-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.c
executable file
·46 lines (38 loc) · 1.01 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "stdxh.h"
#include "nfct.h"
#include "nfqnl_thread.h"
#include "nfct_thread.h"
//extern void nfq_start(void * pconnt);
//extern struct conntrack * new_conntrack();
int main(int argc ,char * argv []){
pthread_t nfq_pthread;
pthread_t nfct_pthread;
int ret;
struct conntrack * connt;
connt = new_conntrack();
if(connt ==NULL){
fprintf(stderr, "New conntrack error!\n");
exit(1);
}
if(argc == 1){
connt->queuenum = atoi(*argv);
}
//should have queue num and conntrack struct
ret = pthread_create(&nfq_pthread, NULL,(void *)nfq_start,connt);
if(ret!= 0){
perror("Create nfq_pthread error\n");
exit(1);
}
ret = pthread_create(&nfct_pthread,NULL,(void *)nfct_start,connt);
if(ret!= 0){
perror("Create nfct_pthread error\n");
exit(1);
}
pthread_join(nfct_pthread,NULL);
pthread_join(nfq_pthread,NULL);
while(1){
sleep(5000);
printf("running\n");
};
return 0 ;
}