summaryrefslogtreecommitdiff
path: root/common/include/public.h
blob: 3e8083ee3599c692e386baee199b5a49abb5b6a2 (plain)
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
#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 <signal.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 LOG_DEBUG(format, ...)                       \
	{                                                \
		fprintf(stdout, format "\n", ##__VA_ARGS__); \
		fflush(stdout);                              \
	}

#define LOG_ERROR(format, ...)                       \
	{                                                \
		fprintf(stderr, format "\n", ##__VA_ARGS__); \
		fflush(stderr);                              \
	}

#ifdef __cpluscplus
}
#endif

#endif