/src/wireshark/epan/dissectors/packet-sgsap.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* packet-sgsap.c |
2 | | * Routines for SGs Application Part (SGsAP) protocol dissection |
3 | | * |
4 | | * Copyright 2010 - 2017, Anders Broman <anders.broman@ericsson.com> |
5 | | * |
6 | | * Wireshark - Network traffic analyzer |
7 | | * By Gerald Combs <gerald@wireshark.org> |
8 | | * Copyright 1998 Gerald Combs |
9 | | * |
10 | | * SPDX-License-Identifier: GPL-2.0-or-later |
11 | | * |
12 | | * References: 3GPP TS 29.118 V10.2.0 (2010-12) |
13 | | */ |
14 | | |
15 | | #include "config.h" |
16 | | |
17 | | #include <epan/packet.h> |
18 | | #include <epan/tfs.h> |
19 | | #include <epan/expert.h> |
20 | | #include <epan/exceptions.h> |
21 | | #include <epan/show_exception.h> |
22 | | |
23 | | #include <wsutil/array.h> |
24 | | #include "packet-gsm_a_common.h" |
25 | | #include "packet-e212.h" |
26 | | |
27 | 14 | #define PNAME "SGs Application Part (SGsAP)" |
28 | 14 | #define PSNAME "SGSAP" |
29 | 28 | #define PFNAME "sgsap" |
30 | | |
31 | | |
32 | | void proto_register_sgsap(void); |
33 | | void proto_reg_handoff_sgsap(void); |
34 | | |
35 | | /* Global variables */ |
36 | | static dissector_handle_t gsm_a_dtap_handle; |
37 | | |
38 | | /* The registered SCTP port number for SGsAP is 29118. |
39 | | * The payload protocol identifier to be used for SGsAP is 0. |
40 | | */ |
41 | 14 | #define SGSAP_SCTP_PORT_RANGE "29118" |
42 | | |
43 | | /* Initialize the protocol and registered fields */ |
44 | | static int proto_sgsap; |
45 | | |
46 | | static int hf_sgsap_msg_type; |
47 | | int hf_sgsap_elem_id; |
48 | | static int hf_sgsap_eps_location_update_type; |
49 | | static int hf_sgsap_service_indicator_value; |
50 | | static int hf_sgsap_sgs_cause; |
51 | | static int hf_sgsap_ue_emm_mode; |
52 | | static int hf_sgsap_eci; |
53 | | static int hf_sgsap_cn_id; |
54 | | static int hf_sgsap_imsi_det_eps; |
55 | | static int hf_sgsap_imsi_det_non_eps; |
56 | | static int hf_sgsap_lcs_indic; |
57 | | static int hf_sgsap_mme_name; |
58 | | static int hf_sgsap_vlr_name; |
59 | | static int hf_sgsap_imeisv; |
60 | | static int hf_sgsap_unknown_msg; |
61 | | static int hf_sgsap_message_elements; |
62 | | static int hf_sgsap_csri; |
63 | | static int hf_sgsap_sel_cs_dmn_op; |
64 | | |
65 | | static int ett_sgsap; |
66 | | static int ett_sgsap_sel_cs_dmn_op; |
67 | | |
68 | | static expert_field ei_sgsap_extraneous_data; |
69 | | static expert_field ei_sgsap_missing_mandatory_element; |
70 | | |
71 | | static dissector_handle_t sgsap_handle; |
72 | | |
73 | | static void get_sgsap_msg_params(uint8_t oct, const char **msg_str, int *ett_tree, int *hf_idx, msg_fcn *msg_fcn_p); |
74 | | |
75 | | /* |
76 | | * 9.4 Information elements |
77 | | */ |
78 | | /* |
79 | | * 9.4.1 CLI |
80 | | */ |
81 | | |
82 | | /* |
83 | | * Octets 3 to 14 contain the value part of the Calling party BCD number information element |
84 | | * defined in subclause 10.5.4.9 of 3GPP TS 24.008 [8] (octets 3 to 14, i.e. not including |
85 | | * 3GPP TS 24.008 IEI and 3GPP TS 24.008 length indicator) |
86 | | * ( packet-gsm_a_dtap.c ) |
87 | | */ |
88 | | /* |
89 | | * 9.4.2 EPS location update type |
90 | | */ |
91 | | |
92 | | /* EPS location update type value (octet 3) */ |
93 | | static const value_string sgsap_eps_location_update_type_values[] = { |
94 | | { 0x00, "Shall not be sent in this version of the protocol" }, |
95 | | { 0x01, "IMSI attach" }, |
96 | | { 0x02, "Normal location update" }, |
97 | | { 0, NULL } |
98 | | }; |
99 | | |
100 | | static uint16_t |
101 | | de_sgsap_eps_loc_upd_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
102 | 0 | { |
103 | 0 | uint32_t curr_offset; |
104 | 0 | uint8_t oct; |
105 | |
|
106 | 0 | curr_offset = offset; |
107 | | |
108 | | /* Octet 3 EPS location update type value */ |
109 | 0 | proto_tree_add_item(tree, hf_sgsap_eps_location_update_type, tvb, offset, 1, ENC_BIG_ENDIAN); |
110 | 0 | if (add_string) { |
111 | 0 | oct = tvb_get_uint8(tvb, curr_offset); |
112 | 0 | snprintf(add_string, string_len, " - %s", val_to_str_const(oct, sgsap_eps_location_update_type_values, "Reserved")); |
113 | 0 | } |
114 | |
|
115 | 0 | curr_offset++; |
116 | |
|
117 | 0 | return curr_offset - offset; |
118 | 0 | } |
119 | | /* |
120 | | * 9.4.3 Erroneous message |
121 | | * |
122 | | * See subclause 18.4.5 in 3GPP TS 29.018 [16]. |
123 | | */ |
124 | | static uint16_t |
125 | | de_sgsap_err_msg(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string , int string_len) |
126 | 0 | { |
127 | 0 | const char *msg_str; |
128 | 0 | int ett_tree; |
129 | 0 | int hf_idx; |
130 | 0 | void(*msg_fcn_p)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len); |
131 | 0 | uint8_t oct; |
132 | | |
133 | | /* 18.4.5 Erroneous message |
134 | | * The Erroneous message IE is a TLV IE that encapsulates the message in error. |
135 | | * Octet 3 - Octet n |
136 | | * Erroneous message including the message type. |
137 | | */ |
138 | | /* Message type IE*/ |
139 | 0 | oct = tvb_get_uint8(tvb, offset); |
140 | 0 | msg_fcn_p = NULL; |
141 | 0 | ett_tree = -1; |
142 | 0 | hf_idx = -1; |
143 | 0 | msg_str = NULL; |
144 | |
|
145 | 0 | proto_tree_add_item(tree, hf_sgsap_msg_type, tvb, offset, 1, ENC_BIG_ENDIAN); |
146 | |
|
147 | 0 | get_sgsap_msg_params(oct, &msg_str, &ett_tree, &hf_idx, &msg_fcn_p); |
148 | 0 | if (msg_str) { |
149 | 0 | if (add_string) |
150 | 0 | snprintf(add_string, string_len, " - %s", msg_str); |
151 | |
|
152 | 0 | } |
153 | 0 | if (msg_fcn_p){ |
154 | 0 | volatile uint32_t curr_offset = offset + 1; |
155 | 0 | TRY { |
156 | | /*let's try to decode erroneous message and catch exceptions as it could be malformed */ |
157 | 0 | (*msg_fcn_p)(tvb, tree, pinfo, curr_offset, len - 1); |
158 | 0 | } CATCH_BOUNDS_ERRORS { |
159 | 0 | show_exception(tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE); |
160 | 0 | } ENDTRY |
161 | 0 | } |
162 | | |
163 | |
|
164 | 0 | return len; |
165 | 0 | } |
166 | | /* |
167 | | * 9.4.3a E-UTRAN Cell Global Identity |
168 | | * |
169 | | * The coding of the E-UTRAN Cell Global Identity value is according to ECGI field information element |
170 | | * as specified in subclause 8.21.5 of 3GPP TS 29.274 [17A] (GTPv2-C) |
171 | | */ |
172 | | uint16_t |
173 | | de_sgsap_ecgi(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
174 | 0 | { |
175 | 0 | uint32_t curr_offset; |
176 | |
|
177 | 0 | curr_offset = offset; |
178 | |
|
179 | 0 | dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, E212_ECGI, true); |
180 | 0 | curr_offset += 3; |
181 | |
|
182 | 0 | proto_tree_add_item(tree, hf_sgsap_eci, tvb, curr_offset, 4, ENC_BIG_ENDIAN); |
183 | 0 | curr_offset += 4; |
184 | |
|
185 | 0 | return curr_offset-offset; |
186 | 0 | } |
187 | | /* |
188 | | * 9.4.4 Global CN-Id |
189 | | * |
190 | | * See subclause 18.4.27 in 3GPP TS 29.018 [16]. |
191 | | * 18.4.27 Global CN-Id |
192 | | * The Global CN-Id consists of a PLMN-Id and a CN-Id, see 3GPP TS 23.003. The PLMN-Id consists of MCC and MNC |
193 | | * coded according to Location Area Identification in 3GPP TS 24.008. The CN-Id is an integer defined by O&M. The |
194 | | * least significant bit of the CN-Id field is bit 1 of octet 7 and the most significant bit is bit 8 of octet 6. If the CN-Id does |
195 | | * not fill the field reserved for it, the rest of the bits are set to '0'. |
196 | | */ |
197 | | static uint16_t |
198 | | de_sgsap_g_cn_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
199 | 0 | { |
200 | 0 | uint32_t curr_offset; |
201 | |
|
202 | 0 | curr_offset = offset; |
203 | |
|
204 | 0 | dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, E212_NONE, true); |
205 | 0 | curr_offset += 3; |
206 | |
|
207 | 0 | proto_tree_add_item(tree, hf_sgsap_cn_id, tvb, curr_offset, 2, ENC_BIG_ENDIAN); |
208 | 0 | curr_offset += 2; |
209 | |
|
210 | 0 | return curr_offset-offset; |
211 | 0 | } |
212 | | /* |
213 | | * 9.4.5 IMEISV |
214 | | * See subclause 18.4.9 in 3GPP TS 29.018 [16]. |
215 | | * The IMEISV is coded as a sequence of BCD digits, compressed two into each octet. |
216 | | * The IMEISV consists of 16 digits |
217 | | * (see 3GPP TS 23.003). |
218 | | */ |
219 | | static uint16_t |
220 | | de_sgsap_imeisv(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
221 | 0 | { |
222 | 0 | char *imeisv_str; |
223 | 0 | uint32_t curr_offset; |
224 | |
|
225 | 0 | curr_offset = offset; |
226 | |
|
227 | 0 | proto_tree_add_item_ret_display_string(tree, hf_sgsap_imeisv, tvb, curr_offset, len, ENC_BCD_DIGITS_0_9|ENC_LITTLE_ENDIAN, pinfo->pool, &imeisv_str); |
228 | 0 | if (add_string) { |
229 | | /* (len<<2)+4 = the maximum number of bytes to produce (including the terminating nul character). */ |
230 | 0 | snprintf(add_string, (len<<2)+4, " - %s", imeisv_str); |
231 | 0 | } |
232 | |
|
233 | 0 | return len; |
234 | 0 | } |
235 | | |
236 | | /* |
237 | | * 9.4.6 IMSI |
238 | | * See subclause 18.4.10 in 3GPP TS 29.018 [16]. |
239 | | */ |
240 | | /* The IMSI is coded as a sequence of BCD digits, compressed two into each octet. |
241 | | * This is a variable length element, and includes a length indicator. |
242 | | * The IMSI is defined in 3GPP TS 23.003. It shall not exceed 15 digits (see 3GPP TS 23.003). |
243 | | */ |
244 | | /* |
245 | | * 9.4.7 IMSI detach from EPS service type |
246 | | */ |
247 | | |
248 | | /* IMSI detach from EPS service type value (octet 3) */ |
249 | | static const value_string sgsap_imsi_det_from_eps_serv_type_values[] = { |
250 | | { 0x00, "Interpreted as reserved in this version of the protocol" }, |
251 | | { 0x01, "Network initiated IMSI detach from EPS services" }, |
252 | | { 0x02, "UE initiated IMSI detach from EPS services" }, |
253 | | { 0x03, "EPS services not allowed" }, |
254 | | { 0, NULL } |
255 | | }; |
256 | | |
257 | | static uint16_t |
258 | | de_sgsap_imsi_det_eps(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
259 | 0 | { |
260 | 0 | uint32_t curr_offset; |
261 | |
|
262 | 0 | curr_offset = offset; |
263 | |
|
264 | 0 | proto_tree_add_item(tree, hf_sgsap_imsi_det_eps, tvb, curr_offset, 1, ENC_BIG_ENDIAN); |
265 | 0 | curr_offset += 1; |
266 | |
|
267 | 0 | return curr_offset-offset; |
268 | 0 | } |
269 | | /* |
270 | | * 9.4.8 IMSI detach from non-EPS service type |
271 | | */ |
272 | | /* IMSI detach from non-EPS service type value (octet 3)*/ |
273 | | static const value_string sgsap_imsi_det_from_non_eps_serv_type_values[] = { |
274 | | { 0x00, "Interpreted as reserved in this version of the protocol" }, |
275 | | { 0x01, "Explicit UE initiated IMSI detach from non-EPS services" }, |
276 | | { 0x02, "Combined UE initiated IMSI detach from EPS and non-EPS services" }, |
277 | | { 0x03, "Implicit network initiated IMSI detach from non-EPS services" }, |
278 | | { 0, NULL } |
279 | | }; |
280 | | |
281 | | static uint16_t |
282 | | de_sgsap_imsi_det_non_eps(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
283 | 0 | { |
284 | 0 | uint32_t curr_offset; |
285 | |
|
286 | 0 | curr_offset = offset; |
287 | |
|
288 | 0 | proto_tree_add_item(tree, hf_sgsap_imsi_det_non_eps, tvb, curr_offset, 1, ENC_BIG_ENDIAN); |
289 | 0 | curr_offset += 1; |
290 | |
|
291 | 0 | return curr_offset-offset; |
292 | 0 | } |
293 | | /* |
294 | | * 9.4.9 LCS client identity |
295 | | * The coding of the LCS client identity value is according to LCS-ClientID |
296 | | * as specified in subclause 17.7.13 of 3GPP TS 29.002 [15] |
297 | | * (packet-nas_eps.c) |
298 | | */ |
299 | | /* |
300 | | * 9.4.10 LCS indicator |
301 | | */ |
302 | | static const value_string sgsap_lcs_indic_values[] = { |
303 | | { 0x00, "Normal, unspecified in this version of the protocol" }, |
304 | | { 0x01, "MT-LR" }, |
305 | | { 0, NULL } |
306 | | }; |
307 | | |
308 | | static uint16_t |
309 | | de_sgsap_lcs_indic(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
310 | 0 | { |
311 | 0 | uint32_t curr_offset; |
312 | |
|
313 | 0 | curr_offset = offset; |
314 | |
|
315 | 0 | proto_tree_add_item(tree, hf_sgsap_lcs_indic, tvb, curr_offset, 1, ENC_BIG_ENDIAN); |
316 | 0 | curr_offset += 1; |
317 | |
|
318 | 0 | return curr_offset-offset; |
319 | 0 | } |
320 | | /* |
321 | | * 9.4.11 Location area identifier |
322 | | * |
323 | | * Octets 3 to 7 contain the value part of the Location area identification information element |
324 | | * defined in 3GPP TS 24.008 [8] (starting with octet 2, i.e. not including 3GPP TS 24.008 IEI) |
325 | | *(packet-gsm_a_common.c) |
326 | | */ |
327 | | /* |
328 | | * 9.4.12 MM information |
329 | | * For the coding see subclause 18.4.16 in 3GPP TS 29.018 [16]. |
330 | | * User information: This field is composed of one or more of the |
331 | | * information elements of the MM information message as defined in |
332 | | * 3GPP TS 24.008, excluding the Protocol discriminator, Skip |
333 | | * indicator and Message type. This field includes the IEI and length |
334 | | * indicatior of the other information elements. |
335 | | */ |
336 | | static uint16_t |
337 | | de_sgsap_mm_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_) |
338 | 0 | { |
339 | 0 | uint32_t curr_offset; |
340 | |
|
341 | 0 | curr_offset = offset; |
342 | |
|
343 | 0 | dtap_mm_mm_info(tvb, tree, pinfo, curr_offset, len); |
344 | |
|
345 | 0 | return len; |
346 | 0 | } |
347 | | |
348 | | /* |
349 | | * 9.4.13 MME name |
350 | | */ |
351 | | static uint16_t |
352 | | de_sgsap_mme_name(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
353 | 0 | { |
354 | 0 | unsigned name_len; |
355 | 0 | uint8_t *fqdn = NULL; |
356 | | |
357 | | /* The MME name information element specifies the MME name and is coded as shown in figure 9.4.13.1. Octets 3 |
358 | | * through n contain the name in the form of a fully qualified domain name (FQDN) as specified in 3GPP TS 23.003 [3]. |
359 | | * The value part of the MME name information element (not including IEI and length indicator) shall have a length of 55 |
360 | | * octets. |
361 | | */ |
362 | 0 | if (len > 0) { |
363 | 0 | name_len = tvb_get_uint8(tvb, offset); |
364 | |
|
365 | 0 | if (name_len < 0x20) { |
366 | 0 | fqdn = tvb_get_string_enc(pinfo->pool, tvb, offset, len, ENC_APN_STR); |
367 | 0 | } else{ |
368 | 0 | fqdn = tvb_get_string_enc(pinfo->pool, tvb, offset, len, ENC_ASCII); |
369 | 0 | } |
370 | 0 | proto_tree_add_string(tree, hf_sgsap_mme_name, tvb, offset, len, fqdn); |
371 | 0 | if (add_string) |
372 | 0 | snprintf(add_string, string_len, " - %s", fqdn); |
373 | |
|
374 | 0 | } |
375 | |
|
376 | 0 | return len; |
377 | 0 | } |
378 | | /* |
379 | | * 9.4.14 Mobile identity |
380 | | * See subclause 18.4.17 in 3GPP TS 29.018 [16]. |
381 | | * (packet-gsm_a_common.c) |
382 | | */ |
383 | | /* |
384 | | * 9.4.14a Mobile Station Classmark 2 |
385 | | * With the exception of the IEI, the contents are specified in subclause 10.5.1.6 in 3GPP TS 24.008 [8]. |
386 | | * (packet-gsm_a_common.c) |
387 | | */ |
388 | | /* |
389 | | * 9.4.15 NAS message container |
390 | | * Octets 3 to 253 contain the SMS message (i.e. CP DATA, CP ACK or CP ERROR) |
391 | | * as defined in subclause 7.2 of 3GPP TS 24.011 [10] |
392 | | */ |
393 | | static uint16_t |
394 | | de_sgsap_nas_msg_container(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_) |
395 | 0 | { |
396 | 0 | tvbuff_t *new_tvb; |
397 | 0 | uint32_t curr_offset; |
398 | |
|
399 | 0 | curr_offset = offset; |
400 | | |
401 | | /* Octets 3 to 253 contain the SMS message (i.e. CP DATA, CP ACK or CP ERROR) |
402 | | * as defined in subclause 7.2 of 3GPP TS 24.011 [10] |
403 | | */ |
404 | 0 | new_tvb = tvb_new_subset_length(tvb, curr_offset, len); |
405 | 0 | if (gsm_a_dtap_handle) { |
406 | 0 | call_dissector(gsm_a_dtap_handle, new_tvb, pinfo, tree); |
407 | 0 | } |
408 | |
|
409 | 0 | return len; |
410 | 0 | } |
411 | | /* |
412 | | * 9.4.16 Reject cause |
413 | | * See subclause 18.4.21 in 3GPP TS 29.018 [16]. |
414 | | * The rest of the information element is coded as the value part of |
415 | | * the reject cause IE defined in 3GPP TS 24.008, not including |
416 | | * 3GPP TS 24.008 IEI. |
417 | | * (packet-gsm_a_dtap.c) |
418 | | */ |
419 | | /* |
420 | | * 9.4.17 Service indicator |
421 | | */ |
422 | | |
423 | | /* Octet 3 Service indicator value */ |
424 | | static const value_string sgsap_service_indicator_values[] = { |
425 | | { 0x00, "Shall not be sent in this version of the protocol" }, |
426 | | { 0x01, "CS call indicator" }, |
427 | | { 0x02, "SMS indicator" }, |
428 | | { 0, NULL } |
429 | | }; |
430 | | |
431 | | static uint16_t |
432 | | de_sgsap_serv_indic(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
433 | 0 | { |
434 | 0 | uint32_t curr_offset; |
435 | 0 | uint8_t oct; |
436 | |
|
437 | 0 | curr_offset = offset; |
438 | | |
439 | | /* Octet 3 Service indicator value */ |
440 | 0 | proto_tree_add_item(tree, hf_sgsap_service_indicator_value, tvb, offset, 1, ENC_BIG_ENDIAN); |
441 | 0 | if (add_string) { |
442 | 0 | oct = tvb_get_uint8(tvb, curr_offset); |
443 | 0 | snprintf(add_string, string_len, " - %s", val_to_str_const(oct, sgsap_service_indicator_values, "Reserved")); |
444 | 0 | } |
445 | 0 | curr_offset++; |
446 | |
|
447 | 0 | return curr_offset-offset; |
448 | 0 | } |
449 | | /* |
450 | | * 9.4.18 SGs cause |
451 | | */ |
452 | | |
453 | | /* SGs cause value (octet 3) */ |
454 | | static const value_string sgsap_sgs_cause_values[] = { |
455 | | { 0x00, "Normal, unspecified in this version of the protocol" }, |
456 | | { 0x01, "IMSI detached for EPS services" }, |
457 | | { 0x02, "IMSI detached for EPS and non-EPS services" }, |
458 | | { 0x03, "IMSI unknown" }, |
459 | | { 0x04, "IMSI detached for non-EPS services" }, |
460 | | { 0x05, "IMSI implicitly detached for non-EPS services" }, |
461 | | { 0x06, "UE unreachable" }, |
462 | | { 0x07, "Message not compatible with the protocol state" }, |
463 | | { 0x08, "Missing mandatory information element" }, |
464 | | { 0x09, "Invalid mandatory information" }, |
465 | | { 0x0a, "Conditional information element error" }, |
466 | | { 0x0b, "Semantically incorrect message" }, |
467 | | { 0x0c, "Message unknown" }, |
468 | | { 0x0d, "Mobile terminating CS fallback call rejected by the user" }, |
469 | | { 0x0e, "UE temporarily unreachable" }, |
470 | | { 0, NULL } |
471 | | }; |
472 | | |
473 | | static value_string_ext sgsap_sgs_cause_values_ext = VALUE_STRING_EXT_INIT(sgsap_sgs_cause_values); |
474 | | |
475 | | static uint16_t |
476 | | de_sgsap_sgs_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
477 | 0 | { |
478 | 0 | uint32_t curr_offset; |
479 | 0 | uint8_t oct; |
480 | |
|
481 | 0 | curr_offset = offset; |
482 | |
|
483 | 0 | proto_tree_add_item(tree, hf_sgsap_sgs_cause, tvb, offset, 1, ENC_BIG_ENDIAN); |
484 | 0 | if (add_string) { |
485 | 0 | oct = tvb_get_uint8(tvb, curr_offset); |
486 | 0 | snprintf(add_string, string_len, " - %s", val_to_str_ext_const(oct, &sgsap_sgs_cause_values_ext, "Reserved")); |
487 | 0 | } |
488 | 0 | curr_offset++; |
489 | |
|
490 | 0 | return curr_offset-offset; |
491 | 0 | } |
492 | | /* |
493 | | * 9.4.19 SS code |
494 | | * The coding of the SS code value is according to SS-Code as specified in |
495 | | * subclause 17.7.5 of 3GPP TS 29.002 [15] |
496 | | * ( packet-nas_eps.c) |
497 | | */ |
498 | | /* |
499 | | * 9.4.20 TMSI |
500 | | * See subclause 18.4.23 in 3GPP TS 29.018 [16]. |
501 | | * (packet-gsm_a_bssmap.c) |
502 | | */ |
503 | | |
504 | | /* |
505 | | * 9.4.21 TMSI status |
506 | | * |
507 | | * See subclause 18.4.24 in 3GPP TS 29.018 [16]. |
508 | | * (packet-gsm_a_gm.c) |
509 | | */ |
510 | | /* |
511 | | * 9.4.21a Tracking Area Identity |
512 | | * Octets 3 to 7 contain the value part of the Tracking Area Identity information element defined in 3GPP TS 24.301 [14] |
513 | | * (starting with octet 2, i.e. not including 3GPP TS 24.301 IEI) |
514 | | * (packet-nas_eps.c) |
515 | | */ |
516 | | /* |
517 | | * 9.4.21b UE Time Zone |
518 | | * The coding of the UE Time Zone value is according to value part of the Time Zone information element as specified |
519 | | * in subclause 10.5.3.8 of 3GPP TS 24.008 [8] (i.e. not including 3GPP TS 24.008 IEI) |
520 | | * (packet-gsm_a_dtap.c) |
521 | | */ |
522 | | /* |
523 | | * 9.4.21c UE EMM mode |
524 | | */ |
525 | | static const value_string sgsap_ue_emm_mode_values[] = { |
526 | | { 0x00, "EMM-IDLE" }, |
527 | | { 0x01, "EMM-CONNECTED" }, |
528 | | { 0, NULL } |
529 | | }; |
530 | | |
531 | | static uint16_t |
532 | | de_sgsap_ue_emm_mode(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
533 | 0 | { |
534 | 0 | uint32_t curr_offset; |
535 | |
|
536 | 0 | curr_offset = offset; |
537 | |
|
538 | 0 | proto_tree_add_item(tree, hf_sgsap_ue_emm_mode, tvb, offset, 1, ENC_BIG_ENDIAN); |
539 | 0 | curr_offset += 1; |
540 | |
|
541 | 0 | return curr_offset-offset; |
542 | 0 | } |
543 | | /* |
544 | | * 9.4.22 VLR name |
545 | | */ |
546 | | static uint16_t |
547 | | de_sgsap_vlr_name(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
548 | 0 | { |
549 | 0 | unsigned name_len; |
550 | 0 | uint8_t *fqdn = NULL; |
551 | | |
552 | | /* The VLR name information element specifies the VLR name and is coded as shown in figure 9.4.22.1. |
553 | | * Octets 3 through n contain the VLR name in the form of a fully qualified domain name (FQDN) |
554 | | * as specified in IETF RFC 1035 [21]. |
555 | | */ |
556 | 0 | if (len > 0) { |
557 | 0 | name_len = tvb_get_uint8(tvb, offset); |
558 | |
|
559 | 0 | if (name_len < 0x20) { |
560 | 0 | fqdn = tvb_get_string_enc(pinfo->pool, tvb, offset, len, ENC_APN_STR); |
561 | 0 | } else{ |
562 | 0 | fqdn = tvb_get_string_enc(pinfo->pool, tvb, offset, len, ENC_ASCII); |
563 | 0 | } |
564 | 0 | proto_tree_add_string(tree, hf_sgsap_vlr_name, tvb, offset, len, fqdn); |
565 | 0 | if (add_string) |
566 | 0 | snprintf(add_string, string_len, " - %s", fqdn); |
567 | 0 | } |
568 | |
|
569 | 0 | return len; |
570 | 0 | } |
571 | | |
572 | | /* |
573 | | * 9.4.23 Channel needed |
574 | | * See subclause 18.4.2 in 3GPP TS 29.018 [16]. |
575 | | * The rest of the information element is coded as the IEI part and the |
576 | | * value part of the Channel Needed IE defined in 3GPP TS 44.018 |
577 | | * (packet-gsm_a_bssmap.c) |
578 | | */ |
579 | | /* |
580 | | * 9.4.24 eMLPP priority |
581 | | * See subclause 18.4.4 in 3GPP TS 29.018 [16]. |
582 | | * The rest of the information element is coded as the value part of |
583 | | * the eMLPP-Priority IE defined in 3GPP TS 48.008 (not including |
584 | | * 3GPP TS 48.008 IEI and 3GPP TS 48.008 length indicator). |
585 | | * (packet-gsm_a_bssmap.c) |
586 | | */ |
587 | | |
588 | | /* |
589 | | * |
590 | | */ |
591 | | static uint16_t |
592 | | de_sgsap_add_paging_ind(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
593 | 0 | { |
594 | | /* Octet 3 0 0 0 0 0 0 0 CSRI */ |
595 | 0 | proto_tree_add_item(tree, hf_sgsap_csri, tvb, offset, 1, ENC_BIG_ENDIAN); |
596 | |
|
597 | 0 | return len; |
598 | 0 | } |
599 | | |
600 | | #if 0 |
601 | | Reuse GSM_A_PDU_TYPE_GM, DE_NET_RES_ID_CONT |
602 | | /* |
603 | | * 9.4.26 TMSI based NRI container |
604 | | */ |
605 | | static uint16_t |
606 | | de_sgsap_tmsi_based_nri_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
607 | | { |
608 | | |
609 | | /* See subclause 18.4.28 in 3GPP TS 29.018 [16]. |
610 | | * Which says The TMSI based NRI container value value consists of 10 bits which correspond to bits 23 to 14 of the valid TMSI |
611 | | * (3GPP TS 23.236 and |
612 | | * Octet 3 and Octet 4 The rest of the information element is coded as the value part of the Network resource identifier container IE |
613 | | * defined in 3GPP TS 24.008. |
614 | | */ |
615 | | return len; |
616 | | } |
617 | | #endif |
618 | | /* |
619 | | * 9.4.27 Selected CS domain operator |
620 | | */ |
621 | | static uint16_t |
622 | | de_sgsap_selected_cs_dmn_op(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
623 | 0 | { |
624 | 0 | proto_item *item; |
625 | 0 | proto_tree *sub_tree; |
626 | | /* Coded as octets 2 to 4 of the Location Area Identification IE, |
627 | | * defined in 3GPP TS 24.008 [8] (not including 3GPP TS 24.008 IEI |
628 | | * and LAC).(10.5.1.3 Location Area Identification) |
629 | | * MCC digit 2 MCC digit 1 octet 2 |
630 | | * MNC digit 3 MCC digit 3 octet 3 |
631 | | * MNC digit 2 MNC digit 1 octet 4 |
632 | | */ |
633 | 0 | item = proto_tree_add_item(tree, hf_sgsap_sel_cs_dmn_op, tvb, offset, 1, ENC_NA); |
634 | 0 | sub_tree = proto_item_add_subtree(item, ett_sgsap_sel_cs_dmn_op); |
635 | |
|
636 | 0 | dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, sub_tree, offset, E212_LAI, true); |
637 | |
|
638 | 0 | return len; |
639 | 0 | } |
640 | | |
641 | | static const value_string sgsap_elem_strings[] = { |
642 | | { DE_SGSAP_IMSI, "IMSI" }, /* 9.4.6 */ |
643 | | { DE_SGSAP_VLR_NAME, "VLR name" }, /* 9.4.22 */ |
644 | | { DE_SGSAP_TMSI, "TMSI" }, /* 9.4.20 */ |
645 | | { DE_SGSAP_LOC_AREA_ID, "Location area identifier" }, /* 9.4.11 */ |
646 | | { DE_SGSAP_CH_NEEDED, "Channel Needed" }, /* 9.4.23 */ |
647 | | { DE_SGSAP_EMLPP_PRIO, "eMLPP Priority" }, /* 9.4.24 */ |
648 | | { DE_SGSAP_TMSI_STATUS, "TMSI status" }, /* 9.4.21 */ |
649 | | { DE_SGSAP_SGS_CAUSE, "SGs cause" }, /* 9.4.18 */ |
650 | | { DE_SGSAP_MME_NAME, "MME name" }, /* 9.4.13 */ |
651 | | { DE_SGSAP_EPS_LOC_UPD_TYPE, "EPS location update type" }, /* 9.4.2 */ |
652 | | { DE_SGSAP_GLOBAL_CN_ID, "Global CN-Id" }, /* 9.4.4 */ |
653 | | |
654 | | { DE_SGSAP_UDEF_11, "Undefined" }, /* */ |
655 | | { DE_SGSAP_UDEF_12, "Undefined" }, /* */ |
656 | | |
657 | | { DE_SGSAP_MID, "Mobile identity" }, /* 9.4.14 */ |
658 | | { DE_SGSAP_REJ_CAUSE, "Reject cause" }, /* 9.4.16 */ |
659 | | { DE_SGSAP_IMSI_DET_EPS, "IMSI detach from EPS service type" }, /* 9.4.7 */ |
660 | | { DE_SGSAP_IMSI_DET_NON_EPS, "IMSI detach from non-EPS service type" }, /* 9.4.8 */ |
661 | | |
662 | | { DE_SGSAP_IMEISV, "IMEISV" }, /* 9.4.5 */ |
663 | | { DE_SGSAP_NAS_MSG_CONTAINER, "NAS message container" }, /* 9.4.15 */ |
664 | | { DE_SGSAP_MM_INFO, "MM information" }, /* 9.4.12 */ |
665 | | |
666 | | { DE_SGSAP_UDEF_20, "Undefined" }, /* */ |
667 | | { DE_SGSAP_UDEF_21, "Undefined" }, /* */ |
668 | | { DE_SGSAP_UDEF_22, "Undefined" }, /* */ |
669 | | |
670 | | { DE_SGSAP_ERR_MSG, "Erroneous message" }, /* 9.4.3 */ |
671 | | { DE_SGSAP_CLI, "CLI" }, /* 9.4.1 */ |
672 | | { DE_SGSAP_LCS_CLIENT_ID, "LCS client identity" }, /* 9.4.9 */ |
673 | | { DE_SGSAP_LCS_INDIC, "LCS indicator" }, /* 9.4.10 */ |
674 | | { DE_SGSAP_SS_CODE, "SS code" }, /* 9.4.19 */ |
675 | | { DE_SGSAP_SERV_INDIC, "Service indicator" }, /* 9.4.17 */ |
676 | | { DE_SGSAP_UE_TZ, "UE Time Zone" }, /* 9.4.21b */ |
677 | | { DE_SGSAP_MSC_2, "Mobile Station Classmark 2" }, /* 9.4.14a */ |
678 | | { DE_SGSAP_TAID, "Tracking Area Identity" }, /* 9.4.21a */ |
679 | | { DE_SGSAP_ECGI, "E-UTRAN Cell Global Identity" }, /* 9.4.3a */ |
680 | | { DE_SGSAP_UE_EMM_MODE, "UE EMM mode" }, /* 9.4.21c */ |
681 | | { DE_SGSAP_ADD_PAGING_IND, "Additional paging indicators" }, /* 9.4.25 */ |
682 | | { DE_SGSAP_TMSI_BASED_NRI_CONT, "TMSI based NRI container" }, /* 9.4.26 */ |
683 | | { DE_SGSAP_SELECTED_CS_DMN_OP, "Selected CS domain operator" }, /* 9.4.27 */ |
684 | | { 0, NULL } |
685 | | }; |
686 | | value_string_ext sgsap_elem_strings_ext = VALUE_STRING_EXT_INIT(sgsap_elem_strings); |
687 | | |
688 | 546 | #define NUM_SGSAP_ELEM array_length(sgsap_elem_strings) |
689 | | int ett_sgsap_elem[NUM_SGSAP_ELEM]; |
690 | | #if 0 |
691 | | This enum has been moved to packet-gsm_a_common to |
692 | | make it possible to use element dissecton from this dissector |
693 | | in other dissectors. |
694 | | It is left here as a comment for easier reference. |
695 | | |
696 | | Note this enum must be of the same size as the element decoding list |
697 | | |
698 | | typedef enum |
699 | | { |
700 | | |
701 | | DE_SGSAP_IMSI, /. 9.4.6 IMSI./ |
702 | | DE_SGSAP_VLR_NAME, /. 9.4.22 VLR name./ |
703 | | DE_SGSAP_TMSI, /. 9.4.20 TMSI ./ |
704 | | DE_SGSAP_LOC_AREA_ID, /. 9.4.11 Location area identifier ./ |
705 | | DE_SGSAP_CH_NEEDED, /. 9.4.23 Channel Needed ./ |
706 | | DE_SGSAP_EMLPP_PRIO, /. 9.4.24 eMLPP Priority./ |
707 | | DE_SGSAP_TMSI_STATUS, /. 9.4.21 TMSI status ./ |
708 | | DE_SGSAP_SGS_CAUSE, /. 9.4.18 SGs cause./ |
709 | | DE_SGSAP_MME_NAME, /. 9.4.13 MME name./ |
710 | | DE_SGSAP_EPS_LOC_UPD_TYPE, /. 9.4.2 EPS location update type./ |
711 | | DE_SGSAP_GLOBAL_CN_ID, /. 9.4.4 Global CN-Id./ |
712 | | |
713 | | DE_SGSAP_UDEF_11, /. Undefined ./ |
714 | | DE_SGSAP_UDEF_12, /. Undefined ./ |
715 | | |
716 | | DE_SGSAP_MID, /. 9.4.14 Mobile identity./ |
717 | | DE_SGSAP_REJ_CAUSE, /. 9.4.16 Reject cause ./ |
718 | | DE_SGSAP_IMSI_DET_EPS, /. 9.4.7 IMSI detach from EPS service type ./ |
719 | | DE_SGSAP_IMSI_DET_NON_EPS, /. 9.4.8 IMSI detach from non-EPS service type ./ |
720 | | |
721 | | DE_SGSAP_IMEISV, /. 9.4.5 IMEISV ./ |
722 | | DE_SGSAP_NAS_MSG_CONTAINER, /. 9.4.15 NAS message container./ |
723 | | DE_SGSAP_MM_INFO, /. 9.4.12 MM information./ |
724 | | |
725 | | DE_SGSAP_UDEF_20, /. Undefined ./ |
726 | | DE_SGSAP_UDEF_21, /. Undefined ./ |
727 | | DE_SGSAP_UDEF_22, /. Undefined ./ |
728 | | |
729 | | DE_SGSAP_ERR_MSG, /. 9.4.3 Erroneous message./ |
730 | | DE_SGSAP_CLI, /. 9.4.1 CLI ./ |
731 | | DE_SGSAP_LCS_CLIENT_ID, /. 9.4.9 LCS client identity ./ |
732 | | DE_SGSAP_LCS_INDIC, /. 9.4.10 LCS indicator ./ |
733 | | DE_SGSAP_SS_CODE, /. 9.4.19 SS code ./ |
734 | | DE_SGSAP_SERV_INDIC, /. 9.4.17 Service indicator ./ |
735 | | DE_SGSAP_UE_TZ, /. 9.4.21b UE Time Zone ./ |
736 | | DE_SGSAP_MSC_2, /. 9.4.14a Mobile Station Classmark 2 ./ |
737 | | DE_SGSAP_TAID, /. 9.4.21a Tracking Area Identity ./ |
738 | | DE_SGSAP_ECGI, /. 9.4.3a E-UTRAN Cell Global Identity ./ |
739 | | DE_SGSAP_UE_EMM_MODE, /. 9.4.21c UE EMM mode./ |
740 | | DE_SGSAP_ADD_PAGING_IND, /. 9.4.25 Additional paging indicators ./ |
741 | | DE_SGSAP_TMSI_BASED_NRI_CONT, /. 9.4.26 TMSI based NRI container ./ |
742 | | DE_SGSAP_SELECTED_CS_DMN_OP, /. 9.4.27 Selected CS domain operator ./ |
743 | | |
744 | | DE_SGAP_NONE /. NONE ./ |
745 | | } |
746 | | sgsap_elem_idx_t; |
747 | | #endif /* 0 */ |
748 | | |
749 | | uint16_t (*sgsap_elem_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len, char *add_string, int string_len) = { |
750 | | NULL/*DE_SGSAP_IMSI*/, /* 9.4.6 IMSI*/ |
751 | | de_sgsap_vlr_name, /* 9.4.22 VLR name*/ |
752 | | NULL/*DE_SGSAP_TMSI*/, /* 9.4.20 TMSI */ |
753 | | NULL/*DE_SGSAP_LOC_AREA_ID*/, /* 9.4.11 Location area identifier */ |
754 | | NULL/*DE_SGSAP_CH_NEEDED*/, /* 9.4.23 Channel Needed */ |
755 | | NULL/*DE_SGSAP_EMLPP_PRIO*/, /* 9.4.24 eMLPP Priority*/ |
756 | | NULL/*DE_SGSAP_TMSI_STATUS*/, /* 9.4.21 TMSI status */ |
757 | | de_sgsap_sgs_cause, /* 9.4.18 SGs cause*/ |
758 | | de_sgsap_mme_name, /* 9.4.13 MME name*/ |
759 | | de_sgsap_eps_loc_upd_type, /* 9.4.2 EPS location update type*/ |
760 | | de_sgsap_g_cn_id, /* 9.4.4 Global CN-Id*/ |
761 | | |
762 | | NULL/*DE_SGSAP_UDEF_11*/, /* Undefined */ |
763 | | NULL/*DE_SGSAP_UDEF_12*/, /* Undefined */ |
764 | | |
765 | | NULL/*DE_SGSAP_MID*/, /* 9.4.14 Mobile identity*/ |
766 | | NULL/*DE_SGSAP_REJ_CAUSE*/, /* 9.4.16 Reject cause */ |
767 | | de_sgsap_imsi_det_eps, /* 9.4.7 IMSI detach from EPS service type */ |
768 | | de_sgsap_imsi_det_non_eps, /* 9.4.8 IMSI detach from non-EPS service type */ |
769 | | |
770 | | de_sgsap_imeisv, /* 9.4.5 IMEISV */ |
771 | | de_sgsap_nas_msg_container, /* 9.4.15 NAS message container*/ |
772 | | de_sgsap_mm_info, /* 9.4.12 MM information*/ |
773 | | |
774 | | NULL/*DE_SGSAP_UDEF_20*/, /* Undefined */ |
775 | | NULL/*DE_SGSAP_UDEF_21*/, /* Undefined */ |
776 | | NULL/*DE_SGSAP_UDEF_22*/, /* Undefined */ |
777 | | |
778 | | de_sgsap_err_msg, /* 9.4.3 Erroneous message*/ |
779 | | NULL/*DE_SGSAP_CLI*/, /* 9.4.1 CLI */ |
780 | | NULL/*DE_SGSAP_LCS_CLIENT_ID*/, /* 9.4.9 LCS client identity */ |
781 | | de_sgsap_lcs_indic, /* 9.4.10 LCS indicator */ |
782 | | NULL/*DE_SGSAP_SS_CODE*/, /* 9.4.19 SS code */ |
783 | | de_sgsap_serv_indic, /* 9.4.17 Service indicator */ |
784 | | NULL/*DE_SGSAP_UE_TZ*/, /* 9.4.21b UE Time Zone */ |
785 | | NULL/*DE_SGSAP_MSC_2*/, /* 9.4.14a Mobile Station Classmark 2 */ |
786 | | NULL/*DE_SGSAP_TAID*/, /* 9.4.21a Tracking Area Identity */ |
787 | | de_sgsap_ecgi, /* 9.4.3a E-UTRAN Cell Global Identity */ |
788 | | de_sgsap_ue_emm_mode, /* 9.4.21c UE EMM mode*/ |
789 | | de_sgsap_add_paging_ind, /* 9.4.25 Additional paging indicators */ |
790 | | NULL/*DE_SGSAP_TMSI_BASED_NRI_CONT */, /* 9.4.26 TMSI based NRI container (Reuse GSM_A_PDU_TYPE_GM, DE_NET_RES_ID_CONT */ |
791 | | de_sgsap_selected_cs_dmn_op, /* 9.4.27 Selected CS domain operator */ |
792 | | NULL, /* NONE */ |
793 | | }; |
794 | | |
795 | | /* MESSAGE FUNCTIONS */ |
796 | | |
797 | | /* |
798 | | * 8.1 SGsAP-ALERT-ACK message |
799 | | */ |
800 | | static void |
801 | | sgsap_alert_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
802 | 0 | { |
803 | 0 | uint32_t curr_offset; |
804 | 0 | uint32_t consumed; |
805 | 0 | unsigned curr_len; |
806 | |
|
807 | 0 | curr_offset = offset; |
808 | 0 | curr_len = len; |
809 | | |
810 | | /* IMSI IMSI 9.4.6 M TLV 6-10 */ |
811 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
812 | |
|
813 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
814 | 0 | } |
815 | | |
816 | | /* |
817 | | * 8.2 SGsAP-ALERT-REJECT message |
818 | | */ |
819 | | static void |
820 | | sgsap_alert_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
821 | 0 | { |
822 | 0 | uint32_t curr_offset; |
823 | 0 | uint32_t consumed; |
824 | 0 | unsigned curr_len; |
825 | |
|
826 | 0 | curr_offset = offset; |
827 | 0 | curr_len = len; |
828 | | |
829 | | /* IMSI IMSI 9.4.6 M TLV 6-10 */ |
830 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
831 | | /* SGs Cause SGs cause 9.4.18 M TLV 3 */ |
832 | 0 | ELEM_MAND_TLV(0x08, SGSAP_PDU_TYPE, DE_SGSAP_SGS_CAUSE, NULL, ei_sgsap_missing_mandatory_element); |
833 | |
|
834 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
835 | 0 | } |
836 | | |
837 | | /* |
838 | | * 8.3 SGsAP-ALERT-REQUEST message |
839 | | */ |
840 | | static void |
841 | | sgsap_alert_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
842 | 0 | { |
843 | 0 | uint32_t curr_offset; |
844 | 0 | uint32_t consumed; |
845 | 0 | unsigned curr_len; |
846 | |
|
847 | 0 | curr_offset = offset; |
848 | 0 | curr_len = len; |
849 | | |
850 | | /* IMSI IMSI 9.4.6 M TLV 6-10 */ |
851 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
852 | |
|
853 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
854 | 0 | } |
855 | | |
856 | | /* |
857 | | * 8.4 SGsAP-DOWNLINK-UNITDATA message |
858 | | */ |
859 | | static void |
860 | | sgsap_dl_unitdata(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
861 | 0 | { |
862 | 0 | uint32_t curr_offset; |
863 | 0 | uint32_t consumed; |
864 | 0 | unsigned curr_len; |
865 | |
|
866 | 0 | curr_offset = offset; |
867 | 0 | curr_len = len; |
868 | | |
869 | | |
870 | | /* IMSI IMSI 9.4.6 M TLV 6-10 */ |
871 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
872 | | /* NAS message container NAS message container 9.4.15 M TLV 4-253 */ |
873 | 0 | ELEM_MAND_TLV(0x16, SGSAP_PDU_TYPE, DE_SGSAP_NAS_MSG_CONTAINER, NULL, ei_sgsap_missing_mandatory_element); |
874 | |
|
875 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
876 | 0 | } |
877 | | |
878 | | /* |
879 | | * 8.5 SGsAP-EPS-DETACH-ACK message |
880 | | */ |
881 | | |
882 | | static void |
883 | | sgsap_eps_det_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
884 | 0 | { |
885 | 0 | uint32_t curr_offset; |
886 | 0 | uint32_t consumed; |
887 | 0 | unsigned curr_len; |
888 | |
|
889 | 0 | curr_offset = offset; |
890 | 0 | curr_len = len; |
891 | | |
892 | | /* IMSI IMSI 9.4.6 M TLV 6-10 */ |
893 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
894 | |
|
895 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
896 | 0 | } |
897 | | /* |
898 | | * 8.6 SGsAP-EPS-DETACH-INDICATION message |
899 | | */ |
900 | | |
901 | | static void |
902 | | sgsap_eps_det_ind(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
903 | 0 | { |
904 | 0 | uint32_t curr_offset; |
905 | 0 | uint32_t consumed; |
906 | 0 | unsigned curr_len; |
907 | |
|
908 | 0 | curr_offset = offset; |
909 | 0 | curr_len = len; |
910 | | |
911 | | /* IMSI IMSI 9.4.6 M TLV 6-10 */ |
912 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
913 | | /* MME name MME name 9.4.13 M TLV 57 */ |
914 | 0 | ELEM_MAND_TLV(0x09, SGSAP_PDU_TYPE, DE_SGSAP_MME_NAME, NULL, ei_sgsap_missing_mandatory_element); |
915 | | /* IMSI detach from EPS service type IMSI detach from EPS service type 9.4.7 M TLV 3 */ |
916 | 0 | ELEM_MAND_TLV(0x10, SGSAP_PDU_TYPE, DE_SGSAP_IMSI_DET_EPS, NULL, ei_sgsap_missing_mandatory_element); |
917 | |
|
918 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
919 | 0 | } |
920 | | |
921 | | /* |
922 | | * 8.7 SGsAP-IMSI-DETACH-ACK message |
923 | | */ |
924 | | static void |
925 | | sgsap_imsi_det_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
926 | 0 | { |
927 | 0 | uint32_t curr_offset; |
928 | 0 | uint32_t consumed; |
929 | 0 | unsigned curr_len; |
930 | |
|
931 | 0 | curr_offset = offset; |
932 | 0 | curr_len = len; |
933 | | |
934 | | /* IMSI IMSI 9.4.6 M TLV 6-10 */ |
935 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
936 | |
|
937 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
938 | 0 | } |
939 | | /* |
940 | | * 8.8 SGsAP-IMSI-DETACH-INDICATION message |
941 | | */ |
942 | | static void |
943 | | sgsap_imsi_det_ind(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
944 | 0 | { |
945 | 0 | uint32_t curr_offset; |
946 | 0 | uint32_t consumed; |
947 | 0 | unsigned curr_len; |
948 | |
|
949 | 0 | curr_offset = offset; |
950 | 0 | curr_len = len; |
951 | | |
952 | | /* IMSI IMSI 9.4.6 M TLV 6-10 */ |
953 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
954 | | /* MME name MME name 9.4.13 M TLV 57 */ |
955 | 0 | ELEM_MAND_TLV(0x09, SGSAP_PDU_TYPE, DE_SGSAP_MME_NAME, NULL, ei_sgsap_missing_mandatory_element); |
956 | | /* IMSI Detach from non-EPS service type IMSI detach from non-EPS service type 9.4.8 M TLV 3 */ |
957 | 0 | ELEM_MAND_TLV(0x11, SGSAP_PDU_TYPE, DE_SGSAP_IMSI_DET_NON_EPS, NULL, ei_sgsap_missing_mandatory_element); |
958 | |
|
959 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
960 | 0 | } |
961 | | |
962 | | /* |
963 | | * 8.9 SGsAP-LOCATION-UPDATE-ACCEPT message |
964 | | */ |
965 | | static void |
966 | | sgsap_imsi_loc_update_acc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
967 | 0 | { |
968 | 0 | uint32_t curr_offset; |
969 | 0 | uint32_t consumed; |
970 | 0 | unsigned curr_len; |
971 | |
|
972 | 0 | curr_offset = offset; |
973 | 0 | curr_len = len; |
974 | | |
975 | | /* IMSI IMSI 9.4.6 M TLV 6-10 */ |
976 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
977 | | /* Location area identifier Location area identifier 9.4.11 M TLV 7 */ |
978 | 0 | ELEM_MAND_TLV(0x04, GSM_A_PDU_TYPE_COMMON, DE_LAI, NULL, ei_sgsap_missing_mandatory_element); |
979 | | /* New TMSI, or IMSI Mobile identity 9.4.14 O TLV 6-10 */ |
980 | 0 | ELEM_OPT_TLV(0x0e, GSM_A_PDU_TYPE_COMMON, DE_MID, " - New TMSI, or IMSI"); |
981 | |
|
982 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
983 | 0 | } |
984 | | |
985 | | /* |
986 | | * 8.10 SGsAP-LOCATION-UPDATE-REJECT message |
987 | | */ |
988 | | static void |
989 | | sgsap_imsi_loc_update_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
990 | 0 | { |
991 | 0 | uint32_t curr_offset; |
992 | 0 | uint32_t consumed; |
993 | 0 | unsigned curr_len; |
994 | |
|
995 | 0 | curr_offset = offset; |
996 | 0 | curr_len = len; |
997 | | |
998 | | /* IMSI IMSI 9.4.6 M TLV 6-10 */ |
999 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
1000 | | /* Reject cause Reject cause 9.4.16 M TLV 3 */ |
1001 | 0 | ELEM_MAND_TLV(0x0f, GSM_A_PDU_TYPE_DTAP, DE_REJ_CAUSE, NULL, ei_sgsap_missing_mandatory_element); |
1002 | | /* Location area identifier Location area identifier 9.4.11 O TLV 7 */ |
1003 | 0 | ELEM_OPT_TLV(0x04, GSM_A_PDU_TYPE_COMMON, DE_LAI, NULL); |
1004 | |
|
1005 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
1006 | 0 | } |
1007 | | |
1008 | | /* |
1009 | | * 8.11 SGsAP-LOCATION-UPDATE-REQUEST message |
1010 | | */ |
1011 | | |
1012 | | static void |
1013 | | sgsap_imsi_loc_update_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
1014 | 0 | { |
1015 | 0 | uint32_t curr_offset; |
1016 | 0 | uint32_t consumed; |
1017 | 0 | unsigned curr_len; |
1018 | |
|
1019 | 0 | curr_offset = offset; |
1020 | 0 | curr_len = len; |
1021 | | |
1022 | | /* IMSI IMSI 9.4.6 M TLV 6-10 */ |
1023 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
1024 | | /* MME name MME name 9.4.13 M TLV 57 */ |
1025 | 0 | ELEM_MAND_TLV(0x09, SGSAP_PDU_TYPE, DE_SGSAP_MME_NAME, NULL, ei_sgsap_missing_mandatory_element); |
1026 | | /* EPS location update type EPS location update type 9.4.2 M TLV 3 */ |
1027 | 0 | ELEM_MAND_TLV(0x0a, SGSAP_PDU_TYPE, DE_SGSAP_EPS_LOC_UPD_TYPE, NULL, ei_sgsap_missing_mandatory_element); |
1028 | | /* New location area identifier Location area identifier 9.4.11 M TLV 7 */ |
1029 | 0 | ELEM_MAND_TLV(0x04, GSM_A_PDU_TYPE_COMMON, DE_LAI, NULL, ei_sgsap_missing_mandatory_element); |
1030 | | /* Old location area identifier Location area identifier 9.4.11 O TLV 7 */ |
1031 | 0 | ELEM_OPT_TLV(0x04, GSM_A_PDU_TYPE_COMMON, DE_LAI, " - Old location area identifier"); |
1032 | | /* TMSI status TMSI status 9.4.21 O TLV 3 */ |
1033 | 0 | ELEM_OPT_TLV( 0x07 , GSM_A_PDU_TYPE_GM, DE_TMSI_STAT , NULL ); |
1034 | | /* IMEISV IMEISV 9.4.5 O TLV 10 */ |
1035 | 0 | ELEM_OPT_TLV(0x15, SGSAP_PDU_TYPE, DE_SGSAP_IMEISV, NULL); |
1036 | | /* TAI Tracking Area Identity 9.4.21a O TLV 7 */ |
1037 | 0 | ELEM_OPT_TLV(0x23, NAS_PDU_TYPE_EMM, DE_EMM_TRAC_AREA_ID, NULL); |
1038 | | /* E-CGI E-UTRAN Cell Global Identity 9.4.3a O TLV 9 */ |
1039 | 0 | ELEM_OPT_TLV(0x24, SGSAP_PDU_TYPE, DE_SGSAP_ECGI, NULL); |
1040 | | /* TMSI based NRI container TMSI based NRI container 9.4.26 O TLV 4 */ |
1041 | 0 | ELEM_OPT_TLV(0x27, GSM_A_PDU_TYPE_GM, DE_NET_RES_ID_CONT, " - TMSI based NRI container"); |
1042 | | /* Selected CS domain operator Selected CS domain operator 9.4.27 O TLV 5 */ |
1043 | 0 | ELEM_OPT_TLV(0x28, SGSAP_PDU_TYPE, DE_SGSAP_SELECTED_CS_DMN_OP, NULL); |
1044 | |
|
1045 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
1046 | 0 | } |
1047 | | |
1048 | | /* |
1049 | | * 8.12 SGsAP-MM-INFORMATION-REQUEST |
1050 | | */ |
1051 | | static void |
1052 | | sgsap_mm_info_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
1053 | 0 | { |
1054 | 0 | uint32_t curr_offset; |
1055 | 0 | uint32_t consumed; |
1056 | 0 | unsigned curr_len; |
1057 | |
|
1058 | 0 | curr_offset = offset; |
1059 | 0 | curr_len = len; |
1060 | | |
1061 | | /* IMSI IMSI 9.4.6 M TLV 6-10 */ |
1062 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
1063 | | /* MM information MM information 9.4.12 M TLV 3-n */ |
1064 | 0 | ELEM_MAND_TLV(0x17, SGSAP_PDU_TYPE, DE_SGSAP_MM_INFO, NULL, ei_sgsap_missing_mandatory_element); |
1065 | |
|
1066 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
1067 | 0 | } |
1068 | | |
1069 | | /* |
1070 | | * 8.13 SGsAP-PAGING-REJECT message |
1071 | | */ |
1072 | | static void |
1073 | | sgsap_paging_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
1074 | 0 | { |
1075 | 0 | uint32_t curr_offset; |
1076 | 0 | uint32_t consumed; |
1077 | 0 | unsigned curr_len; |
1078 | |
|
1079 | 0 | curr_offset = offset; |
1080 | 0 | curr_len = len; |
1081 | | |
1082 | | /* IMSI IMSI 9.4.6 M TLV 6-10 */ |
1083 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
1084 | | /* SGs Cause SGs Cause 9.4.18 M TLV 3 */ |
1085 | 0 | ELEM_MAND_TLV(0x08, SGSAP_PDU_TYPE, DE_SGSAP_SGS_CAUSE, NULL, ei_sgsap_missing_mandatory_element); |
1086 | |
|
1087 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
1088 | 0 | } |
1089 | | /* |
1090 | | * 8.14 SGsAP-PAGING-REQUEST message |
1091 | | */ |
1092 | | static void |
1093 | | sgsap_paging_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
1094 | 0 | { |
1095 | 0 | uint32_t curr_offset; |
1096 | 0 | uint32_t consumed; |
1097 | 0 | unsigned curr_len; |
1098 | |
|
1099 | 0 | curr_offset = offset; |
1100 | 0 | curr_len = len; |
1101 | | |
1102 | | /* IMSI IMSI 9.4.6 M TLV 6-10 */ |
1103 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
1104 | | /* VLR name VLR name 9.4.22 M TLV 3-n */ |
1105 | 0 | ELEM_MAND_TLV(0x02, SGSAP_PDU_TYPE, DE_SGSAP_VLR_NAME, NULL, ei_sgsap_missing_mandatory_element); |
1106 | | /* Service indicator Service indicator 9.4.17 M TLV 3 */ |
1107 | 0 | ELEM_MAND_TLV(0x20, SGSAP_PDU_TYPE, DE_SGSAP_SERV_INDIC, NULL, ei_sgsap_missing_mandatory_element); |
1108 | | /* TMSI TMSI 9.4.20 O TLV 6 */ |
1109 | 0 | ELEM_OPT_TLV(0x03, GSM_A_PDU_TYPE_BSSMAP, BE_TMSI, NULL); |
1110 | | /* CLI CLI 9.4.1 O TLV 3-14 */ |
1111 | 0 | ELEM_OPT_TLV(0x1c, GSM_A_PDU_TYPE_DTAP, DE_CLG_PARTY_BCD_NUM, " - CLI"); |
1112 | | /* Location area identifier Location area identifier 9.4.11 O TLV 7 */ |
1113 | 0 | ELEM_OPT_TLV(0x04, GSM_A_PDU_TYPE_COMMON, DE_LAI, NULL); |
1114 | | /* Global CN-Id Global CN-Id 9.4.4 O TLV 7 */ |
1115 | 0 | ELEM_OPT_TLV(0x0b, SGSAP_PDU_TYPE, DE_SGSAP_GLOBAL_CN_ID, NULL); |
1116 | | /* SS code SS code 9.4.19 O TLV 3 */ |
1117 | 0 | ELEM_OPT_TLV(0x1f, NAS_PDU_TYPE_EMM, DE_EMM_SS_CODE, NULL); |
1118 | | /* LCS indicator LCS indicator 9.4.10 O TLV 3 */ |
1119 | 0 | ELEM_OPT_TLV(0x1e, SGSAP_PDU_TYPE, DE_SGSAP_LCS_INDIC, NULL); |
1120 | | /* LCS client identity LCS client identity 9.4.9 O TLV 3-n */ |
1121 | 0 | ELEM_OPT_TLV(0x1d, NAS_PDU_TYPE_EMM, DE_EMM_LCS_CLIENT_ID, NULL); |
1122 | | /* Channel needed Channel needed 9.4.23 O TLV 3 */ |
1123 | 0 | ELEM_OPT_TLV(0x05, GSM_A_PDU_TYPE_BSSMAP, BE_CHAN_NEEDED, NULL); |
1124 | | /* eMLPP Priority eMLPP Priority 9.4.24 O TLV 3 */ |
1125 | 0 | ELEM_OPT_TLV(0x06, GSM_A_PDU_TYPE_BSSMAP, BE_EMLPP_PRIO, NULL); |
1126 | | /* Additional paging indicators Additional paging indicators 9.4.25 O TLV 3 */ |
1127 | 0 | ELEM_OPT_TLV(0x26, SGSAP_PDU_TYPE, DE_SGSAP_ADD_PAGING_IND, NULL); |
1128 | |
|
1129 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
1130 | 0 | } |
1131 | | /* |
1132 | | * 8.15 SGsAP-RESET-ACK message |
1133 | | */ |
1134 | | static void |
1135 | | sgsap_reset_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
1136 | 0 | { |
1137 | 0 | uint32_t curr_offset; |
1138 | 0 | uint32_t consumed; |
1139 | 0 | unsigned curr_len; |
1140 | |
|
1141 | 0 | curr_offset = offset; |
1142 | 0 | curr_len = len; |
1143 | | |
1144 | | /* MME name MME name 9.4.13 C TLV 57 */ |
1145 | 0 | ELEM_OPT_TLV(0x09, SGSAP_PDU_TYPE, DE_SGSAP_MME_NAME, NULL); |
1146 | | /* VLR name VLR name 9.4.22 C TLV 3-n */ |
1147 | 0 | ELEM_OPT_TLV(0x02, SGSAP_PDU_TYPE, DE_SGSAP_VLR_NAME, NULL); |
1148 | |
|
1149 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
1150 | 0 | } |
1151 | | |
1152 | | /* |
1153 | | * 8.16 SGsAP-RESET-INDICATION message |
1154 | | */ |
1155 | | static void |
1156 | | sgsap_reset_ind(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
1157 | 0 | { |
1158 | 0 | uint32_t curr_offset; |
1159 | 0 | uint32_t consumed; |
1160 | 0 | unsigned curr_len; |
1161 | |
|
1162 | 0 | curr_offset = offset; |
1163 | 0 | curr_len = len; |
1164 | | |
1165 | | /* MME name MME name 9.4.13 C TLV 57 */ |
1166 | 0 | ELEM_OPT_TLV(0x09, SGSAP_PDU_TYPE, DE_SGSAP_MME_NAME, NULL); |
1167 | | /* VLR name VLR name 9.4.22 C TLV 3-n */ |
1168 | 0 | ELEM_OPT_TLV(0x02, SGSAP_PDU_TYPE, DE_SGSAP_VLR_NAME, NULL); |
1169 | |
|
1170 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
1171 | 0 | } |
1172 | | /* |
1173 | | * 8.17 SGsAP-SERVICE-REQUEST message |
1174 | | */ |
1175 | | static void |
1176 | | sgsap_service_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
1177 | 0 | { |
1178 | 0 | uint32_t curr_offset; |
1179 | 0 | uint32_t consumed; |
1180 | 0 | unsigned curr_len; |
1181 | |
|
1182 | 0 | curr_offset = offset; |
1183 | 0 | curr_len = len; |
1184 | | |
1185 | | /*IMSI IMSI 9.4.6 M TLV 6-10 */ |
1186 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
1187 | | /* Service indicator Service indicator 9.4.17 M TLV 3 */ |
1188 | 0 | ELEM_MAND_TLV(0x20, SGSAP_PDU_TYPE, DE_SGSAP_SERV_INDIC, NULL, ei_sgsap_missing_mandatory_element); |
1189 | | /* IMEISV IMEISV 9.4.5 O TLV 10 */ |
1190 | 0 | ELEM_OPT_TLV(0x15, SGSAP_PDU_TYPE, DE_SGSAP_IMEISV, NULL); |
1191 | | /* UE Time Zone UE Time Zone 9.4.21b O TLV 3 */ |
1192 | 0 | ELEM_OPT_TLV(0x21, GSM_A_PDU_TYPE_DTAP, DE_TIME_ZONE, " - UE Time Zone"); |
1193 | | /* Mobile Station Classmark 2 Mobile Station Classmark 2 9.4.14a O TLV 5 */ |
1194 | 0 | ELEM_OPT_TLV(0x22 , GSM_A_PDU_TYPE_COMMON, DE_MS_CM_2, NULL); |
1195 | | /* TAI Tracking Area Identity 9.4.21a O TLV 7 */ |
1196 | 0 | ELEM_OPT_TLV(0x23, NAS_PDU_TYPE_EMM, DE_EMM_TRAC_AREA_ID, NULL); |
1197 | | /* E-CGI E-UTRAN Cell Global Identity 9.4.3a O TLV 9 */ |
1198 | 0 | ELEM_OPT_TLV(0x24, SGSAP_PDU_TYPE, DE_SGSAP_ECGI, NULL); |
1199 | | /* UE EMM Mode UE EMM mode 9.4.21c O TLV 3 */ |
1200 | 0 | ELEM_OPT_TLV(0x25, SGSAP_PDU_TYPE, DE_SGSAP_UE_EMM_MODE, NULL); |
1201 | |
|
1202 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
1203 | 0 | } |
1204 | | |
1205 | | /* |
1206 | | * 8.18 SGsAP-STATUS message |
1207 | | */ |
1208 | | static void |
1209 | | sgsap_status(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
1210 | 0 | { |
1211 | 0 | uint32_t curr_offset; |
1212 | 0 | uint32_t consumed; |
1213 | 0 | unsigned curr_len; |
1214 | |
|
1215 | 0 | curr_offset = offset; |
1216 | 0 | curr_len = len; |
1217 | | |
1218 | | /* IMSI IMSI 9.4.6 O TLV 6-10 */ |
1219 | 0 | ELEM_OPT_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL); |
1220 | | /* SGs cause SGs cause 9.4.18 M TLV 3 */ |
1221 | 0 | ELEM_MAND_TLV(0x08, SGSAP_PDU_TYPE, DE_SGSAP_SGS_CAUSE, NULL, ei_sgsap_missing_mandatory_element); |
1222 | | /* Erroneous message Erroneous message 9.4.3 M TLV 3-n */ |
1223 | 0 | ELEM_OPT_TLV(0x1b, SGSAP_PDU_TYPE, DE_SGSAP_ERR_MSG, NULL); |
1224 | |
|
1225 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
1226 | 0 | } |
1227 | | |
1228 | | /* |
1229 | | * 8.19 SGsAP-TMSI-REALLOCATION-COMPLETE message |
1230 | | */ |
1231 | | static void |
1232 | | sgsap_tmsi_realloc_comp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
1233 | 0 | { |
1234 | 0 | uint32_t curr_offset; |
1235 | 0 | uint32_t consumed; |
1236 | 0 | unsigned curr_len; |
1237 | |
|
1238 | 0 | curr_offset = offset; |
1239 | 0 | curr_len = len; |
1240 | | |
1241 | | /*IMSI IMSI 9.4.6 M TLV 6-10 */ |
1242 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
1243 | |
|
1244 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
1245 | 0 | } |
1246 | | |
1247 | | /* |
1248 | | * 8.20 SGsAP-UE-ACTIVITY-INDICATION message |
1249 | | */ |
1250 | | static void |
1251 | | sgsap_ue_act_ind(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
1252 | 0 | { |
1253 | 0 | uint32_t curr_offset; |
1254 | 0 | uint32_t consumed; |
1255 | 0 | unsigned curr_len; |
1256 | |
|
1257 | 0 | curr_offset = offset; |
1258 | 0 | curr_len = len; |
1259 | | |
1260 | | /* IMSI IMSI 9.4.6 M TLV 6-10 */ |
1261 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
1262 | |
|
1263 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
1264 | 0 | } |
1265 | | |
1266 | | /* |
1267 | | * 8.21 SGsAP-UE-UNREACHABLE message |
1268 | | */ |
1269 | | static void |
1270 | | sgsap_ue_unreachable(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
1271 | 0 | { |
1272 | 0 | uint32_t curr_offset; |
1273 | 0 | uint32_t consumed; |
1274 | 0 | unsigned curr_len; |
1275 | |
|
1276 | 0 | curr_offset = offset; |
1277 | 0 | curr_len = len; |
1278 | | |
1279 | | |
1280 | | /* IMSI IMSI 9.4.6 M TLV 6-10 */ |
1281 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
1282 | | /* SGs cause SGs cause 9.4.18 M TLV 3 */ |
1283 | 0 | ELEM_MAND_TLV(0x08, SGSAP_PDU_TYPE, DE_SGSAP_SGS_CAUSE, NULL, ei_sgsap_missing_mandatory_element); |
1284 | |
|
1285 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
1286 | 0 | } |
1287 | | /* |
1288 | | * 8.22 SGsAP-UPLINK-UNITDATA message |
1289 | | */ |
1290 | | static void |
1291 | | sgsap_ue_ul_unitdata(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
1292 | 0 | { |
1293 | 0 | uint32_t curr_offset; |
1294 | 0 | uint32_t consumed; |
1295 | 0 | unsigned curr_len; |
1296 | |
|
1297 | 0 | curr_offset = offset; |
1298 | 0 | curr_len = len; |
1299 | | |
1300 | | /* IMSI IMSI 9.4.6 M TLV 6-10 */ |
1301 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
1302 | | /* NAS message container NAS message container 9.4.15 M TLV 4-253 */ |
1303 | 0 | ELEM_MAND_TLV(0x16, SGSAP_PDU_TYPE, DE_SGSAP_NAS_MSG_CONTAINER, NULL, ei_sgsap_missing_mandatory_element); |
1304 | | /* IMEISV IMEISV 9.4.5 O TLV 10 */ |
1305 | 0 | ELEM_OPT_TLV(0x15, SGSAP_PDU_TYPE, DE_SGSAP_IMEISV, NULL); |
1306 | | /* UE Time Zone UE Time Zone 9.4.21b O TLV 3 */ |
1307 | 0 | ELEM_OPT_TLV(0x21, GSM_A_PDU_TYPE_DTAP, DE_TIME_ZONE, " - UE Time Zone"); |
1308 | | /* Mobile Station Classmark 2 Mobile Station Classmark 2 9.4.14a O TLV 5 */ |
1309 | 0 | ELEM_OPT_TLV(0x22 , GSM_A_PDU_TYPE_COMMON, DE_MS_CM_2, NULL); |
1310 | | /* TAI Tracking Area Identity 9.4.21a O TLV 7 */ |
1311 | 0 | ELEM_OPT_TLV(0x23, NAS_PDU_TYPE_EMM, DE_EMM_TRAC_AREA_ID, NULL); |
1312 | | /* E-CGI E-UTRAN Cell Global Identity 9.4.3a O TLV 9 */ |
1313 | 0 | ELEM_OPT_TLV(0x24, SGSAP_PDU_TYPE, DE_SGSAP_ECGI, NULL); |
1314 | |
|
1315 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
1316 | 0 | } |
1317 | | /* |
1318 | | * 8.23 SGsAP-RELEASE-REQUEST message |
1319 | | */ |
1320 | | static void |
1321 | | sgsap_release_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
1322 | 0 | { |
1323 | 0 | uint32_t curr_offset; |
1324 | 0 | uint32_t consumed; |
1325 | 0 | unsigned curr_len; |
1326 | |
|
1327 | 0 | curr_offset = offset; |
1328 | 0 | curr_len = len; |
1329 | | |
1330 | | /* IMSI IMSI 9.4.6 M TLV 6-10 */ |
1331 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
1332 | | /* SGs cause SGs cause 9.4.18 O TLV 3 */ |
1333 | 0 | ELEM_OPT_TLV(0x08, SGSAP_PDU_TYPE, DE_SGSAP_SGS_CAUSE, NULL); |
1334 | |
|
1335 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
1336 | 0 | } |
1337 | | |
1338 | | /* |
1339 | | * 8.24 SGsAP-SERVICE-ABORT-REQUEST message |
1340 | | */ |
1341 | | static void |
1342 | | sgsap_service_abort_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
1343 | 0 | { |
1344 | 0 | uint32_t curr_offset; |
1345 | 0 | uint32_t consumed; |
1346 | 0 | unsigned curr_len; |
1347 | |
|
1348 | 0 | curr_offset = offset; |
1349 | 0 | curr_len = len; |
1350 | | |
1351 | | /* IMSI IMSI 9.4.6 M TLV 6-10 */ |
1352 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
1353 | |
|
1354 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
1355 | 0 | } |
1356 | | |
1357 | | /* |
1358 | | * 8.25 SGsAP-MO-CSFB-INDICATION message |
1359 | | */ |
1360 | | static void |
1361 | | sgsap_mo_csfb_ind(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) |
1362 | 0 | { |
1363 | 0 | uint32_t curr_offset; |
1364 | 0 | uint32_t consumed; |
1365 | 0 | unsigned curr_len; |
1366 | |
|
1367 | 0 | curr_offset = offset; |
1368 | 0 | curr_len = len; |
1369 | | |
1370 | | /* IMSI IMSI 9.4.6 M TLV 6-10 */ |
1371 | 0 | ELEM_MAND_TLV(0x01, GSM_A_PDU_TYPE_BSSMAP, BE_IMSI, NULL, ei_sgsap_missing_mandatory_element); |
1372 | | /* TAI Tracking Area Identity 9.4.21a O TLV 7 */ |
1373 | 0 | ELEM_OPT_TLV(0x23, NAS_PDU_TYPE_EMM, DE_EMM_TRAC_AREA_ID, NULL); |
1374 | | /* E-CGI E-UTRAN Cell Global Identity 9.4.3a O TLV 9 */ |
1375 | 0 | ELEM_OPT_TLV(0x24, SGSAP_PDU_TYPE, DE_SGSAP_ECGI, NULL); |
1376 | |
|
1377 | 0 | EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_sgsap_extraneous_data); |
1378 | 0 | } |
1379 | | /* |
1380 | | * 9.2 Message type |
1381 | | */ |
1382 | | static const value_string sgsap_msg_strings[] = { |
1383 | | { 0x01, "SGsAP-PAGING-REQUEST"}, /* 8.14 */ |
1384 | | { 0x02, "SGsAP-PAGING-REJECT"}, /* 8.13 */ |
1385 | | /* |
1386 | | * 0 0 0 0 0 0 1 1 |
1387 | | * to |
1388 | | * 0 0 0 0 0 1 0 1 |
1389 | | * Unassigned: treated as an unknown Message type |
1390 | | */ |
1391 | | { 0x03, "Unassigned"}, /* 7 */ |
1392 | | { 0x04, "Unassigned"}, /* 7 */ |
1393 | | { 0x05, "Unassigned"}, /* 7 */ |
1394 | | |
1395 | | { 0x06, "SGsAP-SERVICE-REQUEST"}, /* 8.17 */ |
1396 | | { 0x07, "SGsAP-DOWNLINK-UNITDATA"}, /* 8.4 */ |
1397 | | { 0x08, "SGsAP-UPLINK-UNITDATA"}, /* 8.22 */ |
1398 | | { 0x09, "SGsAP-LOCATION-UPDATE-REQUEST"}, /* 8.11 */ |
1399 | | { 0x0a, "SGsAP-LOCATION-UPDATE-ACCEPT"}, /* 8.9 */ |
1400 | | { 0x0b, "SGsAP-LOCATION-UPDATE-REJECT"}, /* 8.10 */ |
1401 | | { 0x0c, "SGsAP-TMSI-REALLOCATION-COMPLETE"}, /* 8.19 */ |
1402 | | { 0x0d, "SGsAP-ALERT-REQUEST"}, /* 8.3 */ |
1403 | | { 0x0e, "SGsAP-ALERT-ACK"}, /* 8.1 */ |
1404 | | { 0x0f, "SGsAP-ALERT-REJECT"}, /* 8.2 */ |
1405 | | { 0x10, "SGsAP-UE-ACTIVITY-INDICATION"}, /* 8.20 */ |
1406 | | { 0x11, "SGsAP-EPS-DETACH-INDICATION"}, /* 8.6 */ |
1407 | | { 0x12, "SGsAP-EPS-DETACH-ACK"}, /* 8.5 */ |
1408 | | { 0x13, "SGsAP-IMSI-DETACH-INDICATION"}, /* 8.8 */ |
1409 | | { 0x14, "SGsAP-IMSI-DETACH-ACK"}, /* 8.7 */ |
1410 | | { 0x15, "SGsAP-RESET-INDICATION"}, /* 8.16 */ |
1411 | | { 0x16, "SGsAP-RESET-ACK"}, /* 8.15 */ |
1412 | | { 0x17, "SGsAP-SERVICE-ABORT-REQUEST"}, /* 8.24 */ |
1413 | | { 0x18, "SGsAP-MO-CSFB-INDICATION"}, /* 8.25 */ |
1414 | | /* |
1415 | | * 0 0 0 1 1 0 0 0 |
1416 | | * to |
1417 | | * 0 0 0 1 1 0 0 1 |
1418 | | * Unassigned: treated as an unknown Message type |
1419 | | */ |
1420 | | { 0x19, "Unassigned"}, |
1421 | | |
1422 | | { 0x1a, "SGsAP-MM-INFORMATION-REQUEST"}, /* 8.12 */ |
1423 | | { 0x1b, "SGsAP-RELEASE-REQUEST"}, /* 8.23 */ |
1424 | | /* |
1425 | | * 0 0 0 1 1 1 0 0 Unassigned: treated as an unknown Message type 7 |
1426 | | */ |
1427 | | { 0x1c, "Unassigned"}, /* 7 */ |
1428 | | |
1429 | | { 0x1d, "SGsAP-STATUS"}, /* 8.18 */ |
1430 | | { 0x1e, "Unassigned"}, /* 7 */ |
1431 | | { 0x1f, "SGsAP-UE-UNREACHABLE"}, /* 8.21 */ |
1432 | | { 0, NULL } |
1433 | | }; |
1434 | | static value_string_ext sgsap_msg_strings_ext = VALUE_STRING_EXT_INIT(sgsap_msg_strings); |
1435 | | |
1436 | 462 | #define NUM_SGSAP_MSG array_length(sgsap_msg_strings) |
1437 | | static int ett_sgsap_msg[NUM_SGSAP_MSG]; |
1438 | | static void (*sgsap_msg_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) = { |
1439 | | sgsap_paging_req, /* 0x01, "SGsAP-PAGING-REQUEST" 8.14 */ |
1440 | | sgsap_paging_rej, /* 0x02, "SGsAP-PAGING-REJECT" 8.13 */ |
1441 | | /* |
1442 | | * 0 0 0 0 0 0 1 1 |
1443 | | * to |
1444 | | * 0 0 0 0 0 1 0 1 |
1445 | | * Unassigned: treated as an unknown Message type |
1446 | | */ |
1447 | | NULL, /* 0x03, "Unassigned" 7 */ |
1448 | | NULL, /* 0x04, "Unassigned" 7 */ |
1449 | | NULL, /* 0x05, "Unassigned" 7 */ |
1450 | | |
1451 | | sgsap_service_req, /* 0x06, "SGsAP-SERVICE-REQUEST" 8.17 */ |
1452 | | sgsap_dl_unitdata, /* 0x07, "SGsAP-DOWNLINK-UNITDATA" 8.4 */ |
1453 | | sgsap_ue_ul_unitdata, /* 0x08, "SGsAP-UPLINK-UNITDATA" 8.22 */ |
1454 | | sgsap_imsi_loc_update_req, /* 0x09, "SGsAP-LOCATION-UPDATE-REQUEST" 8.11 */ |
1455 | | sgsap_imsi_loc_update_acc, /* 0x0a, "SGsAP-LOCATION-UPDATE-ACCEPT" 8.9 */ |
1456 | | sgsap_imsi_loc_update_rej, /* 0x0b, "SGsAP-LOCATION-UPDATE-REJECT" 8.10 */ |
1457 | | sgsap_tmsi_realloc_comp, /* 0x0c, "SGsAP-TMSI-REALLOCATION-COMPLETE" 8.19 */ |
1458 | | sgsap_alert_req, /* 0x0d, "SGsAP-ALERT-REQUEST" 8.3 */ |
1459 | | sgsap_alert_ack, /* 0x0e, "SGsAP-ALERT-ACK" 8.1 */ |
1460 | | sgsap_alert_rej, /* 0x0f, "SGsAP-ALERT-REJECT" 8.2 */ |
1461 | | sgsap_ue_act_ind, /* 0x10, "SGsAP-UE-ACTIVITY-INDICATION" 8.20 */ |
1462 | | sgsap_eps_det_ind, /* 0x11, "SGsAP-EPS-DETACH-INDICATION" 8.6 */ |
1463 | | sgsap_eps_det_ack, /* 0x12, "SGsAP-EPS-DETACH-ACK" 8.5 */ |
1464 | | sgsap_imsi_det_ind, /* 0x13, "SGsAP-IMSI-DETACH-INDICATION" 8.8 */ |
1465 | | sgsap_imsi_det_ack, /* 0x14, "SGsAP-IMSI-DETACH-ACK" 8.7 */ |
1466 | | sgsap_reset_ind, /* 0x15, "SGsAP-RESET-INDICATION" 8.16 */ |
1467 | | sgsap_reset_ack, /* 0x16, "SGsAP-RESET-ACK" 8.15 */ |
1468 | | sgsap_service_abort_req, /* 0x17, "SGsAP-SERVICE-ABORT-REQUEST" 8.24 */ |
1469 | | sgsap_mo_csfb_ind, /* 0x18, "SGsAP-MO-CSFB-INDICATION" 8.25 */ |
1470 | | /* |
1471 | | * 0 0 0 1 1 0 0 1 |
1472 | | * to |
1473 | | * 0 0 0 1 1 0 0 1 |
1474 | | * Unassigned: treated as an unknown Message type |
1475 | | */ |
1476 | | NULL, /* 0x19, "Unassigned" */ |
1477 | | |
1478 | | sgsap_mm_info_req, /* 0x1a, "SGsAP-MM-INFORMATION-REQUEST" 8.12 */ |
1479 | | sgsap_release_req, /* 0x1b, "SGsAP-RELEASE-REQUEST" 8.23 */ |
1480 | | /* |
1481 | | * 0 0 0 1 1 1 0 0 Unassigned: treated as an unknown Message type 7 |
1482 | | */ |
1483 | | NULL, /* 0x1c, "Unassigned" */ |
1484 | | |
1485 | | sgsap_status, /* 0x1d, "SGsAP-STATUS" 8.18 */ |
1486 | | NULL, /* 0x1e, "Unassigned" */ |
1487 | | sgsap_ue_unreachable, /* 0x1f, "SGsAP-UE-UNREACHABLE" 8.21 */ |
1488 | | |
1489 | | NULL, /* NONE */ |
1490 | | }; |
1491 | | |
1492 | | static void get_sgsap_msg_params(uint8_t oct, const char **msg_str, int *ett_tree, int *hf_idx, msg_fcn *msg_fcn_p) |
1493 | 0 | { |
1494 | 0 | int idx; |
1495 | |
|
1496 | 0 | *msg_str = try_val_to_str_idx_ext((uint32_t) (oct & 0xff), &sgsap_msg_strings_ext, &idx); |
1497 | 0 | *hf_idx = hf_sgsap_msg_type; |
1498 | 0 | if (*msg_str != NULL) { |
1499 | 0 | *ett_tree = ett_sgsap_msg[idx]; |
1500 | 0 | *msg_fcn_p = sgsap_msg_fcn[idx]; |
1501 | 0 | } |
1502 | |
|
1503 | 0 | return; |
1504 | 0 | } |
1505 | | |
1506 | | |
1507 | | static int |
1508 | | dissect_sgsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) |
1509 | 0 | { |
1510 | 0 | proto_item *item; |
1511 | 0 | proto_tree *sgsap_tree; |
1512 | 0 | int offset = 0; |
1513 | 0 | uint32_t len; |
1514 | 0 | const char *msg_str; |
1515 | 0 | int ett_tree; |
1516 | 0 | int hf_idx; |
1517 | 0 | void (*msg_fcn_p)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len); |
1518 | 0 | uint8_t oct; |
1519 | |
|
1520 | 0 | len = tvb_reported_length(tvb); |
1521 | | |
1522 | | /* Make entry in the Protocol column on summary display */ |
1523 | 0 | col_set_str(pinfo->cinfo, COL_PROTOCOL, PSNAME); |
1524 | |
|
1525 | 0 | item = proto_tree_add_item(tree, proto_sgsap, tvb, 0, -1, ENC_NA); |
1526 | 0 | sgsap_tree = proto_item_add_subtree(item, ett_sgsap); |
1527 | | |
1528 | | /* Message type IE*/ |
1529 | 0 | oct = tvb_get_uint8(tvb, offset); |
1530 | 0 | msg_fcn_p = NULL; |
1531 | 0 | ett_tree = -1; |
1532 | 0 | hf_idx = -1; |
1533 | 0 | msg_str = NULL; |
1534 | |
|
1535 | 0 | get_sgsap_msg_params(oct, &msg_str, &ett_tree, &hf_idx, &msg_fcn_p); |
1536 | |
|
1537 | 0 | if (msg_str) { |
1538 | 0 | col_add_str(pinfo->cinfo, COL_INFO, msg_str); |
1539 | 0 | }else{ |
1540 | 0 | proto_tree_add_item(tree, hf_sgsap_unknown_msg, tvb, offset, 1, ENC_BIG_ENDIAN); |
1541 | 0 | return tvb_captured_length(tvb); |
1542 | 0 | } |
1543 | | |
1544 | | /* |
1545 | | * Add SGSAP message name |
1546 | | */ |
1547 | 0 | proto_tree_add_item(sgsap_tree, hf_idx, tvb, offset, 1, ENC_BIG_ENDIAN); |
1548 | 0 | offset++; |
1549 | | |
1550 | | |
1551 | | /* |
1552 | | * decode elements |
1553 | | */ |
1554 | 0 | if (msg_fcn_p == NULL) |
1555 | 0 | { |
1556 | 0 | proto_tree_add_item(sgsap_tree, hf_sgsap_message_elements, tvb, offset, len - offset, ENC_NA); |
1557 | 0 | } |
1558 | 0 | else |
1559 | 0 | { |
1560 | 0 | (*msg_fcn_p)(tvb, sgsap_tree, pinfo, offset, len - offset); |
1561 | 0 | } |
1562 | |
|
1563 | 0 | return tvb_captured_length(tvb); |
1564 | 0 | } |
1565 | | |
1566 | | |
1567 | | |
1568 | 14 | void proto_register_sgsap(void) { |
1569 | 14 | unsigned i; |
1570 | 14 | unsigned last_offset; |
1571 | | |
1572 | | /* List of fields */ |
1573 | | |
1574 | 14 | static hf_register_info hf[] = { |
1575 | 14 | { &hf_sgsap_msg_type, |
1576 | 14 | { "SGSAP Message Type", "sgsap.msg_type", |
1577 | 14 | FT_UINT8, BASE_HEX|BASE_EXT_STRING, &sgsap_msg_strings_ext, 0x0, |
1578 | 14 | NULL, HFILL } |
1579 | 14 | }, |
1580 | 14 | { &hf_sgsap_elem_id, |
1581 | 14 | { "Element ID", "sgsap.elem_id", |
1582 | 14 | FT_UINT8, BASE_HEX, NULL, 0x0, |
1583 | 14 | NULL, HFILL } |
1584 | 14 | }, |
1585 | 14 | { &hf_sgsap_eps_location_update_type, |
1586 | 14 | { "EPS location update type", "sgsap.eps_location_update_type", |
1587 | 14 | FT_UINT8, BASE_DEC, VALS(sgsap_eps_location_update_type_values), 0x0, |
1588 | 14 | NULL, HFILL } |
1589 | 14 | }, |
1590 | 14 | { &hf_sgsap_service_indicator_value, |
1591 | 14 | { "Service indicator", "sgsap.service_indicator", |
1592 | 14 | FT_UINT8, BASE_DEC, VALS(sgsap_service_indicator_values), 0x0, |
1593 | 14 | NULL, HFILL } |
1594 | 14 | }, |
1595 | 14 | { &hf_sgsap_sgs_cause, |
1596 | 14 | { "SGs cause", "sgsap.sgs_cause", |
1597 | 14 | FT_UINT8, BASE_DEC|BASE_EXT_STRING, &sgsap_sgs_cause_values_ext, 0x0, |
1598 | 14 | NULL, HFILL } |
1599 | 14 | }, |
1600 | 14 | { &hf_sgsap_ue_emm_mode, |
1601 | 14 | { "UE EMM mode", "sgsap.ue_emm_mode", |
1602 | 14 | FT_UINT8, BASE_DEC, VALS(sgsap_ue_emm_mode_values), 0x0, |
1603 | 14 | NULL, HFILL } |
1604 | 14 | }, |
1605 | 14 | { &hf_sgsap_eci, |
1606 | 14 | {"ECI (E-UTRAN Cell Identifier)", "sgsap.eci", |
1607 | 14 | FT_UINT32, BASE_DEC, NULL, 0x0fffffff, |
1608 | 14 | NULL, HFILL} |
1609 | 14 | }, |
1610 | 14 | { &hf_sgsap_cn_id, |
1611 | 14 | {"CN_ID", "sgsap.cn_id", |
1612 | 14 | FT_UINT16, BASE_DEC, NULL, 0x0, |
1613 | 14 | NULL, HFILL} |
1614 | 14 | }, |
1615 | 14 | { &hf_sgsap_imsi_det_eps, |
1616 | 14 | { "IMSI detach from EPS service type", "sgsap.imsi_det_eps", |
1617 | 14 | FT_UINT8, BASE_DEC, VALS(sgsap_imsi_det_from_eps_serv_type_values), 0x0, |
1618 | 14 | NULL, HFILL } |
1619 | 14 | }, |
1620 | 14 | { &hf_sgsap_imsi_det_non_eps, |
1621 | 14 | { "IMSI detach from non-EPS service type", "sgsap.imsi_det_non_eps", |
1622 | 14 | FT_UINT8, BASE_DEC, VALS(sgsap_imsi_det_from_non_eps_serv_type_values), 0x0, |
1623 | 14 | NULL, HFILL } |
1624 | 14 | }, |
1625 | 14 | { &hf_sgsap_lcs_indic, |
1626 | 14 | { "LCS indicator", "sgsap.lcs_indicator", |
1627 | 14 | FT_UINT8, BASE_DEC, VALS(sgsap_lcs_indic_values), 0x0, |
1628 | 14 | NULL, HFILL } |
1629 | 14 | }, |
1630 | 14 | { &hf_sgsap_mme_name, |
1631 | 14 | {"MME name", "sgsap.mme_name", |
1632 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
1633 | 14 | NULL, HFILL} |
1634 | 14 | }, |
1635 | 14 | { &hf_sgsap_vlr_name, |
1636 | 14 | {"VLR name", "sgsap.vlr_name", |
1637 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
1638 | 14 | NULL, HFILL} |
1639 | 14 | }, |
1640 | 14 | { &hf_sgsap_imeisv, |
1641 | 14 | {"IMEISV", "sgsap.imeisv", |
1642 | 14 | FT_STRING, BASE_NONE, NULL, 0x0, |
1643 | 14 | NULL, HFILL} |
1644 | 14 | }, |
1645 | 14 | { &hf_sgsap_unknown_msg, |
1646 | 14 | { "Unknown message", "sgsap.unknown_msg", |
1647 | 14 | FT_UINT8, BASE_HEX, NULL, 0x0, |
1648 | 14 | NULL, HFILL } |
1649 | 14 | }, |
1650 | 14 | { &hf_sgsap_message_elements, |
1651 | 14 | {"Message Elements", "sgsap.message_elements", |
1652 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
1653 | 14 | NULL, HFILL} |
1654 | 14 | }, |
1655 | 14 | { &hf_sgsap_csri, |
1656 | 14 | {"CS restoration indicator (CSRI)", "sgsap.csri", |
1657 | 14 | FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x01, |
1658 | 14 | NULL, HFILL } |
1659 | 14 | }, |
1660 | 14 | { &hf_sgsap_sel_cs_dmn_op, |
1661 | 14 | { "Selected CS domain operator", "sgsap.sel_cs_dmn_op", |
1662 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
1663 | 14 | NULL, HFILL } |
1664 | 14 | }, |
1665 | 14 | }; |
1666 | | |
1667 | 14 | static ei_register_info ei[] = { |
1668 | 14 | { &ei_sgsap_extraneous_data, { "sgsap.extraneous_data", PI_PROTOCOL, PI_NOTE, "Extraneous Data, dissector bug or later version spec(report to wireshark.org)", EXPFILL }}, |
1669 | 14 | { &ei_sgsap_missing_mandatory_element, { "sgsap.missing_mandatory_element", PI_PROTOCOL, PI_WARN, "Missing Mandatory element, rest of dissection is suspect", EXPFILL }}, |
1670 | 14 | }; |
1671 | | |
1672 | 14 | expert_module_t* expert_sgsap; |
1673 | | |
1674 | | /* Setup protocol subtree array */ |
1675 | 14 | #define NUM_INDIVIDUAL_ELEMS 2 |
1676 | 14 | int *ett[NUM_INDIVIDUAL_ELEMS + |
1677 | 14 | NUM_SGSAP_ELEM + |
1678 | 14 | NUM_SGSAP_MSG]; |
1679 | | |
1680 | 14 | ett[0] = &ett_sgsap; |
1681 | 14 | ett[1] = &ett_sgsap_sel_cs_dmn_op; |
1682 | | |
1683 | 14 | last_offset = NUM_INDIVIDUAL_ELEMS; |
1684 | | |
1685 | 546 | for (i=0; i < NUM_SGSAP_ELEM; i++, last_offset++) |
1686 | 532 | { |
1687 | 532 | ett[last_offset] = &ett_sgsap_elem[i]; |
1688 | 532 | } |
1689 | | |
1690 | 462 | for (i=0; i < NUM_SGSAP_MSG; i++, last_offset++) |
1691 | 448 | { |
1692 | 448 | ett[last_offset] = &ett_sgsap_msg[i]; |
1693 | 448 | } |
1694 | | |
1695 | | /* Register protocol */ |
1696 | 14 | proto_sgsap = proto_register_protocol(PNAME, PSNAME, PFNAME); |
1697 | | /* Register fields and subtrees */ |
1698 | 14 | proto_register_field_array(proto_sgsap, hf, array_length(hf)); |
1699 | 14 | proto_register_subtree_array(ett, array_length(ett)); |
1700 | 14 | expert_sgsap = expert_register_protocol(proto_sgsap); |
1701 | 14 | expert_register_field_array(expert_sgsap, ei, array_length(ei)); |
1702 | | |
1703 | | /* Register dissector */ |
1704 | 14 | sgsap_handle = register_dissector(PFNAME, dissect_sgsap, proto_sgsap); |
1705 | | |
1706 | | /* sgsap_module = prefs_register_protocol(proto_sgsap, NULL); */ |
1707 | | |
1708 | 14 | } |
1709 | | |
1710 | | void |
1711 | | proto_reg_handoff_sgsap(void) |
1712 | 14 | { |
1713 | | /* The registered SCTP port number for SGsAP is 29118. |
1714 | | * The payload protocol identifier to be used for SGsAP is 0. |
1715 | | */ |
1716 | 14 | gsm_a_dtap_handle = find_dissector_add_dependency("gsm_a_dtap", proto_sgsap); |
1717 | 14 | dissector_add_uint_range_with_preference("sctp.port", SGSAP_SCTP_PORT_RANGE, sgsap_handle); |
1718 | 14 | } |
1719 | | |
1720 | | /* |
1721 | | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
1722 | | * |
1723 | | * Local variables: |
1724 | | * c-basic-offset: 4 |
1725 | | * tab-width: 8 |
1726 | | * indent-tabs-mode: nil |
1727 | | * End: |
1728 | | * |
1729 | | * vi: set shiftwidth=4 tabstop=8 expandtab: |
1730 | | * :indentSize=4:tabSize=8:noTabs=true: |
1731 | | */ |