Commit ede6f34f authored by 's avatar

Added napatechflib and dummy (does nothing) INTERFACE function.


git-svn-id: file:///home/svn/mapi/trunk@1482 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 57a01cd3
......@@ -313,7 +313,7 @@ AM_CONDITIONAL(DRIVER_NAPATECH, test x$napatech = xtrue)
# AM_CONDITIONAL(PRECLASSIFICATION, test x$dag = xtrue)
if test x$napatech = xtrue; then
MAPI_CONF_NAPATECH_ENTRY=$srcdir/config/mapi.conf.napatech.entry
# MAPI_FUNC_LIBS="${MAPI_FUNC_LIBS}:dagflib.so"
MAPI_FUNC_LIBS="${MAPI_FUNC_LIBS}:napatechflib.so"
# AC_DEFINE(PRECLASSIFICATION, 1, [hardware preliminary packet classification])
AC_DEFINE(WITH_NAPATECH, 1, [if NAPATECH cards are supported])
AC_MSG_RESULT(yes)
......@@ -915,6 +915,7 @@ AC_CONFIG_FILES([
src/bpfcompiler/Makefile
src/bpfcompiler/pcap/Makefile
src/dagflib/Makefile
src/napatechflib/Makefile
src/extraflib/Makefile
applications/Makefile
applications/appmon/Makefile
......
AM_CPPFLAGS = -I$(srcdir)/.. -I$(srcdir)/../lib -I$(srcdir)/../drivers -I$(srcdir)/../common @NAPATECHINC@ -D_GNU_SOURCE -D_THREAD_SAFE
libdir = $(pkgdatadir)
# napatechflib
# mapi function libraries are dynamically loadable modules (but not standalone
# libraries for users)
lib_LTLIBRARIES = napatechflib.la
napatechflib_la_LDFLAGS = -module
napatechflib_la_LIBADD = \
../common/libflist.la \
../common/libmsearch.la \
../common/libfhelp.la \
../common/libparseconf.la \
../common/libprintfstring.la \
../common/libdebug.la \
../common/libmapiipc.la @NAPATECHLIB@
napatechflib_la_SOURCES = napatechflib.c interface.c
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <sys/shm.h>
#include <string.h>
#include <errno.h>
#include "mapidflib.h"
#include "mapidlib.h"
#include "mapidevices.h"
#include "mapid.h"
#include "fhelp.h"
#include "mapi_errors.h"
typedef struct {
int ifindex;
} interface_instance_t;
static int interface_instance(mapidflib_function_instance_t *instance,
MAPI_UNUSED int fd,
MAPI_UNUSED mapidflib_flow_mod_t *flow_mod)
{
mapiFunctArg* fargs;
int ifindex;
int interface_f;
fargs = instance->args;
ifindex = getargint(&fargs);
/* refuse: bad port specification */
if(ifindex < 0)
return MFUNCT_INVALID_ARGUMENT;
/* refuse: the same function was already applied to this flow */
fhlp_filtering_funct_is_in_list_but_INTERFACE(instance->hwinfo->gflist, fd, &interface_f);
if (interface_f == INTERFACE_FUNCT_EXISTS)
return MFUNCT_COULD_NOT_APPLY_FUNCT;
return 0;
}
static int interface_init(mapidflib_function_instance_t *instance,
MAPI_UNUSED int fd)
{
interface_instance_t *internal_data_ptr;
mapiFunctArg* fargs;
int ifindex;
if((instance->internal_data = malloc(sizeof(interface_instance_t))) == NULL) {
fprintf(stderr, "interface_init(): could not allocate internal data.\n");
return MAPID_MEM_ALLOCATION_ERROR;
}
internal_data_ptr = (interface_instance_t *) (instance->internal_data);
fargs = instance->args;
ifindex = getargint(&fargs);
internal_data_ptr->ifindex = ifindex;
return 0;
}
static int interface_process(mapidflib_function_instance_t *instance,
unsigned char* dev_pkt,
MAPI_UNUSED unsigned char* link_pkt,
MAPI_UNUSED mapid_pkthdr_t* pkt_head)
{
return 1;
//return 0;
}
static int interface_cleanup(mapidflib_function_instance_t* instance)
{
if (instance->internal_data != NULL) {
free(instance->internal_data);
instance->internal_data = NULL;
}
return 0;
}
static mapidflib_function_def_t finfo={
"", //libname
"INTERFACE", //name
"Filters packets from specific interfaces on an adapter", //descr
"i", //argdescr
MAPI_DEVICE_DAG, //devtype
MAPIRES_NONE, //Method for returning results
0, //shm size
0, //modifies_pkts
1, //filters packets
MAPIOPT_AUTO,
interface_instance, //instance
interface_init, //init
interface_process, //process
NULL, //get_result,
NULL, //reset
interface_cleanup, //cleanup
NULL, //client_init
NULL, //client_read_result
NULL //client_cleanup
};
mapidflib_function_def_t* interface_get_funct_info();
mapidflib_function_def_t* interface_get_funct_info() {
return &finfo;
};
//Fri Mar 6 19:21:48 2009
//This file was created automatically by createlib.pl
#include <stdio.h>
#include "mapidflib.h"
#include "debug.h"
char libname[]="napatechflib";
__attribute__ ((constructor)) void init ();
__attribute__ ((destructor)) void fini ();
mapidflib_functionlist_t functions[1];
extern mapidflib_function_def_t * interface_get_funct_info();
mapidflib_functionlist_t* mapidflib_get_function_list()
{
functions[0].def=interface_get_funct_info();
functions[0].def->libname=libname;
functions[0].next=NULL;
return &functions[0];
}
char *mapidflib_get_libname() {
return libname;
}
__attribute__ ((constructor))
void init ()
{
DEBUG_CMD(printf ("Library napatechflib loaded\n"));
}
__attribute__ ((destructor))
void fini ()
{
DEBUG_CMD(printf ("Library napatechflib unloaded\n"));
}
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