Coverage Report

Created: 2026-05-14 06:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-gsm_bssmap_le.c
Line
Count
Source
1
/* packet-gsm_bssmap_le.c
2
 * Routines for GSM Lb Interface BSSMAP dissection
3
 *
4
 * Copyright 2008, Johnny Mitrevski <mitrevj@hotmail.com>
5
 *
6
 * 3GPP TS 49.031 version v7.4.0 (2009-09)
7
 *
8
 * Wireshark - Network traffic analyzer
9
 * By Gerald Combs <gerald@wireshark.org>
10
 * Copyright 1998 Gerald Combs
11
 *
12
 * SPDX-License-Identifier: GPL-2.0-or-later
13
 */
14
15
#include "config.h"
16
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"
24
25
void proto_register_gsm_bssmap_le(void);
26
void proto_reg_handoff_gsm_bssmap_le(void);
27
28
/* PROTOTYPES/FORWARDS */
29
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
39
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 }
55
};
56
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
88
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 }
121
};
122
value_string_ext gsm_bssmap_le_elem_strings_ext = VALUE_STRING_EXT_INIT(gsm_bssmap_le_elem_strings);
123
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 },
130
};
131
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}
137
};
138
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}
144
};
145
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}
151
};
152
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}
158
};
159
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}
167
};
168
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 }
174
};
175
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 }
184
};
185
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 }
201
};
202
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 }
210
};
211
212
/* Initialize the protocol and registered fields */
213
static int proto_bssmap_le;
214
int hf_gsm_bssmap_le_elem_id;
215
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()
219
*/
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;
255
256
257
/* Initialize the subtree pointers */
258
static int ett_bssmap_le_msg;
259
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;
263
264
static dissector_handle_t gsm_bsslap_handle;
265
static dissector_handle_t bssmap_le_handle;
266
267
static proto_tree *g_tree;
268
269
480
#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];
271
272
/*
273
 * 10.3 APDU
274
 */
275
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_)
278
0
{
279
0
  uint32_t  curr_offset;
280
0
  uint8_t   apdu_protocol_id;
281
0
  tvbuff_t *APDU_tvb;
282
283
0
  curr_offset = offset;
284
285
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_apdu, tvb, curr_offset, len, ENC_NA);
286
287
  /*
288
   * dissect the embedded APDU message
289
   * if someone writes a TS 09.31 dissector
290
   *
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.
293
   */
294
295
0
  proto_tree_add_item_ret_uint8(tree, hf_gsm_bssmap_le_apdu_protocol_id, tvb, curr_offset, 1, ENC_BIG_ENDIAN, &apdu_protocol_id);
296
297
0
  switch(apdu_protocol_id){
298
0
  case 1:
299
    /* BSSLAP
300
     * the embedded message is as defined in 3GPP TS 08.71(3GPP TS 48.071 version 7.2.0 Release 7)
301
     */
302
0
    APDU_tvb = tvb_new_subset_length(tvb, curr_offset+1, len-1);
303
0
    if(gsm_bsslap_handle)
304
0
      call_dissector(gsm_bsslap_handle, APDU_tvb, pinfo, g_tree);
305
0
    break;
306
0
  case 2:
307
    /* LLP
308
     * The embedded message contains a Facility Information Element as defined in 3GPP TS 04.71
309
     * excluding the Facility IEI and length of Facility IEI octets defined in 3GPP TS 04.71.(3GPP TS 44.071).
310
     */
311
0
    break;
312
0
  case 3:
313
    /* SMLCPP
314
     * The embedded message is as defined in 3GPP TS 08.31(TS 48.031).
315
     */
316
0
    break;
317
0
  default:
318
0
    break;
319
0
  }
320
321
0
  curr_offset += len;
322
323
0
  EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_bssmap_le_extraneous_data);
324
325
0
  return curr_offset - offset;
326
0
}
327
/*
328
 * 10.4 Cause
329
 * coded as the value part of the Cause IE defined in 3GPP TS 48.008
330
 */
331
/*
332
 * 10.5 Cell Identifier
333
 * coded as the value part of the Cell Identifier IE defined in 3GPP TS 48.008
334
 */
335
/*
336
 * 10.6 Chosen Channel
337
 * coded as the value part of the Chosen Channel IE defined in 3GPP TS 48.008
338
 */
339
/*
340
 * 10.7 Classmark Information Type 3
341
 * coded as the value part of the Classmark Information Type 3 IE defined in 3GPP TS 48.008
342
 */
343
/*
344
 * 10.8 Deciphering Keys
345
 */
346
static uint16_t
347
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_)
348
0
{
349
0
  int bit_offset;
350
351
  /* Spare bits */
352
0
  bit_offset = (offset<<3);
353
0
  proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_spare, tvb, bit_offset, 7, ENC_BIG_ENDIAN);
354
0
  bit_offset += 7;
355
356
  /* Extract the Ciphering Key Flag and add to protocol tree */
357
0
  proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_ciphering_key_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
358
0
  bit_offset++;
359
  /*offset++;*/
360
361
  /* Extract the Current Deciphering Key Value and add to protocol tree */
362
0
  proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_current_deciphering_key_value, tvb, bit_offset, 56, ENC_NA);
363
0
  bit_offset += 56;
364
  /*offset += 7;*/
365
366
  /* Extract the Next Deciphering Key Value and add to protocol tree */
367
0
  proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_next_deciphering_key_value, tvb, bit_offset, 56, ENC_NA);
368
  /*offset += 7;*/
369
370
0
  return len;
371
0
}
372
/*
373
 * 10.9 Geographic Location
374
 * contains an octet sequence identical to that for Geographical Information
375
 * defined in 3GPP TS 23.032..
376
 */
377
/*
378
 * 10.10 Requested GPS Assistance Data
379
 */
380
static uint16_t
381
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_)
382
0
{
383
0
  uint32_t  curr_offset;
384
385
0
  curr_offset = offset;
386
387
  /* Octet 3 H G F E D C B A */
388
  /* bit H Acquisition Assistance */
389
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_acq_ass, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
390
  /* bit G Reference Time */
391
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_ref_time, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
392
  /* bit F Reference Location */
393
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_ref_loc, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
394
  /* bit E DGPS Corrections */
395
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_dgps_corr, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
396
  /* bit D Navigation Model */
397
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_nav_mod, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
398
  /* bit C Ionospheric Model */
399
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_iono_mod, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
400
  /* bit B UTC Model */
401
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_utc_mod, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
402
  /* bit A Almanac */
403
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_almanac, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
404
0
  curr_offset++;
405
406
  /* Octet 4 P O N M L K J I
407
   * bits L through P are Spare bits
408
   */
409
  /* bit K Ephemeris Extension Check */
410
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_ephemeris_ext_chk, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
411
  /* bit J Ephemeris Extension */
412
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_ephemeris_ext, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
413
  /* bit I Real-Time Integrity */
414
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_real_time_int, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
415
0
  curr_offset++;
416
417
  /* Octet 5 to Octet 8+2n Satellite related data */
418
0
  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");
419
0
  return len;
420
0
}
421
/*
422
 * 10.11 IMSI
423
 * coded as the value part of the Mobile Identity IE defined in 3GPP TS 24.008 (NOTE 1)
424
 * NOTE 1: The Type of identity field in the Mobile Identity IE shall
425
 * be ignored by the receiver
426
 */
427
/*
428
 * 10.12 (void)
429
 */
430
/*
431
 * 10.13 LCS Cause
432
 */
433
static const value_string bssmap_le_lcs_cause_values[] = {
434
  { 0, "Unspecified" },
435
  { 1, "System Failure" },
436
  { 2, "Protocol Error" },
437
  { 3, "Data missing in position request" },
438
  { 4, "Unexpected data value in position request" },
439
  { 5, "Position method failure" },
440
  { 6, "Target MS Unreachable" },
441
  { 7, "Location request aborted" },
442
  { 8, "Facility not supported" },
443
  { 9, "Inter-BSC Handover Ongoing" },
444
  { 10, "Intra-BSC Handover Complete" },
445
  { 11, "Congestion" },
446
  { 12, "Inter NSE cell change" },
447
  { 13, "Routing Area Update" },
448
  { 14, "PTMSI reallocation" },
449
  { 15, "Suspension of GPRS services" },
450
  { 0, NULL}
451
};
452
453
static const value_string bssmap_le_position_method_failure_diagnostic_vals[] = {
454
  { 0, "Congestion" },
455
  { 1, "insufficientResources" },
456
  { 2, "insufficientMeasurementData" },
457
  { 3, "inconsistentMeasurementData" },
458
  { 4, "locationProcedureNotCompleted" },
459
  { 5, "locationProcedureNotSupportedByTargetMS" },
460
  { 6, "qoSNotAttainable" },
461
  { 7, "positionMethodNotAvailableInNetwork" },
462
  { 8, "positionMethodNotAvailableInLocationArea" },
463
  { 0, NULL}
464
};
465
static uint16_t
466
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_)
467
0
{
468
0
  uint32_t  curr_offset;
469
470
0
  curr_offset = offset;
471
472
  /* cause value  */
473
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_lcs_cause_value, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
474
0
  curr_offset++;
475
476
0
  if (len == 2)
477
0
  {
478
    /* Diagnostic value (note) */
479
0
    proto_tree_add_item(tree, hf_gsm_bssmap_le_diagnostic_value, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
480
0
    curr_offset++;
481
0
  }
482
483
0
  return curr_offset - offset;
484
0
}
485
/*
486
 * 10.14 LCS Client Type
487
 */
488
/* Client Category definitions */
489
static const value_string bssmap_le_client_category[] = {
490
  { 0, "Value Added Client" },
491
  { 2, "PLMN Operator" },
492
  { 3, "Emergency Services"},
493
  { 4, "Lawful Intercept Services"},
494
  { 0, NULL}
495
};
496
497
/* Client Subtype definitions */
498
static const value_string bssmap_le_client_subtype[] = {
499
  { 0, "unspecified" },
500
  { 1, "broadcast service" },
501
  { 2, "O&M" },
502
  { 3, "anonymous statistics" },
503
  { 4, "Target MS service support" },
504
  { 0, NULL}
505
};
506
507
static uint16_t
508
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_)
509
1
{
510
1
  uint32_t  curr_offset;
511
1
  uint8_t bitCount;
512
513
1
  bitCount = offset<<3;
514
1
  curr_offset = offset;
515
516
  /* Extract the client category and add to protocol tree */
517
1
  proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_client_category, tvb, bitCount, 4, ENC_BIG_ENDIAN);
518
1
  bitCount = bitCount + 4;
519
520
  /* Extract the client subtype and add to protocol tree */
521
1
  proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_client_subtype, tvb, bitCount, 4, ENC_BIG_ENDIAN);
522
  /*bitCount = bitCount + 4;*/
523
1
  curr_offset++;
524
525
1
  return curr_offset - offset;
526
1
}
527
/*
528
 * 10.15 LCS Priority
529
 * coded as the LCS-Priority octet in 3GPP TS 29.002
530
 */
531
/*
532
 * 10.16 LCS QoS
533
 */
534
static uint16_t
535
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_)
536
2
{
537
2
  uint64_t verticalCoordIndicator, velocityRequested, horizontalAccuracyIndicator, verticalAccuracyIndicator;
538
2
  uint16_t bitCount;
539
540
2
  bitCount = offset << 3;
541
542
2
  proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_spare, tvb, bitCount, 6, ENC_BIG_ENDIAN);
543
2
  bitCount = bitCount + 6;
544
545
  /* Extract Velocity requested element */
546
2
  proto_tree_add_bits_ret_val(tree, hf_gsm_bssmap_le_velocity_requested, tvb, bitCount, 1, &velocityRequested, ENC_BIG_ENDIAN);
547
2
  bitCount++;
548
549
  /* Extract vertical coordinator element */
550
2
  proto_tree_add_bits_ret_val(tree, hf_gsm_bssmap_le_vertical_coordinate_indicator, tvb, bitCount, 1, &verticalCoordIndicator, ENC_BIG_ENDIAN);
551
2
  bitCount++;
552
553
  /* Extract horizontal accuracy element */
554
2
  proto_tree_add_bits_ret_val(tree, hf_gsm_bssmap_le_horizontal_accuracy_indicator, tvb, bitCount, 1, &horizontalAccuracyIndicator, ENC_BIG_ENDIAN);
555
2
  bitCount++;
556
557
2
  if(horizontalAccuracyIndicator == 1)
558
1
  {
559
1
    proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_horizontal_accuracy, tvb, bitCount, 7, ENC_BIG_ENDIAN);
560
1
    bitCount = bitCount + 7;
561
1
  }
562
1
  else
563
1
  {
564
1
    proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_spare, tvb, bitCount, 7, ENC_BIG_ENDIAN);
565
1
    bitCount = bitCount + 7;
566
1
  }
567
568
  /* Extract vertical accuracy element */
569
2
  proto_tree_add_bits_ret_val(tree, hf_gsm_bssmap_le_vertical_accuracy_indicator, tvb, bitCount, 1, &verticalAccuracyIndicator, ENC_BIG_ENDIAN);
570
2
  bitCount++;
571
572
2
  if(verticalAccuracyIndicator == 1)
573
1
  {
574
1
    proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_vertical_accuracy, tvb, bitCount, 7, ENC_BIG_ENDIAN);
575
1
    bitCount = bitCount + 7;
576
1
  }
577
1
  else
578
1
  {
579
1
    proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_spare, tvb, bitCount, 7, ENC_BIG_ENDIAN);
580
1
    bitCount = bitCount + 7;
581
1
  }
582
583
2
  proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_response_time_category, tvb, bitCount, 2, ENC_BIG_ENDIAN);
584
  /*bitCount = bitCount + 2;*/
585
586
2
  return len;
587
2
}
588
/*
589
 * 10.17 (void)
590
 */
591
/*
592
 * 10.18 Location Type
593
 */
594
static uint16_t
595
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_)
596
1
{
597
1
  uint32_t  curr_offset;
598
599
1
  curr_offset = offset;
600
601
  /* Location information (octet 3)  */
602
1
  proto_tree_add_item(tree, hf_gsm_bssmap_le_location_inf, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
603
1
  curr_offset++;
604
1
  if (len == 1) {
605
0
    return len;
606
0
  }
607
  /* Positioning Method (octet 4) */
608
1
  proto_tree_add_item(tree, hf_gsm_bssmap_le_pos_method, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
609
1
  curr_offset++;
610
611
1
  return curr_offset - offset;
612
1
}
613
/*
614
 * 10.19 Network Element Identity
615
 */
616
/*
617
 * 10.20 Positioning Data
618
 */
619
static uint16_t
620
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_)
621
0
{
622
0
  uint32_t  curr_offset, value;
623
624
0
  curr_offset = offset;
625
626
  /* Octet 3  spare Positioning Data Discriminator*/
627
0
  proto_tree_add_item_ret_uint(tree, hf_gsm_bssmap_le_pos_data_disc, tvb, curr_offset, 1, ENC_BIG_ENDIAN, &value);
628
0
  curr_offset++;
629
630
0
  if (value != 0) {
631
0
    return len;
632
0
  }
633
  /* 0000 indicate usage of each positioning method that was attempted either successfully or unsuccessfully;
634
   * 1 octet of data is provided for each positioning method included
635
   */
636
0
  while (curr_offset < (offset +len)) {
637
    /* Octet x  positioning method  usage*/
638
0
    proto_tree_add_item(tree, hf_gsm_bssmap_le_pos_data_pos_method, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
639
0
    proto_tree_add_item(tree, hf_gsm_bssmap_le_pos_data_usage, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
640
0
    curr_offset++;
641
0
  }
642
643
0
  return len;
644
0
}
645
/*
646
 * 10.21 Return Error Request
647
 */
648
/*
649
 * 10.22 Return Error Cause
650
 */
651
/*
652
 * 10.23 (void)
653
 */
654
/*
655
 * 10.24 Segmentation
656
 */
657
/*
658
 * 10.25 (void)
659
 */
660
/*
661
 * 10.26 LCS Capability
662
 * coded as the value part of the LCS Capability
663
 * information element in 3GPP TS 48.018, not including
664
 * 3GPP TS 48.018 IEI and length indicator
665
 */
666
/* Dissector for the LCS Capability element */
667
static uint16_t
668
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_)
669
0
{
670
  /* Extract the LCS Capability element and add to protocol tree */
671
0
  proto_tree_add_expert(tree, pinfo, &ei_gsm_a_bssmap_le_not_decoded_yet, tvb, offset, len);
672
0
  return len;
673
0
}
674
675
/*
676
 * 10.27 Packet Measurement Report
677
 * coded as the Packet Measurement Report
678
 * message or the Packet Enhanced Measurement Report message
679
 * starting with the 6-bit MESSAGE_TYPE (see clause 11 in
680
 * 3GPP TS 44.060) and ending with the Non-distribution contents
681
 * (i.e. the RLC/MAC padding bits are not included). The end of the
682
 * message is padded with 0-bits to the nearest octet boundary.
683
 */
684
/* Dissector for the Packet Measurement Report element */
685
static uint16_t
686
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_)
687
0
{
688
  /* Extract the Packet Measurement Report element and add to protocol tree */
689
0
  proto_tree_add_expert(tree, pinfo, &ei_gsm_a_bssmap_le_not_decoded_yet, tvb, offset, len);
690
691
0
  return len;
692
0
}
693
694
/*
695
 * 10.28 Cell Identity List
696
 * coded as the value part of the Cell Identity List IE
697
 * defined in 3GPP TS 48.071.
698
 */
699
/* Dissector for the Measured Cell Identity List element */
700
static uint16_t
701
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_)
702
0
{
703
  /* Extract the Measured Cell Identity List element and add to protocol tree */
704
0
  proto_tree_add_expert(tree, pinfo, &ei_gsm_a_bssmap_le_not_decoded_yet, tvb, offset, len);
705
706
0
  return len;
707
0
}
708
709
/*
710
 * 10.29 IMEI
711
 * IMEI coded as the value part of the Mobile Identity IE defined in
712
 * 3GPP TS 24.008 (NOTE 1)
713
 * NOTE 1: The Type of identity field in the Mobile Identity IE shall
714
 * be ignored by the receiver.
715
 */
716
/*
717
 * 10.30 Velocity Data
718
 * contains an octet sequence identical to that for Description of
719
 * Velocity defined in 3GPP TS 23.032.
720
 */
721
/*
722
 * 10.31 Requested GANSS Assistance Data
723
 */
724
/*
725
 * 10.32 GANSS Positioning Data
726
 */
727
/*
728
 * 10.33 GANSS Location Type
729
 */
730
731
732
225
#define NUM_GSM_BSSMAP_LE_MSG array_length(gsm_bssmap_le_msg_strings)
733
static int ett_gsm_bssmap_le_msg[NUM_GSM_BSSMAP_LE_MSG];
734
735
/*
736
This enum is defined in packet-gsm_a_common.h to
737
make it possible to use element dissection from this dissector
738
in other dissectors.
739
740
It is shown here as a comment for easier reference.
741
742
Note this enum must be of the same size as the element decoding list below
743
744
typedef enum
745
{
746
  DE_BMAPLE_LCSQOS,     / 10.16 LCS QoS /
747
  DE_BMAPLE_LCS_PRIO,     / LCS Priority /
748
  DE_BMAPLE_LOC_TYPE,     / 10.18 Location Type /
749
  DE_BMAPLE_GANSS_LOC_TYPE, / GANSS Location Type /
750
  DE_BMAPLE_GEO_LOC,      / 10.9 Geographic Location /
751
  DE_BMAPLE_POS_DATA,     / 10.20 Positioning Data /
752
  DE_BMAPLE_GANSS_POS_DATA, / GANSS Positioning Data /
753
  DE_BMAPLE_VELOC_DATA,   / Velocity Data /
754
  DE_BMAPLE_LCS_CAUSE,    / 10.13 LCS Cause /
755
  DE_BMAPLE_LCS_CLIENT_TYPE,  / LCS Client Type /
756
  DE_BMAPLE_APDU,       / 10.3 APDU /
757
  DE_BMAPLE_NETWORK_ELEM_ID,  / Network Element Identity /
758
  DE_BMAPLE_REQ_GPS_ASSIST_D, / 10.10 Requested GPS Assistance Data /
759
  DE_BMAPLE_REQ_GNSS_ASSIST_D,/ Requested GANSS Assistance Data /
760
  DE_BMAPLE_DECIPH_KEYS,    / 10.8 Deciphering Keys /
761
  DE_BMAPLE_RETURN_ERROR_REQ, / Return Error Request /
762
  DE_BMAPLE_RETURN_ERROR_CAUSE, / Return Error Cause /
763
  DE_BMAPLE_SEGMENTATION,   / Segmentation /
764
  DE_BMAPLE_CLASSMARK_TYPE_3, / 10.7 Classmark Information Type 3 /
765
  DE_BMAPLE_CAUSE,      / 10.4 Cause /
766
  DE_BMAPLE_CELL_IDENTIFIER,  / 10.5 Cell Identifier /
767
  DE_BMAPLE_CHOSEN_CHANNEL, / 10.6 Chosen Channel /
768
  DE_BMAPLE_IMSI,       / 10.11 IMSI /
769
  DE_BMAPLE_RES1,       / Reserved /
770
  DE_BMAPLE_RES2,       / Reserved /
771
  DE_BMAPLE_RES3,       / Reserved /
772
  DE_BMAPLE_LCS_CAPABILITY, / LCS Capability /
773
  DE_BMAPLE_PACKET_MEAS_REP,  / Packet Measurement Report /
774
  DE_BMAPLE_MEAS_CELL_ID,   / Measured Cell Identity /
775
  DE_BMAPLE_IMEI,       / IMEI /
776
  BMAPLE_NONE         / NONE /
777
}
778
bssmap_le_elem_idx_t;
779
*/
780
781
782
uint16_t (* const 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) = {
783
  /* NOTE: The null types below are defined elsewhere. i.e in packet-gsm_a_bssmap.c */
784
  de_bmaple_lcs_qos,        /* 10.16 LCS QoS */
785
  NULL,             /* LCS Priority */
786
  de_bmaple_location_type,    /* 10.18 Location Type */
787
  be_ganss_loc_type,        /* GANSS Location Type */
788
  NULL,             /* 10.9 Geographic Location */
789
  de_bmaple_pos_dta,        /* 10.20 Positioning Data */
790
  be_ganss_pos_dta,       /* GANSS Positioning Data */
791
  NULL,             /* Velocity Data */
792
  de_bmaple_cause,        /* 10.13 LCS Cause */
793
  de_bmaple_client,       /* LCS Client Type */
794
  de_bmaple_apdu,         /* APDU */
795
  NULL,             /* Network Element Identity */
796
  de_bmaple_req_gps_ass_data,   /* 10.10 Requested GPS Assistance Data */
797
  be_ganss_ass_dta,       /* Requested GANSS Assistance Data */
798
  de_bmaple_decihp_keys,      /* 10.8 Deciphering Keys */
799
  NULL,             /* Return Error Request */
800
  NULL,             /* Return Error Cause */
801
  NULL,             /* Segmentation */
802
  NULL,             /* 10.7 Classmark Information Type 3 */
803
  NULL,             /* Cause */
804
  NULL,             /* Cell Identifier */
805
  NULL,             /* 10.6 Chosen Channel */
806
  de_mid,             /* 10.11 IMSI */
807
  NULL,             /* Reserved */
808
  NULL,             /* Reserved */
809
  NULL,             /* Reserved */
810
  be_lcs_capability,        /* LCS Capability */
811
  be_packet_meas_rep,       /* Packet Measurement Report */
812
  be_measured_cell_identity,    /* Measured Cell Identity List */
813
  de_mid,             /* IMEI (use same dissector as IMSI) */
814
815
  NULL, /* NONE */
816
817
};
818
819
/*
820
 * 9.1 PERFORM LOCATION REQUEST
821
 */
822
static void
823
bssmap_le_perf_loc_request(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len)
824
0
{
825
0
  uint32_t  curr_offset;
826
0
  uint32_t  consumed;
827
0
  unsigned  curr_len;
828
829
0
  curr_offset = offset;
830
0
  curr_len = len;
831
832
  /* Location Type 9.1.1 M 3-n */
833
0
  ELEM_MAND_TLV(BSSMAP_LE_LOCATION_TYPE, GSM_A_PDU_TYPE_BSSMAP, BE_LOC_TYPE, NULL, ei_gsm_a_bssmap_le_missing_mandatory_element)
834
  /* Cell Identifier 9.1.2 O 5-10 */
835
0
  ELEM_MAND_TLV(BSSMAP_LE_CELL_IDENTIFIER, GSM_A_PDU_TYPE_BSSMAP, BE_CELL_ID, NULL, ei_gsm_a_bssmap_le_missing_mandatory_element);
836
  /* Classmark Information Type 3 9.1.3 O 3-14 */
837
0
  ELEM_OPT_TLV(BSSMAP_LE_CLASSMARK_INFORMATION_TYPE_3, GSM_A_PDU_TYPE_BSSMAP, BE_CM_INFO_3, NULL);
838
  /* LCS Client Type 9.1.4 C (note 3) 3-n */
839
0
  ELEM_OPT_TLV(BSSMAP_LE_LCS_CLIENT_TYPE, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_LCS_CLIENT_TYPE, NULL);
840
  /* Chosen Channel 9.1.5 O 2 */
841
0
  ELEM_OPT_TLV(BSSMAP_LE_CHOSEN_CHANNEL, GSM_A_PDU_TYPE_BSSMAP, BE_CHOSEN_CHAN, NULL);
842
  /* LCS Priority 9.1.6 O 3-n */
843
0
  ELEM_OPT_TLV(BSSMAP_LE_LCS_PRIORITY, GSM_A_PDU_TYPE_BSSMAP, BE_LCS_PRIO, NULL);
844
  /* LCS QoS 9.1.6a C (note 1) 3-n */
845
0
  ELEM_OPT_TLV(BSSMAP_LE_LCS_QOS, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_LCSQOS, NULL);
846
  /* GPS Assistance Data 9.1.7 C (note 2) 3-n */
847
0
  ELEM_OPT_TLV(BSSMAP_LE_REQUESTED_GPS_ASSISTANCE_DATA, GSM_A_PDU_TYPE_BSSMAP, BE_GPS_ASSIST_DATA, NULL);
848
  /* APDU 9.1.8 O 3-n */
849
0
  ELEM_OPT_TELV(BSSMAP_LE_APDU, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_APDU, NULL);
850
  /* LCS Capability 9.1.9 O */
851
0
  ELEM_OPT_TLV(BSSMAP_LE_LCS_CAPABILITY, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_LCS_CAPABILITY, NULL);
852
  /* Packet Measurement Report 9.1.10 O*/
853
0
  ELEM_OPT_TLV(BSSMAP_LE_PACKET_MEASUREMENT_REPORT, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_PACKET_MEAS_REP, NULL);
854
  /* Measured Cell Identity List 9.1.11 O*/
855
0
  ELEM_OPT_TLV(BSSMAP_LE_CELL_IDENTITY_LIST, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_MEAS_CELL_ID, NULL);
856
  /* IMSI 9.1.12  O (note 4)  5-10 */
857
0
  ELEM_OPT_TLV(BSSMAP_LE_IMSI, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_IMSI, NULL);
858
  /* IMEI 9.1.13  O (note 4)  10 (use same decode as IMSI) */
859
0
  ELEM_OPT_TLV(BSSMAP_LE_IMEI, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_IMEI, NULL);
860
  /* GANSS Location Type  9.1.14  C 3 */
861
0
  ELEM_OPT_TLV(BSSMAP_LE_GANSS_LOCATION_TYPE, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_GANSS_LOC_TYPE, NULL);
862
  /* GANSS Assistance Data  9.1.15  C (note 5)  3-n */
863
0
  ELEM_OPT_TLV(BSSMAP_LE_REQUESTED_GANSS_ASSISTANCE_DATA, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_REQ_GNSS_ASSIST_D, NULL);
864
865
0
  EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_bssmap_le_extraneous_data);
866
867
0
}
868
869
/*
870
 * 9.2 PERFORM LOCATION RESPONSE
871
 */
872
static void
873
bssmap_le_perf_loc_resp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len)
874
0
{
875
0
  uint32_t  curr_offset;
876
0
  uint32_t  consumed;
877
0
  unsigned  curr_len;
878
879
0
  curr_offset = offset;
880
0
  curr_len = len;
881
882
  /* Location Estimate 9.2.1 C (note 1) 3-n */
883
0
  ELEM_OPT_TLV(BSSMAP_LE_GEOGRAPHIC_LOCATION, BSSAP_PDU_TYPE_BSSMAP, BE_LOC_EST, NULL);
884
  /* Positioning Data 9.2.2 O 3-n */
885
0
  ELEM_OPT_TLV(BSSMAP_LE_POSITIONING_DATA, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_POS_DATA, NULL);
886
  /* Deciphering Keys 9.2.3 C (note 2) 3-n */
887
0
  ELEM_OPT_TLV(BSSMAP_LE_DECIPHERING_KEYS, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_DECIPH_KEYS, NULL);
888
  /* LCS Cause 9.2.4 C (note 3) 3-n */
889
0
  ELEM_OPT_TLV(BSSMAP_LE_LCS_CAUSE, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_LCS_CAUSE, NULL);
890
  /* Velocity Estimate  9.2.5 O 3-n */
891
0
  ELEM_OPT_TLV(BSSMAP_LE_VELOCITY_DATA, BSSAP_PDU_TYPE_BSSMAP, BE_VEL_EST, NULL);
892
  /* GANSS Positioning Data 9.2.6 O 3-n */
893
0
  ELEM_OPT_TLV(BSSMAP_LE_GANSS_POSITIONING_DATA, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_GANSS_POS_DATA, NULL);
894
895
0
  EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_bssmap_le_extraneous_data);
896
0
}
897
898
/*
899
 * 9.8 CONNECTION ORIENTED INFORMATION
900
 */
901
static void
902
bssmap_le_connection_oriented(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
  /* APDU 9.8.1 M 3-n */
912
0
  ELEM_MAND_TELV(BSSMAP_LE_APDU, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_APDU, NULL, ei_gsm_a_bssmap_le_missing_mandatory_element);
913
  /* Segmentation 9.8.2 */
914
0
  ELEM_OPT_TLV(BSSMAP_LE_SEGMENTATION, BSSAP_PDU_TYPE_BSSMAP, BE_SEG, NULL);
915
916
0
  EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_bssmap_le_extraneous_data);
917
0
}
918
919
/*
920
 * 9.9  CONNECTIONLESS INFORMATION
921
 *
922
Network Element Identity (source) 3.2.2.69  Both  M 3-n
923
Network Element Identity (target) 3.2.2.69  Both  M 3-n
924
APDU  3.2.2.68  Both  M 3-n
925
Segmentation  3.2,2,74  Both  C (note 1)  5
926
Return Error Request  3.2.2.72  Both  C (note 2)  3-n
927
Return Error Cause  3.2.2.73  Both  C (note 3)  3-n
928
*/
929
930
/*
931
 * 9.11 RESET ACKNOWLEDGE
932
 * no data
933
 */
934
935
/*
936
 * 9.12 PERFORM LOCATION INFORMATION
937
 */
938
static void
939
bssmap_le_perf_loc_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len)
940
0
{
941
0
  uint32_t  curr_offset;
942
0
  uint32_t  consumed;
943
0
  unsigned  curr_len;
944
945
0
  curr_offset = offset;
946
0
  curr_len = len;
947
948
  /* Cell Identifier 9.12.1 M */
949
0
  ELEM_MAND_TLV(BSSMAP_LE_CELL_IDENTIFIER, GSM_A_PDU_TYPE_BSSMAP, BE_CELL_ID, NULL, ei_gsm_a_bssmap_le_missing_mandatory_element);
950
  /* APDU 9.1.8 O 3-n */
951
0
  ELEM_OPT_TELV(BSSMAP_LE_APDU, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_APDU, NULL);
952
953
0
  EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_bssmap_le_extraneous_data);
954
0
}
955
956
static void (* const bssmap_le_msg_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len) = {
957
  NULL,
958
  NULL,
959
  NULL,
960
  NULL,
961
  NULL,
962
  bssmap_le_perf_loc_request, /* Perform Location Request */
963
  bssmap_le_perf_loc_resp,  /* Perform Location Response */
964
  bssmap_perf_loc_abort,    /* Abort */
965
  bssmap_le_perf_loc_info,  /* Perform Location Information */
966
  bssmap_le_connection_oriented,  /* Connection Oriented Information */
967
  NULL,           /* Connectionless Information */
968
  bssmap_reset,       /* Reset */
969
  NULL,   /* Reset Acknowledge */
970
971
  NULL, /* NONE */
972
};
973
974
static int
975
dissect_bssmap_le(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
976
0
{
977
0
  static gsm_a_tap_rec_t  tap_rec[4];
978
0
  static gsm_a_tap_rec_t *tap_p;
979
0
  static unsigned   tap_current=0;
980
0
  uint8_t oct;
981
0
  uint32_t  offset, saved_offset;
982
0
  uint32_t  len;
983
0
  int idx;
984
0
  proto_item  *bssmap_le_item = NULL;
985
0
  proto_tree  *bssmap_le_tree = NULL;
986
0
  const char  *str;
987
0
  sccp_msg_info_t *sccp_msg_p = (sccp_msg_info_t *)data;
988
989
0
  if (!(sccp_msg_p && sccp_msg_p->data.co.assoc)) {
990
0
    sccp_msg_p = NULL;
991
0
  }
992
993
0
  col_append_str(pinfo->cinfo, COL_INFO, "(BSSMAP LE) ");
994
995
  /*
996
   * set tap record pointer
997
   */
998
0
  tap_current++;
999
0
  if (tap_current >= 4)
1000
0
  {
1001
0
    tap_current = 0;
1002
0
  }
1003
0
  tap_p = &tap_rec[tap_current];
1004
1005
1006
0
  offset = 0;
1007
0
  saved_offset = offset;
1008
1009
0
  g_tree = tree;
1010
1011
0
  len = tvb_reported_length(tvb);
1012
1013
  /*
1014
   * add BSSMAP message name
1015
   */
1016
0
  oct = tvb_get_uint8(tvb, offset++);
1017
1018
0
  str = try_val_to_str_idx((uint32_t) oct, gsm_bssmap_le_msg_strings, &idx);
1019
1020
0
  if (sccp_msg_p && !sccp_msg_p->data.co.label) {
1021
0
    sccp_msg_p->data.co.label = val_to_str(wmem_file_scope(), (uint32_t) oct, gsm_bssmap_le_msg_strings, "BSSMAP LE(0x%02x)");
1022
0
  }
1023
1024
  /*
1025
   * create the protocol tree
1026
   */
1027
0
  if (str == NULL)
1028
0
  {
1029
0
    bssmap_le_item =
1030
0
    proto_tree_add_protocol_format(tree, proto_bssmap_le, tvb, 0, len,
1031
0
      "Lb - I/F BSSMAP LE - Unknown BSSMAP Message Type (0x%02x)",
1032
0
      oct);
1033
1034
0
    bssmap_le_tree = proto_item_add_subtree(bssmap_le_item, ett_bssmap_le_msg);
1035
0
  }
1036
0
  else
1037
0
  {
1038
0
    bssmap_le_item =
1039
0
    proto_tree_add_protocol_format(tree, proto_bssmap_le, tvb, 0, -1,
1040
0
      "Lb - I/F BSSMAP LE - %s",
1041
0
      str);
1042
1043
0
    bssmap_le_tree = proto_item_add_subtree(bssmap_le_item, ett_gsm_bssmap_le_msg[idx]);
1044
1045
0
    col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", str);
1046
1047
    /*
1048
     * add BSSMAP message name
1049
     */
1050
0
    proto_tree_add_uint_format(bssmap_le_tree, hf_gsm_bssmap_le_msg_type,
1051
0
    tvb, saved_offset, 1, oct, "Message Type %s",str);
1052
0
  }
1053
1054
0
  tap_p->pdu_type = BSSAP_PDU_TYPE_BSSMAP;
1055
0
  tap_p->message_type = oct;
1056
1057
0
  tap_queue_packet(gsm_a_tap, pinfo, tap_p);
1058
1059
0
  if (str == NULL) return len;
1060
1061
0
  if (offset >= len) return len;
1062
1063
  /*
1064
   * decode elements
1065
   */
1066
0
  if (bssmap_le_msg_fcn[idx] == NULL)
1067
0
  {
1068
0
    proto_tree_add_item(bssmap_le_tree, hf_gsm_bssmap_le_message_elements, tvb, offset, len - offset, ENC_NA);
1069
0
  }
1070
0
  else
1071
0
  {
1072
0
    (*bssmap_le_msg_fcn[idx])(tvb, bssmap_le_tree, pinfo, offset, len - offset);
1073
0
  }
1074
1075
0
  return len;
1076
0
}
1077
1078
/* Register the protocol with Wireshark */
1079
void
1080
proto_register_gsm_bssmap_le(void)
1081
15
{
1082
15
  unsigned i;
1083
15
  unsigned last_offset;
1084
1085
  /* Setup list of header fields */
1086
15
  static hf_register_info hf[] = {
1087
15
    { &hf_gsm_bssmap_le_msg_type,
1088
15
      { "BSSMAP LE Message Type", "gsm_bssmap_le.msgtype",
1089
15
        FT_UINT8, BASE_HEX, VALS(gsm_bssmap_le_msg_strings), 0x0,
1090
15
        NULL, HFILL }
1091
15
    },
1092
15
    { &hf_gsm_bssmap_le_elem_id,
1093
15
      { "Element ID", "gsm_bssmap_le.elem_id",
1094
15
        FT_UINT8, BASE_HEX, NULL, 0,
1095
15
        NULL, HFILL }
1096
15
    },
1097
15
    { &hf_gsm_bssmap_le_apdu_protocol_id,
1098
15
      { "Protocol ID", "gsm_bssmap_le.apdu_protocol_id",
1099
15
        FT_UINT8, BASE_DEC, VALS(gsm_apdu_protocol_id_strings), 0x0,
1100
15
        "APDU embedded protocol id", HFILL }
1101
15
    },
1102
15
    { &hf_gsm_bssmap_le_spare,
1103
15
      { "Spare", "gsm_bssmap_le.spare",
1104
15
        FT_UINT8, BASE_HEX, NULL, 0x0,
1105
15
        NULL, HFILL}
1106
15
    },
1107
15
    { &hf_gsm_bssmap_le_ciphering_key_flag,
1108
15
      { "Ciphering Key Flag", "gsm_bssmap_le.decipheringKeys.flag",
1109
15
        FT_UINT8, BASE_DEC, NULL, 0x0,
1110
15
        NULL, HFILL}
1111
15
    },
1112
15
    { &hf_gsm_bssmap_le_current_deciphering_key_value,
1113
15
      { "Current Deciphering Key Value", "gsm_bssmap_le.decipheringKeys.current",
1114
15
        FT_UINT64, BASE_HEX, NULL, 0x0, NULL,
1115
15
        HFILL}
1116
15
    },
1117
15
    { &hf_gsm_bssmap_le_next_deciphering_key_value,
1118
15
      { "Next Deciphering Key Value", "gsm_bssmap_le.decipheringKeys.next",
1119
15
        FT_UINT64, BASE_HEX, NULL, 0x0,
1120
15
        NULL, HFILL}
1121
15
    },
1122
15
    { &hf_gsm_bssmap_le_acq_ass,
1123
15
      { "Acquisition Assistance", "gsm_bssmap_le.acq_ass",
1124
15
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x80,
1125
15
        NULL, HFILL }
1126
15
    },
1127
15
    { &hf_gsm_bssmap_le_ref_time,
1128
15
      { "Reference Time", "gsm_bssmap_le.ref_time",
1129
15
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x40,
1130
15
        NULL, HFILL }
1131
15
    },
1132
15
    { &hf_gsm_bssmap_le_ref_loc,
1133
15
      { "Reference Location", "gsm_bssmap_le.ref_loc",
1134
15
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x20,
1135
15
        NULL, HFILL }
1136
15
    },
1137
15
    { &hf_gsm_bssmap_le_dgps_corr,
1138
15
      { "DGPS Corrections", "gsm_bssmap_le.gps_corr",
1139
15
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x08,
1140
15
        NULL, HFILL }
1141
15
    },
1142
15
    { &hf_gsm_bssmap_le_nav_mod,
1143
15
      { "Navigation Model", "gsm_bssmap_le.nav_mod",
1144
15
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x10,
1145
15
        NULL, HFILL }
1146
15
    },
1147
15
    { &hf_gsm_bssmap_le_iono_mod,
1148
15
      { "Ionospheric Model", "gsm_bssmap_le.iono_mod",
1149
15
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x04,
1150
15
        NULL, HFILL }
1151
15
    },
1152
15
    { &hf_gsm_bssmap_le_utc_mod,
1153
15
      { "UTC Model", "gsm_bssmap_le.utc_mod",
1154
15
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x02,
1155
15
        NULL, HFILL }
1156
15
    },
1157
15
    { &hf_gsm_bssmap_le_almanac,
1158
15
      { "Almanac", "gsm_bssmap_le.almanac",
1159
15
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x01,
1160
15
        NULL, HFILL }
1161
15
    },
1162
15
    { &hf_gsm_bssmap_le_ephemeris_ext_chk,
1163
15
      { "Ephemeris Extension Check", "gsm_bssmap_le.ephemeris_ext_chk",
1164
15
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x04,
1165
15
        NULL, HFILL }
1166
15
    },
1167
15
    { &hf_gsm_bssmap_le_ephemeris_ext,
1168
15
      { "Ephemeris Extension", "gsm_bssmap_le.ephemeris_ext",
1169
15
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x02,
1170
15
        NULL, HFILL }
1171
15
    },
1172
15
    { &hf_gsm_bssmap_le_real_time_int,
1173
15
      { "Real-Time Integrity", "gsm_bssmap_le.real_time_int",
1174
15
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x01,
1175
15
        NULL, HFILL }
1176
15
    },
1177
15
    { &hf_gsm_bssmap_le_lcs_cause_value,
1178
15
      { "Cause Value", "gsm_bssmap_le.lcsCauseValue",
1179
15
        FT_UINT8, BASE_HEX, VALS(bssmap_le_lcs_cause_values), 0x0,
1180
15
        NULL, HFILL}
1181
15
    },
1182
15
    { &hf_gsm_bssmap_le_diagnostic_value,
1183
15
      { "Diagnostic Value", "gsm_bssmap_le.diagnosticValue",
1184
15
        FT_UINT8, BASE_HEX, VALS(bssmap_le_position_method_failure_diagnostic_vals), 0x0,
1185
15
        NULL, HFILL}
1186
15
    },
1187
15
    { &hf_gsm_bssmap_le_client_category,
1188
15
      { "Client Category", "gsm_bssmap_le.lcsClientType.clientCategory",
1189
15
        FT_UINT8, BASE_HEX, VALS(bssmap_le_client_category), 0x0,
1190
15
        NULL, HFILL}
1191
15
    },
1192
15
    { &hf_gsm_bssmap_le_client_subtype,
1193
15
      { "Client Subtype", "gsm_bssmap_le.lcsClientType.clientSubtype",
1194
15
        FT_UINT8, BASE_HEX, VALS(bssmap_le_client_subtype), 0x0,
1195
15
        NULL, HFILL}
1196
15
    },
1197
15
    { &hf_gsm_bssmap_le_velocity_requested,
1198
15
      { "Velocity Requested", "gsm_bssmap_le.lcsQos.velocityRequested",
1199
15
        FT_UINT8, BASE_HEX, VALS(bssmap_le_velocity_requested_vals), 0x0,
1200
15
        NULL, HFILL}
1201
15
    },
1202
15
    { &hf_gsm_bssmap_le_vertical_coordinate_indicator,
1203
15
      { "Vertical Coordinate Indicator", "gsm_bssmap_le.lcsQos.verticalCoordinateIndicator",
1204
15
        FT_UINT8, BASE_HEX, VALS(bssmap_le_vertical_coordinate_indicator_vals), 0x0,
1205
15
        NULL, HFILL}
1206
15
    },
1207
15
    { &hf_gsm_bssmap_le_horizontal_accuracy_indicator,
1208
15
      { "Horizontal Accuracy Indicator", "gsm_bssmap_le.lcsQos.horizontalAccuracyIndicator",
1209
15
        FT_UINT8, BASE_HEX, VALS(bssmap_le_horizontal_accuracy_indicator_vals), 0x0,
1210
15
        NULL, HFILL}
1211
15
    },
1212
15
    { &hf_gsm_bssmap_le_horizontal_accuracy,
1213
15
      { "Horizontal Accuracy", "gsm_bssmap_le.lcsQos.horizontalAccuracy",
1214
15
        FT_UINT8, BASE_HEX, NULL, 0x0,
1215
15
        NULL, HFILL}
1216
15
    },
1217
15
    { &hf_gsm_bssmap_le_vertical_accuracy,
1218
15
      { "Vertical Accuracy", "gsm_bssmap_le.lcsQos.verticalAccuracy",
1219
15
        FT_UINT8, BASE_HEX, NULL, 0x0,
1220
15
        NULL, HFILL}
1221
15
    },
1222
15
    { &hf_gsm_bssmap_le_vertical_accuracy_indicator,
1223
15
      { "Vertical Accuracy Indicator", "gsm_bssmap_le.lcsQos.verticalAccuracyIndicator",
1224
15
        FT_UINT8, BASE_HEX, VALS(bssmap_le_vertical_accuracy_indicator_vals), 0x0,
1225
15
        NULL, HFILL}
1226
15
    },
1227
15
    { &hf_gsm_bssmap_le_response_time_category,
1228
15
      { "Response Time Category", "gsm_bssmap_le.lcsQos.responseTimeCategory",
1229
15
        FT_UINT8, BASE_HEX, VALS(bssmap_le_response_time_definitions_vals), 0x0,
1230
15
        NULL, HFILL}
1231
15
    },
1232
15
    { &hf_gsm_bssmap_le_apdu,
1233
15
      { "APDU", "gsm_bssmap_le.apdu",
1234
15
        FT_BYTES, BASE_NONE, NULL, 0x0,
1235
15
        NULL, HFILL}
1236
15
    },
1237
15
    { &hf_gsm_bssmap_le_message_elements,
1238
15
      { "Message Elements", "gsm_bssmap_le.message_elements",
1239
15
        FT_BYTES, BASE_NONE, NULL, 0x0,
1240
15
        NULL, HFILL}
1241
15
    },
1242
15
    { &hf_gsm_bssmap_le_location_inf,
1243
15
    { "Location Information", "gsm_bssmap_le.location_inf",
1244
15
      FT_UINT8, BASE_HEX, VALS(bssmap_le_loc_inf_vals), 0x0,
1245
15
      NULL, HFILL }
1246
15
    },
1247
15
    { &hf_gsm_bssmap_le_pos_method,
1248
15
    { "Positioning Method", "gsm_bssmap_le.pos_method",
1249
15
      FT_UINT8, BASE_HEX, VALS(bssmap_le_pos_method_vals), 0x0,
1250
15
      NULL, HFILL }
1251
15
    },
1252
15
    { &hf_gsm_bssmap_le_pos_data_disc,
1253
15
    { "Positioning Data Discriminator", "gsm_bssmap_le.pos_data_disc",
1254
15
      FT_UINT8, BASE_HEX, NULL, 0x0f,
1255
15
      NULL, HFILL }
1256
15
    },
1257
15
    { &hf_gsm_bssmap_le_pos_data_pos_method,
1258
15
    { "Positioning Method", "gsm_bssmap_le.pos_data.pos_method",
1259
15
      FT_UINT8, BASE_HEX, VALS(bssmap_le_pos_data_pos_method_vals), 0xf8,
1260
15
      NULL, HFILL }
1261
15
    },
1262
15
    { &hf_gsm_bssmap_le_pos_data_usage,
1263
15
    { "Usage", "gsm_bssmap_le.pos_data.usage",
1264
15
      FT_UINT8, BASE_HEX, VALS(bssmap_le_pos_data_usage_vals), 0x03,
1265
15
      NULL, HFILL }
1266
15
    },
1267
15
  };
1268
1269
15
  expert_module_t* expert_gsm_a_bssmap_le;
1270
1271
15
  static ei_register_info ei[] = {
1272
15
    { &ei_gsm_a_bssmap_le_not_decoded_yet, { "gsm_bssmap_le.not_decoded_yet", PI_UNDECODED, PI_WARN, "Not decoded yet", EXPFILL }},
1273
15
    { &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 }},
1274
15
    { &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 }},
1275
15
  };
1276
1277
  /* Setup protocol subtree array */
1278
15
#define NUM_INDIVIDUAL_ELEMS  1
1279
15
  int *ett[NUM_INDIVIDUAL_ELEMS + NUM_GSM_BSSMAP_LE_MSG +
1280
15
      NUM_GSM_BSSMAP_LE_ELEM];
1281
1282
15
  ett[0] = &ett_bssmap_le_msg;
1283
1284
15
  last_offset = NUM_INDIVIDUAL_ELEMS;
1285
1286
225
  for (i=0; i < NUM_GSM_BSSMAP_LE_MSG; i++, last_offset++)
1287
210
  {
1288
210
    ett[last_offset] = &ett_gsm_bssmap_le_msg[i];
1289
210
  }
1290
1291
480
  for (i=0; i < NUM_GSM_BSSMAP_LE_ELEM; i++, last_offset++)
1292
465
  {
1293
465
    ett[last_offset] = &ett_gsm_bssmap_le_elem[i];
1294
465
  }
1295
1296
  /* Register the protocol name and description */
1297
1298
15
  proto_bssmap_le =
1299
15
    proto_register_protocol("Lb-I/F BSSMAP LE", "GSM BSSMAP LE", "gsm_bssmap_le");
1300
1301
15
  proto_register_field_array(proto_bssmap_le, hf, array_length(hf));
1302
15
  proto_register_subtree_array(ett, array_length(ett));
1303
15
  expert_gsm_a_bssmap_le = expert_register_protocol(proto_bssmap_le);
1304
15
  expert_register_field_array(expert_gsm_a_bssmap_le, ei, array_length(ei));
1305
1306
15
  bssmap_le_handle = register_dissector("gsm_bssmap_le", dissect_bssmap_le, proto_bssmap_le);
1307
15
}
1308
1309
void
1310
proto_reg_handoff_gsm_bssmap_le(void)
1311
15
{
1312
15
  dissector_add_uint("bssap_le.pdu_type",  BSSAP_PDU_TYPE_BSSMAP, bssmap_le_handle);
1313
1314
15
  gsm_bsslap_handle = find_dissector_add_dependency("gsm_bsslap", proto_bssmap_le);
1315
15
}
1316
1317
/*
1318
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
1319
 *
1320
 * Local variables:
1321
 * c-basic-offset: 8
1322
 * tab-width: 8
1323
 * indent-tabs-mode: t
1324
 * End:
1325
 *
1326
 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1327
 * :indentSize=8:tabSize=8:noTabs=false:
1328
 */