1 #ifndef _APP_LIB_H_
2 #define _APP_LIB_H_
3 
4 #define MAX_LINE_LEN  (1000)
5 #define MAX_FLOW_NUM  (1000000)
6 #define MAX_EVENTS    (MAX_FLOW_NUM * 3)
7 #ifndef MAX_CPUS
8 #define MAX_CPUS      (16)                      // max number of CPU cores
9 #endif
10 
11 #define MAX(a, b) ((a)>(b)?(a):(b))
12 #define MIN(a, b) ((a)<(b)?(a):(b))
13 
14 #ifndef TRUE
15 #define TRUE (1)
16 #endif
17 
18 #ifndef FALSE
19 #define FALSE (0)
20 #endif
21 
22 #ifndef ERROR
23 #define ERROR (-1)
24 #endif
25 
26 #define TIMEVAL_TO_MSEC(t)		((t.tv_sec * 1000) + (t.tv_usec / 1000))
27 #define TIMEVAL_TO_USEC(t)		((t.tv_sec * 1000000) + (t.tv_usec))
28 #define TS_GT(a,b)				((int64_t)((a)-(b)) > 0)
29 
30 /*----------------------------------------------------------------------------*/
31 #define CONF_VALUE_LEN 100
32 struct conf_var {
33 	char *name;
34 	char value[CONF_VALUE_LEN + 1];
35 };
36 /*----------------------------------------------------------------------------*/
37 
38 char *
39 strevent(uint64_t ev);
40 
41 char *
42 strcbevent(uint64_t ev);
43 
44 int
45 LoadConfig(char *file_name, struct conf_var *vlist, int size);
46 
47 #endif
48