Coverage Report

Created: 2025-08-04 07:15

/src/wireshark/epan/dissectors/packet-gsm_bssmap_le.c
Line
Count
Source (jump to first uncovered line)
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
448
#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
  apdu_protocol_id = tvb_get_uint8(tvb,curr_offset);
296
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_apdu_protocol_id, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
297
298
0
  switch(apdu_protocol_id){
299
0
  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)
302
     */
303
0
    APDU_tvb = tvb_new_subset_length(tvb, curr_offset+1, len-1);
304
0
    if(gsm_bsslap_handle)
305
0
      call_dissector(gsm_bsslap_handle, APDU_tvb, pinfo, g_tree);
306
0
    break;
307
0
  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).
311
     */
312
0
    break;
313
0
  case 3:
314
    /* SMLCPP
315
     * The embedded message is as defined in 3GPP TS 08.31(TS 48.031).
316
     */
317
0
    break;
318
0
  default:
319
0
    break;
320
0
  }
321
322
0
  curr_offset += len;
323
324
0
  EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_bssmap_le_extraneous_data);
325
326
0
  return curr_offset - offset;
327
0
}
328
/*
329
 * 10.4 Cause
330
 * coded as the value part of the Cause IE defined in 3GPP TS 48.008
331
 */
332
/*
333
 * 10.5 Cell Identifier
334
 * coded as the value part of the Cell Identifier IE defined in 3GPP TS 48.008
335
 */
336
/*
337
 * 10.6 Chosen Channel
338
 * coded as the value part of the Chosen Channel IE defined in 3GPP TS 48.008
339
 */
340
/*
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
343
 */
344
/*
345
 * 10.8 Deciphering Keys
346
 */
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_)
349
0
{
350
0
  int bit_offset;
351
352
  /* Spare bits */
353
0
  bit_offset = (offset<<3);
354
0
  proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_spare, tvb, bit_offset, 7, ENC_BIG_ENDIAN);
355
0
  bit_offset += 7;
356
357
  /* Extract the Ciphering Key Flag and add to protocol tree */
358
0
  proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_ciphering_key_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
359
0
  bit_offset++;
360
  /*offset++;*/
361
362
  /* Extract the Current Deciphering Key Value and add to protocol tree */
363
0
  proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_current_deciphering_key_value, tvb, bit_offset, 56, ENC_NA);
364
0
  bit_offset += 56;
365
  /*offset += 7;*/
366
367
  /* Extract the Next Deciphering Key Value and add to protocol tree */
368
0
  proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_next_deciphering_key_value, tvb, bit_offset, 56, ENC_NA);
369
  /*offset += 7;*/
370
371
0
  return len;
372
0
}
373
/*
374
 * 10.9 Geographic Location
375
 * contains an octet sequence identical to that for Geographical Information
376
 * defined in 3GPP TS 23.032..
377
 */
378
/*
379
 * 10.10 Requested GPS Assistance Data
380
 */
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_)
383
0
{
384
0
  uint32_t  curr_offset;
385
386
0
  curr_offset = offset;
387
388
  /* Octet 3 H G F E D C B A */
389
  /* bit H Acquisition Assistance */
390
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_acq_ass, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
391
  /* bit G Reference Time */
392
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_ref_time, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
393
  /* bit F Reference Location */
394
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_ref_loc, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
395
  /* bit E DGPS Corrections */
396
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_dgps_corr, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
397
  /* bit D Navigation Model */
398
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_nav_mod, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
399
  /* bit C Ionospheric Model */
400
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_iono_mod, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
401
  /* bit B UTC Model */
402
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_utc_mod, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
403
  /* bit A Almanac */
404
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_almanac, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
405
0
  curr_offset++;
406
407
  /* Octet 4 P O N M L K J I
408
   * bits L through P are Spare bits
409
   */
410
  /* bit K Ephemeris Extension Check */
411
0
  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
0
  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
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_real_time_int, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
416
0
  curr_offset++;
417
418
  /* Octet 5 to Octet 8+2n Satellite related data */
419
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");
420
0
  return len;
421
0
}
422
/*
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
427
 */
428
/*
429
 * 10.12 (void)
430
 */
431
/*
432
 * 10.13 LCS Cause
433
 */
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}
452
};
453
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}
465
};
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_)
468
0
{
469
0
  uint32_t  curr_offset;
470
471
0
  curr_offset = offset;
472
473
  /* cause value  */
474
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_lcs_cause_value, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
475
0
  curr_offset++;
476
477
0
  if (len == 2)
478
0
  {
479
    /* Diagnostic value (note) */
480
0
    proto_tree_add_item(tree, hf_gsm_bssmap_le_diagnostic_value, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
481
0
    curr_offset++;
482
0
  }
483
484
0
  return curr_offset - offset;
485
0
}
486
/*
487
 * 10.14 LCS Client Type
488
 */
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}
496
};
497
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}
506
};
507
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_)
510
1
{
511
1
  uint32_t  curr_offset;
512
1
  uint8_t bitCount;
513
514
1
  bitCount = offset<<3;
515
1
  curr_offset = offset;
516
517
  /* Extract the client category and add to protocol tree */
518
1
  proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_client_category, tvb, bitCount, 4, ENC_BIG_ENDIAN);
519
1
  bitCount = bitCount + 4;
520
521
  /* Extract the client subtype and add to protocol tree */
522
1
  proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_client_subtype, tvb, bitCount, 4, ENC_BIG_ENDIAN);
523
  /*bitCount = bitCount + 4;*/
524
1
  curr_offset++;
525
526
1
  return curr_offset - offset;
527
1
}
528
/*
529
 * 10.15 LCS Priority
530
 * coded as the LCS-Priority octet in 3GPP TS 29.002
531
 */
532
/*
533
 * 10.16 LCS QoS
534
 */
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_)
537
3
{
538
3
  uint64_t verticalCoordIndicator, velocityRequested, horizontalAccuracyIndicator, verticalAccuracyIndicator;
539
3
  uint16_t bitCount;
540
541
3
  bitCount = offset << 3;
542
543
3
  proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_spare, tvb, bitCount, 6, ENC_BIG_ENDIAN);
544
3
  bitCount = bitCount + 6;
545
546
  /* Extract Velocity requested element */
547
3
  proto_tree_add_bits_ret_val(tree, hf_gsm_bssmap_le_velocity_requested, tvb, bitCount, 1, &velocityRequested, ENC_BIG_ENDIAN);
548
3
  bitCount++;
549
550
  /* Extract vertical coordinator element */
551
3
  proto_tree_add_bits_ret_val(tree, hf_gsm_bssmap_le_vertical_coordinate_indicator, tvb, bitCount, 1, &verticalCoordIndicator, ENC_BIG_ENDIAN);
552
3
  bitCount++;
553
554
  /* Extract horizontal accuracy element */
555
3
  proto_tree_add_bits_ret_val(tree, hf_gsm_bssmap_le_horizontal_accuracy_indicator, tvb, bitCount, 1, &horizontalAccuracyIndicator, ENC_BIG_ENDIAN);
556
3
  bitCount++;
557
558
3
  if(horizontalAccuracyIndicator == 1)
559
2
  {
560
2
    proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_horizontal_accuracy, tvb, bitCount, 7, ENC_BIG_ENDIAN);
561
2
    bitCount = bitCount + 7;
562
2
  }
563
1
  else
564
1
  {
565
1
    proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_spare, tvb, bitCount, 7, ENC_BIG_ENDIAN);
566
1
    bitCount = bitCount + 7;
567
1
  }
568
569
  /* Extract vertical accuracy element */
570
3
  proto_tree_add_bits_ret_val(tree, hf_gsm_bssmap_le_vertical_accuracy_indicator, tvb, bitCount, 1, &verticalAccuracyIndicator, ENC_BIG_ENDIAN);
571
3
  bitCount++;
572
573
3
  if(verticalAccuracyIndicator == 1)
574
1
  {
575
1
    proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_vertical_accuracy, tvb, bitCount, 7, ENC_BIG_ENDIAN);
576
1
    bitCount = bitCount + 7;
577
1
  }
578
2
  else
579
2
  {
580
2
    proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_spare, tvb, bitCount, 7, ENC_BIG_ENDIAN);
581
2
    bitCount = bitCount + 7;
582
2
  }
583
584
3
  proto_tree_add_bits_item(tree, hf_gsm_bssmap_le_response_time_category, tvb, bitCount, 2, ENC_BIG_ENDIAN);
585
  /*bitCount = bitCount + 2;*/
586
587
3
  return len;
588
3
}
589
/*
590
 * 10.17 (void)
591
 */
592
/*
593
 * 10.18 Location Type
594
 */
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_)
597
0
{
598
0
  uint32_t  curr_offset;
599
600
0
  curr_offset = offset;
601
602
  /* Location information (octet 3)  */
603
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_location_inf, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
604
0
  curr_offset++;
605
0
  if (len == 1) {
606
0
    return len;
607
0
  }
608
  /* Positioning Method (octet 4) */
609
0
  proto_tree_add_item(tree, hf_gsm_bssmap_le_pos_method, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
610
0
  curr_offset++;
611
612
0
  return curr_offset - offset;
613
0
}
614
/*
615
 * 10.19 Network Element Identity
616
 */
617
/*
618
 * 10.20 Positioning Data
619
 */
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_)
622
0
{
623
0
  uint32_t  curr_offset, value;
624
625
0
  curr_offset = offset;
626
627
  /* Octet 3  spare Positioning Data Discriminator*/
628
0
  proto_tree_add_item_ret_uint(tree, hf_gsm_bssmap_le_pos_data_disc, tvb, curr_offset, 1, ENC_BIG_ENDIAN, &value);
629
0
  curr_offset++;
630
631
0
  if (value != 0) {
632
0
    return len;
633
0
  }
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
636
   */
637
0
  while (curr_offset < (offset +len)) {
638
    /* Octet x  positioning method  usage*/
639
0
    proto_tree_add_item(tree, hf_gsm_bssmap_le_pos_data_pos_method, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
640
0
    proto_tree_add_item(tree, hf_gsm_bssmap_le_pos_data_usage, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
641
0
    curr_offset++;
642
0
  }
643
644
0
  return len;
645
0
}
646
/*
647
 * 10.21 Return Error Request
648
 */
649
/*
650
 * 10.22 Return Error Cause
651
 */
652
/*
653
 * 10.23 (void)
654
 */
655
/*
656
 * 10.24 Segmentation
657
 */
658
/*
659
 * 10.25 (void)
660
 */
661
/*
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
666
 */
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_)
670
0
{
671
  /* Extract the LCS Capability element and add to protocol tree */
672
0
  proto_tree_add_expert(tree, pinfo, &ei_gsm_a_bssmap_le_not_decoded_yet, tvb, offset, len);
673
0
  return len;
674
0
}
675
676
/*
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.
684
 */
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_)
688
0
{
689
  /* Extract the Packet Measurement Report element and add to protocol tree */
690
0
  proto_tree_add_expert(tree, pinfo, &ei_gsm_a_bssmap_le_not_decoded_yet, tvb, offset, len);
691
692
0
  return len;
693
0
}
694
695
/*
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.
699
 */
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_)
703
0
{
704
  /* Extract the Measured Cell Identity List element and add to protocol tree */
705
0
  proto_tree_add_expert(tree, pinfo, &ei_gsm_a_bssmap_le_not_decoded_yet, tvb, offset, len);
706
707
0
  return len;
708
0
}
709
710
/*
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.
716
 */
717
/*
718
 * 10.30 Velocity Data
719
 * contains an octet sequence identical to that for Description of
720
 * Velocity defined in 3GPP TS 23.032.
721
 */
722
/*
723
 * 10.31 Requested GANSS Assistance Data
724
 */
725
/*
726
 * 10.32 GANSS Positioning Data
727
 */
728
/*
729
 * 10.33 GANSS Location Type
730
 */
731
732
733
210
#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];
735
736
/*
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.
740
741
It is shown here as a comment for easier reference.
742
743
Note this enum must be of the same size as the element decoding list below
744
745
typedef enum
746
{
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 /
778
}
779
bssmap_le_elem_idx_t;
780
*/
781
782
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) */
815
816
  NULL, /* NONE */
817
818
};
819
820
/*
821
 * 9.1 PERFORM LOCATION REQUEST
822
 */
823
static void
824
bssmap_le_perf_loc_request(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len)
825
0
{
826
0
  uint32_t  curr_offset;
827
0
  uint32_t  consumed;
828
0
  unsigned  curr_len;
829
830
0
  curr_offset = offset;
831
0
  curr_len = len;
832
833
  /* Location Type 9.1.1 M 3-n */
834
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)
835
  /* Cell Identifier 9.1.2 O 5-10 */
836
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);
837
  /* Classmark Information Type 3 9.1.3 O 3-14 */
838
0
  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
0
  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
0
  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
0
  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
0
  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
0
  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
0
  ELEM_OPT_TELV(BSSMAP_LE_APDU, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_APDU, NULL);
851
  /* LCS Capability 9.1.9 O */
852
0
  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
0
  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
0
  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
0
  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
0
  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
0
  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
0
  ELEM_OPT_TLV(BSSMAP_LE_REQUESTED_GANSS_ASSISTANCE_DATA, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_REQ_GNSS_ASSIST_D, NULL);
865
866
0
  EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_bssmap_le_extraneous_data);
867
868
0
}
869
870
/*
871
 * 9.2 PERFORM LOCATION RESPONSE
872
 */
873
static void
874
bssmap_le_perf_loc_resp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len)
875
0
{
876
0
  uint32_t  curr_offset;
877
0
  uint32_t  consumed;
878
0
  unsigned  curr_len;
879
880
0
  curr_offset = offset;
881
0
  curr_len = len;
882
883
  /* Location Estimate 9.2.1 C (note 1) 3-n */
884
0
  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
0
  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
0
  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
0
  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
0
  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
0
  ELEM_OPT_TLV(BSSMAP_LE_GANSS_POSITIONING_DATA, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_GANSS_POS_DATA, NULL);
895
896
0
  EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_bssmap_le_extraneous_data);
897
0
}
898
899
/*
900
 * 9.8 CONNECTION ORIENTED INFORMATION
901
 */
902
static void
903
bssmap_le_connection_oriented(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len)
904
0
{
905
0
  uint32_t  curr_offset;
906
0
  uint32_t  consumed;
907
0
  unsigned  curr_len;
908
909
0
  curr_offset = offset;
910
0
  curr_len = len;
911
912
  /* APDU 9.8.1 M 3-n */
913
0
  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
0
  ELEM_OPT_TLV(BSSMAP_LE_SEGMENTATION, BSSAP_PDU_TYPE_BSSMAP, BE_SEG, NULL);
916
917
0
  EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_bssmap_le_extraneous_data);
918
0
}
919
920
/*
921
 * 9.9  CONNECTIONLESS INFORMATION
922
 *
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
929
*/
930
931
/*
932
 * 9.11 RESET ACKNOWLEDGE
933
 * no data
934
 */
935
936
/*
937
 * 9.12 PERFORM LOCATION INFORMATION
938
 */
939
static void
940
bssmap_le_perf_loc_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, uint32_t offset, unsigned len)
941
0
{
942
0
  uint32_t  curr_offset;
943
0
  uint32_t  consumed;
944
0
  unsigned  curr_len;
945
946
0
  curr_offset = offset;
947
0
  curr_len = len;
948
949
  /* Cell Identifier 9.12.1 M */
950
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);
951
  /* APDU 9.1.8 O 3-n */
952
0
  ELEM_OPT_TELV(BSSMAP_LE_APDU, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_APDU, NULL);
953
954
0
  EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_bssmap_le_extraneous_data);
955
0
}
956
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 */
971
972
  NULL, /* NONE */
973
};
974
975
static int
976
dissect_bssmap_le(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
977
0
{
978
0
  static gsm_a_tap_rec_t  tap_rec[4];
979
0
  static gsm_a_tap_rec_t *tap_p;
980
0
  static unsigned   tap_current=0;
981
0
  uint8_t oct;
982
0
  uint32_t  offset, saved_offset;
983
0
  uint32_t  len;
984
0
  int idx;
985
0
  proto_item  *bssmap_le_item = NULL;
986
0
  proto_tree  *bssmap_le_tree = NULL;
987
0
  const char  *str;
988
0
  sccp_msg_info_t *sccp_msg_p = (sccp_msg_info_t *)data;
989
990
0
  if (!(sccp_msg_p && sccp_msg_p->data.co.assoc)) {
991
0
    sccp_msg_p = NULL;
992
0
  }
993
994
0
  col_append_str(pinfo->cinfo, COL_INFO, "(BSSMAP LE) ");
995
996
  /*
997
   * set tap record pointer
998
   */
999
0
  tap_current++;
1000
0
  if (tap_current >= 4)
1001
0
  {
1002
0
    tap_current = 0;
1003
0
  }
1004
0
  tap_p = &tap_rec[tap_current];
1005
1006
1007
0
  offset = 0;
1008
0
  saved_offset = offset;
1009
1010
0
  g_tree = tree;
1011
1012
0
  len = tvb_reported_length(tvb);
1013
1014
  /*
1015
   * add BSSMAP message name
1016
   */
1017
0
  oct = tvb_get_uint8(tvb, offset++);
1018
1019
0
  str = try_val_to_str_idx((uint32_t) oct, gsm_bssmap_le_msg_strings, &idx);
1020
1021
0
  if (sccp_msg_p && !sccp_msg_p->data.co.label) {
1022
0
    sccp_msg_p->data.co.label = wmem_strdup(wmem_file_scope(),
1023
0
                        val_to_str((uint32_t) oct,
1024
0
                        gsm_bssmap_le_msg_strings, "BSSMAP LE(0x%02x)"));
1025
0
  }
1026
1027
  /*
1028
   * create the protocol tree
1029
   */
1030
0
  if (str == NULL)
1031
0
  {
1032
0
    bssmap_le_item =
1033
0
    proto_tree_add_protocol_format(tree, proto_bssmap_le, tvb, 0, len,
1034
0
      "Lb - I/F BSSMAP LE - Unknown BSSMAP Message Type (0x%02x)",
1035
0
      oct);
1036
1037
0
    bssmap_le_tree = proto_item_add_subtree(bssmap_le_item, ett_bssmap_le_msg);
1038
0
  }
1039
0
  else
1040
0
  {
1041
0
    bssmap_le_item =
1042
0
    proto_tree_add_protocol_format(tree, proto_bssmap_le, tvb, 0, -1,
1043
0
      "Lb - I/F BSSMAP LE - %s",
1044
0
      str);
1045
1046
0
    bssmap_le_tree = proto_item_add_subtree(bssmap_le_item, ett_gsm_bssmap_le_msg[idx]);
1047
1048
0
    col_append_fstr(pinfo->cinfo, COL_INFO, "%s ", str);
1049
1050
    /*
1051
     * add BSSMAP message name
1052
     */
1053
0
    proto_tree_add_uint_format(bssmap_le_tree, hf_gsm_bssmap_le_msg_type,
1054
0
    tvb, saved_offset, 1, oct, "Message Type %s",str);
1055
0
  }
1056
1057
0
  tap_p->pdu_type = BSSAP_PDU_TYPE_BSSMAP;
1058
0
  tap_p->message_type = oct;
1059
1060
0
  tap_queue_packet(gsm_a_tap, pinfo, tap_p);
1061
1062
0
  if (str == NULL) return len;
1063
1064
0
  if (offset >= len) return len;
1065
1066
  /*
1067
   * decode elements
1068
   */
1069
0
  if (bssmap_le_msg_fcn[idx] == NULL)
1070
0
  {
1071
0
    proto_tree_add_item(bssmap_le_tree, hf_gsm_bssmap_le_message_elements, tvb, offset, len - offset, ENC_NA);
1072
0
  }
1073
0
  else
1074
0
  {
1075
0
    (*bssmap_le_msg_fcn[idx])(tvb, bssmap_le_tree, pinfo, offset, len - offset);
1076
0
  }
1077
1078
0
  return len;
1079
0
}
1080
1081
/* Register the protocol with Wireshark */
1082
void
1083
proto_register_gsm_bssmap_le(void)
1084
14
{
1085
14
  unsigned i;
1086
14
  unsigned last_offset;
1087
1088
  /* Setup list of header fields */
1089
14
  static hf_register_info hf[] = {
1090
14
    { &hf_gsm_bssmap_le_msg_type,
1091
14
      { "BSSMAP LE Message Type", "gsm_bssmap_le.msgtype",
1092
14
        FT_UINT8, BASE_HEX, VALS(gsm_bssmap_le_msg_strings), 0x0,
1093
14
        NULL, HFILL }
1094
14
    },
1095
14
    { &hf_gsm_bssmap_le_elem_id,
1096
14
      { "Element ID", "gsm_bssmap_le.elem_id",
1097
14
        FT_UINT8, BASE_HEX, NULL, 0,
1098
14
        NULL, HFILL }
1099
14
    },
1100
14
    { &hf_gsm_bssmap_le_apdu_protocol_id,
1101
14
      { "Protocol ID", "gsm_bssmap_le.apdu_protocol_id",
1102
14
        FT_UINT8, BASE_DEC, VALS(gsm_apdu_protocol_id_strings), 0x0,
1103
14
        "APDU embedded protocol id", HFILL }
1104
14
    },
1105
14
    { &hf_gsm_bssmap_le_spare,
1106
14
      { "Spare", "gsm_bssmap_le.spare",
1107
14
        FT_UINT8, BASE_HEX, NULL, 0x0,
1108
14
        NULL, HFILL}
1109
14
    },
1110
14
    { &hf_gsm_bssmap_le_ciphering_key_flag,
1111
14
      { "Ciphering Key Flag", "gsm_bssmap_le.decipheringKeys.flag",
1112
14
        FT_UINT8, BASE_DEC, NULL, 0x0,
1113
14
        NULL, HFILL}
1114
14
    },
1115
14
    { &hf_gsm_bssmap_le_current_deciphering_key_value,
1116
14
      { "Current Deciphering Key Value", "gsm_bssmap_le.decipheringKeys.current",
1117
14
        FT_UINT64, BASE_HEX, NULL, 0x0, NULL,
1118
14
        HFILL}
1119
14
    },
1120
14
    { &hf_gsm_bssmap_le_next_deciphering_key_value,
1121
14
      { "Next Deciphering Key Value", "gsm_bssmap_le.decipheringKeys.next",
1122
14
        FT_UINT64, BASE_HEX, NULL, 0x0,
1123
14
        NULL, HFILL}
1124
14
    },
1125
14
    { &hf_gsm_bssmap_le_acq_ass,
1126
14
      { "Acquisition Assistance", "gsm_bssmap_le.acq_ass",
1127
14
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x80,
1128
14
        NULL, HFILL }
1129
14
    },
1130
14
    { &hf_gsm_bssmap_le_ref_time,
1131
14
      { "Reference Time", "gsm_bssmap_le.ref_time",
1132
14
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x40,
1133
14
        NULL, HFILL }
1134
14
    },
1135
14
    { &hf_gsm_bssmap_le_ref_loc,
1136
14
      { "Reference Location", "gsm_bssmap_le.ref_loc",
1137
14
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x20,
1138
14
        NULL, HFILL }
1139
14
    },
1140
14
    { &hf_gsm_bssmap_le_dgps_corr,
1141
14
      { "DGPS Corrections", "gsm_bssmap_le.gps_corr",
1142
14
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x08,
1143
14
        NULL, HFILL }
1144
14
    },
1145
14
    { &hf_gsm_bssmap_le_nav_mod,
1146
14
      { "Navigation Model", "gsm_bssmap_le.nav_mod",
1147
14
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x10,
1148
14
        NULL, HFILL }
1149
14
    },
1150
14
    { &hf_gsm_bssmap_le_iono_mod,
1151
14
      { "Ionospheric Model", "gsm_bssmap_le.iono_mod",
1152
14
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x04,
1153
14
        NULL, HFILL }
1154
14
    },
1155
14
    { &hf_gsm_bssmap_le_utc_mod,
1156
14
      { "UTC Model", "gsm_bssmap_le.utc_mod",
1157
14
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x02,
1158
14
        NULL, HFILL }
1159
14
    },
1160
14
    { &hf_gsm_bssmap_le_almanac,
1161
14
      { "Almanac", "gsm_bssmap_le.almanac",
1162
14
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x01,
1163
14
        NULL, HFILL }
1164
14
    },
1165
14
    { &hf_gsm_bssmap_le_ephemeris_ext_chk,
1166
14
      { "Ephemeris Extension Check", "gsm_bssmap_le.ephemeris_ext_chk",
1167
14
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x04,
1168
14
        NULL, HFILL }
1169
14
    },
1170
14
    { &hf_gsm_bssmap_le_ephemeris_ext,
1171
14
      { "Ephemeris Extension", "gsm_bssmap_le.ephemeris_ext",
1172
14
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x02,
1173
14
        NULL, HFILL }
1174
14
    },
1175
14
    { &hf_gsm_bssmap_le_real_time_int,
1176
14
      { "Real-Time Integrity", "gsm_bssmap_le.real_time_int",
1177
14
        FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x01,
1178
14
        NULL, HFILL }
1179
14
    },
1180
14
    { &hf_gsm_bssmap_le_lcs_cause_value,
1181
14
      { "Cause Value", "gsm_bssmap_le.lcsCauseValue",
1182
14
        FT_UINT8, BASE_HEX, VALS(bssmap_le_lcs_cause_values), 0x0,
1183
14
        NULL, HFILL}
1184
14
    },
1185
14
    { &hf_gsm_bssmap_le_diagnostic_value,
1186
14
      { "Diagnostic Value", "gsm_bssmap_le.diagnosticValue",
1187
14
        FT_UINT8, BASE_HEX, VALS(bssmap_le_position_method_failure_diagnostic_vals), 0x0,
1188
14
        NULL, HFILL}
1189
14
    },
1190
14
    { &hf_gsm_bssmap_le_client_category,
1191
14
      { "Client Category", "gsm_bssmap_le.lcsClientType.clientCategory",
1192
14
        FT_UINT8, BASE_HEX, VALS(bssmap_le_client_category), 0x0,
1193
14
        NULL, HFILL}
1194
14
    },
1195
14
    { &hf_gsm_bssmap_le_client_subtype,
1196
14
      { "Client Subtype", "gsm_bssmap_le.lcsClientType.clientSubtype",
1197
14
        FT_UINT8, BASE_HEX, VALS(bssmap_le_client_subtype), 0x0,
1198
14
        NULL, HFILL}
1199
14
    },
1200
14
    { &hf_gsm_bssmap_le_velocity_requested,
1201
14
      { "Velocity Requested", "gsm_bssmap_le.lcsQos.velocityRequested",
1202
14
        FT_UINT8, BASE_HEX, VALS(bssmap_le_velocity_requested_vals), 0x0,
1203
14
        NULL, HFILL}
1204
14
    },
1205
14
    { &hf_gsm_bssmap_le_vertical_coordinate_indicator,
1206
14
      { "Vertical Coordinate Indicator", "gsm_bssmap_le.lcsQos.verticalCoordinateIndicator",
1207
14
        FT_UINT8, BASE_HEX, VALS(bssmap_le_vertical_coordinate_indicator_vals), 0x0,
1208
14
        NULL, HFILL}
1209
14
    },
1210
14
    { &hf_gsm_bssmap_le_horizontal_accuracy_indicator,
1211
14
      { "Horizontal Accuracy Indicator", "gsm_bssmap_le.lcsQos.horizontalAccuracyIndicator",
1212
14
        FT_UINT8, BASE_HEX, VALS(bssmap_le_horizontal_accuracy_indicator_vals), 0x0,
1213
14
        NULL, HFILL}
1214
14
    },
1215
14
    { &hf_gsm_bssmap_le_horizontal_accuracy,
1216
14
      { "Horizontal Accuracy", "gsm_bssmap_le.lcsQos.horizontalAccuracy",
1217
14
        FT_UINT8, BASE_HEX, NULL, 0x0,
1218
14
        NULL, HFILL}
1219
14
    },
1220
14
    { &hf_gsm_bssmap_le_vertical_accuracy,
1221
14
      { "Vertical Accuracy", "gsm_bssmap_le.lcsQos.verticalAccuracy",
1222
14
        FT_UINT8, BASE_HEX, NULL, 0x0,
1223
14
        NULL, HFILL}
1224
14
    },
1225
14
    { &hf_gsm_bssmap_le_vertical_accuracy_indicator,
1226
14
      { "Vertical Accuracy Indicator", "gsm_bssmap_le.lcsQos.verticalAccuracyIndicator",
1227
14
        FT_UINT8, BASE_HEX, VALS(bssmap_le_vertical_accuracy_indicator_vals), 0x0,
1228
14
        NULL, HFILL}
1229
14
    },
1230
14
    { &hf_gsm_bssmap_le_response_time_category,
1231
14
      { "Response Time Category", "gsm_bssmap_le.lcsQos.responseTimeCategory",
1232
14
        FT_UINT8, BASE_HEX, VALS(bssmap_le_response_time_definitions_vals), 0x0,
1233
14
        NULL, HFILL}
1234
14
    },
1235
14
    { &hf_gsm_bssmap_le_apdu,
1236
14
      { "APDU", "gsm_bssmap_le.apdu",
1237
14
        FT_BYTES, BASE_NONE, NULL, 0x0,
1238
14
        NULL, HFILL}
1239
14
    },
1240
14
    { &hf_gsm_bssmap_le_message_elements,
1241
14
      { "Message Elements", "gsm_bssmap_le.message_elements",
1242
14
        FT_BYTES, BASE_NONE, NULL, 0x0,
1243
14
        NULL, HFILL}
1244
14
    },
1245
14
    { &hf_gsm_bssmap_le_location_inf,
1246
14
    { "Location Information", "gsm_bssmap_le.location_inf",
1247
14
      FT_UINT8, BASE_HEX, VALS(bssmap_le_loc_inf_vals), 0x0,
1248
14
      NULL, HFILL }
1249
14
    },
1250
14
    { &hf_gsm_bssmap_le_pos_method,
1251
14
    { "Positioning Method", "gsm_bssmap_le.pos_method",
1252
14
      FT_UINT8, BASE_HEX, VALS(bssmap_le_pos_method_vals), 0x0,
1253
14
      NULL, HFILL }
1254
14
    },
1255
14
    { &hf_gsm_bssmap_le_pos_data_disc,
1256
14
    { "Positioning Data Discriminator", "gsm_bssmap_le.pos_data_disc",
1257
14
      FT_UINT8, BASE_HEX, NULL, 0x0f,
1258
14
      NULL, HFILL }
1259
14
    },
1260
14
    { &hf_gsm_bssmap_le_pos_data_pos_method,
1261
14
    { "Positioning Method", "gsm_bssmap_le.pos_data.pos_method",
1262
14
      FT_UINT8, BASE_HEX, VALS(bssmap_le_pos_data_pos_method_vals), 0xf8,
1263
14
      NULL, HFILL }
1264
14
    },
1265
14
    { &hf_gsm_bssmap_le_pos_data_usage,
1266
14
    { "Usage", "gsm_bssmap_le.pos_data.usage",
1267
14
      FT_UINT8, BASE_HEX, VALS(bssmap_le_pos_data_usage_vals), 0x03,
1268
14
      NULL, HFILL }
1269
14
    },
1270
14
  };
1271
1272
14
  expert_module_t* expert_gsm_a_bssmap_le;
1273
1274
14
  static ei_register_info ei[] = {
1275
14
    { &ei_gsm_a_bssmap_le_not_decoded_yet, { "gsm_bssmap_le.not_decoded_yet", PI_UNDECODED, PI_WARN, "Not decoded yet", EXPFILL }},
1276
14
    { &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
14
    { &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 }},
1278
14
  };
1279
1280
  /* Setup protocol subtree array */
1281
14
#define NUM_INDIVIDUAL_ELEMS  1
1282
14
  int *ett[NUM_INDIVIDUAL_ELEMS + NUM_GSM_BSSMAP_LE_MSG +
1283
14
      NUM_GSM_BSSMAP_LE_ELEM];
1284
1285
14
  ett[0] = &ett_bssmap_le_msg;
1286
1287
14
  last_offset = NUM_INDIVIDUAL_ELEMS;
1288
1289
210
  for (i=0; i < NUM_GSM_BSSMAP_LE_MSG; i++, last_offset++)
1290
196
  {
1291
196
    ett[last_offset] = &ett_gsm_bssmap_le_msg[i];
1292
196
  }
1293
1294
448
  for (i=0; i < NUM_GSM_BSSMAP_LE_ELEM; i++, last_offset++)
1295
434
  {
1296
434
    ett[last_offset] = &ett_gsm_bssmap_le_elem[i];
1297
434
  }
1298
1299
  /* Register the protocol name and description */
1300
1301
14
  proto_bssmap_le =
1302
14
    proto_register_protocol("Lb-I/F BSSMAP LE", "GSM BSSMAP LE", "gsm_bssmap_le");
1303
1304
14
  proto_register_field_array(proto_bssmap_le, hf, array_length(hf));
1305
14
  proto_register_subtree_array(ett, array_length(ett));
1306
14
  expert_gsm_a_bssmap_le = expert_register_protocol(proto_bssmap_le);
1307
14
  expert_register_field_array(expert_gsm_a_bssmap_le, ei, array_length(ei));
1308
1309
14
  bssmap_le_handle = register_dissector("gsm_bssmap_le", dissect_bssmap_le, proto_bssmap_le);
1310
14
}
1311
1312
void
1313
proto_reg_handoff_gsm_bssmap_le(void)
1314
14
{
1315
14
  dissector_add_uint("bssap_le.pdu_type",  BSSAP_PDU_TYPE_BSSMAP, bssmap_le_handle);
1316
1317
14
  gsm_bsslap_handle = find_dissector_add_dependency("gsm_bsslap", proto_bssmap_le);
1318
14
}
1319
1320
/*
1321
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
1322
 *
1323
 * Local variables:
1324
 * c-basic-offset: 8
1325
 * tab-width: 8
1326
 * indent-tabs-mode: t
1327
 * End:
1328
 *
1329
 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1330
 * :indentSize=8:tabSize=8:noTabs=false:
1331
 */