00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef GLOBAL_H
00026 #define GLOBAL_H
00027
00028 #include <stdio.h>
00029 #include <pthread.h>
00030 #include <time.h>
00031 #include <sys/time.h>
00032
00033 #include "debug.h"
00034
00038 extern int g_control_fd;
00039
00042 extern pthread_mutex_t g_nets_mutex;
00043
00051 #define CHECK_FILEDESCRIPTOR_RET() \
00052 do { \
00053 if (g_control_fd == 0) { \
00054 PRINT_DBG("File descriptor invalid. Library was not initalized"); \
00055 return; \
00056 } \
00057 } while (FALSE)
00058
00070 #define CHECK_FILEDESCRIPTOR_RET_VAL(val) \
00071 do { \
00072 if (g_control_fd == 0) { \
00073 PRINT_DBG("File descriptor invalid. Library was not initalized"); \
00074 return val; \
00075 } \
00076 } while (FALSE)
00077
00078
00084 #define TIME_IN_MS(time) \
00085 do { \
00086 struct timeval tmp; \
00087 gettimeofday(&tmp, NULL); \
00088 time = (unsigned long long)tmp.tv_sec * 1000 + tmp.tv_usec / 1000; \
00089 } while(0);
00090
00091
00092
00093 #endif
00094
00095