Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-gsm_bssmap_le.c
blob6ca52de5e5bae15a0fce3631245b67d15df209f9
1 /* packet-gsm_bssmap_le.c
2 * Routines for GSM Lb Interface BSSMAP dissection
4 * Copyright 2008, Johnny Mitrevski <mitrevj@hotmail.com>
6 * 3GPP TS 49.031 version v7.4.0 (2009-09)
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * SPDX-License-Identifier: GPL-2.0-or-later
15 #include "config.h"
17 #include <epan/packet.h>
18 #include <epan/expert.h>
19 #include <epan/tap.h>
20 #include <epan/tfs.h>
21 #include <wsutil/array.h>
22 #include "packet-bssap.h"
23 #include "packet-gsm_a_common.h"
25 void proto_register_gsm_bssmap_le(void);
26 void proto_reg_handoff_gsm_bssmap_le(void);
28 /* PROTOTYPES/FORWARDS */
30 /* Message Type definitions */
31 #define BSSMAP_LE_PERFORM_LOCATION_REQUEST 43
32 #define BSSMAP_LE_PERFORM_LOCATION_RESPONSE 45
33 #define BSSMAP_LE_PERFORM_LOCATION_ABORT 46
34 #define BSSMAP_LE_PERFORM_LOCATION_INFORMATION 47
35 #define BSSMAP_LE_CONNECTION_ORIENTED_INFORMATION 42
36 #define BSSMAP_LE_CONNECTIONLESS_INFORMATION 58
37 #define BSSMAP_LE_RESET 48
38 #define BSSMAP_LE_RESET_ACKNOWLEDGE 49
40 static const value_string gsm_bssmap_le_msg_strings[] = {
41 { 0, "Reserved" },
42 { 1, "Reserved" },
43 { 2, "Reserved" },
44 { 3, "Reserved" },
45 { 4, "Reserved" },
46 { BSSMAP_LE_PERFORM_LOCATION_REQUEST, "Perform Location Request" },
47 { BSSMAP_LE_PERFORM_LOCATION_RESPONSE, "Perform Location Response" },
48 { BSSMAP_LE_PERFORM_LOCATION_ABORT, "Perform Location Abort" },
49 { BSSMAP_LE_PERFORM_LOCATION_INFORMATION, "Perform Location Information" },
50 { BSSMAP_LE_CONNECTION_ORIENTED_INFORMATION, "Connection Oriented Information" },
51 { BSSMAP_LE_CONNECTIONLESS_INFORMATION, "Connectionless Information" },
52 { BSSMAP_LE_RESET, "Reset" },
53 { BSSMAP_LE_RESET_ACKNOWLEDGE, "Reset Acknowledge" },
54 { 0, NULL }
57 /* Information Element definitions */
58 #define BSSMAP_LE_LCS_QOS 62
59 #define BSSMAP_LE_LCS_PRIORITY 67
60 #define BSSMAP_LE_LOCATION_TYPE 68
61 #define BSSMAP_LE_GANSS_LOCATION_TYPE 130
62 #define BSSMAP_LE_GEOGRAPHIC_LOCATION 69
63 #define BSSMAP_LE_POSITIONING_DATA 70
64 #define BSSMAP_LE_GANSS_POSITIONING_DATA 131
65 #define BSSMAP_LE_VELOCITY_DATA 85
66 #define BSSMAP_LE_LCS_CAUSE 71
67 #define BSSMAP_LE_LCS_CLIENT_TYPE 72
68 #define BSSMAP_LE_APDU 73
69 #define BSSMAP_LE_NETWORK_ELEMENT_IDENTITY 74
70 #define BSSMAP_LE_REQUESTED_GPS_ASSISTANCE_DATA 75
71 #define BSSMAP_LE_REQUESTED_GANSS_ASSISTANCE_DATA 65
72 #define BSSMAP_LE_DECIPHERING_KEYS 76
73 #define BSSMAP_LE_RETURN_ERROR_REQUEST 77
74 #define BSSMAP_LE_RETURN_ERROR_CAUSE 78
75 #define BSSMAP_LE_SEGMENTATION 79
76 #define BSSMAP_LE_CLASSMARK_INFORMATION_TYPE_3 19
77 #define BSSMAP_LE_CAUSE 4
78 #define BSSMAP_LE_CELL_IDENTIFIER 5
79 #define BSSMAP_LE_CHOSEN_CHANNEL 33
80 #define BSSMAP_LE_IMSI 0
81 #define BSSMAP_LE_RESERVED_NOTE1 1
82 #define BSSMAP_LE_RESERVED_NOTE2 2
83 #define BSSMAP_LE_RESERVED_NOTE3 3
84 #define BSSMAP_LE_LCS_CAPABILITY 80
85 #define BSSMAP_LE_PACKET_MEASUREMENT_REPORT 81
86 #define BSSMAP_LE_CELL_IDENTITY_LIST 82
87 #define BSSMAP_LE_IMEI 128
89 static const value_string gsm_bssmap_le_elem_strings[] = {
90 { DE_BMAPLE_LCSQOS, "LCS QoS" },
91 { DE_BMAPLE_LCS_PRIO, "LCS Priority" },
92 { DE_BMAPLE_LOC_TYPE, "Location Type" },
93 { DE_BMAPLE_GANSS_LOC_TYPE, "GANSS Location Type" },
94 { DE_BMAPLE_GEO_LOC, "Geographic Location" },
95 { DE_BMAPLE_POS_DATA, "Positioning Data" },
96 { DE_BMAPLE_GANSS_POS_DATA, "GANSS Positioning Data" },
97 { DE_BMAPLE_VELOC_DATA, "Velocity Data" },
98 { DE_BMAPLE_LCS_CAUSE, "LCS Cause" },
99 { DE_BMAPLE_LCS_CLIENT_TYPE, "LCS Client Type" },
100 { DE_BMAPLE_APDU, "APDU" },
101 { DE_BMAPLE_NETWORK_ELEM_ID, "Network Element Identity" },
102 { DE_BMAPLE_REQ_GPS_ASSIST_D, "Requested GPS Assistance Data" },
103 { DE_BMAPLE_REQ_GNSS_ASSIST_D, "Requested GANSS Assistance Data" },
104 { DE_BMAPLE_DECIPH_KEYS, "Deciphering Keys" },
105 { DE_BMAPLE_RETURN_ERROR_REQ, "Return Error Request" },
106 { DE_BMAPLE_RETURN_ERROR_CAUSE, "Return Error Cause" },
107 { DE_BMAPLE_SEGMENTATION, "Segmentation" },
108 { DE_BMAPLE_CLASSMARK_TYPE_3, "Classmark Information Type 3" },
109 { DE_BMAPLE_CAUSE, "Cause" },
110 { DE_BMAPLE_CELL_IDENTIFIER, "Cell Identifier" },
111 { DE_BMAPLE_CHOSEN_CHANNEL, "Chosen Channel" },
112 { DE_BMAPLE_IMSI, "IMSI" },
113 { DE_BMAPLE_RES1, "Reserved" },
114 { DE_BMAPLE_RES2, "Reserved" },
115 { DE_BMAPLE_RES3, "Reserved" },
116 { DE_BMAPLE_LCS_CAPABILITY, "LCS Capability" },
117 { DE_BMAPLE_PACKET_MEAS_REP, "Packet Measurement Report" },
118 { DE_BMAPLE_MEAS_CELL_ID, "Cell Identity List" },
119 { DE_BMAPLE_IMEI, "IMEI" },
120 { 0, NULL }
122 value_string_ext gsm_bssmap_le_elem_strings_ext = VALUE_STRING_EXT_INIT(gsm_bssmap_le_elem_strings);
124 static const value_string gsm_apdu_protocol_id_strings[] = {
125 { 0, "reserved" },
126 { 1, "BSSLAP" },
127 { 2, "LLP" },
128 { 3, "SMLCPP" },
129 { 0, NULL },
132 /* Velocity Requested definitions */
133 static const value_string bssmap_le_velocity_requested_vals[] = {
134 { 0, "do not report velocity" },
135 { 1, "report velocity if available" },
136 { 0, NULL}
139 /* Vertical Coordinate definitions */
140 static const value_string bssmap_le_vertical_coordinate_indicator_vals[] = {
141 { 0, "vertical coordinate not requested" },
142 { 1, "vertical coordinate is requested" },
143 { 0, NULL}
146 /* Horizontal Accuracy definitions */
147 static const value_string bssmap_le_horizontal_accuracy_indicator_vals[] = {
148 { 0, "horizontal accuracy is not specified" },
149 { 1, "horizontal accuracy is specified" },
150 { 0, NULL}
153 /* Vertical Accuracy definitions */
154 static const value_string bssmap_le_vertical_accuracy_indicator_vals[] = {
155 { 0, "vertical accuracy is not specified" },
156 { 1, "vertical accuracy is specified" },
157 { 0, NULL}
160 /* Response Time definitions */
161 static const value_string bssmap_le_response_time_definitions_vals[] = {
162 { 0, "Response Time is not specified" },
163 { 1, "Low Delay" },
164 { 2, "Delay Tolerant" },
165 { 3, "reserved" },
166 { 0, NULL}
169 static const value_string bssmap_le_loc_inf_vals[] = {
170 { 0, "Current Geographic Location" },
171 { 1, "Location Assistance Information for the target MS" },
172 { 2, "Deciphering keys for broadcast assistance data for the target MS" },
173 { 0, NULL }
176 static const value_string bssmap_le_pos_method_vals[] = {
177 { 0, "Reserved" },
178 { 1, "Mobile Assisted E-OTD" },
179 { 2, "Mobile Based E-OTD" },
180 { 3, "Assisted GPS" },
181 { 4, "Assisted GANSS" },
182 { 5, "Assisted GPS and Assisted GANSS" },
183 { 0, NULL }
186 static const value_string bssmap_le_pos_data_pos_method_vals[] = {
187 { 0, "Timing Advance" },
188 { 1, "Reserved" },
189 { 2, "Reserved" },
190 { 3, "Mobile Assisted E - OTD" },
191 { 4, "Mobile Based E - OTD" },
192 { 5, "Mobile Assisted GPS" },
193 { 6, "Mobile Based GPS" },
194 { 7, "Conventional GPS" },
195 { 8, "U - TDOA" },
196 { 9, "Reserved for UTRAN use only" },
197 { 0xa, "Reserved for UTRAN use only" },
198 { 0xb, "Reserved for UTRAN use only" },
199 { 0xc, "Cell ID" },
200 { 0, NULL }
203 static const value_string bssmap_le_pos_data_usage_vals[] = {
204 { 0, "Attempted unsuccessfully due to failure or interruption" },
205 { 1, "Attempted successfully : results not used to generate location" },
206 { 2, "Attempted successfully : results used to verify but not generate location" },
207 { 3, "Attempted successfully : results used to generate location" },
208 { 4, "Attempted successfully : method or methods used by the MS cannot be determined" },
209 { 0, NULL }
212 /* Initialize the protocol and registered fields */
213 static int proto_bssmap_le;
214 int hf_gsm_bssmap_le_elem_id;
216 /* The following hf_* variables are used to hold the Wireshark IDs of
217 * our header fields; they are filled out when we call
218 * proto_register_field_array() in proto_register_bssmap_le()
220 static int hf_gsm_bssmap_le_msg_type;
221 static int hf_gsm_bssmap_le_apdu_protocol_id;
222 static int hf_gsm_bssmap_le_spare;
223 static int hf_gsm_bssmap_le_ciphering_key_flag;
224 static int hf_gsm_bssmap_le_current_deciphering_key_value;
225 static int hf_gsm_bssmap_le_next_deciphering_key_value;
226 static int hf_gsm_bssmap_le_acq_ass;
227 static int hf_gsm_bssmap_le_ref_time;
228 static int hf_gsm_bssmap_le_ref_loc;
229 static int hf_gsm_bssmap_le_dgps_corr;
230 static int hf_gsm_bssmap_le_nav_mod;
231 static int hf_gsm_bssmap_le_iono_mod;
232 static int hf_gsm_bssmap_le_utc_mod;
233 static int hf_gsm_bssmap_le_almanac;
234 static int hf_gsm_bssmap_le_ephemeris_ext_chk;
235 static int hf_gsm_bssmap_le_ephemeris_ext;
236 static int hf_gsm_bssmap_le_real_time_int;
237 static int hf_gsm_bssmap_le_lcs_cause_value;
238 static int hf_gsm_bssmap_le_diagnostic_value;
239 static int hf_gsm_bssmap_le_client_category;
240 static int hf_gsm_bssmap_le_client_subtype;
241 static int hf_gsm_bssmap_le_velocity_requested;
242 static int hf_gsm_bssmap_le_vertical_coordinate_indicator;
243 static int hf_gsm_bssmap_le_horizontal_accuracy_indicator;
244 static int hf_gsm_bssmap_le_horizontal_accuracy;
245 static int hf_gsm_bssmap_le_vertical_accuracy_indicator;
246 static int hf_gsm_bssmap_le_vertical_accuracy;
247 static int hf_gsm_bssmap_le_response_time_category;
248 static int hf_gsm_bssmap_le_apdu;
249 static int hf_gsm_bssmap_le_message_elements;
250 static int hf_gsm_bssmap_le_location_inf;
251 static int hf_gsm_bssmap_le_pos_method;
252 static int hf_gsm_bssmap_le_pos_data_disc;
253 static int hf_gsm_bssmap_le_pos_data_pos_method;
254 static int hf_gsm_bssmap_le_pos_data_usage;
257 /* Initialize the subtree pointers */
258 static int ett_bssmap_le_msg;
260 static expert_field ei_gsm_a_bssmap_le_not_decoded_yet;
261 static expert_field ei_gsm_a_bssmap_le_extraneous_data;
262 static expert_field ei_gsm_a_bssmap_le_missing_mandatory_element;
264 static dissector_handle_t gsm_bsslap_handle;
265 static dissector_handle_t bssmap_le_handle;
267 static proto_tree *g_tree;
269 #define NUM_GSM_BSSMAP_LE_ELEM array_length(gsm_bssmap_le_elem_strings)
270 int ett_gsm_bssmap_le_elem[NUM_GSM_BSSMAP_LE_ELEM];
273 * 10.3 APDU
276 static uint16_t
277 de_bmaple_apdu(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_)
279 uint32_t curr_offset;
280 uint8_t apdu_protocol_id;
281 tvbuff_t *APDU_tvb;
283 curr_offset = offset;
285 proto_tree_add_item(tree, hf_gsm_bssmap_le_apdu, tvb, curr_offset, len, ENC_NA);
288 * dissect the embedded APDU message
289 * if someone writes a TS 09.31 dissector
291 * The APDU octets 4 to n are coded in the same way as the
292 * equivalent octet in the APDU element of 3GPP TS 49.031 BSSAP-LE.
295 apdu_protocol_id = tvb_get_uint8(tvb,curr_offset);
296 proto_tree_add_item(tree, hf_gsm_bssmap_le_apdu_protocol_id, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
298 switch(apdu_protocol_id){
299 case 1:
300 /* BSSLAP
301 * the embedded message is as defined in 3GPP TS 08.71(3GPP TS 48.071 version 7.2.0 Release 7)
303 APDU_tvb = tvb_new_subset_length(tvb, curr_offset+1, len-1);
304 if(gsm_bsslap_handle)
305 call_dissector(gsm_bsslap_handle, APDU_tvb, pinfo, g_tree);
306 break;
307 case 2:
308 /* LLP
309 * The embedded message contains a Facility Information Element as defined in 3GPP TS 04.71
310 * excluding the Facility IEI and length of Facility IEI octets defined in 3GPP TS 04.71.(3GPP TS 44.071).
312 break;
313 case 3:
314 /* SMLCPP
315 * The embedded message is as defined in 3GPP TS 08.31(TS 48.031).
317 break;
318 default:
319 break;
322 curr_offset += len;
324 EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_bssmap_le_extraneous_data);
326 return curr_offset - offset;
329 * 10.4 Cause
330 * coded as the value part of the Cause IE defined in 3GPP TS 48.008
333 * 10.5 Cell Identifier
334 * coded as the value part of the Cell Identifier IE defined in 3GPP TS 48.008
337 * 10.6 Chosen Channel
338 * coded as the value part of the Chosen Channel IE defined in 3GPP TS 48.008
341 * 10.7 Classmark Information Type 3
342 * coded as the value part of the Classmark Information Type 3 IE defined in 3GPP TS 48.008
345 * 10.8 Deciphering Keys
347 static uint16_t
348 de_bmaple_decihp_keys(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_)
350 int bit_offset;
352 /* Spare bits */
353 bit_offset = (offset<<3);
354 proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_spare, tvb, bit_offset, 7, ENC_BIG_ENDIAN);
355 bit_offset += 7;
357 /* Extract the Ciphering Key Flag and add to protocol tree */
358 proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_ciphering_key_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
359 bit_offset++;
360 /*offset++;*/
362 /* Extract the Current Deciphering Key Value and add to protocol tree */
363 proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_current_deciphering_key_value, tvb, bit_offset, 56, ENC_NA);
364 bit_offset += 56;
365 /*offset += 7;*/
367 /* Extract the Next Deciphering Key Value and add to protocol tree */
368 proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_next_deciphering_key_value, tvb, bit_offset, 56, ENC_NA);
369 /*offset += 7;*/
371 return len;
374 * 10.9 Geographic Location
375 * contains an octet sequence identical to that for Geographical Information
376 * defined in 3GPP TS 23.032..
379 * 10.10 Requested GPS Assistance Data
381 static uint16_t
382 de_bmaple_req_gps_ass_data(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_)
384 uint32_t curr_offset;
386 curr_offset = offset;
388 /* Octet 3 H G F E D C B A */
389 /* bit H Acquisition Assistance */
390 proto_tree_add_item(tree, hf_gsm_bssmap_le_acq_ass, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
391 /* bit G Reference Time */
392 proto_tree_add_item(tree, hf_gsm_bssmap_le_ref_time, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
393 /* bit F Reference Location */
394 proto_tree_add_item(tree, hf_gsm_bssmap_le_ref_loc, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
395 /* bit E DGPS Corrections */
396 proto_tree_add_item(tree, hf_gsm_bssmap_le_dgps_corr, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
397 /* bit D Navigation Model */
398 proto_tree_add_item(tree, hf_gsm_bssmap_le_nav_mod, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
399 /* bit C Ionospheric Model */
400 proto_tree_add_item(tree, hf_gsm_bssmap_le_iono_mod, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
401 /* bit B UTC Model */
402 proto_tree_add_item(tree, hf_gsm_bssmap_le_utc_mod, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
403 /* bit A Almanac */
404 proto_tree_add_item(tree, hf_gsm_bssmap_le_almanac, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
405 curr_offset++;
407 /* Octet 4 P O N M L K J I
408 * bits L through P are Spare bits
410 /* bit K Ephemeris Extension Check */
411 proto_tree_add_item(tree, hf_gsm_bssmap_le_ephemeris_ext_chk, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
412 /* bit J Ephemeris Extension */
413 proto_tree_add_item(tree, hf_gsm_bssmap_le_ephemeris_ext, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
414 /* bit I Real-Time Integrity */
415 proto_tree_add_item(tree, hf_gsm_bssmap_le_real_time_int, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
416 curr_offset++;
418 /* Octet 5 to Octet 8+2n Satellite related data */
419 proto_tree_add_expert_format(tree, pinfo, &ei_gsm_a_bssmap_le_not_decoded_yet, tvb, curr_offset, len-2, "Satellite related data Not decoded yet");
420 return len;
423 * 10.11 IMSI
424 * coded as the value part of the Mobile Identity IE defined in 3GPP TS 24.008 (NOTE 1)
425 * NOTE 1: The Type of identity field in the Mobile Identity IE shall
426 * be ignored by the receiver
429 * 10.12 (void)
432 * 10.13 LCS Cause
434 static const value_string bssmap_le_lcs_cause_values[] = {
435 { 0, "Unspecified" },
436 { 1, "System Failure" },
437 { 2, "Protocol Error" },
438 { 3, "Data missing in position request" },
439 { 4, "Unexpected data value in position request" },
440 { 5, "Position method failure" },
441 { 6, "Target MS Unreachable" },
442 { 7, "Location request aborted" },
443 { 8, "Facility not supported" },
444 { 9, "Inter-BSC Handover Ongoing" },
445 { 10, "Intra-BSC Handover Complete" },
446 { 11, "Congestion" },
447 { 12, "Inter NSE cell change" },
448 { 13, "Routing Area Update" },
449 { 14, "PTMSI reallocation" },
450 { 15, "Suspension of GPRS services" },
451 { 0, NULL}
454 static const value_string bssmap_le_position_method_failure_diagnostic_vals[] = {
455 { 0, "Congestion" },
456 { 1, "insufficientResources" },
457 { 2, "insufficientMeasurementData" },
458 { 3, "inconsistentMeasurementData" },
459 { 4, "locationProcedureNotCompleted" },
460 { 5, "locationProcedureNotSupportedByTargetMS" },
461 { 6, "qoSNotAttainable" },
462 { 7, "positionMethodNotAvailableInNetwork" },
463 { 8, "positionMethodNotAvailableInLocationArea" },
464 { 0, NULL}
466 static uint16_t
467 de_bmaple_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_)
469 uint32_t curr_offset;
471 curr_offset = offset;
473 /* cause value */
474 proto_tree_add_item(tree, hf_gsm_bssmap_le_lcs_cause_value, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
475 curr_offset++;
477 if (len == 2)
479 /* Diagnostic value (note) */
480 proto_tree_add_item(tree, hf_gsm_bssmap_le_diagnostic_value, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
481 curr_offset++;
484 return curr_offset - offset;
487 * 10.14 LCS Client Type
489 /* Client Category definitions */
490 static const value_string bssmap_le_client_category[] = {
491 { 0, "Value Added Client" },
492 { 2, "PLMN Operator" },
493 { 3, "Emergency Services"},
494 { 4, "Lawful Intercept Services"},
495 { 0, NULL}
498 /* Client Subtype definitions */
499 static const value_string bssmap_le_client_subtype[] = {
500 { 0, "unspecified" },
501 { 1, "broadcast service" },
502 { 2, "O&M" },
503 { 3, "anonymous statistics" },
504 { 4, "Target MS service support" },
505 { 0, NULL}
508 static uint16_t
509 de_bmaple_client(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len _U_, char *add_string _U_, int string_len _U_)
511 uint32_t curr_offset;
512 uint8_t bitCount;
514 bitCount = offset<<3;
515 curr_offset = offset;
517 /* Extract the client category and add to protocol tree */
518 proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_client_category, tvb, bitCount, 4, ENC_BIG_ENDIAN);
519 bitCount = bitCount + 4;
521 /* Extract the client subtype and add to protocol tree */
522 proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_client_subtype, tvb, bitCount, 4, ENC_BIG_ENDIAN);
523 /*bitCount = bitCount + 4;*/
524 curr_offset++;
526 return curr_offset - offset;
529 * 10.15 LCS Priority
530 * coded as the LCS-Priority octet in 3GPP TS 29.002
533 * 10.16 LCS QoS
535 static uint16_t
536 de_bmaple_lcs_qos(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_)
538 uint64_t verticalCoordIndicator, velocityRequested, horizontalAccuracyIndicator, verticalAccuracyIndicator;
539 uint16_t bitCount;
541 bitCount = offset << 3;
543 proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_spare, tvb, bitCount, 6, ENC_BIG_ENDIAN);
544 bitCount = bitCount + 6;
546 /* Extract Velocity requested element */
547 proto_tree_add_bits_ret_val(tree, hf_gsm_bssmap_le_velocity_requested, tvb, bitCount, 1, &velocityRequested, ENC_BIG_ENDIAN);
548 bitCount++;
550 /* Extract vertical coordinator element */
551 proto_tree_add_bits_ret_val(tree, hf_gsm_bssmap_le_vertical_coordinate_indicator, tvb, bitCount, 1, &verticalCoordIndicator, ENC_BIG_ENDIAN);
552 bitCount++;
554 /* Extract horizontal accuracy element */
555 proto_tree_add_bits_ret_val(tree, hf_gsm_bssmap_le_horizontal_accuracy_indicator, tvb, bitCount, 1, &horizontalAccuracyIndicator, ENC_BIG_ENDIAN);
556 bitCount++;
558 if(horizontalAccuracyIndicator == 1)
560 proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_horizontal_accuracy, tvb, bitCount, 7, ENC_BIG_ENDIAN);
561 bitCount = bitCount + 7;
563 else
565 proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_spare, tvb, bitCount, 7, ENC_BIG_ENDIAN);
566 bitCount = bitCount + 7;
569 /* Extract vertical accuracy element */
570 proto_tree_add_bits_ret_val(tree, hf_gsm_bssmap_le_vertical_accuracy_indicator, tvb, bitCount, 1, &verticalAccuracyIndicator, ENC_BIG_ENDIAN);
571 bitCount++;
573 if(verticalAccuracyIndicator == 1)
575 proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_vertical_accuracy, tvb, bitCount, 7, ENC_BIG_ENDIAN);
576 bitCount = bitCount + 7;
578 else
580 proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_spare, tvb, bitCount, 7, ENC_BIG_ENDIAN);
581 bitCount = bitCount + 7;
584 proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_response_time_category, tvb, bitCount, 2, ENC_BIG_ENDIAN);
585 /*bitCount = bitCount + 2;*/
587 return len;
590 * 10.17 (void)
593 * 10.18 Location Type
595 static uint16_t
596 de_bmaple_location_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_)
598 uint32_t curr_offset;
600 curr_offset = offset;
602 /* Location information (octet 3) */
603 proto_tree_add_item(tree, hf_gsm_bssmap_le_location_inf, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
604 curr_offset++;
605 if (len == 1) {
606 return len;
608 /* Positioning Method (octet 4) */
609 proto_tree_add_item(tree, hf_gsm_bssmap_le_pos_method, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
610 curr_offset++;
612 return curr_offset - offset;
615 * 10.19 Network Element Identity
618 * 10.20 Positioning Data
620 static uint16_t
621 de_bmaple_pos_dta(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_)
623 uint32_t curr_offset, value;
625 curr_offset = offset;
627 /* Octet 3 spare Positioning Data Discriminator*/
628 proto_tree_add_item_ret_uint(tree, hf_gsm_bssmap_le_pos_data_disc, tvb, curr_offset, 1, ENC_BIG_ENDIAN, &value);
629 curr_offset++;
631 if (value != 0) {
632 return len;
634 /* 0000 indicate usage of each positioning method that was attempted either successfully or unsuccessfully;
635 * 1 octet of data is provided for each positioning method included
637 while (curr_offset < (offset +len)) {
638 /* Octet x positioning method usage*/
639 proto_tree_add_item(tree, hf_gsm_bssmap_le_pos_data_pos_method, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
640 proto_tree_add_item(tree, hf_gsm_bssmap_le_pos_data_usage, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
641 curr_offset++;
644 return len;
647 * 10.21 Return Error Request
650 * 10.22 Return Error Cause
653 * 10.23 (void)
656 * 10.24 Segmentation
659 * 10.25 (void)
662 * 10.26 LCS Capability
663 * coded as the value part of the LCS Capability
664 * information element in 3GPP TS 48.018, not including
665 * 3GPP TS 48.018 IEI and length indicator
667 /* Dissector for the LCS Capability element */
668 static uint16_t
669 be_lcs_capability(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_)
671 /* Extract the LCS Capability element and add to protocol tree */
672 proto_tree_add_expert(tree, pinfo, &ei_gsm_a_bssmap_le_not_decoded_yet, tvb, offset, len);
673 return len;
677 * 10.27 Packet Measurement Report
678 * coded as the Packet Measurement Report
679 * message or the Packet Enhanced Measurement Report message
680 * starting with the 6-bit MESSAGE_TYPE (see clause 11 in
681 * 3GPP TS 44.060) and ending with the Non-distribution contents
682 * (i.e. the RLC/MAC padding bits are not included). The end of the
683 * message is padded with 0-bits to the nearest octet boundary.
685 /* Dissector for the Packet Measurement Report element */
686 static uint16_t
687 be_packet_meas_rep(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_)
689 /* Extract the Packet Measurement Report element and add to protocol tree */
690 proto_tree_add_expert(tree, pinfo, &ei_gsm_a_bssmap_le_not_decoded_yet, tvb, offset, len);
692 return len;
696 * 10.28 Cell Identity List
697 * coded as the value part of the Cell Identity List IE
698 * defined in 3GPP TS 48.071.
700 /* Dissector for the Measured Cell Identity List element */
701 static uint16_t
702 be_measured_cell_identity(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, uint32_t offset, unsigned len, char *add_string _U_, int string_len _U_)
704 /* Extract the Measured Cell Identity List element and add to protocol tree */
705 proto_tree_add_expert(tree, pinfo, &ei_gsm_a_bssmap_le_not_decoded_yet, tvb, offset, len);
707 return len;
711 * 10.29 IMEI
712 * IMEI coded as the value part of the Mobile Identity IE defined in
713 * 3GPP TS 24.008 (NOTE 1)
714 * NOTE 1: The Type of identity field in the Mobile Identity IE shall
715 * be ignored by the receiver.
718 * 10.30 Velocity Data
719 * contains an octet sequence identical to that for Description of
720 * Velocity defined in 3GPP TS 23.032.
723 * 10.31 Requested GANSS Assistance Data
726 * 10.32 GANSS Positioning Data
729 * 10.33 GANSS Location Type
733 #define NUM_GSM_BSSMAP_LE_MSG array_length(gsm_bssmap_le_msg_strings)
734 static int ett_gsm_bssmap_le_msg[NUM_GSM_BSSMAP_LE_MSG];
737 This enum is defined in packet-gsm_a_common.h to
738 make it possible to use element dissecton from this dissector
739 in other dissectors.
741 It is shown here as a comment for easier reference.
743 Note this enum must be of the same size as the element decoding list below
745 typedef enum
747 DE_BMAPLE_LCSQOS, / 10.16 LCS QoS /
748 DE_BMAPLE_LCS_PRIO, / LCS Priority /
749 DE_BMAPLE_LOC_TYPE, / 10.18 Location Type /
750 DE_BMAPLE_GANSS_LOC_TYPE, / GANSS Location Type /
751 DE_BMAPLE_GEO_LOC, / 10.9 Geographic Location /
752 DE_BMAPLE_POS_DATA, / 10.20 Positioning Data /
753 DE_BMAPLE_GANSS_POS_DATA, / GANSS Positioning Data /
754 DE_BMAPLE_VELOC_DATA, / Velocity Data /
755 DE_BMAPLE_LCS_CAUSE, / 10.13 LCS Cause /
756 DE_BMAPLE_LCS_CLIENT_TYPE, / LCS Client Type /
757 DE_BMAPLE_APDU, / 10.3 APDU /
758 DE_BMAPLE_NETWORK_ELEM_ID, / Network Element Identity /
759 DE_BMAPLE_REQ_GPS_ASSIST_D, / 10.10 Requested GPS Assistance Data /
760 DE_BMAPLE_REQ_GNSS_ASSIST_D,/ Requested GANSS Assistance Data /
761 DE_BMAPLE_DECIPH_KEYS, / 10.8 Deciphering Keys /
762 DE_BMAPLE_RETURN_ERROR_REQ, / Return Error Request /
763 DE_BMAPLE_RETURN_ERROR_CAUSE, / Return Error Cause /
764 DE_BMAPLE_SEGMENTATION, / Segmentation /
765 DE_BMAPLE_CLASSMARK_TYPE_3, / 10.7 Classmark Information Type 3 /
766 DE_BMAPLE_CAUSE, / 10.4 Cause /
767 DE_BMAPLE_CELL_IDENTIFIER, / 10.5 Cell Identifier /
768 DE_BMAPLE_CHOSEN_CHANNEL, / 10.6 Chosen Channel /
769 DE_BMAPLE_IMSI, / 10.11 IMSI /
770 DE_BMAPLE_RES1, / Reserved /
771 DE_BMAPLE_RES2, / Reserved /
772 DE_BMAPLE_RES3, / Reserved /
773 DE_BMAPLE_LCS_CAPABILITY, / LCS Capability /
774 DE_BMAPLE_PACKET_MEAS_REP, / Packet Measurement Report /
775 DE_BMAPLE_MEAS_CELL_ID, / Measured Cell Identity /
776 DE_BMAPLE_IMEI, / IMEI /
777 BMAPLE_NONE / NONE /
779 bssmap_le_elem_idx_t;
783 uint16_t (*bssmap_le_elem_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len, char *add_string, int string_len) = {
784 /* NOTE: The null types below are defined elsewhere. i.e in packet-gsm_a_bssmap.c */
785 de_bmaple_lcs_qos, /* 10.16 LCS QoS */
786 NULL, /* LCS Priority */
787 de_bmaple_location_type, /* 10.18 Location Type */
788 be_ganss_loc_type, /* GANSS Location Type */
789 NULL, /* 10.9 Geographic Location */
790 de_bmaple_pos_dta, /* 10.20 Positioning Data */
791 be_ganss_pos_dta, /* GANSS Positioning Data */
792 NULL, /* Velocity Data */
793 de_bmaple_cause, /* 10.13 LCS Cause */
794 de_bmaple_client, /* LCS Client Type */
795 de_bmaple_apdu, /* APDU */
796 NULL, /* Network Element Identity */
797 de_bmaple_req_gps_ass_data, /* 10.10 Requested GPS Assistance Data */
798 be_ganss_ass_dta, /* Requested GANSS Assistance Data */
799 de_bmaple_decihp_keys, /* 10.8 Deciphering Keys */
800 NULL, /* Return Error Request */
801 NULL, /* Return Error Cause */
802 NULL, /* Segmentation */
803 NULL, /* 10.7 Classmark Information Type 3 */
804 NULL, /* Cause */
805 NULL, /* Cell Identifier */
806 NULL, /* 10.6 Chosen Channel */
807 de_mid, /* 10.11 IMSI */
808 NULL, /* Reserved */
809 NULL, /* Reserved */
810 NULL, /* Reserved */
811 be_lcs_capability, /* LCS Capability */
812 be_packet_meas_rep, /* Packet Measurement Report */
813 be_measured_cell_identity, /* Measured Cell Identity List */
814 de_mid, /* IMEI (use same dissector as IMSI) */
816 NULL, /* NONE */
821 * 9.1 PERFORM LOCATION REQUEST
823 static void
824 bssmap_le_perf_loc_request(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len)
826 uint32_t curr_offset;
827 uint32_t consumed;
828 unsigned curr_len;
830 curr_offset = offset;
831 curr_len = len;
833 /* Location Type 9.1.1 M 3-n */
834 ELEM_MAND_TLV(BSSMAP_LE_LOCATION_TYPE, GSM_A_PDU_TYPE_BSSMAP, BE_LOC_TYPE, NULL, ei_gsm_a_bssmap_le_missing_mandatory_element)
835 /* Cell Identifier 9.1.2 O 5-10 */
836 ELEM_MAND_TLV(BSSMAP_LE_CELL_IDENTIFIER, GSM_A_PDU_TYPE_BSSMAP, BE_CELL_ID, NULL, ei_gsm_a_bssmap_le_missing_mandatory_element);
837 /* Classmark Information Type 3 9.1.3 O 3-14 */
838 ELEM_OPT_TLV(BSSMAP_LE_CLASSMARK_INFORMATION_TYPE_3, GSM_A_PDU_TYPE_BSSMAP, BE_CM_INFO_3, NULL);
839 /* LCS Client Type 9.1.4 C (note 3) 3-n */
840 ELEM_OPT_TLV(BSSMAP_LE_LCS_CLIENT_TYPE, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_LCS_CLIENT_TYPE, NULL);
841 /* Chosen Channel 9.1.5 O 2 */
842 ELEM_OPT_TLV(BSSMAP_LE_CHOSEN_CHANNEL, GSM_A_PDU_TYPE_BSSMAP, BE_CHOSEN_CHAN, NULL);
843 /* LCS Priority 9.1.6 O 3-n */
844 ELEM_OPT_TLV(BSSMAP_LE_LCS_PRIORITY, GSM_A_PDU_TYPE_BSSMAP, BE_LCS_PRIO, NULL);
845 /* LCS QoS 9.1.6a C (note 1) 3-n */
846 ELEM_OPT_TLV(BSSMAP_LE_LCS_QOS, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_LCSQOS, NULL);
847 /* GPS Assistance Data 9.1.7 C (note 2) 3-n */
848 ELEM_OPT_TLV(BSSMAP_LE_REQUESTED_GPS_ASSISTANCE_DATA, GSM_A_PDU_TYPE_BSSMAP, BE_GPS_ASSIST_DATA, NULL);
849 /* APDU 9.1.8 O 3-n */
850 ELEM_OPT_TELV(BSSMAP_LE_APDU, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_APDU, NULL);
851 /* LCS Capability 9.1.9 O */
852 ELEM_OPT_TLV(BSSMAP_LE_LCS_CAPABILITY, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_LCS_CAPABILITY, NULL);
853 /* Packet Measurement Report 9.1.10 O*/
854 ELEM_OPT_TLV(BSSMAP_LE_PACKET_MEASUREMENT_REPORT, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_PACKET_MEAS_REP, NULL);
855 /* Measured Cell Identity List 9.1.11 O*/
856 ELEM_OPT_TLV(BSSMAP_LE_CELL_IDENTITY_LIST, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_MEAS_CELL_ID, NULL);
857 /* IMSI 9.1.12 O (note 4) 5-10 */
858 ELEM_OPT_TLV(BSSMAP_LE_IMSI, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_IMSI, NULL);
859 /* IMEI 9.1.13 O (note 4) 10 (use same decode as IMSI) */
860 ELEM_OPT_TLV(BSSMAP_LE_IMEI, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_IMEI, NULL);
861 /* GANSS Location Type 9.1.14 C 3 */
862 ELEM_OPT_TLV(BSSMAP_LE_GANSS_LOCATION_TYPE, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_GANSS_LOC_TYPE, NULL);
863 /* GANSS Assistance Data 9.1.15 C (note 5) 3-n */
864 ELEM_OPT_TLV(BSSMAP_LE_REQUESTED_GANSS_ASSISTANCE_DATA, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_REQ_GNSS_ASSIST_D, NULL);
866 EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_bssmap_le_extraneous_data);
871 * 9.2 PERFORM LOCATION RESPONSE
873 static void
874 bssmap_le_perf_loc_resp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len)
876 uint32_t curr_offset;
877 uint32_t consumed;
878 unsigned curr_len;
880 curr_offset = offset;
881 curr_len = len;
883 /* Location Estimate 9.2.1 C (note 1) 3-n */
884 ELEM_OPT_TLV(BSSMAP_LE_GEOGRAPHIC_LOCATION, BSSAP_PDU_TYPE_BSSMAP, BE_LOC_EST, NULL);
885 /* Positioning Data 9.2.2 O 3-n */
886 ELEM_OPT_TLV(BSSMAP_LE_POSITIONING_DATA, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_POS_DATA, NULL);
887 /* Deciphering Keys 9.2.3 C (note 2) 3-n */
888 ELEM_OPT_TLV(BSSMAP_LE_DECIPHERING_KEYS, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_DECIPH_KEYS, NULL);
889 /* LCS Cause 9.2.4 C (note 3) 3-n */
890 ELEM_OPT_TLV(BSSMAP_LE_LCS_CAUSE, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_LCS_CAUSE, NULL);
891 /* Velocity Estimate 9.2.5 O 3-n */
892 ELEM_OPT_TLV(BSSMAP_LE_VELOCITY_DATA, BSSAP_PDU_TYPE_BSSMAP, BE_VEL_EST, NULL);
893 /* GANSS Positioning Data 9.2.6 O 3-n */
894 ELEM_OPT_TLV(BSSMAP_LE_GANSS_POSITIONING_DATA, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_GANSS_POS_DATA, NULL);
896 EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_bssmap_le_extraneous_data);
900 * 9.8 CONNECTION ORIENTED INFORMATION
902 static void
903 bssmap_le_connection_oriented(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len)
905 uint32_t curr_offset;
906 uint32_t consumed;
907 unsigned curr_len;
909 curr_offset = offset;
910 curr_len = len;
912 /* APDU 9.8.1 M 3-n */
913 ELEM_MAND_TELV(BSSMAP_LE_APDU, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_APDU, NULL, ei_gsm_a_bssmap_le_missing_mandatory_element);
914 /* Segmentation 9.8.2 */
915 ELEM_OPT_TLV(BSSMAP_LE_SEGMENTATION, BSSAP_PDU_TYPE_BSSMAP, BE_SEG, NULL);
917 EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_bssmap_le_extraneous_data);
921 * 9.9 CONNECTIONLESS INFORMATION
923 Network Element Identity (source) 3.2.2.69 Both M 3-n
924 Network Element Identity (target) 3.2.2.69 Both M 3-n
925 APDU 3.2.2.68 Both M 3-n
926 Segmentation 3.2,2,74 Both C (note 1) 5
927 Return Error Request 3.2.2.72 Both C (note 2) 3-n
928 Return Error Cause 3.2.2.73 Both C (note 3) 3-n
932 * 9.11 RESET ACKNOWLEDGE
933 * no data
937 * 9.12 PERFORM LOCATION INFORMATION
939 static void
940 bssmap_le_perf_loc_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len)
942 uint32_t curr_offset;
943 uint32_t consumed;
944 unsigned curr_len;
946 curr_offset = offset;
947 curr_len = len;
949 /* Cell Identifier 9.12.1 M */
950 ELEM_MAND_TLV(BSSMAP_LE_CELL_IDENTIFIER, GSM_A_PDU_TYPE_BSSMAP, BE_CELL_ID, NULL, ei_gsm_a_bssmap_le_missing_mandatory_element);
951 /* APDU 9.1.8 O 3-n */
952 ELEM_OPT_TELV(BSSMAP_LE_APDU, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_APDU, NULL);
954 EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_bssmap_le_extraneous_data);
957 static void (*bssmap_le_msg_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) = {
958 NULL,
959 NULL,
960 NULL,
961 NULL,
962 NULL,
963 bssmap_le_perf_loc_request, /* Perform Location Request */
964 bssmap_le_perf_loc_resp, /* Perform Location Response */
965 bssmap_perf_loc_abort, /* Abort */
966 bssmap_le_perf_loc_info, /* Perform Location Information */
967 bssmap_le_connection_oriented, /* Connection Oriented Information */
968 NULL, /* Connectionless Information */
969 bssmap_reset, /* Reset */
970 NULL, /* Reset Acknowledge */
972 NULL, /* NONE */
975 static int
976 dissect_bssmap_le(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
978 static gsm_a_tap_rec_t tap_rec[4];
979 static gsm_a_tap_rec_t *tap_p;
980 static unsigned tap_current=0;
981 uint8_t oct;
982 uint32_t offset, saved_offset;
983 uint32_t len;
984 int idx;
985 proto_item *bssmap_le_item = NULL;
986 proto_tree *bssmap_le_tree = NULL;
987 const char *str;
988 sccp_msg_info_t *sccp_msg_p = (sccp_msg_info_t *)data;
990 if (!(sccp_msg_p && sccp_msg_p->data.co.assoc)) {
991 sccp_msg_p = NULL;
994 col_append_str(pinfo->cinfo, COL_INFO, "(BSSMAP LE) ");
997 * set tap record pointer
999 tap_current++;
1000 if (tap_current >= 4)
1002 tap_current = 0;
1004 tap_p = &tap_rec[tap_current];
1007 offset = 0;
1008 saved_offset = offset;
1010 g_tree = tree;
1012 len = tvb_reported_length(tvb);
1015 * add BSSMAP message name
1017 oct = tvb_get_uint8(tvb, offset++);
1019 str = try_val_to_str_idx((uint32_t) oct, gsm_bssmap_le_msg_strings, &idx);
1021 if (sccp_msg_p && !sccp_msg_p->data.co.label) {
1022 sccp_msg_p->data.co.label = wmem_strdup(wmem_file_scope(),
1023 val_to_str((uint32_t) oct,
1024 gsm_bssmap_le_msg_strings, "BSSMAP LE(0x%02x)"));
1028 * create the protocol tree
1030 if (str == NULL)
1032 bssmap_le_item =
1033 proto_tree_add_protocol_format(tree, proto_bssmap_le, tvb, 0, len,
1034 "Lb - I/F BSSMAP LE - Unknown BSSMAP Message Type (0x%02x)",
1035 oct);
1037 bssmap_le_tree = proto_item_add_subtree(bssmap_le_item, ett_bssmap_le_msg);
1039 else
1041 bssmap_le_item =
1042 proto_tree_add_protocol_format(tree, proto_bssmap_le, tvb, 0, -1,
1043 "Lb - I/F BSSMAP LE - %s",
1044 str);
1046 bssmap_le_tree = proto_item_add_subtree(bssmap_le_item, ett_gsm_bssmap_le_msg[idx]);
1048 col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", str);
1051 * add BSSMAP message name
1053 proto_tree_add_uint_format(bssmap_le_tree, hf_gsm_bssmap_le_msg_type,
1054 tvb, saved_offset, 1, oct, "Message Type %s",str);
1057 tap_p->pdu_type = BSSAP_PDU_TYPE_BSSMAP;
1058 tap_p->message_type = oct;
1060 tap_queue_packet(gsm_a_tap, pinfo, tap_p);
1062 if (str == NULL) return len;
1064 if (offset >= len) return len;
1067 * decode elements
1069 if (bssmap_le_msg_fcn[idx] == NULL)
1071 proto_tree_add_item(bssmap_le_tree, hf_gsm_bssmap_le_message_elements, tvb, offset, len - offset, ENC_NA);
1073 else
1075 (*bssmap_le_msg_fcn[idx])(tvb, bssmap_le_tree, pinfo, offset, len - offset);
1078 return len;
1081 /* Register the protocol with Wireshark */
1082 void
1083 proto_register_gsm_bssmap_le(void)
1085 unsigned i;
1086 unsigned last_offset;
1088 /* Setup list of header fields */
1089 static hf_register_info hf[] = {
1090 { &hf_gsm_bssmap_le_msg_type,
1091 { "BSSMAP LE Message Type", "gsm_bssmap_le.msgtype",
1092 FT_UINT8, BASE_HEX, VALS(gsm_bssmap_le_msg_strings), 0x0,
1093 NULL, HFILL }
1095 { &hf_gsm_bssmap_le_elem_id,
1096 { "Element ID", "gsm_bssmap_le.elem_id",
1097 FT_UINT8, BASE_HEX, NULL, 0,
1098 NULL, HFILL }
1100 { &hf_gsm_bssmap_le_apdu_protocol_id,
1101 { "Protocol ID", "gsm_bssmap_le.apdu_protocol_id",
1102 FT_UINT8, BASE_DEC, VALS(gsm_apdu_protocol_id_strings), 0x0,
1103 "APDU embedded protocol id", HFILL }
1105 { &hf_gsm_bssmap_le_spare,
1106 { "Spare", "gsm_bssmap_le.spare",
1107 FT_UINT8, BASE_HEX, NULL, 0x0,
1108 NULL, HFILL}
1110 { &hf_gsm_bssmap_le_ciphering_key_flag,
1111 { "Ciphering Key Flag", "gsm_bssmap_le.decipheringKeys.flag",
1112 FT_UINT8, BASE_DEC, NULL, 0x0,
1113 NULL, HFILL}
1115 { &hf_gsm_bssmap_le_current_deciphering_key_value,
1116 { "Current Deciphering Key Value", "gsm_bssmap_le.decipheringKeys.current",
1117 FT_UINT64, BASE_HEX, NULL, 0x0, NULL,
1118 HFILL}
1120 { &hf_gsm_bssmap_le_next_deciphering_key_value,
1121 { "Next Deciphering Key Value", "gsm_bssmap_le.decipheringKeys.next",
1122 FT_UINT64, BASE_HEX, NULL, 0x0,
1123 NULL, HFILL}
1125 { &hf_gsm_bssmap_le_acq_ass,
1126 { "Acquisition Assistance", "gsm_bssmap_le.acq_ass",
1127 FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x80,
1128 NULL, HFILL }
1130 { &hf_gsm_bssmap_le_ref_time,
1131 { "Reference Time", "gsm_bssmap_le.ref_time",
1132 FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x40,
1133 NULL, HFILL }
1135 { &hf_gsm_bssmap_le_ref_loc,
1136 { "Reference Location", "gsm_bssmap_le.ref_loc",
1137 FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x20,
1138 NULL, HFILL }
1140 { &hf_gsm_bssmap_le_dgps_corr,
1141 { "DGPS Corrections", "gsm_bssmap_le.gps_corr",
1142 FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x08,
1143 NULL, HFILL }
1145 { &hf_gsm_bssmap_le_nav_mod,
1146 { "Navigation Model", "gsm_bssmap_le.nav_mod",
1147 FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x10,
1148 NULL, HFILL }
1150 { &hf_gsm_bssmap_le_iono_mod,
1151 { "Ionospheric Model", "gsm_bssmap_le.iono_mod",
1152 FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x04,
1153 NULL, HFILL }
1155 { &hf_gsm_bssmap_le_utc_mod,
1156 { "UTC Model", "gsm_bssmap_le.utc_mod",
1157 FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x02,
1158 NULL, HFILL }
1160 { &hf_gsm_bssmap_le_almanac,
1161 { "Almanac", "gsm_bssmap_le.almanac",
1162 FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x01,
1163 NULL, HFILL }
1165 { &hf_gsm_bssmap_le_ephemeris_ext_chk,
1166 { "Ephemeris Extension Check", "gsm_bssmap_le.ephemeris_ext_chk",
1167 FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x04,
1168 NULL, HFILL }
1170 { &hf_gsm_bssmap_le_ephemeris_ext,
1171 { "Ephemeris Extension", "gsm_bssmap_le.ephemeris_ext",
1172 FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x02,
1173 NULL, HFILL }
1175 { &hf_gsm_bssmap_le_real_time_int,
1176 { "Real-Time Integrity", "gsm_bssmap_le.real_time_int",
1177 FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x01,
1178 NULL, HFILL }
1180 { &hf_gsm_bssmap_le_lcs_cause_value,
1181 { "Cause Value", "gsm_bssmap_le.lcsCauseValue",
1182 FT_UINT8, BASE_HEX, VALS(bssmap_le_lcs_cause_values), 0x0,
1183 NULL, HFILL}
1185 { &hf_gsm_bssmap_le_diagnostic_value,
1186 { "Diagnostic Value", "gsm_bssmap_le.diagnosticValue",
1187 FT_UINT8, BASE_HEX, VALS(bssmap_le_position_method_failure_diagnostic_vals), 0x0,
1188 NULL, HFILL}
1190 { &hf_gsm_bssmap_le_client_category,
1191 { "Client Category", "gsm_bssmap_le.lcsClientType.clientCategory",
1192 FT_UINT8, BASE_HEX, VALS(bssmap_le_client_category), 0x0,
1193 NULL, HFILL}
1195 { &hf_gsm_bssmap_le_client_subtype,
1196 { "Client Subtype", "gsm_bssmap_le.lcsClientType.clientSubtype",
1197 FT_UINT8, BASE_HEX, VALS(bssmap_le_client_subtype), 0x0,
1198 NULL, HFILL}
1200 { &hf_gsm_bssmap_le_velocity_requested,
1201 { "Velocity Requested", "gsm_bssmap_le.lcsQos.velocityRequested",
1202 FT_UINT8, BASE_HEX, VALS(bssmap_le_velocity_requested_vals), 0x0,
1203 NULL, HFILL}
1205 { &hf_gsm_bssmap_le_vertical_coordinate_indicator,
1206 { "Vertical Coordinate Indicator", "gsm_bssmap_le.lcsQos.verticalCoordinateIndicator",
1207 FT_UINT8, BASE_HEX, VALS(bssmap_le_vertical_coordinate_indicator_vals), 0x0,
1208 NULL, HFILL}
1210 { &hf_gsm_bssmap_le_horizontal_accuracy_indicator,
1211 { "Horizontal Accuracy Indicator", "gsm_bssmap_le.lcsQos.horizontalAccuracyIndicator",
1212 FT_UINT8, BASE_HEX, VALS(bssmap_le_horizontal_accuracy_indicator_vals), 0x0,
1213 NULL, HFILL}
1215 { &hf_gsm_bssmap_le_horizontal_accuracy,
1216 { "Horizontal Accuracy", "gsm_bssmap_le.lcsQos.horizontalAccuracy",
1217 FT_UINT8, BASE_HEX, NULL, 0x0,
1218 NULL, HFILL}
1220 { &hf_gsm_bssmap_le_vertical_accuracy,
1221 { "Vertical Accuracy", "gsm_bssmap_le.lcsQos.verticalAccuracy",
1222 FT_UINT8, BASE_HEX, NULL, 0x0,
1223 NULL, HFILL}
1225 { &hf_gsm_bssmap_le_vertical_accuracy_indicator,
1226 { "Vertical Accuracy Indicator", "gsm_bssmap_le.lcsQos.verticalAccuracyIndicator",
1227 FT_UINT8, BASE_HEX, VALS(bssmap_le_vertical_accuracy_indicator_vals), 0x0,
1228 NULL, HFILL}
1230 { &hf_gsm_bssmap_le_response_time_category,
1231 { "Response Time Category", "gsm_bssmap_le.lcsQos.responseTimeCategory",
1232 FT_UINT8, BASE_HEX, VALS(bssmap_le_response_time_definitions_vals), 0x0,
1233 NULL, HFILL}
1235 { &hf_gsm_bssmap_le_apdu,
1236 { "APDU", "gsm_bssmap_le.apdu",
1237 FT_BYTES, BASE_NONE, NULL, 0x0,
1238 NULL, HFILL}
1240 { &hf_gsm_bssmap_le_message_elements,
1241 { "Message Elements", "gsm_bssmap_le.message_elements",
1242 FT_BYTES, BASE_NONE, NULL, 0x0,
1243 NULL, HFILL}
1245 { &hf_gsm_bssmap_le_location_inf,
1246 { "Location Information", "gsm_bssmap_le.location_inf",
1247 FT_UINT8, BASE_HEX, VALS(bssmap_le_loc_inf_vals), 0x0,
1248 NULL, HFILL }
1250 { &hf_gsm_bssmap_le_pos_method,
1251 { "Positioning Method", "gsm_bssmap_le.pos_method",
1252 FT_UINT8, BASE_HEX, VALS(bssmap_le_pos_method_vals), 0x0,
1253 NULL, HFILL }
1255 { &hf_gsm_bssmap_le_pos_data_disc,
1256 { "Positioning Data Discriminator", "gsm_bssmap_le.pos_data_disc",
1257 FT_UINT8, BASE_HEX, NULL, 0x0f,
1258 NULL, HFILL }
1260 { &hf_gsm_bssmap_le_pos_data_pos_method,
1261 { "Positioning Method", "gsm_bssmap_le.pos_data.pos_method",
1262 FT_UINT8, BASE_HEX, VALS(bssmap_le_pos_data_pos_method_vals), 0xf8,
1263 NULL, HFILL }
1265 { &hf_gsm_bssmap_le_pos_data_usage,
1266 { "Usage", "gsm_bssmap_le.pos_data.usage",
1267 FT_UINT8, BASE_HEX, VALS(bssmap_le_pos_data_usage_vals), 0x03,
1268 NULL, HFILL }
1272 expert_module_t* expert_gsm_a_bssmap_le;
1274 static ei_register_info ei[] = {
1275 { &ei_gsm_a_bssmap_le_not_decoded_yet, { "gsm_bssmap_le.not_decoded_yet", PI_UNDECODED, PI_WARN, "Not decoded yet", EXPFILL }},
1276 { &ei_gsm_a_bssmap_le_extraneous_data, { "gsm_bssmap_le.extraneous_data", PI_PROTOCOL, PI_NOTE, "Extraneous Data, dissector bug or later version spec(report to wireshark.org)", EXPFILL }},
1277 { &ei_gsm_a_bssmap_le_missing_mandatory_element, { "gsm_bssmap_le.missing_mandatory_element", PI_PROTOCOL, PI_WARN, "Missing Mandatory element, rest of dissection is suspect", EXPFILL }},
1280 /* Setup protocol subtree array */
1281 #define NUM_INDIVIDUAL_ELEMS 1
1282 int *ett[NUM_INDIVIDUAL_ELEMS + NUM_GSM_BSSMAP_LE_MSG +
1283 NUM_GSM_BSSMAP_LE_ELEM];
1285 ett[0] = &ett_bssmap_le_msg;
1287 last_offset = NUM_INDIVIDUAL_ELEMS;
1289 for (i=0; i < NUM_GSM_BSSMAP_LE_MSG; i++, last_offset++)
1291 ett[last_offset] = &ett_gsm_bssmap_le_msg[i];
1294 for (i=0; i < NUM_GSM_BSSMAP_LE_ELEM; i++, last_offset++)
1296 ett[last_offset] = &ett_gsm_bssmap_le_elem[i];
1299 /* Register the protocol name and description */
1301 proto_bssmap_le =
1302 proto_register_protocol("Lb-I/F BSSMAP LE", "GSM BSSMAP LE", "gsm_bssmap_le");
1304 proto_register_field_array(proto_bssmap_le, hf, array_length(hf));
1305 proto_register_subtree_array(ett, array_length(ett));
1306 expert_gsm_a_bssmap_le = expert_register_protocol(proto_bssmap_le);
1307 expert_register_field_array(expert_gsm_a_bssmap_le, ei, array_length(ei));
1309 bssmap_le_handle = register_dissector("gsm_bssmap_le", dissect_bssmap_le, proto_bssmap_le);
1312 void
1313 proto_reg_handoff_gsm_bssmap_le(void)
1315 dissector_add_uint("bssap_le.pdu_type", BSSAP_PDU_TYPE_BSSMAP, bssmap_le_handle);
1317 gsm_bsslap_handle = find_dissector_add_dependency("gsm_bsslap", proto_bssmap_le);
1321 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1323 * Local variables:
1324 * c-basic-offset: 8
1325 * tab-width: 8
1326 * indent-tabs-mode: t
1327 * End:
1329 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1330 * :indentSize=8:tabSize=8:noTabs=false: