Commit 46fa9101 authored by 's avatar

+ Better error messages.



git-svn-id: file:///home/svn/mapi/trunk@1286 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent e24a95be
......@@ -49,7 +49,7 @@
#define MDLIB_FLOW_ALREADY_ACTIVE 3081
3081 = "Flow already active"
#define MDLIB_NO_MODIFYING 3082
3082 = "No support for functions that modifies packets"
3082 = "No support for functions that modify packets"
#define MDLIB_FILE_EXSISTS 3083
3083 = "File already exists"
#define MAPID_NOT_AUTHENTICATED 3139
......
......@@ -5,7 +5,7 @@ libdir = $(pkgdatadir)
# mapi function libraries are dynamically loadable modules (but not standalone
# libraries for users)
lib_LTLIBRARIES = rulerflib.la
check_PROGRAMS = testcompiler
check_PROGRAMS = testcompiler example
rulerflib_la_LDFLAGS = -module
rulerflib_la_SOURCES = rulerflib.c helper-functions.h
rulerflib_la_LIBADD = \
......@@ -16,6 +16,8 @@ rulerflib_la_LIBADD = \
testcompiler_SOURCES = testcompiler.c helper-functions.h
testcompiler_LDADD = -ldl
example_LDADD = ../lib/libmapi.la
EXTRA_DIST = 00README.txt
TESTS = runtest
......@@ -6,6 +6,7 @@
#include <sys/time.h>
#include "mapi.h"
static char errstr[520];
static void dump_packet( FILE *f, const unsigned char *buf, unsigned int sz )
{
......@@ -46,23 +47,30 @@ int main( int argc, char **argv )
{
int res;
char *interface = "eth0";
int errcode;
int fd = mapi_create_flow( interface );
//int fd = mapi_create_offline_flow( "tests/tracefile", MFF_PCAP );
if( fd<0 ){
fprintf( stderr, "Could not create a MAPI flow for interface `%s'\n", interface );
mapi_read_error( &errcode, errstr );
fprintf( stderr, "Error: %d: %s\n", errcode, errstr );
exit( EXIT_FAILURE );
}
int sid = mapi_apply_function( fd, "RULER", "/home/reeuwijk/lobster/src/ruler/mapi/filter.rl" );
if( sid<0 ){
fprintf( stderr, "Could not apply function\n" );
fprintf( stderr, "Could not apply function RULER: error code %d\n", sid );
mapi_read_error( &errcode, errstr );
fprintf( stderr, "Error: %d: %s\n", errcode, errstr );
exit( EXIT_FAILURE );
}
int bufid = mapi_apply_function( fd, "TO_BUFFER" );
if( bufid<0 ){
fprintf( stderr, "Could not apply function\n" );
fprintf( stderr, "Could not apply function TO_BUFFER\n" );
mapi_read_error( &errcode, errstr );
fprintf( stderr, "Error: %d: %s\n", errcode, errstr );
exit( EXIT_FAILURE );
}
......
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