blob: bc99bcb78fa30cfa8a19d02041c63058115d865b [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 Weltec035ec62011-01-19 09:40:59 +010023#define GSMTAP_TYPE_TETRA_I1 0x05 /* tetra air interface */
24#define GSMTAP_TYPE_TETRA_I1_BURST 0x06 /* tetra air interface */
Harald Weltefae779a2011-10-08 14:35:51 +020025#define GSMTAP_TYPE_WMX_BURST 0x07 /* WiMAX burst */
26#define GSMTAP_TYPE_GB_LLC 0x08 /* GPRS Gb interface: LLC */
27#define GSMTAP_TYPE_GB_SNDCP 0x09 /* GPRS Gb interface: SNDCP */
Harald Welteec8b4502010-02-20 20:34:29 +010028
Harald Weltedba84782011-01-18 21:38:12 +010029/* sub-types for TYPE_UM_BURST */
Harald Welteec8b4502010-02-20 20:34:29 +010030#define GSMTAP_BURST_UNKNOWN 0x00
31#define GSMTAP_BURST_FCCH 0x01
32#define GSMTAP_BURST_PARTIAL_SCH 0x02
33#define GSMTAP_BURST_SCH 0x03
34#define GSMTAP_BURST_CTS_SCH 0x04
35#define GSMTAP_BURST_COMPACT_SCH 0x05
36#define GSMTAP_BURST_NORMAL 0x06
37#define GSMTAP_BURST_DUMMY 0x07
38#define GSMTAP_BURST_ACCESS 0x08
39#define GSMTAP_BURST_NONE 0x09
Harald Weltefae779a2011-10-08 14:35:51 +020040/* WiMAX bursts */
41#define GSMTAP_BURST_CDMA_CODE 0x10 /* WiMAX CDMA Code Attribute burst */
42#define GSMTAP_BURST_FCH 0x11 /* WiMAX FCH burst */
43#define GSMTAP_BURST_FFB 0x12 /* WiMAX Fast Feedback burst */
44#define GSMTAP_BURST_PDU 0x13 /* WiMAX PDU burst */
45#define GSMTAP_BURST_HACK 0x14 /* WiMAX HARQ ACK burst */
46#define GSMTAP_BURST_PHY_ATTRIBUTES 0x15 /* WiMAX PHY Attributes burst */
Harald Welteec8b4502010-02-20 20:34:29 +010047
Harald Weltedba84782011-01-18 21:38:12 +010048/* sub-types for TYPE_UM */
Harald Welte8c8caaa2010-03-04 15:02:54 +010049#define GSMTAP_CHANNEL_UNKNOWN 0x00
50#define GSMTAP_CHANNEL_BCCH 0x01
51#define GSMTAP_CHANNEL_CCCH 0x02
52#define GSMTAP_CHANNEL_RACH 0x03
53#define GSMTAP_CHANNEL_AGCH 0x04
54#define GSMTAP_CHANNEL_PCH 0x05
55#define GSMTAP_CHANNEL_SDCCH 0x06
56#define GSMTAP_CHANNEL_SDCCH4 0x07
57#define GSMTAP_CHANNEL_SDCCH8 0x08
58#define GSMTAP_CHANNEL_TCH_F 0x09
59#define GSMTAP_CHANNEL_TCH_H 0x0a
Harald Welteaa244bf2011-09-26 00:24:59 +020060#define GSMTAP_CHANNEL_CBCH51 0x0b
61#define GSMTAP_CHANNEL_CBCH52 0x0c
62#define GSMTAP_CHANNEL_PDCH 0x0d
63#define GSMTAP_CHANNEL_PTCCH 0x0e
Harald Weltefae779a2011-10-08 14:35:51 +020064#define GSMTAP_CHANNEL_PACCH 0x0f
Harald Welte8c8caaa2010-03-04 15:02:54 +010065#define GSMTAP_CHANNEL_ACCH 0x80
66
Harald Weltec035ec62011-01-19 09:40:59 +010067/* sub-types for TYPE_TETRA_AIR */
68#define GSMTAP_TETRA_BSCH 0x01
69#define GSMTAP_TETRA_AACH 0x02
Holger Hans Peter Freythere7509082011-01-28 10:13:41 +010070#define GSMTAP_TETRA_SCH_HU 0x03
71#define GSMTAP_TETRA_SCH_HD 0x04
72#define GSMTAP_TETRA_SCH_F 0x05
73#define GSMTAP_TETRA_BNCH 0x06
74#define GSMTAP_TETRA_STCH 0x07
75#define GSMTAP_TETRA_TCH_F 0x08
Harald Weltec035ec62011-01-19 09:40:59 +010076
Harald Weltedba84782011-01-18 21:38:12 +010077/* flags for the ARFCN */
Harald Welte4e128792010-03-04 15:15:37 +010078#define GSMTAP_ARFCN_F_PCS 0x8000
79#define GSMTAP_ARFCN_F_UPLINK 0x4000
80#define GSMTAP_ARFCN_MASK 0x3fff
81
Harald Weltedba84782011-01-18 21:38:12 +010082/* IANA-assigned well-known UDP port for GSMTAP messages */
Harald Welte8c8caaa2010-03-04 15:02:54 +010083#define GSMTAP_UDP_PORT 4729
Harald Welteec8b4502010-02-20 20:34:29 +010084
85struct gsmtap_hdr {
Harald Welte8c8caaa2010-03-04 15:02:54 +010086 uint8_t version; /* version, set to 0x01 currently */
87 uint8_t hdr_len; /* length in number of 32bit words */
88 uint8_t type; /* see GSMTAP_TYPE_* */
89 uint8_t timeslot; /* timeslot (0..7 on Um) */
Harald Welteec8b4502010-02-20 20:34:29 +010090
Harald Welte8c8caaa2010-03-04 15:02:54 +010091 uint16_t arfcn; /* ARFCN (frequency) */
92 int8_t signal_dbm; /* signal level in dBm */
93 int8_t snr_db; /* signal/noise ratio in dB */
Harald Welteec8b4502010-02-20 20:34:29 +010094
Harald Welte8c8caaa2010-03-04 15:02:54 +010095 uint32_t frame_number; /* GSM Frame Number (FN) */
Harald Welteec8b4502010-02-20 20:34:29 +010096
Harald Welte8c8caaa2010-03-04 15:02:54 +010097 uint8_t sub_type; /* Type of burst/channel, see above */
98 uint8_t antenna_nr; /* Antenna Number */
99 uint8_t sub_slot; /* sub-slot within timeslot */
100 uint8_t res; /* reserved for future use (RFU) */
Harald Welteec8b4502010-02-20 20:34:29 +0100101
102} __attribute__((packed));
103
Harald Welteec8b4502010-02-20 20:34:29 +0100104#endif /* _GSMTAP_H */