Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-gmr1_rr.c
blobf3c833e4ffa0e5647ffa49f91fdecb8d516b229c
1 /* packet-gmr1_rr.c
3 * Routines for GMR-1 Radio Resource dissection in wireshark.
4 * Copyright (c) 2011 Sylvain Munaut <tnt@246tNt.com>
6 * References:
7 * [1] ETSI TS 101 376-4-8 V1.3.1 - GMR-1 04.008
8 * [2] ETSI TS 101 376-4-8 V2.2.1 - GMPRS-1 04.008
9 * [3] ETSI TS 101 376-4-8 V3.1.1 - GMR-1 3G 44.008
10 * [4] ETSI TS 100 940 V7.21.0 - GSM 04.08
11 * [5] ETSI TS 101 376-4-12 V3.2.1 - GMR-1 3G 44.060
12 * [6] ETSI TS 101 376-5-6 V1.3.1 - GMR-1 05.008
14 * Wireshark - Network traffic analyzer
15 * By Gerald Combs <gerald@wireshark.org>
16 * Copyright 1998 Gerald Combs
18 * SPDX-License-Identifier: GPL-2.0-or-later
21 #include "config.h"
23 #include <epan/packet.h>
24 #include <epan/expert.h>
25 #include <wsutil/array.h>
27 #include "packet-gmr1_common.h"
29 #include "packet-gmr1_rr.h"
31 void proto_register_gmr1_rr(void);
33 /* GMR-1 RR and CCCH proto */
34 static int proto_gmr1_rr;
35 static int proto_gmr1_ccch;
37 /* Fallback CCCH sub tree */
38 static int ett_msg_ccch;
40 static int ett_rr_pd;
42 static expert_field ei_gmr1_missing_mandatory_element;
45 /* ------------------------------------------------------------------------ */
46 /* RR Information Elements */
47 /* ------------------------------------------------------------------------ */
49 enum gmr1_ie_rr_idx {
50 GMR1_IE_RR_CHAN_DESC = 0, /* [1] 11.5.2.5 */
51 GMR1_IE_RR_CHAN_MODE, /* [1] 11.5.2.6 */
52 GMR1_IE_RR_CIPH_MODE_SETTING, /* [4] 10.5.2.9 */
53 GMR1_IE_RR_CIPH_RESP, /* [4] 10.5.2.10 */
54 GMR1_IE_RR_L2_PSEUDO_LEN, /* [1] 11.5.2.19 */
55 GMR1_IE_RR_PAGE_MODE, /* [1] 11.5.2.26 */
56 GMR1_IE_RR_REQ_REF, /* [1] 11.5.2.30 */
57 GMR1_IE_RR_CAUSE, /* [1] 11.5.2.31 */
58 GMR1_IE_RR_TIMING_OFS, /* [1] 11.5.2.40 */
59 GMR1_IE_RR_TMSI_PTMSI, /* [4] 10.5.2.42 */
60 GMR1_IE_RR_WAIT_IND, /* [4] 10.5.2.43 */
61 GMR1_IE_RR_MES_INFO_FLG, /* [1] 11.5.2.44 */
62 GMR1_IE_RR_FREQ_OFS, /* [1] 11.5.2.49 */
63 GMR1_IE_RR_PAGE_INFO, /* [1] 11.5.2.51 */
64 GMR1_IE_RR_POS_DISPLAY, /* [1] 11.5.2.52 */
65 GMR1_IE_RR_POS_UPD_INFO, /* [1] 11.5.2.54 */
66 GMR1_IE_RR_BCCH_CARRIER, /* [1] 11.5.2.55 */
67 GMR1_IE_RR_REJECT_CAUSE, /* [1] 11.5.2.56 */
68 GMR1_IE_RR_GPS_TIMESTAMP, /* [1] 11.5.2.57 */
69 GMR1_IE_RR_PWR_CTRL_PRM, /* [1] 11.5.2.60 */
70 GMR1_IE_RR_TMSI_AVAIL_MSK, /* [1] 11.5.2.62 */
71 GMR1_IE_RR_GPS_ALMANAC, /* [1] 11.5.2.63 */
72 GMR1_IE_RR_MSC_ID, /* [1] 11.5.2.100 */
73 GMR1_IE_RR_GPS_DISCR, /* [1] 11.5.2.101 */
74 GMR1_IE_RR_PKT_IMM_ASS_3_PRM, /* [3] 11.5.2.105 */
75 GMR1_IE_RR_PKT_FREQ_PRM, /* [3] 11.5.2.106 */
76 GMR1_IE_RR_PKT_IMM_ASS_2_PRM, /* [3] 11.5.2.107 */
77 GMR1_IE_RR_USF, /* [3] 11.5.2.110 */
78 GMR1_IE_RR_TIMING_ADV_IDX, /* [3] 10.1.18.3.4 */
79 GMR1_IE_RR_TLLI, /* [5] 12.16 */
80 GMR1_IE_RR_PKT_PWR_CTRL_PRM, /* [3] 10.1.18.3.3 */
81 GMR1_IE_RR_PERSISTENCE_LVL, /* [3] 10.1.18.4.2 */
82 NUM_GMR1_IE_RR /* Terminator */
85 static const value_string gmr1_ie_rr_strings[] = {
86 { GMR1_IE_RR_CHAN_DESC,
87 "Channel Description" }, /* [1] 11.5.2.5 */
88 { GMR1_IE_RR_CHAN_MODE,
89 "Channel Mode" }, /* [1] 11.5.2.6 */
90 { GMR1_IE_RR_CIPH_MODE_SETTING,
91 "Cipher Mode Setting" }, /* [4] 10.5.2.9 */
92 { GMR1_IE_RR_CIPH_RESP,
93 "Cipher Response" }, /* [4] 10.5.2.10 */
94 { GMR1_IE_RR_L2_PSEUDO_LEN,
95 "L2 Pseudo Length" }, /* [1] 11.5.2.19 */
96 { GMR1_IE_RR_PAGE_MODE,
97 "Page Mode" }, /* [1] 11.5.2.26 */
98 { GMR1_IE_RR_REQ_REF,
99 "Request Reference" }, /* [1] 11.5.2.30 */
100 { GMR1_IE_RR_CAUSE,
101 "RR Cause" }, /* [1] 11.5.2.31 */
102 { GMR1_IE_RR_TIMING_OFS,
103 "Timing Offset" }, /* [1] 11.5.2.40 */
104 { GMR1_IE_RR_TMSI_PTMSI,
105 "TMSI/P-TMSI" }, /* [4] 10.5.2.42 */
106 { GMR1_IE_RR_WAIT_IND,
107 "Wait Indication" }, /* [4] 10.5.2.43 */
108 { GMR1_IE_RR_MES_INFO_FLG,
109 "MES Information Flag" }, /* [1] 11.5.2.44 */
110 { GMR1_IE_RR_FREQ_OFS,
111 "Frequency Offset" }, /* [1] 11.5.2.49 */
112 { GMR1_IE_RR_PAGE_INFO,
113 "Paging Information" }, /* [1] 11.5.2.51 */
114 { GMR1_IE_RR_POS_DISPLAY,
115 "Position Display" }, /* [1] 11.5.2.52 */
116 { GMR1_IE_RR_POS_UPD_INFO,
117 "Position Update Information" }, /* [1] 11.5.2.54 */
118 { GMR1_IE_RR_BCCH_CARRIER,
119 "BCCH Carrier Specification"}, /* [1] 11.5.2.55 */
120 { GMR1_IE_RR_REJECT_CAUSE,
121 "Reject Cause" }, /* [1] 11.5.2.56 */
122 { GMR1_IE_RR_GPS_TIMESTAMP,
123 "GPS timestamp" }, /* [1] 11.5.2.57 */
124 { GMR1_IE_RR_PWR_CTRL_PRM,
125 "Power Control Params" }, /* [1] 11.5.2.60 */
126 { GMR1_IE_RR_TMSI_AVAIL_MSK,
127 "TMSI Availability Mask" }, /* [1] 11.5.2.62 */
128 { GMR1_IE_RR_GPS_ALMANAC,
129 "GPS Almanac Data" }, /* [1] 11.5.2.63 */
130 { GMR1_IE_RR_MSC_ID,
131 "MSC ID" }, /* [1] 11.5.2.100 */
132 { GMR1_IE_RR_GPS_DISCR,
133 "GPS Discriminator" }, /* [1] 11.5.2.101 */
134 { GMR1_IE_RR_PKT_IMM_ASS_3_PRM,
135 "Packet Imm. Ass. Type 3 Params" }, /* [3] 11.5.2.105 */
136 { GMR1_IE_RR_PKT_FREQ_PRM,
137 "Packet Frequency Parameters" }, /* [3] 11.5.2.106 */
138 { GMR1_IE_RR_PKT_IMM_ASS_2_PRM,
139 "Packet Imm. Ass. Type 2 Params" }, /* [3] 11.5.2.107 */
140 { GMR1_IE_RR_USF,
141 "USF" }, /* [3] 11.5.2.110 */
142 { GMR1_IE_RR_TIMING_ADV_IDX,
143 "Timing Advance Index" }, /* [3] 10.1.18.3.4 */
144 { GMR1_IE_RR_TLLI,
145 "TLLI" }, /* [5] 12.16 */
146 { GMR1_IE_RR_PKT_PWR_CTRL_PRM,
147 "Packet Power Control Params" }, /* [3] 10.1.18.3.3 */
148 { GMR1_IE_RR_PERSISTENCE_LVL,
149 "Persistence Level" }, /* [3] 10.1.18.4.2 */
150 { 0, NULL },
152 value_string_ext gmr1_ie_rr_strings_ext = VALUE_STRING_EXT_INIT(gmr1_ie_rr_strings);
154 int ett_gmr1_ie_rr[NUM_GMR1_IE_RR];
157 /* Fields */
158 static int hf_rr_msg_type;
159 static int hf_rr_chan_desc_kab_loc;
160 static int hf_rr_chan_desc_rx_tn;
161 static int hf_rr_chan_desc_arfcn;
162 static int hf_rr_chan_desc_tx_tn;
163 static int hf_rr_chan_desc_chan_type;
164 static int hf_rr_chan_mode;
165 static int hf_rr_ciph_mode_setting_sc;
166 static int hf_rr_ciph_mode_setting_algo;
167 static int hf_rr_ciph_resp_cr;
168 static int hf_rr_ciph_resp_spare;
169 static int hf_rr_l2_pseudo_len;
170 static int hf_rr_page_mode;
171 static int hf_rr_page_mode_spare;
172 static int hf_rr_req_ref_est_cause;
173 static int hf_rr_req_ref_ra;
174 static int hf_rr_req_ref_fn;
175 static int hf_rr_cause;
176 static int hf_rr_timing_ofs_ti;
177 static int hf_rr_timing_ofs_value;
178 static int hf_rr_tmsi_ptmsi;
179 static int hf_rr_wait_ind_timeout;
180 static int hf_rr_mif_mes1_ab;
181 static int hf_rr_mif_mes1_i;
182 static int hf_rr_mif_mes1_d;
183 static int hf_rr_mif_mes2;
184 static int hf_rr_mif_mes3;
185 static int hf_rr_mif_mes4;
186 static int hf_rr_mif_pv;
187 static int hf_rr_freq_ofs_fi;
188 static int hf_rr_freq_ofs_value;
189 static int hf_rr_freq_ofs_spare;
190 static int hf_rr_page_info_msc_id;
191 static int hf_rr_page_info_chan_needed;
192 static int hf_rr_pos_display_flag;
193 static int hf_rr_pos_display_text;
194 static int hf_rr_pos_upd_info_v;
195 static int hf_rr_pos_upd_info_dist;
196 static int hf_rr_pos_upd_info_time;
197 static int hf_rr_bcch_carrier_arfcn;
198 static int hf_rr_bcch_carrier_si;
199 static int hf_rr_bcch_carrier_ri;
200 static int hf_rr_bcch_carrier_spare;
201 static int hf_rr_reject_cause;
202 static int hf_rr_reject_cause_b;
203 static int hf_rr_gps_timestamp;
204 static int hf_rr_gps_power_control_params;
205 static int hf_rr_tmsi_avail_msk_tmsi[4];
206 static int hf_rr_gps_almanac_pn;
207 static int hf_rr_gps_almanac_wn;
208 static int hf_rr_gps_almanac_word;
209 static int hf_rr_gps_almanac_sfn;
210 static int hf_rr_gps_almanac_co;
211 static int hf_rr_gps_almanac_spare;
212 static int hf_rr_msc_id;
213 static int hf_rr_msc_id_spare;
214 static int hf_rr_gps_discr;
215 static int hf_rr_pkt_imm_ass_3_prm_rlc_mode;
216 static int hf_rr_pkt_imm_ass_3_prm_spare;
217 static int hf_rr_pkt_imm_ass_3_prm_dl_tfi;
218 static int hf_rr_pkt_imm_ass_3_prm_start_fn;
219 static int hf_rr_pkt_imm_ass_3_prm_mac_slot_alloc;
220 static int hf_rr_pkt_freq_prm_arfcn;
221 static int hf_rr_pkt_freq_prm_dl_freq_plan_id;
222 static int hf_rr_pkt_freq_prm_dl_bw;
223 static int hf_rr_pkt_freq_prm_ul_freq_dist;
224 static int hf_rr_pkt_freq_prm_ul_bw;
225 static int hf_rr_pkt_freq_prm_spare;
226 static int hf_rr_pkt_imm_ass_2_prm_ac_spare1;
227 static int hf_rr_pkt_imm_ass_2_prm_ac_final_alloc;
228 static int hf_rr_pkt_imm_ass_2_prm_ac_usf_granularity;
229 static int hf_rr_pkt_imm_ass_2_prm_ac_dl_ctl_mac_slot;
230 static int hf_rr_pkt_imm_ass_2_prm_ac_mac_mode;
231 static int hf_rr_pkt_imm_ass_2_prm_ac_start_fn;
232 static int hf_rr_pkt_imm_ass_2_prm_ac_rlc_dblk_gnt;
233 static int hf_rr_pkt_imm_ass_2_prm_ac_mcs;
234 static int hf_rr_pkt_imm_ass_2_prm_ac_tfi;
235 static int hf_rr_pkt_imm_ass_2_prm_ac_spare2;
236 static int hf_rr_pkt_imm_ass_2_prm_ac_mac_slot_alloc;
237 static int hf_rr_pkt_imm_ass_2_prm_d_chan_mcs_cmd;
238 static int hf_rr_pkt_imm_ass_2_prm_d_chan_mcs_cmd_pnb512;
239 static int hf_rr_pkt_imm_ass_2_prm_d_spare1;
240 static int hf_rr_pkt_imm_ass_2_prm_d_rlc_dblk_gnt;
241 static int hf_rr_pkt_imm_ass_2_prm_d_spare2;
242 static int hf_rr_pkt_imm_ass_2_prm_d_tfi;
243 static int hf_rr_pkt_imm_ass_2_prm_d_usf_granularity;
244 static int hf_rr_pkt_imm_ass_2_prm_d_mac_slot_alloc;
245 static int hf_rr_usf_value;
246 static int hf_rr_usf_spare;
247 static int hf_rr_timing_adv_idx_value;
248 static int hf_rr_timing_adv_idx_spare;
249 static int hf_rr_tlli;
250 static int hf_rr_pkt_pwr_ctrl_prm_par;
251 static int hf_rr_pkt_pwr_ctrl_prm_spare;
252 static int hf_rr_persistence_lvl[4];
253 static int hf_rr_protocol_discriminator;
254 static int hf_rr_message_elements;
256 /* Generic display vals/func */
257 static const value_string rr_gen_ie_presence_vals[] = {
258 { 0, "IE is absent" },
259 { 1, "IE is present" },
260 { 0, NULL }
263 static void
264 rr_gen_ie_seconds_fmt(char *s, uint32_t v)
266 snprintf(s, ITEM_LABEL_LENGTH, "%u seconds", v);
271 /* [1] 11.5.2.5 - Channel Description */
272 static const value_string rr_chan_desc_chan_type_vals[] = {
273 { 1, "TCH3 No offset" },
274 { 3, "TCH3 1/2 symbol offset" },
275 { 6, "TCH6 No offset" },
276 { 7, "TCH6 1/2 symbol offset" },
277 { 4, "TCH9 No offset" },
278 { 5, "TCH9 1/2 symbol offset" },
279 { 13, "Reserved for SDCCH frames xx00" },
280 { 14, "Reserved for SDCCH frames xx01" },
281 { 15, "Reserved for SDCCH frames xx10" },
282 { 16, "Reserved for SDCCH frames xx11" },
283 { 0, NULL }
286 GMR1_IE_FUNC(gmr1_ie_rr_chan_desc)
288 int bit_offset;
290 bit_offset = offset << 3;
292 /* KAB Location (6 bits)*/
293 proto_tree_add_bits_item(tree, hf_rr_chan_desc_kab_loc, tvb,
294 bit_offset, 6, ENC_BIG_ENDIAN);
295 bit_offset += 6;
297 /* RX Timeslot (5 bits) */
298 proto_tree_add_bits_item(tree, hf_rr_chan_desc_rx_tn, tvb,
299 bit_offset, 5, ENC_BIG_ENDIAN);
300 bit_offset += 5;
302 /* ARFCN (11 bits) */
303 proto_tree_add_bits_item(tree, hf_rr_chan_desc_arfcn, tvb,
304 bit_offset, 11, ENC_BIG_ENDIAN);
305 bit_offset += 11;
307 /* TX Timeslot (5 bits) */
308 proto_tree_add_bits_item(tree, hf_rr_chan_desc_tx_tn, tvb,
309 bit_offset, 5, ENC_BIG_ENDIAN);
310 bit_offset += 5;
312 /* Channel Type (5 bits) */
313 proto_tree_add_bits_item(tree, hf_rr_chan_desc_chan_type, tvb,
314 bit_offset, 5, ENC_BIG_ENDIAN);
315 /*bit_offset += 5;*/
317 return 4;
320 /* [1] 11.5.2.6 - Channel Mode */
321 static const value_string rr_chan_mode_vals[] = {
322 { 0x00, "Signalling only" },
323 { 0x01, "Speech" },
324 { 0x03, "Data, 12,0 kbit/s radio I/F rate" },
325 { 0x0b, "Data, 6,0 kbit/s radio I/F rate" },
326 { 0x13, "Data, 3,6 kbit/s radio I/F rate" },
327 { 0, NULL }
330 GMR1_IE_FUNC(gmr1_ie_rr_chan_mode)
332 /* Channel Mode */
333 proto_tree_add_item(tree, hf_rr_chan_mode, tvb, offset, 1, ENC_BIG_ENDIAN);
335 return 1;
338 /* [4] 10.5.2.9 - Cipher Mode Setting */
339 static const value_string rr_ciph_mode_setting_sc_vals[] = {
340 { 0, "No ciphering"},
341 { 1, "Start ciphering"},
342 { 0, NULL }
345 static const value_string rr_ciph_mode_setting_algo_vals[] = {
346 { 0, "A5/1" },
347 { 1, "A5/2" },
348 { 2, "A5/3" },
349 { 3, "A5/4" },
350 { 4, "A5/5" },
351 { 5, "A5/6" },
352 { 6, "A5/7" },
353 { 7, "Reserved" },
354 { 0, NULL }
357 GMR1_IE_FUNC(gmr1_ie_rr_ciph_mode_setting)
359 /* SC */
360 proto_tree_add_item(tree, hf_rr_ciph_mode_setting_sc, tvb, offset, 1, ENC_BIG_ENDIAN);
362 /* Algo */
363 proto_tree_add_item(tree, hf_rr_ciph_mode_setting_algo, tvb, offset, 1, ENC_BIG_ENDIAN);
365 return 1;
368 /* [4] 10.5.2.10 - Cipher Response */
369 static const value_string rr_ciph_resp_cr_vals[] = {
370 { 0, "IMEISV shall not be included"},
371 { 1, "IMEISV shall be included"},
372 { 0, NULL }
375 GMR1_IE_FUNC(gmr1_ie_rr_ciph_resp)
377 /* CR */
378 proto_tree_add_item(tree, hf_rr_ciph_resp_cr, tvb, offset, 1, ENC_BIG_ENDIAN);
380 /* Spare */
381 proto_tree_add_item(tree, hf_rr_ciph_resp_spare, tvb, offset, 1, ENC_BIG_ENDIAN);
383 return 1;
386 /* [1] 11.5.2.19 - L2 Pseudo Length */
387 GMR1_IE_FUNC(gmr1_ie_rr_l2_pseudo_len)
389 /* L2 Pseudo Length value */
390 proto_tree_add_item(tree, hf_rr_l2_pseudo_len, tvb, offset, 1, ENC_BIG_ENDIAN);
392 return 1;
395 /* [1] 11.5.2.26 - Page Mode */
396 static const value_string rr_page_mode_vals[] = {
397 { 0, "Normal Paging" },
398 { 1, "Reserved (Changed from Extended Paging in GSM)" },
399 { 2, "Paging Reorganization" },
400 { 3, "Same as before" },
401 { 0, NULL }
404 GMR1_IE_FUNC(gmr1_ie_rr_page_mode)
406 /* Page mode */
407 proto_tree_add_item(tree, hf_rr_page_mode, tvb, offset, 1, ENC_BIG_ENDIAN);
409 /* Spare */
410 proto_tree_add_item(tree, hf_rr_page_mode_spare, tvb, offset, 1, ENC_BIG_ENDIAN);
412 return 1;
415 /* [1] 11.5.2.30 - Request Reference */
416 static const value_string rr_req_ref_est_cause_vals[] = {
417 { 0, "MO call" },
418 { 1, "In response to paging/alerting" },
419 { 2, "Location update/IMSI detach" },
420 { 3, "Emergency call" },
421 { 4, "Supplementary/short message service" },
422 { 5, "Position verification" },
423 { 6, "Any other valid cause" },
424 { 7, "Reserved" },
425 { 0, NULL }
428 GMR1_IE_FUNC(gmr1_ie_rr_req_ref)
430 /* Establishment Cause + RA */
431 proto_tree_add_item(tree, hf_rr_req_ref_est_cause, tvb, offset, 1, ENC_BIG_ENDIAN);
432 proto_tree_add_item(tree, hf_rr_req_ref_ra, tvb, offset, 1, ENC_BIG_ENDIAN);
433 offset++;
435 /* Frame number % 256 */
436 proto_tree_add_item(tree, hf_rr_req_ref_fn, tvb, offset, 1, ENC_BIG_ENDIAN);
438 return 2;
441 /* [1] 11.5.2.31 - RR Cause */
442 static const value_string rr_cause_vals[] = {
443 { 0x00, "Normal event" },
444 { 0x01, "Abnormal release, unspecified" },
445 { 0x02, "Abnormal release, channel unacceptable" },
446 { 0x03, "Abnormal release, timer expired" },
447 { 0x04, "Abnormal release, no activity on the radio path" },
448 { 0x05, "Preemptive release" },
449 { 0x09, "Channel mode unacceptable" },
450 { 0x0a, "Frequency not implemented" },
451 { 0x0b, "Position unacceptable" },
452 { 0x41, "Call already cleared" },
453 { 0x5f, "Semantically incorrect message" },
454 { 0x60, "Invalid mandatory information" },
455 { 0x61, "Message type nonexistent or not implemented" },
456 { 0x62, "Message type not compatible with protocol state" },
457 { 0x6f, "Protocol error unspecified" },
458 { 0, NULL }
461 GMR1_IE_FUNC(gmr1_ie_rr_cause)
463 /* RR Cause */
464 proto_tree_add_item(tree, hf_rr_cause, tvb, offset, 1, ENC_BIG_ENDIAN);
466 return 1;
469 /* [1] 11.5.2.40 - Timing Offset */
470 static const value_string rr_timing_ofs_ti_vals[] = {
471 { 0, "The timing offset parameter in this IE to be ignored" },
472 { 1, "The timing offset parameter has a valid value" },
473 { 0, NULL }
476 static void
477 rr_timing_ofs_value_fmt(char *s, uint32_t v)
479 int32_t sv = (signed)v;
481 snprintf(s, ITEM_LABEL_LENGTH, "%.3f symbols ( ~ %.3f ms )",
482 sv / 40.0f, (sv / 40.0f) * (10.0f / 234.0f));
485 GMR1_IE_FUNC(gmr1_ie_rr_timing_ofs)
487 int bit_offset;
489 bit_offset = offset << 3;
491 /* TI */
492 proto_tree_add_bits_item(tree, hf_rr_timing_ofs_ti, tvb,
493 bit_offset, 1, ENC_BIG_ENDIAN);
494 bit_offset++;
496 /* Value */
497 proto_tree_add_bits_item(tree, hf_rr_timing_ofs_value, tvb,
498 bit_offset, 15, ENC_BIG_ENDIAN);
499 /*bit_offset += 15;*/
501 return 2;
504 /* [4] 10.5.2.42 - TMSI/P-TMSI */
505 GMR1_IE_FUNC(gmr1_ie_rr_tmsi_ptmsi)
507 /* TMSI/P-TMSI value as hex */
508 proto_tree_add_item(tree, hf_rr_tmsi_ptmsi, tvb, offset, 4, ENC_BIG_ENDIAN);
510 return 4;
513 /* [4] 10.5.2.43 - Wait Indication */
514 GMR1_IE_FUNC(gmr1_ie_rr_wait_ind)
516 /* Timeout value */
517 proto_tree_add_item(tree, hf_rr_wait_ind_timeout, tvb, offset, 1, ENC_BIG_ENDIAN);
519 return 1;
522 /* [1] 11.5.2.44 - MES Information Flag */
523 static const value_string rr_mif_mes1_ab_vals[] = {
524 { 0, "Chan. Assigned: MES1 registered at selected GS" },
525 { 1, "Chan. Assigned: MES1 requires registration at selected GS" },
526 { 2, "Chan. Assigned; MES 1 Extended Channel Req. Reqd" },
527 { 3, "Pause Timer Indication" },
528 { 0, NULL }
531 static const value_string rr_mif_mes234_vals[] = {
532 { 0, "MES doesn't exists" },
533 { 1, "Pause Timer Ind for this MES" },
534 { 0, NULL }
537 static const value_string rr_mif_pv_vals[] = {
538 { 0, "Position Verification not requested" },
539 { 1, "MES1 shall send a Channel Request for Position Verification following the completion of the upcoming call" },
540 { 0, NULL }
543 GMR1_IE_FUNC(gmr1_ie_rr_mes_info_flg)
545 proto_tree_add_item(tree, hf_rr_mif_mes1_ab,
546 tvb, offset, 1, ENC_BIG_ENDIAN);
548 proto_tree_add_item(tree, hf_rr_mif_mes1_i,
549 tvb, offset, 1, ENC_BIG_ENDIAN);
551 proto_tree_add_item(tree, hf_rr_mif_mes1_d,
552 tvb, offset, 1, ENC_BIG_ENDIAN);
554 proto_tree_add_item(tree, hf_rr_mif_mes2,
555 tvb, offset, 1, ENC_BIG_ENDIAN);
557 proto_tree_add_item(tree, hf_rr_mif_mes3,
558 tvb, offset, 1, ENC_BIG_ENDIAN);
560 proto_tree_add_item(tree, hf_rr_mif_mes4,
561 tvb, offset, 1, ENC_BIG_ENDIAN);
563 proto_tree_add_item(tree, hf_rr_mif_pv,
564 tvb, offset, 1, ENC_BIG_ENDIAN);
566 return 1;
569 /* [1] 11.5.2.49 - Frequency Offset */
570 static const value_string rr_freq_ofs_fi_vals[] = {
571 { 0, "The frequency offset parameter in this IE to be ignored" },
572 { 1, "The frequency offset parameter has a valid value" },
573 { 0, NULL }
576 static void
577 rr_freq_ofs_value_fmt(char *s, uint32_t v)
579 int32_t sv = (signed)v;
581 snprintf(s, ITEM_LABEL_LENGTH, "%d Hz", sv);
584 GMR1_IE_FUNC(gmr1_ie_rr_freq_ofs)
586 int bit_offset;
588 bit_offset = offset << 3;
590 /* FI */
591 proto_tree_add_bits_item(tree, hf_rr_freq_ofs_fi, tvb,
592 bit_offset, 1, ENC_BIG_ENDIAN);
593 bit_offset++;
595 /* Value */
596 proto_tree_add_bits_item(tree, hf_rr_freq_ofs_value, tvb,
597 bit_offset, 12, ENC_BIG_ENDIAN);
598 bit_offset += 12;
600 /* Spare */
601 proto_tree_add_bits_item(tree, hf_rr_freq_ofs_spare, tvb,
602 bit_offset, 3, ENC_BIG_ENDIAN);
603 /*bit_offset += 3;*/
605 return 2;
608 /* [1] 11.5.2.51 - Paging Information */
609 static const value_string rr_page_info_chan_needed_vals[] = {
610 { 0, "Any" },
611 { 1, "SDCCH" },
612 { 2, "TCH3" },
613 { 3, "PDCCH" },
614 { 0, NULL }
617 GMR1_IE_FUNC(gmr1_ie_rr_page_info)
619 /* MSC ID & Channel needed */
620 proto_tree_add_item(tree, hf_rr_page_info_msc_id,
621 tvb, offset, 1, ENC_BIG_ENDIAN);
622 proto_tree_add_item(tree, hf_rr_page_info_chan_needed,
623 tvb, offset, 1, ENC_BIG_ENDIAN);
625 return 1;
628 /* [1] 11.5.2.52 - Position Display */
629 static const value_string rr_pos_display_flag_vals[] = {
630 { 0, "Position not available" },
631 { 1, "No position display service" },
632 { 2, "Use default 7-bit alphabet (GSM 03.38)" },
633 { 0, NULL }
636 GMR1_IE_FUNC(gmr1_ie_rr_pos_display)
638 const unsigned char *txt_raw;
639 char *txt_packed, *txt_unpacked;
640 tvbuff_t *txt_packed_tvb;
641 int i;
643 /* Flag */
644 proto_tree_add_item(tree, hf_rr_pos_display_flag,
645 tvb, offset, 1, ENC_BIG_ENDIAN);
647 /* Get text in an aligned tvbuff */
648 /* Do not use tvb_new_octet_aligned(), GSM 7bit packing bit parsing
649 goes from LSB to MSB so a trick is applied here for the last byte */
650 txt_raw = tvb_get_ptr(tvb, offset, 11);
651 txt_packed = (char*)wmem_alloc(pinfo->pool, 11);
652 for (i=0; i<10; i++)
653 txt_packed[i] = (txt_raw[i] << 4) | (txt_raw[i+1] >> 4);
654 txt_packed[10] = txt_raw[10];
655 txt_packed_tvb = tvb_new_real_data(txt_packed, 11, 11);
657 /* Unpack text */
658 txt_unpacked = tvb_get_ts_23_038_7bits_string_packed(pinfo->pool, txt_packed_tvb, 0, 12);
659 tvb_free(txt_packed_tvb);
661 /* Display it */
662 proto_tree_add_string(tree, hf_rr_pos_display_text, tvb, offset, 11,
663 txt_unpacked);
665 return 11;
668 /* [1] 11.5.2.54 - Position Update Information */
669 static const value_string rr_pos_upd_info_v_vals[] = {
670 { 0, "Information in this IE is Invalid and should be ignored" },
671 { 1, "Information in this IE is Valid" },
672 { 0, NULL }
675 static void
676 rr_pos_upd_info_dist_fmt(char *s, uint32_t v)
678 snprintf(s, ITEM_LABEL_LENGTH, "%d km", v);
681 static void
682 rr_pos_upd_info_time_fmt(char *s, uint32_t v)
684 snprintf(s, ITEM_LABEL_LENGTH, "%d minutes", v);
687 GMR1_IE_FUNC(gmr1_ie_rr_pos_upd_info)
689 int curr_offset = offset;
691 /* Valid & GPS Update Distance */
692 proto_tree_add_item(tree, hf_rr_pos_upd_info_v,
693 tvb, curr_offset, 1, ENC_BIG_ENDIAN);
694 proto_tree_add_item(tree, hf_rr_pos_upd_info_dist,
695 tvb, curr_offset, 1, ENC_BIG_ENDIAN);
696 curr_offset++;
698 /* GPS Update Timer */
699 proto_tree_add_item(tree, hf_rr_pos_upd_info_time,
700 tvb, curr_offset, 1, ENC_BIG_ENDIAN);
701 curr_offset++;
703 return 2;
706 /* [1] 11.5.2.55 - BCCH Carrier */
707 static const value_string rr_bcch_carrier_si_vals[] = {
708 { 0, "BCCH carrier is on the same satellite" },
709 { 1, "BCCH carrier is on a different satellite" },
710 { 0, NULL }
713 static const value_string rr_bcch_carrier_ri_vals[] = {
714 { 0, "Spot beam reselection not needed; use the spot beam with given BCCH" },
715 { 1, "Spot beam reselection needed; use the BCCH for spot beam reselection" },
716 { 0, NULL }
719 GMR1_IE_FUNC(gmr1_ie_rr_bcch_carrier)
721 int bit_offset;
723 bit_offset = offset << 3;
725 /* ARFCN */
726 proto_tree_add_bits_item(tree, hf_rr_bcch_carrier_arfcn,
727 tvb, bit_offset, 11, ENC_BIG_ENDIAN);
728 bit_offset += 11;
730 /* Sat ind */
731 proto_tree_add_bits_item(tree, hf_rr_bcch_carrier_si,
732 tvb, bit_offset, 1, ENC_BIG_ENDIAN);
733 bit_offset++;
735 /* Resel ind */
736 proto_tree_add_bits_item(tree, hf_rr_bcch_carrier_ri,
737 tvb, bit_offset, 1, ENC_BIG_ENDIAN);
738 bit_offset++;
740 /* Spare */
741 proto_tree_add_bits_item(tree, hf_rr_bcch_carrier_spare,
742 tvb, bit_offset, 3, ENC_BIG_ENDIAN);
743 /*bit_offset += 3;*/
745 return 2;
748 /* [1] 11.5.2.56 - Reject Cause */
749 static const value_string rr_reject_cause_vals[] = {
750 { 0x00, "Lack of resources (default)" },
751 { 0x11, "Invalid position for selected LAI" },
752 { 0x12, "Invalid position for selected spot beam" },
753 { 0x13, "Invalid position" },
754 { 0x15, "Position too old" },
755 { 0x16, "Invalid position for service provider" },
756 { 0x17, "Redirect to new satellite" },
757 { 0x3f, "Reported position acceptable" },
758 { 0, NULL }
761 GMR1_IE_FUNC(gmr1_ie_rr_reject_cause)
763 /* Cause */
764 proto_tree_add_item(tree, hf_rr_reject_cause,
765 tvb, offset, 1, ENC_BIG_ENDIAN);
767 /* BCCH carrier */
768 proto_tree_add_item(tree, hf_rr_reject_cause_b,
769 tvb, offset, 1, ENC_BIG_ENDIAN);
771 return 1;
774 /* [1] 11.5.2.57 - GPS timestamp */
775 static void
776 rr_gps_timestamp_fmt(char *s, uint32_t v)
778 if (v == 0xffff)
779 snprintf(s, ITEM_LABEL_LENGTH, "> 65535 minutes or N/A");
780 else
781 snprintf(s, ITEM_LABEL_LENGTH, "%d minutes", v);
784 GMR1_IE_FUNC(gmr1_ie_rr_gps_timestamp)
786 /* GPS timestamp */
787 proto_tree_add_item(tree, hf_rr_gps_timestamp,
788 tvb, offset, 2, ENC_BIG_ENDIAN);
790 return 2;
793 /* [1] 11.5.2.60 - Power Control Params */
794 GMR1_IE_FUNC(gmr1_ie_rr_pwr_ctrl_prm)
796 /* It's CSN1 encoded and we have no real world sample. Until we do,
797 * we don't pollute the code with a bunch of untested stuff ... */
799 proto_tree_add_item(tree, hf_rr_gps_power_control_params, tvb, offset, 5, ENC_NA);
801 return 5;
804 /* [1] 11.5.2.62 - Availability Mask */
805 GMR1_IE_FUNC(gmr1_ie_rr_tmsi_avail_msk)
807 int i;
809 for (i=0; i<4; i++)
810 proto_tree_add_item(tree, hf_rr_tmsi_avail_msk_tmsi[i],
811 tvb, offset, 1, ENC_BIG_ENDIAN);
813 return 1;
816 /* [1] 11.5.2.63 - GPS Almanac Data */
817 static void
818 rr_gps_almanac_pn_fmt(char *s, uint32_t v)
820 snprintf(s, ITEM_LABEL_LENGTH, "%d", v+1);
823 static const value_string rr_gps_almanac_sfn_vals[] = {
824 { 0, "Frame 4" },
825 { 1, "Frame 5" },
826 { 0, NULL }
830 GMR1_IE_FUNC(gmr1_ie_rr_gps_almanac)
832 int curr_offset = offset;
834 /* Page Number & Word Number */
835 proto_tree_add_item(tree, hf_rr_gps_almanac_pn,
836 tvb, curr_offset, 1, ENC_BIG_ENDIAN);
837 proto_tree_add_item(tree, hf_rr_gps_almanac_wn,
838 tvb, curr_offset, 1, ENC_BIG_ENDIAN);
839 curr_offset++;
841 /* Almanac Data */
842 proto_tree_add_item(tree, hf_rr_gps_almanac_word,
843 tvb, curr_offset, 3, ENC_BIG_ENDIAN);
844 curr_offset += 3;
846 /* SubFrame Number & CO & Spare */
847 proto_tree_add_item(tree, hf_rr_gps_almanac_sfn,
848 tvb, curr_offset, 1, ENC_BIG_ENDIAN);
849 proto_tree_add_item(tree, hf_rr_gps_almanac_co,
850 tvb, curr_offset, 1, ENC_BIG_ENDIAN);
851 proto_tree_add_item(tree, hf_rr_gps_almanac_spare,
852 tvb, curr_offset, 1, ENC_BIG_ENDIAN);
853 curr_offset++;
855 return 5;
858 /* [1] 11.5.2.100 - MSC ID */
859 GMR1_IE_FUNC(gmr1_ie_rr_msc_id)
861 /* MSC ID */
862 proto_tree_add_item(tree, hf_rr_msc_id,
863 tvb, offset, 1, ENC_BIG_ENDIAN);
865 /* Spare bits */
866 proto_tree_add_item(tree, hf_rr_msc_id_spare,
867 tvb, offset, 1, ENC_BIG_ENDIAN);
869 return 1;
872 /* [1] 11.5.2.101 - GPS Discriminator */
873 GMR1_IE_FUNC(gmr1_ie_rr_gps_discr)
875 /* GPS Position CRC value */
876 proto_tree_add_item(tree, hf_rr_gps_discr, tvb, offset, 2, ENC_BIG_ENDIAN);
878 return 2;
881 /* [3] 11.5.2.105 - Packet Imm. Ass. Type 3 Params */
882 static const value_string rr_pkt_imm_ass_3_prm_rlc_mode_vals[] = {
883 { 0, "RLC acknowledged mode" },
884 { 1, "RLC unacknowledged mode" },
885 { 0, NULL }
888 static const crumb_spec_t rr_pkt_imm_ass_3_prm_dl_tfi_crumbs[] = {
889 { 0, 3 },
890 { 12, 4 },
891 { 0, 0 }
894 GMR1_IE_FUNC(gmr1_ie_rr_pkt_imm_ass_3_prm)
896 /* RLC Mode */
897 proto_tree_add_item(tree, hf_rr_pkt_imm_ass_3_prm_rlc_mode,
898 tvb, offset, 1, ENC_BIG_ENDIAN);
900 /* Spare */
901 proto_tree_add_item(tree, hf_rr_pkt_imm_ass_3_prm_spare,
902 tvb, offset, 1, ENC_BIG_ENDIAN);
904 /* Downlink Temporary Flow Identifier (TFI) */
905 proto_tree_add_split_bits_item_ret_val(
906 tree, hf_rr_pkt_imm_ass_3_prm_dl_tfi,
907 tvb, offset << 3,
908 rr_pkt_imm_ass_3_prm_dl_tfi_crumbs,
909 NULL);
911 /* Starting Frame Number */
912 proto_tree_add_item(tree, hf_rr_pkt_imm_ass_3_prm_start_fn,
913 tvb, offset+1, 1, ENC_BIG_ENDIAN);
915 /* MAC Slot allocation */
916 proto_tree_add_item(tree, hf_rr_pkt_imm_ass_3_prm_mac_slot_alloc,
917 tvb, offset+2, 1, ENC_BIG_ENDIAN);
919 return 3;
922 /* [3] 11.5.2.106 - Packet Frequency Parameters */
923 static const value_string rr_pkt_freq_prm_dl_freq_plan_id_vals[] = {
924 { 0, "S-Band" }, /* Pretty much a guess ... */
925 { 1, "L-Band" }, /* didn't find exact value in specs */
926 { 0, NULL }
929 static const crumb_spec_t rr_pkt_freq_prm_arfcn_crumbs[] = {
930 { 0, 8 },
931 { 13, 3 },
932 { 0, 0 }
935 static const crumb_spec_t rr_pkt_freq_prm_ul_freq_dist_crumbs[] = {
936 { 0, 1 },
937 { 12, 4 },
938 { 0, 0 }
941 static void
942 rr_pkt_freq_prm_xx_bw_fmt(char *s, uint32_t v)
944 snprintf(s, ITEM_LABEL_LENGTH, "%d * 31.25 kHz = %.2f kHz (%d)", v, 31.25f*v, v);
947 GMR1_IE_FUNC(gmr1_ie_rr_pkt_freq_prm)
949 /* ARFCN */
950 proto_tree_add_split_bits_item_ret_val(
951 tree, hf_rr_pkt_freq_prm_arfcn,
952 tvb, offset << 3,
953 rr_pkt_freq_prm_arfcn_crumbs,
954 NULL);
956 /* DL Freq plan ID */
957 proto_tree_add_item(tree, hf_rr_pkt_freq_prm_dl_freq_plan_id,
958 tvb, offset+1, 1, ENC_BIG_ENDIAN);
960 /* DL bandwidth */
961 proto_tree_add_item(tree, hf_rr_pkt_freq_prm_dl_bw,
962 tvb, offset+1, 1, ENC_BIG_ENDIAN);
964 /* UL Freq distance */
965 proto_tree_add_split_bits_item_ret_val(
966 tree, hf_rr_pkt_freq_prm_ul_freq_dist,
967 tvb, (offset+1) << 3,
968 rr_pkt_freq_prm_ul_freq_dist_crumbs,
969 NULL);
971 /* UL bandwidth */
972 proto_tree_add_item(tree, hf_rr_pkt_freq_prm_ul_bw,
973 tvb, offset+2, 1, ENC_BIG_ENDIAN);
975 /* Spare */
976 proto_tree_add_item(tree, hf_rr_pkt_freq_prm_spare,
977 tvb, offset+2, 1, ENC_BIG_ENDIAN);
979 return 3;
982 /* [3] 11.5.2.107 - Packet Imm. Ass. Type 2 Params */
983 static const value_string rr_pkt_imm_ass_2_prm_ac_mac_mode_vals[] = {
984 { 0, "Dynamic allocation" },
985 { 1, "Reserved" },
986 { 2, "Reserved" },
987 { 3, "Reserved" },
988 { 0, NULL }
991 static const crumb_spec_t rr_pkt_imm_ass_2_prm_ac_rlc_dblk_gnt_crumbs[] = {
992 { 0, 4 },
993 { 13, 3 },
994 { 0, 0 }
997 GMR1_IE_FUNC(gmr1_ie_rr_pkt_imm_ass_2_prm)
999 proto_tree *subtree_ac, *subtree_d;
1002 /* Terminal AC */
1003 /* ----------- */
1005 subtree_ac = proto_tree_add_subtree(tree, tvb, offset, 5,
1006 ett_gmr1_ie_rr[GMR1_IE_RR_PKT_IMM_ASS_2_PRM], NULL, "GMPRS Terminal type A or C");
1008 /* Spare */
1009 proto_tree_add_item(subtree_ac, hf_rr_pkt_imm_ass_2_prm_ac_spare1,
1010 tvb, offset, 1, ENC_BIG_ENDIAN);
1012 /* Final Allocation */
1013 proto_tree_add_item(subtree_ac, hf_rr_pkt_imm_ass_2_prm_ac_final_alloc,
1014 tvb, offset, 1, ENC_BIG_ENDIAN);
1016 /* USF Granularity */
1017 proto_tree_add_item(subtree_ac, hf_rr_pkt_imm_ass_2_prm_ac_usf_granularity,
1018 tvb, offset, 1, ENC_BIG_ENDIAN);
1020 /* Downlink Control MAC slot */
1021 proto_tree_add_item(subtree_ac, hf_rr_pkt_imm_ass_2_prm_ac_dl_ctl_mac_slot,
1022 tvb, offset, 1, ENC_BIG_ENDIAN);
1024 /* MAC Mode */
1025 proto_tree_add_item(subtree_ac, hf_rr_pkt_imm_ass_2_prm_ac_mac_mode,
1026 tvb, offset, 1, ENC_BIG_ENDIAN);
1028 /* Starting Frame Number */
1029 proto_tree_add_item(subtree_ac, hf_rr_pkt_imm_ass_2_prm_ac_start_fn,
1030 tvb, offset+1, 1, ENC_BIG_ENDIAN);
1032 /* RLC Data Blocks Granted */
1033 proto_tree_add_split_bits_item_ret_val(
1034 tree, hf_rr_pkt_imm_ass_2_prm_ac_rlc_dblk_gnt,
1035 tvb, (offset+1) << 3,
1036 rr_pkt_imm_ass_2_prm_ac_rlc_dblk_gnt_crumbs,
1037 NULL);
1039 /* MCS */
1040 proto_tree_add_item(subtree_ac, hf_rr_pkt_imm_ass_2_prm_ac_mcs,
1041 tvb, offset+2, 1, ENC_BIG_ENDIAN);
1043 /* TFI */
1044 proto_tree_add_item(subtree_ac, hf_rr_pkt_imm_ass_2_prm_ac_tfi,
1045 tvb, offset+3, 1, ENC_BIG_ENDIAN);
1047 /* Spare */
1048 proto_tree_add_item(subtree_ac, hf_rr_pkt_imm_ass_2_prm_ac_spare2,
1049 tvb, offset+3, 1, ENC_BIG_ENDIAN);
1051 /* MAC Slot allocation */
1052 proto_tree_add_item(subtree_ac, hf_rr_pkt_imm_ass_2_prm_ac_mac_slot_alloc,
1053 tvb, offset+4, 1, ENC_BIG_ENDIAN);
1055 /* Terminal D */
1056 /* ---------- */
1058 subtree_d = proto_tree_add_subtree(tree, tvb, offset, 5,
1059 ett_gmr1_ie_rr[GMR1_IE_RR_PKT_IMM_ASS_2_PRM], NULL, "GMPRS Terminal type D");
1061 /* Channel MCS command */
1062 proto_tree_add_item(subtree_d, hf_rr_pkt_imm_ass_2_prm_d_chan_mcs_cmd,
1063 tvb, offset, 1, ENC_BIG_ENDIAN);
1065 /* Channel MCS command PNB(5,12) */
1066 proto_tree_add_item(subtree_d, hf_rr_pkt_imm_ass_2_prm_d_chan_mcs_cmd_pnb512,
1067 tvb, offset, 1, ENC_BIG_ENDIAN);
1069 /* Spare */
1070 proto_tree_add_item(subtree_d, hf_rr_pkt_imm_ass_2_prm_d_spare1,
1071 tvb, offset+1, 1, ENC_BIG_ENDIAN);
1073 /* RLC Data Blocks Granted */
1074 proto_tree_add_item(subtree_d, hf_rr_pkt_imm_ass_2_prm_d_rlc_dblk_gnt,
1075 tvb, offset+2, 1, ENC_BIG_ENDIAN);
1077 /* Spare */
1078 proto_tree_add_item(subtree_d, hf_rr_pkt_imm_ass_2_prm_d_spare2,
1079 tvb, offset+2, 1, ENC_BIG_ENDIAN);
1081 /* TFI */
1082 proto_tree_add_item(subtree_d, hf_rr_pkt_imm_ass_2_prm_d_tfi,
1083 tvb, offset+3, 1, ENC_BIG_ENDIAN);
1085 /* USF Granularity */
1086 proto_tree_add_item(subtree_d, hf_rr_pkt_imm_ass_2_prm_d_usf_granularity,
1087 tvb, offset+3, 1, ENC_BIG_ENDIAN);
1089 /* MAC Slot allocation */
1090 proto_tree_add_item(subtree_d, hf_rr_pkt_imm_ass_2_prm_d_mac_slot_alloc,
1091 tvb, offset+4, 1, ENC_BIG_ENDIAN);
1094 return 5;
1097 /* [3] 11.5.2.110 - USF */
1098 GMR1_IE_FUNC(gmr1_ie_rr_usf)
1100 /* Spare */
1101 proto_tree_add_item(tree, hf_rr_usf_spare,
1102 tvb, offset, 3, ENC_BIG_ENDIAN);
1104 /* USF */
1105 proto_tree_add_item(tree, hf_rr_usf_value,
1106 tvb, offset+2, 1, ENC_BIG_ENDIAN);
1108 return 3;
1111 /* [3] 10.1.18.3.4 & [5] 12.29 - Timing Advance Index */
1112 GMR1_IE_FUNC(gmr1_ie_rr_timing_adv_idx)
1114 /* TAI */
1115 proto_tree_add_item(tree, hf_rr_timing_adv_idx_value,
1116 tvb, offset, 1, ENC_BIG_ENDIAN);
1118 /* Spare */
1119 proto_tree_add_item(tree, hf_rr_timing_adv_idx_spare,
1120 tvb, offset, 1, ENC_BIG_ENDIAN);
1122 return 1;
1125 /* [5] 12.16 - TLLI */
1126 GMR1_IE_FUNC(gmr1_ie_rr_tlli)
1128 /* TLLI value as hex */
1129 proto_tree_add_item(tree, hf_rr_tlli, tvb, offset, 4, ENC_BIG_ENDIAN);
1131 return 4;
1134 /* [3] 10.1.18.3.3 & [5] 10.4.10a & [6] 5.3.3 - Packet Power Control Params */
1135 static void
1136 rr_pkt_pwr_ctrl_prm_par_fmt(char *s, uint32_t v)
1138 if (v >= 61) {
1139 snprintf(s, ITEM_LABEL_LENGTH, "Escape %d (%d)", v-60, v);
1140 return;
1143 snprintf(s, ITEM_LABEL_LENGTH, "%.1f dB (%d)", v*0.4f, v);
1146 GMR1_IE_FUNC(gmr1_ie_rr_pkt_pwr_ctrl_prm)
1148 /* Power Attenuation Request (PAR) */
1149 proto_tree_add_item(tree, hf_rr_pkt_pwr_ctrl_prm_par,
1150 tvb, offset, 1, ENC_BIG_ENDIAN);
1152 /* Spare */
1153 proto_tree_add_item(tree, hf_rr_pkt_pwr_ctrl_prm_spare,
1154 tvb, offset, 1, ENC_BIG_ENDIAN);
1156 return 1;
1159 /* [3] 10.1.18.4.2 & [5] 12.14 - Persistence Level */
1160 GMR1_IE_FUNC(gmr1_ie_rr_persistence_lvl)
1162 int i;
1164 for (i=0; i<4; i++)
1165 proto_tree_add_item(tree, hf_rr_persistence_lvl[i],
1166 tvb, offset + (i>>1), 1, ENC_BIG_ENDIAN);
1168 return 2;
1172 elem_fcn gmr1_ie_rr_func[NUM_GMR1_IE_RR] = {
1173 gmr1_ie_rr_chan_desc, /* Channel Description */
1174 gmr1_ie_rr_chan_mode, /* Channel Mode */
1175 gmr1_ie_rr_ciph_mode_setting, /* Cipher Mode Setting */
1176 gmr1_ie_rr_ciph_resp, /* Cipher Response */
1177 gmr1_ie_rr_l2_pseudo_len, /* L2 Pseudo Length */
1178 gmr1_ie_rr_page_mode, /* Page Mode */
1179 gmr1_ie_rr_req_ref, /* Request Reference */
1180 gmr1_ie_rr_cause, /* RR Cause */
1181 gmr1_ie_rr_timing_ofs, /* Timing Offset */
1182 gmr1_ie_rr_tmsi_ptmsi, /* TMSI/P-TMSI */
1183 gmr1_ie_rr_wait_ind, /* Wait Indication */
1184 gmr1_ie_rr_mes_info_flg, /* MES Information Flag */
1185 gmr1_ie_rr_freq_ofs, /* Frequency Offset */
1186 gmr1_ie_rr_page_info, /* Paging Information */
1187 gmr1_ie_rr_pos_display, /* Position Display */
1188 gmr1_ie_rr_pos_upd_info, /* Position Update Information */
1189 gmr1_ie_rr_bcch_carrier, /* BCCH Carrier */
1190 gmr1_ie_rr_reject_cause, /* Reject Cause */
1191 gmr1_ie_rr_gps_timestamp, /* GPS timestamp */
1192 gmr1_ie_rr_pwr_ctrl_prm, /* Power Control Params */
1193 gmr1_ie_rr_tmsi_avail_msk, /* TMSI Availability Mask */
1194 gmr1_ie_rr_gps_almanac, /* GPS Almanac Data */
1195 gmr1_ie_rr_msc_id, /* MSC ID */
1196 gmr1_ie_rr_gps_discr, /* GPS Discriminator */
1197 gmr1_ie_rr_pkt_imm_ass_3_prm, /* Packet Imm. Ass. Type 3 Params */
1198 gmr1_ie_rr_pkt_freq_prm, /* Packet Frequency Parameters */
1199 gmr1_ie_rr_pkt_imm_ass_2_prm, /* Packet Imm. Ass. Type 2 Params */
1200 gmr1_ie_rr_usf, /* USF */
1201 gmr1_ie_rr_timing_adv_idx, /* Timing Advance Index */
1202 gmr1_ie_rr_tlli, /* TLLI */
1203 gmr1_ie_rr_pkt_pwr_ctrl_prm, /* Packet Power Control Params */
1204 gmr1_ie_rr_persistence_lvl, /* Persistence Level */
1208 /* ------------------------------------------------------------------------ */
1209 /* RR Messages */
1210 /* ------------------------------------------------------------------------ */
1212 /* [1] 10.1.18 - Immediate Assignment */
1213 GMR1_MSG_FUNC(gmr1_rr_msg_imm_ass)
1215 uint8_t mif;
1217 GMR1_MSG_FUNC_BEGIN
1219 /* MES Information Flag [1] 11.5.2.44 - M V 1 */
1220 mif = tvb_get_uint8(tvb, curr_offset);
1222 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_MES_INFO_FLG, NULL, ei_gmr1_missing_mandatory_element);
1224 /* Request Reference 1 (MES1) [1] 11.5.2.30 - M V 2 */
1225 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_REQ_REF, " - MES1", ei_gmr1_missing_mandatory_element);
1227 /* GPS Discriminator [1] 11.5.2.101 - C V 2 */
1228 if ((mif & 0x03) != 0x02) {
1229 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_GPS_DISCR, " - MES1", ei_gmr1_missing_mandatory_element);
1232 /* Channel Description [1] 11.5.2.5 - C V 4 */
1233 if ((mif & 0x03) != 0x03) {
1234 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_CHAN_DESC, " - MES1", ei_gmr1_missing_mandatory_element);
1237 /* Timing Offset [1] 11.5.2.40 - C V 2 */
1238 if ((mif & 0x03) != 0x03) {
1239 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_TIMING_OFS, " - MES1", ei_gmr1_missing_mandatory_element);
1242 /* Frequency Offset [1] 11.5.2.49 - C V 2 */
1243 if ((mif & 0x03) != 0x03) {
1244 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_FREQ_OFS, " - MES1", ei_gmr1_missing_mandatory_element);
1247 /* Idle Mode Pos. Upd. Info. [1] 11.5.2.54 - C V 2 */
1248 if (mif & 0x04) {
1249 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_POS_UPD_INFO, " - Idle Mode", ei_gmr1_missing_mandatory_element);
1252 /* Ded. Mode Pos. Upd. Info. [1] 11.5.2.54 - C V 2 */
1253 if (mif & 0x08) {
1254 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_POS_UPD_INFO, " - Dedicated Mode", ei_gmr1_missing_mandatory_element);
1257 /* Request Reference 2 (MES2) [1] 11.5.2.30 - C V 2 */
1258 if (mif & 0x10) {
1259 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_REQ_REF, " - MES2", ei_gmr1_missing_mandatory_element);
1262 /* Request Reference 3 (MES3) [1] 11.5.2.30 - C V 2 */
1263 if (mif & 0x20) {
1264 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_REQ_REF, " - MES3", ei_gmr1_missing_mandatory_element);
1267 /* Request Reference 4 (MES4) [1] 11.5.2.30 - C V 2 */
1268 if (mif & 0x40) {
1269 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_REQ_REF, " - MES4", ei_gmr1_missing_mandatory_element);
1272 /* IA Rest Octets [1] 11.5.2.16 - M V 0..18 */
1273 /* FIXME */
1275 GMR1_MSG_FUNC_END
1278 /* [1] 10.1.20.1 - Immediate Assignment Reject Type 1 */
1279 GMR1_MSG_FUNC(gmr1_rr_msg_imm_ass_rej_1)
1281 uint8_t rej_cause;
1283 GMR1_MSG_FUNC_BEGIN
1285 /* Request Reference 1 (MES1) [1] 11.5.2.30 - M V 2 */
1286 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_REQ_REF, " - MES1", ei_gmr1_missing_mandatory_element);
1288 /* GPS Discriminator [1] 11.5.2.101 - M V 2 */
1289 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_GPS_DISCR, NULL, ei_gmr1_missing_mandatory_element);
1291 /* Reject Cause [1] 11.5.2.56 - M V 1 */
1292 rej_cause = tvb_get_uint8(tvb, curr_offset);
1294 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_REJECT_CAUSE, NULL, ei_gmr1_missing_mandatory_element);
1296 /* Wait Indication 1 (MES1) [4] 10.5.2.43 - C V 1 */
1297 if ((rej_cause & 0xfc) == 0x00) {
1298 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_WAIT_IND, " - MES1", ei_gmr1_missing_mandatory_element);
1301 /* Request Reference 2 (MES2) [1] 11.5.2.30 - M V 2 */
1302 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_REQ_REF, " - MES2", ei_gmr1_missing_mandatory_element);
1304 /* Wait Indication 2 (MES2) [4] 10.5.2.43 - M V 1 */
1305 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_WAIT_IND, " - MES2", ei_gmr1_missing_mandatory_element);
1307 /* Request Reference 3 (MES3) [1] 11.5.2.30 - M V 2 */
1308 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_REQ_REF, " - MES3", ei_gmr1_missing_mandatory_element);
1310 /* Wait Indication 3 (MES3) [4] 10.5.2.43 - M V 1 */
1311 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_WAIT_IND, " - MES3", ei_gmr1_missing_mandatory_element);
1313 /* Request Reference 4 (MES4) [1] 11.5.2.30 - M V 2 */
1314 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_REQ_REF, " - MES4", ei_gmr1_missing_mandatory_element);
1316 /* Wait Indication 4 (MES4) [4] 10.5.2.43 - M V 1 */
1317 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_WAIT_IND, " - MES4", ei_gmr1_missing_mandatory_element);
1319 /* Idle Mode Position Update Info. [1] 11.5.2.54 - M V 2 */
1320 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_POS_UPD_INFO, " - Idle Mode", ei_gmr1_missing_mandatory_element);
1322 /* BCCH Carrier Specification [1] 11.5.2.55 - C V 2 */
1323 if (rej_cause & 1) {
1324 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_BCCH_CARRIER, NULL, ei_gmr1_missing_mandatory_element);
1327 /* MSC ID [1] 11.5.2.100 - C V 1 */
1328 if ((rej_cause & 0xfc) == 0x5c) {
1329 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_MSC_ID, NULL, ei_gmr1_missing_mandatory_element);
1332 /* IAR Rest Octets [1] 11.5.2.17 - M V 1..4 */
1333 /* FIXME */
1335 GMR1_MSG_FUNC_END
1338 /* [1] 10.1.20.4 - Position Verification Notify */
1339 GMR1_MSG_FUNC(gmr1_rr_msg_pos_verif_notify)
1341 GMR1_MSG_FUNC_BEGIN
1343 /* Request Reference [1] 11.5.2.30 - M V 2 */
1344 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_REQ_REF, NULL, ei_gmr1_missing_mandatory_element);
1346 /* GPS Discriminator [1] 11.5.2.101 - M V 2 */
1347 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_GPS_DISCR, NULL, ei_gmr1_missing_mandatory_element);
1349 /* Position Display [1] 11.5.2.52 - M V 11 */
1350 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_POS_DISPLAY, NULL, ei_gmr1_missing_mandatory_element);
1352 /* 78 Idle Mode Position Update Info. [1] 11.5.2.54 - O TV 3 */
1353 ELEM_OPT_TV(0x78, GMR1_IE_RR, GMR1_IE_RR_POS_UPD_INFO, NULL);
1355 /* IAR Rest Octets [1] 11.5.2.17 - M V 3..6 */
1356 /* FIXME */
1358 GMR1_MSG_FUNC_END
1361 /* [3] 10.1.18.3 - Immediate Assignment Type 2 */
1362 GMR1_MSG_FUNC(gmr1_rr_msg_imm_ass_2)
1364 GMR1_MSG_FUNC_BEGIN
1366 /* USF [3] 11.5.2.110 - M V 3 */
1367 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_USF, NULL, ei_gmr1_missing_mandatory_element);
1369 /* Timing Advance Index [3] 10.1.18.3.4 - M V 1 */
1370 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_TIMING_ADV_IDX, NULL, ei_gmr1_missing_mandatory_element);
1372 /* TLLI [5] 12.16 - M V 4 */
1373 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_TLLI, NULL, ei_gmr1_missing_mandatory_element);
1375 /* Timing Offset [1] 11.5.2.40 - M V 2 */
1376 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_TIMING_OFS, NULL, ei_gmr1_missing_mandatory_element);
1378 /* Frequency Offset [1] 11.5.2.49 - M V 2 */
1379 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_FREQ_OFS, NULL, ei_gmr1_missing_mandatory_element);
1381 /* Packet Imm. Ass. Type 2 Params. [3] 11.5.2.107 - M V 5 */
1382 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_PKT_IMM_ASS_2_PRM, NULL, ei_gmr1_missing_mandatory_element);
1384 /* Packet Frequency Parameters [3] 11.5.2.106 - M V 3 */
1385 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_PKT_FREQ_PRM, NULL, ei_gmr1_missing_mandatory_element);
1387 /* Packet Power Control Parameters [3] 10.1.18.3.3 - M V 1 */
1388 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_PKT_PWR_CTRL_PRM, NULL, ei_gmr1_missing_mandatory_element);
1390 GMR1_MSG_FUNC_END
1393 /* [3] 10.1.18.4 - Immediate Assignment Type 3 */
1394 GMR1_MSG_FUNC(gmr1_rr_msg_imm_ass_3)
1396 GMR1_MSG_FUNC_BEGIN
1398 /* Page Mode [1] 11.5.2.26 - M V 1/2 */
1399 /* Spare Half Octet [1] 11.5.1.8 - M V 1/2 */
1400 ELEM_MAND_VV_SHORT(GMR1_IE_RR, GMR1_IE_RR_PAGE_MODE,
1401 GMR1_IE_COMMON, GMR1_IE_COM_SPARE_NIBBLE, ei_gmr1_missing_mandatory_element);
1403 /* Persistence Level [3] 10.1.18.4.2 - M V 2 */
1404 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_PERSISTENCE_LVL, NULL, ei_gmr1_missing_mandatory_element);
1406 /* Timing Advance Index [3] 10.1.18.3.4 - M V 1 */
1407 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_TIMING_ADV_IDX, NULL, ei_gmr1_missing_mandatory_element);
1409 /* TLLI [5] 12.16 - M V 4 */
1410 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_TLLI, NULL, ei_gmr1_missing_mandatory_element);
1412 /* Packet Imm. Ass. Type 3 Params [3] 11.5.2.105 - M V 3 */
1413 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_PKT_IMM_ASS_3_PRM, NULL, ei_gmr1_missing_mandatory_element);
1415 /* Packet Frequency Parameters [3] 11.5.2.106 - M V 3 */
1416 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_PKT_FREQ_PRM, NULL, ei_gmr1_missing_mandatory_element);
1418 /* Packet Power Control Parameters [3] 10.1.18.3.3 - M V 1 */
1419 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_PKT_PWR_CTRL_PRM, NULL, ei_gmr1_missing_mandatory_element);
1421 /* P1 Rest Octets [1] 11.5.2.23 - M V 6 */
1422 /* FIXME */
1424 GMR1_MSG_FUNC_END
1427 /* [3] 10.1.9 - Ciphering Mode Command */
1428 GMR1_MSG_FUNC(gmr1_rr_msg_ciph_mode_cmd)
1430 GMR1_MSG_FUNC_BEGIN
1432 /* Cipher Mode Setting [4] 10.5.2.9 - M V 1/2 */
1433 /* Cipher Response [4] 10.5.2.10 - M V 1/2 */
1434 ELEM_MAND_VV_SHORT(GMR1_IE_RR, GMR1_IE_RR_CIPH_MODE_SETTING,
1435 GMR1_IE_RR, GMR1_IE_RR_CIPH_RESP, ei_gmr1_missing_mandatory_element);
1437 /* 75 Position Display [1] 11.5.2.52 - O TV 12 */
1438 ELEM_OPT_TV(0x75, GMR1_IE_RR, GMR1_IE_RR_POS_DISPLAY, NULL);
1440 GMR1_MSG_FUNC_END
1443 /* [1] 10.1.10 - Ciphering Mode Complete */
1444 GMR1_MSG_FUNC(gmr1_rr_msg_ciph_mode_complete)
1446 GMR1_MSG_FUNC_BEGIN
1448 /* 17 Mobile Identity [1] 11.5.1.4 - O TLV 3-11 */
1449 ELEM_OPT_TLV(0x17, GSM_A_PDU_TYPE_COMMON, DE_MID, NULL);
1451 /* 76 GPS Timestamp [1] 11.5.2.57 - O TV 3 */
1452 ELEM_OPT_TV(0x76, GMR1_IE_RR, GMR1_IE_RR_GPS_TIMESTAMP, NULL);
1454 GMR1_MSG_FUNC_END
1457 /* [1] 10.1.2.1 - Assignment Command 1 */
1458 GMR1_MSG_FUNC(gmr1_rr_msg_ass_cmd_1)
1460 GMR1_MSG_FUNC_BEGIN
1462 /* Channel Description [1] 11.5.2.5 - M V 4 */
1463 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_CHAN_DESC, NULL, ei_gmr1_missing_mandatory_element);
1465 /* 7D Timing Offset [1] 11.5.2.40 - O TV 3 */
1466 ELEM_OPT_TV(0x7D, GMR1_IE_RR, GMR1_IE_RR_TIMING_OFS, NULL);
1468 /* 7F Frequency Offset [1] 11.5.2.49 - O TV 3 */
1469 ELEM_OPT_TV(0x7F, GMR1_IE_RR, GMR1_IE_RR_FREQ_OFS, NULL);
1471 /* 63 Channel Mode [1] 11.5.2.6 - O TV 2 */
1472 ELEM_OPT_TV(0x63, GMR1_IE_RR, GMR1_IE_RR_CHAN_MODE, NULL);
1474 /* 71 Power Control Parameters [1] 11.5.2.60 - O TV 6 */
1475 ELEM_OPT_TV(0x71, GMR1_IE_RR, GMR1_IE_RR_PWR_CTRL_PRM, NULL);
1477 /* 9- Cipher Mode Setting [4] 10.5.2.9 - O TV 1 */
1478 ELEM_OPT_TV_SHORT(0x90, GMR1_IE_RR, GMR1_IE_RR_CIPH_MODE_SETTING, NULL);
1480 GMR1_MSG_FUNC_END
1483 /* [1] 10.1.7 - Channel Release */
1484 GMR1_MSG_FUNC(gmr1_rr_msg_chan_release)
1486 GMR1_MSG_FUNC_BEGIN
1488 /* RR Cause [1] 11.5.2.31 - M V 1 */
1489 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_CAUSE, NULL, ei_gmr1_missing_mandatory_element);
1491 GMR1_MSG_FUNC_END
1494 /* [1] 10.1.24 - Paging Request Type 3 */
1495 GMR1_MSG_FUNC(gmr1_rr_msg_pag_req_3)
1497 uint8_t tam;
1499 GMR1_MSG_FUNC_BEGIN
1501 /* Page Mode [1] 11.5.2.26 - M V 1/2 */
1502 /* TMSI Availability Mask [1] 11.5.2.62 - M V 1/2 */
1503 tam = (tvb_get_uint8(tvb, curr_offset) & 0xf0) >> 4;
1505 ELEM_MAND_VV_SHORT(GMR1_IE_RR, GMR1_IE_RR_PAGE_MODE,
1506 GMR1_IE_RR, GMR1_IE_RR_TMSI_AVAIL_MSK, ei_gmr1_missing_mandatory_element);
1508 /* Mobile Identity 1 (TMSI) [4] 10.5.2.42 - C V 4 */
1509 if (tam & 0x01) {
1510 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_TMSI_PTMSI, " - 1", ei_gmr1_missing_mandatory_element);
1513 /* GPS Almanac Data 1 [1] 11.5.2.63 - C V 5 */
1514 if (!(tam & 0x01)) {
1515 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_GPS_ALMANAC, " - 1", ei_gmr1_missing_mandatory_element);
1518 /* Mobile Identity 2 (TMSI) [4] 10.5.2.42 - C V 4 */
1519 if (tam & 0x02) {
1520 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_TMSI_PTMSI, " - 2", ei_gmr1_missing_mandatory_element);
1523 /* GPS Almanac Data 2 [1] 11.5.2.63 - C V 5 */
1524 if (!(tam & 0x02)) {
1525 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_GPS_ALMANAC, " - 2", ei_gmr1_missing_mandatory_element);
1528 /* Mobile Identity 3 (TMSI) [4] 10.5.2.42 - C V 4 */
1529 if (tam & 0x04) {
1530 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_TMSI_PTMSI, " - 3", ei_gmr1_missing_mandatory_element);
1533 /* GPS Almanac Data 3 [1] 11.5.2.63 - C V 5 */
1534 if (!(tam & 0x04)) {
1535 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_GPS_ALMANAC, " - 3", ei_gmr1_missing_mandatory_element);
1538 /* Mobile Identity 4 (TMSI) [4] 10.5.2.42 - C V 4 */
1539 if (tam & 0x08) {
1540 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_TMSI_PTMSI, " - 4", ei_gmr1_missing_mandatory_element);
1543 /* GPS Almanac Data 4 [1] 11.5.2.63 - C V 5 */
1544 if (!(tam & 0x08)) {
1545 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_GPS_ALMANAC, " - 4", ei_gmr1_missing_mandatory_element);
1548 /* Paging Information 1 [1] 11.5.2.51 - C V 1 */
1549 if (tam & 0x01) {
1550 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_PAGE_INFO, " - 1", ei_gmr1_missing_mandatory_element);
1553 /* Paging Information 2 [1] 11.5.2.51 - C V 1 */
1554 if (tam & 0x02) {
1555 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_PAGE_INFO, " - 2", ei_gmr1_missing_mandatory_element);
1558 /* Paging Information 3 [1] 11.5.2.51 - C V 1 */
1559 if (tam & 0x04) {
1560 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_PAGE_INFO, " - 3", ei_gmr1_missing_mandatory_element);
1563 /* Paging Information 4 [1] 11.5.2.51 - C V 1 */
1564 if (tam & 0x08) {
1565 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_PAGE_INFO, " - 4", ei_gmr1_missing_mandatory_element);
1568 GMR1_MSG_FUNC_END
1571 /* [1] 10.1.25 - Paging Response */
1572 GMR1_MSG_FUNC(gmr1_rr_msg_pag_resp)
1574 GMR1_MSG_FUNC_BEGIN
1576 /* Ciphering Key Sequence Number [4] 10.5.1.2 - M V 1/2 */
1577 /* Spare Half Octet [1] 11.5.1.8 - M V 1/2 */
1578 ELEM_MAND_VV_SHORT(GSM_A_PDU_TYPE_COMMON, DE_CIPH_KEY_SEQ_NUM,
1579 GMR1_IE_COMMON, GMR1_IE_COM_SPARE_NIBBLE, ei_gmr1_missing_mandatory_element);
1581 /* Mobile Earth Station Classmark 2 [1] 11.5.1.6 - M L V 4 */
1582 ELEM_MAND_LV(GMR1_IE_COMMON, GMR1_IE_COM_CM2, NULL, ei_gmr1_missing_mandatory_element);
1584 /* Mobile Identity [4] 10.5.1.4 - M L V 2-9 */
1585 ELEM_MAND_LV(GSM_A_PDU_TYPE_COMMON, DE_MID, NULL, ei_gmr1_missing_mandatory_element);
1587 GMR1_MSG_FUNC_END
1590 /* [1] 10.1.5 - Channel Mode Modify */
1591 GMR1_MSG_FUNC(gmr1_rr_msg_chan_mode_modify)
1593 GMR1_MSG_FUNC_BEGIN
1595 /* Channel Description [1] 11.5.2.5 - M V 4 */
1596 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_CHAN_DESC, NULL, ei_gmr1_missing_mandatory_element);
1598 /* Channel Mode [1] 11.5.2.6 - M V 1 */
1599 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_CHAN_MODE, NULL, ei_gmr1_missing_mandatory_element);
1601 GMR1_MSG_FUNC_END
1604 /* [1] 10.1.6 - Channel Mode Modify Acknowledge */
1605 GMR1_MSG_FUNC(gmr1_rr_msg_chan_mode_mod_ack)
1607 GMR1_MSG_FUNC_BEGIN
1609 /* Channel Description [1] 11.5.2.5 - M V 4 */
1610 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_CHAN_DESC, NULL, ei_gmr1_missing_mandatory_element);
1612 /* Channel Mode [1] 11.5.2.6 - M V 1 */
1613 ELEM_MAND_V(GMR1_IE_RR, GMR1_IE_RR_CHAN_MODE, NULL, ei_gmr1_missing_mandatory_element);
1615 GMR1_MSG_FUNC_END
1619 /* See [3] 11.4.1 - Table 11.1 */
1620 static const value_string gmr1_msg_rr_strings[] = {
1621 /* Channel establishment messages */
1622 { 0x3f, "Immediate Assignment" },
1623 { 0x3a, "Immediate Assignment Reject Type 1" },
1624 { 0x3b, "Immediate Assignment Reject Type 2" },
1626 * XXX - [3] 11.4.1 - Table 11.1 ([3] is ETSI TS 101 376-4-8
1627 * V3.1.1, which is GMR-1 3G 44.008) has 0x3e meaning both
1628 * "Extended Immediate Assignment" and "Immediate Assignment Type 2"
1629 * and has 0x3b meaning both "Immediate Asignment Reject Type 2"
1630 * and "Extended Imm. Assignment Reject".
1632 * [3] makes some references to [1] ([1] is ETSI TS 101 376-4-8
1633 * V1.3.1, which is GMR-1 04.008, not to be confused with GMR-1
1634 * 3G 44.008), saying some messages are the same as in GMR-1
1635 * 04.008. [1]:
1637 * says, in 10.1.18.2, that "Extended immediate assignment"
1638 * "is sent on the main signalling link by the network to
1639 * the MES in response to an EXTENDED CHANNEL REQUEST message
1640 * by the MES";
1642 * says, in 10.1.20.2, that "Immediate assignment reject type 2"
1643 * "may be sent to the MES by the network on the CCCH to indicate
1644 * that no channel is available for assignment or that the MES
1645 * cannot be allowed access";
1647 * says, in 10.1.20.3, that "Extended immediate assignment
1648 * reject" "message is sent by the network on the DCCH to
1649 * indicate that no channel is available for assignment or
1650 * that the MES cannot be allowed access";
1652 * does not mention "Immediate assignment type 2" anywhere
1653 * that I can see.
1655 * [3]:
1657 * says, in 10.1.18.2, that "Extended immediate assignment
1658 * (A/Gb mode only)" is "Same as clause 10.1.18.2 of
1659 * GMR-1 04.008";
1661 * says, in 10.1.18.3, that "Intermediate assignment Type
1662 * 2 (A/Gb mode only)" "is sent on the CCCH by the network
1663 * to the MES to change the channel configuration to a
1664 * dedicated configuration while staying in the same cell";
1666 * says, in 10.1.20.2, that "Immediate assignment reject
1667 * type 2" is "Same as clause 10.1.20.2 of GMR-1 04.008";
1669 * says, in 10.1.20.3, that "Extended immediate assignment
1670 * reject" is "Same as clause 10.1.20.3 of GMR-1 04.008".
1672 * This is currently handled by ORing 0x100 into the values
1673 * for the DCCH, and, in gmr1_get_msg_rr_params(), if the dcch
1674 * parameter is set (which it is if called from gmr1_get_msg_params()
1675 * in packet-gmr1_common.c), 0x100 is ORed into the value
1676 * passed to try_val_to_str_idx(). If that returns NULL, or
1677 * isn't called in the first placee, it calls try_val_to_str_idx()
1678 * without ORing in 0x100.
1680 * So that's why a 1-byte field has, in a value_string used with
1681 * it, two values that don't fit into 1 byte.
1683 * It Would Be Nice if this could be done in a somewhat less
1684 * hackish and opaque fashion.
1686 { 0x13e, "Extended Immediate Assignment" },
1687 { 0x13b, "Extended Imm. Assignment Reject" },
1688 { 0x39, "Position Verification Notify" },
1689 { 0x3c, "Immediate Assignment Reject Type 3" },
1690 { 0x3e, "Immediate Assignment Type 2" },
1691 { 0x3d, "Immediate Assignment Type 3" },
1693 /* Ciphering messages */
1694 { 0x35, "Ciphering Mode Command" },
1695 { 0x32, "Ciphering Mode Complete" },
1697 /* Channel assignment/handover messages */
1698 { 0x2e, "Assignment Command 1" },
1699 { 0x2a, "Assignment Command 2" },
1700 { 0x29, "Assignment Complete" },
1701 { 0x2f, "Assignment Failure" },
1702 { 0x2b, "Handover Command" },
1703 { 0x2c, "Handover Complete" },
1705 /* Channel release messages */
1706 { 0x0d, "Channel Release" },
1707 { 0x0e, "TtT Signalling Link Failure" },
1709 /* Paging messages */
1710 { 0x21, "Paging Request Type 1" },
1711 { 0x22, "Paging Request Type 2" },
1712 { 0x24, "Paging Request Type 3" },
1713 { 0x27, "Paging Response" },
1715 /* Miscellaneous messages */
1716 { 0x10, "Channel Mode Modify" },
1717 { 0x12, "RR Status" },
1718 { 0x17, "Channel Mode Modify Acknowledge" },
1719 { 0x16, "Classmark Change" },
1720 { 0x13, "Classmark Enquiry" },
1721 { 0x14, "Position Update Request" },
1722 { 0x15, "Position Update Accept" },
1723 { 0x11, "Link Correction Message" },
1725 { 0x01, "Power Control Parameters Update" },
1726 { 0x02, "Guard Time Violation" },
1727 { 0x04, "Extended Channel Request" },
1729 /* Status and Diagnostic Messages */
1730 { 0x40, "Information Request" },
1731 { 0x41, "Information Response Position" },
1732 { 0x42, "Information Response Version" },
1733 { 0x43, "Information Response Spot Beam Selection" },
1734 { 0x44, "Information Response Power Control" },
1735 { 0x45, "Information Response Vendor Specific" },
1736 { 0x46, "Information Response Current Beam" },
1737 { 0x4f, "Information Response Error" },
1739 /* End */
1740 { 0, NULL }
1744 #define NUM_GMR1_MSG_RR array_length(gmr1_msg_rr_strings)
1745 static int ett_msg_rr[NUM_GMR1_MSG_RR];
1747 /* same order as gmr1_msg_rr_strings */
1748 static const gmr1_msg_func_t gmr1_msg_rr_func[NUM_GMR1_MSG_RR] = {
1749 /* Channel establishment messages */
1750 gmr1_rr_msg_imm_ass, /* Imm. Ass.*/
1751 gmr1_rr_msg_imm_ass_rej_1, /* Imm. Ass. Reject Type 1 */
1752 NULL, /* Imm. Ass. Reject Type 2 */
1753 NULL, /* Extended Imm. Ass. */
1754 NULL, /* Extended Imm. Ass. Reject */
1755 gmr1_rr_msg_pos_verif_notify, /* Position Verification Notify */
1756 NULL, /* Imm. Ass. Reject Type 3 */
1757 gmr1_rr_msg_imm_ass_2, /* Imm. Ass. Type 2 */
1758 gmr1_rr_msg_imm_ass_3, /* Imm. Ass. Type 3 */
1760 /* Ciphering messages */
1761 gmr1_rr_msg_ciph_mode_cmd, /* Ciphering Mode Command */
1762 gmr1_rr_msg_ciph_mode_complete, /* Ciphering Mode Complete */
1764 /* Channel assignment/handover messages */
1765 gmr1_rr_msg_ass_cmd_1, /* Assignment Command 1 */
1766 NULL, /* Assignment Command 2 */
1767 NULL, /* Assignment Complete */
1768 NULL, /* Assignment Failure */
1769 NULL, /* Handover Command */
1770 NULL, /* Handover Complete */
1772 /* Channel release messages */
1773 gmr1_rr_msg_chan_release, /* Channel Release */
1774 NULL, /* TtT Signalling Link Failure */
1776 /* Paging messages */
1777 NULL, /* Paging Request Type 1 */
1778 NULL, /* Paging Request Type 2 */
1779 gmr1_rr_msg_pag_req_3, /* Paging Request Type 3 */
1780 gmr1_rr_msg_pag_resp, /* Paging Response */
1782 /* Miscellaneous messages */
1783 gmr1_rr_msg_chan_mode_modify, /* Channel Mode Modify */
1784 NULL, /* RR Status */
1785 gmr1_rr_msg_chan_mode_mod_ack, /* Channel Mode Modify Acknowledge */
1786 NULL, /* Classmark Change */
1787 NULL, /* Classmark Enquiry */
1788 NULL, /* Position Update Request */
1789 NULL, /* Position Update Accept */
1790 NULL, /* Link Correction Message */
1792 NULL, /* Power Control Parameters Update */
1793 NULL, /* Guard Time Violation */
1794 NULL, /* Extended Channel Request */
1796 /* Status and Diagnostic Messages */
1797 NULL, /* Info. Req. */
1798 NULL, /* Info. Resp. Position */
1799 NULL, /* Info. Resp. Version */
1800 NULL, /* Info. Resp. Spot Beam Selection */
1801 NULL, /* Info. Resp. Power Control */
1802 NULL, /* Info. Resp. Vendor Specific */
1803 NULL, /* Info. Resp. Current Beam */
1804 NULL, /* Info. Resp. Error */
1806 NULL,
1810 void
1811 gmr1_get_msg_rr_params(uint8_t oct, int dcch, const char **msg_str,
1812 int *ett_tree, int *hf_idx, gmr1_msg_func_t *msg_func_p)
1814 const char *m = NULL;
1815 int idx;
1818 * See the large comment in gmr1_msg_rr_strings[] for an
1819 * explanation of why we're doing this.
1821 if (dcch)
1822 m = try_val_to_str_idx((uint32_t)oct | 0x100, gmr1_msg_rr_strings, &idx);
1824 if (!m)
1825 m = try_val_to_str_idx((uint32_t)oct, gmr1_msg_rr_strings, &idx);
1827 *msg_str = m;
1828 *hf_idx = hf_rr_msg_type;
1829 if (m != NULL) {
1830 *ett_tree = ett_msg_rr[idx];
1831 *msg_func_p = gmr1_msg_rr_func[idx];
1832 } else {
1833 *ett_tree = -1;
1834 *msg_func_p = NULL;
1839 /* ------------------------------------------------------------------------ */
1840 /* Dissector code */
1841 /* ------------------------------------------------------------------------ */
1843 static int
1844 dissect_gmr1_ccch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
1846 uint32_t len, offset;
1847 gmr1_msg_func_t msg_func;
1848 const char *msg_str;
1849 int ett_tree;
1850 int hf_idx;
1851 proto_item *ccch_item = NULL, *pd_item = NULL;
1852 proto_tree *ccch_tree = NULL, *pd_tree = NULL;
1853 uint32_t oct[3];
1854 uint8_t pd;
1855 int ti = -1;
1857 /* Scan init */
1858 len = tvb_reported_length(tvb);
1859 offset = 0;
1861 /* Safety */
1862 if (len < 3) {
1863 /* Can't be a CCCH */
1864 goto err;
1867 col_append_str(pinfo->cinfo, COL_INFO, "(CCCH) ");
1869 /* First octet with pseudo len */
1870 oct[0] = tvb_get_uint8(tvb, offset++);
1872 /* Check protocol descriptor */
1873 oct[1] = tvb_get_uint8(tvb, offset++);
1875 if ((oct[1] & GMR1_PD_EXT_MSK) == GMR1_PD_EXT_VAL)
1876 pd = oct[1] & 0xff;
1877 else
1878 pd = oct[1] & 0x0f;
1880 col_append_fstr(pinfo->cinfo, COL_INFO, "(%s) ",
1881 val_to_str(pd, gmr1_pd_short_vals, "Unknown (%u)"));
1883 if (pd != GMR1_PD_RR)
1884 goto err; /* CCCH is only RR */
1886 /* Get message parameters */
1887 oct[2] = tvb_get_uint8(tvb, offset);
1889 gmr1_get_msg_rr_params(oct[2], 0, &msg_str, &ett_tree, &hf_idx, &msg_func);
1891 /* Create protocol tree */
1892 if (msg_str == NULL)
1894 ccch_item = proto_tree_add_protocol_format(
1895 tree, proto_gmr1_ccch, tvb, 0, len,
1896 "GMR-1 CCCH - Message Type (0x%02x)", oct[2]);
1897 ccch_tree = proto_item_add_subtree(ccch_item, ett_msg_ccch);
1899 col_append_fstr(pinfo->cinfo, COL_INFO, "Message Type (0x%02x) ", oct[2]);
1901 else
1903 ccch_item = proto_tree_add_protocol_format(
1904 tree, proto_gmr1_ccch, tvb, 0, -1,
1905 "GMR-1 CCCH - %s", msg_str);
1906 ccch_tree = proto_item_add_subtree(ccch_item, ett_tree);
1908 col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", msg_str);
1911 /* Start over */
1912 offset = 0;
1914 /* L2 Pseudo Length - [1] 11.5.2.19 */
1915 offset += elem_v(tvb, ccch_tree, pinfo, GMR1_IE_RR, GMR1_IE_RR_L2_PSEUDO_LEN, offset, NULL);
1917 /* Protocol discriminator item */
1918 pd_item = proto_tree_add_uint(
1919 ccch_tree, hf_rr_protocol_discriminator, tvb, 1, 1, pd);
1921 pd_tree = proto_item_add_subtree(pd_item, ett_rr_pd);
1923 /* Skip indicator / Transaction indicator */
1924 if (ti == -1) {
1925 proto_tree_add_item(pd_tree, hf_gmr1_skip_ind, tvb, 1, 1, ENC_BIG_ENDIAN);
1926 } else {
1927 /* FIXME !!! */
1930 /* Protocol discriminator value */
1931 proto_tree_add_item(pd_tree, hf_gmr1_l3_pd, tvb, 1, 1, ENC_BIG_ENDIAN);
1934 /* Move on */
1935 offset++;
1937 /* Message type - [1] 11.4 */
1938 proto_tree_add_uint_format(
1939 ccch_tree, hf_idx, tvb, offset, 1, oct[2],
1940 "Message Type: %s", msg_str ? msg_str : "(Unknown)"
1943 offset++;
1945 /* Decode elements */
1946 if (msg_func) {
1947 (*msg_func)(tvb, ccch_tree, pinfo, offset, len - offset);
1948 } else {
1949 proto_tree_add_item(ccch_tree, hf_rr_message_elements, tvb, offset, len - offset, ENC_NA);
1952 /* Error handling */
1953 err:
1954 call_data_dissector(tvb, pinfo, tree);
1955 return tvb_captured_length(tvb);
1958 void
1959 proto_register_gmr1_rr(void)
1961 static hf_register_info hf[] = {
1962 { &hf_rr_msg_type,
1963 { "Radio Resources Management Message Type", "gmr1.rr.msg_type",
1964 FT_UINT8, BASE_HEX, VALS(gmr1_msg_rr_strings), 0x00,
1965 NULL, HFILL } /* FIXME handle CCCH/DCCH conflicts */
1967 { &hf_rr_chan_desc_kab_loc,
1968 { "KAB Location", "gmr1.rr.chan_desc.kab_loc",
1969 FT_UINT8, BASE_DEC, NULL, 0x00,
1970 NULL, HFILL }
1972 { &hf_rr_chan_desc_rx_tn,
1973 { "RX Timeslot", "gmr1.rr.chan_desc.rx_tn",
1974 FT_UINT8, BASE_DEC, NULL, 0x00,
1975 NULL, HFILL }
1977 { &hf_rr_chan_desc_arfcn,
1978 { "ARFCN", "gmr1.rr.chan_desc.arfcn",
1979 FT_UINT16, BASE_DEC, NULL, 0x00,
1980 NULL, HFILL }
1982 { &hf_rr_chan_desc_tx_tn,
1983 { "TX Timeslot", "gmr1.rr.chan_desc.tx_tn",
1984 FT_UINT8, BASE_DEC, NULL, 0x00,
1985 NULL, HFILL }
1987 { &hf_rr_chan_desc_chan_type,
1988 { "Channel Type", "gmr1.rr.chan_desc.chan_type",
1989 FT_UINT8, BASE_DEC, VALS(rr_chan_desc_chan_type_vals), 0x00,
1990 NULL, HFILL }
1992 { &hf_rr_chan_mode,
1993 { "Channel Mode", "gmr1.rr.chan_mode",
1994 FT_UINT8, BASE_DEC, VALS(rr_chan_mode_vals), 0x00,
1995 NULL, HFILL }
1997 { &hf_rr_ciph_mode_setting_sc,
1998 { "SC", "gmr1.rr.ciph_mode_setting.sc",
1999 FT_UINT8, BASE_DEC, VALS(rr_ciph_mode_setting_sc_vals), 0x01,
2000 NULL, HFILL }
2002 { &hf_rr_ciph_mode_setting_algo,
2003 { "Algorithm", "gmr1.rr.ciph_mode_setting.algo",
2004 FT_UINT8, BASE_DEC, VALS(rr_ciph_mode_setting_algo_vals), 0x0e,
2005 NULL, HFILL }
2007 { &hf_rr_ciph_resp_cr,
2008 { "CR", "gmr1.rr.ciph_resp.cr",
2009 FT_UINT8, BASE_DEC, VALS(rr_ciph_resp_cr_vals), 0x10,
2010 NULL, HFILL }
2012 { &hf_rr_ciph_resp_spare,
2013 { "Spare", "gmr1.rr.ciph_resp.spare",
2014 FT_UINT8, BASE_DEC, NULL, 0xe0,
2015 NULL, HFILL }
2017 { &hf_rr_l2_pseudo_len,
2018 { "L2 Pseudo Length value", "gmr1.rr.l2_pseudo_len",
2019 FT_UINT8, BASE_DEC, NULL, 0xfc,
2020 NULL, HFILL }
2022 { &hf_rr_page_mode,
2023 { "Page Mode", "gmr1.rr.page_mode.mode",
2024 FT_UINT8, BASE_DEC, VALS(rr_page_mode_vals), 0x03,
2025 NULL, HFILL }
2027 { &hf_rr_page_mode_spare,
2028 { "Spare", "gmr1.rr.page_mode.spare",
2029 FT_UINT8, BASE_DEC, NULL, 0x0c,
2030 NULL, HFILL }
2032 { &hf_rr_req_ref_est_cause,
2033 { "Establishment cause group ID", "gmr1.rr.req_ref.est_cause",
2034 FT_UINT8, BASE_DEC, VALS(rr_req_ref_est_cause_vals), 0xe0,
2035 NULL, HFILL }
2037 { &hf_rr_req_ref_ra,
2038 { "Random Access Information", "gmr1.rr.req_ref.ra",
2039 FT_UINT8, BASE_HEX, NULL, 0x1f,
2040 NULL, HFILL }
2042 { &hf_rr_req_ref_fn,
2043 { "Frame Number mod 256", "gmr1.rr.req_ref.fn",
2044 FT_UINT8, BASE_DEC, NULL, 0x00,
2045 NULL, HFILL }
2047 { &hf_rr_cause,
2048 { "RR Cause", "gmr1.rr.cause",
2049 FT_UINT8, BASE_DEC, VALS(rr_cause_vals), 0x00,
2050 NULL, HFILL }
2052 { &hf_rr_timing_ofs_ti,
2053 { "TI", "gmr1.rr.timing_offset.ti",
2054 FT_UINT8, BASE_DEC, VALS(rr_timing_ofs_ti_vals), 0x00,
2055 NULL, HFILL }
2057 { &hf_rr_timing_ofs_value,
2058 { "Timing Offset value", "gmr1.rr.timing_offset.value",
2059 FT_INT16, BASE_CUSTOM, CF_FUNC(rr_timing_ofs_value_fmt), 0x00,
2060 NULL, HFILL }
2062 { &hf_rr_tmsi_ptmsi,
2063 { "TMSI/P-TMSI Value","gmr1.rr.tmsi_ptmsi",
2064 FT_UINT32,BASE_HEX, NULL, 0x00,
2065 NULL, HFILL }
2067 { &hf_rr_wait_ind_timeout,
2068 { "T3122/T3142 timeout", "gmr1.rr.wait_ind.timeout",
2069 FT_UINT8, BASE_CUSTOM, CF_FUNC(rr_gen_ie_seconds_fmt), 0x00,
2070 NULL, HFILL }
2072 { &hf_rr_mif_mes1_ab,
2073 { "MES1 - Assignment Type", "gmr1.rr.mes_info_flag.1.ab",
2074 FT_UINT8, BASE_DEC, VALS(rr_mif_mes1_ab_vals), 0x03,
2075 NULL, HFILL }
2077 { &hf_rr_mif_mes1_i,
2078 { "MES1 - Idle mode position update", "gmr1.rr.mes_info_flag.1.i",
2079 FT_UINT8, BASE_DEC, VALS(rr_gen_ie_presence_vals), 0x04,
2080 NULL, HFILL }
2082 { &hf_rr_mif_mes1_d,
2083 { "MES1 - Dedicated mode position update", "gmr1.rr.mes_info_flag.1.d",
2084 FT_UINT8, BASE_DEC, VALS(rr_gen_ie_presence_vals), 0x08,
2085 NULL, HFILL }
2087 { &hf_rr_mif_mes2,
2088 { "MES2", "gmr1.rr.mes_info_flag.2",
2089 FT_UINT8, BASE_DEC, VALS(rr_mif_mes234_vals), 0x10,
2090 NULL, HFILL }
2092 { &hf_rr_mif_mes3,
2093 { "MES3", "gmr1.rr.mes_info_flag.3",
2094 FT_UINT8, BASE_DEC, VALS(rr_mif_mes234_vals), 0x20,
2095 NULL, HFILL }
2097 { &hf_rr_mif_mes4,
2098 { "MES4", "gmr1.rr.mes_info_flag.4",
2099 FT_UINT8, BASE_DEC, VALS(rr_mif_mes234_vals), 0x40,
2100 NULL, HFILL }
2102 { &hf_rr_mif_pv,
2103 { "Position Verification indicator", "gmr1.rr.mes_info_flag.pv",
2104 FT_UINT8, BASE_DEC, VALS(rr_mif_pv_vals), 0x80,
2105 NULL, HFILL }
2107 { &hf_rr_freq_ofs_fi,
2108 { "FI", "gmr1.rr.frequency_offset.fi",
2109 FT_UINT8, BASE_DEC, VALS(rr_freq_ofs_fi_vals), 0x00,
2110 NULL, HFILL }
2112 { &hf_rr_freq_ofs_value,
2113 { "Frequency Offset value", "gmr1.rr.frequency_offset.value",
2114 FT_INT16, BASE_CUSTOM, CF_FUNC(rr_freq_ofs_value_fmt), 0x00,
2115 NULL, HFILL }
2117 { &hf_rr_freq_ofs_spare,
2118 { "Spare", "gmr1.rr.frequency_offset.spare",
2119 FT_UINT8, BASE_DEC, NULL, 0x00,
2120 NULL, HFILL }
2122 { &hf_rr_page_info_msc_id,
2123 { "MSC ID", "gmr1.rr.paging_info.msc_id",
2124 FT_UINT8, BASE_DEC, NULL, 0xfc,
2125 NULL, HFILL }
2127 { &hf_rr_page_info_chan_needed,
2128 { "Channel Needed", "gmr1.rr.paging_info.chan_needed",
2129 FT_UINT8, BASE_DEC, VALS(rr_page_info_chan_needed_vals), 0x03,
2130 NULL, HFILL }
2132 { &hf_rr_pos_display_flag,
2133 { "Display Information Flag", "gmr1.rr.pos_display.flag",
2134 FT_UINT8, BASE_DEC, VALS(rr_pos_display_flag_vals), 0xf0,
2135 NULL, HFILL }
2137 { &hf_rr_pos_display_text,
2138 { "Country and Region name", "gmr1.rr.pos_display.text",
2139 FT_STRING, BASE_NONE, NULL, 0x00,
2140 NULL, HFILL }
2142 { &hf_rr_pos_upd_info_v,
2143 { "Valid", "gmr1.rr.pos_upd_info.valid",
2144 FT_UINT8, BASE_DEC, VALS(rr_pos_upd_info_v_vals), 0x01,
2145 NULL, HFILL }
2147 { &hf_rr_pos_upd_info_dist,
2148 { "GPS Update Distance", "gmr1.rr.pos_upd_info.distance",
2149 FT_UINT8, BASE_CUSTOM, CF_FUNC(rr_pos_upd_info_dist_fmt), 0xfe,
2150 NULL, HFILL }
2152 { &hf_rr_pos_upd_info_time,
2153 { "GPS Update Timer", "gmr1.rr.pos_upd_info.time",
2154 FT_UINT8, BASE_CUSTOM, CF_FUNC(rr_pos_upd_info_time_fmt), 0xff,
2155 NULL, HFILL }
2157 { &hf_rr_bcch_carrier_arfcn,
2158 { "ARFCN", "gmr1.rr.bcch_carrier.arfcn",
2159 FT_UINT16, BASE_DEC, NULL, 0x00,
2160 NULL, HFILL }
2162 { &hf_rr_bcch_carrier_si,
2163 { "Satellite Indication", "gmr1.rr.bcch_carrier.si",
2164 FT_UINT8, BASE_DEC, VALS(rr_bcch_carrier_si_vals), 0x00,
2165 NULL, HFILL }
2167 { &hf_rr_bcch_carrier_ri,
2168 { "Reselection Indication", "gmr1.rr.bcch_carrier.ri",
2169 FT_UINT8, BASE_DEC, VALS(rr_bcch_carrier_ri_vals), 0x00,
2170 NULL, HFILL }
2172 { &hf_rr_bcch_carrier_spare,
2173 { "Spare", "gmr1.rr.bcch_carrier.spare",
2174 FT_UINT8, BASE_DEC, NULL, 0x00,
2175 NULL, HFILL }
2177 { &hf_rr_reject_cause,
2178 { "Cause", "gmr1.rr.reject_cause.cause",
2179 FT_UINT8, BASE_DEC, VALS(rr_reject_cause_vals), 0xfc,
2180 NULL, HFILL }
2182 { &hf_rr_reject_cause_b,
2183 { "BCCH Carrier IE presence", "gmr1.rr.reject_cause.b",
2184 FT_UINT8, BASE_DEC, VALS(rr_gen_ie_presence_vals), 0x01,
2185 NULL, HFILL }
2187 { &hf_rr_gps_timestamp,
2188 { "GPS timestamp", "gmr1.rr.gps_timestamp",
2189 FT_UINT16, BASE_CUSTOM, CF_FUNC(rr_gps_timestamp_fmt), 0xffff,
2190 NULL, HFILL }
2192 { &hf_rr_gps_power_control_params,
2193 { "Power Control Parameters", "gmr1.rr.power_control_params",
2194 FT_BYTES, BASE_NONE, NULL, 0x0,
2195 NULL, HFILL }
2197 { &hf_rr_tmsi_avail_msk_tmsi[0],
2198 { "TMSI 1 Presence", "gmr1.rr.tmsi_avail_msk.tmsi1",
2199 FT_UINT8, BASE_DEC, VALS(rr_gen_ie_presence_vals), 0x10,
2200 NULL, HFILL }
2202 { &hf_rr_tmsi_avail_msk_tmsi[1],
2203 { "TMSI 2 Presence", "gmr1.rr.tmsi_avail_msk.tmsi2",
2204 FT_UINT8, BASE_DEC, VALS(rr_gen_ie_presence_vals), 0x20,
2205 NULL, HFILL }
2207 { &hf_rr_tmsi_avail_msk_tmsi[2],
2208 { "TMSI 3 Presence", "gmr1.rr.tmsi_avail_msk.tmsi3",
2209 FT_UINT8, BASE_DEC, VALS(rr_gen_ie_presence_vals), 0x40,
2210 NULL, HFILL }
2212 { &hf_rr_tmsi_avail_msk_tmsi[3],
2213 { "TMSI 4 Presence", "gmr1.rr.tmsi_avail_msk.tmsi4",
2214 FT_UINT8, BASE_DEC, VALS(rr_gen_ie_presence_vals), 0x80,
2215 NULL, HFILL }
2217 { &hf_rr_gps_almanac_pn,
2218 { "Page Number", "gmr1.rr.gps_almanac.pn",
2219 FT_UINT8, BASE_CUSTOM, CF_FUNC(rr_gps_almanac_pn_fmt), 0xf8,
2220 "See ICD-GPS-200", HFILL }
2222 { &hf_rr_gps_almanac_wn,
2223 { "Word Number", "gmr1.rr.gps_almanac.wn",
2224 FT_UINT8, BASE_DEC, NULL, 0x07,
2225 "See ICD-GPS-200", HFILL }
2227 { &hf_rr_gps_almanac_word,
2228 { "GPS Almanac Word", "gmr1.rr.gps_almanac.word",
2229 FT_UINT24, BASE_HEX, NULL, 0x00,
2230 "See ICD-GPS-200", HFILL }
2232 { &hf_rr_gps_almanac_sfn,
2233 { "Sub Frame Number", "gmr1.rr.gps_almanac.sfn",
2234 FT_UINT8, BASE_DEC, VALS(rr_gps_almanac_sfn_vals), 0x80,
2235 "See ICD-GPS-200", HFILL }
2237 { &hf_rr_gps_almanac_co,
2238 { "CO", "gmr1.rr.gps_almanac.co",
2239 FT_UINT8, BASE_DEC, NULL, 0x40,
2240 NULL, HFILL }
2242 { &hf_rr_gps_almanac_spare,
2243 { "Spare", "gmr1.rr.gps_almanac.spare",
2244 FT_UINT8, BASE_DEC, NULL, 0x3f,
2245 NULL, HFILL }
2247 { &hf_rr_msc_id,
2248 { "MSC ID", "gmr1.rr.msc_id",
2249 FT_UINT8, BASE_DEC, NULL, 0xfc,
2250 NULL, HFILL }
2252 { &hf_rr_msc_id_spare,
2253 { "Spare", "gmr1.rr.msc_id.spare",
2254 FT_UINT8, BASE_DEC, NULL, 0x03,
2255 NULL, HFILL }
2257 { &hf_rr_gps_discr,
2258 { "GPS Position field CRC-16", "gmr1.rr.gps_discriminator",
2259 FT_UINT16, BASE_HEX, NULL, 0x00,
2260 NULL, HFILL }
2262 { &hf_rr_pkt_imm_ass_3_prm_rlc_mode,
2263 { "RLC Mode", "gmr1.rr.pkt_imm_ass_3_prm",
2264 FT_UINT8, BASE_DEC, VALS(rr_pkt_imm_ass_3_prm_rlc_mode_vals), 0x01,
2265 NULL, HFILL }
2267 { &hf_rr_pkt_imm_ass_3_prm_spare,
2268 { "Spare", "gmr1.rr.pkt_imm_ass_3_prm.spare",
2269 FT_UINT8, BASE_DEC, NULL, 0x1e,
2270 NULL, HFILL }
2272 { &hf_rr_pkt_imm_ass_3_prm_dl_tfi,
2273 { "Downlink TFI", "gmr1.rr.pkt_imm_ass_3_prm.tfi",
2274 FT_UINT8, BASE_HEX, NULL, 0x00,
2275 "Temporary Flow Identifier", HFILL }
2277 { &hf_rr_pkt_imm_ass_3_prm_start_fn,
2278 { "Start Framenumber", "gmr1.rr.pkt_imm_ass_3_prm.start_fn",
2279 FT_UINT8, BASE_DEC, NULL, 0xf0,
2280 NULL, HFILL }
2282 { &hf_rr_pkt_imm_ass_3_prm_mac_slot_alloc,
2283 { "MAC-slot Allocation", "gmr1.rr.pkt_imm_ass_3_prm.mac_slot_alloc",
2284 FT_UINT8, BASE_HEX, NULL, 0xff,
2285 "LSB=slot 0, MSB=slot 7", HFILL }
2287 { &hf_rr_pkt_freq_prm_arfcn,
2288 { "ARFCN", "gmr1.rr.pkt_freq_prm.arfcn",
2289 FT_UINT16, BASE_DEC, NULL, 0x00,
2290 NULL, HFILL }
2292 { &hf_rr_pkt_freq_prm_dl_freq_plan_id,
2293 { "Downlink Freq. Plan ID", "gmr1.rr.pkt_freq_prm.dl_freq_plan_id",
2294 FT_UINT8, BASE_DEC, VALS(rr_pkt_freq_prm_dl_freq_plan_id_vals), 0x08,
2295 NULL, HFILL }
2297 { &hf_rr_pkt_freq_prm_dl_bw,
2298 { "Downlink Bandwidth", "gmr1.rr.pkt_freq_prm.dl_bw",
2299 FT_UINT8, BASE_CUSTOM, CF_FUNC(rr_pkt_freq_prm_xx_bw_fmt), 0x70,
2300 NULL, HFILL }
2302 { &hf_rr_pkt_freq_prm_ul_freq_dist,
2303 { "Uplink Freq. Distance", "gmr1.rr.pkt_freq_prm.ul_freq_dist",
2304 FT_INT8, BASE_DEC, NULL, 0x00,
2305 NULL, HFILL }
2307 { &hf_rr_pkt_freq_prm_ul_bw,
2308 { "Uplink Bandwidth", "gmr1.rr.pkt_freq_prm.ul_bw",
2309 FT_UINT8, BASE_CUSTOM, CF_FUNC(rr_pkt_freq_prm_xx_bw_fmt), 0x70,
2310 NULL, HFILL }
2312 { &hf_rr_pkt_freq_prm_spare,
2313 { "Spare", "gmr1.rr.pkt_freq_prm.spare",
2314 FT_UINT8, BASE_DEC, NULL, 0x80,
2315 NULL, HFILL }
2317 { &hf_rr_pkt_imm_ass_2_prm_ac_spare1,
2318 { "Spare", "gmr1.rr.pkt_imm_ass_2_prm.ac.spare1",
2319 FT_UINT8, BASE_DEC, NULL, 0x01,
2320 NULL, HFILL }
2322 { &hf_rr_pkt_imm_ass_2_prm_ac_final_alloc,
2323 { "Final Allocation", "gmr1.rr.pkt_imm_ass_2_prm.ac.final_alloc",
2324 FT_UINT8, BASE_DEC, NULL, 0x02,
2325 NULL, HFILL }
2327 { &hf_rr_pkt_imm_ass_2_prm_ac_usf_granularity,
2328 { "USF Granularity", "gmr1.rr.pkt_imm_ass_2_prm.ac.usf_granularity",
2329 FT_UINT8, BASE_DEC, NULL, 0x04,
2330 NULL, HFILL }
2332 { &hf_rr_pkt_imm_ass_2_prm_ac_dl_ctl_mac_slot,
2333 { "Downlink Control MAC-slot", "gmr1.rr.pkt_imm_ass_2_prm.ac.dl_ctl_mac_slot",
2334 FT_UINT8, BASE_DEC, NULL, 0x38,
2335 NULL, HFILL }
2337 { &hf_rr_pkt_imm_ass_2_prm_ac_mac_mode,
2338 { "MAC mode", "gmr1.rr.pkt_imm_ass_2_prm.ac.mac_mode",
2339 FT_UINT8, BASE_DEC, VALS(rr_pkt_imm_ass_2_prm_ac_mac_mode_vals), 0xc0,
2340 NULL, HFILL }
2342 { &hf_rr_pkt_imm_ass_2_prm_ac_start_fn,
2343 { "Starting Frame Number", "gmr1.rr.pkt_imm_ass_2_prm.ac.start_fn",
2344 FT_UINT8, BASE_DEC, NULL, 0x0f,
2345 NULL, HFILL }
2347 { &hf_rr_pkt_imm_ass_2_prm_ac_rlc_dblk_gnt,
2348 { "RLC Data Blocks Granted", "gmr1.rr.pkt_imm_ass_2_prm.ac.rlc_dblk_gnt",
2349 FT_UINT8, BASE_DEC, NULL, 0x00,
2350 NULL, HFILL }
2352 { &hf_rr_pkt_imm_ass_2_prm_ac_mcs,
2353 { "MCS", "gmr1.rr.pkt_imm_ass_2_prm.ac.mcs",
2354 FT_UINT8, BASE_DEC, NULL, 0xf8,
2355 NULL, HFILL }
2357 { &hf_rr_pkt_imm_ass_2_prm_ac_tfi,
2358 { "TFI", "gmr1.rr.pkt_imm_ass_2_prm.ac.tfi",
2359 FT_UINT8, BASE_HEX, NULL, 0x7f,
2360 NULL, HFILL }
2362 { &hf_rr_pkt_imm_ass_2_prm_ac_spare2,
2363 { "Spare", "gmr1.rr.pkt_imm_ass_2_prm.ac.spare2",
2364 FT_UINT8, BASE_HEX, NULL, 0x80,
2365 NULL, HFILL }
2367 { &hf_rr_pkt_imm_ass_2_prm_ac_mac_slot_alloc,
2368 { "MAC-slot Allocation", "gmr1.rr.pkt_imm_ass_2_prm.ac.mac_slot_alloc",
2369 FT_UINT8, BASE_HEX, NULL, 0xff,
2370 "LSB=slot 0, MSB=slot 7", HFILL }
2372 { &hf_rr_pkt_imm_ass_2_prm_d_chan_mcs_cmd,
2373 { "Channel MCS Command", "gmr1.rr.pkt_imm_ass_2_prm.d.chan_mcs_cmd",
2374 FT_UINT8, BASE_HEX, NULL, 0x0f,
2375 NULL, HFILL }
2377 { &hf_rr_pkt_imm_ass_2_prm_d_chan_mcs_cmd_pnb512,
2378 { "Channel MCS Command PNB 5,12", "gmr1.rr.pkt_imm_ass_2_prm.d.chan_mcs_cmd_pnb512",
2379 FT_UINT8, BASE_HEX, NULL, 0xf0,
2380 NULL, HFILL }
2382 { &hf_rr_pkt_imm_ass_2_prm_d_spare1,
2383 { "Spare", "gmr1.rr.pkt_imm_ass_2_prm.d.spare1",
2384 FT_UINT8, BASE_HEX, NULL, 0xff,
2385 NULL, HFILL }
2387 { &hf_rr_pkt_imm_ass_2_prm_d_rlc_dblk_gnt,
2388 { "RLC Data Blocks Granted", "gmr1.rr.pkt_imm_ass_2_prm.d.rlc_dblk_gnt",
2389 FT_UINT8, BASE_DEC, NULL, 0x7f,
2390 NULL, HFILL }
2392 { &hf_rr_pkt_imm_ass_2_prm_d_spare2,
2393 { "Spare", "gmr1.rr.pkt_imm_ass_2_prm.d.spare2",
2394 FT_UINT8, BASE_HEX, NULL, 0x80,
2395 NULL, HFILL }
2397 { &hf_rr_pkt_imm_ass_2_prm_d_tfi,
2398 { "TFI", "gmr1.rr.pkt_imm_ass_2_prm.d.tfi",
2399 FT_UINT8, BASE_HEX, NULL, 0x7f,
2400 NULL, HFILL }
2402 { &hf_rr_pkt_imm_ass_2_prm_d_usf_granularity,
2403 { "USF Granularity", "gmr1.rr.pkt_imm_ass_2_prm.ac.usf_granularity",
2404 FT_UINT8, BASE_DEC, NULL, 0x80,
2405 NULL, HFILL }
2407 { &hf_rr_pkt_imm_ass_2_prm_d_mac_slot_alloc,
2408 { "MAC-slot Allocation", "gmr1.rr.pkt_imm_ass_2_prm.d.mac_slot_alloc",
2409 FT_UINT8, BASE_HEX, NULL, 0xff,
2410 "LSB=slot 0, MSB=slot 7", HFILL }
2412 { &hf_rr_usf_value,
2413 { "Uplink state flag (USF)", "gmr1.rr.usf.value",
2414 FT_UINT8, BASE_HEX, NULL, 0x3f,
2415 NULL, HFILL }
2417 { &hf_rr_usf_spare,
2418 { "Spare", "gmr1.rr.usf.spare",
2419 FT_UINT24, BASE_DEC, NULL, 0xffffc0,
2420 NULL, HFILL }
2422 { &hf_rr_timing_adv_idx_value,
2423 { "TAI Value", "gmr1.rr.timing_adv_idx.tai",
2424 FT_UINT8, BASE_DEC, NULL, 0x7f,
2425 NULL, HFILL }
2427 { &hf_rr_timing_adv_idx_spare,
2428 { "Spare", "gmr1.rr.timing_adv_idx.spare",
2429 FT_UINT8, BASE_DEC, NULL, 0x80,
2430 NULL, HFILL }
2432 { &hf_rr_tlli,
2433 { "TLLI", "gmr1.rr.tlli",
2434 FT_UINT32, BASE_HEX, NULL, 0x00,
2435 NULL, HFILL }
2437 { &hf_rr_pkt_pwr_ctrl_prm_par,
2438 { "Power Attenuation Request (PAR)", "gmr1.rr.pkt_pwr_ctrl_prm.par",
2439 FT_UINT8, BASE_CUSTOM, CF_FUNC(rr_pkt_pwr_ctrl_prm_par_fmt), 0x3f,
2440 NULL, HFILL }
2442 { &hf_rr_pkt_pwr_ctrl_prm_spare,
2443 { "Spare", "gmr1.rr.pkt_pwr_ctrl_prm.spare",
2444 FT_UINT8, BASE_DEC, NULL, 0xc0,
2445 NULL, HFILL }
2447 { &hf_rr_persistence_lvl[0],
2448 { "for Radio priority 1", "gmr1.rr.persistence_lvl.p1",
2449 FT_UINT8, BASE_DEC, NULL, 0xf0,
2450 NULL, HFILL }
2452 { &hf_rr_persistence_lvl[1],
2453 { "for Radio priority 2", "gmr1.rr.persistence_lvl.p2",
2454 FT_UINT8, BASE_DEC, NULL, 0x0f,
2455 NULL, HFILL }
2457 { &hf_rr_persistence_lvl[2],
2458 { "for Radio priority 3", "gmr1.rr.persistence_lvl.p3",
2459 FT_UINT8, BASE_DEC, NULL, 0xf0,
2460 NULL, HFILL }
2462 { &hf_rr_persistence_lvl[3],
2463 { "for Radio priority 4", "gmr1.rr.persistence_lvl.p4",
2464 FT_UINT8, BASE_DEC, NULL, 0x0f,
2465 NULL, HFILL }
2467 { &hf_rr_protocol_discriminator,
2468 { "Protocol Discriminator", "gmr1.rr.protocol_discriminator",
2469 FT_UINT8, BASE_DEC, VALS(gmr1_pd_vals), 0x0,
2470 NULL, HFILL }
2472 { &hf_rr_message_elements,
2473 { "Message elements", "gmr1.rr.message_elements",
2474 FT_BYTES, BASE_NONE, NULL, 0x0,
2475 NULL, HFILL }
2479 static ei_register_info ei[] = {
2480 { &ei_gmr1_missing_mandatory_element, { "gmr1.rr.missing_mandatory_element", PI_PROTOCOL, PI_ERROR, "Missing Mandatory element, rest of dissection is suspect", EXPFILL }},
2483 expert_module_t* expert_gmr1_rr;
2485 #define NUM_INDIVIDUAL_ELEMS 2
2486 static int *ett[NUM_INDIVIDUAL_ELEMS +
2487 NUM_GMR1_IE_RR +
2488 NUM_GMR1_MSG_RR];
2490 unsigned int last_offset, i;
2492 /* Setup protocol subtree array */
2493 ett[0] = &ett_msg_ccch;
2494 ett[1] = &ett_rr_pd;
2496 last_offset = NUM_INDIVIDUAL_ELEMS;
2498 for (i=0; i<NUM_GMR1_IE_RR; i++,last_offset++) {
2499 ett[last_offset] = &ett_gmr1_ie_rr[i];
2502 for (i=0; i<NUM_GMR1_MSG_RR; i++,last_offset++) {
2503 ett[last_offset] = &ett_msg_rr[i];
2506 proto_register_subtree_array(ett, array_length(ett));
2508 /* Register the protocol name and field description */
2509 proto_gmr1_rr = proto_register_protocol("GEO-Mobile Radio (1) RR", "GMR-1 RR", "gmr1.rr");
2511 proto_register_field_array(proto_gmr1_rr, hf, array_length(hf));
2513 expert_gmr1_rr = expert_register_protocol(proto_gmr1_rr);
2514 expert_register_field_array(expert_gmr1_rr, ei, array_length(ei));
2516 /* Register the protocol name and field description */
2517 proto_gmr1_ccch = proto_register_protocol("GEO-Mobile Radio (1) CCCH", "GMR-1 CCCH", "gmr1.ccch");
2519 /* Register dissector */
2520 register_dissector("gmr1_ccch", dissect_gmr1_ccch, proto_gmr1_ccch);
2524 * Editor modelines - https://www.wireshark.org/tools/modelines.html
2526 * Local variables:
2527 * c-basic-offset: 8
2528 * tab-width: 8
2529 * indent-tabs-mode: t
2530 * End:
2532 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
2533 * :indentSize=8:tabSize=8:noTabs=false: