Commit d2562b4c authored by 's avatar

+ rulerflib requires support for packet modification.
+ Avoid hard-coding the filter to apply in the example program of rulerflib.



git-svn-id: file:///home/svn/mapi/trunk@1287 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 46fa9101
...@@ -349,6 +349,7 @@ esac], [rulerflib=false]) ...@@ -349,6 +349,7 @@ esac], [rulerflib=false])
AM_CONDITIONAL(BINARY_RULERFLIB, test x$rulerflib = xtrue) AM_CONDITIONAL(BINARY_RULERFLIB, test x$rulerflib = xtrue)
if test x$rulerflib = xtrue; then if test x$rulerflib = xtrue; then
MAPI_FUNC_LIBS="${MAPI_FUNC_LIBS}:rulerflib.so" MAPI_FUNC_LIBS="${MAPI_FUNC_LIBS}:rulerflib.so"
AC_DEFINE(WITH_MODIFY_PKTS, 1, [support for functions that modify packets])
AC_DEFINE(RULERFLIB_COMPILED, 1, [rulerflib is enabled in the build]) AC_DEFINE(RULERFLIB_COMPILED, 1, [rulerflib is enabled in the build])
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
else else
......
...@@ -6,7 +6,10 @@ ...@@ -6,7 +6,10 @@
#include <sys/time.h> #include <sys/time.h>
#include "mapi.h" #include "mapi.h"
#define BUFSIZE 10000
static char errstr[520]; static char errstr[520];
static char filterpath[BUFSIZE];
static void dump_packet( FILE *f, const unsigned char *buf, unsigned int sz ) static void dump_packet( FILE *f, const unsigned char *buf, unsigned int sz )
{ {
...@@ -58,7 +61,10 @@ int main( int argc, char **argv ) ...@@ -58,7 +61,10 @@ int main( int argc, char **argv )
exit( EXIT_FAILURE ); exit( EXIT_FAILURE );
} }
int sid = mapi_apply_function( fd, "RULER", "/home/reeuwijk/lobster/src/ruler/mapi/filter.rl" ); getcwd( filterpath, BUFSIZE );
strcat( filterpath, "/filter.rl" );
int sid = mapi_apply_function( fd, "RULER", filterpath );
if( sid<0 ){ if( sid<0 ){
fprintf( stderr, "Could not apply function RULER: error code %d\n", sid ); fprintf( stderr, "Could not apply function RULER: error code %d\n", sid );
mapi_read_error( &errcode, errstr ); mapi_read_error( &errcode, errstr );
...@@ -66,7 +72,7 @@ int main( int argc, char **argv ) ...@@ -66,7 +72,7 @@ int main( int argc, char **argv )
exit( EXIT_FAILURE ); exit( EXIT_FAILURE );
} }
int bufid = mapi_apply_function( fd, "TO_BUFFER" ); int bufid = mapi_apply_function( fd, "TO_BUFFER", WAIT );
if( bufid<0 ){ if( bufid<0 ){
fprintf( stderr, "Could not apply function TO_BUFFER\n" ); fprintf( stderr, "Could not apply function TO_BUFFER\n" );
mapi_read_error( &errcode, errstr ); mapi_read_error( &errcode, errstr );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment