MSWSP: add two more Property Sets
[wireshark-wip.git] / epan / dissectors / packet-gmr1_common.c
blobbc3b58da9b6463d2e40e95182198f5800ce24313
1 /* packet-gmr1_common.c
3 * Routines for GMR-1 dissection in wireshark (common stuff).
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 * $Id$
16 * Wireshark - Network traffic analyzer
17 * By Gerald Combs <gerald@wireshark.org>
18 * Copyright 1998 Gerald Combs
20 * This program is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU General Public License
22 * as published by the Free Software Foundation; either version 2
23 * of the License, or (at your option) any later version.
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
30 * You should have received a copy of the GNU General Public License
31 * along with this program; if not, write to the Free Software
32 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
35 #include "config.h"
37 #include <glib.h>
38 #include <epan/packet.h>
40 #include "packet-gmr1_common.h"
43 /* GMR-1 Common proto */
44 static int proto_gmr1_common = -1;
47 /* ------------------------------------------------------------------------ */
48 /* Protocol descriptor (see [1] 11.2 & [4] 10.2) */
49 /* ------------------------------------------------------------------------ */
51 const value_string gmr1_pd_vals[] = {
52 { GMR1_PD_CC, "Call Control; call related SS messages" },
53 { GMR1_PD_MM, "Mobility Management messages" },
54 { GMR1_PD_RR, "Radio Resource management messages" },
55 { GMR1_PD_GMM, "GPRS Mobility Management messages" },
56 { GMR1_PD_SM, "Session Management messages" },
57 { GMR1_PD_DTRS, "DTMF transmission and reception service" },
58 { 0, NULL }
61 const value_string gmr1_pd_short_vals[] = {
62 { GMR1_PD_CC, "CC" }, /* Call Control; call related SS messages */
63 { GMR1_PD_MM, "MM" }, /* Mobility Management messages */
64 { GMR1_PD_RR, "RR" }, /* Radio Resource management messages */
65 { GMR1_PD_GMM, "GMM" }, /* GPRS Mobility Management messages */
66 { GMR1_PD_SM, "SM" }, /* Session Management messages */
67 { GMR1_PD_DTRS, "DTRS" }, /* DTMF transmission and reception service */
68 { 0, NULL}
72 /* ------------------------------------------------------------------------ */
73 /* Common Information Elements */
74 /* ------------------------------------------------------------------------ */
76 static const value_string gmr1_ie_common_strings[] = {
77 { GMR1_IE_COM_CM2,
78 "Mobile Earth Station Classmark 2" }, /* [1] 11.5.1.6 */
79 { GMR1_IE_COM_SPARE_NIBBLE,
80 "Spare Half Octet" }, /* [1] 11.5.1.8 */
81 { 0, NULL}
83 value_string_ext gmr1_ie_common_strings_ext = VALUE_STRING_EXT_INIT(gmr1_ie_common_strings);
85 gint ett_gmr1_ie_common[NUM_GMR1_IE_COMMON];
87 /* Fields */
88 int hf_gmr1_skip_ind = -1;
89 int hf_gmr1_l3_pd = -1;
90 int hf_gmr1_elem_id = -1;
91 int hf_gmr1_len = -1;
93 static int hf_com_cm2_spare1 = -1;
94 static int hf_com_cm2_revision = -1;
95 static int hf_com_cm2_early_send = -1;
96 static int hf_com_cm2_a5_1 = -1;
97 static int hf_com_cm2_mes_type = -1;
98 static int hf_com_cm2_spare2 = -1;
99 static int hf_com_cm2_ss_screen_ind = -1;
100 static int hf_com_cm2_sms_cap = -1;
101 static int hf_com_cm2_spare3 = -1;
102 static int hf_com_cm2_freq_cap = -1;
103 static int hf_com_cm2_cm3_presence = -1;
104 static int hf_com_cm2_spare4 = -1;
105 static int hf_com_cm2_a5_3 = -1;
106 static int hf_com_cm2_a5_2_gmr1 = -1;
108 /* [1] 11.5.1.6 - Mobile Earth Station Classmark 2 */
109 static const value_string com_cm2_revision_vals[] = {
110 { 0, "Reserved for Phase 1" },
111 { 1, "Phase 2 MESs" },
112 { 2, "Reserved" },
113 { 3, "Reserved" },
114 { 0, NULL }
117 static const value_string com_cm2_early_send_vals[] = {
118 { 0, "\"Controlled Early Classmark Sending\" option is not implemented" },
119 { 1, "\"Controlled Early Classmark Sending\" option is implemented" },
120 { 0, NULL }
123 static const value_string com_cm2_a5_1_vals[] = {
124 { 0, "Encryption algorithm A5/1 available" },
125 { 1, "Encryption algorithm A5/1 not available" },
126 { 0, NULL }
129 static const value_string com_cm2_mes_type_vals[] = {
130 { 0, "Class 1 Reserved" },
131 { 1, "Class 2 Used by all fixed GMR-1 terminals" },
132 { 2, "Class 3 Used by all vehicular GMR-1 terminals" },
133 { 3, "Class 4 Used by all handheld GMR-1 terminals" },
134 { 0, NULL }
137 static const value_string com_cm2_ss_screen_ind_vals[] = {
138 { 0, "Defined in GSM 04.80 [29]" },
139 { 1, "Defined in GSM 04.80 [29]" },
140 { 2, "Defined in GSM 04.80 [29]" },
141 { 3, "Defined in GSM 04.80 [29]" },
142 { 0, NULL }
145 static const value_string com_cm2_sms_cap_vals[] = {
146 { 0, "MES does not support mobile terminated point-to-point SMS" },
147 { 1, "MES supports mobile terminated point-to-point SMS" },
148 { 0, NULL }
151 static const value_string com_cm2_freq_cap_vals[] = {
152 { 0, "Not used in GMR-1" },
153 { 1, "Not used in GMR-1" },
154 { 0, NULL }
157 static const value_string com_cm3_presence_vals[] = {
158 { 0, "No additional MES capability information available" },
159 { 1, "Additional MES capabilities are described in the Classmark 3 IE" },
160 { 0, NULL }
163 static const value_string com_cm2_a5_3_vals[] = {
164 { 0, "Encryption algorithm A5/3 not available" },
165 { 1, "Encryption algorithm A5/3 available" },
166 { 0, NULL }
169 static const value_string com_cm2_a5_2_gmr1_vals[] = {
170 { 0, "Encryption algorithm GMR-1 A5/2 not available" },
171 { 1, "Encryption algorithm GMR-1 A5/2 available" },
172 { 0, NULL }
175 GMR1_IE_FUNC(gmr1_ie_com_cm2)
177 proto_tree_add_item(tree, hf_com_cm2_spare1,
178 tvb, offset, 1, ENC_BIG_ENDIAN);
180 proto_tree_add_item(tree, hf_com_cm2_revision,
181 tvb, offset, 1, ENC_BIG_ENDIAN);
183 proto_tree_add_item(tree, hf_com_cm2_early_send,
184 tvb, offset, 1, ENC_BIG_ENDIAN);
186 proto_tree_add_item(tree, hf_com_cm2_a5_1,
187 tvb, offset, 1, ENC_BIG_ENDIAN);
189 proto_tree_add_item(tree, hf_com_cm2_mes_type,
190 tvb, offset, 1, ENC_BIG_ENDIAN);
192 offset++;
194 proto_tree_add_item(tree, hf_com_cm2_spare2,
195 tvb, offset, 1, ENC_BIG_ENDIAN);
197 proto_tree_add_item(tree, hf_com_cm2_ss_screen_ind,
198 tvb, offset, 1, ENC_BIG_ENDIAN);
200 proto_tree_add_item(tree, hf_com_cm2_sms_cap,
201 tvb, offset, 1, ENC_BIG_ENDIAN);
203 proto_tree_add_item(tree, hf_com_cm2_spare3,
204 tvb, offset, 1, ENC_BIG_ENDIAN);
206 proto_tree_add_item(tree, hf_com_cm2_freq_cap,
207 tvb, offset, 1, ENC_BIG_ENDIAN);
209 offset++;
211 proto_tree_add_item(tree, hf_com_cm2_cm3_presence,
212 tvb, offset, 1, ENC_BIG_ENDIAN);
214 proto_tree_add_item(tree, hf_com_cm2_spare4,
215 tvb, offset, 1, ENC_BIG_ENDIAN);
217 proto_tree_add_item(tree, hf_com_cm2_a5_3,
218 tvb, offset, 1, ENC_BIG_ENDIAN);
220 proto_tree_add_item(tree, hf_com_cm2_a5_2_gmr1,
221 tvb, offset, 1, ENC_BIG_ENDIAN);
223 offset++;
225 return 3;
228 /* [1] 11.5.1.8 - Spare Half Octet */
229 GMR1_IE_FUNC(gmr1_ie_com_spare_nibble)
231 proto_tree_add_text(tree, tvb, offset, 1, "Spare Half Octet");
233 return 1;
236 elem_fcn gmr1_ie_common_func[NUM_GMR1_IE_COMMON] = {
237 gmr1_ie_com_cm2, /* MES Classmark 2 */
238 gmr1_ie_com_spare_nibble, /* Spare Half Octet */
242 /* ------------------------------------------------------------------------ */
243 /* Messages and IEs parsing */
244 /* ------------------------------------------------------------------------ */
246 extern void
247 gmr1_get_msg_rr_params(guint8 oct, int dcch, const gchar **msg_str,
248 int *ett_tree, int *hf_idx, gmr1_msg_func_t *msg_func_p);
250 void
251 gmr1_get_msg_params(gmr1_pd_e pd, guint8 oct, const gchar **msg_str,
252 int *ett_tree, int *hf_idx, gmr1_msg_func_t *msg_func_p)
254 switch (pd) {
255 case GMR1_PD_RR:
256 gmr1_get_msg_rr_params(oct, 1, msg_str, ett_tree, hf_idx, msg_func_p);
257 break;
259 default:
260 *msg_str = NULL;
261 *ett_tree = -1;
262 *hf_idx = -1;
263 *msg_func_p = NULL;
268 /* ------------------------------------------------------------------------ */
269 /* Register code */
270 /* ------------------------------------------------------------------------ */
272 void
273 proto_register_gmr1_common(void)
275 static hf_register_info hf[] = {
276 { &hf_gmr1_skip_ind,
277 { "Skip Indicator", "gmr1.skip_ind",
278 FT_UINT8, BASE_DEC, NULL, 0xf0,
279 NULL, HFILL }
281 { &hf_gmr1_l3_pd,
282 { "Protocol discriminator","gmr1.l3_protocol_discriminator",
283 FT_UINT8, BASE_DEC, VALS(gmr1_pd_vals), 0x0f,
284 NULL, HFILL }
286 { &hf_gmr1_elem_id,
287 { "Element ID", "gmr1.ie.elem_id",
288 FT_UINT8, BASE_HEX, NULL, 0,
289 NULL, HFILL }
291 { &hf_gmr1_len,
292 { "Length", "gmr1.ie.length",
293 FT_UINT8, BASE_DEC, NULL, 0,
294 NULL, HFILL }
296 { &hf_com_cm2_spare1,
297 { "Spare", "gmr1.common.cm2.spare1",
298 FT_UINT8, BASE_DEC, NULL, 0x80,
299 NULL, HFILL }
301 { &hf_com_cm2_revision,
302 { "Revision Level", "gmr1.common.cm2.revision",
303 FT_UINT8, BASE_DEC, VALS(com_cm2_revision_vals), 0x60,
304 NULL, HFILL }
306 { &hf_com_cm2_early_send,
307 { "ES IND", "gmr1.common.cm2.early_send",
308 FT_UINT8, BASE_DEC, VALS(com_cm2_early_send_vals), 0x10,
309 NULL, HFILL }
311 { &hf_com_cm2_a5_1,
312 { "A5/1", "gmr1.common.cm2.a5_1",
313 FT_UINT8, BASE_DEC, VALS(com_cm2_a5_1_vals), 0x08,
314 NULL, HFILL }
316 { &hf_com_cm2_mes_type,
317 { "MES terminal type", "gmr1.common.cm2.mes_type",
318 FT_UINT8, BASE_DEC, VALS(com_cm2_mes_type_vals), 0x07,
319 NULL, HFILL }
321 { &hf_com_cm2_spare2,
322 { "Spare", "gmr1.common.cm2.spare2",
323 FT_UINT8, BASE_DEC, NULL, 0xc0,
324 NULL, HFILL }
326 { &hf_com_cm2_ss_screen_ind,
327 { "SS Screening Indicator", "gmr1.common.cm2.ss_screen_ind",
328 FT_UINT8, BASE_DEC, VALS(com_cm2_ss_screen_ind_vals), 0x30,
329 NULL, HFILL }
331 { &hf_com_cm2_sms_cap,
332 { "SM capability", "gmr1.common.cm2.sms_cap",
333 FT_UINT8, BASE_DEC, VALS(com_cm2_sms_cap_vals), 0x08,
334 NULL, HFILL }
336 { &hf_com_cm2_spare3,
337 { "Spare", "gmr1.common.cm2.spare3",
338 FT_UINT8, BASE_DEC, NULL, 0x06,
339 NULL, HFILL }
341 { &hf_com_cm2_freq_cap,
342 { "FC", "gmr1.common.cm2.freq_cap",
343 FT_UINT8, BASE_DEC, VALS(com_cm2_freq_cap_vals), 0x01,
344 NULL, HFILL }
346 { &hf_com_cm2_cm3_presence,
347 { "CM3", "gmr1.common.cm2.cm3_presence",
348 FT_UINT8, BASE_DEC, VALS(com_cm3_presence_vals), 0x80,
349 NULL, HFILL }
351 { &hf_com_cm2_spare4,
352 { "Spare", "gmr1.common.cm2.spare4",
353 FT_UINT8, BASE_DEC, NULL, 0x7c,
354 NULL, HFILL }
356 { &hf_com_cm2_a5_3,
357 { "A5/3", "gmr1.common.cm2.a5_3",
358 FT_UINT8, BASE_DEC, VALS(com_cm2_a5_3_vals), 0x02,
359 NULL, HFILL }
361 { &hf_com_cm2_a5_2_gmr1,
362 { "A5/2 GMR-1", "gmr1.common.cm2.a5_2_gmr1",
363 FT_UINT8, BASE_DEC, VALS(com_cm2_a5_2_gmr1_vals), 0x01,
364 NULL, HFILL }
368 /* Register the protocol name and field description */
369 proto_gmr1_common = proto_register_protocol("GEO-Mobile Radio (1) Common", "GMR-1 Common", "gmr1.common");
371 proto_register_field_array(proto_gmr1_common, hf, array_length(hf));
374 void
375 proto_reg_handoff_gmr1_common(void)
377 /* Nothing to do */