libosmocore  0.9.6-9.20170220git32ee5af8.fc29
Osmocom core library
gsmtap.h
1 #pragma once
2 
3 /* gsmtap header, pseudo-header in front of the actua GSM payload */
4 
5 /* GSMTAP is a generic header format for GSM protocol captures,
6  * it uses the IANA-assigned UDP port number 4729 and carries
7  * payload in various formats of GSM interfaces such as Um MAC
8  * blocks or Um bursts.
9  *
10  * Example programs generating GSMTAP data are airprobe
11  * (http://airprobe.org/) or OsmocomBB (http://bb.osmocom.org/)
12  */
13 
14 #include <stdint.h>
15 
16 /* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
17 
18 /* The GSMTAP format definition is maintained in libosmocore,
19  * specifically the latest version can always be obtained from
20  * http://cgit.osmocom.org/cgit/libosmocore/tree/include/osmocom/core/gsmtap.h
21  *
22  * If you want to introduce new protocol/burst/channel types or extend
23  * GSMTAP in any way, please contact the GSMTAP maintainer at either the
24  * public openbsc@lists.osmocom.org mailing list, or privately at
25  * Harald Welte <laforge@gnumonks.org>.
26  *
27  * Your cooperation ensures that all projects will use the same GSMTAP
28  * definitions and remain compatible with each other.
29  */
30 
31 #define GSMTAP_VERSION 0x02
32 
33 #define GSMTAP_TYPE_UM 0x01
34 #define GSMTAP_TYPE_ABIS 0x02
35 #define GSMTAP_TYPE_UM_BURST 0x03 /* raw burst bits */
36 #define GSMTAP_TYPE_SIM 0x04
37 #define GSMTAP_TYPE_TETRA_I1 0x05 /* tetra air interface */
38 #define GSMTAP_TYPE_TETRA_I1_BURST 0x06 /* tetra air interface */
39 #define GSMTAP_TYPE_WMX_BURST 0x07 /* WiMAX burst */
40 #define GSMTAP_TYPE_GB_LLC 0x08 /* GPRS Gb interface: LLC */
41 #define GSMTAP_TYPE_GB_SNDCP 0x09 /* GPRS Gb interface: SNDCP */
42 #define GSMTAP_TYPE_GMR1_UM 0x0a /* GMR-1 L2 packets */
43 #define GSMTAP_TYPE_UMTS_RLC_MAC 0x0b
44 #define GSMTAP_TYPE_UMTS_RRC 0x0c
45 #define GSMTAP_TYPE_LTE_RRC 0x0d /* LTE interface */
46 #define GSMTAP_TYPE_LTE_MAC 0x0e /* LTE MAC interface */
47 #define GSMTAP_TYPE_LTE_MAC_FRAMED 0x0f /* LTE MAC with context hdr */
48 #define GSMTAP_TYPE_OSMOCORE_LOG 0x10 /* libosmocore logging */
49 #define GSMTAP_TYPE_QC_DIAG 0x11 /* Qualcomm DIAG frame */
50 
51 /* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
52 
53 /* sub-types for TYPE_UM_BURST */
54 #define GSMTAP_BURST_UNKNOWN 0x00
55 #define GSMTAP_BURST_FCCH 0x01
56 #define GSMTAP_BURST_PARTIAL_SCH 0x02
57 #define GSMTAP_BURST_SCH 0x03
58 #define GSMTAP_BURST_CTS_SCH 0x04
59 #define GSMTAP_BURST_COMPACT_SCH 0x05
60 #define GSMTAP_BURST_NORMAL 0x06
61 #define GSMTAP_BURST_DUMMY 0x07
62 #define GSMTAP_BURST_ACCESS 0x08
63 #define GSMTAP_BURST_NONE 0x09
64 /* WiMAX bursts */
65 #define GSMTAP_BURST_CDMA_CODE 0x10 /* WiMAX CDMA Code Attribute burst */
66 #define GSMTAP_BURST_FCH 0x11 /* WiMAX FCH burst */
67 #define GSMTAP_BURST_FFB 0x12 /* WiMAX Fast Feedback burst */
68 #define GSMTAP_BURST_PDU 0x13 /* WiMAX PDU burst */
69 #define GSMTAP_BURST_HACK 0x14 /* WiMAX HARQ ACK burst */
70 #define GSMTAP_BURST_PHY_ATTRIBUTES 0x15 /* WiMAX PHY Attributes burst */
71 
72 /* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
73 
74 /* sub-types for TYPE_UM */
75 #define GSMTAP_CHANNEL_UNKNOWN 0x00
76 #define GSMTAP_CHANNEL_BCCH 0x01
77 #define GSMTAP_CHANNEL_CCCH 0x02
78 #define GSMTAP_CHANNEL_RACH 0x03
79 #define GSMTAP_CHANNEL_AGCH 0x04
80 #define GSMTAP_CHANNEL_PCH 0x05
81 #define GSMTAP_CHANNEL_SDCCH 0x06
82 #define GSMTAP_CHANNEL_SDCCH4 0x07
83 #define GSMTAP_CHANNEL_SDCCH8 0x08
84 #define GSMTAP_CHANNEL_TCH_F 0x09
85 #define GSMTAP_CHANNEL_TCH_H 0x0a
86 #define GSMTAP_CHANNEL_PACCH 0x0b
87 #define GSMTAP_CHANNEL_CBCH52 0x0c
88 #define GSMTAP_CHANNEL_PDCH 0x0d
89 #define GSMTAP_CHANNEL_PTCCH 0x0e
90 #define GSMTAP_CHANNEL_CBCH51 0x0f
91 
92 /* GPRS Coding Scheme CS1..4 */
93 #define GSMTAP_GPRS_CS_BASE 0x20
94 #define GSMTAP_GPRS_CS(N) (GSMTAP_GPRS_CS_BASE + N)
95 /* (E) GPRS Coding Scheme MCS0..9 */
96 #define GSMTAP_GPRS_MCS_BASE 0x30
97 #define GSMTAP_GPRS_MCS(N) (GSMTAP_GPRS_MCS_BASE + N)
98 
99 #define GSMTAP_CHANNEL_ACCH 0x80
100 
101 /* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
102 
103 /* sub-types for TYPE_TETRA_AIR */
104 #define GSMTAP_TETRA_BSCH 0x01
105 #define GSMTAP_TETRA_AACH 0x02
106 #define GSMTAP_TETRA_SCH_HU 0x03
107 #define GSMTAP_TETRA_SCH_HD 0x04
108 #define GSMTAP_TETRA_SCH_F 0x05
109 #define GSMTAP_TETRA_BNCH 0x06
110 #define GSMTAP_TETRA_STCH 0x07
111 #define GSMTAP_TETRA_TCH_F 0x08
112 
113 /* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
114 
115 /* sub-types for TYPE_GMR1_UM */
116 #define GSMTAP_GMR1_UNKNOWN 0x00
117 #define GSMTAP_GMR1_BCCH 0x01
118 #define GSMTAP_GMR1_CCCH 0x02 /* either AGCH or PCH */
119 #define GSMTAP_GMR1_PCH 0x03
120 #define GSMTAP_GMR1_AGCH 0x04
121 #define GSMTAP_GMR1_BACH 0x05
122 #define GSMTAP_GMR1_RACH 0x06
123 #define GSMTAP_GMR1_CBCH 0x07
124 #define GSMTAP_GMR1_SDCCH 0x08
125 #define GSMTAP_GMR1_TACCH 0x09
126 #define GSMTAP_GMR1_GBCH 0x0a
127 
128 #define GSMTAP_GMR1_SACCH 0x01 /* to be combined with _TCH{6,9} */
129 #define GSMTAP_GMR1_FACCH 0x02 /* to be combines with _TCH{3,6,9} */
130 #define GSMTAP_GMR1_DKAB 0x03 /* to be combined with _TCH3 */
131 #define GSMTAP_GMR1_TCH3 0x10
132 #define GSMTAP_GMR1_TCH6 0x14
133 #define GSMTAP_GMR1_TCH9 0x18
134 
135 /* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
136 
137 #define GSMTAP_UMTS_CH_PCCH 0x01
138 #define GSMTAP_UMTS_CH_CCCH 0x02
139 #define GSMTAP_UMTS_CH_DCCH 0x03
140 
141 /* sub-types for TYPE_LTE_RRC */
142 #define GSMTAP_LTE_CH_BCCH 0x01
143 #define GSMTAP_LTE_CH_CCCH 0x02
144 #define GSMTAP_LTE_CH_DCCH 0x03
145 #define GSMTAP_LTE_CH_MCCH 0x04
146 #define GSMTAP_LTE_CH_PCCH 0x05
147 #define GSMTAP_LTE_CH_DTCH 0x06
148 #define GSMTAP_LTE_CH_MTCH 0x07
149 
150 /* flags for the ARFCN */
151 #define GSMTAP_ARFCN_F_PCS 0x8000
152 #define GSMTAP_ARFCN_F_UPLINK 0x4000
153 #define GSMTAP_ARFCN_MASK 0x3fff
154 
155 /* IANA-assigned well-known UDP port for GSMTAP messages */
156 #define GSMTAP_UDP_PORT 4729
157 
158 /* UMTS RRC message types */
159 enum {
160  GSMTAP_RRC_SUB_DL_DCCH_Message = 0,
161  GSMTAP_RRC_SUB_UL_DCCH_Message,
162  GSMTAP_RRC_SUB_DL_CCCH_Message,
163  GSMTAP_RRC_SUB_UL_CCCH_Message,
164  GSMTAP_RRC_SUB_PCCH_Message,
165  GSMTAP_RRC_SUB_DL_SHCCH_Message,
166  GSMTAP_RRC_SUB_UL_SHCCH_Message,
167  GSMTAP_RRC_SUB_BCCH_FACH_Message,
168  GSMTAP_RRC_SUB_BCCH_BCH_Message,
169  GSMTAP_RRC_SUB_MCCH_Message,
170  GSMTAP_RRC_SUB_MSCH_Message,
171  GSMTAP_RRC_SUB_HandoverToUTRANCommand,
172  GSMTAP_RRC_SUB_InterRATHandoverInfo,
173  GSMTAP_RRC_SUB_SystemInformation_BCH,
174  GSMTAP_RRC_SUB_System_Information_Container,
175  GSMTAP_RRC_SUB_UE_RadioAccessCapabilityInfo,
176  GSMTAP_RRC_SUB_MasterInformationBlock,
177  GSMTAP_RRC_SUB_SysInfoType1,
178  GSMTAP_RRC_SUB_SysInfoType2,
179  GSMTAP_RRC_SUB_SysInfoType3,
180  GSMTAP_RRC_SUB_SysInfoType4,
181  GSMTAP_RRC_SUB_SysInfoType5,
182  GSMTAP_RRC_SUB_SysInfoType5bis,
183  GSMTAP_RRC_SUB_SysInfoType6,
184  GSMTAP_RRC_SUB_SysInfoType7,
185  GSMTAP_RRC_SUB_SysInfoType8,
186  GSMTAP_RRC_SUB_SysInfoType9,
187  GSMTAP_RRC_SUB_SysInfoType10,
188  GSMTAP_RRC_SUB_SysInfoType11,
189  GSMTAP_RRC_SUB_SysInfoType11bis,
190  GSMTAP_RRC_SUB_SysInfoType12,
191  GSMTAP_RRC_SUB_SysInfoType13,
192  GSMTAP_RRC_SUB_SysInfoType13_1,
193  GSMTAP_RRC_SUB_SysInfoType13_2,
194  GSMTAP_RRC_SUB_SysInfoType13_3,
195  GSMTAP_RRC_SUB_SysInfoType13_4,
196  GSMTAP_RRC_SUB_SysInfoType14,
197  GSMTAP_RRC_SUB_SysInfoType15,
198  GSMTAP_RRC_SUB_SysInfoType15bis,
199  GSMTAP_RRC_SUB_SysInfoType15_1,
200  GSMTAP_RRC_SUB_SysInfoType15_1bis,
201  GSMTAP_RRC_SUB_SysInfoType15_2,
202  GSMTAP_RRC_SUB_SysInfoType15_2bis,
203  GSMTAP_RRC_SUB_SysInfoType15_2ter,
204  GSMTAP_RRC_SUB_SysInfoType15_3,
205  GSMTAP_RRC_SUB_SysInfoType15_3bis,
206  GSMTAP_RRC_SUB_SysInfoType15_4,
207  GSMTAP_RRC_SUB_SysInfoType15_5,
208  GSMTAP_RRC_SUB_SysInfoType15_6,
209  GSMTAP_RRC_SUB_SysInfoType15_7,
210  GSMTAP_RRC_SUB_SysInfoType15_8,
211  GSMTAP_RRC_SUB_SysInfoType16,
212  GSMTAP_RRC_SUB_SysInfoType17,
213  GSMTAP_RRC_SUB_SysInfoType18,
214  GSMTAP_RRC_SUB_SysInfoType19,
215  GSMTAP_RRC_SUB_SysInfoType20,
216  GSMTAP_RRC_SUB_SysInfoType21,
217  GSMTAP_RRC_SUB_SysInfoType22,
218  GSMTAP_RRC_SUB_SysInfoTypeSB1,
219  GSMTAP_RRC_SUB_SysInfoTypeSB2,
220  GSMTAP_RRC_SUB_ToTargetRNC_Container,
221  GSMTAP_RRC_SUB_TargetRNC_ToSourceRNC_Container,
222 
223  GSMTAP_RRC_SUB_MAX
224 };
225 
226 /* LTE RRC message types */
227 enum {
228  GSMTAP_LTE_RRC_SUB_DL_CCCH_Message = 0,
229  GSMTAP_LTE_RRC_SUB_DL_DCCH_Message,
230  GSMTAP_LTE_RRC_SUB_UL_CCCH_Message,
231  GSMTAP_LTE_RRC_SUB_UL_DCCH_Message,
232  GSMTAP_LTE_RRC_SUB_BCCH_BCH_Message,
233  GSMTAP_LTE_RRC_SUB_BCCH_DL_SCH_Message,
234  GSMTAP_LTE_RRC_SUB_PCCH_Message,
235  GSMTAP_LTE_RRC_SUB_MCCH_Message,
236 
237  GSMTAP_LTE_RRC_SUB_MAX
238 };
239 
240 /* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
242 struct gsmtap_hdr {
243  uint8_t version;
244  uint8_t hdr_len;
245  uint8_t type;
246  uint8_t timeslot;
248  uint16_t arfcn;
249  int8_t signal_dbm;
250  int8_t snr_db;
252  uint32_t frame_number;
254  uint8_t sub_type;
255  uint8_t antenna_nr;
256  uint8_t sub_slot;
257  uint8_t res;
259 } __attribute__((packed));
260 
263  struct {
264  uint32_t sec;
265  uint32_t usec;
266  } ts;
267  char proc_name[16];
268  uint32_t pid;
269  uint8_t level;
270  uint8_t _pad[3];
271  /* TODO: color */
272  char subsys[16];
273  struct {
274  char name[32];
275  uint32_t line_nr;
276  } src_file;
277 } __attribute__((packed));
uint16_t arfcn
Definition: gsmtap.h:248
uint8_t hdr_len
Definition: gsmtap.h:244
uint8_t level
Definition: gsmtap.h:269
char name[32]
Definition: gsmtap.h:274
uint32_t line_nr
Definition: gsmtap.h:275
char subsys[16]
Definition: gsmtap.h:272
uint8_t version
Definition: gsmtap.h:243
int8_t signal_dbm
Definition: gsmtap.h:249
uint32_t frame_number
Definition: gsmtap.h:252
uint8_t sub_slot
Definition: gsmtap.h:256
uint32_t pid
Definition: gsmtap.h:268
char proc_name[16]
Definition: gsmtap.h:267
uint8_t timeslot
Definition: gsmtap.h:246
uint8_t sub_type
Definition: gsmtap.h:254
uint8_t type
Definition: gsmtap.h:245
uint8_t antenna_nr
Definition: gsmtap.h:255
Structure of the GTMTAP pseudo-header.
Definition: gsmtap.h:242
uint8_t res
Definition: gsmtap.h:257
Structure of the GTMTAP libosmocore logging header.
Definition: gsmtap.h:262
int8_t snr_db
Definition: gsmtap.h:250