Commit 2a4953ba authored by 's avatar
Browse files

Modified prototype of mapid_apply_function() and mapidrv_apply_function() to

include one additional parameter. This parameter signals whether the function
is applied internally, or per user request.




git-svn-id: file:///home/svn/mapi/trunk@518 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 6ba56a31
......@@ -130,7 +130,7 @@ int (*mapidrv_create_flow) (int devid, int fd, char **devtype);
int (*mapidrv_create_offline_flow) (int devid, int format, int fd,
char **devtype);
int (*mapidrv_close_flow) (int devid, int fd);
int (*mapidrv_apply_function) (int devid, int fd, char *function, ...);
int (*mapidrv_apply_function) (int devid, int fd, unsigned char internal, char *function, ...);
int (*mapidrv_read_results) (int devid, int fd, int fid, void *result);
int (*mapidrv_connect) (int devid, int fd);
int (*mapidrv_start_offline_device) (int devid);
......@@ -1628,7 +1628,7 @@ cmd_apply_function (struct mapiipcbuf *qbuf, int pid, int sock)
mapidrv_apply_function =
get_drv_funct (drv->handle, "mapidrv_apply_function");
functionid = mapidrv_apply_function (drv->devid, qbuf->fd, qbuf->function, qbuf->data);
functionid = mapidrv_apply_function (drv->devid, qbuf->fd, 0, qbuf->function, qbuf->data);
if (functionid == -1)
{
......@@ -1823,7 +1823,7 @@ success:
strcpy(buf.function, "ANONYMIZE");
strcpy((char*)buf.data, "IP,SRC_IP,ZERO");
function_id = mapidrv_apply_function(drv->devid, fd, buf.function, buf.data);
function_id = mapidrv_apply_function(drv->devid, fd, 1, buf.function, buf.data);
fprintf(stderr, "function_id : %d\n", function_id);
......
......@@ -54,10 +54,10 @@ mapidrv_get_errno(int devid,int fd)
}
int
mapidrv_apply_function (int devid,int fd, char* function, mapiFunctArg *fargs)
mapidrv_apply_function (int devid,int fd, unsigned char internal, char* function, mapiFunctArg *fargs)
{
dag_instance_t *i=flist_get(devlist,devid);
return mapid_apply_function(&i->mapidlib,fd, function, fargs);
return mapid_apply_function(&i->mapidlib,fd, function, fargs, internal);
}
int mapidrv_add_device(mapi_offline_device_status_t *olstatus,const char *devname, int file,int devid, global_function_list_t *gflist)
......
......@@ -195,7 +195,7 @@ static int mapid_add_funct(mapidlib_instance_t *i, int fd, char *funct, ...)
}
}
return mapid_apply_function(i,fd,funct,args);
return mapid_apply_function(i, fd, funct, args, 0);
}
......@@ -724,7 +724,8 @@ int
mapid_apply_function(mapidlib_instance_t *i,
int fd,
char* function,
mapiFunctArg *fargs)
mapiFunctArg *fargs,
unsigned char internal)
//Apply function to a flow
//fd =flow descriptor
//function = info about function
......@@ -775,9 +776,16 @@ mapid_apply_function(mapidlib_instance_t *i,
funct_instance->refcount++;
//Add function to list
flist_append(fl->functionlist,fid,funct);
if(f2->process!=NULL)
flist_append(fl->procfunctionlist,fid,funct);
if(!internal)
flist_append(fl->functionlist,fid,funct);
else
flist_prepend(fl->functionlist, fid, funct);
if(f2->process!=NULL)
if(!internal)
flist_append(fl->procfunctionlist,fid,funct);
else
flist_prepend(fl->procfunctionlist, fid, funct);
similar=1;
}
}
......@@ -809,12 +817,12 @@ mapid_apply_function(mapidlib_instance_t *i,
//Add function to list
if(strcmp(function, "ANONYMIZE") == 0)
if(internal == 1)
flist_prepend(fl->functionlist, fid, funct);
else
flist_append(fl->functionlist,fid,funct);
if(f2->process!=NULL){
if(strcmp(function, "ANONYMIZE") == 0)
if(internal == 1)
flist_prepend(fl->procfunctionlist, fid, funct);
else
flist_append(fl->procfunctionlist,fid,funct);
......
......@@ -82,7 +82,8 @@ int mapid_read_results(mapidlib_instance_t *i,
int mapid_apply_function(mapidlib_instance_t *i,
int fd,
char* function,
mapiFunctArg *fargs);
mapiFunctArg *fargs,
unsigned char internal);
void mapid_process_pkt(mapidlib_instance_t *i,
unsigned char* dev_pkt,
unsigned char* link_pkt,
......
......@@ -18,7 +18,7 @@ int mapidrv_close_flow(int devid,int fd);
int mapidrv_get_errno(int devid,int fd);
/* These functions are similar to the ones in mapi.h */
int mapidrv_apply_function(int devid,int fd, char* function, mapiFunctArg *fargs);
int mapidrv_apply_function(int devid,int fd, unsigned char internal, char* function, mapiFunctArg *fargs);
int mapidrv_read_results(int devid,int fd,int fid,mapid_result_t** result);
int mapidrv_connect(int devid,int fd);
mapid_funct_info_t* mapidrv_get_flow_functions(int devid,int fd); //Deprecated and should be removed
......
......@@ -55,10 +55,10 @@ mapidrv_get_errno(int devid,int fd)
}
int
mapidrv_apply_function (int devid,int fd, char* function, mapiFunctArg *fargs)
mapidrv_apply_function (int devid,int fd, unsigned char internal, char* function, mapiFunctArg *fargs)
{
nic_instance_t *i=flist_get(devlist,devid);
return mapid_apply_function(&i->mapidlib,fd, function, fargs);
return mapid_apply_function(&i->mapidlib,fd, function, fargs, internal);
}
int mapidrv_add_device(mapi_offline_device_status_t* olstatus,const char *devname, int file,int devid, global_function_list_t *gflist)
......
......@@ -65,6 +65,8 @@ int main(int argc, char **argv)
fprintf(stderr, "Could not load configuration file info.\n");
return(-1);
}
plist();
if((_socket = socket(PF_UNIX, SOCK_STREAM, 0)) == -1)
{
......@@ -697,7 +699,7 @@ int send_policy(int mapid_socket, auth_msg_t *request)
}
else
{
len += sprintf(policy + len, "%s|", tmp_node->data);
len += sprintf(policy + len, "%s|", (char *)tmp_node->data);
}
tmp_node = tmp_node->next;
......@@ -1000,3 +1002,18 @@ int reorder(flist_t *func_list)
return(0);
}
void plist(void)
{
flist_node_t *tmp = vos->head;
tmp = ((vo_info_t *)(tmp->data))->policy->head;
while(tmp)
{
fprintf(stderr, "%s\n", (char *)tmp->data);
tmp = flist_next(tmp);
}
return;
}
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