summaryrefslogtreecommitdiff
path: root/common/include/public.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/include/public.h')
-rw-r--r--common/include/public.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/common/include/public.h b/common/include/public.h
new file mode 100644
index 0000000..60f3048
--- /dev/null
+++ b/common/include/public.h
@@ -0,0 +1,41 @@
+#ifndef _PUBLIC_H
+#define _PUBLIC_H
+
+#ifdef __cpluscplus
+extern "C"
+{
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <arpa/inet.h>
+
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#define IP_GET_RAW_VER(raw_pkt) ((((raw_pkt)[0] & 0xf0) >> 4))
+
+#define PRINT_FILE_INFO 0
+
+#if (PRINT_FILE_INFO)
+#define LOG_DEBUG(format, ...) \
+ fprintf(stdout, "[%s-%s()-%05d] " format "\n", __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__);
+
+#define LOG_ERROR(format, ...) \
+ fprintf(stderr, "[%s-%s()-%05d] " format "\n", __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__);
+#else
+#define LOG_DEBUG(format, ...) \
+ fprintf(stdout, format "\n", ##__VA_ARGS__);
+
+#define LOG_ERROR(format, ...) \
+ fprintf(stderr, format "\n", ##__VA_ARGS__);
+#endif
+
+#ifdef __cpluscplus
+}
+#endif
+
+#endif \ No newline at end of file