test_cooking.c 791 Bytes
Newer Older
's avatar
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
/*******************************************
 *
 *	Testing PKT_COUNTER
 *
 *******************************************/


#include <stdio.h>
#include <unistd.h>
#include "../mapi.h"

int main(MAPI_UNUSED int argc, char *argv[])
{
's avatar
committed
14
	int fd,fid,fid2,*cnt,*cnt2;
's avatar
committed
15
16
17
18
19
20
21
22

	if(!argv[1])
	{
		printf("\nWrong arguments\n");
		
		return -1;
	}

's avatar
committed
23
	fd=mapi_create_offline_flow(argv[1],MFF_PCAP);
's avatar
committed
24
25

	fid=mapi_apply_function(fd,"PKT_COUNTER");
's avatar
committed
26
27
	mapi_apply_function(fd,"COOKING",100000,10);
	fid2=mapi_apply_function(fd,"PKT_COUNTER");
's avatar
committed
28
29
30
31
32
33
34

	mapi_connect(fd);

	while(1)
	{
		sleep(1);
		cnt = mapi_read_results(fd,fid,MAPI_REF);
's avatar
committed
35
36
		cnt2 = mapi_read_results(fd,fid2,MAPI_REF);
		printf("\nPackets:: Before COOKING: %d After COOKING: %d",*cnt,*cnt2);
's avatar
committed
37
38
39
40
41
42
43
44
	}

	mapi_close_flow(fd);

	printf("\nCOOKING OK\n");

	return 0;
}