blob: c5dba7942add11e52b71db71dedee94d33efe488 [file] [log] [blame]
Harald Welteec8b4502010-02-20 20:34:29 +01001#ifndef _GSMTAP_H
2#define _GSMTAP_H
3
Harald Welte8c8caaa2010-03-04 15:02:54 +01004/* gsmtap header, pseudo-header in front of the actua GSM payload */
5
6/* GSMTAP is a generic header format for GSM protocol captures,
7 * it uses the IANA-assigned UDP port number 4729 and carries
8 * payload in various formats of GSM interfaces such as Um MAC
9 * blocks or Um bursts.
10 *
11 * Example programs generating GSMTAP data are airprobe
12 * (http://airprobe.org/) or OsmocomBB (http://bb.osmocom.org/)
13 */
Harald Welteec8b4502010-02-20 20:34:29 +010014
15#include <stdint.h>
16
Harald Welte8c8caaa2010-03-04 15:02:54 +010017#define GSMTAP_VERSION 0x02
Harald Welteec8b4502010-02-20 20:34:29 +010018
19#define GSMTAP_TYPE_UM 0x01
20#define GSMTAP_TYPE_ABIS 0x02
21#define GSMTAP_TYPE_UM_BURST 0x03 /* raw burst bits */
Harald Weltefe851ff2010-11-18 23:54:20 +010022#define GSMTAP_TYPE_SIM 0x04
Harald Welteec8b4502010-02-20 20:34:29 +010023
Harald Weltedba84782011-01-18 21:38:12 +010024/* sub-types for TYPE_UM_BURST */
Harald Welteec8b4502010-02-20 20:34:29 +010025#define GSMTAP_BURST_UNKNOWN 0x00
26#define GSMTAP_BURST_FCCH 0x01
27#define GSMTAP_BURST_PARTIAL_SCH 0x02
28#define GSMTAP_BURST_SCH 0x03
29#define GSMTAP_BURST_CTS_SCH 0x04
30#define GSMTAP_BURST_COMPACT_SCH 0x05
31#define GSMTAP_BURST_NORMAL 0x06
32#define GSMTAP_BURST_DUMMY 0x07
33#define GSMTAP_BURST_ACCESS 0x08
34#define GSMTAP_BURST_NONE 0x09
35
Harald Weltedba84782011-01-18 21:38:12 +010036/* sub-types for TYPE_UM */
Harald Welte8c8caaa2010-03-04 15:02:54 +010037#define GSMTAP_CHANNEL_UNKNOWN 0x00
38#define GSMTAP_CHANNEL_BCCH 0x01
39#define GSMTAP_CHANNEL_CCCH 0x02
40#define GSMTAP_CHANNEL_RACH 0x03
41#define GSMTAP_CHANNEL_AGCH 0x04
42#define GSMTAP_CHANNEL_PCH 0x05
43#define GSMTAP_CHANNEL_SDCCH 0x06
44#define GSMTAP_CHANNEL_SDCCH4 0x07
45#define GSMTAP_CHANNEL_SDCCH8 0x08
46#define GSMTAP_CHANNEL_TCH_F 0x09
47#define GSMTAP_CHANNEL_TCH_H 0x0a
48#define GSMTAP_CHANNEL_ACCH 0x80
49
Harald Weltedba84782011-01-18 21:38:12 +010050/* flags for the ARFCN */
Harald Welte4e128792010-03-04 15:15:37 +010051#define GSMTAP_ARFCN_F_PCS 0x8000
52#define GSMTAP_ARFCN_F_UPLINK 0x4000
53#define GSMTAP_ARFCN_MASK 0x3fff
54
Harald Weltedba84782011-01-18 21:38:12 +010055/* IANA-assigned well-known UDP port for GSMTAP messages */
Harald Welte8c8caaa2010-03-04 15:02:54 +010056#define GSMTAP_UDP_PORT 4729
Harald Welteec8b4502010-02-20 20:34:29 +010057
58struct gsmtap_hdr {
Harald Welte8c8caaa2010-03-04 15:02:54 +010059 uint8_t version; /* version, set to 0x01 currently */
60 uint8_t hdr_len; /* length in number of 32bit words */
61 uint8_t type; /* see GSMTAP_TYPE_* */
62 uint8_t timeslot; /* timeslot (0..7 on Um) */
Harald Welteec8b4502010-02-20 20:34:29 +010063
Harald Welte8c8caaa2010-03-04 15:02:54 +010064 uint16_t arfcn; /* ARFCN (frequency) */
65 int8_t signal_dbm; /* signal level in dBm */
66 int8_t snr_db; /* signal/noise ratio in dB */
Harald Welteec8b4502010-02-20 20:34:29 +010067
Harald Welte8c8caaa2010-03-04 15:02:54 +010068 uint32_t frame_number; /* GSM Frame Number (FN) */
Harald Welteec8b4502010-02-20 20:34:29 +010069
Harald Welte8c8caaa2010-03-04 15:02:54 +010070 uint8_t sub_type; /* Type of burst/channel, see above */
71 uint8_t antenna_nr; /* Antenna Number */
72 uint8_t sub_slot; /* sub-slot within timeslot */
73 uint8_t res; /* reserved for future use (RFU) */
Harald Welteec8b4502010-02-20 20:34:29 +010074
75} __attribute__((packed));
76
Harald Welteec8b4502010-02-20 20:34:29 +010077#endif /* _GSMTAP_H */