Commit a5801ab6 authored by 's avatar
Browse files

fixes


git-svn-id: file:///home/svn/mapi/trunk@207 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 9cfd4581
......@@ -221,7 +221,7 @@ int pipeline_http_decode(unsigned char *payload,unsigned int dsize,struct httphe
while(*space_finder!=' ' && space_finder<end_of_first_line)
space_finder++;
if(space_finder==end_of_first_line) {
fprintf(stderr,"Not appropriate HTTP protocol\n");
//fprintf(stderr,"Not appropriate HTTP protocol\n");
return -1;
}
......@@ -237,12 +237,12 @@ int pipeline_http_decode(unsigned char *payload,unsigned int dsize,struct httphe
}
else {
fprintf(stderr,"Invalid first line of HTTP response\n");
//fprintf(stderr,"Invalid first line of HTTP response\n");
return -1;
}
}
else {
fprintf(stderr,">>>> First line does not match to HTTP protocol %d\n",offset);
//fprintf(stderr,">>>> First line does not match to HTTP protocol %d\n",offset);
return -1;
}
......@@ -257,7 +257,7 @@ int pipeline_http_decode(unsigned char *payload,unsigned int dsize,struct httphe
unsigned char *semicolon_pos;
semicolon_pos=strnchr(start_of_headers,end_of_line,':');
if(semicolon_pos==NULL) {
fprintf(stderr,"Invalid HTTP protocol. No semicolon\n");
//fprintf(stderr,"Invalid HTTP protocol. No semicolon\n");
return -1;
}
......@@ -265,7 +265,7 @@ int pipeline_http_decode(unsigned char *payload,unsigned int dsize,struct httphe
int match=match_http_keyword(start_of_headers);
*semicolon_pos=':'; //restore the semicolon
if(match==-1) {
fprintf(stderr,"Unknown header ::: "); print_substring(start_of_headers,semicolon_pos); printf("\n");
//fprintf(stderr,"Unknown header ::: "); print_substring(start_of_headers,semicolon_pos); printf("\n");
}
else {
h->pointers_to_value[level][match]=semicolon_pos+2;
......@@ -302,7 +302,6 @@ int pipeline_http_decode(unsigned char *payload,unsigned int dsize,struct httphe
if(((end_of_headers-data)+4)<dsize) {
h->pointers_to_value[level][HTTP_PAYLOAD-BASE_HTTP_DEFS-1]=end_of_headers+4;
h->value_length[level][HTTP_PAYLOAD-BASE_HTTP_DEFS-1]=(payload+dsize)-end_of_headers-4;
fprintf(stderr,"++Payload size: %d %d %d\n",(payload+dsize)-end_of_headers-4,dsize,offset);
}
return 0;
......
......@@ -54,6 +54,8 @@ unsigned char *last_dev_pkt;
int callbacks=0;
struct mapidlibflow *cook_tmp_flow=NULL;
static int cooking_id=0;
static int cook_instance(mapidflib_function_instance_t* instance, flist_t *flist, mapidflib_flow_mod_t *flow_mod,function_manipulation_t* manip)
{
......@@ -368,14 +370,16 @@ static int cook_init(mapidflib_function_instance_t *instance,
data->threshold=getargint(&fargs);
data->timeout=getargint(&fargs);
data->flow=cook_tmp_flow;
data->id=cooking_id;
cooking_id++;
desc.fd = 1;
desc.linktype = instance->hwinfo->link_type;
desc.bufsize = instance->hwinfo->cap_length;
nids_mapi_init(&desc, instance->hwinfo->link_type,0);
nids_mapi_init(&desc, instance->hwinfo->link_type,data->id);
nids_register_tcp(tcp_callback);
nids_mapi_register_tcp(tcp_callback,data->id);
if(data->threshold <= 0)
{
......@@ -433,7 +437,7 @@ static int cook_process(mapidflib_function_instance_t *instance,const unsigned c
if(iph->ip_p != IPPROTO_TCP) // no TCP packet
return 1;
nids_mapi_next(&h, link_pkt,0);
nids_mapi_next(&h, link_pkt,data->id);
//if(callbacks>1)
//fprintf(stderr,">> %d %d %d\n",callbacks,status,pkt_head->caplen);
......@@ -446,7 +450,7 @@ static int cook_process(mapidflib_function_instance_t *instance,const unsigned c
tcph = (struct tcphdr *)(link_pkt + ether_len + ip_len);
//XXX replace 0
stream= find_stream(tcph,iph,&from_client,0);
stream= find_stream(tcph,iph,&from_client,data->id);
if(stream) {
//fprintf(stderr,"\tStream found\n");
headers = malloc(sizeof(struct headers_data));
......@@ -496,7 +500,7 @@ static int cook_process(mapidflib_function_instance_t *instance,const unsigned c
headers->ts.tv_usec = pkt_head->ts;
//XXX replace 0
stream= find_stream(tcph,iph,&from_client,0);
stream= find_stream(tcph,iph,&from_client,data->id);
if(stream==NULL) {
//fprintf(stderr,"\tNULL stream %d %d\n",headers->ts.tv_sec,headers->ts.tv_usec);
create_mod_pkt(link_pkt,flow,pkt_head);
......
......@@ -10,6 +10,7 @@ struct cooking_data
{
int threshold;
int timeout;
int id;
struct mapidlibflow *flow;
};
......
Supports Markdown
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