/src/wireshark/epan/dissectors/packet-gsm_bsslap.c
Line | Count | Source |
1 | | /* packet-gsm_bsslap.c |
2 | | * Routines for Location Services (LCS) Serving Mobile Location Centre - Base Station System (SMLC-BSS) dissection |
3 | | * Copyright 2008, Anders Broman <anders.broman[at]ericsson.com> |
4 | | * |
5 | | * Wireshark - Network traffic analyzer |
6 | | * By Gerald Combs <gerald@wireshark.org> |
7 | | * Copyright 1998 Gerald Combs |
8 | | * |
9 | | * SPDX-License-Identifier: GPL-2.0-or-later |
10 | | * |
11 | | * References: 3GPP TS 48.071 version 7.2.0 Release 7 |
12 | | */ |
13 | | |
14 | | #include "config.h" |
15 | | |
16 | | #include <epan/packet.h> |
17 | | #include <epan/expert.h> |
18 | | #include <epan/tfs.h> |
19 | | #include <wsutil/array.h> |
20 | | |
21 | | #include "packet-gsm_a_common.h" |
22 | | |
23 | | void proto_reg_handoff_gsm_bsslap(void); |
24 | | void proto_register_gsm_bsslap(void); |
25 | | |
26 | | static dissector_handle_t bsslap_rrlp_handle; |
27 | | |
28 | | /* Initialize the protocol and registered fields */ |
29 | | static int proto_gsm_bsslap; |
30 | | static int hf_gsm_bsslap_msg_type; |
31 | | int hf_gsm_a_bsslap_elem_id; |
32 | | static int hf_gsm_bsslap_ta; |
33 | | static int hf_gsm_bsslap_timer_value; |
34 | | static int hf_gsm_bsslap_ms_pow; |
35 | | static int hf_gsm_bsslap_cause; |
36 | | static int hf_gsm_bsslap_rrlp_flg; |
37 | | static int hf_gsm_bsslap_tfi; |
38 | | static int hf_gsm_bsslap_poll_rep; |
39 | | static int hf_gsm_bsslap_lac; |
40 | | static int hf_gsm_bsslap_cell_id_disc; |
41 | | static int hf_gsm_bsslap_encryption_key; |
42 | | |
43 | | /* Initialize the subtree pointers */ |
44 | | static int ett_gsm_bsslap; |
45 | | static int ett_bsslap_cell_list; |
46 | | |
47 | | static expert_field ei_gsm_bsslap_missing_mandatory_element; |
48 | | static expert_field ei_gsm_bsslap_not_decoded_yet; |
49 | | |
50 | | /* Table 5.1: Element Identifier codes */ |
51 | | #define BSSLAP_PARAM_TIMING_ADVANCE 0x01 |
52 | | #define BSSLAP_PARAM_RESERVED_01 0x08 |
53 | | #define BSSLAP_PARAM_CELL_IDENTITY 0x09 |
54 | | #define BSSLAP_PARAM_RESERVED_02 0x0A |
55 | | #define BSSLAP_PARAM_RESERVED_03 0x0B |
56 | | #define BSSLAP_PARAM_RESERVED_04 0x0C |
57 | | #define BSSLAP_PARAM_CHANNEL_DESCRIPTION 0x10 |
58 | | #define BSSLAP_PARAM_RESERVED_05 0x11 |
59 | | #define BSSLAP_PARAM_RESERVED_06 0x12 |
60 | | #define BSSLAP_PARAM_RESERVED_07 0x13 |
61 | | #define BSSLAP_PARAM_MEASUREMENT_REPORT 0x14 |
62 | | #define BSSLAP_PARAM_RESERVED_08 0x15 |
63 | | #define BSSLAP_PARAM_CAUSE 0x18 |
64 | | #define BSSLAP_PARAM_RRLP_FLAG 0x19 |
65 | | #define BSSLAP_PARAM_RRLP_IE 0x1B |
66 | | #define BSSLAP_PARAM_CELL_IDENTITY_LIST 0x1C |
67 | | #define BSSLAP_PARAM_ENHANCED_MEASUREMENT_REPORT 0x1D |
68 | | #define BSSLAP_PARAM_LOCATION_AREA_CODE 0x1E |
69 | | #define BSSLAP_PARAM_FREQUENCY_LIST 0x21 |
70 | | #define BSSLAP_PARAM_MS_POWER 0x22 |
71 | | #define BSSLAP_PARAM_DELTA_TIMER 0x23 |
72 | | #define BSSLAP_PARAM_SERVING_CELL_IDENTIFIER 0x24 |
73 | | #define BSSLAP_PARAM_ENCRYPTION_KEY 0x25 |
74 | | #define BSSLAP_PARAM_CIPHER_MODE_SETTING 0x26 |
75 | | #define BSSLAP_PARAM_CHANNEL_MODE 0x27 |
76 | | #define BSSLAP_PARAM_MULTIRATE_CONFIGURATION 0x28 |
77 | | #define BSSLAP_PARAM_POLLING_REPETITION 0x29 |
78 | | #define BSSLAP_PARAM_PACKET_CHANNEL_DESCRIPTION 0x2A |
79 | | #define BSSLAP_PARAM_TLLI 0x2B |
80 | | #define BSSLAP_PARAM_TFI 0x2C |
81 | | #define BSSLAP_PARAM_STARTING_TIME 0x2D |
82 | | |
83 | | static const value_string gsm_bsslap_elem_strings[] = { |
84 | | { DE_BLAP_RES1, "Reserved" }, |
85 | | { DE_BLAP_TA, "Timing Advance" }, |
86 | | { DE_BLAP_RES3, "Reserved" }, /* (note) */ |
87 | | { DE_BLAP_RES4, "Cell Identity" }, |
88 | | { DE_BLAP_RES5, "Reserved" }, /* (note) */ |
89 | | { DE_BLAP_RES6, "Reserved" }, /* (note) */ |
90 | | { DE_BLAP_RES7, "Reserved" }, /* (note) */ |
91 | | { DE_BLAP_CH_DESC, "Channel Description" }, |
92 | | { DE_BLAP_RES9, "Reserved" }, /* (note) */ |
93 | | { DE_BLAP_RES10, "Reserved" }, /* (note) */ |
94 | | { DE_BLAP_RES11, "Reserved" }, /* (note) */ |
95 | | { DE_BLAP_MEAS_REP, "Measurement Report" }, |
96 | | { DE_BLAP_RES13, "Reserved" }, /* (note) */ |
97 | | { DE_BLAP_CAUSE, "Cause" }, |
98 | | { DE_BLAP_RRLP_FLG, "RRLP Flag" }, |
99 | | { DE_BLAP_RRLP_IE, "RRLP IE" }, |
100 | | { DE_BLAP_CELL_ID_LIST, "Cell Identity List" }, |
101 | | { DE_BLAP_ENH_MEAS_REP, "Enhanced Measurement Report" }, |
102 | | { DE_BLAP_LAC, "Location Area Code" }, |
103 | | { DE_BLAP_FREQ_LIST, "Frequency List" }, |
104 | | { DE_BLAP_MS_POW, "MS Power" }, |
105 | | { DE_BLAP_DELTA_TIME, "Delta Timer" }, |
106 | | { DE_BLAP_SERV_CELL_ID, "Serving Cell Identifier" }, |
107 | | { DE_BLAP_ENC_KEY, "Encryption Key (Kc)" }, |
108 | | { DE_BLAP_CIP_M_SET, "Cipher Mode Setting" }, |
109 | | { DE_BLAP_CH_MODE, "Channel Mode" }, |
110 | | { DE_BLAP_POLL_REP, "Polling Repetition" }, |
111 | | { DE_BLAP_PKT_CH_DESC, "Packet Channel Description" }, |
112 | | { DE_BLAP_TLLI, "TLLI" }, |
113 | | { DE_BLAP_TFI, "TFI" }, |
114 | | { DE_BLAP_START_TIME, "Starting Time" }, |
115 | | { 0, NULL }, |
116 | | }; |
117 | | value_string_ext gsm_bsslap_elem_strings_ext = VALUE_STRING_EXT_INIT(gsm_bsslap_elem_strings); |
118 | | |
119 | | /* |
120 | | * NOTE: These values of the codepoints shall not be used as they were used in an earlier version of the |
121 | | * protocol. |
122 | | * All unassigned codes are spare. |
123 | | */ |
124 | | |
125 | | |
126 | 0 | #define BSSLAP_TA_REQUEST 1 |
127 | 0 | #define BSSLAP_TA_RESPONSE 2 |
128 | 0 | #define BSSLAP_REJECT 10 |
129 | 0 | #define BSSLAP_RESET 11 |
130 | 0 | #define BSSLAP_ABORT 12 |
131 | 0 | #define BSSLAP_TA_LAYER3 13 |
132 | 0 | #define BSSLAP_MS_POS_CMD 15 |
133 | 0 | #define BSSLAP_MS_POS_RES 16 |
134 | 0 | #define BSSLAP_U_TDOA_REQ 17 |
135 | 0 | #define BSSLAP_U_TDOA_RES 18 |
136 | | |
137 | | /* Table 5.1.1: Message Type codes */ |
138 | | static const value_string gsm_a_bsslap_msg_strings[] = { |
139 | | { 0x00, "Reserved" }, |
140 | | { BSSLAP_TA_REQUEST, "TA REQUEST" }, |
141 | | { BSSLAP_TA_RESPONSE, "TA RESPONSE" }, |
142 | | { 0x04, "Reserved" }, |
143 | | { 0x05, "Reserved" }, |
144 | | { BSSLAP_REJECT, "REJECT" }, |
145 | | { BSSLAP_RESET, "RESET" }, |
146 | | { BSSLAP_ABORT, "ABORT" }, |
147 | | { BSSLAP_TA_LAYER3, "TA LAYER3" }, |
148 | | { BSSLAP_MS_POS_CMD, "MS Position Command" }, |
149 | | { BSSLAP_MS_POS_RES, "MS Position Response" }, |
150 | | { BSSLAP_U_TDOA_REQ, "U-TDOA Request" }, |
151 | | { BSSLAP_U_TDOA_RES, "U-TDOA Response" }, |
152 | | { 0, NULL } |
153 | | }; |
154 | | |
155 | 462 | #define NUM_GSM_BSSLAP_ELEM array_length(gsm_bsslap_elem_strings) |
156 | | int ett_gsm_bsslap_elem[NUM_GSM_BSSLAP_ELEM]; |
157 | | |
158 | | /* |
159 | | * 5.2 Timing Advance IE |
160 | | */ |
161 | | static uint16_t |
162 | | de_ta(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
163 | 0 | { |
164 | 0 | uint32_t curr_offset; |
165 | |
|
166 | 0 | curr_offset = offset; |
167 | 0 | proto_tree_add_item(tree, hf_gsm_bsslap_ta, tvb, curr_offset, 1, ENC_BIG_ENDIAN); |
168 | 0 | curr_offset++; |
169 | |
|
170 | 0 | return curr_offset - offset; |
171 | 0 | } |
172 | | /* |
173 | | * 5.12 Measurement Report IE |
174 | | */ |
175 | | #if 0 |
176 | | static uint16_t |
177 | | de_meas_rep(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_) |
178 | | { |
179 | | uint32_t curr_offset; |
180 | | |
181 | | curr_offset = offset; |
182 | | proto_tree_add_expert(tree, pinfo, &ei_gsm_bsslap_not_decoded_yet, tvb, curr_offset, len); |
183 | | |
184 | | |
185 | | return len; |
186 | | } |
187 | | #endif |
188 | | /* |
189 | | * 5.14 Cause IE |
190 | | */ |
191 | | static const value_string gsm_bsslap_cause_vals[] = { |
192 | | { 0x00, "Congestion" }, |
193 | | { 0x01, "Channel Mode not supported" }, |
194 | | { 0x02, "Positioning procedure not supported" }, |
195 | | { 0x03, "Failure for other radio related events" }, |
196 | | { 0x04, "Intra-BSS handover" }, |
197 | | { 0x05, "Supervision Timer Expired" }, |
198 | | { 0x06, "Inter-BSS handover" }, |
199 | | { 0x07, "Loss of signalling connection to MS" }, |
200 | | { 0x08, "Incorrect serving cell identity" }, |
201 | | { 0x09, "BSSAP-LE Segmentation error" }, |
202 | | { 0, NULL } |
203 | | }; |
204 | | |
205 | | static uint16_t |
206 | | de_bsslap_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_) |
207 | 0 | { |
208 | 0 | uint32_t curr_offset; |
209 | |
|
210 | 0 | curr_offset = offset; |
211 | 0 | proto_tree_add_item(tree, hf_gsm_bsslap_cause, tvb, curr_offset, 1, ENC_BIG_ENDIAN); |
212 | 0 | curr_offset++; |
213 | |
|
214 | 0 | return curr_offset - offset; |
215 | 0 | } |
216 | | /* |
217 | | * 5.15 RRLP Flag IE |
218 | | */ |
219 | | static const true_false_string gsm_bsslap_rrlp_flg_vals = { |
220 | | "Not a Positioning Command or final response." , |
221 | | "Position Command (SMLC to BSC) or final response (BSC to SMLC)" |
222 | | }; |
223 | | static uint16_t |
224 | | de_rrlp_flg(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
225 | 0 | { |
226 | 0 | uint32_t curr_offset; |
227 | |
|
228 | 0 | curr_offset = offset; |
229 | 0 | proto_tree_add_item(tree, hf_gsm_bsslap_rrlp_flg, tvb, curr_offset, 1, ENC_BIG_ENDIAN); |
230 | 0 | curr_offset++; |
231 | |
|
232 | 0 | return curr_offset - offset; |
233 | 0 | } |
234 | | static uint16_t |
235 | | de_rrlp_ie(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
236 | 0 | { |
237 | 0 | uint32_t curr_offset; |
238 | 0 | tvbuff_t *rrlp_tvb; |
239 | 0 | uint16_t length; |
240 | |
|
241 | 0 | length = tvb_get_ntohs(tvb, offset); |
242 | |
|
243 | 0 | curr_offset = offset + 2; |
244 | 0 | if (length > 0) |
245 | 0 | { |
246 | 0 | rrlp_tvb = tvb_new_subset_length(tvb, curr_offset, length); |
247 | 0 | if (bsslap_rrlp_handle) |
248 | 0 | call_dissector(bsslap_rrlp_handle, rrlp_tvb, pinfo, tree); |
249 | 0 | } |
250 | |
|
251 | 0 | curr_offset += length; |
252 | 0 | return curr_offset - offset; |
253 | 0 | } |
254 | | /* |
255 | | * 5.17 Cell Identity List IE |
256 | | */ |
257 | | /* |
258 | | * The Cell identification discriminator i is coded as follows: |
259 | | */ |
260 | | static const value_string gsm_a_bsslap_cell_id_disc_vals[] = { |
261 | | { 0x0, "The whole Cell Global Identification, CGI, is used to identify the 2G cells" }, |
262 | | { 0x1, "Location Area Code, LAC, and Cell Identify, CI, are used to identify the 2G cells" }, |
263 | | { 0x2, "3G Cell identification container 1" }, |
264 | | { 0x3, "3G Cell identification container 2" }, |
265 | | { 0, NULL } |
266 | | }; |
267 | | |
268 | | |
269 | | |
270 | | static uint16_t |
271 | | de_cell_id_list(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_) |
272 | 0 | { |
273 | 0 | uint32_t curr_offset; |
274 | 0 | uint8_t consumed; |
275 | 0 | uint8_t cell_id_disc; |
276 | 0 | uint8_t num_cells; |
277 | 0 | proto_item *item = NULL; |
278 | 0 | proto_tree *subtree = NULL; |
279 | |
|
280 | 0 | curr_offset = offset; |
281 | 0 | cell_id_disc = tvb_get_uint8(tvb,curr_offset); |
282 | 0 | num_cells = 0; |
283 | |
|
284 | 0 | while(len>0){ |
285 | 0 | num_cells++; |
286 | 0 | consumed = 0; |
287 | 0 | subtree = proto_tree_add_subtree_format(tree, tvb, curr_offset, -1, ett_bsslap_cell_list, &item, "Cell %u", num_cells); |
288 | |
|
289 | 0 | if (add_string) |
290 | 0 | add_string[0] = '\0'; |
291 | 0 | proto_tree_add_item(subtree, hf_gsm_bsslap_cell_id_disc, tvb, curr_offset, 1, ENC_BIG_ENDIAN); |
292 | 0 | curr_offset++; |
293 | 0 | len--; |
294 | 0 | switch(cell_id_disc){ |
295 | 0 | case 0: |
296 | | /* The whole Cell Global Identification, CGI, is used to identify the 2G cells. */ |
297 | 0 | consumed+= be_cell_id_aux(tvb, subtree, pinfo, curr_offset, len, NULL, 0, 0); |
298 | 0 | break; |
299 | 0 | case 1: |
300 | | /* Location Area Code, LAC, and Cell Identify, CI, are used to identify the 2G cells. */ |
301 | 0 | consumed+= be_cell_id_aux(tvb, subtree, pinfo, curr_offset, len, NULL, 0, 1); |
302 | 0 | break; |
303 | 0 | case 2: |
304 | | /* 3G Cell identification container 1 */ |
305 | | /* fall trough */ |
306 | 0 | case 3: |
307 | | /* 3G Cell identification container 2 */ |
308 | | /* fall trough */ |
309 | 0 | default: |
310 | 0 | proto_tree_add_expert(subtree, pinfo, &ei_gsm_bsslap_not_decoded_yet, tvb, curr_offset, len); |
311 | 0 | consumed = len; |
312 | 0 | break; |
313 | 0 | } |
314 | 0 | curr_offset += consumed; |
315 | 0 | len-=consumed; |
316 | | /* length is "cell id" + discriminator */ |
317 | 0 | proto_item_set_len(item, consumed+1); |
318 | 0 | } |
319 | | |
320 | | |
321 | 0 | return curr_offset - offset; |
322 | 0 | } |
323 | | /* |
324 | | * 5.18 Enhanced Measurement Report IE |
325 | | * The Enhanced Measurement Results field is encoded as the contents of the |
326 | | * ENHANCED MEASUREMENT REPORT message in 3GPP TS 44.018 (excluding the fields: |
327 | | * "RR short PD", "Message type" and "Short layer 2 header")... |
328 | | */ |
329 | | static uint16_t |
330 | | de_enh_meas_rep(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_) |
331 | 0 | { |
332 | 0 | uint32_t curr_offset; |
333 | |
|
334 | 0 | curr_offset = offset; |
335 | 0 | proto_tree_add_expert(tree, pinfo, &ei_gsm_bsslap_not_decoded_yet, tvb, curr_offset, len); |
336 | | |
337 | |
|
338 | 0 | return len; |
339 | 0 | } |
340 | | /* |
341 | | * 5.19 Location Area Code IE |
342 | | */ |
343 | | static uint16_t |
344 | | de_lac(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
345 | 0 | { |
346 | 0 | uint32_t curr_offset; |
347 | |
|
348 | 0 | curr_offset = offset; |
349 | 0 | proto_tree_add_item(tree, hf_gsm_bsslap_lac, tvb, curr_offset, 1, ENC_BIG_ENDIAN); |
350 | 0 | curr_offset++; |
351 | |
|
352 | 0 | return curr_offset - offset; |
353 | 0 | } |
354 | | /* |
355 | | * 5.21 MS Power IE |
356 | | */ |
357 | | static uint16_t |
358 | | de_ms_pow(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
359 | 0 | { |
360 | 0 | uint32_t curr_offset; |
361 | |
|
362 | 0 | curr_offset = offset; |
363 | 0 | proto_tree_add_item(tree, hf_gsm_bsslap_ms_pow, tvb, curr_offset, 1, ENC_BIG_ENDIAN); |
364 | 0 | curr_offset++; |
365 | |
|
366 | 0 | return curr_offset - offset; |
367 | 0 | } |
368 | | |
369 | | /* |
370 | | * 5.22 Delta Timer IE |
371 | | */ |
372 | | static uint16_t |
373 | | de_delta_time(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
374 | 0 | { |
375 | 0 | uint32_t curr_offset; |
376 | |
|
377 | 0 | curr_offset = offset; |
378 | 0 | proto_tree_add_item(tree, hf_gsm_bsslap_timer_value, tvb, curr_offset, 1, ENC_BIG_ENDIAN); |
379 | 0 | curr_offset++; |
380 | |
|
381 | 0 | return curr_offset - offset; |
382 | 0 | } |
383 | | /* |
384 | | * 5.23 Serving Cell Identifier IE |
385 | | * The Serving Cell Identifier IE is encoded as in 3GPP TS 48.008 (excluding IEI and length field). |
386 | | */ |
387 | | /* |
388 | | * 5.24 Encryption Key |
389 | | */ |
390 | | static uint16_t |
391 | | de_blap_enc_key(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
392 | 0 | { |
393 | 0 | uint32_t curr_offset; |
394 | |
|
395 | 0 | curr_offset = offset; |
396 | 0 | proto_tree_add_item(tree, hf_gsm_bsslap_encryption_key, tvb, curr_offset, 8, ENC_NA); |
397 | 0 | curr_offset = curr_offset + 8; |
398 | |
|
399 | 0 | return curr_offset - offset; |
400 | 0 | } |
401 | | /* |
402 | | * 5.25 Cipher Mode Setting IE |
403 | | * The Cipher Mode Setting information element is coded as defined in TS 44.018 (excluding IEI). |
404 | | */ |
405 | | /* |
406 | | * 5.26 Channel Mode IE |
407 | | * The Channel Mode information element is coded as defined in TS 44.018 (excluding IEI). |
408 | | */ |
409 | | /* |
410 | | * 5.27 MultiRate Configuration IE |
411 | | * The MultiRate Configuration information element is coded as defined in TS 44.018 (excluding IEI). |
412 | | */ |
413 | | /* |
414 | | * 5.28 Polling Repetition IE |
415 | | */ |
416 | | static uint16_t |
417 | | de_poll_rep(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
418 | 0 | { |
419 | 0 | uint32_t curr_offset; |
420 | |
|
421 | 0 | curr_offset = offset; |
422 | 0 | proto_tree_add_item(tree, hf_gsm_bsslap_poll_rep, tvb, curr_offset, 1, ENC_BIG_ENDIAN); |
423 | 0 | curr_offset++; |
424 | |
|
425 | 0 | return curr_offset - offset; |
426 | 0 | } |
427 | | /* |
428 | | * 5.29 Packet Channel Description IE |
429 | | * CSN.1 binary representation of the channel parameters as |
430 | | * described in TS 44.018 (CCCH) or TS 44.060 (PCCCH) plus |
431 | | * padding bits (binary 0) as required to achieve 4 complete octets |
432 | | */ |
433 | | static uint16_t |
434 | | de_pkt_ch_desc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_) |
435 | 0 | { |
436 | 0 | uint32_t curr_offset; |
437 | |
|
438 | 0 | curr_offset = offset; |
439 | 0 | proto_tree_add_expert(tree, pinfo, &ei_gsm_bsslap_not_decoded_yet, tvb, curr_offset, len); |
440 | | |
441 | |
|
442 | 0 | return len; |
443 | 0 | } |
444 | | /* |
445 | | * 5.31 TFI IE |
446 | | * The TFI information element is coded as defined in TS 44.060 (excluding IEI). |
447 | | * 44.060: |
448 | | * UPLINK_TFI (5 bit field) |
449 | | * The Temporary Flow Identity field identifies an uplink Temporary Block Flow (TBF). |
450 | | * This field is encoded as a binary number. Range 0 to 31 |
451 | | */ |
452 | | static uint16_t |
453 | | de_tfi(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_) |
454 | 0 | { |
455 | 0 | uint32_t curr_offset; |
456 | |
|
457 | 0 | curr_offset = offset; |
458 | 0 | proto_tree_add_item(tree, hf_gsm_bsslap_tfi, tvb, curr_offset, 1, ENC_BIG_ENDIAN); |
459 | 0 | curr_offset++; |
460 | |
|
461 | 0 | return curr_offset - offset; |
462 | 0 | } |
463 | | |
464 | | /* |
465 | | This enum has been moved to packet-gsm_a_common to |
466 | | make it possible to use element dissection from this dissector |
467 | | in other dissectors. |
468 | | It is left here as a comment for easier reference. |
469 | | |
470 | | Note this enum must be of the same size as the element decoding list |
471 | | |
472 | | typedef enum |
473 | | { |
474 | | /. BSS LAP Elements 5 ./ |
475 | | DE_BLAP_RES1, /. Reserved ./ |
476 | | DE_BLAP_TA, /. Timing Advance ./ |
477 | | DE_BLAP_RES3, /. Reserved ./ /. (note) ./ |
478 | | DE_BLAP_RES4, /. Cell Identity ./ |
479 | | DE_BLAP_RES5, /. Reserved ./ /. (note) ./ |
480 | | DE_BLAP_RES6, /. Reserved ./ /. (note) ./ |
481 | | DE_BLAP_RES7, /. Reserved ./ /. (note) ./ |
482 | | DE_BLAP_CH_DESC, /. Channel Description ./ |
483 | | DE_BLAP_RES9, /. Reserved ./ /. (note) ./ |
484 | | DE_BLAP_RES10, /. Reserved ./ /. (note) ./ |
485 | | DE_BLAP_RES11, /. Reserved ./ /. (note) ./ |
486 | | DE_BLAP_MEAS_REP, /. Measurement Report ./ |
487 | | DE_BLAP_RES13, /. Reserved ./ /. (note) ./ |
488 | | DE_BLAP_CAUSE, /. Cause ./ |
489 | | DE_BLAP_RRLP_FLG, /. RRLP Flag ./ |
490 | | DE_BLAP_RRLP_IE, /. RRLP IE ./ |
491 | | DE_BLAP_CELL_ID_LIST, /. Cell Identity List ./ |
492 | | DE_BLAP_ENH_MEAS_REP, /. Enhanced Measurement Report ./ |
493 | | DE_BLAP_LAC, /. Location Area Code ./ |
494 | | DE_BLAP_FREQ_LIST, /. Frequency List ./ |
495 | | DE_BLAP_MS_POW, /. MS Power ./ |
496 | | DE_BLAP_DELTA_TIME, /. Delta Timer ./ |
497 | | DE_BLAP_SERV_CELL_ID, /. Serving Cell Identifier ./ |
498 | | DE_BLAP_ENC_KEY, /. Encryption Key (Kc) ./ |
499 | | DE_BLAP_CIP_M_SET, /. Cipher Mode Setting ./ |
500 | | DE_BLAP_CH_MODE, /. Channel Mode ./ |
501 | | DE_BLAP_POLL_REP, /. Polling Repetition ./ |
502 | | DE_BLAP_PKT_CH_DESC, /. Packet Channel Description ./ |
503 | | DE_BLAP_TLLI, /. TLLI ./ |
504 | | DE_BLAP_TFI, /. TFI ./ |
505 | | DE_BLAP_START_TIME, /. Starting Time ./ |
506 | | BSSLAP_NONE /. NONE ./ |
507 | | } |
508 | | bsslap_elem_idx_t; |
509 | | */ |
510 | | const elem_fcn bsslap_elem_fcn[] = { |
511 | | /* BSS LAP Elements 5 */ |
512 | | NULL, /* Reserved */ |
513 | | de_ta, /* Timing Advance */ |
514 | | NULL, /* Reserved */ /* (note) */ |
515 | | NULL, /* "Cell Identity */ |
516 | | NULL, /* "Reserved */ /* (note) */ |
517 | | NULL, /* "Reserved */ /* (note) */ |
518 | | NULL, /* "Reserved */ /* (note) */ |
519 | | NULL, /* "Channel Description */ |
520 | | NULL, /* "Reserved */ /* (note) */ |
521 | | NULL, /* Reserved */ /* (note) */ |
522 | | NULL, /* Reserved */ /* (note) */ |
523 | | de_rr_meas_res, /* "Measurement Report */ |
524 | | NULL, /* "Reserved */ /* (note) */ |
525 | | de_bsslap_cause, /* "Cause */ |
526 | | de_rrlp_flg, /* "RRLP Flag */ |
527 | | de_rrlp_ie, /* "RRLP IE */ |
528 | | de_cell_id_list, /* "Cell Identity List */ |
529 | | de_enh_meas_rep, /* Enhanced Measurement Report */ |
530 | | de_lac, /* "Location Area Code */ |
531 | | NULL, /* "Frequency List */ |
532 | | de_ms_pow, /* MS Power */ |
533 | | de_delta_time, /* Delta Timer */ |
534 | | NULL, /* Serving Cell Identifier */ |
535 | | de_blap_enc_key, /* Encryption Key (Kc) */ |
536 | | NULL, /* Cipher Mode Setting */ |
537 | | NULL, /* Channel Mode */ |
538 | | de_poll_rep, /* Polling Repetition */ |
539 | | de_pkt_ch_desc, /* Packet Channel Description */ |
540 | | NULL, /* TLLI */ |
541 | | de_tfi, /* TFI */ |
542 | | NULL, /* Starting Time */ |
543 | | NULL, /* NONE */ |
544 | | }; |
545 | | |
546 | 210 | #define NUM_GSM_BSSLAP_MSG array_length(gsm_a_bsslap_msg_strings) |
547 | | static int ett_gsm_bsslap_msg[NUM_GSM_BSSLAP_MSG]; |
548 | | |
549 | | /* 4.2.2 TA Response ETSI TS 148 071 V7.2.0 (2007-06) */ |
550 | | static void |
551 | | dissect_gsm_bsslap_ta_res(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int offset) |
552 | 0 | { |
553 | 0 | uint32_t curr_offset; |
554 | 0 | uint32_t consumed; |
555 | 0 | unsigned curr_len; |
556 | |
|
557 | 0 | curr_offset = offset; |
558 | 0 | curr_len = tvb_reported_length_remaining(tvb,offset); |
559 | | |
560 | | /* Cell Identity IE / 5.4 M TV 3 */ |
561 | 0 | ELEM_MAND_TV(BSSLAP_PARAM_CELL_IDENTITY, GSM_A_PDU_TYPE_COMMON, DE_CELL_ID, "Serving Cell Identity", ei_gsm_bsslap_missing_mandatory_element); |
562 | | /* Timing Advance IE / 5.2 M TV 2 */ |
563 | 0 | ELEM_MAND_TV(BSSLAP_PARAM_TIMING_ADVANCE, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_TA, NULL, ei_gsm_bsslap_missing_mandatory_element); |
564 | | /* Measurement Report IE / 5.12 O TLV 18 */ |
565 | 0 | ELEM_OPT_TLV(BSSLAP_PARAM_MEASUREMENT_REPORT, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_MEAS_REP, " BSSLAP"); |
566 | | /* Enhanced Measurement Report IE / 5.18 O TLV 4-n */ |
567 | 0 | ELEM_OPT_TLV(BSSLAP_PARAM_ENHANCED_MEASUREMENT_REPORT, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_ENH_MEAS_REP, NULL); |
568 | | /* Cell Identity List IE / 5.17 O TLV 6-n */ |
569 | 0 | ELEM_OPT_TLV(BSSLAP_PARAM_CELL_IDENTITY_LIST, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_CELL_ID_LIST, "-Measured Cell"); |
570 | |
|
571 | 0 | return; |
572 | |
|
573 | 0 | } |
574 | | |
575 | | |
576 | | /* 4.2.3 (void) ETSI TS 148 071 V7.2.0 (2007-06) */ |
577 | | /* 4.2.4 (void) ETSI TS 148 071 V7.2.0 (2007-06) */ |
578 | | /* 4.2.5 Reject ETSI TS 148 071 V7.2.0 (2007-06) */ |
579 | | static void |
580 | | dissect_gsm_bsslap_reject(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int offset) |
581 | 0 | { |
582 | 0 | uint32_t curr_offset; |
583 | 0 | uint32_t consumed; |
584 | 0 | unsigned curr_len; |
585 | |
|
586 | 0 | curr_offset = offset; |
587 | 0 | curr_len = tvb_reported_length_remaining(tvb,offset); |
588 | | |
589 | | /* Cause IE / 5.14 M TV 2 */ |
590 | 0 | ELEM_MAND_TV(BSSLAP_PARAM_CAUSE, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_CAUSE, NULL, ei_gsm_bsslap_missing_mandatory_element); |
591 | |
|
592 | 0 | return; |
593 | 0 | } |
594 | | |
595 | | /* 4.2.6 Reset ETSI TS 148 071 V7.2.0 (2007-06) */ |
596 | | static void |
597 | | dissect_gsm_bsslap_reset(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int offset) |
598 | 0 | { |
599 | 0 | uint32_t curr_offset; |
600 | 0 | uint32_t consumed; |
601 | 0 | unsigned curr_len; |
602 | |
|
603 | 0 | curr_offset = offset; |
604 | 0 | curr_len = tvb_reported_length_remaining(tvb,offset); |
605 | | |
606 | | /* Cell Identity IE / 5.4 M TV 3 */ |
607 | 0 | ELEM_MAND_TV(BSSLAP_PARAM_CELL_IDENTITY, GSM_A_PDU_TYPE_COMMON, DE_CELL_ID, NULL, ei_gsm_bsslap_missing_mandatory_element); |
608 | | /* Timing Advance IE / 5.2 M TV 2 */ |
609 | 0 | ELEM_MAND_TV(BSSLAP_PARAM_TIMING_ADVANCE, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_TA, NULL, ei_gsm_bsslap_missing_mandatory_element); |
610 | | /* Channel Description IE / 5.8 M TV 4 */ |
611 | 0 | ELEM_MAND_TV(BSSLAP_PARAM_CHANNEL_DESCRIPTION,GSM_A_PDU_TYPE_RR, DE_RR_CH_DSC, NULL, ei_gsm_bsslap_missing_mandatory_element); |
612 | | /* Cause IE / 5.1 M TV 2 */ |
613 | 0 | ELEM_MAND_TV(BSSLAP_PARAM_CAUSE, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_CAUSE, NULL, ei_gsm_bsslap_missing_mandatory_element); |
614 | | /* Measurement Report Measurement Report IE / 5.12 O TLV 18 */ |
615 | 0 | ELEM_OPT_TLV(BSSLAP_PARAM_MEASUREMENT_REPORT, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_MEAS_REP, " BSSLAP"); |
616 | | /* Enhanced Measurement Report Enhanced Measurement Report IE / 5.18 O TLV 4-n */ |
617 | 0 | ELEM_OPT_TLV(BSSLAP_PARAM_ENHANCED_MEASUREMENT_REPORT, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_ENH_MEAS_REP, NULL); |
618 | | /* Cell Identity List IE / 5.17 O TLV 6-n */ |
619 | 0 | ELEM_OPT_TLV(BSSLAP_PARAM_CELL_IDENTITY_LIST, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_CELL_ID_LIST, "-Measured Cell"); |
620 | | /* LAC Location Area Code IE / 5.19 O TV 3 */ |
621 | 0 | ELEM_OPT_TLV(BSSLAP_PARAM_LOCATION_AREA_CODE, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_LAC, NULL); |
622 | | /* Frequency List Frequency List IE 5.20 C (note 1) TLV 3-n */ |
623 | 0 | ELEM_OPT_TLV(BSSLAP_PARAM_FREQUENCY_LIST, GSM_A_PDU_TYPE_RR, DE_RR_FREQ_LIST, NULL); |
624 | | /* Channel Mode IE 5.26 C (notes 2 & 4) TV 2 */ |
625 | 0 | ELEM_OPT_TV(BSSLAP_PARAM_CHANNEL_MODE, GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, NULL); |
626 | | /* MultiRate Configuration 5.27 C (notes 3 & 4) TLV 4-n */ |
627 | 0 | ELEM_OPT_TLV(BSSLAP_PARAM_MULTIRATE_CONFIGURATION, GSM_A_PDU_TYPE_RR, DE_RR_MULTIRATE_CONF, NULL); |
628 | | /* Packet Channel Description Packet Channel Description IE 5.29 C (note 5) TV 4 */ |
629 | 0 | ELEM_OPT_TLV(BSSLAP_PARAM_PACKET_CHANNEL_DESCRIPTION, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_PKT_CH_DESC, NULL); |
630 | | /* TLLI IE 5.30 C (note 5) TV 5 */ |
631 | 0 | ELEM_OPT_TV(BSSLAP_PARAM_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI,NULL); |
632 | | /* TFI 5.31 C (note 5) TV 2 */ |
633 | 0 | ELEM_OPT_TV(BSSLAP_PARAM_TFI, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_TFI,NULL); |
634 | | /* Starting Time IE 5.32 C (note 5) TV 3 */ |
635 | 0 | ELEM_OPT_TV(BSSLAP_PARAM_STARTING_TIME, GSM_A_PDU_TYPE_RR, DE_RR_STARTING_TIME, "TBF Starting Time"); |
636 | | /* Encryption Key IE 5.24 C (note 4) TV 9 */ |
637 | 0 | ELEM_OPT_TV(BSSLAP_PARAM_ENCRYPTION_KEY, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_ENC_KEY,NULL); |
638 | | /* Cipher Mode Setting IE 5.25 C (note 4) TV 2 */ |
639 | 0 | ELEM_OPT_TV(BSSLAP_PARAM_CIPHER_MODE_SETTING, GSM_A_PDU_TYPE_RR, DE_RR_CIP_MODE_SET, NULL); |
640 | 0 | return; |
641 | 0 | } |
642 | | |
643 | | /* 4.2.7 Abort ETSI TS 148 071 V7.2.0 (2007-06) */ |
644 | | static void |
645 | | dissect_gsm_bsslap_abort(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int offset) |
646 | 0 | { |
647 | 0 | uint32_t curr_offset; |
648 | 0 | uint32_t consumed; |
649 | 0 | unsigned curr_len; |
650 | |
|
651 | 0 | curr_offset = offset; |
652 | 0 | curr_len = tvb_reported_length_remaining(tvb,offset); |
653 | | |
654 | | /* Cause IE / 5.14 M TV 2 */ |
655 | 0 | ELEM_MAND_TV(BSSLAP_PARAM_CAUSE, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_CAUSE, NULL, ei_gsm_bsslap_missing_mandatory_element); |
656 | |
|
657 | 0 | return; |
658 | 0 | } |
659 | | /* 4.2.8 TA Layer3 ETSI TS 148 071 V7.2.0 (2007-06) */ |
660 | | static void |
661 | | dissect_gsm_bsslap_ta_layer3(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int offset) |
662 | 0 | { |
663 | 0 | uint32_t curr_offset; |
664 | 0 | uint32_t consumed; |
665 | 0 | unsigned curr_len; |
666 | |
|
667 | 0 | curr_offset = offset; |
668 | 0 | curr_len = tvb_reported_length_remaining(tvb,offset); |
669 | | |
670 | | /* Timing Advance IE / 5.2 M TV 2 */ |
671 | 0 | ELEM_MAND_TV(BSSLAP_PARAM_TIMING_ADVANCE, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_TA, NULL, ei_gsm_bsslap_missing_mandatory_element); |
672 | | /* Measurement Report IE / 5.12 O TLV 18 */ |
673 | 0 | ELEM_OPT_TLV(BSSLAP_PARAM_MEASUREMENT_REPORT, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_MEAS_REP, " BSSLAP"); |
674 | | /* Enhanced Measurement Report IE / 5.18 O TLV 4-n */ |
675 | 0 | ELEM_OPT_TLV(BSSLAP_PARAM_ENHANCED_MEASUREMENT_REPORT, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_ENH_MEAS_REP, NULL); |
676 | | /*Cell Identity List IE / 5.17 O TLV 6-n */ |
677 | 0 | ELEM_OPT_TLV(BSSLAP_PARAM_CELL_IDENTITY_LIST, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_CELL_ID_LIST, "-Measured Cell"); |
678 | 0 | return; |
679 | 0 | } |
680 | | /* 4.2.9 MS Position Command ETSI TS 148 071 V7.2.0 (2007-06) */ |
681 | | static void |
682 | | dissect_gsm_bsslap_ms_pos_cmd(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int offset) |
683 | 0 | { |
684 | 0 | uint32_t curr_offset; |
685 | 0 | uint32_t consumed; |
686 | 0 | unsigned curr_len; |
687 | |
|
688 | 0 | curr_offset = offset; |
689 | 0 | curr_len = tvb_reported_length_remaining(tvb,offset); |
690 | | |
691 | | /* RRLP flag IE / 5.15 M TV 2 */ |
692 | 0 | ELEM_MAND_TV(BSSLAP_PARAM_RRLP_FLAG, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_RRLP_FLG, "flag", ei_gsm_bsslap_missing_mandatory_element); |
693 | | /* RRLP IE / 5.16 M TLV 3-n */ |
694 | 0 | ELEM_MAND_TV(BSSLAP_PARAM_RRLP_IE, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_RRLP_IE, "RRLP Info", ei_gsm_bsslap_missing_mandatory_element); |
695 | 0 | return; |
696 | 0 | } |
697 | | /* 4.2.10 MS Position Response ETSI TS 148 071 V7.2.0 (2007-06) */ |
698 | | static void |
699 | | dissect_gsm_bsslap_ms_pos_res(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int offset) |
700 | 0 | { |
701 | 0 | uint32_t curr_offset; |
702 | 0 | uint32_t consumed; |
703 | 0 | unsigned curr_len; |
704 | |
|
705 | 0 | curr_offset = offset; |
706 | 0 | curr_len = tvb_reported_length_remaining(tvb,offset); |
707 | | |
708 | | /* flag RRLP flag IE / 5.15 M TV 2 */ |
709 | 0 | ELEM_MAND_TV(BSSLAP_PARAM_RRLP_FLAG, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_RRLP_FLG, "flag", ei_gsm_bsslap_missing_mandatory_element); |
710 | | /* RRLP Info RRLP IE / 5.16 M TLV 3-n */ |
711 | 0 | ELEM_MAND_TV(BSSLAP_PARAM_RRLP_IE, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_RRLP_IE, "RRLP Info", ei_gsm_bsslap_missing_mandatory_element); |
712 | | /* Timing Advance IE / 5.2 O TV 2 */ |
713 | 0 | ELEM_OPT_TV(BSSLAP_PARAM_TIMING_ADVANCE, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_TA, NULL); |
714 | | /* Measurement Report IE / 5.12 O TLV 18 */ |
715 | 0 | ELEM_OPT_TLV(BSSLAP_PARAM_MEASUREMENT_REPORT, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_MEAS_REP, " BSSLAP"); |
716 | | /* Enhanced Measurement Report IE / 5.18 O TLV 4-n */ |
717 | 0 | ELEM_OPT_TLV(BSSLAP_PARAM_ENHANCED_MEASUREMENT_REPORT, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_ENH_MEAS_REP, NULL); |
718 | | /* Cell Identity List IE / 5.17 O TLV 6-n */ |
719 | 0 | ELEM_OPT_TLV(BSSLAP_PARAM_CELL_IDENTITY_LIST, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_CELL_ID_LIST, "-Measured Cell"); |
720 | 0 | return; |
721 | 0 | } |
722 | | /* 4.2.11 U-TDOA Request ETSI TS 148 071 V7.2.0 (2007-06) */ |
723 | | static void |
724 | | dissect_gsm_bsslap_u_tdoa_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int offset) |
725 | 0 | { |
726 | 0 | uint32_t curr_offset; |
727 | 0 | uint32_t consumed; |
728 | 0 | unsigned curr_len; |
729 | |
|
730 | 0 | curr_offset = offset; |
731 | 0 | curr_len = tvb_reported_length_remaining(tvb,offset); |
732 | | |
733 | | /* Delta Timer IE 5.22 O (note 1) TV 2 */ |
734 | 0 | ELEM_OPT_TV(BSSLAP_PARAM_DELTA_TIMER, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_DELTA_TIME, NULL); |
735 | | /* Polling Repetition IE 5.28 (note) C (note 2) TV 2 */ |
736 | 0 | ELEM_OPT_TV(BSSLAP_PARAM_POLLING_REPETITION, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_POLL_REP, NULL); |
737 | |
|
738 | 0 | return; |
739 | 0 | } |
740 | | /* 4.2.12 U-TDOA Response ETSI TS 148 071 V7.2.0 (2007-06) */ |
741 | | static void |
742 | | dissect_gsm_bsslap_u_tdoa_res(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int offset) |
743 | 0 | { |
744 | 0 | uint32_t curr_offset; |
745 | 0 | uint32_t consumed; |
746 | 0 | unsigned curr_len; |
747 | |
|
748 | 0 | curr_offset = offset; |
749 | 0 | curr_len = tvb_reported_length_remaining(tvb,offset); |
750 | | |
751 | | /* Channel Description IE 5.8 M TV 4 */ |
752 | 0 | ELEM_MAND_TV(BSSLAP_PARAM_CHANNEL_DESCRIPTION,GSM_A_PDU_TYPE_RR, DE_RR_CH_DSC, NULL, ei_gsm_bsslap_missing_mandatory_element); |
753 | | /* Serving Cell Identifier Cell Identifier IE 5.23 M TLV 4-n */ |
754 | 0 | ELEM_MAND_TLV(BSSLAP_PARAM_SERVING_CELL_IDENTIFIER,GSM_A_PDU_TYPE_BSSMAP, BE_CELL_ID, NULL, ei_gsm_bsslap_missing_mandatory_element); |
755 | | /* Frequency List IE 5.20 C (note 3) TLV 3-n */ |
756 | 0 | ELEM_OPT_TLV(BSSLAP_PARAM_FREQUENCY_LIST, GSM_A_PDU_TYPE_RR, DE_RR_FREQ_LIST, NULL); |
757 | | /* Timing Advance IE 5.2 O TV 2 */ |
758 | 0 | ELEM_OPT_TV(BSSLAP_PARAM_TIMING_ADVANCE, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_TA, NULL); |
759 | | /* MS Power IE 5.21 O TV 2 */ |
760 | 0 | ELEM_OPT_TV(BSSLAP_PARAM_MS_POWER, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_MS_POW, NULL); |
761 | | /* Measurement Report IE 5.12 O TLV 18 */ |
762 | 0 | ELEM_OPT_TLV(BSSLAP_PARAM_MEASUREMENT_REPORT, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_MEAS_REP, " BSSLAP"); |
763 | | /* Encryption Key IE 5.24 C (note 4) TV 9 */ |
764 | 0 | ELEM_OPT_TV(BSSLAP_PARAM_ENCRYPTION_KEY, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_ENC_KEY, NULL); |
765 | | /* Cipher Mode Setting IE 5.25 C (note 4) TV 2 */ |
766 | 0 | ELEM_OPT_TV(BSSLAP_PARAM_CIPHER_MODE_SETTING, GSM_A_PDU_TYPE_RR, DE_RR_CIP_MODE_SET, NULL); |
767 | | /* Channel Mode IE 5.26 C (notes 1 & 4)TV 2 */ |
768 | 0 | ELEM_OPT_TV(BSSLAP_PARAM_CHANNEL_MODE, GSM_A_PDU_TYPE_RR, DE_RR_CH_MODE, NULL); |
769 | | /* MultiRate Configuration IE 5.27 C (notes 1 & 4)TLV 4-n */ |
770 | 0 | ELEM_OPT_TLV(BSSLAP_PARAM_MULTIRATE_CONFIGURATION, GSM_A_PDU_TYPE_RR, DE_RR_MULTIRATE_CONF, NULL); |
771 | | /* Cell Identity List IE / 5.17 O TLV 6-n */ |
772 | 0 | ELEM_OPT_TLV(BSSLAP_PARAM_CELL_IDENTITY_LIST, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_CELL_ID_LIST, "-Measured Cell"); |
773 | | /* Packet Channel Description IE 5.29 C (note 5) TV 4 */ |
774 | 0 | ELEM_OPT_TLV(BSSLAP_PARAM_PACKET_CHANNEL_DESCRIPTION, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_PKT_CH_DESC, NULL); |
775 | | /* TLLI IE 5.30 C (note 5) TV 5 */ |
776 | 0 | ELEM_OPT_TV(BSSLAP_PARAM_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI, NULL); |
777 | | /* TFI IE 5.31 C (note 5) TV 2 BSSLAP_PARAM_TFI*/ |
778 | 0 | ELEM_OPT_TV(BSSLAP_PARAM_TFI, GSM_A_PDU_TYPE_BSSLAP, DE_BLAP_TFI, NULL); |
779 | | /* Starting Time IE 5.32 C (note 5) TV 3*/ |
780 | 0 | ELEM_OPT_TV(BSSLAP_PARAM_STARTING_TIME, GSM_A_PDU_TYPE_RR, DE_RR_STARTING_TIME, "TBF Starting Time"); |
781 | 0 | return; |
782 | 0 | } |
783 | | |
784 | | |
785 | | static int |
786 | | dissect_gsm_bsslap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) |
787 | 0 | { |
788 | 0 | proto_item *item; |
789 | 0 | proto_tree *sub_tree; |
790 | 0 | int offset=0; |
791 | 0 | uint8_t octet; |
792 | | |
793 | | /* Make entries in Protocol column and Info column on summary display */ |
794 | 0 | col_append_str(pinfo->cinfo, COL_PROTOCOL, "/BSSLAP"); |
795 | 0 | if (tree) { |
796 | 0 | octet = tvb_get_uint8(tvb, offset); |
797 | 0 | item = proto_tree_add_item(tree, proto_gsm_bsslap, tvb, 0, -1, ENC_NA); |
798 | 0 | sub_tree = proto_item_add_subtree(item, ett_gsm_bsslap); |
799 | | |
800 | | /* Message Type IE / 5.1 M V 1 */ |
801 | 0 | proto_tree_add_item(sub_tree, hf_gsm_bsslap_msg_type, tvb, offset, 1, ENC_BIG_ENDIAN); |
802 | 0 | offset++; |
803 | |
|
804 | 0 | switch (octet){ |
805 | 0 | case BSSLAP_TA_REQUEST: |
806 | | /* Only message type IE */ |
807 | 0 | break; |
808 | 0 | case BSSLAP_TA_RESPONSE: |
809 | 0 | dissect_gsm_bsslap_ta_res(tvb, sub_tree, pinfo, offset); |
810 | 0 | break; |
811 | 0 | case BSSLAP_REJECT: |
812 | 0 | dissect_gsm_bsslap_reject(tvb, sub_tree, pinfo, offset); |
813 | 0 | break; |
814 | 0 | case BSSLAP_RESET: |
815 | 0 | dissect_gsm_bsslap_reset(tvb, sub_tree, pinfo, offset); |
816 | 0 | break; |
817 | 0 | case BSSLAP_ABORT: |
818 | 0 | dissect_gsm_bsslap_abort(tvb, sub_tree, pinfo, offset); |
819 | 0 | break; |
820 | 0 | case BSSLAP_TA_LAYER3: |
821 | 0 | dissect_gsm_bsslap_ta_layer3(tvb, sub_tree, pinfo, offset); |
822 | 0 | break; |
823 | 0 | case BSSLAP_MS_POS_CMD: |
824 | 0 | dissect_gsm_bsslap_ms_pos_cmd(tvb, sub_tree, pinfo, offset); |
825 | 0 | break; |
826 | 0 | case BSSLAP_MS_POS_RES: |
827 | 0 | dissect_gsm_bsslap_ms_pos_res(tvb, sub_tree, pinfo, offset); |
828 | 0 | break; |
829 | 0 | case BSSLAP_U_TDOA_REQ: |
830 | 0 | dissect_gsm_bsslap_u_tdoa_req(tvb, sub_tree, pinfo, offset); |
831 | 0 | break; |
832 | 0 | case BSSLAP_U_TDOA_RES: |
833 | 0 | dissect_gsm_bsslap_u_tdoa_res(tvb, sub_tree, pinfo, offset); |
834 | 0 | break; |
835 | 0 | default: |
836 | 0 | break; |
837 | 0 | } |
838 | 0 | } |
839 | | |
840 | 0 | return tvb_captured_length(tvb); |
841 | 0 | } |
842 | | |
843 | | void |
844 | | proto_reg_handoff_gsm_bsslap(void) |
845 | 14 | { |
846 | 14 | bsslap_rrlp_handle = find_dissector_add_dependency("rrlp", proto_gsm_bsslap); |
847 | 14 | } |
848 | | |
849 | | void |
850 | | proto_register_gsm_bsslap(void) |
851 | 14 | { |
852 | 14 | unsigned i; |
853 | 14 | unsigned last_offset; |
854 | | |
855 | | |
856 | | /* Setup list of header fields */ |
857 | 14 | static hf_register_info hf[] = { |
858 | 14 | { &hf_gsm_bsslap_msg_type, |
859 | 14 | { "Message Type IE", "gsm_bsslap.msg_type", |
860 | 14 | FT_UINT8, BASE_DEC, VALS(gsm_a_bsslap_msg_strings), 0x0, |
861 | 14 | NULL, HFILL } |
862 | 14 | }, |
863 | 14 | { &hf_gsm_a_bsslap_elem_id, |
864 | 14 | { "Element ID", "gsm_bsslap.elem_id", |
865 | 14 | FT_UINT8, BASE_HEX, NULL, 0, |
866 | 14 | NULL, HFILL } |
867 | 14 | }, |
868 | 14 | { &hf_gsm_bsslap_ta, |
869 | 14 | { "Timing Advance", "gsm_bsslap.ta", |
870 | 14 | FT_UINT8, BASE_HEX, NULL, 0x0, |
871 | 14 | NULL, HFILL } |
872 | 14 | }, |
873 | 14 | { &hf_gsm_bsslap_timer_value, |
874 | 14 | {"Timer Value", "gsm_bsslap.timerValue", |
875 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
876 | 14 | NULL, HFILL } |
877 | 14 | }, |
878 | | |
879 | 14 | { &hf_gsm_bsslap_ms_pow, |
880 | 14 | {"MS Power", "gsm_bsslap.MS_pow", |
881 | 14 | FT_UINT8, BASE_DEC, NULL, 0x0, |
882 | 14 | NULL, HFILL } |
883 | 14 | }, |
884 | 14 | { &hf_gsm_bsslap_cause, |
885 | 14 | {"Cause", "gsm_bsslap.cause", |
886 | 14 | FT_UINT8, BASE_DEC, VALS(gsm_bsslap_cause_vals), 0x0, |
887 | 14 | NULL, HFILL } |
888 | 14 | }, |
889 | 14 | { &hf_gsm_bsslap_rrlp_flg, |
890 | 14 | {"RRLP Flag", "gsm_bsslap.rrlp_flg", |
891 | 14 | FT_BOOLEAN, 8, TFS(&gsm_bsslap_rrlp_flg_vals), 0x01, |
892 | 14 | "Cause", HFILL } |
893 | 14 | }, |
894 | 14 | { &hf_gsm_bsslap_tfi, |
895 | 14 | {"TFI", "gsm_bsslap.tfi", |
896 | 14 | FT_UINT8, BASE_DEC, NULL, 0x1f, |
897 | 14 | NULL, HFILL } |
898 | 14 | }, |
899 | 14 | { &hf_gsm_bsslap_poll_rep, |
900 | 14 | {"Number of polling repetitions", "gsm_bsslap.poll_rep", |
901 | 14 | FT_UINT8, BASE_DEC, NULL, 0x3F, |
902 | 14 | NULL, HFILL } |
903 | 14 | }, |
904 | 14 | { &hf_gsm_bsslap_lac, |
905 | 14 | {"Location Area Code", "gsm_bsslap.lac", |
906 | 14 | FT_UINT8, BASE_DEC, NULL, 0x3f, |
907 | 14 | NULL, HFILL } |
908 | 14 | }, |
909 | 14 | { &hf_gsm_bsslap_cell_id_disc, |
910 | 14 | {"Cell identification Discriminator", "gsm_bsslap.cell_id_disc", |
911 | 14 | FT_UINT8, BASE_DEC, VALS(gsm_a_bsslap_cell_id_disc_vals), 0xf, |
912 | 14 | NULL, HFILL } |
913 | 14 | }, |
914 | 14 | { &hf_gsm_bsslap_encryption_key, |
915 | 14 | {"Encryption Key (Kc)", "gsm_bsslap.encryption_key", |
916 | 14 | FT_BYTES, BASE_NONE, NULL, 0x0, |
917 | 14 | NULL, HFILL } |
918 | 14 | }, |
919 | 14 | }; |
920 | | |
921 | 14 | static ei_register_info ei[] = { |
922 | 14 | { &ei_gsm_bsslap_missing_mandatory_element, { "gsm_bsslap.missing_mandatory_element", PI_PROTOCOL, PI_WARN, "Missing Mandatory element, rest of dissection is suspect", EXPFILL }}, |
923 | 14 | { &ei_gsm_bsslap_not_decoded_yet, { "gsm_bsslap.not_decoded_yet", PI_UNDECODED, PI_WARN, "Not decoded yet", EXPFILL }}, |
924 | 14 | }; |
925 | | |
926 | 14 | expert_module_t* expert_gsm_bsslap; |
927 | | |
928 | | /* Setup protocol subtree array */ |
929 | 14 | #define NUM_INDIVIDUAL_ELEMS 2 |
930 | 14 | int *ett[NUM_INDIVIDUAL_ELEMS + NUM_GSM_BSSLAP_MSG + |
931 | 14 | NUM_GSM_BSSLAP_ELEM]; |
932 | | |
933 | 14 | ett[0] = &ett_gsm_bsslap; |
934 | 14 | ett[1] = &ett_bsslap_cell_list; |
935 | | |
936 | 14 | last_offset = NUM_INDIVIDUAL_ELEMS; |
937 | | |
938 | 210 | for (i=0; i < NUM_GSM_BSSLAP_MSG; i++, last_offset++) |
939 | 196 | { |
940 | 196 | ett[last_offset] = &ett_gsm_bsslap_msg[i]; |
941 | 196 | } |
942 | | |
943 | 462 | for (i=0; i < NUM_GSM_BSSLAP_ELEM; i++, last_offset++) |
944 | 448 | { |
945 | 448 | ett[last_offset] = &ett_gsm_bsslap_elem[i]; |
946 | 448 | } |
947 | | |
948 | | |
949 | | /* Register the protocol name and description */ |
950 | 14 | proto_gsm_bsslap = |
951 | 14 | proto_register_protocol("BSS LCS Assistance Protocol", |
952 | 14 | "BSSLAP", "bsslap"); |
953 | | |
954 | | /* Required function calls to register the header fields and subtrees used */ |
955 | 14 | proto_register_field_array(proto_gsm_bsslap, hf, array_length(hf)); |
956 | 14 | proto_register_subtree_array(ett, array_length(ett)); |
957 | 14 | expert_gsm_bsslap = expert_register_protocol(proto_gsm_bsslap); |
958 | 14 | expert_register_field_array(expert_gsm_bsslap, ei, array_length(ei)); |
959 | | |
960 | 14 | register_dissector("gsm_bsslap", dissect_gsm_bsslap, proto_gsm_bsslap); |
961 | 14 | } |
962 | | |
963 | | /* |
964 | | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
965 | | * |
966 | | * Local variables: |
967 | | * c-basic-offset: 4 |
968 | | * tab-width: 8 |
969 | | * indent-tabs-mode: nil |
970 | | * End: |
971 | | * |
972 | | * vi: set shiftwidth=4 tabstop=8 expandtab: |
973 | | * :indentSize=4:tabSize=8:noTabs=true: |
974 | | */ |