summaryrefslogtreecommitdiff
path: root/gsmdecode/src/common.h
blob: 61abc5ffef2e0729ca3281b15f19743d94828db6 (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
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef __GSMSP_COMMON_H__
#define __GSMSP_COMMON_H__ 1

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <unistd.h>

#define MIN(a,b)	((a)<(b)?(a):(b))
#define MAX(a,b)	((a)>(b)?(a):(b))

/* DISABLE me for release build. Otherwise with debug output. */
//#define GSMSP_DEBUG 1

#ifdef GSMSP_DEBUG
# define DEBUGF(a...)	do { \
	fprintf(stderr, "DEBUG %s:%d ", __func__, __LINE__); \
	fprintf(stderr, a); \
} while (0)
#else
# define DEBUGF(a...)
#endif

/* True if bit at position 'pos' in 'data' is set */
#define BIT(data, pos)		((data) >> (pos)) & 1

# define HEXDUMPF(data, len, a...)	do { \
	printf("HEX %s:%d ", __func__, __LINE__); \
	printf(a); \
	hexdump(data, len); \
} while (0)

void hexdump(const unsigned char *data, size_t len);

struct _opt
{
	char format;
	char flags;
};

#define MSG_FORMAT_BBIS		(1)
#define MSG_FORMAT_B		(2)
#define MSG_FORMAT_XML		(3)

#define FL_MOTOROLA		(0x01)

#endif /* !__GSMSP_COMMON_H__ */


personal git repositories of Harald Welte. Your mileage may vary