Commit aec901ee authored by 's avatar
Browse files

first files for TOP function


git-svn-id: file:///home/svn/mapi/trunk@243 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent cf0d310e
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "mapidflib.h"
#include "mapidlib.h"
#include "mapidevices.h"
#include "mapid.h"
#include "fhelp.h"
#include "topx.h"
static int topx_process(mapidflib_function_instance_t *instance,
MAPI_UNUSED const unsigned char* dev_pkt,
MAPI_UNUSED const unsigned char* link_pkt,
MAPI_UNUSED mapid_pkthdr_t* pkt_head)
{
return 1;
}
static int topx_reset(mapidflib_function_instance_t *instance)
{
return 0;
}
static int topx_init(mapidflib_function_instance_t *instance,
MAPI_UNUSED flist_t *flist)
{
mapiFunctArg* fargs;
int x,field;
//return MFUNCT_INVALID_ARGUMENT_1;
fargs=instance->args;
x = getargint(&fargs);
field = getargint(&fargs);
instance->internal_data = malloc(sizeof(struct topx_data));
((struct topx_data *)(instance->internal_data))->x=x;
((struct topx_data *)(instance->internal_data))->field=field;
return 0;
}
static mapidflib_function_def_t finfo={
"", //libname
"TOP", //name
"Returns the TOP x values of a field (e.g DST_PORT)\n\tReturn value: x values of variable type according to field applied", //descr
"ii", //argdescr
MAPI_DEVICE_ALL, //devoid
MAPIRES_SHM, //Use shared memory to return results
sizeof(unsigned long long), //shm size
0, //modifies_pkts
NULL, //instance
topx_init, //init
topx_process,
NULL, //get_result,
NULL, //change_args
topx_reset,
NULL, //cleanup
NULL, //client_init
NULL, //client_read_result
NULL //client_cleanup
};
mapidflib_function_def_t* pktc_get_funct_info();
mapidflib_function_def_t* pktc_get_funct_info() {
return &finfo;
};
struct topx_data {
int x;
int field;
};
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