Commit d73c9f4f authored by 's avatar
Browse files

removed hardcoded ANONYMIZE case in mapi.c


git-svn-id: file:///home/svn/mapi/trunk@393 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 53760662
......@@ -1001,12 +1001,13 @@ static mapidflib_function_def_t finfo={
"", //libname
"ANONYMIZE", //name
"Anonymizes packets (header and payload) based on certain rules", //descr
"iiis", //argdescr
"s", //argdescr
MAPI_DEVICE_ALL, //devtype
MAPIRES_NONE, //Method for returning results
0, //shm size
0, //modifies_pkts
MAPIFUNC_OPT_AUTO, //Optimization
0, //filters packets
MAPIOPT_AUTO, //Optimization
anonymize_instance, //instance
anonymize_init, //init
anonymize_process, //process
......
......@@ -983,96 +983,6 @@ int mapi_apply_function(int fd, const char* funct, ...)
va_start(vl,funct);
pos = qbuf.data; // point to start of arguments buffer
#ifdef WITH_ANONYMIZATION
if(strcmp(funct,"ANONYMIZE")==0) {
int function,pattern_type,i;
char *marshalBuffer,*tmps;
char **repvec;
tmp = va_arg(vl, int); //protocol
addarg(&pos, &tmp, INT);
tmp = va_arg(vl, int); //field
addarg(&pos, &tmp, INT);
function = va_arg(vl, int); //function
addarg(&pos, &function, INT);
marshalBuffer=(char *)malloc(1024*sizeof(char));
marshalBuffer[0]='\0';
switch(function) {
case UNCHANGED:
case MAP:
case ZERO:
case PREFIX_PRESERVING:
case FILENAME_RANDOM:
case RANDOM:
case CHECKSUM_ADJUST:
printf("NO PARAMETERS TO APPLY\n");
break;
case STRIP:
tmp = va_arg(vl, int); //seed
sprintf(marshalBuffer,"%d",tmp);
break;
case REPLACE:
tmps=va_arg(vl, char *);
sprintf(marshalBuffer,"%s",tmps);
break;
case HASHED:
tmp = va_arg(vl, int); //hashing algorithm
sprintf(marshalBuffer,"%d",tmp);
tmp = va_arg(vl, int); //padding behavior
sprintf(marshalBuffer,"%s#%d",marshalBuffer,tmp);
break;
case MAP_DISTRIBUTION:
tmp = va_arg(vl, int); //distribution type
sprintf(marshalBuffer,"%d",tmp);
tmp = va_arg(vl, int); //median
sprintf(marshalBuffer,"%s#%d",marshalBuffer,tmp);
tmp = va_arg(vl, int); //standard deviation
sprintf(marshalBuffer,"%s#%d",marshalBuffer,tmp);
break;
case PATTERN_FILL:
pattern_type=va_arg(vl, int); //pattern type
sprintf(marshalBuffer,"%d",pattern_type);
switch(pattern_type) {
case INTEGER:
tmp = va_arg(vl, int); //integer to fill in
sprintf(marshalBuffer,"%s#%d",marshalBuffer,tmp);
break;
case STR:
tmps=va_arg(vl, char *);
sprintf(marshalBuffer,"%s#%s",marshalBuffer,tmps);
break;
default:
printf("UNKNOWN PATTERN TYPE\n");
return -1;
}
break;
case REGEXP:
tmps=va_arg(vl, char *);
sprintf(marshalBuffer,"%s",tmps);
repvec=va_arg(vl, char **);
tmp=va_arg(vl, int);
if(tmp==0) {
return -1;
}
sprintf(marshalBuffer,"%s#%d",marshalBuffer,tmp);
for(i=0;i<tmp;i++) {
if(repvec[i]!=NULL) {
sprintf(marshalBuffer,"%s#%s",marshalBuffer,repvec[i]);
}
else {
sprintf(marshalBuffer,"%s#NULL",marshalBuffer);
}
}
break;
}
addarg(&pos,marshalBuffer,STRING);
}
else
#endif
// parse function arguments
if(strncmp(fdef->argdescr, "", 1)) { // there are some args
argdescr_ptr = fdef->argdescr;
......
......@@ -11,10 +11,10 @@ dimapi_port=2233
device=eth0
driver=mapinicdrv.so
#[driver]
#device=lo
#driver=mapinicdrv.so
#description=This is a driver for local capture
[driver]
device=lo
driver=mapinicdrv.so
description=This is a driver for local capture
@ifcombo6@[driver]
@ifcombo6@device=/dev/scampi/0
......
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