epan/dissectors/pidl/samr/samr.cnf cnf_dissect_lsa_BinaryString => lsarpc_dissect_str...
[wireshark-sm.git] / epan / dissectors / packet-gsmtap.c
blobfd4c220b36d99ae02c12b638d31d99909106cba0
1 /* packet-gsmtap.c
2 * Routines for GSMTAP captures
4 * (C) 2008-2013 by Harald Welte <laforge@gnumonks.org>
5 * (C) 2011 by Holger Hans Peter Freyther
6 * (C) 2020 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * SPDX-License-Identifier: GPL-2.0-or-later
15 /* GSMTAP is a generic header format for GSM protocol captures,
16 * it uses the IANA-assigned UDP port number 4729 and carries
17 * payload in various formats of GSM interfaces such as Um MAC
18 * blocks or Um bursts.
20 * It is defined by the gsmtap.h libosmocore header, in
22 * http://cgit.osmocom.org/libosmocore/tree/include/osmocom/core/gsmtap.h
24 * Example programs generating GSMTAP data are airprobe
25 * (http://git.gnumonks.org/cgit/airprobe/) or OsmocomBB (http://bb.osmocom.org/)
27 * It has also been used for Tetra by the OsmocomTETRA project.
28 * (http://tetra.osmocom.org/)
30 * GSMTAP also carries payload in various formats of WiMAX interfaces.
31 * It uses the wimax plugin to decode the WiMAX bursts.
34 #include "config.h"
36 #include <epan/packet.h>
37 #include <epan/expert.h>
38 #include <epan/conversation.h>
39 #include <epan/tfs.h>
40 #include <epan/unit_strings.h>
41 #include "packet-gsm_rlcmac.h"
42 #include <wiretap/wtap.h>
44 #include "packet-gsmtap.h"
45 #include "packet-lapdm.h"
46 #include "packet-tetra.h"
48 void proto_register_gsmtap(void);
49 void proto_reg_handoff_gsmtap(void);
51 static dissector_handle_t gsmtap_handle;
53 static int proto_gsmtap;
55 static int hf_gsmtap_version;
56 static int hf_gsmtap_hdrlen;
57 static int hf_gsmtap_type;
58 static int hf_gsmtap_timeslot;
59 static int hf_gsmtap_subslot;
60 static int hf_gsmtap_arfcn;
61 static int hf_gsmtap_uplink;
62 static int hf_gsmtap_pcs;
63 static int hf_gsmtap_signal_dbm;
64 static int hf_gsmtap_snr_db;
65 static int hf_gsmtap_frame_nr;
66 static int hf_gsmtap_burst_type;
67 static int hf_gsmtap_channel_type;
68 static int hf_gsmtap_tetra_channel_type;
69 static int hf_gsmtap_gmr1_channel_type;
70 static int hf_gsmtap_rrc_sub_type;
71 static int hf_gsmtap_e1t1_sub_type;
72 static int hf_gsmtap_sim_sub_type;
73 static int hf_gsmtap_antenna;
75 static int hf_sacch_l1h_power_lev;
76 static int hf_sacch_l1h_fpc;
77 static int hf_sacch_l1h_sro_srr;
78 static int hf_sacch_l1h_ta;
80 static int hf_ptcch_spare;
81 static int hf_ptcch_ta_idx;
82 static int hf_ptcch_ta_val;
83 static int hf_ptcch_padding;
85 static int hf_um_voice_type;
87 static int ett_gsmtap;
89 static expert_field ei_gsmtap_unknown_gsmtap_version;
91 enum {
92 GSMTAP_SUB_DATA = 0,
93 GSMTAP_SUB_UM,
94 GSMTAP_SUB_UM_LAPDM,
95 GSMTAP_SUB_UM_RLC_MAC_UL,
96 GSMTAP_SUB_UM_RLC_MAC_DL,
97 GSMTAP_SUB_LLC,
98 GSMTAP_SUB_SNDCP,
99 GSMTAP_SUB_ABIS,
100 /* WiMAX sub handles */
101 GSMTAP_SUB_CDMA_CODE,
102 GSMTAP_SUB_FCH,
103 GSMTAP_SUB_FFB,
104 GSMTAP_SUB_PDU,
105 GSMTAP_SUB_HACK,
106 GSMTAP_SUB_PHY_ATTRIBUTES,
107 GSMTAP_SUB_CBCH,
108 GSMTAP_SUB_SIM,
109 /* GMR-1 sub handles */
110 GSMTAP_SUB_GMR1_BCCH,
111 GSMTAP_SUB_GMR1_CCCH,
112 GSMTAP_SUB_GMR1_LAPSAT,
113 GSMTAP_SUB_GMR1_RACH,
114 /* UMTS */
115 GSMTAP_SUB_UMTS_RLC_MAC,
116 GSMTAP_SUB_UMTS_RRC,
117 /* LTE*/
118 GSMTAP_SUB_LTE_RRC,
119 GSMTAP_SUB_LTE_NAS,
120 GSMTAP_SUB_LAPD,
121 GSMTAP_SUB_FR,
122 GSMTAP_SUB_V5EF,
123 GSMTAP_SUB_GSM_RLP,
124 /* E1/T1 */
125 GSMTAP_SUB_PPP,
126 GSMTAP_SUB_V120,
127 GSMTAP_SUB_X75,
129 GSMTAP_SUB_MAX
132 enum {
133 GSMTAP_SIM_SUB_APDU = 0,
134 GSMTAP_SIM_SUB_ATR,
136 GSMTAP_SIM_SUB_MAX
139 enum {
140 GSMTAP_RRC_SUB_DL_DCCH_Message = 0,
141 GSMTAP_RRC_SUB_UL_DCCH_Message,
142 GSMTAP_RRC_SUB_DL_CCCH_Message,
143 GSMTAP_RRC_SUB_UL_CCCH_Message,
144 GSMTAP_RRC_SUB_PCCH_Message,
145 GSMTAP_RRC_SUB_DL_SHCCH_Message,
146 GSMTAP_RRC_SUB_UL_SHCCH_Message,
147 GSMTAP_RRC_SUB_BCCH_FACH_Message,
148 GSMTAP_RRC_SUB_BCCH_BCH_Message,
149 GSMTAP_RRC_SUB_MCCH_Message,
150 GSMTAP_RRC_SUB_MSCH_Message,
151 GSMTAP_RRC_SUB_HandoverToUTRANCommand,
152 GSMTAP_RRC_SUB_InterRATHandoverInfo,
153 GSMTAP_RRC_SUB_SystemInformation_BCH,
154 GSMTAP_RRC_SUB_System_Information_Container,
155 GSMTAP_RRC_SUB_UE_RadioAccessCapabilityInfo,
156 GSMTAP_RRC_SUB_MasterInformationBlock,
157 GSMTAP_RRC_SUB_SysInfoType1,
158 GSMTAP_RRC_SUB_SysInfoType2,
159 GSMTAP_RRC_SUB_SysInfoType3,
160 GSMTAP_RRC_SUB_SysInfoType4,
161 GSMTAP_RRC_SUB_SysInfoType5,
162 GSMTAP_RRC_SUB_SysInfoType5bis,
163 GSMTAP_RRC_SUB_SysInfoType6,
164 GSMTAP_RRC_SUB_SysInfoType7,
165 GSMTAP_RRC_SUB_SysInfoType8,
166 GSMTAP_RRC_SUB_SysInfoType9,
167 GSMTAP_RRC_SUB_SysInfoType10,
168 GSMTAP_RRC_SUB_SysInfoType11,
169 GSMTAP_RRC_SUB_SysInfoType11bis,
170 GSMTAP_RRC_SUB_SysInfoType12,
171 GSMTAP_RRC_SUB_SysInfoType13,
172 GSMTAP_RRC_SUB_SysInfoType13_1,
173 GSMTAP_RRC_SUB_SysInfoType13_2,
174 GSMTAP_RRC_SUB_SysInfoType13_3,
175 GSMTAP_RRC_SUB_SysInfoType13_4,
176 GSMTAP_RRC_SUB_SysInfoType14,
177 GSMTAP_RRC_SUB_SysInfoType15,
178 GSMTAP_RRC_SUB_SysInfoType15bis,
179 GSMTAP_RRC_SUB_SysInfoType15_1,
180 GSMTAP_RRC_SUB_SysInfoType15_1bis,
181 GSMTAP_RRC_SUB_SysInfoType15_2,
182 GSMTAP_RRC_SUB_SysInfoType15_2bis,
183 GSMTAP_RRC_SUB_SysInfoType15_2ter,
184 GSMTAP_RRC_SUB_SysInfoType15_3,
185 GSMTAP_RRC_SUB_SysInfoType15_3bis,
186 GSMTAP_RRC_SUB_SysInfoType15_4,
187 GSMTAP_RRC_SUB_SysInfoType15_5,
188 GSMTAP_RRC_SUB_SysInfoType15_6,
189 GSMTAP_RRC_SUB_SysInfoType15_7,
190 GSMTAP_RRC_SUB_SysInfoType15_8,
191 GSMTAP_RRC_SUB_SysInfoType16,
192 GSMTAP_RRC_SUB_SysInfoType17,
193 GSMTAP_RRC_SUB_SysInfoType18,
194 GSMTAP_RRC_SUB_SysInfoType19,
195 GSMTAP_RRC_SUB_SysInfoType20,
196 GSMTAP_RRC_SUB_SysInfoType21,
197 GSMTAP_RRC_SUB_SysInfoType22,
198 GSMTAP_RRC_SUB_SysInfoTypeSB1,
199 GSMTAP_RRC_SUB_SysInfoTypeSB2,
200 GSMTAP_RRC_SUB_ToTargetRNC_Container,
201 GSMTAP_RRC_SUB_TargetRNC_ToSourceRNC_Container,
203 GSMTAP_RRC_SUB_MAX
206 static const value_string rrc_sub_types[] = {
207 { GSMTAP_RRC_SUB_DL_DCCH_Message, "RRC DL-DCCH" },
208 { GSMTAP_RRC_SUB_UL_DCCH_Message, "RRC UL-DCCH" },
209 { GSMTAP_RRC_SUB_DL_CCCH_Message, "RRC DL-CCCH" },
210 { GSMTAP_RRC_SUB_UL_CCCH_Message, "RRC UL-CCCH" },
211 { GSMTAP_RRC_SUB_PCCH_Message, "RRC PCCH" },
212 { GSMTAP_RRC_SUB_DL_SHCCH_Message, "RRC DL-SHCCH" },
213 { GSMTAP_RRC_SUB_UL_SHCCH_Message, "RRC UL-SHCCH" },
214 { GSMTAP_RRC_SUB_BCCH_FACH_Message, "RRC BCCH-FACH" },
215 { GSMTAP_RRC_SUB_BCCH_BCH_Message, "RRC BCCH-BCH" },
216 { GSMTAP_RRC_SUB_MCCH_Message, "RRC MCCH" },
217 { GSMTAP_RRC_SUB_MSCH_Message, "RRC MSCH" },
218 { GSMTAP_RRC_SUB_HandoverToUTRANCommand, "RRC Handover To UTRAN Command" },
219 { GSMTAP_RRC_SUB_InterRATHandoverInfo, "RRC Inter RAT Handover Info" },
220 { GSMTAP_RRC_SUB_SystemInformation_BCH, "RRC System Information - BCH" },
221 { GSMTAP_RRC_SUB_System_Information_Container, "RRC System Information Container" },
222 { GSMTAP_RRC_SUB_UE_RadioAccessCapabilityInfo, "RRC UE Radio Access Capability Info" },
223 { GSMTAP_RRC_SUB_MasterInformationBlock, "RRC Master Information Block" },
224 { GSMTAP_RRC_SUB_SysInfoType1, "RRC System Information Type 1" },
225 { GSMTAP_RRC_SUB_SysInfoType2, "RRC System Information Type 2" },
226 { GSMTAP_RRC_SUB_SysInfoType3, "RRC System Information Type 3" },
227 { GSMTAP_RRC_SUB_SysInfoType4, "RRC System Information Type 4" },
228 { GSMTAP_RRC_SUB_SysInfoType5, "RRC System Information Type 5" },
229 { GSMTAP_RRC_SUB_SysInfoType5bis, "RRC System Information Type 5bis" },
230 { GSMTAP_RRC_SUB_SysInfoType6, "RRC System Information Type 6" },
231 { GSMTAP_RRC_SUB_SysInfoType7, "RRC System Information Type 7" },
232 { GSMTAP_RRC_SUB_SysInfoType8, "RRC System Information Type 8" },
233 { GSMTAP_RRC_SUB_SysInfoType9, "RRC System Information Type 9" },
234 { GSMTAP_RRC_SUB_SysInfoType10, "RRC System Information Type 10" },
235 { GSMTAP_RRC_SUB_SysInfoType11, "RRC System Information Type 11" },
236 { GSMTAP_RRC_SUB_SysInfoType11bis, "RRC System Information Type 11bis" },
237 { GSMTAP_RRC_SUB_SysInfoType12, "RRC System Information Type 12" },
238 { GSMTAP_RRC_SUB_SysInfoType13, "RRC System Information Type 13" },
239 { GSMTAP_RRC_SUB_SysInfoType13_1, "RRC System Information Type 13.1" },
240 { GSMTAP_RRC_SUB_SysInfoType13_2, "RRC System Information Type 13.2" },
241 { GSMTAP_RRC_SUB_SysInfoType13_3, "RRC System Information Type 13.3" },
242 { GSMTAP_RRC_SUB_SysInfoType13_4, "RRC System Information Type 13.4" },
243 { GSMTAP_RRC_SUB_SysInfoType14, "RRC System Information Type 14" },
244 { GSMTAP_RRC_SUB_SysInfoType15, "RRC System Information Type 15" },
245 { GSMTAP_RRC_SUB_SysInfoType15bis, "RRC System Information Type 15bis" },
246 { GSMTAP_RRC_SUB_SysInfoType15_1, "RRC System Information Type 15.1" },
247 { GSMTAP_RRC_SUB_SysInfoType15_1bis, "RRC System Information Type 15.1bis" },
248 { GSMTAP_RRC_SUB_SysInfoType15_2, "RRC System Information Type 15.1" },
249 { GSMTAP_RRC_SUB_SysInfoType15_2bis, "RRC System Information Type 15.2bis" },
250 { GSMTAP_RRC_SUB_SysInfoType15_2ter, "RRC System Information Type 15.2ter" },
251 { GSMTAP_RRC_SUB_SysInfoType15_3, "RRC System Information Type 15.3" },
252 { GSMTAP_RRC_SUB_SysInfoType15_3bis, "RRC System Information Type 15.3bis" },
253 { GSMTAP_RRC_SUB_SysInfoType15_4, "RRC System Information Type 15.4" },
254 { GSMTAP_RRC_SUB_SysInfoType15_5, "RRC System Information Type 15.5" },
255 { GSMTAP_RRC_SUB_SysInfoType15_6, "RRC System Information Type 15.6" },
256 { GSMTAP_RRC_SUB_SysInfoType15_7, "RRC System Information Type 15.7 "},
257 { GSMTAP_RRC_SUB_SysInfoType15_8, "RRC System Information Type 15.8" },
258 { GSMTAP_RRC_SUB_SysInfoType16, "RRC System Information Type 16" },
259 { GSMTAP_RRC_SUB_SysInfoType17, "RRC System Information Type 17" },
260 { GSMTAP_RRC_SUB_SysInfoType18, "RRC System Information Type 18" },
261 { GSMTAP_RRC_SUB_SysInfoType19, "RRC System Information Type 19" },
262 { GSMTAP_RRC_SUB_SysInfoType20, "RRC System Information Type 20" },
263 { GSMTAP_RRC_SUB_SysInfoType21, "RRC System Information Type 21" },
264 { GSMTAP_RRC_SUB_SysInfoType22, "RRC System Information Type 22" },
265 { GSMTAP_RRC_SUB_SysInfoTypeSB1, "RRC System Information Type SB 1" },
266 { GSMTAP_RRC_SUB_SysInfoTypeSB2, "RRC System Information Type SB 2" },
267 { GSMTAP_RRC_SUB_ToTargetRNC_Container, "RRC To Target RNC Container" },
268 { GSMTAP_RRC_SUB_TargetRNC_ToSourceRNC_Container, "RRC Target RNC To Source RNC Container" },
269 { 0, NULL }
272 /* LTE RRC message types */
273 enum {
274 GSMTAP_LTE_RRC_SUB_DL_CCCH_Message = 0,
275 GSMTAP_LTE_RRC_SUB_DL_DCCH_Message,
276 GSMTAP_LTE_RRC_SUB_UL_CCCH_Message,
277 GSMTAP_LTE_RRC_SUB_UL_DCCH_Message,
278 GSMTAP_LTE_RRC_SUB_BCCH_BCH_Message,
279 GSMTAP_LTE_RRC_SUB_BCCH_DL_SCH_Message,
280 GSMTAP_LTE_RRC_SUB_PCCH_Message,
281 GSMTAP_LTE_RRC_SUB_MCCH_Message,
282 GSMTAP_LTE_RRC_SUB_BCCH_BCH_Message_MBMS,
283 GSMTAP_LTE_RRC_SUB_BCCH_DL_SCH_Message_BR,
284 GSMTAP_LTE_RRC_SUB_BCCH_DL_SCH_Message_MBMS,
285 GSMTAP_LTE_RRC_SUB_SC_MCCH_Message,
286 GSMTAP_LTE_RRC_SUB_SBCCH_SL_BCH_Message,
287 GSMTAP_LTE_RRC_SUB_SBCCH_SL_BCH_Message_V2X,
288 GSMTAP_LTE_RRC_SUB_DL_CCCH_Message_NB,
289 GSMTAP_LTE_RRC_SUB_DL_DCCH_Message_NB,
290 GSMTAP_LTE_RRC_SUB_UL_CCCH_Message_NB,
291 GSMTAP_LTE_RRC_SUB_UL_DCCH_Message_NB,
292 GSMTAP_LTE_RRC_SUB_BCCH_BCH_Message_NB,
293 GSMTAP_LTE_RRC_SUB_BCCH_BCH_Message_TDD_NB,
294 GSMTAP_LTE_RRC_SUB_BCCH_DL_SCH_Message_NB,
295 GSMTAP_LTE_RRC_SUB_PCCH_Message_NB,
296 GSMTAP_LTE_RRC_SUB_SC_MCCH_Message_NB,
298 GSMTAP_LTE_RRC_SUB_MAX
301 /* LTE NAS message types */
302 enum {
303 GSMTAP_LTE_NAS_PLAIN = 0,
304 GSMTAP_LTE_NAS_SEC_HEADER,
306 GSMTAP_LTE_NAS_SUB_MAX
309 /*! First byte of type==GSMTAP_TYPE_UM sub_type==GSMTAP_CHANNEL_VOICE payload */
310 enum gsmtap_um_voice_type {
311 /*! 1 byte TOC + 112 bits (14 octets) = 15 octets payload;
312 * Reference is RFC5993 Section 5.2.1 + 3GPP TS 46.030 Annex B */
313 GSMTAP_UM_VOICE_HR,
314 /*! 33 payload bytes; Reference is RFC3551 Section 4.5.8.1 */
315 GSMTAP_UM_VOICE_FR,
316 /*! 31 payload bytes; Reference is RFC3551 Section 4.5.9 + ETSI TS 101 318 */
317 GSMTAP_UM_VOICE_EFR,
318 /*! 1 byte TOC + 5..31 bytes = 6..32 bytes payload; RFC4867 octet-aligned */
319 GSMTAP_UM_VOICE_AMR,
320 /* TODO: Revisit the types below; their usage; ... */
321 GSMTAP_UM_VOICE_AMR_SID_BAD,
322 GSMTAP_UM_VOICE_AMR_ONSET,
323 GSMTAP_UM_VOICE_AMR_RATSCCH,
324 GSMTAP_UM_VOICE_AMR_SID_UPDATE_INH,
325 GSMTAP_UM_VOICE_AMR_SID_FIRST_P1,
326 GSMTAP_UM_VOICE_AMR_SID_FIRST_P2,
327 GSMTAP_UM_VOICE_AMR_SID_FIRST_INH,
328 GSMTAP_UM_VOICE_AMR_RATSCCH_MARKER,
329 GSMTAP_UM_VOICE_AMR_RATSCCH_DATA,
332 static dissector_handle_t sub_handles[GSMTAP_SUB_MAX];
333 static dissector_handle_t sim_sub_handles[GSMTAP_SIM_SUB_MAX];
334 static dissector_handle_t rrc_sub_handles[GSMTAP_RRC_SUB_MAX];
335 static dissector_handle_t lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_MAX];
336 static dissector_handle_t lte_nas_sub_handles[GSMTAP_LTE_NAS_SUB_MAX];
338 static dissector_table_t gsmtap_dissector_table;
340 static const value_string gsmtap_bursts[] = {
341 { GSMTAP_BURST_UNKNOWN, "UNKNOWN" },
342 { GSMTAP_BURST_FCCH, "FCCH" },
343 { GSMTAP_BURST_PARTIAL_SCH, "PARTIAL SCH" },
344 { GSMTAP_BURST_SCH, "SCH" },
345 { GSMTAP_BURST_CTS_SCH, "CTS SCH" },
346 { GSMTAP_BURST_COMPACT_SCH, "COMPACT SCH" },
347 { GSMTAP_BURST_NORMAL, "NORMAL" },
348 { GSMTAP_BURST_DUMMY, "DUMMY" },
349 { GSMTAP_BURST_ACCESS, "RACH" },
350 /* WiMAX bursts */
351 { GSMTAP_BURST_CDMA_CODE, "CDMA Code" },
352 { GSMTAP_BURST_FCH, "FCH" },
353 { GSMTAP_BURST_FFB, "Fast Feedback" },
354 { GSMTAP_BURST_PDU, "PDU" },
355 { GSMTAP_BURST_HACK, "HACK" },
356 { GSMTAP_BURST_PHY_ATTRIBUTES, "PHY Attributes" },
357 { 0, NULL },
360 static const value_string gsmtap_channels[] = {
361 { GSMTAP_CHANNEL_UNKNOWN, "UNKNOWN" },
362 { GSMTAP_CHANNEL_BCCH, "BCCH" },
363 { GSMTAP_CHANNEL_CCCH, "CCCH" },
364 { GSMTAP_CHANNEL_RACH, "RACH" },
365 { GSMTAP_CHANNEL_AGCH, "AGCH" },
366 { GSMTAP_CHANNEL_PCH, "PCH" },
367 { GSMTAP_CHANNEL_SDCCH, "SDCCH" },
368 { GSMTAP_CHANNEL_SDCCH4, "SDCCH/4" },
369 { GSMTAP_CHANNEL_SDCCH8, "SDCCH/8" },
370 { GSMTAP_CHANNEL_TCH_F, "FACCH/F" },
371 { GSMTAP_CHANNEL_TCH_H, "FACCH/H" },
372 { GSMTAP_CHANNEL_PACCH, "PACCH" },
373 { GSMTAP_CHANNEL_CBCH52, "CBCH" },
374 { GSMTAP_CHANNEL_PDTCH, "PDTCH" },
375 { GSMTAP_CHANNEL_PTCCH, "PTTCH" },
376 { GSMTAP_CHANNEL_CBCH51, "CBCH" },
377 { GSMTAP_CHANNEL_VOICE_F, "TCH/F" },
378 { GSMTAP_CHANNEL_VOICE_H, "TCH/H" },
380 { GSMTAP_CHANNEL_ACCH|
381 GSMTAP_CHANNEL_SDCCH, "LSACCH" },
382 { GSMTAP_CHANNEL_ACCH|
383 GSMTAP_CHANNEL_SDCCH4, "SACCH/4" },
384 { GSMTAP_CHANNEL_ACCH|
385 GSMTAP_CHANNEL_SDCCH8, "SACCH/8" },
386 { GSMTAP_CHANNEL_ACCH|
387 GSMTAP_CHANNEL_TCH_F, "SACCH/F" },
388 { GSMTAP_CHANNEL_ACCH|
389 GSMTAP_CHANNEL_TCH_H, "SACCH/H" },
390 { 0, NULL },
393 static const value_string gsmtap_tetra_channels[] = {
394 { GSMTAP_TETRA_BSCH, "BSCH" },
395 { GSMTAP_TETRA_AACH, "AACH" },
396 { GSMTAP_TETRA_SCH_HU, "SCH/HU" },
397 { GSMTAP_TETRA_SCH_HD, "SCH/HD" },
398 { GSMTAP_TETRA_SCH_F, "SCH/F" },
399 { GSMTAP_TETRA_BNCH, "BNCH" },
400 { GSMTAP_TETRA_STCH, "STCH" },
401 { GSMTAP_TETRA_TCH_F, "AACH" },
402 { 0, NULL },
405 static const value_string gsmtap_gmr1_channels[] = {
406 { GSMTAP_GMR1_BCCH, "BCCH" },
407 { GSMTAP_GMR1_CCCH, "CCCH" },
408 { GSMTAP_GMR1_PCH, "PCH" },
409 { GSMTAP_GMR1_AGCH, "AGCH" },
410 { GSMTAP_GMR1_BACH, "BACH" },
411 { GSMTAP_GMR1_RACH, "RACH" },
412 { GSMTAP_GMR1_CBCH, "CBCH" },
413 { GSMTAP_GMR1_SDCCH, "SDCCH" },
414 { GSMTAP_GMR1_TACCH, "TACCH" },
415 { GSMTAP_GMR1_GBCH, "GBCH" },
416 { GSMTAP_GMR1_TCH3, "TCH3" },
417 { GSMTAP_GMR1_TCH3|
418 GSMTAP_GMR1_FACCH, "FACCH3" },
419 { GSMTAP_GMR1_TCH3|
420 GSMTAP_GMR1_DKAB, "DKAB" },
421 { GSMTAP_GMR1_TCH6, "TCH6" },
422 { GSMTAP_GMR1_TCH6|
423 GSMTAP_GMR1_FACCH, "FACCH6" },
424 { GSMTAP_GMR1_TCH6|
425 GSMTAP_GMR1_SACCH, "SACCH6" },
426 { GSMTAP_GMR1_TCH9, "TCH9" },
427 { GSMTAP_GMR1_TCH9|
428 GSMTAP_GMR1_FACCH, "FACCH9" },
429 { GSMTAP_GMR1_TCH9|
430 GSMTAP_GMR1_SACCH, "SACCH9" },
431 { 0, NULL },
434 /* the mapping is not complete */
435 static const int gsmtap_to_tetra[9] = {
437 TETRA_CHAN_BSCH,
438 TETRA_CHAN_AACH,
439 TETRA_CHAN_SCH_HU,
441 TETRA_CHAN_SCH_F,
442 TETRA_CHAN_BNCH,
443 TETRA_CHAN_STCH,
447 static const value_string gsmtap_types[] = {
448 { GSMTAP_TYPE_UM, "GSM Um (MS<->BTS)" },
449 { GSMTAP_TYPE_ABIS, "GSM Abis (BTS<->BSC)" },
450 { GSMTAP_TYPE_UM_BURST, "GSM Um burst (MS<->BTS)" },
451 { GSMTAP_TYPE_SIM, "SIM" },
452 { GSMTAP_TYPE_TETRA_I1, "TETRA V+D"},
453 { GSMTAP_TTPE_TETRA_I1_BURST, "TETRA V+D burst"},
454 { GSMTAP_TYPE_WMX_BURST,"WiMAX burst" },
455 { GSMTAP_TYPE_GMR1_UM, "GMR-1 air interface (MES-MS<->GTS)" },
456 { GSMTAP_TYPE_UMTS_RLC_MAC, "UMTS RLC/MAC" },
457 { GSMTAP_TYPE_UMTS_RRC, "UMTS RRC" },
458 { GSMTAP_TYPE_LTE_RRC, "LTE RRC" },
459 { GSMTAP_TYPE_LTE_MAC, "LTE MAC" },
460 { GSMTAP_TYPE_LTE_MAC_FRAMED, "LTE MAC framed" },
461 { GSMTAP_TYPE_OSMOCORE_LOG, "libosmocore logging" },
462 { GSMTAP_TYPE_QC_DIAG, "Qualcomm DIAG" },
463 { GSMTAP_TYPE_LTE_NAS, "LTE NAS" },
464 { GSMTAP_TYPE_E1T1, "E1/T1" },
465 { GSMTAP_TYPE_GSM_RLP, "GSM RLP" },
466 { 0, NULL },
469 static const value_string gsmtap_um_voice_types[] = {
470 { GSMTAP_UM_VOICE_HR, "HR" },
471 { GSMTAP_UM_VOICE_FR, "FR" },
472 { GSMTAP_UM_VOICE_EFR, "EFR" },
473 { GSMTAP_UM_VOICE_AMR, "AMR" },
474 { GSMTAP_UM_VOICE_AMR_SID_BAD, "AMR_SID_BAD" },
475 { GSMTAP_UM_VOICE_AMR_ONSET, "AMR_ONSET" },
476 { GSMTAP_UM_VOICE_AMR_RATSCCH, "AMR_RATSCCH" },
477 { GSMTAP_UM_VOICE_AMR_SID_UPDATE_INH, "AMR_SID_UPDATE_INH" },
478 { GSMTAP_UM_VOICE_AMR_SID_FIRST_P1, "AMR_SID_FIRST_P1" },
479 { GSMTAP_UM_VOICE_AMR_SID_FIRST_P2, "AMR_SID_FIRST_P2" },
480 { GSMTAP_UM_VOICE_AMR_SID_FIRST_INH, "AMR_SID_FIRST_INH" },
481 { GSMTAP_UM_VOICE_AMR_RATSCCH_MARKER, "AMR_RATSCCH_MARKER" },
482 { GSMTAP_UM_VOICE_AMR_RATSCCH_DATA, "AMR_RATSCCH_DATA" },
483 { 0, NULL },
486 static const value_string gsmtap_um_e1t1_types[] = {
487 { GSMTAP_E1T1_LAPD, "LAPD" }, /* ISDN LAPD Q.921 */
488 { GSMTAP_E1T1_FR, "FR" }, /* Frame Relay */
489 { GSMTAP_E1T1_RAW, "RAW" }, /* RAW/transparent B-channels */
490 { GSMTAP_E1T1_TRAU16, "TRAU 16k" }, /* 16k/s sub-channels (I.460) with GSM TRAU frames */
491 { GSMTAP_E1T1_TRAU8, "TRAU 8k" }, /* 8k/s sub-channels (I.460) with GSM TRAU frames */
492 { GSMTAP_E1T1_V5EF, "V5-EF" }, /* V5 Envelope Function */
493 { GSMTAP_E1T1_X75, "X.75" }, /* X.75 B-channel data */
494 { GSMTAP_E1T1_V120, "V.120" }, /* V.120 B-channel data */
495 { GSMTAP_E1T1_V110, "V.110" }, /* V.110 B-channel data */
496 { GSMTAP_E1T1_H221, "H.221" }, /* H.221 B-channel data */
497 { GSMTAP_E1T1_PPP, "PPP" }, /* PPP */
498 { 0, NULL },
501 static const value_string gsmtap_sim_types[] = {
502 { GSMTAP_SIM_APDU, "APDU" },
503 { GSMTAP_SIM_ATR, "ATR" },
504 { GSMTAP_SIM_PPS_REQ, "PPS request" },
505 { GSMTAP_SIM_PPS_RSP, "PPS response" },
506 { GSMTAP_SIM_TPDU_HDR, "TPDU command header" },
507 { GSMTAP_SIM_TPDU_CMD, "TPDU command body" },
508 { GSMTAP_SIM_TPDU_RSP, "TPDU response body" },
509 { GSMTAP_SIM_TPDU_SW, "TPDU response trailer" },
510 { 0, NULL },
513 /* dissect a SACCH L1 header which is included in the first 2 bytes
514 * of every SACCH frame (according to TS 04.04) */
515 static void
516 dissect_sacch_l1h(tvbuff_t *tvb, proto_tree *tree)
518 proto_item *ti;
519 proto_tree *l1h_tree = NULL;
521 if (!tree)
522 return;
524 ti = proto_tree_add_protocol_format(tree, proto_gsmtap, tvb, 0, 2,
525 "SACCH L1 Header, Power Level: %u, Timing Advance: %u",
526 tvb_get_uint8(tvb, 0) & 0x1f,
527 tvb_get_uint8(tvb, 1));
528 l1h_tree = proto_item_add_subtree(ti, ett_gsmtap);
529 /* Power Level */
530 proto_tree_add_item(l1h_tree, hf_sacch_l1h_power_lev, tvb, 0, 1, ENC_BIG_ENDIAN);
531 /* Fast Power Control */
532 proto_tree_add_item(l1h_tree, hf_sacch_l1h_fpc, tvb, 0, 1, ENC_BIG_ENDIAN);
533 /* SRO/SRR (SACCH Repetition) bit */
534 proto_tree_add_item(l1h_tree, hf_sacch_l1h_sro_srr, tvb, 0, 1, ENC_BIG_ENDIAN);
535 /* Actual Timing Advance */
536 proto_tree_add_item(l1h_tree, hf_sacch_l1h_ta, tvb, 1, 1, ENC_BIG_ENDIAN);
539 /* Dissect a PTCCH/D (Packet Timing Advance Control Channel) message.
540 * See 3GPP TS 45.010, section 5.6.2 and 3GPP TS 45.002, section 3.3.4.2.
542 * +--------------+--------------+-----+---------------+------------------+
543 * | Octet 1 | Octet 2 | | Octet 16 | Octet 17 .. 23 |
544 * +---+----------+---+----------+-----+---+-----------+------------------+
545 * | 0 | TA TAI=0 | 0 | TA TAI=1 | ... | 0 | TA TAI=15 | Padding 00101011 |
546 * +---+----------+---+----------+-----+---+-----------+------------------+
548 static void
549 dissect_ptcch_dl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
551 proto_tree *sub_tree;
552 proto_item *ti, *gi;
553 int offset;
555 col_set_str(pinfo->cinfo, COL_INFO, "Packet Timing Advance Control");
557 if (!tree)
558 return;
560 ti = proto_tree_add_protocol_format(tree, proto_gsmtap, tvb, 0, 23,
561 "PTCCH (Packet Timing Advance Control Channel) on Downlink");
562 sub_tree = proto_item_add_subtree(ti, ett_gsmtap);
564 for (offset = 0; offset < 16; offset++) {
565 /* Meta info: Timing Advance Index */
566 gi = proto_tree_add_uint(sub_tree, hf_ptcch_ta_idx, tvb, 0, 0, offset);
567 proto_item_set_generated(gi);
569 proto_tree_add_item(sub_tree, hf_ptcch_spare, tvb, offset, 1, ENC_NA);
570 proto_tree_add_item(sub_tree, hf_ptcch_ta_val, tvb, offset, 1, ENC_NA);
573 /* Spare padding */
574 proto_tree_add_item(sub_tree, hf_ptcch_padding, tvb, offset, -1, ENC_NA);
577 static void
578 handle_lapdm(uint8_t sub_type, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
580 lapdm_data_t ld;
582 ld.is_acch = (sub_type & GSMTAP_CHANNEL_ACCH) != 0;
583 call_dissector_with_data(sub_handles[GSMTAP_SUB_UM_LAPDM], tvb, pinfo, tree, &ld);
586 static void
587 handle_rach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
589 uint8_t channel_type = GSMTAP_CHANNEL_RACH;
590 call_dissector_with_data(sub_handles[GSMTAP_SUB_UM], tvb, pinfo, tree, &channel_type);
593 static void
594 dissect_um_voice(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
596 tvbuff_t *payload_tvb;
597 uint8_t vtype = tvb_get_uint8(tvb, 0);
599 col_add_fstr(pinfo->cinfo, COL_INFO, "GSM CS User Plane (Voice/CSD): %s",
600 val_to_str(vtype, gsmtap_um_voice_types, "Unknown %d"));
602 proto_tree_add_item(tree, hf_um_voice_type, tvb, 0, 1, ENC_NA);
604 payload_tvb = tvb_new_subset_length(tvb, 1, tvb_reported_length(tvb)-1);
605 call_dissector(sub_handles[GSMTAP_SUB_DATA], payload_tvb, pinfo, tree);
608 static void
609 handle_tetra(int channel, tvbuff_t *payload_tvb, packet_info *pinfo, proto_tree *tree)
611 int tetra_chan;
612 if (channel < 0 || channel > GSMTAP_TETRA_TCH_F)
613 return;
615 tetra_chan = gsmtap_to_tetra[channel];
616 if (tetra_chan <= 0)
617 return;
619 tetra_dissect_pdu(tetra_chan, TETRA_DOWNLINK, payload_tvb, tree, pinfo);
622 /* length of an EGPRS RLC data block for given MCS */
623 static const unsigned data_block_len_by_mcs[] = {
624 0, /* MCS0 */
625 22, /* MCS1 */
633 74, /* MCS9 */
634 0, /* MCS_INVALID */
637 /* determine the number of rlc data blocks and their size / offsets */
638 static void
639 setup_rlc_mac_priv(RlcMacPrivateData_t *rm, bool is_uplink,
640 unsigned *n_calls, unsigned *data_block_bits, unsigned *data_block_offsets)
642 unsigned nc, dbl = 0, dbo[2] = {0,0};
644 dbl = data_block_len_by_mcs[rm->mcs];
646 switch (rm->block_format) {
647 case RLCMAC_HDR_TYPE_1:
648 nc = 3;
649 dbo[0] = is_uplink ? 5*8 + 6 : 5*8 + 0;
650 dbo[1] = dbo[0] + dbl * 8 + 2;
651 break;
652 case RLCMAC_HDR_TYPE_2:
653 nc = 2;
654 dbo[0] = is_uplink ? 4*8 + 5 : 3*8 + 4;
655 break;
656 case RLCMAC_HDR_TYPE_3:
657 nc = 2;
658 dbo[0] = 3*8 + 7;
659 break;
660 default:
661 nc = 1;
662 break;
665 *n_calls = nc;
666 *data_block_bits = dbl * 8 + 2;
667 data_block_offsets[0] = dbo[0];
668 data_block_offsets[1] = dbo[1];
671 /* bit-shift the entire 'src' of length 'length_bytes' by 'offset_bits'
672 * and store the reuslt to caller-allocated 'buffer'. The shifting is
673 * done lsb-first, unlike tvb_new_octet_aligned() */
674 static void clone_aligned_buffer_lsbf(unsigned offset_bits, unsigned length_bytes,
675 const uint8_t *src, uint8_t *buffer)
677 unsigned hdr_bytes;
678 unsigned extra_bits;
679 unsigned i;
681 uint8_t c, last_c;
682 uint8_t *dst;
684 hdr_bytes = offset_bits / 8;
685 extra_bits = offset_bits % 8;
687 if (extra_bits == 0) {
688 /* It is aligned already */
689 memmove(buffer, src + hdr_bytes, length_bytes);
690 return;
693 dst = buffer;
694 src = src + hdr_bytes;
695 last_c = *(src++);
697 for (i = 0; i < length_bytes; i++) {
698 c = src[i];
699 *(dst++) = (last_c >> extra_bits) | (c << (8 - extra_bits));
700 last_c = c;
704 /* obtain an (aligned) EGPRS data block with given bit-offset and
705 * bit-length from the parent TVB */
706 static tvbuff_t *get_egprs_data_block(tvbuff_t *tvb, unsigned offset_bits,
707 unsigned length_bits, packet_info *pinfo)
709 tvbuff_t *aligned_tvb;
710 const unsigned initial_spare_bits = 6;
711 uint8_t *aligned_buf;
712 unsigned min_src_length_bytes = (offset_bits + length_bits + 7) / 8;
713 unsigned length_bytes = (initial_spare_bits + length_bits + 7) / 8;
715 tvb_ensure_bytes_exist(tvb, 0, min_src_length_bytes);
717 aligned_buf = (uint8_t *) wmem_alloc(pinfo->pool, length_bytes);
719 /* Copy the data out of the tvb to an aligned buffer */
720 clone_aligned_buffer_lsbf(
721 offset_bits - initial_spare_bits, length_bytes,
722 tvb_get_ptr(tvb, 0, min_src_length_bytes),
723 aligned_buf);
725 /* clear spare bits and move block header bits to the right */
726 aligned_buf[0] = aligned_buf[0] >> initial_spare_bits;
728 aligned_tvb = tvb_new_child_real_data(tvb, aligned_buf,
729 length_bytes, length_bytes);
730 add_new_data_source(pinfo, aligned_tvb, "Aligned EGPRS data bits");
732 return aligned_tvb;
735 static void tvb_len_get_mcs_and_fmt(unsigned len, bool is_uplink, unsigned *frm, uint8_t *mcs)
737 if (len <= 5 && is_uplink) {
738 /* Assume random access burst */
739 *frm = RLCMAC_PRACH;
740 *mcs = 0;
741 return;
744 switch (len)
746 case 23: *frm = RLCMAC_CS1; *mcs = 0; break;
747 case 34: *frm = RLCMAC_CS2; *mcs = 0; break;
748 case 40: *frm = RLCMAC_CS3; *mcs = 0; break;
749 case 54: *frm = RLCMAC_CS4; *mcs = 0; break;
750 case 27: *frm = RLCMAC_HDR_TYPE_3; *mcs = 1; break;
751 case 33: *frm = RLCMAC_HDR_TYPE_3; *mcs = 2; break;
752 case 42: *frm = RLCMAC_HDR_TYPE_3; *mcs = 3; break;
753 case 49: *frm = RLCMAC_HDR_TYPE_3; *mcs = 4; break;
754 case 60: /* fall through */
755 case 61: *frm = RLCMAC_HDR_TYPE_2; *mcs = 5; break;
756 case 78: /* fall through */
757 case 79: *frm = RLCMAC_HDR_TYPE_2; *mcs = 6; break;
758 case 118: /* fall through */
759 case 119: *frm = RLCMAC_HDR_TYPE_1; *mcs = 7; break;
760 case 142: /* fall through */
761 case 143: *frm = RLCMAC_HDR_TYPE_1; *mcs = 8; break;
762 case 154: /* fall through */
763 case 155: *frm = RLCMAC_HDR_TYPE_1; *mcs = 9; break;
764 default: *frm = RLCMAC_CS1; *mcs = 0; break; /* TODO: report error instead */
768 static void
769 handle_rlcmac(uint32_t frame_nr, tvbuff_t *payload_tvb, packet_info *pinfo, proto_tree *tree)
772 int sub_handle;
773 RlcMacPrivateData_t rlcmac_data = {0};
774 tvbuff_t *data_tvb;
775 unsigned data_block_bits, data_block_offsets[2];
776 unsigned num_calls;
777 bool is_uplink;
779 if (pinfo->p2p_dir == P2P_DIR_SENT) {
780 is_uplink = 1;
781 sub_handle = GSMTAP_SUB_UM_RLC_MAC_UL;
782 } else {
783 is_uplink = 0;
784 sub_handle = GSMTAP_SUB_UM_RLC_MAC_DL;
787 rlcmac_data.magic = GSM_RLC_MAC_MAGIC_NUMBER;
788 rlcmac_data.frame_number = frame_nr;
790 tvb_len_get_mcs_and_fmt(tvb_reported_length(payload_tvb), is_uplink,
791 (unsigned *) &rlcmac_data.block_format,
792 (uint8_t *) &rlcmac_data.mcs);
794 switch (rlcmac_data.block_format) {
795 case RLCMAC_HDR_TYPE_1:
796 case RLCMAC_HDR_TYPE_2:
797 case RLCMAC_HDR_TYPE_3:
798 /* First call of RLC/MAC dissector for header */
799 call_dissector_with_data(sub_handles[sub_handle], payload_tvb,
800 pinfo, tree, (void *) &rlcmac_data);
802 /* now determine how to proceed for data */
803 setup_rlc_mac_priv(&rlcmac_data, is_uplink,
804 &num_calls, &data_block_bits, data_block_offsets);
806 /* and call dissector one or two time for the data blocks */
807 if (num_calls >= 2) {
808 rlcmac_data.flags = GSM_RLC_MAC_EGPRS_BLOCK1;
809 data_tvb = get_egprs_data_block(payload_tvb, data_block_offsets[0],
810 data_block_bits, pinfo);
811 call_dissector_with_data(sub_handles[sub_handle], data_tvb, pinfo, tree,
812 (void *) &rlcmac_data);
814 if (num_calls == 3) {
815 rlcmac_data.flags = GSM_RLC_MAC_EGPRS_BLOCK2;
816 data_tvb = get_egprs_data_block(payload_tvb, data_block_offsets[1],
817 data_block_bits, pinfo);
818 call_dissector_with_data(sub_handles[sub_handle], data_tvb, pinfo, tree,
819 (void *) &rlcmac_data);
821 break;
822 default:
823 /* regular GPRS CS doesn't need any
824 * shifting/re-alignment or even separate calls for
825 * header and data blocks. We simply call the dissector
826 * as-is */
827 call_dissector_with_data(sub_handles[sub_handle], payload_tvb, pinfo, tree,
828 (void *) &rlcmac_data);
832 /* dissect a GSMTAP v2 header and hand payload off to respective dissector */
833 static int
834 dissect_gsmtap_v2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
836 int sub_handle, sub_handle_idx = 0, len, offset = 0;
837 proto_item *ti;
838 proto_tree *gsmtap_tree = NULL;
839 tvbuff_t *payload_tvb, *l1h_tvb = NULL;
840 uint8_t hdr_len, type, sub_type, timeslot, subslot;
841 uint16_t arfcn;
842 uint32_t frame_nr;
844 len = tvb_reported_length(tvb);
846 hdr_len = tvb_get_uint8(tvb, offset + 1) <<2;
847 type = tvb_get_uint8(tvb, offset + 2);
848 timeslot = tvb_get_uint8(tvb, offset + 3);
849 arfcn = tvb_get_ntohs(tvb, offset + 4);
850 frame_nr = tvb_get_ntohl(tvb, offset + 8);
851 sub_type = tvb_get_uint8(tvb, offset + 12);
852 subslot = tvb_get_uint8(tvb, offset + 14);
854 /* In case of a SACCH, there is a two-byte L1 header in front
855 * of the packet (see TS 04.04) */
856 if (type == GSMTAP_TYPE_UM &&
857 sub_type & GSMTAP_CHANNEL_ACCH) {
858 l1h_tvb = tvb_new_subset_length(tvb, hdr_len, 2);
859 payload_tvb = tvb_new_subset_length(tvb, hdr_len+2, len-(hdr_len+2));
860 } else {
861 payload_tvb = tvb_new_subset_length(tvb, hdr_len, len-hdr_len);
864 /* We don't want any UDP related info left in the INFO field, as the
865 * gsm_a_dtap dissector will not clear but only append */
866 col_clear(pinfo->cinfo, COL_INFO);
868 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSMTAP");
870 ti = proto_tree_add_protocol_format(tree, proto_gsmtap, tvb, 0, hdr_len,
871 "GSM TAP Header");
872 gsmtap_tree = proto_item_add_subtree(ti, ett_gsmtap);
873 proto_tree_add_item(gsmtap_tree, hf_gsmtap_version,
874 tvb, offset, 1, ENC_BIG_ENDIAN);
875 proto_tree_add_uint(gsmtap_tree, hf_gsmtap_hdrlen,
876 tvb, offset+1, 1, hdr_len);
877 proto_tree_add_item(gsmtap_tree, hf_gsmtap_type,
878 tvb, offset+2, 1, ENC_BIG_ENDIAN);
879 /* Some GSMTAP types are completely unrelated to the Um air interface */
880 if (dissector_try_uint(gsmtap_dissector_table, type, payload_tvb,
881 pinfo, tree))
882 return tvb_captured_length(tvb);
884 if (arfcn & GSMTAP_ARFCN_F_UPLINK) {
885 col_set_str(pinfo->cinfo, COL_RES_NET_SRC, "MS");
886 col_set_str(pinfo->cinfo, COL_RES_NET_DST, "BTS");
887 /* p2p_dir is used by the LAPDm dissector */
888 pinfo->p2p_dir = P2P_DIR_SENT;
889 } else {
890 col_set_str(pinfo->cinfo, COL_RES_NET_SRC, "BTS");
891 switch (sub_type & ~GSMTAP_CHANNEL_ACCH) {
892 case GSMTAP_CHANNEL_BCCH:
893 case GSMTAP_CHANNEL_CCCH:
894 case GSMTAP_CHANNEL_PCH:
895 case GSMTAP_CHANNEL_AGCH:
896 case GSMTAP_CHANNEL_CBCH51:
897 case GSMTAP_CHANNEL_CBCH52:
898 case GSMTAP_CHANNEL_PTCCH:
899 col_set_str(pinfo->cinfo, COL_RES_NET_DST, "Broadcast");
900 break;
901 default:
902 col_set_str(pinfo->cinfo, COL_RES_NET_DST, "MS");
903 break;
905 /* p2p_dir is used by the LAPDm dissector */
906 pinfo->p2p_dir = P2P_DIR_RECV;
909 /* Try to build an identifier of different 'streams' */
910 /* (AFCN _cant_ be used because of hopping */
911 conversation_set_elements_by_id(pinfo, CONVERSATION_GSMTAP, (timeslot << 3) | subslot);
913 if (tree) {
914 if (type == GSMTAP_TYPE_SIM) {
915 /* Skip parsing radio fields for SIM type. */
916 proto_tree_add_item(gsmtap_tree, hf_gsmtap_sim_sub_type,
917 tvb, offset+12, 1, ENC_BIG_ENDIAN);
918 } else {
919 uint8_t channel;
920 const char *channel_str;
921 channel = tvb_get_uint8(tvb, offset+12);
922 if (type == GSMTAP_TYPE_TETRA_I1)
923 channel_str = val_to_str(channel, gsmtap_tetra_channels, "Unknown: %d");
924 else if (type == GSMTAP_TYPE_GMR1_UM)
925 channel_str = val_to_str(channel, gsmtap_gmr1_channels, "Unknown: %d");
926 else
927 channel_str = val_to_str(channel, gsmtap_channels, "Unknown: %d");
929 proto_item_append_text(ti, ", ARFCN: %u (%s), TS: %u, Channel: %s (%u)",
930 arfcn & GSMTAP_ARFCN_MASK,
931 arfcn & GSMTAP_ARFCN_F_UPLINK ? "Uplink" : "Downlink",
932 tvb_get_uint8(tvb, offset+3),
933 channel_str,
934 tvb_get_uint8(tvb, offset+14));
935 proto_tree_add_item(gsmtap_tree, hf_gsmtap_timeslot,
936 tvb, offset+3, 1, ENC_BIG_ENDIAN);
937 proto_tree_add_item(gsmtap_tree, hf_gsmtap_arfcn,
938 tvb, offset+4, 2, ENC_BIG_ENDIAN);
939 proto_tree_add_item(gsmtap_tree, hf_gsmtap_uplink,
940 tvb, offset+4, 2, ENC_BIG_ENDIAN);
941 proto_tree_add_item(gsmtap_tree, hf_gsmtap_pcs,
942 tvb, offset+4, 2, ENC_BIG_ENDIAN);
943 proto_tree_add_item(gsmtap_tree, hf_gsmtap_signal_dbm,
944 tvb, offset+6, 1, ENC_BIG_ENDIAN);
945 proto_tree_add_item(gsmtap_tree, hf_gsmtap_snr_db,
946 tvb, offset+7, 1, ENC_BIG_ENDIAN);
947 proto_tree_add_item(gsmtap_tree, hf_gsmtap_frame_nr,
948 tvb, offset+8, 4, ENC_BIG_ENDIAN);
949 if (type == GSMTAP_TYPE_UM_BURST)
950 proto_tree_add_item(gsmtap_tree, hf_gsmtap_burst_type,
951 tvb, offset+12, 1, ENC_BIG_ENDIAN);
952 else if (type == GSMTAP_TYPE_UM)
953 proto_tree_add_item(gsmtap_tree, hf_gsmtap_channel_type,
954 tvb, offset+12, 1, ENC_BIG_ENDIAN);
955 else if (type == GSMTAP_TYPE_TETRA_I1)
956 proto_tree_add_item(gsmtap_tree, hf_gsmtap_tetra_channel_type,
957 tvb, offset+12, 1, ENC_BIG_ENDIAN);
958 else if (type == GSMTAP_TYPE_WMX_BURST)
959 proto_tree_add_item(gsmtap_tree, hf_gsmtap_burst_type,
960 tvb, offset+12, 1, ENC_BIG_ENDIAN);
961 else if (type == GSMTAP_TYPE_GMR1_UM)
962 proto_tree_add_item(gsmtap_tree, hf_gsmtap_gmr1_channel_type,
963 tvb, offset+12, 1, ENC_BIG_ENDIAN);
964 else if (type == GSMTAP_TYPE_UMTS_RRC)
965 proto_tree_add_item(gsmtap_tree, hf_gsmtap_rrc_sub_type,
966 tvb, offset+12, 1, ENC_BIG_ENDIAN);
967 else if (type == GSMTAP_TYPE_E1T1)
968 proto_tree_add_item(gsmtap_tree, hf_gsmtap_e1t1_sub_type,
969 tvb, offset+12, 1, ENC_BIG_ENDIAN);
970 proto_tree_add_item(gsmtap_tree, hf_gsmtap_antenna,
971 tvb, offset+13, 1, ENC_BIG_ENDIAN);
972 proto_tree_add_item(gsmtap_tree, hf_gsmtap_subslot,
973 tvb, offset+14, 1, ENC_BIG_ENDIAN);
977 switch (type) {
978 case GSMTAP_TYPE_SIM:
979 sub_handle = GSMTAP_SUB_SIM;
980 switch (sub_type) {
981 case GSMTAP_SIM_ATR:
982 sub_handle_idx = GSMTAP_SIM_SUB_ATR;
983 break;
984 default:
985 sub_handle_idx = GSMTAP_SIM_SUB_APDU;
986 break;
988 break;
989 case GSMTAP_TYPE_UMTS_RRC:
990 sub_handle = GSMTAP_SUB_UMTS_RRC;
991 sub_handle_idx = sub_type;
992 if (sub_handle_idx >= GSMTAP_RRC_SUB_MAX) {
993 sub_handle = GSMTAP_SUB_DATA;
995 /* make entry in the Protocol column on summary display.
996 * Normally, the RRC dissector would be doing this, but
997 * we are bypassing dissect_rrc() and directly call a
998 * sub-dissector */
999 col_set_str(pinfo->cinfo, COL_PROTOCOL, "RRC");
1000 break;
1001 case GSMTAP_TYPE_LTE_RRC:
1002 sub_handle = GSMTAP_SUB_LTE_RRC;
1003 sub_handle_idx = sub_type;
1004 if (sub_handle_idx >= GSMTAP_LTE_RRC_SUB_MAX) {
1005 sub_handle = GSMTAP_SUB_DATA;
1007 /*Directly call the respective lte rrc message dissector */
1008 break;
1009 case GSMTAP_TYPE_LTE_NAS:
1010 sub_handle = GSMTAP_SUB_LTE_NAS;
1011 sub_handle_idx = sub_type;
1012 if (sub_handle_idx >= GSMTAP_LTE_NAS_SUB_MAX) {
1013 sub_handle = GSMTAP_SUB_DATA;
1015 break;
1017 case GSMTAP_TYPE_UM:
1018 if (l1h_tvb)
1019 dissect_sacch_l1h(l1h_tvb, tree);
1020 switch (sub_type & ~GSMTAP_CHANNEL_ACCH) {
1021 case GSMTAP_CHANNEL_BCCH:
1022 case GSMTAP_CHANNEL_CCCH:
1023 case GSMTAP_CHANNEL_PCH:
1024 case GSMTAP_CHANNEL_AGCH:
1025 /* FIXME: we might want to skip idle frames */
1026 sub_handle = GSMTAP_SUB_UM;
1027 break;
1028 case GSMTAP_CHANNEL_SDCCH:
1029 case GSMTAP_CHANNEL_SDCCH4:
1030 case GSMTAP_CHANNEL_SDCCH8:
1031 case GSMTAP_CHANNEL_TCH_F:
1032 case GSMTAP_CHANNEL_TCH_H:
1033 handle_lapdm(sub_type, payload_tvb, pinfo, tree);
1034 return tvb_captured_length(tvb);
1035 case GSMTAP_CHANNEL_PACCH:
1036 if (pinfo->p2p_dir == P2P_DIR_SENT) {
1037 sub_handle = GSMTAP_SUB_UM_RLC_MAC_UL;
1039 else
1041 sub_handle = GSMTAP_SUB_UM_RLC_MAC_DL;
1043 break;
1044 case GSMTAP_CHANNEL_PDTCH:
1045 handle_rlcmac(frame_nr, payload_tvb, pinfo, tree);
1046 return tvb_captured_length(tvb);
1047 /* See 3GPP TS 45.003, section 5.2 "Packet control channels" */
1048 case GSMTAP_CHANNEL_PTCCH:
1049 /* PTCCH/D carries Timing Advance updates encoded with CS-1 */
1050 if (pinfo->p2p_dir == P2P_DIR_RECV) {
1051 dissect_ptcch_dl(payload_tvb, pinfo, tree);
1052 return tvb_captured_length(tvb);
1055 /* PTCCH/U carries Access Bursts for Timing Advance estimation */
1056 sub_handle = GSMTAP_SUB_DATA;
1057 break;
1059 case GSMTAP_CHANNEL_CBCH51:
1060 case GSMTAP_CHANNEL_CBCH52:
1061 sub_handle = GSMTAP_SUB_CBCH;
1062 break;
1064 case GSMTAP_CHANNEL_VOICE_F:
1065 case GSMTAP_CHANNEL_VOICE_H:
1066 dissect_um_voice(payload_tvb, pinfo, tree);
1067 return tvb_captured_length(tvb);
1069 case GSMTAP_CHANNEL_RACH:
1070 handle_rach(payload_tvb, pinfo, tree);
1071 return tvb_captured_length(tvb);
1073 default:
1074 sub_handle = GSMTAP_SUB_DATA;
1075 break;
1077 break;
1078 case GSMTAP_TYPE_ABIS:
1079 sub_handle = GSMTAP_SUB_ABIS;
1080 break;
1081 case GSMTAP_TYPE_GB_LLC:
1082 sub_handle = GSMTAP_SUB_LLC;
1083 break;
1084 case GSMTAP_TYPE_GB_SNDCP:
1085 sub_handle = GSMTAP_SUB_SNDCP;
1086 break;
1087 case GSMTAP_TYPE_TETRA_I1:
1088 handle_tetra(tvb_get_uint8(tvb, offset+12), payload_tvb, pinfo, tree);
1089 return tvb_captured_length(tvb);
1090 case GSMTAP_TYPE_WMX_BURST:
1091 switch (sub_type) {
1092 case GSMTAP_BURST_CDMA_CODE:
1093 sub_handle = GSMTAP_SUB_CDMA_CODE;
1094 break;
1095 case GSMTAP_BURST_FCH:
1096 sub_handle = GSMTAP_SUB_FCH;
1097 break;
1098 case GSMTAP_BURST_FFB:
1099 sub_handle = GSMTAP_SUB_FFB;
1100 break;
1101 case GSMTAP_BURST_PDU:
1102 sub_handle = GSMTAP_SUB_PDU;
1103 break;
1104 case GSMTAP_BURST_HACK:
1105 sub_handle = GSMTAP_SUB_HACK;
1106 break;
1107 case GSMTAP_BURST_PHY_ATTRIBUTES:
1108 sub_handle = GSMTAP_SUB_PHY_ATTRIBUTES;
1109 break;
1110 default:
1111 sub_handle = GSMTAP_SUB_DATA;
1112 break;
1114 break;
1115 case GSMTAP_TYPE_GMR1_UM:
1116 switch (sub_type) {
1117 case GSMTAP_GMR1_BCCH:
1118 sub_handle = GSMTAP_SUB_GMR1_BCCH;
1119 break;
1120 case GSMTAP_GMR1_CCCH:
1121 case GSMTAP_GMR1_AGCH:
1122 case GSMTAP_GMR1_PCH:
1123 sub_handle = GSMTAP_SUB_GMR1_CCCH;
1124 break;
1125 case GSMTAP_GMR1_SDCCH:
1126 case GSMTAP_GMR1_TCH3 | GSMTAP_GMR1_FACCH:
1127 case GSMTAP_GMR1_TCH6 | GSMTAP_GMR1_FACCH:
1128 case GSMTAP_GMR1_TCH9 | GSMTAP_GMR1_FACCH:
1129 sub_handle = GSMTAP_SUB_GMR1_LAPSAT;
1130 break;
1131 case GSMTAP_GMR1_RACH:
1132 sub_handle = GSMTAP_SUB_GMR1_RACH;
1133 break;
1134 default:
1135 sub_handle = GSMTAP_SUB_DATA;
1136 break;
1138 break;
1139 case GSMTAP_TYPE_E1T1:
1140 switch (sub_type) {
1141 case GSMTAP_E1T1_LAPD:
1142 sub_handle = GSMTAP_SUB_LAPD;
1143 if (sub_handles[sub_handle]) {
1144 struct isdn_phdr isdn;
1145 isdn.uton = pinfo->p2p_dir == P2P_DIR_SENT ? 1 : 0;
1146 isdn.channel = 0;
1147 call_dissector_with_data(sub_handles[sub_handle], payload_tvb, pinfo, tree, &isdn);
1149 return tvb_captured_length(tvb);
1150 case GSMTAP_E1T1_FR:
1151 sub_handle = GSMTAP_SUB_FR;
1152 break;
1153 case GSMTAP_E1T1_V5EF:
1154 sub_handle = GSMTAP_SUB_V5EF;
1155 if (sub_handles[sub_handle]) {
1156 struct isdn_phdr isdn;
1157 isdn.uton = pinfo->p2p_dir == P2P_DIR_SENT ? 1 : 0;
1158 isdn.channel = 0;
1159 call_dissector_with_data(sub_handles[sub_handle], payload_tvb, pinfo, tree, &isdn);
1161 return tvb_captured_length(tvb);
1162 case GSMTAP_E1T1_PPP:
1163 sub_handle = GSMTAP_SUB_PPP;
1164 if (sub_handles[sub_handle]) {
1165 struct isdn_phdr isdn;
1166 isdn.uton = pinfo->p2p_dir == P2P_DIR_SENT ? 1 : 0;
1167 isdn.channel = 0;
1168 call_dissector_with_data(sub_handles[sub_handle], payload_tvb, pinfo, tree, &isdn);
1170 return tvb_captured_length(tvb);
1171 case GSMTAP_E1T1_V120:
1172 sub_handle = GSMTAP_SUB_V120;
1173 if (sub_handles[sub_handle]) {
1174 struct isdn_phdr isdn;
1175 isdn.uton = pinfo->p2p_dir == P2P_DIR_SENT ? 1 : 0;
1176 isdn.channel = 0;
1177 call_dissector_with_data(sub_handles[sub_handle], payload_tvb, pinfo, tree, &isdn);
1179 return tvb_captured_length(tvb);
1180 case GSMTAP_E1T1_X75:
1181 sub_handle = GSMTAP_SUB_X75;
1182 if (sub_handles[sub_handle]) {
1183 struct isdn_phdr isdn;
1184 isdn.uton = pinfo->p2p_dir == P2P_DIR_SENT ? 1 : 0;
1185 isdn.channel = 0;
1186 call_dissector_with_data(sub_handles[sub_handle], payload_tvb, pinfo, tree, &isdn);
1188 return tvb_captured_length(tvb);
1189 default:
1190 sub_handle = GSMTAP_SUB_DATA;
1191 break;
1193 break;
1194 case GSMTAP_TYPE_GSM_RLP:
1195 sub_handle = GSMTAP_SUB_GSM_RLP;
1196 break;
1197 case GSMTAP_TYPE_UM_BURST:
1198 default:
1199 sub_handle = GSMTAP_SUB_DATA;
1200 break;
1202 switch (sub_handle){
1203 case GSMTAP_SUB_SIM:
1204 call_dissector(sim_sub_handles[sub_handle_idx], payload_tvb,
1205 pinfo, tree);
1206 break;
1207 case GSMTAP_SUB_UMTS_RRC:
1208 call_dissector(rrc_sub_handles[sub_handle_idx], payload_tvb,
1209 pinfo, tree);
1210 break;
1211 case GSMTAP_SUB_LTE_RRC:
1212 call_dissector(lte_rrc_sub_handles[sub_handle_idx], payload_tvb,
1213 pinfo, tree);
1214 break;
1215 case GSMTAP_SUB_LTE_NAS:
1216 call_dissector(lte_nas_sub_handles[sub_handle_idx], payload_tvb,
1217 pinfo, tree);
1218 break;
1219 default:
1220 if (sub_handles[sub_handle] != NULL)
1221 call_dissector(sub_handles[sub_handle], payload_tvb, pinfo, tree);
1222 break;
1224 /* TODO: warn user that the WiMAX plugin must be enabled for some types */
1225 return tvb_captured_length(tvb);
1228 static int
1229 dissect_gsmtap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1231 uint8_t version;
1232 proto_tree *gsmtap_tree;
1233 proto_item *ti, *tf;
1235 version = tvb_get_uint8(tvb, 0);
1237 if (version == 2) {
1238 return dissect_gsmtap_v2(tvb, pinfo, tree, data);
1241 /* Unknown GSMTAP version */
1242 ti = proto_tree_add_protocol_format(tree, proto_gsmtap, tvb, 0, 1, "GSMTAP, unknown version (%u)", version);
1243 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSMTAP");
1244 col_clear(pinfo->cinfo, COL_INFO);
1245 col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown GSMTAP version (%u)", version);
1246 gsmtap_tree = proto_item_add_subtree(ti, ett_gsmtap);
1247 tf = proto_tree_add_item(gsmtap_tree, hf_gsmtap_version, tvb, 0, 1, ENC_BIG_ENDIAN);
1248 expert_add_info(pinfo, tf, &ei_gsmtap_unknown_gsmtap_version);
1249 return 1;
1252 void
1253 proto_register_gsmtap(void)
1255 static hf_register_info hf[] = {
1256 { &hf_gsmtap_version, { "Version", "gsmtap.version",
1257 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
1258 { &hf_gsmtap_hdrlen, { "Header Length", "gsmtap.hdr_len",
1259 FT_UINT8, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0, NULL, HFILL } },
1260 { &hf_gsmtap_type, { "Payload Type", "gsmtap.type",
1261 FT_UINT8, BASE_DEC, VALS(gsmtap_types), 0, NULL, HFILL } },
1262 { &hf_gsmtap_timeslot, { "Time Slot", "gsmtap.ts",
1263 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
1264 { &hf_gsmtap_arfcn, { "ARFCN", "gsmtap.arfcn",
1265 FT_UINT16, BASE_DEC, NULL, GSMTAP_ARFCN_MASK, NULL, HFILL } },
1266 { &hf_gsmtap_uplink, { "Uplink", "gsmtap.uplink",
1267 FT_UINT16, BASE_DEC, NULL, GSMTAP_ARFCN_F_UPLINK, NULL, HFILL } },
1268 { &hf_gsmtap_pcs, { "PCS band indicator", "gsmtap.pcs_band",
1269 FT_UINT16, BASE_DEC, NULL, GSMTAP_ARFCN_F_PCS, NULL, HFILL } },
1270 { &hf_gsmtap_signal_dbm, { "Signal Level", "gsmtap.signal_dbm",
1271 FT_INT8, BASE_DEC | BASE_UNIT_STRING, UNS(&units_dbm), 0, NULL, HFILL } },
1272 { &hf_gsmtap_snr_db, { "Signal/Noise Ratio", "gsmtap.snr_db",
1273 FT_INT8, BASE_DEC | BASE_UNIT_STRING, UNS(&units_decibels), 0, NULL, HFILL } },
1274 { &hf_gsmtap_frame_nr, { "GSM Frame Number", "gsmtap.frame_nr",
1275 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } },
1276 { &hf_gsmtap_burst_type, { "Burst Type", "gsmtap.burst_type",
1277 FT_UINT8, BASE_DEC, VALS(gsmtap_bursts), 0, NULL, HFILL }},
1278 { &hf_gsmtap_channel_type, { "Channel Type", "gsmtap.chan_type",
1279 FT_UINT8, BASE_DEC, VALS(gsmtap_channels), 0, NULL, HFILL }},
1280 { &hf_gsmtap_tetra_channel_type, { "Channel Type", "gsmtap.tetra_chan_type",
1281 FT_UINT8, BASE_DEC, VALS(gsmtap_tetra_channels), 0, NULL, HFILL }},
1282 { &hf_gsmtap_gmr1_channel_type, { "Channel Type", "gsmtap.gmr1_chan_type",
1283 FT_UINT8, BASE_DEC, VALS(gsmtap_gmr1_channels), 0, NULL, HFILL }},
1284 { &hf_gsmtap_rrc_sub_type, { "Message Type", "gsmtap.rrc_sub_type",
1285 FT_UINT8, BASE_DEC, VALS(rrc_sub_types), 0, NULL, HFILL }},
1286 { &hf_gsmtap_e1t1_sub_type, { "Channel Type", "gsmtap.e1t1_sub_type",
1287 FT_UINT8, BASE_DEC, VALS(gsmtap_um_e1t1_types), 0, NULL, HFILL }},
1288 { &hf_gsmtap_sim_sub_type, { "SIM Type", "gsmtap.sim_sub_type",
1289 FT_UINT8, BASE_DEC, VALS(gsmtap_sim_types), 0, NULL, HFILL }},
1290 { &hf_gsmtap_antenna, { "Antenna Number", "gsmtap.antenna",
1291 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
1292 { &hf_gsmtap_subslot, { "Sub-Slot", "gsmtap.sub_slot",
1293 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
1295 { &hf_sacch_l1h_power_lev, { "MS power level", "gsmtap.sacch_l1.power_lev",
1296 FT_UINT8, BASE_DEC, NULL, 0x1f, NULL, HFILL } },
1297 { &hf_sacch_l1h_fpc, { "FPC (Fast Power Control)", "gsmtap.sacch_l1.fpc",
1298 FT_BOOLEAN, 8, TFS(&tfs_inuse_not_inuse), 0x20, NULL, HFILL } },
1299 { &hf_sacch_l1h_sro_srr, { "SRO/SRR (SACCH Repetition)", "gsmtap.sacch_l1.sro_srr",
1300 FT_BOOLEAN, 8, TFS(&tfs_required_not_required), 0x40, NULL, HFILL } },
1301 { &hf_sacch_l1h_ta, { "Actual Timing Advance", "gsmtap.sacch_l1.ta",
1302 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
1303 { &hf_um_voice_type, { "GSM Um Voice Type", "gsmtap.um_voice_type",
1304 FT_UINT8, BASE_DEC, VALS(gsmtap_um_voice_types), 0, NULL, HFILL } },
1306 /* PTCCH (Packet Timing Advance Control Channel) on Downlink */
1307 { &hf_ptcch_spare, { "Spare Bit", "gsmtap.ptcch.spare",
1308 FT_UINT8, BASE_DEC, NULL, 0x80, NULL, HFILL } },
1309 { &hf_ptcch_ta_idx, { "Timing Advance Index", "gsmtap.ptcch.ta_idx",
1310 FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
1311 { &hf_ptcch_ta_val, { "Timing Advance Value", "gsmtap.ptcch.ta_val",
1312 FT_UINT8, BASE_DEC, NULL, 0x7f, NULL, HFILL } },
1313 { &hf_ptcch_padding, { "Spare Padding", "gsmtap.ptcch.padding",
1314 FT_BYTES, SEP_SPACE, NULL, 0, NULL, HFILL } },
1316 static int *ett[] = {
1317 &ett_gsmtap
1319 static ei_register_info ei[] = {
1320 { &ei_gsmtap_unknown_gsmtap_version, { "gsmtap.version.invalid", PI_PROTOCOL, PI_WARN, "Unknown protocol version", EXPFILL }},
1323 expert_module_t* expert_gsmtap;
1325 proto_gsmtap = proto_register_protocol("GSM Radiotap", "GSMTAP", "gsmtap");
1326 proto_register_field_array(proto_gsmtap, hf, array_length(hf));
1327 proto_register_subtree_array(ett, array_length(ett));
1328 expert_gsmtap = expert_register_protocol(proto_gsmtap);
1329 expert_register_field_array(expert_gsmtap, ei, array_length(ei));
1331 gsmtap_dissector_table = register_dissector_table("gsmtap.type",
1332 "GSMTAP type", proto_gsmtap, FT_UINT8, BASE_HEX);
1334 gsmtap_handle = register_dissector("gsmtap", dissect_gsmtap, proto_gsmtap);
1337 void
1338 proto_reg_handoff_gsmtap(void)
1340 /* TODO: some dissectors may be NULL if not loaded */
1341 sub_handles[GSMTAP_SUB_DATA] = find_dissector("data");
1342 sub_handles[GSMTAP_SUB_UM] = find_dissector_add_dependency("gsm_a_ccch", proto_gsmtap);
1343 sub_handles[GSMTAP_SUB_UM_LAPDM] = find_dissector_add_dependency("lapdm", proto_gsmtap);
1344 sub_handles[GSMTAP_SUB_UM_RLC_MAC_UL] = find_dissector_add_dependency("gsm_rlcmac_ul", proto_gsmtap);
1345 sub_handles[GSMTAP_SUB_UM_RLC_MAC_DL] = find_dissector_add_dependency("gsm_rlcmac_dl", proto_gsmtap);
1346 sub_handles[GSMTAP_SUB_LLC] = find_dissector_add_dependency("llcgprs", proto_gsmtap);
1347 sub_handles[GSMTAP_SUB_SNDCP] = find_dissector_add_dependency("sndcp", proto_gsmtap);
1348 sub_handles[GSMTAP_SUB_ABIS] = find_dissector_add_dependency("gsm_a_dtap", proto_gsmtap);
1349 sub_handles[GSMTAP_SUB_CDMA_CODE] = find_dissector_add_dependency("wimax_cdma_code_burst_handler", proto_gsmtap);
1350 sub_handles[GSMTAP_SUB_FCH] = find_dissector_add_dependency("wimax_fch_burst_handler", proto_gsmtap);
1351 sub_handles[GSMTAP_SUB_FFB] = find_dissector_add_dependency("wimax_ffb_burst_handler", proto_gsmtap);
1352 sub_handles[GSMTAP_SUB_PDU] = find_dissector_add_dependency("wimax_pdu_burst_handler", proto_gsmtap);
1353 sub_handles[GSMTAP_SUB_HACK] = find_dissector_add_dependency("wimax_hack_burst_handler", proto_gsmtap);
1354 sub_handles[GSMTAP_SUB_PHY_ATTRIBUTES] = find_dissector_add_dependency("wimax_phy_attributes_burst_handler", proto_gsmtap);
1355 sub_handles[GSMTAP_SUB_CBCH] = find_dissector_add_dependency("gsm_cbch", proto_gsmtap);
1356 sub_handles[GSMTAP_SUB_GMR1_BCCH] = find_dissector_add_dependency("gmr1_bcch", proto_gsmtap);
1357 sub_handles[GSMTAP_SUB_GMR1_CCCH] = find_dissector_add_dependency("gmr1_ccch", proto_gsmtap);
1358 sub_handles[GSMTAP_SUB_GMR1_LAPSAT] = find_dissector_add_dependency("lapsat", proto_gsmtap);
1359 sub_handles[GSMTAP_SUB_GMR1_RACH] = find_dissector_add_dependency("gmr1_rach", proto_gsmtap);
1360 sub_handles[GSMTAP_SUB_UMTS_RRC] = find_dissector_add_dependency("rrc", proto_gsmtap);
1361 sub_handles[GSMTAP_SUB_LAPD] = find_dissector_add_dependency("lapd-phdr", proto_gsmtap);
1362 sub_handles[GSMTAP_SUB_FR] = find_dissector_add_dependency("fr", proto_gsmtap);
1363 sub_handles[GSMTAP_SUB_V5EF] = find_dissector_add_dependency("v5ef", proto_gsmtap);
1364 sub_handles[GSMTAP_SUB_GSM_RLP] = find_dissector_add_dependency("gsm_rlp", proto_gsmtap);
1365 sub_handles[GSMTAP_SUB_PPP] = find_dissector_add_dependency("ppp", proto_gsmtap);
1366 sub_handles[GSMTAP_SUB_V120] = find_dissector_add_dependency("v120", proto_gsmtap);
1367 sub_handles[GSMTAP_SUB_X75] = find_dissector_add_dependency("x75", proto_gsmtap);
1369 sim_sub_handles[GSMTAP_SIM_SUB_APDU] = find_dissector_add_dependency("gsm_sim", proto_gsmtap);
1370 sim_sub_handles[GSMTAP_SIM_SUB_ATR] = find_dissector_add_dependency("iso7816.atr", proto_gsmtap);
1372 rrc_sub_handles[GSMTAP_RRC_SUB_DL_DCCH_Message] = find_dissector_add_dependency("rrc.dl.dcch", proto_gsmtap);
1373 rrc_sub_handles[GSMTAP_RRC_SUB_UL_DCCH_Message] = find_dissector_add_dependency("rrc.ul.dcch", proto_gsmtap);
1374 rrc_sub_handles[GSMTAP_RRC_SUB_DL_CCCH_Message] = find_dissector_add_dependency("rrc.dl.ccch", proto_gsmtap);
1375 rrc_sub_handles[GSMTAP_RRC_SUB_UL_CCCH_Message] = find_dissector_add_dependency("rrc.ul.ccch", proto_gsmtap);
1376 rrc_sub_handles[GSMTAP_RRC_SUB_PCCH_Message] = find_dissector_add_dependency("rrc.pcch", proto_gsmtap);
1377 rrc_sub_handles[GSMTAP_RRC_SUB_DL_SHCCH_Message] = find_dissector_add_dependency("rrc.dl.shcch", proto_gsmtap);
1378 rrc_sub_handles[GSMTAP_RRC_SUB_UL_SHCCH_Message] = find_dissector_add_dependency("rrc.ul.shcch", proto_gsmtap);
1379 rrc_sub_handles[GSMTAP_RRC_SUB_BCCH_FACH_Message] = find_dissector_add_dependency("rrc.bcch.fach", proto_gsmtap);
1380 rrc_sub_handles[GSMTAP_RRC_SUB_BCCH_BCH_Message] = find_dissector_add_dependency("rrc.bcch.bch", proto_gsmtap);
1381 rrc_sub_handles[GSMTAP_RRC_SUB_MCCH_Message] = find_dissector_add_dependency("rrc.mcch", proto_gsmtap);
1382 rrc_sub_handles[GSMTAP_RRC_SUB_MSCH_Message] = find_dissector_add_dependency("rrc.msch", proto_gsmtap);
1383 rrc_sub_handles[GSMTAP_RRC_SUB_HandoverToUTRANCommand] = find_dissector_add_dependency("rrc.irat.ho_to_utran_cmd", proto_gsmtap);
1384 rrc_sub_handles[GSMTAP_RRC_SUB_InterRATHandoverInfo] = find_dissector_add_dependency("rrc.irat.irat_ho_info", proto_gsmtap);
1385 rrc_sub_handles[GSMTAP_RRC_SUB_SystemInformation_BCH] = find_dissector_add_dependency("rrc.sysinfo", proto_gsmtap);
1386 rrc_sub_handles[GSMTAP_RRC_SUB_System_Information_Container] = find_dissector_add_dependency("rrc.sysinfo.cont", proto_gsmtap);
1387 rrc_sub_handles[GSMTAP_RRC_SUB_UE_RadioAccessCapabilityInfo] = find_dissector_add_dependency("rrc.ue_radio_access_cap_info", proto_gsmtap);
1388 rrc_sub_handles[GSMTAP_RRC_SUB_MasterInformationBlock] = find_dissector_add_dependency("rrc.si.mib", proto_gsmtap);
1389 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType1] = find_dissector_add_dependency("rrc.si.sib1", proto_gsmtap);
1390 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType2] = find_dissector_add_dependency("rrc.si.sib2", proto_gsmtap);
1391 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType3] = find_dissector_add_dependency("rrc.si.sib3", proto_gsmtap);
1392 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType4] = find_dissector_add_dependency("rrc.si.sib4", proto_gsmtap);
1393 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType5] = find_dissector_add_dependency("rrc.si.sib5", proto_gsmtap);
1394 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType5bis] = find_dissector_add_dependency("rrc.si.sib5bis", proto_gsmtap);
1395 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType6] = find_dissector_add_dependency("rrc.si.sib6", proto_gsmtap);
1396 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType7] = find_dissector_add_dependency("rrc.si.sib7", proto_gsmtap);
1397 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType8] = find_dissector_add_dependency("rrc.si.sib8", proto_gsmtap);
1398 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType9] = find_dissector_add_dependency("rrc.si.sib9", proto_gsmtap);
1399 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType10] = find_dissector_add_dependency("rrc.si.sib10", proto_gsmtap);
1400 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType11] = find_dissector_add_dependency("rrc.si.sib11", proto_gsmtap);
1401 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType11bis] = find_dissector_add_dependency("rrc.si.sib11bis", proto_gsmtap);
1402 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType12] = find_dissector_add_dependency("rrc.si.sib12", proto_gsmtap);
1403 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType13] = find_dissector_add_dependency("rrc.si.sib13", proto_gsmtap);
1404 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType13_1] = find_dissector_add_dependency("rrc.si.sib13-1", proto_gsmtap);
1405 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType13_2] = find_dissector_add_dependency("rrc.si.sib13-2", proto_gsmtap);
1406 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType13_3] = find_dissector_add_dependency("rrc.si.sib13-3", proto_gsmtap);
1407 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType13_4] = find_dissector_add_dependency("rrc.si.sib13-4", proto_gsmtap);
1408 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType14] = find_dissector_add_dependency("rrc.si.sib14", proto_gsmtap);
1409 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType15] = find_dissector_add_dependency("rrc.si.sib15", proto_gsmtap);
1410 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType15bis] = find_dissector_add_dependency("rrc.si.sib15bis", proto_gsmtap);
1411 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType15_1] = find_dissector_add_dependency("rrc.si.sib15-1", proto_gsmtap);
1412 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType15_1bis] = find_dissector_add_dependency("rrc.si.sib15-1bis", proto_gsmtap);
1413 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType15_2] = find_dissector_add_dependency("rrc.si.sib15-2", proto_gsmtap);
1414 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType15_2bis] = find_dissector_add_dependency("rrc.si.sib15-2bis", proto_gsmtap);
1415 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType15_2ter] = find_dissector_add_dependency("rrc.si.sib15-2ter", proto_gsmtap);
1416 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType15_3] = find_dissector_add_dependency("rrc.si.sib15-3", proto_gsmtap);
1417 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType15_3bis] = find_dissector_add_dependency("rrc.si.sib15-3bis", proto_gsmtap);
1418 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType15_4] = find_dissector_add_dependency("rrc.si.sib15-4", proto_gsmtap);
1419 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType15_5] = find_dissector_add_dependency("rrc.si.sib15-5", proto_gsmtap);
1420 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType15_6] = find_dissector_add_dependency("rrc.si.sib15-6", proto_gsmtap);
1421 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType15_7] = find_dissector_add_dependency("rrc.si.sib15-7", proto_gsmtap);
1422 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType15_8] = find_dissector_add_dependency("rrc.si.sib15-8", proto_gsmtap);
1423 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType16] = find_dissector_add_dependency("rrc.si.sib16", proto_gsmtap);
1424 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType17] = find_dissector_add_dependency("rrc.si.sib17", proto_gsmtap);
1425 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType18] = find_dissector_add_dependency("rrc.si.sib18", proto_gsmtap);
1426 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType19] = find_dissector_add_dependency("rrc.si.sib19", proto_gsmtap);
1427 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType20] = find_dissector_add_dependency("rrc.si.sib20", proto_gsmtap);
1428 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType21] = find_dissector_add_dependency("rrc.si.sib21", proto_gsmtap);
1429 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoType22] = find_dissector_add_dependency("rrc.si.sib22", proto_gsmtap);
1430 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoTypeSB1] = find_dissector_add_dependency("rrc.si.sb1", proto_gsmtap);
1431 rrc_sub_handles[GSMTAP_RRC_SUB_SysInfoTypeSB2] = find_dissector_add_dependency("rrc.si.sb2", proto_gsmtap);
1432 rrc_sub_handles[GSMTAP_RRC_SUB_ToTargetRNC_Container] = find_dissector_add_dependency("rrc.s_to_trnc_cont", proto_gsmtap);
1433 rrc_sub_handles[GSMTAP_RRC_SUB_TargetRNC_ToSourceRNC_Container] = find_dissector_add_dependency("rrc.t_to_srnc_cont", proto_gsmtap);
1435 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_DL_CCCH_Message] = find_dissector_add_dependency("lte_rrc.dl_ccch", proto_gsmtap);
1436 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_DL_DCCH_Message] = find_dissector_add_dependency("lte_rrc.dl_dcch", proto_gsmtap);
1437 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_UL_CCCH_Message] = find_dissector_add_dependency("lte_rrc.ul_ccch", proto_gsmtap);
1438 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_UL_DCCH_Message] = find_dissector_add_dependency("lte_rrc.ul_dcch", proto_gsmtap);
1439 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_BCCH_BCH_Message] = find_dissector_add_dependency("lte_rrc.bcch_bch", proto_gsmtap);
1440 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_BCCH_DL_SCH_Message] = find_dissector_add_dependency("lte_rrc.bcch_dl_sch", proto_gsmtap);
1441 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_PCCH_Message] = find_dissector_add_dependency("lte_rrc.pcch", proto_gsmtap);
1442 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_MCCH_Message] = find_dissector_add_dependency("lte_rrc.mcch", proto_gsmtap);
1443 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_BCCH_BCH_Message_MBMS] = find_dissector_add_dependency("lte_rrc.bcch_bch.mbms", proto_gsmtap);
1444 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_BCCH_DL_SCH_Message_BR] = find_dissector_add_dependency("lte_rrc.bcch_dl_sch_br", proto_gsmtap);
1445 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_BCCH_DL_SCH_Message_MBMS] = find_dissector_add_dependency("lte_rrc.bcch_dl_sch.mbms", proto_gsmtap);
1446 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_SC_MCCH_Message] = find_dissector_add_dependency("lte_rrc.sc_mcch", proto_gsmtap);
1447 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_SBCCH_SL_BCH_Message] = find_dissector_add_dependency("lte_rrc.sbcch_sl_bch", proto_gsmtap);
1448 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_SBCCH_SL_BCH_Message_V2X] = find_dissector_add_dependency("lte_rrc.sbcch_sl_bch.v2x", proto_gsmtap);
1449 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_DL_CCCH_Message_NB] = find_dissector_add_dependency("lte_rrc.dl_ccch.nb", proto_gsmtap);
1450 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_DL_DCCH_Message_NB] = find_dissector_add_dependency("lte_rrc.dl_dcch.nb", proto_gsmtap);
1451 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_UL_CCCH_Message_NB] = find_dissector_add_dependency("lte_rrc.ul_ccch.nb", proto_gsmtap);
1452 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_UL_DCCH_Message_NB] = find_dissector_add_dependency("lte_rrc.ul_dcch.nb", proto_gsmtap);
1453 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_BCCH_BCH_Message_NB] = find_dissector_add_dependency("lte_rrc.bcch_bch.nb", proto_gsmtap);
1454 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_BCCH_BCH_Message_TDD_NB] = find_dissector_add_dependency("lte_rrc.bcch_bch.nb.tdd", proto_gsmtap);
1455 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_BCCH_DL_SCH_Message_NB] = find_dissector_add_dependency("lte_rrc.bcch_dl_sch.nb", proto_gsmtap);
1456 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_PCCH_Message_NB] = find_dissector_add_dependency("lte_rrc.pcch.nb", proto_gsmtap);
1457 lte_rrc_sub_handles[GSMTAP_LTE_RRC_SUB_SC_MCCH_Message_NB] = find_dissector_add_dependency("lte_rrc.sc_mcch.nb", proto_gsmtap);
1459 lte_nas_sub_handles[GSMTAP_LTE_NAS_PLAIN] = find_dissector_add_dependency("nas-eps_plain", proto_gsmtap);
1460 lte_nas_sub_handles[GSMTAP_LTE_NAS_SEC_HEADER] = find_dissector_add_dependency("nas-eps", proto_gsmtap);
1462 dissector_add_uint_with_preference("udp.port", GSMTAP_UDP_PORT, gsmtap_handle);
1466 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1468 * Local variables:
1469 * c-basic-offset: 8
1470 * tab-width: 8
1471 * indent-tabs-mode: t
1472 * End:
1474 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1475 * :indentSize=8:tabSize=8:noTabs=false: