Coverage Report

Created: 2026-08-14 06:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-qcdiag_log.c
Line
Count
Source
1
/* packet-qcdiag_log.c
2
 * Dissector routines for Qualcomm DIAG packet handling
3
 *
4
 * (C) 2016-2017 by Harald Welte <laforge@gnumonks.org>
5
 * (C) 2025 by Oliver Smith <osmith@sysmocom.de>
6
 * (C) 2026 by Tamas Regos <regost@gmail.com>
7
 *
8
 * Wireshark - Network traffic analyzer
9
 * By Gerald Combs <gerald@wireshark.org>
10
 * Copyright 1998 Gerald Combs
11
 *
12
 * SPDX-License-Identifier: GPL-2.0-or-later
13
 */
14
15
#include "config.h"
16
17
#include <epan/packet.h>
18
19
#include <epan/exceptions.h>
20
#include <epan/show_exception.h>
21
#include <epan/tfs.h>
22
#include <epan/to_str.h>
23
#include <epan/unit_strings.h>
24
#include <epan/ftypes/ftypes.h>
25
26
#include <wsutil/strtoi.h>
27
28
#include "packet-e212.h"
29
#include "packet-gsm_a_common.h"
30
#include "packet-gsmtap.h"
31
#include "packet-qcdiag.h"
32
#include "packet-umts_rlc.h"
33
#include "expert.h"
34
35
0
#define GSMTAP_HDR_VERSION           0
36
0
#define GSMTAP_HDR_HDR_LEN           1
37
0
#define GSMTAP_HDR_TYPE              2
38
#define GSMTAP_HDR_TIMESLOT          3
39
0
#define GSMTAP_HDR_ARFCN_4           4
40
0
#define GSMTAP_HDR_ARFCN_5           5
41
#define GSMTAP_HDR_SIGNAL_DBM        6
42
#define GSMTAP_HDR_SNR_DB            7
43
0
#define GSMTAP_HDR_FRAME_NUMBER_8    8
44
0
#define GSMTAP_HDR_FRAME_NUMBER_9    9
45
0
#define GSMTAP_HDR_FRAME_NUMBER_10  10
46
0
#define GSMTAP_HDR_FRAME_NUMBER_11  11
47
0
#define GSMTAP_HDR_SUB_TYPE         12
48
#define GSMTAP_HDR_ANTENNA_NR       13
49
0
#define GSMTAP_HDR_SUB_SLOT         14
50
#define GSMTAP_HDR_RES              15
51
52
16
#define QCDIAG_WCDMA_CID_MASK       0x0FFFFFFF
53
54
0
#define UDP_SRC_PORT                ((uint16_t) 13337)  /* Based on SCAT (assumingly P2P related) */
55
0
#define UDP_DST_PORT                ((uint16_t) 47290)  /* User plane UDP port based on GSMTAP port 4729 */
56
57
#define NR_PDU_BCCH_BCH             "BCCH-BCH-Message"
58
#define NR_PDU_BCCH_DL_SCH          "BCCH-DL-SCH-Message"
59
#define NR_PDU_DL_CCCH              "DL-CCCH-Message"
60
#define NR_PDU_DL_DCCH              "DL-DCCH-Message"
61
#define NR_PDU_MCCH                 "MCCH-Message"
62
#define NR_PDU_PCCH                 "PCCH-Message"
63
#define NR_PDU_UL_CCCH              "UL-CCCH-Message"
64
#define NR_PDU_UL_CCCH1             "UL-CCCH1-Message"
65
#define NR_PDU_UL_DCCH              "UL-DCCH-Message"
66
#define NR_PDU_RRC_RECONF           "RRC Reconfiguration"
67
#define NR_PDU_RRC_RECONF_COMPL     "RRC Reconfiguration Complete"
68
#define NR_PDU_SIB2                 "SIB2"
69
#define NR_PDU_SIB3                 "SIB3"
70
#define NR_PDU_SIB4                 "SIB4"
71
#define NR_PDU_SIB5                 "SIB5"
72
#define NR_PDU_SIB6                 "SIB6"
73
#define NR_PDU_SIB7                 "SIB7"
74
#define NR_PDU_SIB8                 "SIB8"
75
#define NR_PDU_SIB9                 "SIB9"
76
#define NR_PDU_RADIOBEARERCONF      "RadioBearerConfig"
77
#define NR_PDU_UE_MRDC_CAP          "UE-MRDC-Capability"
78
#define NR_PDU_UE_NR_CAP            "UE-NR-Capability"
79
#define NR_PDU_CG_CF_INFO           "CG-ConfigInfo"
80
#define NR_PDU_UE_CAP_RAT_CL        "UE-CapabilityRAT-ContainerList"
81
#define NR_PDU_CELL_GRP_CFG         "CellGroupConfig"
82
#define NR_PDU_UE_RA_CAP_INF        "UERadioAccessCapabilityInformation"
83
#define NR_PDU_MEAS_CFG             "MeasConfig"
84
#define NR_PDU_MEAS_GAP_CFG         "MeasGapConfig"
85
#define NR_PDU_HO_CMD               "HandoverCommand"
86
#define NR_PDU_HO_PREP_INFO         "HandoverPreparationInformation"
87
#define NR_PDU_BCCH_BCH_MBMS        "BCCH-BCH-MBMS-Message"
88
#define NR_PDU_BCCH_DL_SCH_BR       "BCCH-DL-SCH-BR-Message"
89
#define NR_PDU_BCCH_DL_SCH_MBMS     "BCCH-DL-SCH-MBMS-Message"
90
#define NR_PDU_SC_MCCH              "SC-MCCH-Message"
91
#define NR_PDU_SBCCH_SL_BCH         "SBCCH-SL-BCH-Message"
92
#define NR_PDU_SBCCH_SL_BCH_V2X     "SBCCH-SL-BCH-V2X-Message"
93
#define NR_PDU_DL_CCCH_NB           "DL-CCCH-NB-Message"
94
#define NR_PDU_DL_DCCH_NB           "DL-DCCH-NB-Message"
95
#define NR_PDU_UL_CCCH_NB           "UL-CCCH-NB-Message"
96
#define NR_PDU_UL_DCCH_NB           "UL-DCCH-NB-Message"
97
#define NR_PDU_BCCH_BCH_NB          "BCCH-BCH-NB-Message"
98
#define NR_PDU_BCCH_BCH_TDD_NB      "BCCH-BCH-TDD-NB-Message"
99
#define NR_PDU_BCCH_DL_SCH_NB       "BCCH-DL-SCH-NB-Message"
100
#define NR_PDU_PCCH_NB              "PCCH-NB-Message"
101
#define NR_PDU_SC_MCCH_NB           "SC_MCCH-NB-Message"
102
103
void proto_register_qcdiag_log(void);
104
void proto_reg_handoff_qcdiag_log(void);
105
106
static dissector_handle_t data_handle;
107
static dissector_handle_t text_lines_handle;
108
static dissector_handle_t udp_handle;
109
static dissector_handle_t gsmtap_handle;
110
static dissector_handle_t nas5gs_handle;
111
static dissector_handle_t nr_rrc_bcch_bch_handle;
112
static dissector_handle_t nr_rrc_bcch_dl_sch_handle;
113
static dissector_handle_t nr_rrc_pcch_handle;
114
static dissector_handle_t nr_rrc_ul_dcch_handle;
115
static dissector_handle_t nr_rrc_dl_dcch_handle;
116
static dissector_handle_t nr_rrc_ul_ccch_handle;
117
static dissector_handle_t nr_rrc_dl_ccch_handle;
118
static dissector_handle_t nr_rrc_ul_ccch1_handle;
119
static dissector_handle_t nr_rrc_reconf_handle;
120
static dissector_handle_t nr_rrc_reconf_compl_handle;
121
static dissector_handle_t nr_rrc_radiobearerconfig_handle;
122
static dissector_handle_t nr_rrc_ue_mrdc_cap_handle;
123
static dissector_handle_t nr_rrc_ue_nr_cap_handle;
124
static dissector_handle_t nr_rrc_sib2_handle;
125
static dissector_handle_t nr_rrc_sib3_handle;
126
static dissector_handle_t nr_rrc_sib4_handle;
127
static dissector_handle_t nr_rrc_sib5_handle;
128
static dissector_handle_t nr_rrc_sib6_handle;
129
static dissector_handle_t nr_rrc_sib7_handle;
130
static dissector_handle_t nr_rrc_sib8_handle;
131
static dissector_handle_t nr_rrc_sib9_handle;
132
133
static dissector_table_t qcdiag_log_code_dissector_table;
134
135
static heur_dtbl_entry_t *hdtbl_entry;
136
137
static int proto_qcdiag_log;
138
139
static int hf_qcdiag_log_ver;
140
static int hf_qcdiag_log_ver_4;
141
static int hf_qcdiag_arfcn;
142
static int hf_qcdiag_uplink;
143
static int hf_qcdiag_pcs;
144
static int hf_qcdiag_psc;
145
static int hf_qcdiag_subtype_v1;
146
static int hf_qcdiag_subtype_v2;
147
static int hf_qcdiag_packet_ver;
148
static int hf_qcdiag_lte_rrc_rel;
149
static int hf_qcdiag_nr_rrc_rel;
150
static int hf_qcdiag_lte_nas_rel;
151
static int hf_qcdiag_nr_nas_rel;
152
static int hf_qcdiag_log_len;
153
static int hf_qcdiag_log_more;
154
static int hf_qcdiag_log_timestamp;
155
156
static int hf_qcdiag_rr_chan_type;
157
static int hf_qcdiag_rr_direction;
158
static int hf_qcdiag_rr_msg_type;
159
160
static int hf_qcdiag_mac_chan_type;
161
static int hf_qcdiag_mac_direction;
162
static int hf_qcdiag_mac_msg_type;
163
164
static int hf_qcdiag_wcdma_rrc_state;
165
static int hf_qcdiag_wcdma_rrc_procedure;
166
static int hf_qcdiag_wcdma_rrc_failure_cause;
167
static int hf_qcdiag_wcdma_rrc_prot_err_cause;
168
static int hf_qcdiag_wcdma_cid_ul_uarfcn;
169
static int hf_qcdiag_wcdma_cid_dl_uarfcn;
170
static int hf_qcdiag_wcdma_cid_cell_id;
171
static int hf_qcdiag_wcdma_cid_ura_id;
172
static int hf_qcdiag_wcdma_cid_cell_barred;
173
static int hf_qcdiag_wcdma_cid_cell_reserved;
174
static int hf_qcdiag_wcdma_cid_cell_solsa;
175
static int hf_qcdiag_wcdma_cid_ue_camped;
176
static int hf_qcdiag_wcdma_cid_reserved;
177
static int hf_qcdiag_wcdma_cid_allowed_call_access;
178
static int hf_qcdiag_wcdma_cid_psc;
179
static int hf_qcdiag_wcdma_cid_mcc;
180
static int hf_qcdiag_wcdma_cid_mnc;
181
static int hf_qcdiag_wcdma_cid_lac;
182
static int hf_qcdiag_wcdma_cid_rac;
183
static int hf_qcdiag_wcdma_freq_scan_type;
184
static int hf_qcdiag_wcdma_freq_scan_thres;
185
static int hf_qcdiag_wcdma_freq_scan_num;
186
static int hf_qcdiag_wcdma_freq_scan_arfcn;
187
static int hf_qcdiag_wcdma_freq_scan_rssi_raw;
188
static int hf_qcdiag_wcdma_freq_scan_rssi_dbm;
189
static int hf_qcdiag_wcdma_crr_ver;
190
static int hf_qcdiag_wcdma_crr_num_3g;
191
static int hf_qcdiag_wcdma_crr_reserved;
192
static int hf_qcdiag_wcdma_crr_num_2g;
193
static int hf_qcdiag_wcdma_crr_uarfcn_3g;
194
static int hf_qcdiag_wcdma_crr_psc_3g;
195
static int hf_qcdiag_wcdma_crr_rscp_3g;
196
static int hf_qcdiag_wcdma_crr_rscp_rank_3g;
197
static int hf_qcdiag_wcdma_crr_ecio_3g;
198
static int hf_qcdiag_wcdma_crr_ecio_rank_3g;
199
static int hf_qcdiag_wcdma_crr_arfcn_2g;
200
static int hf_qcdiag_wcdma_crr_rssi_2g;
201
static int hf_qcdiag_wcdma_crr_rssi_rank_2g;
202
static int hf_qcdiag_wcdma_crr_bsic_2g;
203
static int hf_qcdiag_wcdma_crr_bsic_bcc;
204
static int hf_qcdiag_wcdma_crr_bsic_ncc;
205
static int hf_qcdiag_wcdma_crr_resel_status;
206
static int hf_qcdiag_wcdma_crr_hcs_priority;
207
static int hf_qcdiag_wcdma_crr_h_value;
208
static int hf_qcdiag_wcdma_crr_hcs_cell_qualify;
209
static int hf_qcdiag_wcdma_rlc_num_ent;
210
static int hf_qcdiag_wcdma_rlc_num_pdu;
211
static int hf_qcdiag_wcdma_rlc_lcid;
212
static int hf_qcdiag_wcdma_rlc_pdu_size;
213
static int hf_qcdiag_wcdma_rlc_pdu_size_bits;
214
static int hf_qcdiag_wcdma_rlc_pdu_count;
215
static int hf_qcdiag_wcdma_rlc_ciph_key;
216
static int hf_qcdiag_wcdma_rlc_ciph_alg;
217
static int hf_qcdiag_wcdma_rlc_ciph_msg;
218
static int hf_qcdiag_wcdma_rlc_ciph_countc;
219
220
static int hf_qcdiag_nas_msg_length;
221
static int hf_qcdiag_nas_direction;
222
223
static int hf_qcdiag_rrc_chan_type;
224
static int hf_qcdiag_rrc_chan_type_umts_v1;
225
static int hf_qcdiag_rrc_chan_type_umts_v2;
226
static int hf_qcdiag_rrc_rb_id;
227
static int hf_qcdiag_msg_len_1;
228
static int hf_qcdiag_msg_len_2;
229
230
static int hf_qcdiag_lte_rrc_rb_id;
231
static int hf_qcdiag_lte_rrc_pci;
232
static int hf_qcdiag_lte_rrc_earfcn_v2;
233
static int hf_qcdiag_lte_rrc_earfcn_v8;
234
static int hf_qcdiag_lte_rrc_sfn;
235
static int hf_qcdiag_lte_rrc_pdu;
236
static int hf_qcdiag_lte_rrc_sib;
237
238
static int hf_qcdiag_nr_rrc_rb_id;
239
static int hf_qcdiag_nr_rrc_pci;
240
static int hf_qcdiag_nr_rrc_ncgi;
241
static int hf_qcdiag_nr_rrc_arfcn;
242
static int hf_qcdiag_nr_rrc_sfn_v9;
243
static int hf_qcdiag_nr_rrc_sfn;
244
static int hf_qcdiag_nr_rrc_pdu_v9;
245
static int hf_qcdiag_nr_rrc_pdu_v14;
246
static int hf_qcdiag_nr_rrc_pdu_v17;
247
static int hf_qcdiag_nr_rrc_pdu_v20;
248
static int hf_qcdiag_nr_rrc_pdu_v26;
249
static int hf_qcdiag_nr_rrc_pdu_v28;
250
static int hf_qcdiag_nr_rrc_sib;
251
static int hf_qcdiag_nr_rrc_segment_id;
252
253
static int ett_qcdiag_log;
254
static int ett_qcdiag_log_wcdma_crr_wcmda;
255
static int ett_qcdiag_log_wcdma_crr_gsm;
256
static int ett_qcdiag_log_wcdma_cid_car;
257
static int ett_qcdiag_log_wcdma_rlc_dl_am_sig;
258
static int ett_qcdiag_log_wcdma_rlc_dl_am_ciph;
259
static int ett_qcdiag_log_wcdma_rlc_ul_am_ciph;
260
static int ett_qcdiag_log_wcdma_freq_scan;
261
262
static expert_field ei_qcdiag_log_mcc_non_decimal;
263
static expert_field ei_qcdiag_log_mnc_non_decimal;
264
265
static bool heur_rlc_udp_enabled;
266
267
static const true_false_string tfs_downlink_uplink = { "Downlink", "Uplink" };
268
269
/* Active flags indicating "not set" status for restricted states */
270
static const true_false_string tfs_not_barred_barred = { "Cell Not Barred", "Cell Barred" };
271
static const true_false_string tfs_not_reserved_reserved = { "Cell Not Reserved", "Cell Reserved" };
272
static const true_false_string tfs_not_reserved_reserved_solsa = { "Cell Not Reserved", "Cell Reserved for SoLSA" };
273
static const true_false_string tfs_not_camped_camped = { "UE Not Camped On A Cell", "UE Camped On A Cell" };
274
275
/* Subscription Id 1 (Radio Id 0), Subscription Id 2 (Radio Id 1) */
276
static int gsm_last_uarfcn[]     = { 0, 0 };
277
static int umts_last_uarfcn_dl[] = { 0, 0 };
278
static int umts_last_uarfcn_ul[] = { 0, 0 };
279
//static int umts_last_cell_id[]   = { 0, 0 };
280
281
typedef struct _value_number {
282
    uint32_t value;   /**< Numeric value to match. */
283
    uint32_t number;  /**< Corresponding number representation. */
284
} value_number;
285
286
static const value_string rr_chan_types[] = {
287
    { 0, "DCCH" },
288
    { 1, "BCCH" },
289
    { 2, "RACH" },
290
    { 3, "CCCH" },
291
    { 4, "SACCH" },
292
    { 5, "SDCCH" },
293
    { 6, "FACCH/F" },
294
    { 7, "FACCH/H" },
295
    { 0, NULL }
296
};
297
298
enum gprs_mac_chan_type {
299
    PRACH_11BIT_CHANNEL = 0x01,
300
    PRACH_8BIT_CHANNEL  = 0x02,
301
    PACCH_RRBP_CHANNEL  = 0x03,
302
    UL_PACCH_CHANNEL    = 0x04,
303
    PPCH_CHANNEL        = 0x80,
304
    PAGCH_CHANNEL       = 0x81,
305
    PBCCH_CHANNEL       = 0x82,
306
    DL_PACCH_CHANNEL    = 0x83,
307
};
308
309
static const value_string mac_chan_types[] = {
310
    { PRACH_11BIT_CHANNEL, "PRACH (11 bit)" },
311
    { PRACH_8BIT_CHANNEL,  "PRACH (8 bit)" },
312
    { PACCH_RRBP_CHANNEL,  "PACCH (RRBP)" },
313
    { UL_PACCH_CHANNEL,    "UL-PACCH" },
314
    { PPCH_CHANNEL,        "PPCH" },
315
    { PAGCH_CHANNEL,       "PAGCH" },
316
    { PBCCH_CHANNEL,       "PBCCH" },
317
    { DL_PACCH_CHANNEL,    "DL-PACCH" },
318
    { 0, NULL }
319
};
320
321
static const value_number gsm_gmac_channel_type_map[] = {
322
    { PRACH_11BIT_CHANNEL, GSMTAP_CHANNEL_PACCH },
323
    { PRACH_8BIT_CHANNEL,  GSMTAP_CHANNEL_PACCH },
324
    { PACCH_RRBP_CHANNEL,  GSMTAP_CHANNEL_PACCH },
325
    { UL_PACCH_CHANNEL,    GSMTAP_CHANNEL_PACCH },
326
    { PPCH_CHANNEL,        GSMTAP_CHANNEL_PACCH },
327
    { PAGCH_CHANNEL,       GSMTAP_CHANNEL_PACCH },
328
    { PBCCH_CHANNEL,       GSMTAP_CHANNEL_PACCH },
329
    { DL_PACCH_CHANNEL,    GSMTAP_CHANNEL_PACCH },
330
    { 0, UINT32_MAX }
331
};
332
333
static const value_number gsm_rr_channel_type_map[] = {
334
    {  0, GSMTAP_CHANNEL_SDCCH8 },                        /* DCCH */
335
    {  1, GSMTAP_CHANNEL_BCCH },                          /* BCCH */
336
    {  2, GSMTAP_CHANNEL_RACH },                          /* RACH */
337
    {  3, GSMTAP_CHANNEL_CCCH },                          /* CCCH */
338
    {  4, GSMTAP_CHANNEL_ACCH | GSMTAP_CHANNEL_SDCCH8 },  /* SACCH */
339
    {  5, GSMTAP_CHANNEL_SDCCH },                         /* SDCCH */
340
    {  6, GSMTAP_CHANNEL_TCH_F },                         /* FACCH */
341
    {  7, GSMTAP_CHANNEL_TCH_F },                         /* TCH/F */
342
    {  8, GSMTAP_CHANNEL_TCH_F },                         /* TCH/F9.6 */
343
    {  9, GSMTAP_CHANNEL_TCH_F },                         /* TCH/F14.4 */
344
    { 10, GSMTAP_CHANNEL_TCH_H },                         /* TCH/H */
345
    { 11, GSMTAP_CHANNEL_VOICE_F },                       /* TCH/AFS */
346
    { 12, GSMTAP_CHANNEL_VOICE_H },                       /* TCH/AHS */
347
    { 13, GSMTAP_CHANNEL_VOICE_F },                       /* RATSCCH/AFS */
348
    { 14, GSMTAP_CHANNEL_VOICE_H },                       /* RATSCCH/AHS */
349
    { 15, GSMTAP_CHANNEL_VOICE_F },                       /* SID_FIRST/AFS */
350
    { 16, GSMTAP_CHANNEL_VOICE_F },                       /* SID_UPDATE/AFS */
351
    { 17, GSMTAP_CHANNEL_VOICE_H },                       /* SID_FIRST/AHS */
352
    { 18, GSMTAP_CHANNEL_VOICE_H },                       /* SID_UPDATE/AHS */
353
    { 19, GSMTAP_CHANNEL_TCH_H },                         /* FACCH/H */
354
    { 20, GSMTAP_CHANNEL_VOICE_F },                       /* FACCH_AFS */
355
    { 21, GSMTAP_CHANNEL_VOICE_H },                       /* FACCH_AHS */
356
    { 22, GSMTAP_CHANNEL_VOICE_H },                       /* SID_FIRST_INH */
357
    { 23, GSMTAP_CHANNEL_VOICE_H },                       /* SID_UPDATE_INH */
358
    { 24, GSMTAP_CHANNEL_VOICE_F },                       /* RATSCCH_MARKER */
359
    { 25, GSMTAP_CHANNEL_CBCH51 },                        /* CBCH */
360
    { 26, GSMTAP_CHANNEL_VOICE_F },                       /* ONSET */
361
    { 27, GSMTAP_CHANNEL_VOICE_F },                       /* TCH_WFS */
362
    { 28, GSMTAP_CHANNEL_VOICE_F },                       /* FACCH_WFS */
363
    { 29, GSMTAP_CHANNEL_VOICE_F },                       /* RATSCCH_WFS */
364
    { 0, UINT32_MAX }
365
};
366
367
static const value_number umts_channel_type_map_v1[] = {
368
    {    0, GSMTAP_RRC_SUB_UL_CCCH_Message },
369
    {    1, GSMTAP_RRC_SUB_UL_DCCH_Message },
370
    {    2, GSMTAP_RRC_SUB_DL_CCCH_Message },
371
    {    3, GSMTAP_RRC_SUB_DL_DCCH_Message },
372
    {    4, GSMTAP_RRC_SUB_BCCH_BCH_Message },
373
    {    5, GSMTAP_RRC_SUB_BCCH_FACH_Message },
374
    {    6, GSMTAP_RRC_SUB_PCCH_Message },
375
    {    7, GSMTAP_RRC_SUB_MCCH_Message },
376
    {    8, GSMTAP_RRC_SUB_MSCH_Message },
377
    {   10, GSMTAP_RRC_SUB_System_Information_Container },
378
    { 0, UINT32_MAX }
379
};
380
381
static const value_number umts_channel_type_map_ext_v1[] = {
382
    { 0x09, GSMTAP_RRC_SUB_BCCH_BCH_Message },
383
    { 0xFE, GSMTAP_RRC_SUB_BCCH_BCH_Message },
384
    { 0xFF, GSMTAP_RRC_SUB_BCCH_FACH_Message },
385
    { 0, UINT32_MAX }
386
};
387
388
static const value_string umts_v1_sub_types[] = {
389
    {    0, "RRC UL-CCCH" },
390
    {    1, "RRC UL-DCCH" },
391
    {    2, "RRC DL-CCCH" },
392
    {    3, "RRC DL-DCCH" },
393
    {    4, "RRC BCCH-BCH" },
394
    {    5, "RRC BCCH-FACH" },
395
    {    6, "RRC PCCH" },
396
    {    7, "RRC MCCH" },
397
    {    8, "RRC MSCH" },
398
    {    9, "RRC BCCH-BCH" },
399
    {   10, "RRC System Information Container" },
400
    { 0xFE, "RRC BCCH-BCH" },
401
    { 0xFF, "RRC BCCH-FACH" },
402
    { 0, NULL }
403
};
404
405
static const value_number umts_channel_type_map_v2[] = {
406
    { 0x80, GSMTAP_RRC_SUB_UL_CCCH_Message },
407
    { 0x81, GSMTAP_RRC_SUB_UL_DCCH_Message },
408
    { 0x82, GSMTAP_RRC_SUB_DL_CCCH_Message },
409
    { 0x83, GSMTAP_RRC_SUB_DL_DCCH_Message },
410
    { 0x84, GSMTAP_RRC_SUB_BCCH_BCH_Message },
411
    { 0x85, GSMTAP_RRC_SUB_BCCH_FACH_Message },
412
    { 0x86, GSMTAP_RRC_SUB_PCCH_Message },
413
    { 0x87, GSMTAP_RRC_SUB_MCCH_Message },
414
    { 0x88, GSMTAP_RRC_SUB_MSCH_Message },
415
    { 0, UINT32_MAX }
416
};
417
418
static const value_number umts_channel_type_map_ext_v2[] = {
419
    { 0x89, GSMTAP_RRC_SUB_BCCH_BCH_Message },
420
    { 0xF0, GSMTAP_RRC_SUB_BCCH_BCH_Message },
421
    { 0, UINT32_MAX }
422
};
423
424
static const value_string umts_v2_sub_types[] = {
425
    { 0x80, "RRC UL-CCCH" },
426
    { 0x81, "RRC UL-DCCH" },
427
    { 0x82, "RRC DL-CCCH" },
428
    { 0x83, "RRC DL-DCCH" },
429
    { 0x84, "RRC BCCH-BCH" },
430
    { 0x85, "RRC BCCH-FACH" },
431
    { 0x86, "RRC PCCH" },
432
    { 0x87, "RRC MCCH" },
433
    { 0x88, "RRC MSCH" },
434
    { 0x89, "RRC BCCH-BCH" },
435
    { 0xF0, "RRC BCCH-BCH" },
436
    { 0, NULL }
437
};
438
439
static const value_number umts_sib_type_map_v1[] = {
440
    {    0, GSMTAP_RRC_SUB_MasterInformationBlock },
441
    {    1, GSMTAP_RRC_SUB_SysInfoType1 },
442
    {    2, GSMTAP_RRC_SUB_SysInfoType2 },
443
    {    3, GSMTAP_RRC_SUB_SysInfoType3 },
444
    {    4, GSMTAP_RRC_SUB_SysInfoType4 },
445
    {    5, GSMTAP_RRC_SUB_SysInfoType5 },
446
    {    6, GSMTAP_RRC_SUB_SysInfoType6 },
447
    {    7, GSMTAP_RRC_SUB_SysInfoType7 },
448
    {    8, GSMTAP_RRC_SUB_SysInfoType8 },
449
    {    9, GSMTAP_RRC_SUB_SysInfoType9 },
450
    {   10, GSMTAP_RRC_SUB_SysInfoType10 },
451
    {   11, GSMTAP_RRC_SUB_SysInfoType11 },
452
    {   12, GSMTAP_RRC_SUB_SysInfoType12 },
453
    {   13, GSMTAP_RRC_SUB_SysInfoType13 },
454
    {   14, GSMTAP_RRC_SUB_SysInfoType13_1 },
455
    {   15, GSMTAP_RRC_SUB_SysInfoType13_2 },
456
    {   16, GSMTAP_RRC_SUB_SysInfoType13_3 },
457
    {   17, GSMTAP_RRC_SUB_SysInfoType13_4 },
458
    {   18, GSMTAP_RRC_SUB_SysInfoType14 },
459
    {   19, GSMTAP_RRC_SUB_SysInfoType15 },
460
    {   20, GSMTAP_RRC_SUB_SysInfoType15_1 },
461
    {   21, GSMTAP_RRC_SUB_SysInfoType15_2 },
462
    {   22, GSMTAP_RRC_SUB_SysInfoType15_3 },
463
    {   23, GSMTAP_RRC_SUB_SysInfoType16 },
464
    {   24, GSMTAP_RRC_SUB_SysInfoType17 },
465
    {   25, GSMTAP_RRC_SUB_SysInfoType15_4 },
466
    {   26, GSMTAP_RRC_SUB_SysInfoType18 },
467
    {   27, GSMTAP_RRC_SUB_SysInfoTypeSB1 },
468
    {   28, GSMTAP_RRC_SUB_SysInfoTypeSB2 },
469
    {   29, GSMTAP_RRC_SUB_SysInfoType15_5 },
470
    {   30, GSMTAP_RRC_SUB_SysInfoType5bis },
471
    {   31, GSMTAP_RRC_SUB_SysInfoType11bis },
472
    {   66, GSMTAP_RRC_SUB_SysInfoType11bis },
473
    {   67, GSMTAP_RRC_SUB_SysInfoType1 },
474
    { 0, UINT32_MAX }
475
};
476
477
static const value_string umts_sib_types_v1[] = {
478
    {    0, "RRC Master Information Block" },
479
    {    1, "RRC System Information Type 1" },
480
    {    2, "RRC System Information Type 2" },
481
    {    3, "RRC System Information Type 3" },
482
    {    4, "RRC System Information Type 4" },
483
    {    5, "RRC System Information Type 5" },
484
    {    6, "RRC System Information Type 6" },
485
    {    7, "RRC System Information Type 7" },
486
    {    8, "RRC System Information Type 8" },
487
    {    9, "RRC System Information Type 9" },
488
    {   10, "RRC System Information Type 10" },
489
    {   11, "RRC System Information Type 11" },
490
    {   12, "RRC System Information Type 12" },
491
    {   13, "RRC System Information Type 13" },
492
    {   14, "RRC System Information Type 13.1" },
493
    {   15, "RRC System Information Type 13.2" },
494
    {   16, "RRC System Information Type 13.3" },
495
    {   17, "RRC System Information Type 13.4" },
496
    {   18, "RRC System Information Type 14" },
497
    {   19, "RRC System Information Type 15" },
498
    {   20, "RRC System Information Type 15.1" },
499
    {   21, "RRC System Information Type 15.1" },
500
    {   22, "RRC System Information Type 15.3" },
501
    {   23, "RRC System Information Type 16" },
502
    {   24, "RRC System Information Type 17" },
503
    {   25, "RRC System Information Type 15.4" },
504
    {   26, "RRC System Information Type 18" },
505
    {   27, "RRC System Information Type SB 1" },
506
    {   28, "RRC System Information Type SB 2" },
507
    {   29, "RRC System Information Type 15.5" },
508
    {   30, "RRC System Information Type 5bis" },
509
    {   31, "RRC System Information Type 11bis" },
510
    {   66, "RRC System Information Type 11bis" },
511
    {   67, "RRC System Information Type 1" },
512
    { 0, NULL }
513
};
514
515
static const value_number umts_sib_type_map_v2[] = {
516
    {    0, GSMTAP_RRC_SUB_MasterInformationBlock },
517
    {    1, GSMTAP_RRC_SUB_SysInfoType1 },
518
    {    2, GSMTAP_RRC_SUB_SysInfoType2 },
519
    {    3, GSMTAP_RRC_SUB_SysInfoType3 },
520
    {    4, GSMTAP_RRC_SUB_SysInfoType4 },
521
    {    5, GSMTAP_RRC_SUB_SysInfoType5 },
522
    {    6, GSMTAP_RRC_SUB_SysInfoType6 },
523
    {    7, GSMTAP_RRC_SUB_SysInfoType7 },
524
    {    8, GSMTAP_RRC_SUB_SysInfoType8 },
525
    {    9, GSMTAP_RRC_SUB_SysInfoType9 },
526
    {   10, GSMTAP_RRC_SUB_SysInfoType10 },
527
    {   11, GSMTAP_RRC_SUB_SysInfoType11 },
528
    {   12, GSMTAP_RRC_SUB_SysInfoType12 },
529
    {   13, GSMTAP_RRC_SUB_SysInfoType13 },
530
    {   14, GSMTAP_RRC_SUB_SysInfoType13_1 },
531
    {   15, GSMTAP_RRC_SUB_SysInfoType13_2 },
532
    {   16, GSMTAP_RRC_SUB_SysInfoType13_3 },
533
    {   17, GSMTAP_RRC_SUB_SysInfoType13_4 },
534
    {   18, GSMTAP_RRC_SUB_SysInfoType14 },
535
    {   19, GSMTAP_RRC_SUB_SysInfoType15 },
536
    {   20, GSMTAP_RRC_SUB_SysInfoType15_1 },
537
    {   21, GSMTAP_RRC_SUB_SysInfoType15_2 },
538
    {   22, GSMTAP_RRC_SUB_SysInfoType15_3 },
539
    {   23, GSMTAP_RRC_SUB_SysInfoType16 },
540
    {   24, GSMTAP_RRC_SUB_SysInfoType17 },
541
    {   25, GSMTAP_RRC_SUB_SysInfoType15_4 },
542
    {   26, GSMTAP_RRC_SUB_SysInfoType18 },
543
    {   27, GSMTAP_RRC_SUB_SysInfoTypeSB1 },
544
    {   28, GSMTAP_RRC_SUB_SysInfoTypeSB2 },
545
    {   29, GSMTAP_RRC_SUB_SysInfoType15_5 },
546
    {   30, GSMTAP_RRC_SUB_SysInfoType5bis },
547
    {   31, GSMTAP_RRC_SUB_SysInfoType19 },
548
    {   66, GSMTAP_RRC_SUB_SysInfoType11bis },
549
    {   67, GSMTAP_RRC_SUB_SysInfoType19 },
550
    { 0, UINT32_MAX }
551
};
552
553
static const value_string umts_sib_types_v2[] = {
554
    {    0, "RRC Master Information Block" },
555
    {    1, "RRC System Information Type 1" },
556
    {    2, "RRC System Information Type 2" },
557
    {    3, "RRC System Information Type 3" },
558
    {    4, "RRC System Information Type 4" },
559
    {    5, "RRC System Information Type 5" },
560
    {    6, "RRC System Information Type 6" },
561
    {    7, "RRC System Information Type 7" },
562
    {    8, "RRC System Information Type 8" },
563
    {    9, "RRC System Information Type 9" },
564
    {   10, "RRC System Information Type 10" },
565
    {   11, "RRC System Information Type 11" },
566
    {   12, "RRC System Information Type 12" },
567
    {   13, "RRC System Information Type 13" },
568
    {   14, "RRC System Information Type 13.1" },
569
    {   15, "RRC System Information Type 13.2" },
570
    {   16, "RRC System Information Type 13.3" },
571
    {   17, "RRC System Information Type 13.4" },
572
    {   18, "RRC System Information Type 14" },
573
    {   19, "RRC System Information Type 15" },
574
    {   20, "RRC System Information Type 15.1" },
575
    {   21, "RRC System Information Type 15.1" },
576
    {   22, "RRC System Information Type 15.3" },
577
    {   23, "RRC System Information Type 16" },
578
    {   24, "RRC System Information Type 17" },
579
    {   25, "RRC System Information Type 15.4" },
580
    {   26, "RRC System Information Type 18" },
581
    {   27, "RRC System Information Type SB 1" },
582
    {   28, "RRC System Information Type SB 2" },
583
    {   29, "RRC System Information Type 15.5" },
584
    {   30, "RRC System Information Type 5bis" },
585
    {   31, "RRC System Information Type 19" },
586
    {   66, "RRC System Information Type 11bis" },
587
    {   67, "RRC System Information Type 19" },
588
    { 0, NULL }
589
};
590
591
enum {
592
    DL_CCCH          =  0,
593
    DL_DCCH          =  1,
594
    UL_CCCH          =  2,
595
    UL_DCCH          =  3,
596
    BCCH_BCH         =  4,
597
    BCCH_DL_SCH      =  5,
598
    PCCH             =  6,
599
    MCCH             =  7,
600
    BCCH_BCH_MBMS    =  8,
601
    BCCH_DL_SCH_BR   =  9,
602
    BCCH_DL_SCH_MBMS = 10,
603
    SC_MCCH          = 11,
604
    SBCCH_SL_BCH     = 12,
605
    SBCCH_SL_BCH_V2X = 13,
606
    DL_CCCH_NB       = 14,
607
    DL_DCCH_NB       = 15,
608
    UL_CCCH_NB       = 16,
609
    UL_DCCH_NB       = 17,
610
    BCCH_BCH_NB      = 18,
611
    BCCH_BCH_TDD_NB  = 19,
612
    BCCH_DL_SCH_NB   = 20,
613
    PCCH_NB          = 21,
614
    SC_MCCH_NB       = 22
615
};
616
617
static const value_number lte_rrc_sm_v1[] = {
618
    {  1, BCCH_BCH },
619
    {  2, BCCH_DL_SCH },
620
    {  3, MCCH },
621
    {  4, PCCH },
622
    {  5, DL_CCCH },
623
    {  6, DL_DCCH },
624
    {  7, UL_CCCH },
625
    {  8, UL_DCCH },
626
    { 0, UINT32_MAX }
627
};
628
629
static const value_number lte_rrc_sm_v2[] = {
630
    {  8, BCCH_BCH },
631
    {  9, BCCH_DL_SCH },
632
    { 10, MCCH },
633
    { 11, PCCH },
634
    { 12, DL_CCCH },
635
    { 13, DL_DCCH },
636
    { 14, UL_CCCH },
637
    { 15, UL_DCCH },
638
    { 0, UINT32_MAX }
639
};
640
641
static const value_number lte_rrc_sm_v3[] = {
642
    {  1, BCCH_BCH },
643
    {  2, BCCH_DL_SCH },
644
    {  4, MCCH },
645
    {  5, PCCH },
646
    {  6, DL_CCCH },
647
    {  7, DL_DCCH },
648
    {  8, UL_CCCH },
649
    {  9, UL_DCCH },
650
    { 0, UINT32_MAX }
651
};
652
653
static const value_number lte_rrc_sm_v4[] = {
654
    {  1, BCCH_BCH },
655
    {  2, BCCH_DL_SCH },
656
    {  4, MCCH },
657
    {  5, PCCH },
658
    {  6, DL_CCCH },
659
    {  7, DL_DCCH },
660
    {  8, UL_CCCH },
661
    {  9, UL_DCCH },
662
    { 0, UINT32_MAX }
663
};
664
665
static const value_number lte_rrc_sm_v5[] = {
666
    {  1, BCCH_BCH },
667
    {  3, BCCH_DL_SCH },
668
    {  6, MCCH },
669
    {  7, PCCH },
670
    {  8, DL_CCCH },
671
    {  9, DL_DCCH },
672
    { 10, UL_CCCH },
673
    { 11, UL_DCCH },
674
    { 45, BCCH_BCH_NB },
675
    { 46, BCCH_DL_SCH_NB },
676
    { 47, PCCH_NB },
677
    { 48, DL_CCCH_NB },
678
    { 49, DL_DCCH_NB },
679
    { 50, UL_CCCH_NB },
680
    { 52, UL_DCCH_NB },
681
    { 0, UINT32_MAX }
682
};
683
684
static const value_number lte_rrc_sm_v6[] = {
685
    {  1, BCCH_BCH },
686
    {  2, BCCH_DL_SCH },
687
    {  4, MCCH },
688
    {  5, PCCH },
689
    {  6, DL_CCCH },
690
    {  7, DL_DCCH },
691
    {  8, UL_CCCH },
692
    {  9, UL_DCCH },
693
    { 54, BCCH_BCH_NB },
694
    { 55, BCCH_DL_SCH_NB },
695
    { 56, PCCH_NB },
696
    { 57, DL_CCCH_NB },
697
    { 58, DL_DCCH_NB },
698
    { 59, UL_CCCH_NB },
699
    { 61, UL_DCCH_NB },
700
    { 0, UINT32_MAX }
701
};
702
703
static const value_string wcdma_rrc_states_vals[] = {
704
    {  0, "Disconnected" },
705
    {  1, "Connecting" },
706
    {  2, "CELL_FACH" },
707
    {  3, "CELL_DCH" },
708
    {  4, "CELL_PCH" },
709
    {  5, "URA_PCH" },
710
    { 0, NULL }
711
};
712
713
static const value_string umts_rrc_procedure_vals[] = {
714
    {  0, "Cell Selection" },
715
    {  1, "SIB Processing" },
716
    {  2, "Paging Type 2" },
717
    {  3, "Measurement Control Reporting" },
718
    {  4, "RRC Connection Establishment" },
719
    {  5, "RRC Connection Release" },
720
    {  6, "UE Capability Information" },
721
    {  7, "UE Capability Enquiry" },
722
    {  8, "Initial Direct Transfer" },
723
    {  9, "Uplink Direct Transfer" },
724
    { 10, "Downlink Direct Transfer" },
725
    { 11, "Signaling Connection Release" },
726
    { 12, "Signalling connection Release Request" },
727
    { 13, "Counter Check" },
728
    { 14, "Radio Bearer Establishment" },
729
    { 15, "Radio Bearer Re-configuration" },
730
    { 16, "Radio Bearer Release" },
731
    { 17, "Transport Channel Re-configuration" },
732
    { 18, "Physical Channel Re-configuration" },
733
    { 19, "Transport Format Combination Control" },
734
    { 20, "Cell Update" },
735
    { 21, "URA Update" },
736
    { 22, "UTRAN Mobility Information" },
737
    { 23, "Active Set Update" },
738
    { 24, "Inter-System Handover from UTRAN" },
739
    { 25, "Inter-System Handover to UTRAN" },
740
    { 26, "Inter-System Cell Reselection from UTRAN" },
741
    { 27, "Inter-System Cell Reselection to UTRAN" },
742
    { 28, "Paging Type 1" },
743
    { 29, "Security Mode Command" },
744
    { 0, NULL }
745
};
746
747
static const value_string umts_rrc_fail_cause_vals[] = {
748
    {  0, "Configuration Unsupported" },
749
    {  1, "Physical Channel Failure" },
750
    {  2, "Incompatible Simultaneous Reconfig" },
751
    {  3, "Protocol Error" },
752
    {  4, "Compressed Mode Runtime Error" },
753
    {  5, "Cell Reselection" },
754
    {  6, "Invalid Configuration" },
755
    {  7, "Configuration Incomplete" },
756
    {  8, "Unsupported Measurement" },
757
    { 0, NULL }
758
};
759
760
static const value_string umts_rrc_prot_err_vals[] = {
761
    {  0, "ASN.1 Violation / Encoding Error" },
762
    {  1, "Not Existing or Not Implemented Message Type" },
763
    {  2, "Message Incompatible With Rx State" },
764
    {  3, "IE Value Not Understood" },
765
    {  4, "Conditional IE Error" },
766
    {  5, "Message Extension Not Understood" },
767
    { 0, NULL }
768
};
769
770
static const value_string wcdma_cid_allowed_call_access_vals[] = {
771
    { 0, "All Calls" },
772
    { 1, "Emergency Calls Only" },
773
    { 0, NULL }
774
};
775
776
static const value_string wcdma_rlc_ciph_level_vals[] = {
777
    {   0, "UEA0 (No ciphering)" },
778
    {   1, "UEA1" },
779
    {   2, "UEA2" },
780
    {   3, "UEA3" },
781
    { 255, "Not set" },
782
    { 0, NULL }
783
};
784
785
static const value_string wcdma_freq_scan_type_vals[] = {
786
    {   0, "Raw Scan" },
787
    {   1, "Fine Scan" },
788
    {   2, "Additional Channel Scan" },
789
    {   3, "List Scan" },
790
    { 0, NULL }
791
};
792
793
enum {
794
    MSG_BCCH_BCH          =  0,
795
    MSG_BCCH_DL_SCH       =  1,
796
    MSG_DL_CCCH           =  2,
797
    MSG_DL_DCCH           =  3,
798
    MSG_MCCH              =  4,
799
    MSG_PCCH              =  5,
800
    MSG_UL_CCCH           =  6,
801
    MSG_UL_CCCH1          =  7,
802
    MSG_UL_DCCH           =  8,
803
    MSG_RRC_RECONF        =  9,
804
    MSG_RRC_RECONF_COMPL  = 10,
805
    MSG_SIB2              = 11,
806
    MSG_SIB3              = 12,
807
    MSG_SIB4              = 13,
808
    MSG_SIB5              = 14,
809
    MSG_SIB6              = 15,
810
    MSG_SIB7              = 16,
811
    MSG_SIB8              = 17,
812
    MSG_SIB9              = 18,
813
    MSG_RADIOBEARERCONF   = 19,
814
    MSG_UE_MRDC_CAP       = 20,
815
    MSG_UE_NR_CAP         = 21,
816
    MSG_CG_CF_INFO        = 22,
817
    MSG_UE_CAP_RAT_CL     = 23,
818
    MSG_CELL_GRP_CFG      = 24,
819
    MSG_UE_RA_CAP_INF     = 25,
820
    MSG_MEAS_CFG          = 26,
821
    MSG_MEAS_GAP_CFG      = 27,
822
    MSG_HO_CMD            = 28,
823
    MSG_HO_PREP_INFO      = 29,
824
    MSG_BCCH_BCH_MBMS     = 30,
825
    MSG_BCCH_DL_SCH_BR    = 31,
826
    MSG_BCCH_DL_SCH_MBMS  = 32,
827
    MSG_SC_MCCH           = 33,
828
    MSG_SBCCH_SL_BCH      = 34,
829
    MSG_SBCCH_SL_BCH_V2X  = 35,
830
    MSG_DL_CCCH_NB        = 36,
831
    MSG_DL_DCCH_NB        = 37,
832
    MSG_UL_CCCH_NB        = 38,
833
    MSG_UL_DCCH_NB        = 39,
834
    MSG_BCCH_BCH_NB       = 40,
835
    MSG_BCCH_BCH_TDD_NB   = 41,
836
    MSG_BCCH_DL_SCH_NB    = 42,
837
    MSG_PCCH_NB           = 43,
838
    MSG_SC_MCCH_NB        = 44,
839
};
840
841
/* Packet Version 9, 12 */
842
static const value_string nr_rrc_pdu_type_v9_vals[] = {
843
    { 0x01, NR_PDU_BCCH_BCH },
844
    { 0x02, NR_PDU_BCCH_DL_SCH },
845
    { 0x03, NR_PDU_DL_CCCH },
846
    { 0x04, NR_PDU_DL_DCCH },
847
    { 0x05, NR_PDU_PCCH },
848
    { 0x06, NR_PDU_UL_CCCH },
849
    { 0x07, NR_PDU_UL_CCCH1 },
850
    { 0x08, NR_PDU_UL_DCCH },
851
    { 0x09, NR_PDU_RRC_RECONF },
852
    { 0x0a, NR_PDU_RRC_RECONF_COMPL },
853
    { 0x0e, NR_PDU_SIB2 },               // cellReselectionInfoCommon
854
    { 0x0f, NR_PDU_SIB3 },
855
    { 0x10, NR_PDU_SIB4 },               // interFreqCarrierFreqList
856
    { 0x11, NR_PDU_SIB5 },               // carrierFreqListEUTRA
857
    { 0x18, NR_PDU_RADIOBEARERCONF },
858
    { 0x19, NR_PDU_RADIOBEARERCONF },
859
    { 0x1a, NR_PDU_RADIOBEARERCONF },
860
    { 0x1c, NR_PDU_UE_MRDC_CAP },
861
    { 0x1d, NR_PDU_UE_NR_CAP },
862
    { 0, NULL }
863
};
864
865
/* Packet Version 14 */
866
static const value_string nr_rrc_pdu_type_v14_vals[] = {
867
    { 0x01, NR_PDU_BCCH_BCH },
868
    { 0x02, NR_PDU_BCCH_DL_SCH },
869
    { 0x03, NR_PDU_DL_CCCH },
870
    { 0x04, NR_PDU_DL_DCCH },
871
    { 0x05, NR_PDU_PCCH },
872
    { 0x06, NR_PDU_UL_CCCH },
873
    { 0x07, NR_PDU_UL_CCCH1 },
874
    { 0x08, NR_PDU_UL_DCCH },
875
    { 0x09, NR_PDU_RRC_RECONF },
876
    { 0x0a, NR_PDU_RRC_RECONF_COMPL },
877
    { 0x0e, NR_PDU_SIB2 },               // cellReselectionInfoCommon
878
    { 0x0f, NR_PDU_SIB3 },
879
    { 0x10, NR_PDU_SIB4 },               // interFreqCarrierFreqList
880
    { 0x11, NR_PDU_SIB5 },               // carrierFreqListEUTRA
881
    { 0x18, NR_PDU_RADIOBEARERCONF },
882
    { 0x19, NR_PDU_RADIOBEARERCONF },
883
    { 0x1a, NR_PDU_RADIOBEARERCONF },
884
    { 0x1f, NR_PDU_UE_MRDC_CAP },
885
    { 0x20, NR_PDU_UE_NR_CAP },
886
    { 0x21, NR_PDU_UE_NR_CAP },
887
    { 0, NULL }
888
};
889
890
/* Packet Version 17, 19 */
891
static const value_string nr_rrc_pdu_type_v17_vals[] = {
892
    { 0x01, NR_PDU_BCCH_BCH },
893
    { 0x02, NR_PDU_BCCH_DL_SCH },
894
    { 0x03, NR_PDU_DL_CCCH },
895
    { 0x04, NR_PDU_DL_DCCH },
896
    { 0x05, NR_PDU_PCCH },
897
    { 0x06, NR_PDU_UL_CCCH },
898
    { 0x07, NR_PDU_UL_CCCH1 },
899
    { 0x08, NR_PDU_UL_DCCH },
900
    { 0x09, NR_PDU_RRC_RECONF },
901
    { 0x0a, NR_PDU_RRC_RECONF_COMPL },
902
    { 0x0f, NR_PDU_SIB2 },               // cellReselectionInfoCommon
903
    { 0x10, NR_PDU_SIB3 },
904
    { 0x11, NR_PDU_SIB4 },               // interFreqCarrierFreqList
905
    { 0x12, NR_PDU_SIB5 },               // carrierFreqListEUTRA
906
    //{ 0x13: NR_PDU_SIB6 },
907
    //{ 0x14: NR_PDU_SIB7 },
908
    //{ 0x15: NR_PDU_SIB8 },
909
    //{ 0x16: NR_PDU_SIB9 },
910
    { 0x1d, NR_PDU_RADIOBEARERCONF },
911
    { 0, NULL }
912
};
913
914
/* Packet Version 20, 23, 24 */
915
static const value_string nr_rrc_pdu_type_v20_vals[] = {
916
    { 0x01, NR_PDU_BCCH_BCH },
917
    { 0x02, NR_PDU_BCCH_DL_SCH },
918
    { 0x03, NR_PDU_DL_CCCH },
919
    { 0x04, NR_PDU_DL_DCCH },
920
    { 0x05, NR_PDU_MCCH },
921
    { 0x06, NR_PDU_PCCH },
922
    { 0x07, NR_PDU_UL_CCCH },
923
    { 0x08, NR_PDU_UL_CCCH1 },
924
    { 0x09, NR_PDU_UL_DCCH },
925
    { 0x0a, NR_PDU_RRC_RECONF },
926
    { 0x0b, NR_PDU_RRC_RECONF_COMPL },
927
    { 0x13, NR_PDU_SIB2 },               // cellReselectionInfoCommon
928
    { 0x14, NR_PDU_SIB3 },
929
    { 0x15, NR_PDU_SIB4 },               // interFreqCarrierFreqList
930
    { 0x16, NR_PDU_SIB5 },               // carrierFreqListEUTRA
931
    { 0x17, NR_PDU_SIB6 },               // ETWS primary notification, Earthquake and Tsunami Warning System (ETWS)
932
    { 0x18, NR_PDU_SIB7 },               // ETWS secondary notification
933
    { 0x19, NR_PDU_SIB8 },               // CMAS warning notification, Commercial Mobile Alert System (CMAS)
934
    { 0x1a, NR_PDU_SIB9 },               // GPS time and Coordinated Universal Time (UTC)
935
    { 0x24, NR_PDU_RADIOBEARERCONF },
936
    { 0, NULL }
937
};
938
939
/* Packet Version 26 */
940
static const value_string nr_rrc_pdu_type_v26_vals[] = {
941
    { 0x01, NR_PDU_BCCH_BCH },
942
    { 0x02, NR_PDU_BCCH_DL_SCH },
943
    { 0x03, NR_PDU_DL_CCCH },
944
    { 0x04, NR_PDU_DL_DCCH },
945
    { 0x05, NR_PDU_MCCH },
946
    { 0x06, NR_PDU_PCCH },
947
    { 0x07, NR_PDU_UL_CCCH },
948
    { 0x08, NR_PDU_UL_CCCH1 },
949
    { 0x09, NR_PDU_UL_DCCH },
950
    { 0x0b, NR_PDU_RRC_RECONF },
951
    { 0x0c, NR_PDU_RRC_RECONF_COMPL },
952
    { 0x13, NR_PDU_SIB2 },               // cellReselectionInfoCommon
953
    { 0x14, NR_PDU_SIB3 },
954
    { 0x15, NR_PDU_SIB4 },               // interFreqCarrierFreqList
955
    { 0x16, NR_PDU_SIB5 },               // carrierFreqListEUTRA
956
    { 0x17, NR_PDU_SIB6 },               // ETWS primary notification, Earthquake and Tsunami Warning System (ETWS)
957
    { 0x18, NR_PDU_SIB7 },               // ETWS secondary notification
958
    { 0x19, NR_PDU_SIB8 },               // CMAS warning notification, Commercial Mobile Alert System (CMAS)
959
    { 0x1a, NR_PDU_SIB9 },               // GPS time and Coordinated Universal Time (UTC)
960
    { 0x24, NR_PDU_RADIOBEARERCONF },
961
    { 0, NULL }
962
};
963
964
/* Packet Version 28 */
965
static const value_string nr_rrc_pdu_type_v28_vals[] = {
966
    { 0x01, NR_PDU_BCCH_BCH },
967
    { 0x02, NR_PDU_BCCH_DL_SCH },
968
    { 0x03, NR_PDU_DL_CCCH },
969
    { 0x04, NR_PDU_DL_DCCH },
970
    { 0x05, NR_PDU_MCCH },
971
    { 0x06, NR_PDU_PCCH },
972
    { 0x07, NR_PDU_UL_CCCH },
973
    { 0x08, NR_PDU_UL_CCCH1 },
974
    { 0x0a, NR_PDU_UL_DCCH },
975
    { 0x0b, NR_PDU_RRC_RECONF },
976
    { 0x0c, NR_PDU_RRC_RECONF_COMPL },
977
    { 0x13, NR_PDU_SIB2 },               // cellReselectionInfoCommon
978
    { 0x14, NR_PDU_SIB3 },
979
    { 0x15, NR_PDU_SIB4 },              // interFreqCarrierFreqList
980
    { 0x16, NR_PDU_SIB5 },              // carrierFreqListEUTRA
981
    { 0x17, NR_PDU_SIB6 },              // ETWS primary notification, Earthquake and Tsunami Warning System (ETWS)
982
    { 0x18, NR_PDU_SIB7 },              // ETWS secondary notification
983
    { 0x19, NR_PDU_SIB8 },              // CMAS warning notification, Commercial Mobile Alert System (CMAS)
984
    { 0x1a, NR_PDU_SIB9 },              // GPS time and Coordinated Universal Time (UTC)
985
    { 0x24, NR_PDU_RADIOBEARERCONF },
986
    { 0, NULL }
987
};
988
989
/* Packet Version 9, 12 */
990
static const value_number nr_rrc_map_v9[] = {
991
    { 0x01, MSG_BCCH_BCH },
992
    { 0x02, MSG_BCCH_DL_SCH },
993
    { 0x03, MSG_DL_CCCH },
994
    { 0x04, MSG_DL_DCCH },
995
    { 0x05, MSG_PCCH },
996
    { 0x06, MSG_UL_CCCH },
997
    { 0x07, MSG_UL_CCCH1 },
998
    { 0x08, MSG_UL_DCCH },
999
    { 0x09, MSG_RRC_RECONF },
1000
    { 0x0a, MSG_RRC_RECONF_COMPL },
1001
    { 0x0e, MSG_SIB2 },               // cellReselectionInfoCommon
1002
    { 0x0f, MSG_SIB3 },
1003
    { 0x10, MSG_SIB4 },               // interFreqCarrierFreqList
1004
    { 0x11, MSG_SIB5 },               // carrierFreqListEUTRA
1005
    { 0x18, MSG_RADIOBEARERCONF },
1006
    { 0x19, MSG_RADIOBEARERCONF },
1007
    { 0x1a, MSG_RADIOBEARERCONF },
1008
    { 0x1c, MSG_UE_MRDC_CAP },
1009
    { 0x1d, MSG_UE_NR_CAP },
1010
    { 0, UINT32_MAX }
1011
};
1012
1013
/* Packet Version 14 */
1014
static const value_number nr_rrc_map_v14[] = {
1015
    { 0x01, MSG_BCCH_BCH },
1016
    { 0x02, MSG_BCCH_DL_SCH },
1017
    { 0x03, MSG_DL_CCCH },
1018
    { 0x04, MSG_DL_DCCH },
1019
    { 0x05, MSG_PCCH },
1020
    { 0x06, MSG_UL_CCCH },
1021
    { 0x07, MSG_UL_CCCH1 },
1022
    { 0x08, MSG_UL_DCCH },
1023
    { 0x09, MSG_RRC_RECONF },
1024
    { 0x0a, MSG_RRC_RECONF_COMPL },
1025
    { 0x0e, MSG_SIB2 },               // cellReselectionInfoCommon
1026
    { 0x0f, MSG_SIB3 },
1027
    { 0x10, MSG_SIB4 },               // interFreqCarrierFreqList
1028
    { 0x11, MSG_SIB5 },               // carrierFreqListEUTRA
1029
    { 0x18, MSG_RADIOBEARERCONF },
1030
    { 0x19, MSG_RADIOBEARERCONF },
1031
    { 0x1a, MSG_RADIOBEARERCONF },
1032
    { 0x1f, MSG_UE_MRDC_CAP },
1033
    { 0x20, MSG_UE_NR_CAP },
1034
    { 0x21, MSG_UE_NR_CAP },
1035
    { 0, UINT32_MAX }
1036
};
1037
1038
/* Packet Version 17, 19 */
1039
static const value_number nr_rrc_map_v17[] = {
1040
    { 0x01, MSG_BCCH_BCH },
1041
    { 0x02, MSG_BCCH_DL_SCH },
1042
    { 0x03, MSG_DL_CCCH },
1043
    { 0x04, MSG_DL_DCCH },
1044
    { 0x05, MSG_PCCH },
1045
    { 0x06, MSG_UL_CCCH },
1046
    { 0x07, MSG_UL_CCCH1 },
1047
    { 0x08, MSG_UL_DCCH },
1048
    { 0x09, MSG_RRC_RECONF },
1049
    { 0x0a, MSG_RRC_RECONF_COMPL },
1050
    { 0x0f, MSG_SIB2 },               // cellReselectionInfoCommon
1051
    { 0x10, MSG_SIB3 },
1052
    { 0x11, MSG_SIB4 },               // interFreqCarrierFreqList
1053
    { 0x12, MSG_SIB5 },               // carrierFreqListEUTRA
1054
    //{ 0x13: MSG_SIB6 },
1055
    //{ 0x14: MSG_SIB7 },
1056
    //{ 0x15: MSG_SIB8 },
1057
    //{ 0x16: MSG_SIB9 },
1058
    { 0x1d, MSG_RADIOBEARERCONF },
1059
    { 0, UINT32_MAX }
1060
};
1061
1062
/* Packet Version 20, 23, 24 */
1063
static const value_number nr_rrc_map_v20[] = {
1064
    { 0x01, MSG_BCCH_BCH },
1065
    { 0x02, MSG_BCCH_DL_SCH },
1066
    { 0x03, MSG_DL_CCCH },
1067
    { 0x04, MSG_DL_DCCH },
1068
    { 0x05, MSG_MCCH },
1069
    { 0x06, MSG_PCCH },
1070
    { 0x07, MSG_UL_CCCH },
1071
    { 0x08, MSG_UL_CCCH1 },
1072
    { 0x09, MSG_UL_DCCH },
1073
    { 0x0a, MSG_RRC_RECONF },
1074
    { 0x0b, MSG_RRC_RECONF_COMPL },
1075
    { 0x13, MSG_SIB2 },               // cellReselectionInfoCommon
1076
    { 0x14, MSG_SIB3 },
1077
    { 0x15, MSG_SIB4 },               // interFreqCarrierFreqList
1078
    { 0x16, MSG_SIB5 },               // carrierFreqListEUTRA
1079
    { 0x17, MSG_SIB6 },               // ETWS primary notification, Earthquake and Tsunami Warning System (ETWS)
1080
    { 0x18, MSG_SIB7 },               // ETWS secondary notification
1081
    { 0x19, MSG_SIB8 },               // CMAS warning notification, Commercial Mobile Alert System (CMAS)
1082
    { 0x1a, MSG_SIB9 },               // GPS time and Coordinated Universal Time (UTC)
1083
    { 0x24, MSG_RADIOBEARERCONF },
1084
    { 0, UINT32_MAX }
1085
};
1086
1087
/* Packet Version 26 */
1088
static const value_number nr_rrc_map_v26[] = {
1089
    { 0x01, MSG_BCCH_BCH },
1090
    { 0x02, MSG_BCCH_DL_SCH },
1091
    { 0x03, MSG_DL_CCCH },
1092
    { 0x04, MSG_DL_DCCH },
1093
    { 0x05, MSG_MCCH },
1094
    { 0x06, MSG_PCCH },
1095
    { 0x07, MSG_UL_CCCH },
1096
    { 0x08, MSG_UL_CCCH1 },
1097
    { 0x09, MSG_UL_DCCH },
1098
    { 0x0b, MSG_RRC_RECONF },
1099
    { 0x0c, MSG_RRC_RECONF_COMPL },
1100
    { 0x13, MSG_SIB2 },               // cellReselectionInfoCommon
1101
    { 0x14, MSG_SIB3 },
1102
    { 0x15, MSG_SIB4 },               // interFreqCarrierFreqList
1103
    { 0x16, MSG_SIB5 },               // carrierFreqListEUTRA
1104
    { 0x17, MSG_SIB6 },               // ETWS primary notification, Earthquake and Tsunami Warning System (ETWS)
1105
    { 0x18, MSG_SIB7 },               // ETWS secondary notification
1106
    { 0x19, MSG_SIB8 },               // CMAS warning notification, Commercial Mobile Alert System (CMAS)
1107
    { 0x1a, MSG_SIB9 },               // GPS time and Coordinated Universal Time (UTC)
1108
    { 0x24, MSG_RADIOBEARERCONF },
1109
    { 0, UINT32_MAX }
1110
};
1111
1112
/* Packet Version 28 */
1113
static const value_number nr_rrc_map_v28[] = {
1114
    { 0x01, MSG_BCCH_BCH },
1115
    { 0x02, MSG_BCCH_DL_SCH },
1116
    { 0x03, MSG_DL_CCCH },
1117
    { 0x04, MSG_DL_DCCH },
1118
    { 0x05, MSG_MCCH },
1119
    { 0x06, MSG_PCCH },
1120
    { 0x07, MSG_UL_CCCH },
1121
    { 0x08, MSG_UL_CCCH1 },
1122
    { 0x0a, MSG_UL_DCCH },
1123
    { 0x0b, MSG_RRC_RECONF },
1124
    { 0x0c, MSG_RRC_RECONF_COMPL },
1125
    { 0x13, MSG_SIB2 },               // cellReselectionInfoCommon
1126
    { 0x14, MSG_SIB3 },
1127
    { 0x15, MSG_SIB4 },              // interFreqCarrierFreqList
1128
    { 0x16, MSG_SIB5 },              // carrierFreqListEUTRA
1129
    { 0x17, MSG_SIB6 },              // ETWS primary notification, Earthquake and Tsunami Warning System (ETWS)
1130
    { 0x18, MSG_SIB7 },              // ETWS secondary notification
1131
    { 0x19, MSG_SIB8 },              // CMAS warning notification, Commercial Mobile Alert System (CMAS)
1132
    { 0x1a, MSG_SIB9 },              // GPS time and Coordinated Universal Time (UTC)
1133
    { 0x24, MSG_RADIOBEARERCONF },
1134
    { 0, UINT32_MAX }
1135
};
1136
1137
static uint32_t
1138
try_val_to_int(const uint32_t val, const value_number *cm)
1139
0
{
1140
0
    int i = 0;
1141
1142
0
    if (cm) {
1143
0
        while (cm[i].number != UINT32_MAX) {
1144
0
            if (cm[i].value == val) {
1145
0
                return(cm[i].number);
1146
0
            }
1147
0
            i++;
1148
0
        }
1149
0
    }
1150
1151
0
    return UINT32_MAX;
1152
0
}
1153
1154
static void
1155
try_call_dissector(dissector_handle_t handle, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1156
0
{
1157
0
    if (!handle) return;
1158
0
    TRY {
1159
0
      call_dissector(handle, tvb, pinfo, tree);
1160
0
    }
1161
0
    CATCH_BOUNDS_ERRORS {
1162
0
      show_exception(tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE);
1163
0
    }
1164
0
    ENDTRY;
1165
0
}
1166
1167
static void
1168
qcdiag_format_ver(char *s, uint32_t ver)
1169
0
{
1170
0
    uint8_t low, high;
1171
1172
0
    high = ver >> 16;
1173
0
    low  = ver & 0xffff;
1174
1175
0
    if (high)
1176
0
        snprintf(s, ITEM_LABEL_LENGTH, "%u (%u.%u)", ver, high, low);
1177
0
    else
1178
0
        snprintf(s, ITEM_LABEL_LENGTH, "%u (%u)", ver, low);
1179
0
}
1180
1181
static void
1182
dissect_qcdiag_log_set_col(packet_info *pinfo, uint32_t gsmtap_type)
1183
0
{
1184
0
    const char *str;
1185
1186
0
    str = val_to_str(pinfo->pool, gsmtap_type, gsmtap_types, "Unknown GSMTAP type (%d)");
1187
1188
0
    col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSMTAP");
1189
0
    col_set_str(pinfo->cinfo, COL_INFO, str);
1190
0
}
1191
1192
static void
1193
dissect_qcdiag_log_append_text(proto_tree *log_tree, proto_tree *tree, bool direction)
1194
0
{
1195
0
    proto_item *ti;
1196
1197
0
    ti = proto_tree_get_parent(log_tree);
1198
0
    proto_item_append_text(ti, " (%s)", tfs_get_string(direction, &tfs_uplink_downlink));
1199
1200
0
    ti = proto_tree_get_parent(tree);
1201
0
    proto_item_append_text(ti, " (%s)", tfs_get_string(direction, &tfs_uplink_downlink));
1202
0
}
1203
1204
static void
1205
0
store_uint16(uint8_t **array_ptr, uint16_t value) {
1206
0
    uint16_t network_value = g_htons(value);
1207
1208
0
    memcpy(*array_ptr, &network_value, sizeof(uint16_t));
1209
1210
0
    *array_ptr += sizeof(uint16_t);
1211
0
}
1212
1213
static tvbuff_t*
1214
get_udp_hdr_tvb(packet_info *pinfo _U_, uint16_t pdu_size, const char *string)
1215
0
{
1216
0
    tvbuff_t *udp_hdr_tvb;
1217
0
    uint8_t *udp_bytes, *arr_ptr;
1218
0
    uint16_t str_len, rlc_hdr_len, udp_hdr_len, udp_len;
1219
1220
0
    str_len = (uint16_t)strlen(string);
1221
0
    rlc_hdr_len = str_len + 5;
1222
1223
0
    udp_hdr_len = 8;
1224
0
    udp_len = udp_hdr_len + rlc_hdr_len + pdu_size;
1225
1226
0
    udp_bytes = (uint8_t*)wmem_alloc0(pinfo->pool, udp_hdr_len);
1227
1228
0
    arr_ptr = udp_bytes;
1229
0
    store_uint16(&arr_ptr, UDP_SRC_PORT);  /* Source Port */
1230
0
    store_uint16(&arr_ptr, UDP_DST_PORT);  /* Destination Port */
1231
0
    store_uint16(&arr_ptr, udp_len);       /* Length */
1232
0
    store_uint16(&arr_ptr, 0xffff);        /* Checksum */
1233
1234
0
    udp_hdr_tvb = tvb_new_real_data(udp_bytes, udp_hdr_len, udp_hdr_len);
1235
1236
0
    return udp_hdr_tvb;
1237
0
}
1238
1239
static tvbuff_t*
1240
get_rlc_hdr_tvb(packet_info *pinfo, uint8_t direction)
1241
0
{
1242
0
    tvbuff_t *rlc_hdr_tvb;
1243
0
    uint8_t *rlc_bytes;
1244
0
    uint16_t str_len, rlc_hdr_len;
1245
1246
0
    str_len = (uint16_t)strlen(RLC_START_STRING);
1247
0
    rlc_hdr_len = str_len + 5;
1248
1249
0
    rlc_bytes = (uint8_t*)wmem_alloc0(pinfo->pool, rlc_hdr_len);
1250
1251
0
    memcpy(rlc_bytes, RLC_START_STRING, str_len);
1252
0
    rlc_bytes[str_len++] = RLC_MODE_TAG;
1253
0
    rlc_bytes[str_len++] = RLC_AM;
1254
0
    rlc_bytes[str_len++] = RLC_DIRECTION_TAG;
1255
0
    rlc_bytes[str_len++] = direction;
1256
0
    rlc_bytes[str_len++] = RLC_PAYLOAD_TAG;
1257
1258
0
    rlc_hdr_tvb = tvb_new_real_data(rlc_bytes, rlc_hdr_len, rlc_hdr_len);
1259
1260
0
    return rlc_hdr_tvb;
1261
0
}
1262
1263
static tvbuff_t*
1264
get_gsmtap_hdr_tvb(packet_info *pinfo, uint8_t type, uint16_t arfcn, uint32_t frame_nr, uint8_t subtype, uint8_t subslot)
1265
0
{
1266
0
    tvbuff_t *gsmtap_hdr_tvb;
1267
0
    uint8_t *gsmtap_bytes;
1268
1269
0
    gsmtap_bytes = (uint8_t*)wmem_alloc0(pinfo->pool, 16);
1270
1271
0
    gsmtap_bytes[GSMTAP_HDR_VERSION]         = 0x02;
1272
0
    gsmtap_bytes[GSMTAP_HDR_HDR_LEN]         = 0x04;
1273
0
    gsmtap_bytes[GSMTAP_HDR_TYPE]            = type;
1274
0
    gsmtap_bytes[GSMTAP_HDR_ARFCN_4]         = arfcn >> 8;
1275
0
    gsmtap_bytes[GSMTAP_HDR_ARFCN_5]         = arfcn & 0xff;
1276
0
    gsmtap_bytes[GSMTAP_HDR_FRAME_NUMBER_8]  = (frame_nr >> 24) & 0xff;
1277
0
    gsmtap_bytes[GSMTAP_HDR_FRAME_NUMBER_9]  = (frame_nr >> 16) & 0xff;
1278
0
    gsmtap_bytes[GSMTAP_HDR_FRAME_NUMBER_10] = (frame_nr >>  8) & 0xff;
1279
0
    gsmtap_bytes[GSMTAP_HDR_FRAME_NUMBER_11] = frame_nr & 0xff;
1280
0
    gsmtap_bytes[GSMTAP_HDR_SUB_TYPE]        = subtype;
1281
0
    gsmtap_bytes[GSMTAP_HDR_SUB_SLOT]        = subslot;
1282
1283
0
    gsmtap_hdr_tvb = tvb_new_real_data(gsmtap_bytes, 16, 16);
1284
1285
0
    return gsmtap_hdr_tvb;
1286
0
}
1287
1288
static uint32_t
1289
get_lte_rrc_subtype(uint32_t pkt_ver, uint32_t pdu)
1290
0
{
1291
0
    const value_number* selected_map = NULL;
1292
1293
0
    switch (pkt_ver) {
1294
0
        case 0x02:
1295
0
        case 0x03:
1296
0
        case 0x04:
1297
0
        case 0x06:
1298
0
        case 0x07:
1299
0
        case 0x08:
1300
0
        case 0x0d:
1301
0
        case 0x16:
1302
0
            selected_map = lte_rrc_sm_v1;
1303
0
            break;
1304
0
        case 0x09:
1305
0
        case 0x0c:
1306
0
            selected_map = lte_rrc_sm_v2;
1307
0
            break;
1308
0
        case 0x0e:
1309
0
            selected_map = lte_rrc_sm_v3;
1310
0
            break;
1311
0
        case 0x0f:
1312
0
        case 0x10:
1313
0
            selected_map = lte_rrc_sm_v4;
1314
0
            break;
1315
0
        case 0x13:
1316
0
            selected_map = lte_rrc_sm_v5;
1317
0
            break;
1318
0
        case 0x14:
1319
0
        case 0x18:
1320
0
        case 0x19:
1321
0
            selected_map = lte_rrc_sm_v6;
1322
0
            break;
1323
0
        case 0x1a:
1324
0
        case 0x1b:
1325
0
        case 0x1e:
1326
0
            selected_map = lte_rrc_sm_v5;
1327
0
            break;
1328
0
        default:
1329
0
            return UINT32_MAX;
1330
0
    }
1331
1332
0
    return try_val_to_int(pdu, selected_map);
1333
0
}
1334
1335
static uint32_t
1336
get_nr_rrc_hf_pdu(uint32_t pkt_ver)
1337
0
{
1338
0
    int hf_pdu;
1339
1340
0
    switch (pkt_ver) {
1341
0
        case 9:
1342
0
        case 12:
1343
0
            hf_pdu = hf_qcdiag_nr_rrc_pdu_v9;
1344
0
            break;
1345
0
        case 14:
1346
0
            hf_pdu = hf_qcdiag_nr_rrc_pdu_v14;
1347
0
            break;
1348
0
        case 17:
1349
0
        case 19:
1350
0
            hf_pdu = hf_qcdiag_nr_rrc_pdu_v17;
1351
0
            break;
1352
0
        case 20:
1353
0
        case 23:
1354
0
        case 24:
1355
0
            hf_pdu = hf_qcdiag_nr_rrc_pdu_v20;
1356
0
            break;
1357
0
        case 26:
1358
0
            hf_pdu = hf_qcdiag_nr_rrc_pdu_v26;
1359
0
            break;
1360
0
        case 28:
1361
0
            hf_pdu = hf_qcdiag_nr_rrc_pdu_v28;
1362
0
            break;
1363
0
        default:
1364
0
            hf_pdu = -1;
1365
0
    }
1366
1367
0
    return hf_pdu;
1368
0
}
1369
1370
static dissector_handle_t
1371
get_nr_rrc_dissector(uint32_t pkt_ver, uint8_t pkt_pdu)
1372
0
{
1373
0
    const value_number* selected_map = NULL;
1374
0
    dissector_handle_t handle;
1375
0
    uint32_t pdu;
1376
1377
0
    switch (pkt_ver) {
1378
0
        case 9:
1379
0
        case 12:
1380
0
            selected_map = nr_rrc_map_v9;
1381
0
            break;
1382
0
        case 14:
1383
0
            selected_map = nr_rrc_map_v14;
1384
0
            break;
1385
0
        case 17:
1386
0
        case 19:
1387
0
            selected_map = nr_rrc_map_v17;
1388
0
            break;
1389
0
        case 20:
1390
0
        case 23:
1391
0
        case 24:
1392
0
            selected_map = nr_rrc_map_v20;
1393
0
            break;
1394
0
        case 26:
1395
0
            selected_map = nr_rrc_map_v26;
1396
0
            break;
1397
0
        case 28:
1398
0
            selected_map = nr_rrc_map_v28;
1399
0
            break;
1400
0
        default:
1401
0
            return NULL;
1402
0
    }
1403
1404
0
    pdu = try_val_to_int(pkt_pdu, selected_map);
1405
1406
0
    switch (pdu) {
1407
0
        case MSG_BCCH_BCH:
1408
0
            handle = nr_rrc_bcch_bch_handle;
1409
0
            break;
1410
0
        case MSG_BCCH_DL_SCH:
1411
0
            handle = nr_rrc_bcch_dl_sch_handle;
1412
0
            break;
1413
0
        case MSG_PCCH:
1414
0
            handle = nr_rrc_pcch_handle;
1415
0
            break;
1416
0
        case MSG_UL_DCCH:
1417
0
            handle = nr_rrc_ul_dcch_handle;
1418
0
            break;
1419
0
        case MSG_DL_DCCH:
1420
0
            handle = nr_rrc_dl_dcch_handle;
1421
0
            break;
1422
0
        case MSG_UL_CCCH:
1423
0
            handle = nr_rrc_ul_ccch_handle;
1424
0
            break;
1425
0
        case MSG_DL_CCCH:
1426
0
            handle = nr_rrc_dl_ccch_handle;
1427
0
            break;
1428
0
        case MSG_UL_CCCH1:
1429
0
            handle = nr_rrc_ul_ccch1_handle;
1430
0
            break;
1431
0
        case MSG_RRC_RECONF:
1432
0
            handle = nr_rrc_reconf_handle;
1433
0
            break;
1434
0
        case MSG_RRC_RECONF_COMPL:
1435
0
            handle = nr_rrc_reconf_compl_handle;
1436
0
            break;
1437
0
        case MSG_RADIOBEARERCONF:
1438
0
            handle = nr_rrc_radiobearerconfig_handle;
1439
0
            break;
1440
0
        case MSG_UE_MRDC_CAP:
1441
0
            handle = nr_rrc_ue_mrdc_cap_handle;
1442
0
            break;
1443
0
        case MSG_UE_NR_CAP:
1444
0
            handle = nr_rrc_ue_nr_cap_handle;
1445
0
            break;
1446
0
        case MSG_SIB2:
1447
0
            handle = nr_rrc_sib2_handle;
1448
0
            break;
1449
0
        case MSG_SIB3:
1450
0
            handle = nr_rrc_sib3_handle;
1451
0
            break;
1452
0
        case MSG_SIB4:
1453
0
            handle = nr_rrc_sib4_handle;
1454
0
            break;
1455
0
        case MSG_SIB5:
1456
0
            handle = nr_rrc_sib5_handle;
1457
0
            break;
1458
0
        case MSG_SIB6:
1459
0
            handle = nr_rrc_sib6_handle;
1460
0
            break;
1461
0
        case MSG_SIB7:
1462
0
            handle = nr_rrc_sib7_handle;
1463
0
            break;
1464
0
        case MSG_SIB8:
1465
0
            handle = nr_rrc_sib8_handle;
1466
0
            break;
1467
0
        case MSG_SIB9:
1468
0
            handle = nr_rrc_sib9_handle;
1469
0
            break;
1470
0
        default:
1471
0
            handle = NULL;
1472
0
    }
1473
1474
0
    return handle;
1475
0
}
1476
1477
static void
1478
dissect_qcdiag_log_wcdma_search_cell_resel_rank(tvbuff_t *tvb, uint32_t offset, packet_info *pinfo _U_, proto_tree *log_tree, proto_tree *tree _U_)
1479
0
{
1480
0
    proto_tree *subtree;
1481
0
    uint8_t i, len, version, num_wcdma, num_gsm;
1482
0
    int8_t rscp, rssi;
1483
0
    int16_t rscp_rank, ecio_rank, rssi_rank, h_val;
1484
0
    float ecio;
1485
1486
    /* Version */
1487
0
    proto_tree_add_item_ret_uint8(log_tree, hf_qcdiag_wcdma_crr_ver, tvb, offset, 1, ENC_NA, &version);
1488
1489
    /* Number of WCDMA Cells */
1490
0
    proto_tree_add_item_ret_uint8(log_tree, hf_qcdiag_wcdma_crr_num_3g, tvb, offset, 1, ENC_NA, &num_wcdma);
1491
0
    offset += 1;
1492
1493
    /* Reserved */
1494
0
    proto_tree_add_item(log_tree, hf_qcdiag_wcdma_crr_reserved, tvb, offset, 1, ENC_NA);
1495
1496
    /* Number of GSM Cells */
1497
0
    proto_tree_add_item_ret_uint8(log_tree, hf_qcdiag_wcdma_crr_num_2g, tvb, offset, 1, ENC_NA, &num_gsm);
1498
0
    offset += 1;
1499
1500
0
    if (!(version == 0 || version == 1 || version == 2))
1501
0
        return;
1502
1503
    /* From Version 2 there are 5 more bytes (so far unknown) */
1504
0
    if (version == 2)
1505
0
        offset += 5;
1506
1507
0
    for (i = 0; i < num_wcdma; i++) {
1508
0
        len = 10;
1509
0
        if (version == 1) len = 11;
1510
0
        if (version == 2) len = 16;
1511
1512
0
        subtree = proto_tree_add_subtree_format(log_tree, tvb, offset, len,
1513
0
                   ett_qcdiag_log_wcdma_crr_wcmda, NULL, "WCDMA Cell %d", i);
1514
1515
        /* RF Channel Frequency */
1516
0
        proto_tree_add_item(subtree, hf_qcdiag_wcdma_crr_uarfcn_3g, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1517
0
        offset += 2;
1518
1519
        /* Primary Scrambling Code */
1520
0
        proto_tree_add_item(subtree, hf_qcdiag_wcdma_crr_psc_3g, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1521
0
        offset += 2;
1522
1523
0
        rscp = tvb_get_int8(tvb, offset) - 21;
1524
1525
        /* Received Signal Code Power */
1526
0
        proto_tree_add_int(subtree, hf_qcdiag_wcdma_crr_rscp_3g, tvb, offset, 1, rscp);
1527
0
        offset += 1;
1528
1529
0
        rscp_rank = tvb_get_int16(tvb, offset, ENC_LITTLE_ENDIAN);
1530
1531
        /* Cell Ranking RSCP */
1532
0
        proto_tree_add_int(subtree, hf_qcdiag_wcdma_crr_rscp_rank_3g, tvb, offset, 2, rscp_rank);
1533
0
        offset += 2;
1534
1535
0
        ecio = (tvb_get_uint8(tvb, offset)-256) / 2.f;
1536
1537
        /* Energy Per Chip Over Interference */
1538
0
        proto_tree_add_float(subtree, hf_qcdiag_wcdma_crr_ecio_3g, tvb, offset, 1, ecio);
1539
0
        offset += 1;
1540
1541
0
        ecio_rank = tvb_get_int16(tvb, offset, ENC_LITTLE_ENDIAN);
1542
1543
        /* Cell Ranking Ec/Io */
1544
0
        proto_tree_add_int(subtree, hf_qcdiag_wcdma_crr_ecio_rank_3g, tvb, offset, 2, ecio_rank);
1545
0
        offset += 2;
1546
1547
        // TODO: identify the reselection status values
1548
0
        if (version > 0) {
1549
            /* Reselection Status */
1550
0
            proto_tree_add_item(subtree, hf_qcdiag_wcdma_crr_resel_status, tvb, offset, 1, ENC_NA);
1551
0
            offset += 1;
1552
0
        }
1553
1554
0
        if (version > 1) {
1555
            /* Hierarchical Cell Structure (HCS) Priority */
1556
0
            proto_tree_add_item(subtree, hf_qcdiag_wcdma_crr_hcs_priority, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1557
0
            offset += 2;
1558
1559
0
            h_val = tvb_get_int16(tvb, offset, ENC_LITTLE_ENDIAN);
1560
1561
            /* H Value */
1562
0
            proto_tree_add_int(subtree, hf_qcdiag_wcdma_crr_h_value, tvb, offset, 2, h_val);
1563
0
            offset += 2;
1564
1565
            /* Hierarchical Cell Structure (HCS) Cell Qualify */
1566
0
            proto_tree_add_item(subtree, hf_qcdiag_wcdma_crr_hcs_cell_qualify, tvb, offset, 1, ENC_NA);
1567
0
            offset += 1;
1568
0
        }
1569
0
    }
1570
1571
0
    for (i = 0; i < num_gsm; i++) {
1572
0
        len = 7;
1573
0
        if (version == 1) len = 8;
1574
0
        if (version == 2) len = 13;
1575
1576
0
        subtree = proto_tree_add_subtree_format(log_tree, tvb, offset, len,
1577
0
                   ett_qcdiag_log_wcdma_crr_gsm, NULL, "GSM Cell %d", i);
1578
1579
        /* RF Channel Frequency */
1580
0
        proto_tree_add_item(subtree, hf_qcdiag_wcdma_crr_arfcn_2g, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1581
0
        offset += 2;
1582
1583
        // TODO: interpret BSIC: NCC/BCC (1 byte each or 3-3 bits?)
1584
        /* Base Station Identity Code */
1585
0
        proto_tree_add_item(subtree, hf_qcdiag_wcdma_crr_bsic_2g, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1586
0
        offset += 2;
1587
1588
0
        rssi = tvb_get_int8(tvb, offset);
1589
1590
        /* Received Signal Strength Indicator */
1591
0
        proto_tree_add_int(subtree, hf_qcdiag_wcdma_crr_rssi_2g, tvb, offset, 1, rssi);
1592
0
        offset += 1;
1593
1594
0
        rssi_rank = tvb_get_int16(tvb, offset, ENC_LITTLE_ENDIAN);
1595
1596
        /* Cell Ranking RSSI */
1597
0
        proto_tree_add_int(subtree, hf_qcdiag_wcdma_crr_rssi_rank_2g, tvb, offset, 2, rssi_rank);
1598
0
        offset += 2;
1599
1600
        // TODO: is there a Band here? E.g.: Band = 0 (900/1800)
1601
1602
        // TODO: identify the reselection status values
1603
0
        if (version > 0) {
1604
            /* Reselection Status */
1605
0
            proto_tree_add_item(subtree, hf_qcdiag_wcdma_crr_resel_status, tvb, offset, 1, ENC_NA);
1606
0
            offset += 1;
1607
0
        }
1608
1609
0
        if (version > 1) {
1610
            /* Hierarchical Cell Structure (HCS) Priority */
1611
0
            proto_tree_add_item(subtree, hf_qcdiag_wcdma_crr_hcs_priority, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1612
0
            offset += 2;
1613
1614
0
            h_val = tvb_get_int16(tvb, offset, ENC_LITTLE_ENDIAN);
1615
1616
            /* H Value */
1617
0
            proto_tree_add_int(subtree, hf_qcdiag_wcdma_crr_h_value, tvb, offset, 2, h_val);
1618
0
            offset += 2;
1619
1620
            /* Hierarchical Cell Structure (HCS) Cell Qualify */
1621
0
            proto_tree_add_item(subtree, hf_qcdiag_wcdma_crr_hcs_cell_qualify, tvb, offset, 1, ENC_NA);
1622
0
            offset += 1;
1623
0
        }
1624
0
    }
1625
0
}
1626
1627
static void
1628
dissect_qcdiag_log_wcdma_rrc(tvbuff_t *tvb, uint32_t offset, packet_info *pinfo, proto_tree *log_tree, proto_tree *tree)
1629
0
{
1630
0
    tvbuff_t *payload_tvb, *gsmtap_hdr_tvb, *gsmtap_tvb;
1631
0
    uint32_t ct_offset, chan_type, subtype, uplink;
1632
0
    uint32_t arfcn_val;
1633
0
    int hf_rrc_ct, hf_qcdiag_subtype;
1634
1635
0
    uint32_t arfcn[] = { 0, 0 };
1636
1637
0
    ct_offset = offset;
1638
0
    chan_type = (uint32_t)tvb_get_uint8(tvb, offset);
1639
1640
0
    offset += 4;
1641
1642
0
    arfcn[0] = umts_last_uarfcn_dl[0];
1643
0
    arfcn[1] = umts_last_uarfcn_dl[1];
1644
1645
    /* Set the Channel Type header field */
1646
0
    hf_rrc_ct = hf_qcdiag_rrc_chan_type;
1647
1648
    /* Unset the Subtype header field */
1649
0
    hf_qcdiag_subtype = -1;
1650
1651
0
    if (chan_type == 0 || chan_type == 1) {
1652
0
        arfcn[0] = umts_last_uarfcn_ul[0];
1653
0
        arfcn[1] = umts_last_uarfcn_ul[1];
1654
0
    }
1655
1656
0
    if ((subtype = try_val_to_int(chan_type, umts_channel_type_map_v1) != UINT32_MAX)) {
1657
        /* subtype is from umts_channel_type_map_v1 */
1658
1659
        /* Set the Channel Type header field */
1660
0
        hf_rrc_ct = hf_qcdiag_rrc_chan_type_umts_v1;
1661
1662
0
    } else if (try_val_to_int(chan_type, umts_channel_type_map_ext_v1) != UINT32_MAX) {
1663
        /* subtype is from umts_channel_type_map_ext_v1 */
1664
0
        arfcn[0] = umts_last_uarfcn_dl[0];
1665
0
        arfcn[1] = umts_last_uarfcn_dl[1];
1666
1667
        /* Set the Subtype */
1668
0
        subtype = try_val_to_int(chan_type, umts_sib_type_map_v1);
1669
1670
        /* Set the Channel Type header field */
1671
0
        hf_rrc_ct = hf_qcdiag_rrc_chan_type_umts_v1;
1672
1673
        /* Set the Subtype header field */
1674
0
        hf_qcdiag_subtype = hf_qcdiag_subtype_v1;
1675
1676
0
        offset += 1;
1677
1678
0
    } else if ((subtype = try_val_to_int(chan_type, umts_channel_type_map_v2)) != UINT32_MAX) {
1679
        /* subtype is from umts_channel_type_map_v2 */
1680
0
        arfcn_val = (uint32_t)tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN);
1681
1682
0
        arfcn[0] = arfcn_val;
1683
0
        arfcn[1] = arfcn_val;
1684
1685
        /* Set the Channel Type header field */
1686
0
        hf_rrc_ct = hf_qcdiag_rrc_chan_type_umts_v2;
1687
1688
0
        offset += 4;
1689
1690
0
    } else if (try_val_to_int(chan_type, umts_channel_type_map_ext_v2) != UINT32_MAX) {
1691
        /* subtype is from umts_channel_type_map_ext_v2 */
1692
0
        arfcn_val = (uint32_t)tvb_get_uint16(tvb, offset, ENC_LITTLE_ENDIAN);
1693
1694
0
        arfcn[0] = arfcn_val;
1695
0
        arfcn[1] = arfcn_val;
1696
1697
        /* Set the Subtype */
1698
0
        subtype = (uint32_t)tvb_get_uint8(tvb, offset+4);
1699
0
        subtype = try_val_to_int(subtype, umts_sib_type_map_v2);
1700
1701
        /* Set the Channel Type header field */
1702
0
        hf_rrc_ct = hf_qcdiag_rrc_chan_type_umts_v2;
1703
1704
        /* Set the Subtype header field */
1705
0
        hf_qcdiag_subtype = hf_qcdiag_subtype_v2;
1706
1707
0
        offset += 5;
1708
0
    }
1709
1710
    /* Channel Type */
1711
0
    proto_tree_add_uint(log_tree, hf_rrc_ct, tvb, ct_offset++, 1, chan_type);
1712
1713
    /* Radio Bearer Id */
1714
0
    proto_tree_add_item(log_tree, hf_qcdiag_rrc_rb_id, tvb, ct_offset++, 1, ENC_NA);
1715
1716
    /* Message Length */
1717
0
    proto_tree_add_item(log_tree, hf_qcdiag_msg_len_2, tvb, ct_offset, 2, ENC_LITTLE_ENDIAN);
1718
1719
    /* Absolute Radio Frequency Channel Number */
1720
0
    proto_tree_add_item(log_tree, hf_qcdiag_arfcn, tvb, ct_offset+2, 2, ENC_LITTLE_ENDIAN);
1721
1722
    /* NOTE: the ARFCN value is not always set correctly with regards to direction.
1723
     * For example, WCDMA MIB with ARFCN 0x2975 but MIB is an uplink packet.
1724
     * ..10 1001 0111 0101 = ARFCN: 10613
1725
     * .0.. .... .... .... = Uplink: 0
1726
     * 0... .... .... .... = PCS band indicator: 0
1727
     *
1728
     * ARFCN 0x6975 would mean uplink.
1729
     */
1730
1731
    /* Uplink */
1732
0
    proto_tree_add_item_ret_uint(log_tree, hf_qcdiag_uplink, tvb, ct_offset+2, 2, ENC_LITTLE_ENDIAN, &uplink);
1733
1734
    /* PCS band indicator */
1735
0
    proto_tree_add_item(log_tree, hf_qcdiag_pcs, tvb, ct_offset+2, 2, ENC_LITTLE_ENDIAN);
1736
1737
    /* Primary Scrambling Code */
1738
0
    proto_tree_add_item(log_tree, hf_qcdiag_psc, tvb, ct_offset+4, 2, ENC_LITTLE_ENDIAN);
1739
1740
    /* Subtype */
1741
0
    if (hf_qcdiag_subtype != -1) {
1742
0
        proto_tree_add_item(log_tree, hf_qcdiag_subtype, tvb, offset-1, 1, ENC_NA);
1743
0
    }
1744
1745
0
    gsmtap_hdr_tvb = get_gsmtap_hdr_tvb(pinfo, GSMTAP_TYPE_UMTS_RRC, arfcn[0], 0, subtype, 0);
1746
0
    payload_tvb = tvb_new_subset_remaining(tvb, offset);
1747
1748
0
    gsmtap_tvb = tvb_new_composite();
1749
0
    tvb_composite_append(gsmtap_tvb, gsmtap_hdr_tvb);
1750
0
    tvb_composite_append(gsmtap_tvb, payload_tvb);
1751
0
    tvb_composite_finalize(gsmtap_tvb);
1752
1753
0
    dissect_qcdiag_log_set_col(pinfo, GSMTAP_TYPE_UMTS_RRC);
1754
0
    dissect_qcdiag_log_append_text(log_tree, tree, (bool)uplink);
1755
1756
0
    add_new_data_source(pinfo, gsmtap_tvb, "UMTS RRC");
1757
0
    try_call_dissector(gsmtap_handle, gsmtap_tvb, pinfo, proto_tree_get_parent_tree(tree));
1758
0
}
1759
1760
static void
1761
dissect_qcdiag_log_wcdma_rrc_states(tvbuff_t *tvb, uint32_t offset, packet_info *pinfo _U_, proto_tree *log_tree, proto_tree *tree _U_)
1762
0
{
1763
0
    uint8_t state;
1764
0
    const char *state_str;
1765
1766
    /* RRC State */
1767
0
    proto_tree_add_item_ret_uint8(log_tree, hf_qcdiag_wcdma_rrc_state, tvb, offset, 1, ENC_NA, &state);
1768
1769
0
    state_str = val_to_str(pinfo->pool, state, wcdma_rrc_states_vals, "Unknown State (%d)");
1770
0
    col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", state_str);
1771
0
}
1772
1773
static void
1774
dissect_qcdiag_log_wcdma_rrc_prot_errors(tvbuff_t *tvb, uint32_t offset, packet_info *pinfo _U_, proto_tree *log_tree, proto_tree *tree _U_)
1775
0
{
1776
    /* RRC State */
1777
0
    proto_tree_add_item(log_tree, hf_qcdiag_wcdma_rrc_state, tvb, offset, 1, ENC_NA);
1778
0
    offset += 1;
1779
1780
    /* RRC Procedure */
1781
0
    proto_tree_add_item(log_tree, hf_qcdiag_wcdma_rrc_procedure, tvb, offset, 1, ENC_NA);
1782
0
    offset += 1;
1783
1784
    /* RRC Failure Cause */
1785
0
    proto_tree_add_item(log_tree, hf_qcdiag_wcdma_rrc_failure_cause, tvb, offset, 1, ENC_NA);
1786
0
    offset += 1;
1787
1788
    /* RRC Protocol Error Cause */
1789
0
    proto_tree_add_item(log_tree, hf_qcdiag_wcdma_rrc_prot_err_cause, tvb, offset, 1, ENC_NA);
1790
0
}
1791
1792
static void
1793
dissect_qcdiag_log_wcdma_cell_id(tvbuff_t *tvb, uint32_t offset, packet_info *pinfo _U_, proto_tree *log_tree, proto_tree *tree _U_)
1794
0
{
1795
0
    proto_tree *subtree;
1796
0
    proto_item *item;
1797
0
    uint64_t mcc_mnc;
1798
0
    uint32_t mcc, mnc;
1799
0
    uint8_t mcc1, mcc2, mcc3;
1800
0
    uint8_t mnc1, mnc2, mnc3;
1801
0
    char *mcc_str, *mnc_str;
1802
1803
    /* UL UTRA ARFCN */
1804
0
    proto_tree_add_item(log_tree, hf_qcdiag_wcdma_cid_ul_uarfcn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1805
0
    offset += 4;
1806
1807
    /* DL UTRA ARFCN  */
1808
0
    proto_tree_add_item(log_tree, hf_qcdiag_wcdma_cid_dl_uarfcn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1809
0
    offset += 4;
1810
1811
    /* Cell Id */
1812
0
    proto_tree_add_item(log_tree, hf_qcdiag_wcdma_cid_cell_id, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1813
0
    offset += 4;
1814
1815
    /* UTRAN Registration Area */
1816
0
    proto_tree_add_item(log_tree, hf_qcdiag_wcdma_cid_ura_id, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1817
0
    offset += 2;
1818
1819
    /* Cell Access Restrictions */
1820
0
    subtree = proto_tree_add_subtree_format(log_tree, tvb, offset, 1,
1821
0
                   ett_qcdiag_log_wcdma_cid_car, NULL, "Cell Access Restrictions");
1822
1823
    /* Cell Barred */
1824
0
    proto_tree_add_item(subtree, hf_qcdiag_wcdma_cid_cell_barred, tvb, offset, 1, ENC_NA);
1825
1826
    /* Cell Reserved */
1827
0
    proto_tree_add_item(subtree, hf_qcdiag_wcdma_cid_cell_reserved, tvb, offset, 1, ENC_NA);
1828
1829
    /* Cell Reserved for SoLSA */
1830
0
    proto_tree_add_item(subtree, hf_qcdiag_wcdma_cid_cell_solsa, tvb, offset, 1, ENC_NA);
1831
1832
    /* UE Camped on Cell */
1833
0
    proto_tree_add_item(subtree, hf_qcdiag_wcdma_cid_ue_camped, tvb, offset, 1, ENC_NA);
1834
1835
    /* Reserved */
1836
0
    proto_tree_add_item(subtree, hf_qcdiag_wcdma_cid_reserved, tvb, offset, 1, ENC_NA);
1837
0
    offset += 1;
1838
1839
    /* Allowed Call Access */
1840
0
    proto_tree_add_item(log_tree, hf_qcdiag_wcdma_cid_allowed_call_access, tvb, offset, 1, ENC_NA);
1841
0
    offset += 1;
1842
1843
    /* Primary Scrambling Code */
1844
0
    proto_tree_add_item(log_tree, hf_qcdiag_wcdma_cid_psc, tvb, offset, 2, ENC_LITTLE_ENDIAN);
1845
0
    offset += 2;
1846
1847
0
    mcc_mnc = tvb_get_ntoh48(tvb, offset);
1848
1849
0
    mcc1 = tvb_get_uint8(tvb, offset);
1850
0
    mcc2 = tvb_get_uint8(tvb, offset+1);
1851
0
    mcc3 = tvb_get_uint8(tvb, offset+2);
1852
0
    mcc = 100*mcc1 + 10*mcc2 + mcc3;
1853
0
    mcc_str = wmem_strdup_printf(pinfo->pool, "%03u", mcc);
1854
1855
    /* MCC */
1856
0
    item = proto_tree_add_string_format_value(log_tree, hf_qcdiag_wcdma_cid_mcc, tvb,
1857
0
               offset, 3, mcc_str, "%s (%s)",
1858
0
               val_to_str_ext_const(mcc, &E212_codes_ext, "Unknown"),
1859
0
               mcc_str);
1860
1861
0
    if (((mcc1 > 9) || (mcc2 > 9) || (mcc3 > 9)) && (mcc_mnc != 0xffffffffffff))
1862
0
        expert_add_info(pinfo, item, &ei_qcdiag_log_mcc_non_decimal);
1863
1864
0
    offset += 3;
1865
1866
0
    mnc1 = tvb_get_uint8(tvb, offset);
1867
0
    mnc2 = tvb_get_uint8(tvb, offset+1);
1868
0
    mnc3 = tvb_get_uint8(tvb, offset+2);
1869
0
    if (mnc3 != 0xf) {
1870
0
        mnc = 100 * mnc1 + 10 * mnc2 + mnc3;
1871
0
        mnc_str = wmem_strdup_printf(pinfo->pool, "%03u", mnc);
1872
0
    } else {
1873
0
        mnc = 10 * mnc1 + mnc2;
1874
0
        mnc_str = wmem_strdup_printf(pinfo->pool, "%02u", mnc);
1875
0
    }
1876
1877
    /* MNC */
1878
0
    if (mnc3 != 0xf) {
1879
0
        item = proto_tree_add_string_format_value(log_tree, hf_qcdiag_wcdma_cid_mnc, tvb,
1880
0
                   offset, 3, mnc_str, "%s (%s)",
1881
0
                   val_to_str_ext_const(mcc * 1000 + mnc, &mcc_mnc_3digits_codes_ext, "Unknown"),
1882
0
                   mnc_str);
1883
0
    } else {
1884
0
        item = proto_tree_add_string_format_value(log_tree, hf_qcdiag_wcdma_cid_mnc, tvb,
1885
0
                   offset, 3, mnc_str, "%s (%s)",
1886
0
                   val_to_str_ext_const(mcc * 100 + mnc, &mcc_mnc_2digits_codes_ext, "Unknown"),
1887
0
                   mnc_str);
1888
0
    }
1889
1890
0
    if (((mnc1 > 9) || (mnc2 > 9) || ((mnc3 > 9) && (mnc3 != 0x0f))) && (mcc_mnc != 0xffffffffffff))
1891
0
        expert_add_info(pinfo, item, &ei_qcdiag_log_mnc_non_decimal);
1892
1893
0
    offset += 3;
1894
1895
    /* LAC */
1896
0
    proto_tree_add_item(log_tree, hf_qcdiag_wcdma_cid_lac, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1897
0
    offset += 4;
1898
1899
    /* RAC */
1900
0
    proto_tree_add_item(log_tree, hf_qcdiag_wcdma_cid_rac, tvb, offset, 4, ENC_LITTLE_ENDIAN);
1901
1902
    //umts_last_uarfcn_ul[radio_id] = ul_uarfcn
1903
    //umts_last_uarfcn_dl[radio_id] = dl_uarfcn
1904
    //umts_last_cell_id[radio_id]   = psc
1905
0
}
1906
1907
static void
1908
dissect_qcdiag_log_wcdma_rlc_dl_am_signaling_pdu(tvbuff_t *tvb, uint32_t offset, packet_info *pinfo, proto_tree *log_tree, proto_tree *tree _U_)
1909
0
{
1910
0
    tvbuff_t *payload_tvb, *udp_hdr_tvb, *rlc_tvb, *rlc_hdr_tvb;
1911
0
    proto_tree *subtree;
1912
0
    uint8_t i, num;
1913
0
    uint16_t pdu_count, pdu_size;
1914
1915
    /* Number of Entities */
1916
0
    proto_tree_add_item_ret_uint8(log_tree, hf_qcdiag_wcdma_rlc_num_ent, tvb, offset, 1, ENC_NA, &num);
1917
0
    offset += 1;
1918
1919
0
    for (i = 0; i < num; i++) {
1920
0
        pdu_size = tvb_get_uint16(tvb, offset+3, ENC_LITTLE_ENDIAN);
1921
1922
        /* Entity # */
1923
0
        subtree = proto_tree_add_subtree_format(log_tree, tvb, offset, 5+pdu_size,
1924
0
                   ett_qcdiag_log_wcdma_rlc_dl_am_sig, NULL, "Entity %d", i);
1925
1926
        /* Logical Channel Id */
1927
0
        proto_tree_add_item(subtree, hf_qcdiag_wcdma_rlc_lcid, tvb, offset, 1, ENC_NA);
1928
0
        offset += 1;
1929
1930
        /* PDU Count */
1931
0
        proto_tree_add_item_ret_uint16(subtree, hf_qcdiag_wcdma_rlc_pdu_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &pdu_count);
1932
0
        offset += 2;
1933
1934
        /* PDU Size in Bits */
1935
0
        proto_tree_add_uint(subtree, hf_qcdiag_wcdma_rlc_pdu_size_bits, tvb, offset, 2, pdu_size);
1936
0
        offset += 2;
1937
1938
0
        udp_hdr_tvb = get_udp_hdr_tvb(pinfo, pdu_size, RLC_START_STRING);
1939
0
        rlc_hdr_tvb = get_rlc_hdr_tvb(pinfo, DIRECTION_DOWNLINK);
1940
0
        payload_tvb = tvb_new_subset_length(tvb, offset, pdu_size);
1941
1942
0
        offset += pdu_size;
1943
1944
        /* To be able to call "RLC over UDP", an UDP header is also required */
1945
0
        rlc_tvb = tvb_new_composite();
1946
0
        tvb_composite_append(rlc_tvb, udp_hdr_tvb);
1947
0
        tvb_composite_append(rlc_tvb, rlc_hdr_tvb);
1948
0
        tvb_composite_append(rlc_tvb, payload_tvb);
1949
0
        tvb_composite_finalize(rlc_tvb);
1950
1951
        /* "RLC over UDP" heuristic UDP dissector is disabled by default */
1952
0
        if (hdtbl_entry && !heur_rlc_udp_enabled)
1953
0
            hdtbl_entry->enabled = HEURISTIC_ENABLE;
1954
1955
0
        add_new_data_source(pinfo, rlc_tvb, "WCDMA RLC");
1956
0
        try_call_dissector(udp_handle, rlc_tvb, pinfo, proto_tree_get_parent_tree(tree));
1957
1958
0
        if (hdtbl_entry && !heur_rlc_udp_enabled)
1959
0
            hdtbl_entry->enabled = HEURISTIC_DISABLE;
1960
0
    }
1961
0
}
1962
1963
static void
1964
dissect_qcdiag_log_wcdma_rlc_ul_am_signaling_pdu(tvbuff_t *tvb, uint32_t offset, packet_info *pinfo, proto_tree *log_tree, proto_tree *tree _U_)
1965
0
{
1966
0
    tvbuff_t *payload_tvb, *udp_hdr_tvb, *rlc_tvb, *rlc_hdr_tvb;
1967
0
    proto_tree *subtree;
1968
0
    uint8_t i, num;
1969
0
    uint16_t pdu_count, pdu_size;
1970
1971
    /* Number of Entities */
1972
0
    proto_tree_add_item_ret_uint8(log_tree, hf_qcdiag_wcdma_rlc_num_ent, tvb, offset, 1, ENC_NA, &num);
1973
0
    offset += 1;
1974
1975
0
    for (i = 0; i < num; i++) {
1976
0
        pdu_size = tvb_get_uint16(tvb, offset+3, ENC_LITTLE_ENDIAN);
1977
1978
        /* Entity # */
1979
0
        subtree = proto_tree_add_subtree_format(log_tree, tvb, offset, 5+pdu_size,
1980
0
                   ett_qcdiag_log_wcdma_rlc_dl_am_sig, NULL, "Entity %d", i);
1981
1982
        /* Logical Channel Id */
1983
0
        proto_tree_add_item(subtree, hf_qcdiag_wcdma_rlc_lcid, tvb, offset, 1, ENC_NA);
1984
0
        offset += 1;
1985
1986
        /* PDU Count */
1987
0
        proto_tree_add_item_ret_uint16(subtree, hf_qcdiag_wcdma_rlc_pdu_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &pdu_count);
1988
0
        offset += 2;
1989
1990
        /* PDU Size in Bits */
1991
0
        proto_tree_add_uint(subtree, hf_qcdiag_wcdma_rlc_pdu_size_bits, tvb, offset, 2, pdu_size);
1992
0
        offset += 2;
1993
1994
0
        udp_hdr_tvb = get_udp_hdr_tvb(pinfo, pdu_size, RLC_START_STRING);
1995
0
        rlc_hdr_tvb = get_rlc_hdr_tvb(pinfo, DIRECTION_UPLINK);
1996
0
        payload_tvb = tvb_new_subset_length(tvb, offset, pdu_size);
1997
1998
0
        offset += pdu_size;
1999
2000
        /* To be able to call "RLC over UDP", an UDP header is also required */
2001
0
        rlc_tvb = tvb_new_composite();
2002
0
        tvb_composite_append(rlc_tvb, udp_hdr_tvb);
2003
0
        tvb_composite_append(rlc_tvb, rlc_hdr_tvb);
2004
0
        tvb_composite_append(rlc_tvb, payload_tvb);
2005
0
        tvb_composite_finalize(rlc_tvb);
2006
2007
        /* "RLC over UDP" heuristic UDP dissector is disabled by default */
2008
0
        if (hdtbl_entry && !heur_rlc_udp_enabled)
2009
0
            hdtbl_entry->enabled = HEURISTIC_ENABLE;
2010
2011
0
        add_new_data_source(pinfo, rlc_tvb, "WCDMA RLC");
2012
0
        try_call_dissector(udp_handle, rlc_tvb, pinfo, proto_tree_get_parent_tree(tree));
2013
2014
0
        if (hdtbl_entry && !heur_rlc_udp_enabled)
2015
0
            hdtbl_entry->enabled = HEURISTIC_DISABLE;
2016
0
    }
2017
0
}
2018
2019
static void
2020
dissect_qcdiag_log_wcdma_rlc_ul_am_control_pdu(tvbuff_t *tvb, uint32_t offset, packet_info *pinfo, proto_tree *log_tree, proto_tree *tree _U_)
2021
0
{
2022
0
    tvbuff_t *payload_tvb, *udp_hdr_tvb, *rlc_tvb, *rlc_hdr_tvb;
2023
0
    uint16_t pdu_size;
2024
2025
    /* Logical Channel Id */
2026
0
    proto_tree_add_item(log_tree, hf_qcdiag_wcdma_rlc_lcid, tvb, offset, 1, ENC_NA);
2027
0
    offset += 1;
2028
2029
    /* PDU Size */
2030
0
    proto_tree_add_item_ret_uint16(log_tree, hf_qcdiag_wcdma_rlc_pdu_size, tvb, offset, 2, ENC_LITTLE_ENDIAN, &pdu_size);
2031
0
    offset += 2;
2032
2033
0
    udp_hdr_tvb = get_udp_hdr_tvb(pinfo, pdu_size, RLC_START_STRING);
2034
0
    rlc_hdr_tvb = get_rlc_hdr_tvb(pinfo, DIRECTION_UPLINK);
2035
0
    payload_tvb = tvb_new_subset_length(tvb, offset, pdu_size);
2036
2037
    /* To be able to call "RLC over UDP", an UDP header is also required */
2038
0
    rlc_tvb = tvb_new_composite();
2039
0
    tvb_composite_append(rlc_tvb, udp_hdr_tvb);
2040
0
    tvb_composite_append(rlc_tvb, rlc_hdr_tvb);
2041
0
    tvb_composite_append(rlc_tvb, payload_tvb);
2042
0
    tvb_composite_finalize(rlc_tvb);
2043
2044
    /* "RLC over UDP" heuristic UDP dissector is disabled by default */
2045
0
    if (hdtbl_entry && !heur_rlc_udp_enabled)
2046
0
        hdtbl_entry->enabled = HEURISTIC_ENABLE;
2047
2048
0
    add_new_data_source(pinfo, rlc_tvb, "WCDMA RLC");
2049
0
    try_call_dissector(udp_handle, rlc_tvb, pinfo, proto_tree_get_parent_tree(tree));
2050
2051
0
    if (hdtbl_entry && !heur_rlc_udp_enabled)
2052
0
        hdtbl_entry->enabled = HEURISTIC_DISABLE;
2053
0
}
2054
2055
static void
2056
dissect_qcdiag_log_wcdma_rlc_dl_am_control_pdu(tvbuff_t *tvb, uint32_t offset, packet_info *pinfo, proto_tree *log_tree, proto_tree *tree _U_)
2057
0
{
2058
0
    tvbuff_t *payload_tvb, *udp_hdr_tvb, *rlc_tvb, *rlc_hdr_tvb;
2059
0
    uint16_t pdu_size;
2060
2061
    /* Logical Channel Id */
2062
0
    proto_tree_add_item(log_tree, hf_qcdiag_wcdma_rlc_lcid, tvb, offset, 1, ENC_NA);
2063
0
    offset += 1;
2064
2065
    /* PDU Size */
2066
0
    proto_tree_add_item_ret_uint16(log_tree, hf_qcdiag_wcdma_rlc_pdu_size, tvb, offset, 2, ENC_LITTLE_ENDIAN, &pdu_size);
2067
0
    offset += 2;
2068
2069
0
    udp_hdr_tvb = get_udp_hdr_tvb(pinfo, pdu_size, RLC_START_STRING);
2070
0
    rlc_hdr_tvb = get_rlc_hdr_tvb(pinfo, DIRECTION_DOWNLINK);
2071
0
    payload_tvb = tvb_new_subset_length(tvb, offset, pdu_size);
2072
2073
    /* To be able to call "RLC over UDP", an UDP header is also required */
2074
0
    rlc_tvb = tvb_new_composite();
2075
0
    tvb_composite_append(rlc_tvb, udp_hdr_tvb);
2076
0
    tvb_composite_append(rlc_tvb, rlc_hdr_tvb);
2077
0
    tvb_composite_append(rlc_tvb, payload_tvb);
2078
0
    tvb_composite_finalize(rlc_tvb);
2079
2080
    /* "RLC over UDP" heuristic UDP dissector is disabled by default */
2081
0
    if (hdtbl_entry && !heur_rlc_udp_enabled)
2082
0
        hdtbl_entry->enabled = HEURISTIC_ENABLE;
2083
2084
0
    add_new_data_source(pinfo, rlc_tvb, "WCDMA RLC");
2085
0
    try_call_dissector(udp_handle, rlc_tvb, pinfo, proto_tree_get_parent_tree(tree));
2086
2087
0
    if (hdtbl_entry && !heur_rlc_udp_enabled)
2088
0
        hdtbl_entry->enabled = HEURISTIC_DISABLE;
2089
0
}
2090
2091
static void
2092
dissect_qcdiag_log_wcdma_rlc_dl_am_cipher_pdu(tvbuff_t *tvb, uint32_t offset, packet_info *pinfo _U_, proto_tree *log_tree, proto_tree *tree _U_)
2093
0
{
2094
0
    proto_tree *subtree;
2095
0
    uint16_t i, num;
2096
2097
    /* Number of PDUs */
2098
0
    proto_tree_add_item_ret_uint16(log_tree, hf_qcdiag_wcdma_rlc_num_pdu, tvb, offset, 2, ENC_LITTLE_ENDIAN, &num);
2099
0
    offset += 2;
2100
2101
0
    for (i = 0; i < num; i++) {
2102
        /* PDU # */
2103
0
        subtree = proto_tree_add_subtree_format(log_tree, tvb, offset, 14,
2104
0
                   ett_qcdiag_log_wcdma_rlc_dl_am_ciph, NULL, "PDU %d", i);
2105
2106
        /* Logical Channel Id */
2107
0
        proto_tree_add_item(subtree, hf_qcdiag_wcdma_rlc_lcid, tvb, offset, 1, ENC_NA);
2108
0
        offset += 1;
2109
2110
        /* Ciphering Key */
2111
0
        proto_tree_add_item(subtree, hf_qcdiag_wcdma_rlc_ciph_key, tvb, offset, 4, ENC_LITTLE_ENDIAN);
2112
0
        offset += 4;
2113
2114
        /* Ciphering Algorithm */
2115
0
        proto_tree_add_item(subtree, hf_qcdiag_wcdma_rlc_ciph_alg, tvb, offset, 1, ENC_NA);
2116
0
        offset += 1;
2117
2118
        /* Ciphered Message */
2119
0
        proto_tree_add_item(subtree, hf_qcdiag_wcdma_rlc_ciph_msg, tvb, offset, 4, ENC_LITTLE_ENDIAN);
2120
0
        offset += 4;
2121
2122
        /* Count C */
2123
0
        proto_tree_add_item(subtree, hf_qcdiag_wcdma_rlc_ciph_countc, tvb, offset, 4, ENC_LITTLE_ENDIAN);
2124
0
        offset += 4;
2125
0
    }
2126
0
}
2127
2128
static void
2129
dissect_qcdiag_log_wcdma_rlc_ul_am_cipher_pdu(tvbuff_t *tvb, uint32_t offset, packet_info *pinfo _U_, proto_tree *log_tree, proto_tree *tree _U_)
2130
0
{
2131
0
    proto_tree *subtree;
2132
0
    uint16_t i, num;
2133
2134
    /* Number of PDUs */
2135
0
    proto_tree_add_item_ret_uint16(log_tree, hf_qcdiag_wcdma_rlc_num_pdu, tvb, offset, 2, ENC_LITTLE_ENDIAN, &num);
2136
0
    offset += 2;
2137
2138
0
    for (i = 0; i < num; i++) {
2139
        /* PDU # */
2140
0
        subtree = proto_tree_add_subtree_format(log_tree, tvb, offset, 10,
2141
0
                   ett_qcdiag_log_wcdma_rlc_ul_am_ciph, NULL, "PDU %d", i);
2142
2143
        /* Logical Channel Id */
2144
0
        proto_tree_add_item(subtree, hf_qcdiag_wcdma_rlc_lcid, tvb, offset, 1, ENC_NA);
2145
0
        offset += 1;
2146
2147
        /* Ciphering Key */
2148
0
        proto_tree_add_item(subtree, hf_qcdiag_wcdma_rlc_ciph_key, tvb, offset, 4, ENC_LITTLE_ENDIAN);
2149
0
        offset += 4;
2150
2151
        /* Ciphering Algorithm */
2152
0
        proto_tree_add_item(subtree, hf_qcdiag_wcdma_rlc_ciph_alg, tvb, offset, 1, ENC_NA);
2153
0
        offset += 1;
2154
2155
        /* Count C */
2156
0
        proto_tree_add_item(subtree, hf_qcdiag_wcdma_rlc_ciph_countc, tvb, offset, 4, ENC_LITTLE_ENDIAN);
2157
0
        offset += 4;
2158
0
    }
2159
0
}
2160
2161
/* Decoded Example
2162
 *
2163
 * [0x41B0] WCDMA Freq Scan
2164
 * Version          = 1
2165
 * Freq Scan Type   = List scan (3)
2166
 * Freq Scan Thresh = -482
2167
 * Number of ARFCN  = 1
2168
 * -----------------------
2169
 * |   |     |RSSI |RSSI |
2170
 * |#  |ARFCN|(raw)|(dBm)|
2171
 * -----------------------
2172
 * |  0|10663|     |  -72|
2173
 * -----------------------
2174
 *
2175
 * Source: https://bchobby.github.io/posts/e3323df4cade84fa0b850a2b85ef1d14/
2176
 */
2177
2178
static void
2179
dissect_qcdiag_log_wcdma_freq_scan(tvbuff_t *tvb, uint32_t offset, packet_info *pinfo _U_, proto_tree *log_tree, proto_tree *tree _U_)
2180
0
{
2181
0
    proto_tree *subtree;
2182
0
    proto_item *generated_item;
2183
0
    uint8_t i, num, type;
2184
0
    int16_t val;
2185
2186
    /* Version */
2187
0
    proto_tree_add_item(log_tree, hf_qcdiag_log_ver, tvb, offset, 1, ENC_NA);
2188
0
    offset += 1;
2189
2190
    /* Frequency Scan Type */
2191
0
    proto_tree_add_item_ret_uint8(log_tree, hf_qcdiag_wcdma_freq_scan_type, tvb, offset, 1, ENC_NA, &type);
2192
0
    offset += 1;
2193
2194
0
    val = tvb_get_int16(tvb, offset, ENC_LITTLE_ENDIAN);
2195
2196
    /* Frequency Scan Threshold */
2197
0
    proto_tree_add_int(log_tree, hf_qcdiag_wcdma_freq_scan_thres, tvb, offset, 2, val);
2198
0
    offset += 2;
2199
2200
    /* Number of ARFCN */
2201
0
    proto_tree_add_item_ret_uint8(log_tree, hf_qcdiag_wcdma_freq_scan_num, tvb, offset, 1, ENC_NA, &num);
2202
0
    offset += 1;
2203
2204
0
    for (i = 0; i < num; i++) {
2205
        /* Frequency # */
2206
0
        subtree = proto_tree_add_subtree_format(log_tree, tvb, offset, 4,
2207
0
                   ett_qcdiag_log_wcdma_freq_scan, NULL, "Frequency %d", i);
2208
2209
        /* ARFCN */
2210
0
        proto_tree_add_item(subtree, hf_qcdiag_wcdma_freq_scan_arfcn, tvb, offset+2, 2, ENC_LITTLE_ENDIAN);
2211
2212
0
        val = tvb_get_int16(tvb, offset, ENC_LITTLE_ENDIAN);
2213
2214
0
        if (type == 2) {
2215
            /* RSSI (raw) */
2216
0
            proto_tree_add_int(subtree, hf_qcdiag_wcdma_freq_scan_rssi_raw, tvb, offset, 2, val);
2217
2218
            /* Convert raw to dBm
2219
             *
2220
             * RSSI (dBm) = (0.474 * raw) – 112
2221
             * The 0.474 value is the RSSI step size, in dB/LSB.
2222
             * -112 dBm will be the minimum read out value.
2223
             */
2224
0
            val = (int16_t)(0.474 * val) - 112;
2225
2226
            /* RSSI (dBm) */
2227
0
            generated_item = proto_tree_add_int(subtree, hf_qcdiag_wcdma_freq_scan_rssi_dbm, tvb, offset, 0, val);
2228
0
            proto_item_set_generated(generated_item);
2229
0
        } else if (type == 3) {
2230
            /* RSSI (dBm) */
2231
0
            proto_tree_add_int(subtree, hf_qcdiag_wcdma_freq_scan_rssi_dbm, tvb, offset, 2, val);
2232
0
        }
2233
2234
0
        offset += 4;
2235
0
    }
2236
0
}
2237
2238
static void
2239
dissect_qcdiag_log_rr(tvbuff_t *tvb, uint32_t offset, packet_info *pinfo, proto_tree *log_tree, proto_tree *tree)
2240
0
{
2241
0
    tvbuff_t *payload_tvb, *gsmtap_hdr_tvb, *gsmtap_tvb, *lapdm_tvb;
2242
0
    uint32_t channel_type_dir, channel_type, length;
2243
0
    uint8_t *lapdm_bytes;
2244
0
    bool direction;
2245
2246
0
    uint16_t arfcn[] = { 0, 0 };
2247
2248
0
    channel_type_dir = (uint32_t)tvb_get_uint8(tvb, offset);
2249
2250
    /* Channel Type */
2251
0
    proto_tree_add_item(log_tree, hf_qcdiag_rr_chan_type, tvb, offset, 1, ENC_NA);
2252
2253
    /* Direction */
2254
0
    proto_tree_add_item(log_tree, hf_qcdiag_rr_direction, tvb, offset, 1, ENC_NA);
2255
0
    offset += 1;
2256
2257
    /* Message Type */
2258
0
    proto_tree_add_item(log_tree, hf_qcdiag_rr_msg_type, tvb, offset, 1, ENC_NA);
2259
0
    offset += 1;
2260
2261
    /* Message Length */
2262
0
    proto_tree_add_item_ret_uint(log_tree, hf_qcdiag_msg_len_1, tvb, offset, 1, ENC_NA, &length);
2263
0
    offset += 1;
2264
2265
0
    arfcn[0] = gsm_last_uarfcn[0];
2266
0
    arfcn[1] = gsm_last_uarfcn[1];
2267
2268
    /* 0x00: uplink, 0x80: downlink */
2269
0
    direction = ((channel_type_dir & 0x80) == 0x00);
2270
2271
0
    if (direction)
2272
0
        arfcn[0] = arfcn[0] | GSMTAP_ARFCN_F_UPLINK;
2273
2274
0
    channel_type = try_val_to_int(channel_type_dir & 0x7f, gsm_rr_channel_type_map);
2275
2276
0
    lapdm_tvb = NULL;
2277
2278
    /* DCCH, SACCH requires pseudo length */
2279
0
    if (channel_type == 0) {
2280
        /* SDCCH/8 expects LAPDm header */
2281
0
        lapdm_bytes = (uint8_t*)wmem_alloc0(pinfo->pool, 3);
2282
2283
0
        lapdm_bytes[0] = 0x01;           /* Address field */
2284
0
        lapdm_bytes[1] = 0x03;           /* Control field */
2285
0
        lapdm_bytes[2] = length | 0x01;  /* length field */
2286
2287
0
        lapdm_tvb = tvb_new_real_data(lapdm_bytes, 3, 3);
2288
0
    } else if (channel_type == 4) {
2289
        /* SACCH/8 expects SACCH L1/LAPDm header */
2290
0
        lapdm_bytes = (uint8_t*)wmem_alloc0(pinfo->pool, 5);
2291
2292
0
        lapdm_bytes[0] = 0x00;           /* SACCH L1 header */
2293
0
        lapdm_bytes[1] = 0x00;           /* SACCH L1 header */
2294
0
        lapdm_bytes[2] = 0x01;           /* Address field */
2295
0
        lapdm_bytes[3] = 0x03;           /* Control field */
2296
0
        lapdm_bytes[4] = length | 0x01;  /* length field */
2297
2298
0
        lapdm_tvb = tvb_new_real_data(lapdm_bytes, 5, 5);
2299
0
    }
2300
2301
0
    gsmtap_hdr_tvb = get_gsmtap_hdr_tvb(pinfo, GSMTAP_TYPE_UM, arfcn[0], 0, channel_type, 0);
2302
0
    payload_tvb = tvb_new_subset_remaining(tvb, offset);
2303
2304
0
    gsmtap_tvb = tvb_new_composite();
2305
0
    tvb_composite_append(gsmtap_tvb, gsmtap_hdr_tvb);
2306
0
    tvb_composite_append(gsmtap_tvb, lapdm_tvb);
2307
0
    tvb_composite_append(gsmtap_tvb, payload_tvb);
2308
0
    tvb_composite_finalize(gsmtap_tvb);
2309
2310
0
    dissect_qcdiag_log_set_col(pinfo, GSMTAP_TYPE_UM);
2311
0
    dissect_qcdiag_log_append_text(log_tree, tree, direction);
2312
2313
0
    add_new_data_source(pinfo, gsmtap_tvb, "GSM RR");
2314
0
    try_call_dissector(gsmtap_handle, gsmtap_tvb, pinfo, proto_tree_get_parent_tree(tree));
2315
0
}
2316
2317
static void
2318
dissect_qcdiag_log_gprs_mac(tvbuff_t *tvb, uint32_t offset, packet_info *pinfo, proto_tree *log_tree, proto_tree *tree)
2319
0
{
2320
0
    tvbuff_t *payload_tvb, *gsmtap_hdr_tvb, *gsmtap_tvb, *mac_hdr_tvb;
2321
0
    uint32_t channel_type_dir, channel_type, length;
2322
0
    uint8_t *mac_hdr_bytes;
2323
0
    uint8_t mac_hdr_dl_payload_type, mac_hdr_dl_rrbp, mac_hdr_dl_sp, mac_hdr_dl_usf;
2324
0
    uint8_t mac_hdr_ul_payload_type, mac_hdr_ul_retry;
2325
0
    bool direction;
2326
2327
0
    uint32_t arfcn[] = { 0, 0 };
2328
2329
0
    channel_type_dir = (uint32_t)tvb_get_uint8(tvb, offset);
2330
2331
    /* Channel Type */
2332
0
    proto_tree_add_item(log_tree, hf_qcdiag_mac_chan_type, tvb, offset, 1, ENC_NA);
2333
2334
    /* Direction */
2335
0
    proto_tree_add_item(log_tree, hf_qcdiag_mac_direction, tvb, offset, 1, ENC_NA);
2336
0
    offset += 1;
2337
2338
    /* Message Type */
2339
0
    proto_tree_add_item(log_tree, hf_qcdiag_mac_msg_type, tvb, offset, 1, ENC_NA);
2340
0
    offset += 1;
2341
2342
    /* Message Length */
2343
0
    proto_tree_add_item_ret_uint(log_tree, hf_qcdiag_msg_len_1, tvb, offset, 1, ENC_NA, &length);
2344
0
    offset += 1;
2345
2346
0
    arfcn[0] = gsm_last_uarfcn[0];
2347
0
    arfcn[1] = gsm_last_uarfcn[1];
2348
2349
    /* 0x00: uplink, 0x80: downlink */
2350
0
    direction = ((channel_type_dir & 0x80) == 0x00);
2351
2352
0
    if (direction)
2353
0
        arfcn[0] = arfcn[0] | GSMTAP_ARFCN_F_UPLINK;
2354
2355
0
    channel_type = try_val_to_int(channel_type_dir, gsm_gmac_channel_type_map);
2356
2357
    /* 'GPRS MAC Signaling Message' does not have the 'GSM RLC/MAC' header byte
2358
2359
       [0x5226] GPRS MAC Signaling Message  (Downlink)
2360
       Channel Type (1 byte)
2361
       Message Type (1 byte)
2362
       Length       (1 byte)
2363
2364
       MESSAGE_TYPE_xxxxxx (6 bits)
2365
       Packet Downlink <message type name> content
2366
         PAGE_MODE (2 bits)
2367
2368
2369
       [0x5226] GPRS MAC Signaling Message  (Uplink)
2370
       Channel Type (1 byte)
2371
       Message Type (1 byte)
2372
       Length       (1 byte)
2373
2374
       MESSAGE_TYPE_xxxxxx (6 bits)
2375
       Packet Uplink <message type name> content
2376
         TLLI/G-RNTI (32 bits)
2377
         CTRL_ACK    (2 bits)
2378
2379
2380
       GSM RLC/MAC: <message type name> (Downlink)
2381
         xx.. .... = Payload Type
2382
         ..xx .... = RRBP
2383
         .... x... = S/P
2384
         .... .xxx = USF
2385
         MESSAGE_TYPE (DL): <message type name>
2386
           xxxx xx.. = MESSAGE_TYPE (DL)
2387
           .... ..xx = PAGE_MODE
2388
2389
2390
       GSM RLC/MAC: <message type name> (Uplink)
2391
         xx.. .... = Payload Type (UL)
2392
         ..00 000. = spare: 0
2393
         .... ...x = R
2394
         xxxx xx.. = MESSAGE_TYPE (UL)
2395
         .... ..xx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xx.. = TLLI
2396
         .... ..xx = CTRL_ACK
2397
    */
2398
2399
0
    mac_hdr_bytes = (uint8_t*)wmem_alloc0(pinfo->pool, 1);
2400
2401
0
    if (direction) {
2402
0
        mac_hdr_ul_payload_type = 0x01;  /* packet-gsm_rlcmac.c, dl_payload_type_vals */
2403
0
        mac_hdr_ul_retry = 0x00;         /* packet-gsm_rlcmac.c, retry_vals */
2404
2405
0
        mac_hdr_bytes[0]  = mac_hdr_ul_payload_type << 6;
2406
0
        mac_hdr_bytes[0] += mac_hdr_ul_retry;
2407
0
    } else {
2408
0
        mac_hdr_dl_payload_type = 0x01;  /* packet-gsm_rlcmac.c, dl_payload_type_vals */
2409
0
        mac_hdr_dl_rrbp = 0x00;          /* packet-gsm_rlcmac.c, rrbp_vals */
2410
0
        mac_hdr_dl_sp = 0x00;            /* packet-gsm_rlcmac.c, s_p_vals */
2411
0
        mac_hdr_dl_usf = 0x00;
2412
2413
0
        mac_hdr_bytes[0]  = mac_hdr_dl_payload_type << 6;
2414
0
        mac_hdr_bytes[0] += mac_hdr_dl_rrbp << 4;
2415
0
        mac_hdr_bytes[0] += mac_hdr_dl_sp << 3;
2416
0
        mac_hdr_bytes[0] += mac_hdr_dl_usf;
2417
0
    }
2418
2419
0
    gsmtap_hdr_tvb = get_gsmtap_hdr_tvb(pinfo, GSMTAP_TYPE_UM, arfcn[0], 0, channel_type, 0);
2420
0
    mac_hdr_tvb = tvb_new_real_data(mac_hdr_bytes, 1, 1);
2421
0
    payload_tvb = tvb_new_subset_remaining(tvb, offset);
2422
2423
0
    gsmtap_tvb = tvb_new_composite();
2424
0
    tvb_composite_append(gsmtap_tvb, gsmtap_hdr_tvb);
2425
0
    tvb_composite_append(gsmtap_tvb, mac_hdr_tvb);
2426
0
    tvb_composite_append(gsmtap_tvb, payload_tvb);
2427
0
    tvb_composite_finalize(gsmtap_tvb);
2428
2429
0
    dissect_qcdiag_log_set_col(pinfo, GSMTAP_TYPE_UM);
2430
0
    dissect_qcdiag_log_append_text(log_tree, tree, direction);
2431
2432
0
    add_new_data_source(pinfo, gsmtap_tvb, "GPRS MAC");
2433
0
    try_call_dissector(gsmtap_handle, gsmtap_tvb, pinfo, proto_tree_get_parent_tree(tree));
2434
0
}
2435
2436
static void
2437
dissect_qcdiag_log_umts_nas(tvbuff_t *tvb, uint32_t offset, packet_info *pinfo, proto_tree *log_tree, proto_tree *tree)
2438
0
{
2439
0
    tvbuff_t *payload_tvb, *gsmtap_hdr_tvb, *gsmtap_tvb;
2440
0
    uint16_t arfcn;
2441
0
    bool direction;
2442
2443
    /* Direction */
2444
0
    proto_tree_add_item_ret_boolean(log_tree, hf_qcdiag_nas_direction, tvb, offset, 1, ENC_NA, &direction);
2445
0
    offset += 1;
2446
2447
    /* Length */
2448
0
    proto_tree_add_item(log_tree, hf_qcdiag_nas_msg_length, tvb, offset, 4, ENC_LITTLE_ENDIAN);
2449
0
    offset += 4;
2450
2451
0
    arfcn = (uint16_t)(direction) << 14;
2452
2453
0
    gsmtap_hdr_tvb = get_gsmtap_hdr_tvb(pinfo, GSMTAP_TYPE_ABIS, arfcn, 0, 0, 0);
2454
0
    payload_tvb = tvb_new_subset_remaining(tvb, offset);
2455
2456
0
    gsmtap_tvb = tvb_new_composite();
2457
0
    tvb_composite_append(gsmtap_tvb, gsmtap_hdr_tvb);
2458
0
    tvb_composite_append(gsmtap_tvb, payload_tvb);
2459
0
    tvb_composite_finalize(gsmtap_tvb);
2460
2461
0
    dissect_qcdiag_log_set_col(pinfo, GSMTAP_TYPE_ABIS);
2462
0
    dissect_qcdiag_log_append_text(log_tree, tree, direction);
2463
2464
0
    add_new_data_source(pinfo, gsmtap_tvb, "UMTS NAS");
2465
0
    try_call_dissector(gsmtap_handle, gsmtap_tvb, pinfo, proto_tree_get_parent_tree(tree));
2466
0
}
2467
2468
static void
2469
dissect_qcdiag_log_lte_rrc(tvbuff_t *tvb, uint32_t offset, packet_info *pinfo, proto_tree *log_tree, proto_tree *tree)
2470
0
{
2471
0
    tvbuff_t *payload_tvb, *gsmtap_hdr_tvb, *gsmtap_tvb;
2472
0
    uint32_t version, sfn, pdu, subtype, subslot, arfcn, earfcn, frame_nr;
2473
0
    uint8_t rnum, rmajmin;
2474
0
    wmem_strbuf_t *buf;
2475
0
    bool direction;
2476
2477
    /* Packet Version */
2478
0
    proto_tree_add_item_ret_uint(log_tree, hf_qcdiag_packet_ver, tvb, offset, 1, ENC_NA, &version);
2479
0
    offset += 1;
2480
2481
0
    rnum    = tvb_get_uint8(tvb, offset);
2482
0
    rmajmin = tvb_get_uint8(tvb, offset+1);
2483
2484
0
    buf = wmem_strbuf_new(pinfo->pool, "");
2485
0
    wmem_strbuf_append_printf(buf, "%u.%u.%u", rnum, rmajmin / 16, rmajmin % 16);
2486
2487
    /* LTE Release Number */
2488
0
    proto_tree_add_string(log_tree, hf_qcdiag_lte_rrc_rel, tvb, offset, 2, wmem_strbuf_get_str(buf));
2489
0
    offset += 2;
2490
2491
0
    if (version > 24) {
2492
0
        rnum    = tvb_get_uint8(tvb, offset);
2493
0
        rmajmin = tvb_get_uint8(tvb, offset+1);
2494
2495
0
        buf = wmem_strbuf_new(pinfo->pool, "");
2496
0
        wmem_strbuf_append_printf(buf, "%u.%u.%u", rnum, rmajmin / 16, rmajmin % 16);
2497
2498
        /* NR Release Number */
2499
0
        proto_tree_add_string(log_tree, hf_qcdiag_nr_rrc_rel, tvb, offset, 2, wmem_strbuf_get_str(buf));
2500
0
        offset += 2;
2501
0
    }
2502
2503
    /* Radio Bearer Id */
2504
0
    proto_tree_add_item(log_tree, hf_qcdiag_lte_rrc_rb_id, tvb, offset, 1, ENC_NA);
2505
0
    offset += 1;
2506
2507
    /* Physical Cell Id */
2508
0
    proto_tree_add_item(log_tree, hf_qcdiag_lte_rrc_pci, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2509
0
    offset += 2;
2510
2511
    /* Frequency */
2512
0
    if (version < 8) {
2513
0
        proto_tree_add_item_ret_uint(log_tree, hf_qcdiag_lte_rrc_earfcn_v2, tvb, offset, 2, ENC_LITTLE_ENDIAN, &earfcn);
2514
0
        offset += 2;
2515
0
    } else {
2516
0
        proto_tree_add_item_ret_uint(log_tree, hf_qcdiag_lte_rrc_earfcn_v8, tvb, offset, 4, ENC_LITTLE_ENDIAN, &earfcn);
2517
0
        offset += 4;
2518
0
    }
2519
2520
    /* System Frame Number */
2521
0
    proto_tree_add_item_ret_uint(log_tree, hf_qcdiag_lte_rrc_sfn, tvb, offset, 2, ENC_LITTLE_ENDIAN, &sfn);
2522
0
    offset += 2;
2523
2524
    /* PDU */
2525
0
    proto_tree_add_item_ret_uint(log_tree, hf_qcdiag_lte_rrc_pdu, tvb, offset, 1, ENC_NA, &pdu);
2526
0
    offset += 1;
2527
2528
    /* SIB */
2529
0
    if (version > 4) {
2530
0
        proto_tree_add_item(log_tree, hf_qcdiag_lte_rrc_sib, tvb, offset, 4, ENC_LITTLE_ENDIAN);
2531
0
        offset += 4;
2532
0
    }
2533
2534
    /* Message Length */
2535
0
    proto_tree_add_item(log_tree, hf_qcdiag_msg_len_2, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2536
0
    offset += 2;
2537
2538
    /* From Version 30 there are 3 more bytes (so far unknown) */
2539
0
    if (version > 29)
2540
0
        offset += 3;
2541
2542
0
    subtype = get_lte_rrc_subtype(version, pdu);
2543
2544
    /* Uplink */
2545
0
    direction = (subtype == UL_CCCH ||
2546
0
                 subtype == UL_DCCH ||
2547
0
                 subtype == UL_CCCH_NB ||
2548
0
                 subtype == UL_DCCH_NB);
2549
2550
0
    arfcn = (earfcn >= GSMTAP_ARFCN_F_UPLINK) ? 0 : earfcn;
2551
2552
0
    if (direction)
2553
0
        arfcn = arfcn | GSMTAP_ARFCN_F_UPLINK;
2554
2555
0
    frame_nr = (sfn & 0xfff0) >> 4;
2556
0
    subslot = sfn & 0x000f;
2557
2558
0
    gsmtap_hdr_tvb = get_gsmtap_hdr_tvb(pinfo, GSMTAP_TYPE_LTE_RRC, arfcn, frame_nr, subtype, subslot);
2559
0
    payload_tvb = tvb_new_subset_remaining(tvb, offset);
2560
2561
0
    gsmtap_tvb = tvb_new_composite();
2562
0
    tvb_composite_append(gsmtap_tvb, gsmtap_hdr_tvb);
2563
0
    tvb_composite_append(gsmtap_tvb, payload_tvb);
2564
0
    tvb_composite_finalize(gsmtap_tvb);
2565
2566
0
    dissect_qcdiag_log_set_col(pinfo, GSMTAP_TYPE_LTE_RRC);
2567
0
    dissect_qcdiag_log_append_text(log_tree, tree, direction);
2568
2569
0
    add_new_data_source(pinfo, gsmtap_tvb, "LTE RRC");
2570
0
    try_call_dissector(gsmtap_handle, gsmtap_tvb, pinfo, proto_tree_get_parent_tree(tree));
2571
0
}
2572
2573
static void
2574
dissect_qcdiag_log_lte_nas(tvbuff_t *tvb, uint32_t offset, packet_info *pinfo, proto_tree *log_tree, proto_tree *tree, bool plain)
2575
0
{
2576
0
    tvbuff_t *payload_tvb, *gsmtap_hdr_tvb, *gsmtap_tvb;
2577
0
    uint16_t arfcn;
2578
0
    uint8_t msgtype, number, major, minor;
2579
0
    wmem_strbuf_t *buf;
2580
0
    bool direction;
2581
2582
    /* Version */
2583
0
    proto_tree_add_item(log_tree, hf_qcdiag_log_ver, tvb, offset, 1, ENC_NA);
2584
0
    offset += 1;
2585
2586
0
    number = tvb_get_uint8(tvb, offset);
2587
0
    major  = tvb_get_uint8(tvb, offset+1);
2588
0
    minor  = tvb_get_uint8(tvb, offset+2);
2589
2590
0
    buf = wmem_strbuf_new(pinfo->pool, "");
2591
0
    wmem_strbuf_append_printf(buf, "%u.%u.%u", number, major, minor);
2592
2593
    /* Release Version */
2594
0
    proto_tree_add_string(log_tree, hf_qcdiag_lte_nas_rel, tvb, offset, 3, wmem_strbuf_get_str(buf));
2595
0
    offset += 3;
2596
2597
    /* Message Type */
2598
0
    msgtype = tvb_get_uint8(tvb, offset+1);
2599
2600
    /* Uplink */
2601
0
    direction = (msgtype == 0x41 ||  /* Attach request */
2602
0
                 msgtype == 0x45 ||  /* Detach request */
2603
0
                 msgtype == 0x48 ||  /* Tracking area update request */
2604
0
                 msgtype == 0x4c ||  /* Extended service request */
2605
0
                 msgtype == 0x4d ||  /* Control plane service request */
2606
0
                 msgtype == 0x52 ||  /* Authentication request */
2607
0
                 msgtype == 0x55 ||  /* Identity request */
2608
0
                 msgtype == 0x63 ||  /* Uplink NAS transport */
2609
0
                 msgtype == 0x69);   /* Uplink generic NAS transport */
2610
2611
0
    arfcn = (direction) ? GSMTAP_ARFCN_F_UPLINK : 0;
2612
2613
0
    gsmtap_hdr_tvb = get_gsmtap_hdr_tvb(pinfo, GSMTAP_TYPE_LTE_NAS, arfcn, 0, !plain, 0);
2614
0
    payload_tvb = tvb_new_subset_remaining(tvb, offset);
2615
2616
0
    gsmtap_tvb = tvb_new_composite();
2617
0
    tvb_composite_append(gsmtap_tvb, gsmtap_hdr_tvb);
2618
0
    tvb_composite_append(gsmtap_tvb, payload_tvb);
2619
0
    tvb_composite_finalize(gsmtap_tvb);
2620
2621
0
    dissect_qcdiag_log_set_col(pinfo, GSMTAP_TYPE_LTE_NAS);
2622
0
    dissect_qcdiag_log_append_text(log_tree, tree, direction);
2623
2624
0
    add_new_data_source(pinfo, gsmtap_tvb, "NAS-EPS");
2625
0
    try_call_dissector(gsmtap_handle, gsmtap_tvb, pinfo, proto_tree_get_parent_tree(tree));
2626
0
}
2627
2628
static void
2629
dissect_qcdiag_log_nr_rrc(tvbuff_t *tvb, uint32_t offset, packet_info *pinfo, proto_tree *log_tree, proto_tree *tree)
2630
0
{
2631
0
    tvbuff_t *payload_tvb, *nr5g_tvb;
2632
0
    dissector_handle_t handle;
2633
0
    uint32_t version;
2634
0
    uint8_t pdu, rnum, rmajmin;
2635
0
    uint64_t ncgi;
2636
0
    wmem_strbuf_t *buf;
2637
0
    int hf_pdu;
2638
2639
    /* Version */
2640
0
    proto_tree_add_item_ret_uint(log_tree, hf_qcdiag_log_ver_4, tvb, offset, 4, ENC_LITTLE_ENDIAN, &version);
2641
0
    offset += 4;
2642
2643
    /* Known Packet Versions: 9, 12, 14, 17, 19, 20, 23, 24, 26, 28 */
2644
2645
0
    rnum    = tvb_get_uint8(tvb, offset);
2646
0
    rmajmin = tvb_get_uint8(tvb, offset+1);
2647
2648
0
    buf = wmem_strbuf_new(pinfo->pool, "");
2649
0
    wmem_strbuf_append_printf(buf, "%u.%u.%u", rnum, rmajmin / 16, rmajmin % 16);
2650
2651
    /* NR Release Number */
2652
0
    proto_tree_add_string(log_tree, hf_qcdiag_nr_rrc_rel, tvb, offset, 2, wmem_strbuf_get_str(buf));
2653
0
    offset += 2;
2654
2655
    /* Radio Bearer Id */
2656
0
    proto_tree_add_item(log_tree, hf_qcdiag_nr_rrc_rb_id, tvb, offset, 1, ENC_NA);
2657
0
    offset += 1;
2658
2659
    /* Physical Cell Id */
2660
0
    proto_tree_add_item(log_tree, hf_qcdiag_nr_rrc_pci, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2661
0
    offset += 2;
2662
2663
    /* NR Cell Global Identifier */
2664
0
    if (version > 16) {
2665
0
        ncgi = tvb_get_letoh64(tvb, offset);
2666
2667
0
        if (ncgi > 0) {
2668
0
            (void) proto_tree_add_bits_item(log_tree, hf_qcdiag_nr_rrc_ncgi, tvb, offset * 8, 60, ENC_LITTLE_ENDIAN);
2669
0
        }
2670
0
        offset += 8;
2671
0
    }
2672
2673
    /* Frequency */
2674
0
    proto_tree_add_item(log_tree, hf_qcdiag_nr_rrc_arfcn, tvb, offset, 4, ENC_LITTLE_ENDIAN);
2675
0
    offset += 4;
2676
2677
    /* System Frame Number */
2678
0
    if (version < 12) {
2679
0
        proto_tree_add_item(log_tree, hf_qcdiag_nr_rrc_sfn_v9, tvb, offset, 4, ENC_LITTLE_ENDIAN);
2680
0
        offset += 4;
2681
0
    } else {
2682
0
        proto_tree_add_item(log_tree, hf_qcdiag_nr_rrc_sfn, tvb, offset, 3, ENC_LITTLE_ENDIAN);
2683
0
        offset += 3;
2684
0
    }
2685
2686
0
    pdu = tvb_get_uint8(tvb, offset);
2687
0
    hf_pdu = get_nr_rrc_hf_pdu(version);
2688
2689
    /* PDU */
2690
0
    if (hf_pdu > 0)
2691
0
        proto_tree_add_item(log_tree, hf_pdu, tvb, offset, 1, ENC_NA);
2692
0
    offset += 1;
2693
2694
    /* SIB */
2695
0
    proto_tree_add_item(log_tree, hf_qcdiag_nr_rrc_sib, tvb, offset, 4, ENC_LITTLE_ENDIAN);
2696
0
    offset += 4;
2697
2698
    /* Message Length */
2699
0
    proto_tree_add_item(log_tree, hf_qcdiag_msg_len_2, tvb, offset, 2, ENC_LITTLE_ENDIAN);
2700
0
    offset += 2;
2701
2702
    /* From Version 19 there is 1 byte here (so far unknown) */
2703
0
    if (version > 18)
2704
0
        offset += 1;
2705
2706
    /* From Version 23 there are 2 bytes here (so far unknown) */
2707
0
    if (version > 22)
2708
0
        offset += 2;
2709
2710
    /* Segment Id */
2711
0
    if (version > 22) {
2712
0
        proto_tree_add_item(log_tree, hf_qcdiag_nr_rrc_segment_id, tvb, offset, 1, ENC_NA);
2713
0
        offset += 1;
2714
0
    }
2715
2716
    /* Version 28 is the last known version */
2717
0
    if (version > 28)
2718
0
        return;
2719
2720
0
    payload_tvb = tvb_new_subset_remaining(tvb, offset);
2721
2722
0
    nr5g_tvb = tvb_new_composite();
2723
0
    tvb_composite_append(nr5g_tvb, payload_tvb);
2724
0
    tvb_composite_finalize(nr5g_tvb);
2725
2726
0
    handle = get_nr_rrc_dissector(version, pdu);
2727
2728
0
    add_new_data_source(pinfo, nr5g_tvb, "NR RRC");
2729
0
    try_call_dissector(handle, nr5g_tvb, pinfo, proto_tree_get_parent_tree(tree));
2730
0
}
2731
2732
static void
2733
dissect_qcdiag_log_nr_nas(tvbuff_t *tvb, uint32_t offset, packet_info *pinfo, proto_tree *log_tree, proto_tree *tree)
2734
0
{
2735
0
    tvbuff_t *payload_tvb, *nr5g_tvb;
2736
0
    uint8_t number, major, minor;
2737
0
    wmem_strbuf_t *buf;
2738
2739
    /* Version */
2740
0
    proto_tree_add_item(log_tree, hf_qcdiag_log_ver_4, tvb, offset, 4, ENC_LITTLE_ENDIAN);
2741
0
    offset += 4;
2742
2743
0
    number = tvb_get_uint8(tvb, offset);
2744
0
    major  = tvb_get_uint8(tvb, offset+1);
2745
0
    minor  = tvb_get_uint8(tvb, offset+2);
2746
2747
0
    buf = wmem_strbuf_new(pinfo->pool, "");
2748
0
    wmem_strbuf_append_printf(buf, "%u.%u.%u", number, major, minor);
2749
2750
    /* Release Version */
2751
0
    proto_tree_add_string(log_tree, hf_qcdiag_nr_nas_rel, tvb, offset, 3, wmem_strbuf_get_str(buf));
2752
0
    offset += 3;
2753
2754
0
    payload_tvb = tvb_new_subset_remaining(tvb, offset);
2755
2756
0
    nr5g_tvb = tvb_new_composite();
2757
0
    tvb_composite_append(nr5g_tvb, payload_tvb);
2758
0
    tvb_composite_finalize(nr5g_tvb);
2759
2760
0
    col_clear(pinfo->cinfo, COL_INFO);
2761
2762
0
    add_new_data_source(pinfo, nr5g_tvb, "NAS-5GS");
2763
0
    try_call_dissector(nas5gs_handle, nr5g_tvb, pinfo, proto_tree_get_parent_tree(tree));
2764
0
}
2765
2766
2767
/* Get Log Request
2768
 * +-----------------------+----------------+-----------------------------------------+
2769
 * | Field                 | Length (bytes) | Description                             |
2770
 * +=======================+================+=========================================+
2771
 * | CMD_CODE ( 16 / 0x10) |       1        | Message ID: The CMD_CODE is set to 16   |
2772
 * |                       |                | for this message                        |
2773
 * +-----------------------+----------------+-----------------------------------------+
2774
 *
2775
 * Get Log Response
2776
 * +-----------------------+----------------+-----------------------------------------+
2777
 * | Field                 | Length (bytes) | Description                             |
2778
 * +=======================+================+=========================================+
2779
 * | CMD_CODE ( 16 / 0x10) |       1        | Message ID: The CMD_CODE is set to 16   |
2780
 * |                       |                | for this message                        |
2781
 * +-----------------------+----------------+-----------------------------------------+
2782
 * | MORE                  |       1        | More log data available indicator;      |
2783
 * |                       |                | indicates how many log entries (not     |
2784
 * |                       |                | including the one returned with this    |
2785
 * |                       |                | message) are queued                     |
2786
 * +-----------------------+----------------+-----------------------------------------+
2787
 * | LENGTH                |       2        | Length of the included LOG_ITEM,        |
2788
 * |                       |                | in bytes                                |
2789
 * +-----------------------+----------------+-----------------------------------------+
2790
 * | LOG_ITEM              |     LENGTH     | Log data;                               |
2791
 * |                       |                | Log Record Structure                    |
2792
 * +-----------------------+----------------+-----------------------------------------+
2793
 *
2794
 * Log Record Structure
2795
 * +-----------------------+----------------+-----------------------------------------+
2796
 * | Field                 | Length (bytes) | Description                             |
2797
 * +=======================+================+=========================================+
2798
 * | LENGTH                |       2        | Length of the log record; this is the   |
2799
 * |                       |                | record including LENGTH, LOG_CODE, and  |
2800
 * |                       |                | TIMESTAMP                               |
2801
 * +-----------------------+----------------+-----------------------------------------+
2802
 * | LOG_CODE              |       2        | Specifies the log item.                 |
2803
 * |                       |                | LOG_CODE is the 16-bit logging code and |
2804
 * |                       |                | consists of the following fields:       |
2805
 * |                       |                | - Equipment identifier: Most significant|
2806
 * |                       |                |   4 bits of the log code specify the    |
2807
 * |                       |                |   equipment ID                          |
2808
 * |                       |                | - Item identifier: Least significant    |
2809
 * |                       |                |   12 bits of the log code specify the   |
2810
 * |                       |                |   log item ID within the equipment ID   |
2811
 * +-----------------------+----------------+-----------------------------------------+
2812
 * | TIMESTAMP             |       8        | QC timestamp; this the same format as   |
2813
 * |                       |                | in the Time Stamp (29 / 0x1D)           |
2814
 * +-----------------------+----------------+-----------------------------------------+
2815
 * | DATA                  |   LENGTH+12    | Data specific to that log type          |
2816
 * +-----------------------+----------------+-----------------------------------------+
2817
 */
2818
2819
static int
2820
dissect_qcdiag_log(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
2821
1
{
2822
1
    proto_item *ti;
2823
1
    proto_tree *diag_log_tree;
2824
1
    tvbuff_t *payload_tvb;
2825
1
    qcdiag_data_t *qcdata;
2826
1
    uint32_t offset = 0;
2827
1
    uint32_t length, code;
2828
1
    nstime_t abs_time;
2829
1
    const char *timestamp;
2830
1
    const char *str;
2831
2832
1
    qcdata = (qcdiag_data_t*)data;
2833
2834
1
    length = tvb_reported_length(tvb);
2835
2836
1
    if (qcdata && qcdata->custom) {
2837
        /* DIAG_MAX_F */
2838
0
        offset++;
2839
0
        length--;
2840
0
    }
2841
2842
    /* Request */
2843
1
    if (length == 2) {
2844
0
        return tvb_captured_length(tvb);
2845
0
    }
2846
2847
    /* Log Code */
2848
1
    code = tvb_get_uint16(tvb, offset+6, ENC_LITTLE_ENDIAN);
2849
2850
    /* More */
2851
1
    proto_tree_add_item(tree, hf_qcdiag_log_more, tvb, offset+1, 1, ENC_NA);
2852
2853
    /* Length of the log record */
2854
1
    proto_tree_add_item(tree, hf_qcdiag_log_len, tvb, offset+4, 2, ENC_LITTLE_ENDIAN);
2855
2856
1
    offset += 8;
2857
2858
1
    abs_time = qcdiag_parse_timestamp(tvb, offset);
2859
1
    pinfo->abs_ts = abs_time;
2860
1
    pinfo->fd->abs_ts = abs_time;
2861
2862
    /* local time in our time zone, with month and day */
2863
1
    timestamp = abs_time_to_str(pinfo->pool, &abs_time, ABSOLUTE_TIME_LOCAL, true);
2864
2865
    /* Timestamp */
2866
1
    proto_tree_add_string(tree, hf_qcdiag_log_timestamp, tvb, offset, 8, timestamp);
2867
1
    offset += 8;
2868
2869
1
    str = val_to_str_ext(pinfo->pool, code, qcdiag_logcodes_ext, "Unknown Log Code (0x%04x)");
2870
2871
1
    ti = proto_tree_get_parent(tree);
2872
1
    col_set_str(pinfo->cinfo, COL_INFO, str);
2873
1
    proto_item_append_text(ti, ", %s", str);
2874
2875
1
    ti = proto_tree_add_item(tree, proto_qcdiag_log, tvb, offset, -1, ENC_NA);
2876
1
    proto_item_set_text(ti, "%s", str);
2877
2878
1
    diag_log_tree = proto_item_add_subtree(ti, ett_qcdiag_log);
2879
2880
1
    if (qcdata && qcdata->custom) {
2881
0
        payload_tvb = tvb_new_subset_remaining(tvb, offset);
2882
0
        call_dissector(text_lines_handle, payload_tvb, pinfo, diag_log_tree);
2883
2884
0
        return tvb_captured_length(tvb);
2885
0
    }
2886
2887
1
    switch (code) {
2888
    /* 1X - 0x1000 log code base */
2889
2890
    /* WCDMA - 0x4000 log code base */
2891
0
    case 0x4005:
2892
0
        dissect_qcdiag_log_wcdma_search_cell_resel_rank(tvb, offset, pinfo, diag_log_tree, tree);
2893
0
        break;
2894
0
    case 0x412f:
2895
0
        dissect_qcdiag_log_wcdma_rrc(tvb, offset, pinfo, diag_log_tree, tree);
2896
0
        break;
2897
0
    case 0x4125:
2898
0
        dissect_qcdiag_log_wcdma_rrc_states(tvb, offset, pinfo, diag_log_tree, tree);
2899
0
        break;
2900
0
    case 0x4126:
2901
0
        dissect_qcdiag_log_wcdma_rrc_prot_errors(tvb, offset, pinfo, diag_log_tree, tree);
2902
0
        break;
2903
0
    case 0x4127:
2904
0
        dissect_qcdiag_log_wcdma_cell_id(tvb, offset, pinfo, diag_log_tree, tree);
2905
0
        break;
2906
0
    case 0x4135:
2907
0
        dissect_qcdiag_log_wcdma_rlc_dl_am_signaling_pdu(tvb, offset, pinfo, diag_log_tree, tree);
2908
0
        break;
2909
0
    case 0x413c:
2910
0
        dissect_qcdiag_log_wcdma_rlc_ul_am_signaling_pdu(tvb, offset, pinfo, diag_log_tree, tree);
2911
0
        break;
2912
0
    case 0x4145:
2913
0
        dissect_qcdiag_log_wcdma_rlc_ul_am_control_pdu(tvb, offset, pinfo, diag_log_tree, tree);
2914
0
        break;
2915
0
    case 0x4146:
2916
0
        dissect_qcdiag_log_wcdma_rlc_dl_am_control_pdu(tvb, offset, pinfo, diag_log_tree, tree);
2917
0
        break;
2918
0
    case 0x4168:
2919
0
        dissect_qcdiag_log_wcdma_rlc_dl_am_cipher_pdu(tvb, offset, pinfo, diag_log_tree, tree);
2920
0
        break;
2921
0
    case 0x4169:
2922
0
        dissect_qcdiag_log_wcdma_rlc_ul_am_cipher_pdu(tvb, offset, pinfo, diag_log_tree, tree);
2923
0
        break;
2924
0
    case 0x41b0:
2925
0
        dissect_qcdiag_log_wcdma_freq_scan(tvb, offset, pinfo, diag_log_tree, tree);
2926
0
        break;
2927
2928
    /* GSM - 0x5000 log code base */
2929
0
    case 0x512f:
2930
0
        dissect_qcdiag_log_rr(tvb, offset, pinfo, diag_log_tree, tree);
2931
0
        break;
2932
0
    case 0x5226:
2933
0
        dissect_qcdiag_log_gprs_mac(tvb, offset, pinfo, diag_log_tree, tree);
2934
0
        break;
2935
2936
    /* UMTS - 0x7000 log code base */
2937
0
    case 0x713a:
2938
0
        dissect_qcdiag_log_umts_nas(tvb, offset, pinfo, diag_log_tree, tree);
2939
0
        break;
2940
2941
    /* LTE - 0xB000 log code base (0xB010 - 0xB1FF ) */
2942
0
    case 0xb0c0:
2943
0
        dissect_qcdiag_log_lte_rrc(tvb, offset, pinfo, diag_log_tree, tree);
2944
0
        break;
2945
0
    case 0xb0e0:
2946
0
    case 0xb0e1:
2947
0
        dissect_qcdiag_log_lte_nas(tvb, offset, pinfo, diag_log_tree, tree, false);
2948
0
        break;
2949
0
    case 0xb0e2:
2950
0
    case 0xb0e3:
2951
0
        dissect_qcdiag_log_lte_nas(tvb, offset, pinfo, diag_log_tree, tree, true);
2952
0
        break;
2953
0
    case 0xb0ea:
2954
0
    case 0xb0eb:
2955
0
        dissect_qcdiag_log_lte_nas(tvb, offset, pinfo, diag_log_tree, tree, false);
2956
0
        break;
2957
0
    case 0xb0ec:
2958
0
    case 0xb0ed:
2959
0
        dissect_qcdiag_log_lte_nas(tvb, offset, pinfo, diag_log_tree, tree, true);
2960
0
        break;
2961
2962
    /* NR - 0xB800 log code base (0xB800 - 0xB9FF ) */
2963
0
    case 0xb800:
2964
0
        dissect_qcdiag_log_nr_nas(tvb, offset, pinfo, diag_log_tree, tree);
2965
0
        break;
2966
0
    case 0xb801:
2967
0
        dissect_qcdiag_log_nr_nas(tvb, offset, pinfo, diag_log_tree, tree);
2968
0
        break;
2969
0
    case 0xb808:
2970
0
        dissect_qcdiag_log_nr_nas(tvb, offset, pinfo, diag_log_tree, tree);
2971
0
        break;
2972
0
    case 0xb809:
2973
0
        dissect_qcdiag_log_nr_nas(tvb, offset, pinfo, diag_log_tree, tree);
2974
0
        break;
2975
0
    case 0xb80a:
2976
0
        dissect_qcdiag_log_nr_nas(tvb, offset, pinfo, diag_log_tree, tree);
2977
0
        break;
2978
0
    case 0xb80b:
2979
0
        dissect_qcdiag_log_nr_nas(tvb, offset, pinfo, diag_log_tree, tree);
2980
0
        break;
2981
0
    case 0xb814:
2982
0
        dissect_qcdiag_log_nr_nas(tvb, offset, pinfo, diag_log_tree, tree);
2983
0
        break;
2984
0
    case 0xb821:
2985
0
        dissect_qcdiag_log_nr_rrc(tvb, offset, pinfo, diag_log_tree, tree);
2986
0
        break;
2987
2988
1
    default:
2989
1
        payload_tvb = tvb_new_subset_remaining(tvb, offset);
2990
1
        dissector_try_uint(qcdiag_log_code_dissector_table, code, payload_tvb, pinfo, diag_log_tree);
2991
1
        break;
2992
1
    }
2993
2994
1
    return tvb_captured_length(tvb);
2995
1
}
2996
2997
void
2998
proto_register_qcdiag_log(void)
2999
16
{
3000
16
    static hf_register_info hf[] = {
3001
16
        { &hf_qcdiag_log_ver,
3002
16
          { "Version", "qcdiag_log.ver",
3003
16
            FT_UINT8, BASE_CUSTOM, CF_FUNC(qcdiag_format_ver), 0, "Log Code Version", HFILL }},
3004
16
        { &hf_qcdiag_log_ver_4,
3005
16
          { "Version", "qcdiag_log.ver",
3006
16
            FT_UINT32, BASE_CUSTOM, CF_FUNC(qcdiag_format_ver), 0, "Log Code Version", HFILL }},
3007
16
        { &hf_qcdiag_log_len,
3008
16
          { "Log Message Length", "qcdiag_log.length",
3009
16
            FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0, NULL, HFILL } },
3010
16
        { &hf_qcdiag_log_more,
3011
16
          { "More log data available indicator", "qcdiag_log.more",
3012
16
            FT_UINT8, BASE_DEC, NULL, 0, "Indicates how many log entries (not including the one returned with this message) are queued", HFILL } },
3013
16
        { &hf_qcdiag_log_timestamp,
3014
16
          { "Timestamp", "qcdiag_log.ts",
3015
16
            FT_STRING, BASE_NONE, NULL, 0, "System Time Clock", HFILL }},
3016
16
        { &hf_qcdiag_arfcn,
3017
16
          { "ARFCN", "qcdiag_log.arfcn",
3018
16
            FT_UINT16, BASE_DEC, NULL, GSMTAP_ARFCN_MASK, NULL, HFILL } },
3019
16
        { &hf_qcdiag_uplink,
3020
16
          { "Uplink", "qcdiag_log.uplink",
3021
16
            FT_UINT16, BASE_DEC, NULL, GSMTAP_ARFCN_F_UPLINK, NULL, HFILL } },
3022
16
        { &hf_qcdiag_pcs,
3023
16
          { "PCS band indicator", "qcdiag_log.pcs_band",
3024
16
            FT_UINT16, BASE_DEC, NULL, GSMTAP_ARFCN_F_PCS, NULL, HFILL } },
3025
16
        { &hf_qcdiag_psc,
3026
16
          { "Primary Scrambling Code (PSC)", "qcdiag_log.psc",
3027
16
            FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL } },
3028
16
        { &hf_qcdiag_subtype_v1,
3029
16
          { "Subtype", "qcdiag_log.subtype",
3030
16
            FT_UINT16, BASE_DEC, VALS(umts_sib_types_v1), 0, NULL, HFILL } },
3031
16
        { &hf_qcdiag_subtype_v2,
3032
16
          { "Subtype", "qcdiag_log.subtype",
3033
16
            FT_UINT16, BASE_DEC, VALS(umts_sib_types_v2), 0, NULL, HFILL } },
3034
16
        { &hf_qcdiag_packet_ver,
3035
16
          { "Packet Version", "qcdiag_log.pkt_ver",
3036
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
3037
16
        { &hf_qcdiag_msg_len_1,
3038
16
          { "Message Length", "qcdiag_log.msg_len",
3039
16
            FT_UINT8, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0, NULL, HFILL } },
3040
16
        { &hf_qcdiag_msg_len_2,
3041
16
          {"Message Length", "qcdiag_log.msg_len",
3042
16
            FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0, NULL, HFILL } },
3043
3044
        /* GSM RR */
3045
16
        { &hf_qcdiag_rr_chan_type,
3046
16
          { "Channel Type", "qcdiag_log.rr.chan_type",
3047
16
            FT_UINT8, BASE_HEX, VALS(rr_chan_types), 0x7f, NULL, HFILL } },
3048
16
        { &hf_qcdiag_rr_direction,
3049
16
          { "Direction", "qcdiag_log.rr.direction",
3050
16
            FT_BOOLEAN, 8, TFS(&tfs_downlink_uplink), 0x80, NULL, HFILL } },
3051
16
        { &hf_qcdiag_rr_msg_type,
3052
16
          { "Message Type", "qcdiag_log.rr.msg_type",
3053
16
            FT_UINT8, BASE_HEX, VALS(gsm_a_dtap_msg_rr_strings), 0, NULL, HFILL } },
3054
3055
        /* GPRS MAC */
3056
16
        { &hf_qcdiag_mac_chan_type,
3057
16
          { "Channel Type", "qcdiag_log.gmac.chan_type",
3058
16
            FT_UINT8, BASE_HEX, VALS(mac_chan_types), 0, NULL, HFILL } },
3059
16
        { &hf_qcdiag_mac_direction,
3060
16
          { "Direction", "qcdiag_log.gmac.direction",
3061
16
            FT_BOOLEAN, 8, TFS(&tfs_downlink_uplink), 0x80, NULL, HFILL } },
3062
16
        { &hf_qcdiag_mac_msg_type,
3063
16
          { "Message Type", "qcdiag_log.gmac.msg_type",
3064
16
            FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL } },
3065
3066
        /* NAS (3G) */
3067
16
        { &hf_qcdiag_nas_direction,
3068
16
          { "Direction", "qcdiag_log.nas.direction",
3069
16
            FT_BOOLEAN, 8, TFS(&tfs_uplink_downlink), 0x01, NULL, HFILL } },
3070
16
        { &hf_qcdiag_nas_msg_length,
3071
16
          { "NAS Message Length", "qcdiag_log.nas.msg_len",
3072
16
            FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } },
3073
3074
        /* RRC (3G) */
3075
16
        { &hf_qcdiag_rrc_chan_type,
3076
16
          { "Channel Type", "qcdiag_log.rrc.chan_type",
3077
16
            FT_UINT8, BASE_DEC, VALS(rrc_sub_types), 0, NULL, HFILL } },
3078
16
        { &hf_qcdiag_rrc_chan_type_umts_v1,
3079
16
          { "Channel Type", "qcdiag_log.rrc.chan_type",
3080
16
            FT_UINT8, BASE_DEC, VALS(umts_v1_sub_types), 0, NULL, HFILL } },
3081
16
        { &hf_qcdiag_rrc_chan_type_umts_v2,
3082
16
          { "Channel Type", "qcdiag_log.rrc.chan_type",
3083
16
            FT_UINT8, BASE_DEC, VALS(umts_v2_sub_types), 0, NULL, HFILL } },
3084
16
        { &hf_qcdiag_rrc_rb_id,
3085
16
          {"Radio Bearer Id", "qcdiag_log.rrc.rb_id",
3086
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
3087
3088
        /* WCDMA */
3089
16
        { &hf_qcdiag_wcdma_cid_ul_uarfcn,
3090
16
          { "UL UTRA ARFCN", "qcdiag_log.wcdma_cid.ul_uarfcn",
3091
16
            FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } },
3092
16
        { &hf_qcdiag_wcdma_cid_dl_uarfcn,
3093
16
          { "DL UTRA ARFCN", "qcdiag_log.wcdma_cid.dl_uarfcn",
3094
16
            FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } },
3095
16
        { &hf_qcdiag_wcdma_cid_cell_id,
3096
16
          { "Cell Id", "qcdiag_log.wcdma_cid.cell_id",
3097
16
            FT_UINT32, BASE_DEC, NULL, QCDIAG_WCDMA_CID_MASK, NULL, HFILL } },
3098
16
        { &hf_qcdiag_wcdma_cid_ura_id,
3099
16
          { "UTRAN Registration Area (URA) Id", "qcdiag_log.wcdma_cid.ura_id",
3100
16
            FT_UINT16, BASE_DEC, NULL, 0, "URA to use in case of overlapping URAs", HFILL } },
3101
16
        { &hf_qcdiag_wcdma_cid_cell_barred,
3102
16
          { "Cell Barred", "qcdiag_log.wcdma_cid.cell_barred",
3103
16
            FT_BOOLEAN, 8, TFS(&tfs_not_barred_barred), 0x01, NULL, HFILL } },
3104
16
        { &hf_qcdiag_wcdma_cid_cell_reserved,
3105
16
          { "Cell Reserved", "qcdiag_log.wcdma_cid.cell_reserved",
3106
16
            FT_BOOLEAN, 8, TFS(&tfs_not_reserved_reserved), 0x02, NULL, HFILL } },
3107
16
        { &hf_qcdiag_wcdma_cid_cell_solsa,
3108
16
          { "Cell Reserved for SoLSA", "qcdiag_log.wcdma_cid.cell_solsa",
3109
16
            FT_BOOLEAN, 8, TFS(&tfs_not_reserved_reserved_solsa), 0x04, "Cell Reserved for Support of Localised Service Area (SoLSA)", HFILL } },
3110
16
        { &hf_qcdiag_wcdma_cid_ue_camped,
3111
16
          { "UE Camped on Cell", "qcdiag_log.wcdma_cid.ue_camped",
3112
16
            FT_BOOLEAN, 8, TFS(&tfs_not_camped_camped), 0x08, NULL, HFILL } },
3113
16
        { &hf_qcdiag_wcdma_cid_reserved,
3114
16
          { "Reserved", "qcdiag_log.wcdma_cid.res",
3115
16
            FT_UINT8, BASE_DEC, NULL, 0xf0, NULL, HFILL }},
3116
16
        { &hf_qcdiag_wcdma_cid_allowed_call_access,
3117
16
          { "Allowed Call Access", "qcdiag_log.wcdma_cid.allowed_call_access",
3118
16
            FT_UINT8, BASE_DEC, VALS(wcdma_cid_allowed_call_access_vals), 0, NULL, HFILL } },
3119
16
        { &hf_qcdiag_wcdma_cid_psc,
3120
16
          { "Primary Scrambling Code (PSC)", "qcdiag_log.wcdma_cid.psc",
3121
16
            FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL } },
3122
16
        { &hf_qcdiag_wcdma_cid_mcc,
3123
16
          { "Mobile Country Code (MCC)", "qcdiag_log.wcdma_cid.mcc",
3124
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } },
3125
16
        { &hf_qcdiag_wcdma_cid_mnc,
3126
16
          { "Mobile Network Code (MNC)", "qcdiag_log.wcdma_cid.mnc",
3127
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } },
3128
16
        { &hf_qcdiag_wcdma_cid_lac,
3129
16
          { "Location Area Code (LAC) Id", "qcdiag_log.wcdma_cid.lac",
3130
16
            FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } },
3131
16
        { &hf_qcdiag_wcdma_cid_rac,
3132
16
          { "Routing Area Code (RAC) Id", "qcdiag_log.wcdma_cid.rac",
3133
16
            FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } },
3134
16
        { &hf_qcdiag_wcdma_freq_scan_type,
3135
16
          { "Frequency Scan Type", "qcdiag_log.wcdma_freq_scan.type",
3136
16
            FT_UINT8, BASE_DEC, VALS(wcdma_freq_scan_type_vals), 0, NULL, HFILL } },
3137
16
        { &hf_qcdiag_wcdma_freq_scan_thres,
3138
16
          { "Frequency Scan Threshold", "qcdiag_log.wcdma_freq_scan.thres",
3139
16
            FT_INT16, BASE_DEC, NULL, 0, NULL, HFILL } },
3140
16
        { &hf_qcdiag_wcdma_freq_scan_num,
3141
16
          { "Number of ARFCN", "qcdiag_log.wcdma_freq_scan.num_freq",
3142
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
3143
16
        { &hf_qcdiag_wcdma_freq_scan_arfcn,
3144
16
          { "ARFCN", "qcdiag_log.wcdma_freq_scan.arfcn",
3145
16
            FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL } },
3146
16
        { &hf_qcdiag_wcdma_freq_scan_rssi_raw,
3147
16
          { "RSSI (raw)", "qcdiag_log.wcdma_freq_scan.rssi_raw",
3148
16
            FT_INT16, BASE_DEC, NULL, 0, "Received Signal Strength Indicator (raw)", HFILL } },
3149
16
        { &hf_qcdiag_wcdma_freq_scan_rssi_dbm,
3150
16
          { "RSSI (dBm)", "qcdiag_log.wcdma_freq_scan.rssi_dbm",
3151
16
            FT_INT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_dbm), 0, "Received Signal Strength Indicator (dBm)", HFILL } },
3152
16
        { &hf_qcdiag_wcdma_crr_ver,
3153
16
          { "Version", "qcdiag_log.ver",
3154
16
            FT_UINT8, BASE_CUSTOM, CF_FUNC(qcdiag_format_ver), 0xc0, "Log Code Version", HFILL }},
3155
16
        { &hf_qcdiag_wcdma_crr_num_3g,
3156
16
          { "Number of WCDMA Cells Searched", "qcdiag_log.wcdma_crr.num_3g",
3157
16
            FT_UINT8, BASE_DEC, NULL, 0x3f, NULL, HFILL }},
3158
16
        { &hf_qcdiag_wcdma_crr_reserved,
3159
16
          { "Reserved", "qcdiag_log.wcdma_crr.res",
3160
16
            FT_UINT8, BASE_DEC, NULL, 0xc0, NULL, HFILL }},
3161
16
        { &hf_qcdiag_wcdma_crr_num_2g,
3162
16
          { "Number of GSM Cells Searched", "qcdiag_log.wcdma_crr.num_2g",
3163
16
            FT_UINT8, BASE_DEC, NULL, 0x3f, NULL, HFILL }},
3164
16
        { &hf_qcdiag_wcdma_crr_uarfcn_3g,
3165
16
          { "RF Channel Frequency", "qcdiag_log.wcdma_crr.uarfcn_3g",
3166
16
            FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
3167
16
        { &hf_qcdiag_wcdma_crr_psc_3g,
3168
16
          { "Primary Scrambling Code (PSC)", "qcdiag_log.wcdma_crr.psc_3g",
3169
16
            FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL } },
3170
16
        { &hf_qcdiag_wcdma_crr_rscp_3g,
3171
16
          { "Received Signal Code Power (RSCP)", "qcdiag_log.wcdma_crr.rscp_3g",
3172
16
            FT_INT8, BASE_DEC, NULL, 0, NULL, HFILL } },
3173
16
        { &hf_qcdiag_wcdma_crr_rscp_rank_3g,
3174
16
          { "Cell Ranking RSCP", "qcdiag_log.wcdma_crr.rscp_rank_3g",
3175
16
            FT_INT16, BASE_DEC, NULL, 0, NULL, HFILL } },
3176
16
        { &hf_qcdiag_wcdma_crr_ecio_3g,
3177
16
          { "Energy Per Chip Over Interference (Ec/Io)", "qcdiag_log.wcdma_crr.ecio_3g",
3178
16
            FT_FLOAT, BASE_NONE, NULL, 0, NULL, HFILL } },
3179
16
        { &hf_qcdiag_wcdma_crr_ecio_rank_3g,
3180
16
          { "Cell Ranking Ec/Io", "qcdiag_log.wcdma_crr.ecio_rank_3g",
3181
16
            FT_INT16, BASE_DEC, NULL, 0, NULL, HFILL } },
3182
16
        { &hf_qcdiag_wcdma_crr_arfcn_2g,
3183
16
          { "RF Channel Frequency", "qcdiag_log.wcdma_crr.arfcn_2g",
3184
16
            FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
3185
16
        { &hf_qcdiag_wcdma_crr_rssi_2g,
3186
16
          { "Received Signal Strength Indicator (RSSI)", "qcdiag_log.wcdma_crr.rssi_2g",
3187
16
            FT_INT8, BASE_DEC, NULL, 0, NULL, HFILL } },
3188
16
        { &hf_qcdiag_wcdma_crr_rssi_rank_2g,
3189
16
          { "Cell Ranking RSSI", "qcdiag_log.wcdma_crr.rssi_rank_2g",
3190
16
            FT_INT16, BASE_DEC, NULL, 0, NULL, HFILL } },
3191
16
        { &hf_qcdiag_wcdma_crr_bsic_2g,
3192
16
          { "Base Station Identity Code (BSIC)", "qcdiag_log.wcdma_crr.bsic_2g",
3193
16
            FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL } },
3194
16
        { &hf_qcdiag_wcdma_crr_bsic_bcc,
3195
16
          { "Base Station Color Code (BCC)", "qcdiag_log.wcdma_crr.bsic_bcc",
3196
16
            FT_UINT8, BASE_DEC, NULL, 0x07, NULL, HFILL } },
3197
16
        { &hf_qcdiag_wcdma_crr_bsic_ncc,
3198
16
          { "Network Color Code (NCC)", "qcdiag_log.wcdma_crr.bsic_ncc",
3199
16
            FT_UINT8, BASE_DEC, NULL, 0x38, NULL, HFILL } },
3200
16
        { &hf_qcdiag_wcdma_crr_resel_status,
3201
16
          { "Reselection Status", "qcdiag_log.wcdma_crr.resel_status",
3202
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
3203
16
        { &hf_qcdiag_wcdma_crr_hcs_priority,
3204
16
          { "Hierarchical Cell Structure (HCS) Priority", "qcdiag_log.wcdma_crr.hcs_priority",
3205
16
            FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
3206
16
        { &hf_qcdiag_wcdma_crr_h_value,
3207
16
          { "H Value", "qcdiag_log.wcdma_crr.h_value",
3208
16
            FT_INT16, BASE_DEC, NULL, 0, NULL, HFILL }},
3209
16
        { &hf_qcdiag_wcdma_crr_hcs_cell_qualify,
3210
16
          { "Hierarchical Cell Structure (HCS) Cell Qualify", "qcdiag_log.wcdma_crr.hcs_cell_qualify",
3211
16
            FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01, NULL, HFILL }},
3212
3213
        /* WCDMA RLC */
3214
16
        { &hf_qcdiag_wcdma_rlc_num_ent,
3215
16
          { "Number of Entities", "qcdiag_log.wcdma_rlc.num_ent",
3216
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
3217
16
        { &hf_qcdiag_wcdma_rlc_num_pdu,
3218
16
          { "Number of PDUs", "qcdiag_log.wcdma_rlc.num_pdu",
3219
16
            FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
3220
16
        { &hf_qcdiag_wcdma_rlc_lcid,
3221
16
          { "Logical Channel Id", "qcdiag_log.wcdma_rlc.lcid",
3222
16
            FT_UINT8, BASE_DEC, NULL, 0, "RLC Logical channel Id (range 0 to 18)", HFILL }},
3223
16
        { &hf_qcdiag_wcdma_rlc_pdu_size,
3224
16
          { "PDU Size", "qcdiag_log.wcdma_rlc.pdu_size",
3225
16
            FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0, NULL, HFILL }},
3226
16
        { &hf_qcdiag_wcdma_rlc_pdu_size_bits,
3227
16
          { "PDU Size", "qcdiag_log.wcdma_rlc.pdu_size",
3228
16
            FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_bit_bits), 0, "PDU Size in Bits", HFILL }},
3229
16
        { &hf_qcdiag_wcdma_rlc_pdu_count,
3230
16
          { "PDU Count", "qcdiag_log.wcdma_rlc.pdu_count",
3231
16
            FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
3232
16
        { &hf_qcdiag_wcdma_rlc_ciph_key,
3233
16
          { "Ciphering Key", "qcdiag_log.wcdma_rlc.ciph_key",
3234
16
            FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
3235
16
        { &hf_qcdiag_wcdma_rlc_ciph_alg,
3236
16
          { "Ciphering Algorithm", "qcdiag_log.wcdma_rlc.ciph_alg",
3237
16
            FT_UINT8, BASE_DEC, VALS(wcdma_rlc_ciph_level_vals), 0, "Ultra Encryption Algorithm (UEA)", HFILL }},
3238
16
        { &hf_qcdiag_wcdma_rlc_ciph_msg,
3239
16
          { "Ciphered Message", "qcdiag_log.wcdma_rlc.ciph_msg",
3240
16
            FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
3241
16
        { &hf_qcdiag_wcdma_rlc_ciph_countc,
3242
16
          { "Count C", "qcdiag_log.wcdma_rlc.ciph_countc",
3243
16
            FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
3244
3245
        /* WCDMA RRC */
3246
16
        { &hf_qcdiag_wcdma_rrc_state,
3247
16
          { "RRC State", "qcdiag_log.wcdma_rrc.state",
3248
16
            FT_UINT8, BASE_DEC, VALS(wcdma_rrc_states_vals), 0, NULL, HFILL } },
3249
16
        { &hf_qcdiag_wcdma_rrc_procedure,
3250
16
          { "RRC Procedure", "qcdiag_log.wcdma_rrc.procedure",
3251
16
            FT_UINT8, BASE_DEC, VALS(umts_rrc_procedure_vals), 0, NULL, HFILL } },
3252
16
        { &hf_qcdiag_wcdma_rrc_failure_cause,
3253
16
          { "RRC Failure Cause", "qcdiag_log.wcdma_rrc.failure_cause",
3254
16
            FT_UINT8, BASE_DEC, VALS(umts_rrc_fail_cause_vals), 0, NULL, HFILL } },
3255
16
        { &hf_qcdiag_wcdma_rrc_prot_err_cause,
3256
16
          { "RRC Protocol Error Cause", "qcdiag_log.wcdma_rrc.prot_err_cause",
3257
16
            FT_UINT8, BASE_DEC, VALS(umts_rrc_prot_err_vals), 0, NULL, HFILL } },
3258
3259
        /* LTE RRC */
3260
16
        { &hf_qcdiag_lte_rrc_rel,
3261
16
          { "LTE RRC Release", "qcdiag_log.lte_rrc_rel",
3262
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } },
3263
16
        { &hf_qcdiag_lte_rrc_rb_id,
3264
16
          {"Radio Bearer Id", "qcdiag_log.lte_rrc.rb_id",
3265
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
3266
16
        { &hf_qcdiag_lte_rrc_pci,
3267
16
          {"Physical Cell Id", "qcdiag_log.lte_rrc.pci",
3268
16
            FT_UINT16, BASE_DEC, NULL, 0, "PCI", HFILL } },
3269
16
        { &hf_qcdiag_lte_rrc_earfcn_v2,
3270
16
          { "Frequency", "qcdiag_log.lte_rrc.earfcn",
3271
16
            FT_UINT16, BASE_DEC, NULL, 0, "EARFCN", HFILL } },
3272
16
        { &hf_qcdiag_lte_rrc_earfcn_v8,
3273
16
          { "Frequency", "qcdiag_log.lte_rrc.earfcn",
3274
16
            FT_UINT32, BASE_DEC, NULL, 0, "EARFCN", HFILL } },
3275
16
        { &hf_qcdiag_lte_rrc_sfn,
3276
16
          { "System Frame Number", "qcdiag_log.lte_rrc.sfn",
3277
16
            FT_UINT16, BASE_DEC, NULL, 0, "SFN", HFILL } },
3278
16
        { &hf_qcdiag_lte_rrc_pdu,
3279
16
          { "PDU Number", "qcdiag_log.lte_rrc.pdu",
3280
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
3281
16
        { &hf_qcdiag_lte_rrc_sib,
3282
16
          { "SIB Mask in SI", "qcdiag_log.lte_rrc.sib",
3283
16
            FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } },
3284
3285
        /* LTE NAS */
3286
16
        { &hf_qcdiag_lte_nas_rel,
3287
16
          { "Release Version", "qcdiag_log.lte_nas_rel",
3288
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } },
3289
3290
        /* NR RRC */
3291
16
        { &hf_qcdiag_nr_rrc_rel,
3292
16
          { "NR RRC Release", "qcdiag_log.nr_rrc_rel",
3293
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } },
3294
16
        { &hf_qcdiag_nr_rrc_rb_id,
3295
16
          {"Radio Bearer Id", "qcdiag_log.nr_rrc.rb_id",
3296
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
3297
16
        { &hf_qcdiag_nr_rrc_pci,
3298
16
          {"Physical Cell Id", "qcdiag_log.nr_rrc.pci",
3299
16
            FT_UINT16, BASE_DEC, NULL, 0, "PCI", HFILL } },
3300
16
        { &hf_qcdiag_nr_rrc_ncgi,
3301
16
          { "NR Cell Global Identifier", "qcdiag_log.nr_rrc.ncgi",
3302
16
            FT_UINT64, BASE_DEC, NULL, 0, "NCGI", HFILL } },
3303
16
        { &hf_qcdiag_nr_rrc_arfcn,
3304
16
          { "Frequency", "qcdiag_log.nr_rrc.arfcn",
3305
16
            FT_UINT32, BASE_DEC, NULL, 0, "ARFCN", HFILL } },
3306
16
        { &hf_qcdiag_nr_rrc_sfn_v9,
3307
16
          { "System Frame Number", "qcdiag_log.nr_rrc.sfn",
3308
16
            FT_UINT32, BASE_DEC, NULL, 0, "SFN", HFILL } },
3309
16
        { &hf_qcdiag_nr_rrc_sfn,
3310
16
          { "System Frame Number", "qcdiag_log.nr_rrc.sfn",
3311
16
            FT_UINT24, BASE_DEC, NULL, 0, "SFN", HFILL } },
3312
16
        { &hf_qcdiag_nr_rrc_pdu_v9,
3313
16
          { "PDU Number", "qcdiag_log.nr_rrc.pdu",
3314
16
            FT_UINT8, BASE_DEC, VALS(nr_rrc_pdu_type_v9_vals), 0, NULL, HFILL } },
3315
16
        { &hf_qcdiag_nr_rrc_pdu_v14,
3316
16
          { "PDU Number", "qcdiag_log.nr_rrc.pdu",
3317
16
            FT_UINT8, BASE_DEC, VALS(nr_rrc_pdu_type_v14_vals), 0, NULL, HFILL } },
3318
16
        { &hf_qcdiag_nr_rrc_pdu_v17,
3319
16
          { "PDU Number", "qcdiag_log.nr_rrc.pdu",
3320
16
            FT_UINT8, BASE_DEC, VALS(nr_rrc_pdu_type_v17_vals), 0, NULL, HFILL } },
3321
16
        { &hf_qcdiag_nr_rrc_pdu_v20,
3322
16
          { "PDU Number", "qcdiag_log.nr_rrc.pdu",
3323
16
            FT_UINT8, BASE_DEC, VALS(nr_rrc_pdu_type_v20_vals), 0, NULL, HFILL } },
3324
16
        { &hf_qcdiag_nr_rrc_pdu_v26,
3325
16
          { "PDU Number", "qcdiag_log.nr_rrc.pdu",
3326
16
            FT_UINT8, BASE_DEC, VALS(nr_rrc_pdu_type_v26_vals), 0, NULL, HFILL } },
3327
16
        { &hf_qcdiag_nr_rrc_pdu_v28,
3328
16
          { "PDU Number", "qcdiag_log.nr_rrc.pdu",
3329
16
            FT_UINT8, BASE_DEC, VALS(nr_rrc_pdu_type_v28_vals), 0, NULL, HFILL } },
3330
16
        { &hf_qcdiag_nr_rrc_sib,
3331
16
          { "SIB Mask in SI", "qcdiag_log.nr_rrc.sib",
3332
16
            FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } },
3333
16
        { &hf_qcdiag_nr_rrc_segment_id,
3334
16
          { "Segment Id", "qcdiag_log.nr_rrc.seg_id",
3335
16
            FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
3336
3337
        /* NR NAS */
3338
16
        { &hf_qcdiag_nr_nas_rel,
3339
16
          { "Release Version", "qcdiag_log.nr_nas_rel",
3340
16
            FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL } },
3341
16
    };
3342
3343
16
    int *ett[] = {
3344
16
        &ett_qcdiag_log,
3345
16
        &ett_qcdiag_log_wcdma_crr_wcmda,
3346
16
        &ett_qcdiag_log_wcdma_crr_gsm,
3347
16
        &ett_qcdiag_log_wcdma_cid_car,
3348
16
        &ett_qcdiag_log_wcdma_rlc_dl_am_sig,
3349
16
        &ett_qcdiag_log_wcdma_rlc_dl_am_ciph,
3350
16
        &ett_qcdiag_log_wcdma_rlc_ul_am_ciph,
3351
16
        &ett_qcdiag_log_wcdma_freq_scan
3352
16
    };
3353
3354
16
    static ei_register_info ei[] = {
3355
16
        { &ei_qcdiag_log_mcc_non_decimal, { "qcdiag_log.wcdma_cid.mcc.non_decimal", PI_MALFORMED, PI_WARN, "MCC contains non-decimal digits", EXPFILL }},
3356
16
        { &ei_qcdiag_log_mnc_non_decimal, { "qcdiag_log.wcdma_cid.mnc.non_decimal", PI_MALFORMED, PI_WARN, "MNC contains non-decimal digits", EXPFILL }},
3357
16
    };
3358
3359
16
    expert_module_t* expert_qcdiag_log;
3360
3361
16
    proto_qcdiag_log = proto_register_protocol("Qualcomm Diagnostic Log", "QCDIAG LOG", "qcdiag_log");
3362
16
    proto_register_field_array(proto_qcdiag_log, hf, array_length(hf));
3363
16
    proto_register_subtree_array(ett, array_length(ett));
3364
16
    expert_qcdiag_log = expert_register_protocol(proto_qcdiag_log);
3365
16
    expert_register_field_array(expert_qcdiag_log, ei, array_length(ei));
3366
3367
    /* Register dissector table(s) to do sub dissection of Log Codes */
3368
16
    qcdiag_log_code_dissector_table = register_dissector_table("qcdiag_log.code", "QCDIAG LOG code", proto_qcdiag_log, FT_UINT16, BASE_HEX);
3369
16
}
3370
3371
void
3372
proto_reg_handoff_qcdiag_log(void)
3373
16
{
3374
16
    dissector_handle_t qcdiag_log_handle;
3375
3376
16
    qcdiag_log_handle = create_dissector_handle(dissect_qcdiag_log, proto_qcdiag_log);
3377
16
    dissector_add_uint("qcdiag.cmd", DIAG_LOG_F, qcdiag_log_handle);
3378
3379
16
    data_handle = find_dissector("data");
3380
16
    text_lines_handle = find_dissector("data-text-lines");
3381
16
    udp_handle = find_dissector("udp");
3382
16
    gsmtap_handle = find_dissector("gsmtap");
3383
16
    nas5gs_handle = find_dissector("nas-5gs");
3384
3385
16
    nr_rrc_bcch_bch_handle          = find_dissector("nr-rrc.bcch.bch");
3386
16
    nr_rrc_bcch_dl_sch_handle       = find_dissector("nr-rrc.bcch.dl.sch");
3387
16
    nr_rrc_pcch_handle              = find_dissector("nr-rrc.pcch");
3388
16
    nr_rrc_ul_dcch_handle           = find_dissector("nr-rrc.ul.dcch");
3389
16
    nr_rrc_dl_dcch_handle           = find_dissector("nr-rrc.dl.dcch");
3390
16
    nr_rrc_ul_ccch_handle           = find_dissector("nr-rrc.ul.ccch");
3391
16
    nr_rrc_dl_ccch_handle           = find_dissector("nr-rrc.dl.ccch");
3392
16
    nr_rrc_ul_ccch1_handle          = find_dissector("nr-rrc.ul.ccch1");
3393
16
    nr_rrc_reconf_handle            = find_dissector("nr-rrc.rrc_reconf");
3394
16
    nr_rrc_reconf_compl_handle      = find_dissector("nr-rrc.rrc_reconf_compl");
3395
16
    nr_rrc_radiobearerconfig_handle = find_dissector("nr-rrc.radiobearerconfig");
3396
16
    nr_rrc_ue_mrdc_cap_handle       = find_dissector("nr-rrc.ue_mrdc_cap");
3397
16
    nr_rrc_ue_nr_cap_handle         = find_dissector("nr-rrc.ue_nr_cap");
3398
16
    nr_rrc_sib2_handle              = find_dissector("nr-rrc.sib2");
3399
16
    nr_rrc_sib3_handle              = find_dissector("nr-rrc.sib3");
3400
16
    nr_rrc_sib4_handle              = find_dissector("nr-rrc.sib4");
3401
16
    nr_rrc_sib5_handle              = find_dissector("nr-rrc.sib5");
3402
16
    nr_rrc_sib6_handle              = find_dissector("nr-rrc.sib6");
3403
16
    nr_rrc_sib7_handle              = find_dissector("nr-rrc.sib7");
3404
16
    nr_rrc_sib8_handle              = find_dissector("nr-rrc.sib8");
3405
16
    nr_rrc_sib9_handle              = find_dissector("nr-rrc.sib9");
3406
3407
16
    hdtbl_entry = find_heur_dissector_by_unique_short_name("rlc_udp");
3408
3409
16
    heur_rlc_udp_enabled = true; /* Set to TRUE by default */
3410
16
    if (hdtbl_entry)
3411
0
        heur_rlc_udp_enabled = hdtbl_entry->enabled;
3412
16
}
3413
3414
/*
3415
 * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
3416
 *
3417
 * Local variables:
3418
 * c-basic-offset: 4
3419
 * tab-width: 8
3420
 * indent-tabs-mode: nil
3421
 * End:
3422
 *
3423
 * vi: set shiftwidth=4 tabstop=8 expandtab:
3424
 * :indentSize=4:tabSize=8:noTabs=true:
3425
 */