Commit 13e1df15 authored by 's avatar
Browse files

compilation fixes


git-svn-id: file:///home/svn/mapi/trunk@191 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent e730a1d6
......@@ -33,7 +33,7 @@
static int threshold = 0;
static unsigned int timeout = 0;
unsigned int client_size = 0,server_size=0;
//unsigned int client_size = 0,server_size=0;
struct mapidlibflow *mod_flow = NULL;
......@@ -60,12 +60,6 @@ int callbacks=0;
struct mapidlibflow *cook_tmp_flow;
int get_client_size();
int get_client_size() {
return client_size;
}
static int cook_instance(mapidflib_function_instance_t* instance, flist_t *flist, mapidflib_flow_mod_t *flow_mod,function_manipulation_t* manip)
{
......@@ -108,36 +102,36 @@ void create_mod_pkt(unsigned char *dev_pkt,struct mapidlibflow *flow,mapid_pkthd
tcp_len = tcp->off * 4;
tcp->seq = 0;
ip->tlen = ntohs(client_size + ip_len + tcp_len);
ip->tlen = ntohs(flow->client_size + ip_len + tcp_len);
flow->mod_pkt = malloc(sizeof(char) * (client_size + ether_len + ip_len + tcp_len));
flow->mod_pkt = malloc(sizeof(char) * (flow->client_size + ether_len + ip_len + tcp_len));
if(flow->mod_pkt==NULL) {
//fprintf(stderr,"client size: %d\n",client_size);
//fprintf(stderr,"client size: %d\n",flow->client_size);
assert(flow->mod_pkt!=NULL);
}
memcpy(flow->mod_pkt, eth, ether_len);
memcpy(&flow->mod_pkt[ether_len], ip, ip_len);
memcpy(&flow->mod_pkt[ether_len + ip_len], tcp, tcp_len);
memcpy(&flow->mod_pkt[ether_len + ip_len + tcp_len], ret_client_data, client_size);
memcpy(&flow->mod_pkt[ether_len + ip_len + tcp_len], ret_client_data, flow->client_size);
//server packet
flow->server_mod_pkt = malloc(sizeof(char) * (server_size + ether_len + ip_len + tcp_len));
flow->server_mod_pkt = malloc(sizeof(char) * (flow->server_size + ether_len + ip_len + tcp_len));
if(flow->server_mod_pkt==NULL) {
fprintf(stderr,"client size: %d\n",client_size);
fprintf(stderr,"client size: %d\n",flow->client_size);
assert(flow->server_mod_pkt!=NULL);
}
memcpy(flow->server_mod_pkt, eth, ether_len);
memcpy(&flow->server_mod_pkt[ether_len], ip, ip_len);
memcpy(&flow->server_mod_pkt[ether_len + ip_len], tcp, tcp_len);
memcpy(&flow->server_mod_pkt[ether_len + ip_len + tcp_len], ret_server_data, server_size);
flow->server_mod_pkt_head.caplen = flow->server_mod_pkt_head.wlen = server_size + ether_len + ip_len + tcp_len;
memcpy(&flow->server_mod_pkt[ether_len + ip_len + tcp_len], ret_server_data, flow->server_size);
flow->server_mod_pkt_head.caplen = flow->server_mod_pkt_head.wlen = flow->server_size + ether_len + ip_len + tcp_len;
flow->client_headers = ret_client_headers;
flow->server_headers = ret_server_headers;
pkt_head->caplen = client_size + ether_len + ip_len + tcp_len;
pkt_head->wlen = client_size + ether_len + ip_len + tcp_len;
pkt_head->caplen = flow->client_size + ether_len + ip_len + tcp_len;
pkt_head->wlen = flow->client_size + ether_len + ip_len + tcp_len;
}
void process_flushed_data(struct mapidlibflow *flow) {
......@@ -148,6 +142,9 @@ void tcp_callback(struct tcp_stream *ns, void **param)
{
callbacks++;
cooked_pkts++;
struct mapidlibflow *flow;
flow=ns->flow;
if(ns->nids_state == NIDS_JUST_EST)
{
......@@ -197,8 +194,8 @@ void tcp_callback(struct tcp_stream *ns, void **param)
ret_client_data = ns->client.reassembled_data;
ret_server_data = ns->server.reassembled_data;
client_size = ns->client.read;
server_size = ns->server.read;
flow->client_size = ns->client.read;
flow->server_size = ns->server.read;
ret_client_headers = ns->client.headers;
ret_server_headers = ns->server.headers;
......@@ -225,14 +222,14 @@ void tcp_callback(struct tcp_stream *ns, void **param)
to_free = ret_client_data;
to_free2 = ret_server_data;
client_size = ns->client.read;
server_size = ns->server.read;
flow->client_size = ns->client.read;
flow->server_size = ns->server.read;
ret_client_headers = ns->client.headers;
ret_server_headers = ns->server.headers;
//fprintf(stderr,"final data: %d %d %d\n",client_size,flist_size(ns->client.headers),ns->nids_state==NIDS_EXITING);
//fprintf(stderr,"final data: %d %d %d\n",flow->client_size,flist_size(ns->client.headers),ns->nids_state==NIDS_EXITING);
return;
}
}
......@@ -245,8 +242,8 @@ void tcp_callback(struct tcp_stream *ns, void **param)
to_free = ret_server_data;
to_free2 = ret_client_data;
server_size = ns->server.read;
client_size = ns->client.read;
flow->server_size = ns->server.read;
flow->client_size = ns->client.read;
//fprintf(stderr,"++final data: %d %d\n",server_size,flist_size(ns->server.headers));
ret_server_headers = ns->server.headers;
......@@ -285,13 +282,13 @@ void tcp_callback(struct tcp_stream *ns, void **param)
ret_client_headers = ns->client.headers;
ret_client_data = ns->client.reassembled_data;
client_size = ns->client.read + ns->client.count_new;
flow->client_size = ns->client.read + ns->client.count_new;
ns->client.total_read = ns->client.count;
ns->client.read = 0;
ret_server_headers = ns->server.headers;
ret_server_data = ns->server.reassembled_data;
server_size=ns->server.read;
flow->server_size=ns->server.read;
ns->server.total_read = ns->server.count;
ns->server.read = 0;
......@@ -335,11 +332,11 @@ void tcp_callback(struct tcp_stream *ns, void **param)
ret_server_headers = ns->server.headers;
ret_server_data = ns->server.reassembled_data;
server_size = ns->server.read + ns->server.count_new;
flow->server_size = ns->server.read + ns->server.count_new;
ret_client_headers = ns->client.headers;
ret_client_data = ns->client.reassembled_data;
client_size = ns->client.read;
flow->client_size = ns->client.read;
ns->client.total_read = ns->client.count;
ns->client.read=0;
......@@ -425,12 +422,12 @@ static int cook_process(mapidflib_function_instance_t *instance,unsigned char* d
threshold = data->threshold;
timeout = data->timeout;
flow=data->flow;
status = NON_CHECKED;
ret_client_data = NULL;
ret_server_data = NULL;
client_size=server_size=0;
flow->client_size=flow->server_size=0;
callbacks=0;
......@@ -491,7 +488,7 @@ static int cook_process(mapidflib_function_instance_t *instance,unsigned char* d
struct tcp_stream *stream;
int from_client;
//fprintf(stderr,"\tcheck report %d\n",client_size);
//fprintf(stderr,"\tcheck report %d\n",flow->client_size);
tcph = (struct tcphdr *)(dev_pkt + ether_len + ip_len);
headers = malloc(sizeof(struct headers_data));
......
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