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