Use tce correct IE id
[metze/wireshark/wip.git] / epan / dissectors / packet-bssgp.c
1 /* packet-bssgp.c
2  * Routines for Base Station Subsystem GPRS Protocol dissection
3  * Copyright 2000, Susanne Edlund <susanne.edlund@ericsson.com>
4  *
5  * $Id$
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24  */
25
26 /* 3GPP TS 48.018 V 6.5.0 (2004-07) Release 6 */
27
28 #ifdef HAVE_CONFIG_H
29 # include "config.h"
30 #endif
31
32 #include <glib.h>
33 #include <epan/packet.h>
34 #include <epan/expert.h>
35 #include <prefs.h>
36 #include <epan/asn1.h>
37
38 #include "packet-bssgp.h"
39 #include "packet-e212.h"
40 #include "packet-gsm_a_common.h"
41 #include "packet-ranap.h"
42 #include "packet-rrc.h"
43 #include "packet-lte-rrc.h"
44 #include "packet-s1ap.h"
45
46 /* #define BSSGP_DEBUG */
47 /*
48  * TS 48.018 V6.6.0 (2004-11) says, of information elements:
49  *
50  *    Refer to General Structure Of The Information Elements/3GPP TS 48.016.
51  *
52  * TS 48.016 V9.0.0 (2010-02), in that section, says, of information elements:
53  *
54  *    When a field extends over more than one octet, the order of bit
55  *    values progressively decreases as the octet number increases.
56  *    The least significant bit of the field is represented by the
57  *    lowest numbered bit of the highest numbered octet of the field.
58  *
59  * which sure sounds little-endian.
60  *
61  * [
62  * Later comment:
63  * Actually: To me. the above reads as being BIG_ENDIAN.
64  *  IOW: if bytes are numbered from 0 to n, then the n'th byte
65  *       ("highest numbered octet") has the least significant bit.
66  * ]
67  *
68  * However, for some not-entirely-obvious reason, BSSGP_LITTLE_ENDIAN, which
69  * was passed to proto_tree_add_item() as the byte-order argument, was
70  * defined as FALSE - which meant big-endian.
71  *
72  * For now, we'll use ENC_BIG_ENDIAN, now that we have ENC_BIG_ENDIAN and
73  * REP_LITTLE_ENDIAN definitions.
74  */
75
76 #define BSSGP_SEP ", "
77 static int bssgp_decode_nri = 0;
78 static guint bssgp_nri_length = 4;
79
80 static packet_info *gpinfo;
81 static guint8 g_pdu_type, g_rim_application_identity;
82 static proto_tree *gparent_tree;
83 static dissector_handle_t llc_handle;
84 static dissector_handle_t rrlp_handle;
85 static dissector_handle_t data_handle;
86
87 static module_t *bssgp_module;
88 static dissector_table_t diameter_3gpp_avp_dissector_table;
89
90 /* Initialize the protocol and registered fields */
91 static int proto_bssgp = -1;
92 static int hf_bssgp_msg_type = -1;
93 int hf_bssgp_elem_id = -1;
94 static int hf_bssgp_ci = -1;
95 static int hf_bssgp_flush_action = -1;
96 static int hf_bssgp_llc_frames_disc = -1;
97 static int hf_bssgp_ra_discriminator = -1;
98 static int hf_bssgp_rim_app_id = -1;
99 static int hf_bssgp_rim_seq_no = -1;
100 static int hf_bssgp_rat_discriminator = -1;
101 static int hf_bssgp_nacc_cause = -1;
102 static int hf_bssgp_s13_cause = -1;
103 static int hf_bssgp_mbms_data_ch_cause = -1;
104 static int hf_bssgp_utra_si_cause = -1;
105 static int hf_bssgp_num_si_psi = -1;
106 static int hf_bssgp_si_psi_type = -1;
107 static int hf_bssgp_ran_inf_req_pdu_t_ext_c = -1;
108 static int hf_bssgp_ran_inf_pdu_t_ext_c = -1;
109 static int hf_bssgp_rim_pdu_ind_ack = -1;
110 static int hf_bssgp_rim_proto_ver_no = -1;
111 static int hf_bssgp_bss_area_ind = -1;
112 static int hf_bssgp_bvci = -1;
113 static int hf_bssgp_bmax = -1;
114 static int hf_bssgp_r = -1;
115 static int hf_bssgp_r_pfc = -1;
116 static int hf_bssgp_bucket_size = -1;
117 static int hf_bssgp_bmax_pfc = -1;
118 static int hf_bssgp_omc_id = -1;
119 static int hf_bssgp_nsei = -1;
120 static int hf_bssgp_rrlp_flag1 = -1;
121
122 static int hf_bssgp_delay_val = -1;
123 static int hf_bssgp_cause = -1;
124 static int hf_bssgp_peak_rate_gran = -1;
125 static int hf_bssgp_cr_bit = -1;
126 static int hf_bssgp_t_bit = -1;
127 static int hf_bssgp_a_bit = -1;
128 static int hf_bssgp_ra_cause = -1;
129 static int hf_bssgp_ra_cap_upd_cause = -1;
130 static int hf_bssgp_r_default_ms = -1;
131 static int hf_bssgp_suspend_ref_no = -1;
132 static int hf_bssgp_tag = -1;
133 static int hf_bssgp_trace_ref = -1;
134 static int hf_bssgp_trigger_id = -1;
135 static int hf_bssgp_transaction_id = -1;
136 static int hf_bssgp_no_of_oct = -1;
137 static int hf_bssgp_unit_val = -1;
138 static int hf_bssgp_gprs_timer = -1;
139 static int hf_bssgp_mbms = -1;
140 static int hf_bssgp_EnhancedRadioStatus = -1;
141 static int hf_bssgp_pfcfc = -1;
142 static int hf_bssgp_rim = -1;
143 static int hf_bssgp_lcs = -1;
144 static int hf_bssgp_inr = -1;
145 static int hf_bssgp_cbl = -1;
146 static int hf_bssgp_pfc = -1;
147 static int hf_bssgp_bucket_full_ratio = -1;
148 static int hf_bssgp_b_pfc = -1;
149
150 static int hf_bssgp_precedence = -1;
151 static int hf_bssgp_serv_utran_cco = -1;
152 static int hf_bssgp_mbms_session_id = -1;
153 static int hf_bssgp_mbms_cause = -1;
154 static int hf_bssgp_mbms_stop_cause = -1;
155 static int hf_bssgp_mbms_num_ra_ids = -1;
156 static int hf_bssgp_session_inf = -1;
157 static int hf_bssgp_gb_if = -1;
158 static int hf_bssgp_ps_ho = -1;
159 static int hf_bssgp_src_to_trg_transp_cont = -1;
160 static int hf_bssgp_trg_to_src_transp_cont = -1;
161 static int hf_bssgp_rnc_id = -1;
162 static int hf_bssgp_page_mode = -1;
163 static int hf_bssgp_container_id = -1;
164 static int hf_bssgp_global_tfi = -1;
165 static int hf_bssgp_ul_tfi = -1;
166 static int hf_bssgp_dl_tfi = -1;
167 static int hf_bssgp_time_to_MBMS_data_tran = -1;
168 static int hf_bssgp_mbms_session_rep_no = -1;
169 static int hf_bssgp_ps_ho_cmd = -1;
170 static int hf_bssgp_sipsi = -1;
171 static int hf_bssgp_type = -1;
172 static int hf_bssgp_cs_indication = -1;
173 static int hf_bssgp_flow_control_gran = -1;
174 static int hf_bssgp_serv_eutran_cco = -1;
175 static int hf_bssgp_sub_prof_id_f_rat_freq_prio = -1;
176 static int hf_bssgp_eutran_irat_ho_inf_req = -1;
177 static int hf_bssgp_irat_ho_inf_req = -1;
178
179 static int hf_bssgp_rel_int_rat_ho_inf_ind = -1;
180 static int hf_bssgp_csg_id = -1;
181 static int hf_bssgp_cell_acc_mode = -1;
182 static int hf_bssgp_Global_ENB_ID_PDU = -1;
183 static int hf_bssgp_SONtransferRequestContainer_PDU = -1;
184
185 /* Initialize the subtree pointers */
186 static gint ett_bssgp = -1;
187 static gint ett_bssgp_new = -1;
188 static gint ett_bssgp_pfcs_to_be_set_up_list = -1;
189 static gint ett_bssgp_pfcs_to_be_set_up_list_pft = -1;
190 static gint ett_bssgp_pfcs_to_be_set_up_list_abqp = -1;
191 static gint ett_bssgp_pfcs_to_be_set_up_list_arp = -1;
192 static gint ett_bssgp_pfcs_to_be_set_up_list_t10 = -1;
193 static gint ett_bssgp_list_of_setup_pfcs = -1;
194 static gint ett_bssgp_pfc_flow_control_parameters_pfc = -1;
195 static gint ett_bssgp_ra_id = -1;
196
197 /* PDU type coding, v6.5.0, table 11.3.26, p 80 */
198 #define BSSGP_PDU_DL_UNITDATA                  0x00
199 #define BSSGP_PDU_UL_UNITDATA                  0x01
200 #define BSSGP_PDU_RA_CAPABILITY                0x02
201 #define BSSGP_PDU_PTM_UNITDATA                 0x03
202 #define BSSGP_PDU_DL_MBMS_UNITDATA             0x04
203 #define BSSGP_PDU_UL_MBMS_UNITDATA             0x05
204 #define BSSGP_PDU_PAGING_PS                    0x06
205 #define BSSGP_PDU_PAGING_CS                    0x07
206 #define BSSGP_PDU_RA_CAPABILITY_UPDATE         0x08
207 #define BSSGP_PDU_RA_CAPABILITY_UPDATE_ACK     0x09
208 #define BSSGP_PDU_RADIO_STATUS                 0x0a
209 #define BSSGP_PDU_SUSPEND                      0x0b
210 #define BSSGP_PDU_SUSPEND_ACK                  0x0c
211 #define BSSGP_PDU_SUSPEND_NACK                 0x0d
212 #define BSSGP_PDU_RESUME                       0x0e
213 #define BSSGP_PDU_RESUME_ACK                   0x0f
214 #define BSSGP_PDU_RESUME_NACK                  0x10
215
216 #define BSSGP_PDU_RESERVED_0X11                0x11
217 #define BSSGP_PDU_RESERVED_0X12                0x12
218 #define BSSGP_PDU_RESERVED_0X13                0x13
219 #define BSSGP_PDU_RESERVED_0X14                0x14
220 #define BSSGP_PDU_RESERVED_0X15                0x15
221 #define BSSGP_PDU_RESERVED_0X16                0x16
222 #define BSSGP_PDU_RESERVED_0X17                0x17
223 #define BSSGP_PDU_RESERVED_0X18                0x18
224 #define BSSGP_PDU_RESERVED_0X19                0x19
225 #define BSSGP_PDU_RESERVED_0X1A                0x1a
226 #define BSSGP_PDU_RESERVED_0X1B                0x1b
227 #define BSSGP_PDU_RESERVED_0X1C                0x1c
228 #define BSSGP_PDU_RESERVED_0X1D                0x1d
229 #define BSSGP_PDU_RESERVED_0X1E                0x1e
230 #define BSSGP_PDU_RESERVED_0X1F                0x1f
231
232 #define BSSGP_PDU_BVC_BLOCK                    0x20
233 #define BSSGP_PDU_BVC_BLOCK_ACK                0x21
234 #define BSSGP_PDU_BVC_RESET                    0x22
235 #define BSSGP_PDU_BVC_RESET_ACK                0x23
236 #define BSSGP_PDU_BVC_UNBLOCK                  0x24
237 #define BSSGP_PDU_BVC_UNBLOCK_ACK              0x25
238 #define BSSGP_PDU_FLOW_CONTROL_BVC             0x26
239 #define BSSGP_PDU_FLOW_CONTROL_BVC_ACK         0x27
240 #define BSSGP_PDU_FLOW_CONTROL_MS              0x28
241 #define BSSGP_PDU_FLOW_CONTROL_MS_ACK          0x29
242 #define BSSGP_PDU_FLUSH_LL                     0x2a
243 #define BSSGP_PDU_FLUSH_LL_ACK                 0x2b
244 #define BSSGP_PDU_LLC_DISCARDED                0x2c
245 #define BSSGP_PDU_FLOW_CONTROL_PFC             0x2d
246 #define BSSGP_PDU_FLOW_CONTROL_PFC_ACK         0x2e
247
248 #define BSSGP_PDU_RESERVED_0X2F                0x2f
249 #define BSSGP_PDU_RESERVED_0X30                0x30
250 #define BSSGP_PDU_RESERVED_0X31                0x31
251 #define BSSGP_PDU_RESERVED_0X32                0x32
252 #define BSSGP_PDU_RESERVED_0X33                0x33
253 #define BSSGP_PDU_RESERVED_0X34                0x34
254 #define BSSGP_PDU_RESERVED_0X35                0x35
255 #define BSSGP_PDU_RESERVED_0X36                0x36
256 #define BSSGP_PDU_RESERVED_0X37                0x37
257 #define BSSGP_PDU_RESERVED_0X38                0x38
258 #define BSSGP_PDU_RESERVED_0X39                0x39
259 #define BSSGP_PDU_RESERVED_0X3A                0x3a
260 #define BSSGP_PDU_RESERVED_0X3B                0x3b
261 #define BSSGP_PDU_RESERVED_0X3C                0x3c
262 #define BSSGP_PDU_RESERVED_0X3D                0x3d
263 #define BSSGP_PDU_RESERVED_0X3E                0x3e
264 #define BSSGP_PDU_RESERVED_0X3F                0x3f
265
266 #define BSSGP_PDU_SGSN_INVOKE_TRACE            0x40
267 #define BSSGP_PDU_STATUS                       0x41
268
269 #define BSSGP_PDU_RESERVED_0X42                0x42
270 #define BSSGP_PDU_RESERVED_0X43                0x43
271 #define BSSGP_PDU_RESERVED_0X44                0x44
272 #define BSSGP_PDU_RESERVED_0X45                0x45
273 #define BSSGP_PDU_RESERVED_0X46                0x46
274 #define BSSGP_PDU_RESERVED_0X47                0x47
275 #define BSSGP_PDU_RESERVED_0X48                0x48
276 #define BSSGP_PDU_RESERVED_0X49                0x49
277 #define BSSGP_PDU_RESERVED_0X4A                0x4a
278 #define BSSGP_PDU_RESERVED_0X4B                0x4b
279 #define BSSGP_PDU_RESERVED_0X4C                0x4c
280 #define BSSGP_PDU_RESERVED_0X4D                0x4d
281 #define BSSGP_PDU_RESERVED_0X4E                0x4e
282 #define BSSGP_PDU_RESERVED_0X4F                0x4f
283
284 #define BSSGP_PDU_DOWNLOAD_BSS_PFC             0x50
285 #define BSSGP_PDU_CREATE_BSS_PFC               0x51
286 #define BSSGP_PDU_CREATE_BSS_PFC_ACK           0x52
287 #define BSSGP_PDU_CREATE_BSS_PFC_NACK          0x53
288 #define BSSGP_PDU_MODIFY_BSS_PFC               0x54
289 #define BSSGP_PDU_MODIFY_BSS_PFC_ACK           0x55
290 #define BSSGP_PDU_DELETE_BSS_PFC               0x56
291 #define BSSGP_PDU_DELETE_BSS_PFC_ACK           0x57
292 #define BSSGP_PDU_DELETE_BSS_PFC_REQ           0x58
293 #define BSSGP_PDU_PS_HANDOVER_REQUIRED         0x59
294 #define BSSGP_PDU_PS_HANDOVER_REQUIRED_ACK     0x5a
295 #define BSSGP_PDU_PS_HANDOVER_REQUIRED_NACK    0x5b
296 #define BSSGP_PDU_PS_HANDOVER_REQUEST          0x5c
297 #define BSSGP_PDU_PS_HANDOVER_REQUEST_ACK      0x5d
298 #define BSSGP_PDU_PS_HANDOVER_REQUEST_NACK     0x5e
299
300 #define BSSGP_PDU_RESERVED_0X5F                0x5f
301
302 #define BSSGP_PDU_PERFORM_LOCATION_REQUEST     0x60
303 #define BSSGP_PDU_PERFORM_LOCATION_RESPONSE    0x61
304 #define BSSGP_PDU_PERFORM_LOCATION_ABORT       0x62
305 #define BSSGP_PDU_POSITION_COMMAND             0x63
306 #define BSSGP_PDU_POSITION_RESPONSE            0x64
307
308 #define BSSGP_PDU_RESERVED_0X65                0x65
309 #define BSSGP_PDU_RESERVED_0X66                0x66
310 #define BSSGP_PDU_RESERVED_0X67                0x67
311 #define BSSGP_PDU_RESERVED_0X68                0x68
312 #define BSSGP_PDU_RESERVED_0X69                0x69
313 #define BSSGP_PDU_RESERVED_0X6A                0x6a
314 #define BSSGP_PDU_RESERVED_0X6B                0x6b
315 #define BSSGP_PDU_RESERVED_0X6C                0x6c
316 #define BSSGP_PDU_RESERVED_0X6D                0x6d
317 #define BSSGP_PDU_RESERVED_0X6E                0x6e
318 #define BSSGP_PDU_RESERVED_0X6F                0x6f
319
320 #define BSSGP_PDU_RAN_INFORMATION              0x70
321 #define BSSGP_PDU_RAN_INFORMATION_REQUEST      0x71
322 #define BSSGP_PDU_RAN_INFORMATION_ACK          0x72
323 #define BSSGP_PDU_RAN_INFORMATION_ERROR        0x73
324 #define BSSGP_PDU_RAN_INFORMATION_APP_ERROR    0x74
325
326 #define BSSGP_PDU_RESERVED_0X75                0x75
327 #define BSSGP_PDU_RESERVED_0X76                0x76
328 #define BSSGP_PDU_RESERVED_0X77                0x77
329 #define BSSGP_PDU_RESERVED_0X78                0x78
330 #define BSSGP_PDU_RESERVED_0X79                0x79
331 #define BSSGP_PDU_RESERVED_0X7A                0x7a
332 #define BSSGP_PDU_RESERVED_0X7B                0x7b
333 #define BSSGP_PDU_RESERVED_0X7C                0x7c
334 #define BSSGP_PDU_RESERVED_0X7D                0x7d
335 #define BSSGP_PDU_RESERVED_0X7E                0x7e
336 #define BSSGP_PDU_RESERVED_0X7F                0x7f
337
338 #define BSSGP_PDU_MBMS_SESSION_START_REQ       0x80
339 #define BSSGP_PDU_MBMS_SESSION_START_RESP      0x81
340 #define BSSGP_PDU_MBMS_SESSION_STOP_REQ        0x82
341 #define BSSGP_PDU_MBMS_SESSION_STOP_RESP       0x83
342 #define BSSGP_PDU_MBMS_SESSION_UPDATE_REQ      0x84
343 #define BSSGP_PDU_MBMS_SESSION_UPDATE_RESP     0x85
344
345 #define BSSGP_PDU_RESERVED_0X86                0x86
346 #define BSSGP_PDU_RESERVED_0X87                0x87
347 #define BSSGP_PDU_RESERVED_0X88                0x88
348 #define BSSGP_PDU_RESERVED_0X89                0x89
349 #define BSSGP_PDU_RESERVED_0X8A                0x8a
350 #define BSSGP_PDU_RESERVED_0X8B                0x8b
351 #define BSSGP_PDU_RESERVED_0X8C                0x8c
352 #define BSSGP_PDU_RESERVED_0X8D                0x8d
353 #define BSSGP_PDU_RESERVED_0X8E                0x8e
354 #define BSSGP_PDU_RESERVED_0X8F                0x8f
355
356 #define BSSGP_PDU_RESERVED_0X90                0x90
357 #define BSSGP_PDU_PS_HANDOVER_COMPLETE         0x91
358 #define BSSGP_PDU_PS_HANDOVER_CANCEL           0x92
359 #define BSSGP_PDU_PS_HANDOVER_COMPLETE_ACK     0x93
360
361 /*
362 0x91 PS-HANDOVER-COMPLETE
363 0x92 PS-HANDOVER-CANCEL
364 0x93 PS-HANDOVER-COMPLETE-ACK
365 */
366
367 /* Information element coding, v 6.5.0, table 11.3, p 72 */
368 #define BSSGP_IEI_ALIGNMENT_OCTETS                         0x00
369 #define BSSGP_IEI_BMAX_DEFAULT_MS                          0x01
370 #define BSSGP_IEI_BSS_AREA_INDICATION                      0x02
371 #define BSSGP_IEI_BUCKET_LEAK_RATE                         0x03
372 #define BSSGP_IEI_BVCI                                     0x04
373 #define BSSGP_IEI_BVC_BUCKET_SIZE                          0x05
374 #define BSSGP_IEI_BVC_MEASUREMENT                          0x06
375 #define BSSGP_IEI_CAUSE                                    0x07
376 #define BSSGP_IEI_CELL_IDENTIFIER                          0x08
377 #define BSSGP_IEI_CHANNEL_NEEDED                           0x09
378 #define BSSGP_IEI_DRX_PARAMETERS                           0x0a
379 #define BSSGP_IEI_EMLPP_PRIORITY                           0x0b
380 #define BSSGP_IEI_FLUSH_ACTION                             0x0c
381 #define BSSGP_IEI_IMSI                                     0x0d
382 #define BSSGP_IEI_LLC_PDU                                  0x0e
383 #define BSSGP_IEI_LLC_FRAMES_DISCARDED                     0x0f
384 #define BSSGP_IEI_LOCATION_AREA                            0x10
385 #define BSSGP_IEI_MOBILE_ID                                0x11
386 #define BSSGP_IEI_MS_BUCKET_SIZE                           0x12
387 #define BSSGP_IEI_MS_RADIO_ACCESS_CAPABILITY               0x13
388 #define BSSGP_IEI_OMC_ID                                   0x14
389 #define BSSGP_IEI_PDU_IN_ERROR                             0x15
390 #define BSSGP_IEI_PDU_LIFETIME                             0x16
391 #define BSSGP_IEI_PRIORITY                                 0x17
392 #define BSSGP_IEI_QOS_PROFILE                              0x18
393 #define BSSGP_IEI_RADIO_CAUSE                              0x19
394 #define BSSGP_IEI_RA_CAP_UPD_CAUSE                         0x1a
395 #define BSSGP_IEI_ROUTING_AREA                             0x1b
396 #define BSSGP_IEI_R_DEFAULT_MS                             0x1c
397 #define BSSGP_IEI_SUSPEND_REFERENCE_NUMBER                 0x1d
398 #define BSSGP_IEI_TAG                                      0x1e
399 #define BSSGP_IEI_TLLI                                     0x1f
400 #define BSSGP_IEI_TMSI                                     0x20
401 #define BSSGP_IEI_TRACE_REFERENCE                          0x21
402 #define BSSGP_IEI_TRACE_TYPE                               0x22
403 #define BSSGP_IEI_TRANSACTION_ID                           0x23
404 #define BSSGP_IEI_TRIGGER_ID                               0x24
405 #define BSSGP_IEI_NUMBER_OF_OCTETS_AFFECTED                0x25
406 #define BSSGP_IEI_LSA_IDENTIFIER_LIST                      0x26
407 #define BSSGP_IEI_LSA_INFORMATION                          0x27
408 #define BSSGP_IEI_PFI                                      0x28
409 #define BSSGP_IEI_GPRS_TIMER                               0x29
410 #define BSSGP_IEI_ABQP                                     0x3a
411 #define BSSGP_IEI_FEATURE_BITMAP                           0x3b
412 #define BSSGP_IEI_BUCKET_FULL_RATIO                        0x3c
413 #define BSSGP_IEI_SERVICE_UTRAN_CCO                        0x3d
414 #define BSSGP_IEI_NSEI                                     0x3e
415 #define BSSGP_IEI_RRLP_APDU                                0x3f
416 #define BSSGP_IEI_LCS_QOS                                  0x40
417 #define BSSGP_IEI_LCS_CLIENT_TYPE                          0x41
418 #define BSSGP_IEI_REQUESTED_GPS_ASSISTANCE_DATA            0x42
419 #define BSSGP_IEI_LOCATION_TYPE                            0x43
420 #define BSSGP_IEI_LOCATION_ESTIMATE                        0x44
421 #define BSSGP_IEI_POSITIONING_DATA                         0x45
422 #define BSSGP_IEI_DECIPHERING_KEYS                         0x46
423 #define BSSGP_IEI_LCS_PRIORITY                             0x47
424 #define BSSGP_IEI_LCS_CAUSE                                0x48
425 #define BSSGP_IEI_LCS_CAPABILITY                           0x49
426 #define BSSGP_IEI_RRLP_FLAGS                               0x4a
427 #define BSSGP_IEI_RIM_APP_ID                               0x4b
428 #define BSSGP_IEI_RIM_SEQUENCE_NUMBER                      0x4c
429 #define BSSGP_IEI_RAN_INF_REQUEST_APP_CONTAINER            0x4d
430 #define BSSGP_IEI_RAN_INF_APP_CONTAINER                    0x4e
431 #define BSSGP_IEI_RIM_PDU_INDICATIONS                      0x4f
432 #define BSSGP_IEI_NUMBER_OF_CONTAINER_UNITS                0x50
433 #define BSSGP_IEI_PFC_FLOW_CONTROL_PARAMETERS              0x52
434 #define BSSGP_IEI_GLOBAL_CN_ID                             0x53
435 #define BSSGP_IEI_RIM_ROUTING_INFORMATION                  0x54
436 #define BSSGP_IEI_RIM_PROTOCOL_VERSION                     0x55
437 #define BSSGP_IEI_APPLICATION_ERROR_CONTAINER              0x56
438
439 #define BSSGP_IEI_RAN_INF_REQUEST_RIM_CONTAINER            0x57
440 #define BSSGP_IEI_RAN_INF_RIM_CONTAINER                    0x58
441
442 #define BSSGP_IEI_RAN_INF_APP_ERROR_RIM_CONTAINER          0x59
443 #define BSSGP_IEI_RAN_INF_ACK_RIM_CONTAINER                0x5a
444 #define BSSGP_IEI_RAN_INF_ERROR_RIM_CONTAINER              0x5b
445 /*
446 ETSI
447 3GPP TS 48.018 version 6.16.0 Release 6 108 ETSI TS 148 018 V6.16.0 (2006-12)
448 IEI coding
449 (hexadecimal)
450 IEI Types
451
452 x5c TMGI
453 x5d MBMS Session Identity
454 x5e MBMS Session Duration
455 x5f MBMS Service Area Identity List
456 x60 MBMS Response
457 x61 MBMS Routing Area List
458 x62 MBMS Session Information
459 x63 MBMS Stop Cause
460 x64 Source BSS to Target BSS Transparent Container
461 x65 Target BSS to Source BSS Transparent Container
462 x66 NAS container for PS Handover
463 x67 PFCs to be set-up list
464 x68 List of set-up PFCs
465 x69 Extended Feature Bitmap
466 x6a Source RNC to Target RNC Transparent Container
467 x6b Target RNC to Source RNC Transparent Container
468 x6c RNC Identifier
469 x6d Page Mode
470 x6e Container ID
471 x6f Global TFI
472 x70 IMEI
473 x71 Time to MBMS Data Transfer
474 x72 MBMS Session Repetition Number
475 x73 Inter RAT Handover Info
476 x74 PS Handover Command
477 x75 PS Handover Indications
478 x76 SI/PSI Container
479 x77 Active PFCs List
480 x78 Velocity Data
481 x79 DTM Handover Command
482 x7a CS Indication
483 x7b Requested GANSS Assistance Data
484 x7c GANSS Location Type
485 x7d GANSS Positioning Data
486 x7e Flow Control Granularity
487 x7f eNB Identifier
488 x80 E-UTRAN Inter RAT Handover Info
489 x81 Subscriber Profile ID for RAT/Frequency priority
490 x82 Request for Inter RAT Handover Info
491 x83 Reliable Inter RAT Handover Info
492 x84 SON Transfer Application Identity
493 x85 CSG Identifier
494 x86 TAC
495 x87 Redirect Attempt Flag
496 x88 Redirection Indication
497 x89 Redirection Completed
498 x8a Unconfirmed send state variable
499 x8b IRAT Measurement Configuration
500 */
501
502 /* Macros */
503 /* Defined localy here without the check of curr_len wrapping, that will be taken care of when this IEI dissecton finishes */
504 #define ELEM_IN_ELEM_MAND_TELV(EMT_iei, EMT_pdu_type, EMT_elem_idx, EMT_elem_name_addition) \
505 {\
506     if ((consumed = elem_telv(tvb, tree, pinfo, (guint8) EMT_iei, EMT_pdu_type, EMT_elem_idx, curr_offset, curr_len, EMT_elem_name_addition)) > 0) \
507     { \
508         curr_offset += consumed; \
509         curr_len -= consumed; \
510     } \
511     else \
512     { \
513         proto_tree_add_text(tree, \
514             tvb, curr_offset, 0, \
515             "Missing Mandatory element (0x%02x) %s%s, rest of dissection is suspect", \
516             EMT_iei, \
517             get_gsm_a_msg_string(EMT_pdu_type, EMT_elem_idx), \
518             (EMT_elem_name_addition == NULL) ? "" : EMT_elem_name_addition \
519             ); \
520     } \
521 }
522
523 #define ELEM_IN_ELEM_OPT_TELV(EOT_iei, EOT_pdu_type, EOT_elem_idx, EOT_elem_name_addition) \
524 {\
525     if (curr_len != 0){\
526         if ((consumed = elem_telv(tvb, tree, pinfo, (guint8) EOT_iei, EOT_pdu_type, EOT_elem_idx, curr_offset, curr_len, EOT_elem_name_addition)) > 0) \
527         { \
528             curr_offset += consumed; \
529             curr_len -= consumed; \
530         } \
531     } \
532 }
533
534 /* Forward declarations */
535 static guint16 de_bssgp_ran_inf_request_rim_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_);
536 static guint16 de_bssgp_ran_inf_rim_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_);
537 static guint16 de_bssgp_ran_inf_ack_rim_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_);
538 static guint16 de_bssgp_ran_inf_error_rim_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_);
539 static guint16 de_bssgp_ran_inf_app_error_rim_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_);
540
541
542 static const value_string tab_nacc_cause[]={
543     { 0x00,           "Other unspecified error" },
544     { 0x01,           "Syntax error in the Application Container" },
545     { 0x02,           "Reporting Cell Identifier does not match with the Destination Cell Identifier or with the Source Cell Identifier" },
546     { 0x03,           "SI/PSI type error" },
547     { 0x04,           "Inconsistent length of a SI/PSI message" },
548     { 0x05,           "Inconsistent set of messages" },
549     { 0,              NULL },
550
551 };
552
553
554 /*
555  * 11.3 Information Element Identifier (IEI)
556  */
557
558 /*
559  * 11.3.1   Alignment octets
560  */
561 static guint16
562 de_bssgp_aligment_octets(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
563 {
564     guint32 curr_offset;
565
566     curr_offset = offset;
567
568     proto_tree_add_text(tree, tvb, curr_offset, len, "%u Spare octet(s)",len);
569
570     return(len);
571 }
572
573 /*
574  * 11.3.2   Bmax default MS
575  */
576 static guint16
577 de_bssgp_bmax_default_ms(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
578 {
579     guint32 curr_offset;
580
581     curr_offset = offset;
582
583     proto_tree_add_item(tree, hf_bssgp_bmax, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
584     curr_offset+=2;
585
586     return(curr_offset-offset);
587 }
588 /*
589  * 11.3.3   BSS Area Indication
590  */
591 static guint16
592 de_bssgp_bss_area_ind(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
593 {
594     guint32 curr_offset;
595
596     curr_offset = offset;
597
598     proto_tree_add_item(tree, hf_bssgp_bss_area_ind, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
599     curr_offset++;
600
601     return(curr_offset-offset);
602 }
603 /*
604  * 11.3.4   Bucket Leak Rate (R)
605  */
606 static guint16
607 de_bssgp_bucket_leak_rate(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
608 {
609     guint32 curr_offset;
610
611     curr_offset = offset;
612
613     proto_tree_add_item(tree, hf_bssgp_r, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
614     curr_offset+=2;
615
616     return(curr_offset-offset);
617 }
618 /*
619  * 11.3.5   BVC Bucket Size
620  */
621 static guint16
622 de_bssgp_bvc_bucket_size(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
623 {
624     guint32 curr_offset;
625
626     curr_offset = offset;
627
628     proto_tree_add_item(tree, hf_bssgp_bucket_size, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
629     curr_offset+=2;
630
631     return(curr_offset-offset);
632 }
633 /*
634  * 11.3.6   BVCI (BSSGP Virtual Connection Identifier)
635  */
636 static guint16
637 de_bssgp_bvci(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
638 {
639     guint32 curr_offset;
640     guint16 bvci;
641
642     curr_offset = offset;
643
644     /* octet 3-4 Unstructured value */
645     bvci = tvb_get_ntohs(tvb,curr_offset);
646     proto_tree_add_item(tree, hf_bssgp_bvci, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
647     curr_offset+=2;
648
649     if (add_string)
650         g_snprintf(add_string, string_len, " - 0x%x", bvci);
651
652
653     return(curr_offset-offset);
654 }
655 /*
656  * 11.3.7   BVC Measurement
657  */
658 static guint16
659 de_bssgp_bvc_meas(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
660 {
661     guint32 curr_offset;
662
663     curr_offset = offset;
664
665     /*  The Delay Value field is coded as a 16-bit integer value in units of centi-seconds (one hundredth of a second). This
666      * coding provides a range of over 10 minutes in increments of 10 ms. As a special case, the hexadecimal value 0xFFFF
667      *(decimal 65 535) shall be interpreted as "infinite delay".
668      */
669     proto_tree_add_item(tree, hf_bssgp_delay_val, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
670     curr_offset+=2;
671
672     return(curr_offset-offset);
673 }
674 /*
675  * 11.3.8   Cause
676  */
677 static const value_string bssgp_cause_vals[] = {
678     { 0x00, "Processor overload" },
679     { 0x01, "Equipment failure" },
680     { 0x02, "Transit network service failure" },
681     { 0x03, "Network service transmission capacity modified from zero kbps to greater than zero kbps" },
682     { 0x04, "Unknown MS" },
683     { 0x05, "BVCI unknown" },
684     { 0x06, "Cell traffic congestion" },
685     { 0x07, "SGSN congestion" },
686     { 0x08, "O&M intervention" },
687     { 0x09, "BVCI blocked" },
688     { 0x0a, "PFC create failure" },
689     { 0x0b, "PFC preempted" },
690     { 0x0c, "ABQP no more supported" },
691
692     { 0x0d, "Undefined - protocol error - unspecified" },
693     { 0x0e, "Undefined - protocol error - unspecified" },
694     { 0x0f, "Undefined - protocol error - unspecified" },
695     { 0x10, "Undefined - protocol error - unspecified" },
696     { 0x11, "Undefined - protocol error - unspecified" },
697     { 0x12, "Undefined - protocol error - unspecified" },
698     { 0x13, "Undefined - protocol error - unspecified" },
699     { 0x14, "Undefined - protocol error - unspecified" },
700     { 0x15, "Undefined - protocol error - unspecified" },
701     { 0x16, "Undefined - protocol error - unspecified" },
702     { 0x17, "Undefined - protocol error - unspecified" },
703     { 0x18, "Undefined - protocol error - unspecified" },
704     { 0x19, "Undefined - protocol error - unspecified" },
705     { 0x1a, "Undefined - protocol error - unspecified" },
706     { 0x1b, "Undefined - protocol error - unspecified" },
707     { 0x1c, "Undefined - protocol error - unspecified" },
708     { 0x1d, "Undefined - protocol error - unspecified" },
709     { 0x1e, "Undefined - protocol error - unspecified" },
710     { 0x1f, "Undefined - protocol error - unspecified" },
711
712     { 0x20, "Semantically incorrect PDU" },
713     { 0x21, "Invalid mandatory information" },
714     { 0x22, "Missing mandatory IE" },
715     { 0x23, "Missing conditional IE" },
716     { 0x24, "Unexpected conditional IE" },
717     { 0x25, "Conditional IE error" },
718     { 0x26, "PDU not compatible with the protocol state" },
719     { 0x27, "Protocol error - unspecified" },
720     { 0x28, "PDU not compatible with the feature set" },
721     { 0x29, "Requested information not available" },
722     { 0x2a, "Unknown destination address" },
723     { 0x2b, "Unknown RIM application identity" },
724     { 0x2c, "Invalid container unit information" },
725     { 0x2d, "PFC queuing" },
726     { 0x2e, "PFC created successfully" },
727     { 0x2f, "T12 expiry" },
728     { 0x30, "MS under PS Handover treatment" },
729     { 0x31, "Uplink quality" },
730     { 0x32, "Uplink strength" },
731     { 0x33, "Downlink quality" },
732     { 0x34, "Downlink strength" },
733     { 0x35, "Distance" },
734     { 0x36, "Better cell" },
735     { 0x37, "Traffic" },
736     { 0x38, "Radio contact lost with MS" },
737     { 0x39, "MS back on old channel" },
738     { 0x3a, "T13 expiry" },
739     { 0x3b, "T14 expiry" },
740     { 0x3c, "Not all requested PFCs created" },
741     { 0x3d, "CS cause" },
742     { 0x3e, "Requested ciphering and/or integrity protection algorithms not supported" },
743     { 0x3f, "Relocation failure in target system" },
744     { 0x40, "Directed Retry" },
745     { 0x41, "Time critical relocation" },
746     { 0x42, "PS Handover Target not allowed" },
747     { 0x43, "PS Handover not Supported in Target BSS or Target System" },
748     { 0x44, "Incoming relocation not supported due to PUESBINE feature" },
749     { 0x45, "DTM Handover - No CS resource" },
750     { 0x46, "DTM Handover - PS Allocation failure" },
751     { 0x47, "DTM Handover - T24 expiry" },
752     { 0x48, "DTM Handover - Invalid CS Indication IE" },
753     { 0x49, "DTM Handover - T23 expiry" },
754     { 0x4a, "DTM Handover - MSC Error" },
755     { 0x4b, "Invalid CSG cell" },
756     { 0,    NULL },
757 };
758
759 value_string_ext bssgp_cause_vals_ext = VALUE_STRING_EXT_INIT(bssgp_cause_vals);
760
761 static guint16
762 de_bssgp_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
763 {
764     guint32 curr_offset;
765
766     curr_offset = offset;
767
768     /*  The Delay Value field is coded as a 16-bit integer value in units of centi-seconds (one hundredth of a second). This
769      * coding provides a range of over 10 minutes in increments of 10 ms. As a special case, the hexadecimal value 0xFFFF
770      *(decimal 65 535) shall be interpreted as "infinite delay".
771      */
772     proto_tree_add_item(tree, hf_bssgp_cause, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
773     curr_offset+=1;
774
775     return(curr_offset-offset);
776 }
777 /*
778  * 11.3.9   Cell Identifier
779  */
780 /*
781  * octets 3-8 Octets 3 to 8 contain the value part (starting with octet 2) of the
782  * Routing Area Identification IE defined in 3GPP TS 24.008, not
783  * including 3GPP TS 24.008 IEI
784  * Octets 9 and 10 contain the value part (starting with octet 2) of the
785  * Cell Identity IE defined in 3GPP TS 24.008, not including
786  * 3GPP TS 24.008 IEI (10.5.1.1)
787  */
788
789 guint16
790 de_bssgp_cell_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string, int string_len)
791 {
792     guint32 curr_offset;
793     guint16 ci;
794
795     curr_offset = offset;
796
797     curr_offset = curr_offset + de_gmm_rai(tvb, tree, pinfo, curr_offset, 6, add_string, string_len);
798     /*Why doesn't this work? ( add_string will not contain RAI + CI )
799      * curr_offset = curr_offset + de_cell_id(tvb, tree, curr_offset , 2, add_string, string_len);
800      */
801     ci = tvb_get_ntohs(tvb, curr_offset);
802     proto_tree_add_item(tree, hf_bssgp_ci, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
803     curr_offset+=2;
804     if (add_string)
805         g_snprintf(add_string, string_len, "%s, CI %u", add_string, ci);
806
807
808     return(curr_offset-offset);
809 }
810 /*
811  * 11.3.10  Channel needed
812  */
813 /* Rest of element coded as the value part of the Channel Needed
814  * PDU defined in 3GPP TS 29.018, not including 3GPP TS 29.018
815  * IEI and 3GPP TS 29.018 length indicator
816  * TS 29.018
817  * The rest of the information element is coded as the IEI part and the
818  * value part of the Channel Needed IE defined in 3GPP TS 44.018.
819  */
820 static guint16
821 de_bssgp_chnl_needed(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
822 {
823     guint32 curr_offset;
824
825     curr_offset = offset;
826
827     curr_offset = de_rr_chnl_needed(tvb, tree, pinfo, curr_offset, len , NULL, 0);
828
829     return(curr_offset-offset);
830 }
831
832 /*
833  * 11.3.11  DRX Parameters
834  */
835 /*
836  * Rest of element coded as the value part defined in
837  * 3GPP TS 24.008, not including 3GPP TS 24.008 IEI and
838  * 3GPP TS 24.008 octet length indicator
839  */
840 /*
841  * 11.3.12  eMLPP-Priority
842  */
843 /*
844  * Rest of element coded as the value part of the eMLPP-Priority IE
845  * defined in 3GPP TS 48.008, not including 3GPP TS 48.008 IEI and
846  * 3GPP TS 48.008 length indicator
847  */
848 /*
849  * 11.3.13  Flush Action
850  */
851 static const value_string bssgp_flush_action_vals[] = {
852     { 0x00, "LLC-PDU(s) deleted" },
853     { 0x01, "LLC-PDU(s) transferred" },
854     { 0,    NULL },
855     /* Otherwise "Reserved" */
856 };
857
858 static guint16
859 de_bssgp_flush_action(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
860 {
861     guint32 curr_offset;
862     guint8  oct;
863
864     curr_offset = offset;
865
866     /* Action value */
867     oct = tvb_get_guint8(tvb,curr_offset);
868     proto_tree_add_item(tree, hf_bssgp_flush_action, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
869     curr_offset+=1;
870     if (add_string)
871         g_snprintf(add_string, string_len, " - %s", val_to_str_const(oct, bssgp_flush_action_vals, "Reserved"));
872
873
874     return(curr_offset-offset);
875 }
876 /*
877  * 11.3.14  IMSI
878  */
879 /* Octets 3-n contain an IMSI coded as the value part of the Mobile
880  * Identity IE defined in 3GPP TS 24.008
881  * (NOTE 1)
882  * NOTE 1: The Type of identity field in the Mobile Identity IE shall be ignored by
883  * the receiver.
884  */
885 /*
886  * 11.3.15  LLC-PDU
887  */
888
889 static guint16
890 de_bssgp_llc_pdu(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
891 {
892     tvbuff_t *next_tvb=NULL;
893     guint32 curr_offset;
894
895     curr_offset = offset;
896
897
898
899     if(len > 0){
900         next_tvb = tvb_new_subset_remaining(tvb, curr_offset);
901         proto_tree_add_text(tree, tvb, curr_offset, len, "LLC Data");
902     }
903
904     if(next_tvb){
905         if (llc_handle) {
906             call_dissector(llc_handle, next_tvb, gpinfo, gparent_tree);
907         }
908         else if (data_handle) {
909             call_dissector(data_handle, next_tvb, gpinfo, gparent_tree);
910         }
911     }
912
913     return(len);
914 }
915 /*
916  * 11.3.16  LLC Frames Discarded
917  */
918 static guint16
919 de_bssgp_llc_frames_disc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
920 {
921     guint32 curr_offset;
922     guint8 oct;
923
924     curr_offset = offset;
925
926     /* Action value */
927     oct = tvb_get_guint8(tvb,curr_offset);
928     proto_tree_add_item(tree, hf_bssgp_llc_frames_disc, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
929     curr_offset+=1;
930
931     if (add_string)
932         g_snprintf(add_string, string_len, " - %u Frames", oct);
933
934     return(curr_offset-offset);
935 }
936 /*
937  * 11.3.17  Location Area
938  */
939 /* Octets 3 to 7 contain the value part (starting with octet 2) of the
940  * Location Area Identification IE defined in 3GPP TS 24.008, not
941  * including 3GPP TS 24.008 IEI
942  */
943
944 /*
945  * 11.3.18  LSA Identifier List
946  */
947 /* Rest of element coded as in 3GPP TS 48.008, not including
948  * 3GPP TS 48.008 IEI and 3GPP TS 48.008 length indicator
949  */
950 /*
951  * 11.3.19  LSA Information
952  */
953 /* Rest of element coded as in 3GPP TS 48.008, not including
954  * 3GPP TS 48.008 IEI and 3GPP TS 48.008 length indicator
955  */
956 /*
957  * 11.3.20  Mobile Id
958  */
959 /* Octets 3-n contain either the IMSI, IMEISV or IMEI coded as the
960  * value part (starting with octet 3) of the Mobile Identity IE defined in
961  * 3GPP TS 24.008, not including 3GPP TS 24.008 IEI and
962  * 3GPP TS 24.008 length indcator
963  */
964 /*
965  * 11.3.21  MS Bucket Size
966  */
967
968 static guint16
969 de_bssgp_ms_bucket_size(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
970 {
971     guint32 curr_offset;
972
973     curr_offset = offset;
974
975     /* The Bmax field is coded as Bmax of BVC Bucket Size, see sub-clause 11.3.5. */
976     proto_tree_add_item(tree, hf_bssgp_bucket_size, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
977     curr_offset+=2;
978
979     return(curr_offset-offset);
980 }
981 /*
982  * 11.3.22  MS Radio Access Capability
983  */
984 /* Rest of element coded as the value part defined in
985  * 3GPP TS 24.008, not including 3GPP TS 24.008 IEI and
986  * 3GPP TS 24.008 octet length indicator.
987  */
988 /*
989  * 11.3.23  OMC Id
990  */
991 static guint16
992 de_bssgp_omc_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
993 {
994     guint32 curr_offset;
995
996     curr_offset = offset;
997
998     /* octet 3-22 For the OMC identity, see 3GPP TS 12.20 */
999     proto_tree_add_item(tree, hf_bssgp_omc_id, tvb, curr_offset, len, ENC_NA);
1000
1001     return len;
1002 }
1003 /*
1004  * 11.3.24  PDU In Error
1005  */
1006 static guint16
1007 de_bssgp_pdu_in_error(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1008 {
1009     guint32 curr_offset;
1010
1011     curr_offset = offset;
1012
1013     /* octet 3-? Erroneous BSSGP PDU */
1014      proto_tree_add_item(tree, hf_bssgp_msg_type, tvb, 0, 1, ENC_BIG_ENDIAN);
1015      curr_offset++;
1016
1017      proto_tree_add_text(tree, tvb, curr_offset, len-1, "PDU Data");
1018
1019     return len;
1020 }
1021 /*
1022  * 11.3.25 PDU Lifetime
1023  */
1024 static guint16
1025 de_bssgp_pdu_lifetime(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1026 {
1027     guint32 curr_offset;
1028
1029     curr_offset = offset;
1030
1031     proto_tree_add_item(tree, hf_bssgp_delay_val, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
1032     curr_offset+=2;
1033
1034     return(curr_offset-offset);
1035 }
1036
1037 /*
1038 The Delay Value field is coded as a 16-bit integer value in units of centi-seconds (one hundredth of a second). This
1039 coding provides a range of over 10 minutes in increments of 10 ms. As a special case, the hexadecimal value 0xFFFF
1040 (decimal 65 535) shall be interpreted as "infinite delay".
1041 */
1042 /*
1043  * 11.3.26  PDU Type
1044  */
1045 /*
1046  * 11.3.27  Priority
1047  */
1048 /* Rest of element coded as the value part of the Priority IE defined in
1049  * 3GPP TS 48.008, not including 3GPP TS 48.008 IEI and
1050  * 3GPP TS 48.008 length indicator
1051  */
1052 /*
1053  * 11.3.28  QoS Profile
1054  */
1055 static const true_false_string  bssgp_a_bit_vals = {
1056     "Radio interface uses RLC/MAC-UNITDATA functionality",
1057     "Radio interface uses RLC/MAC ARQ functionality"
1058 };
1059
1060 static const true_false_string  bssgp_t_bit_vals = {
1061     "The SDU contains data",
1062     "The SDU contains signalling"
1063 };
1064
1065 static const true_false_string  bssgp_cr_bit_vals = {
1066     "The SDU does not contain a LLC ACK or SACK command/response frame type",
1067     "The SDU contains a LLC ACK or SACK command/response frame type"
1068 };
1069
1070 const value_string bssgp_peak_rate_gran_vals[] = {
1071     { 0x0, "100 bits/s increments" },
1072     { 0x1, "1000 bits/s increments" },
1073     { 0x2, "10000 bits/s increments" },
1074     { 0x3, "100000 bits/s increments" },
1075     { 0, NULL }
1076 };
1077 static const value_string bssgp_precedence_ul[] = {
1078     { 0,   "High priority" },
1079     { 1,   "Normal priority" },
1080     { 2,   "Low priority" },
1081     { 0,   NULL },
1082 };
1083
1084 static const value_string bssgp_precedence_dl[] = {
1085     { 0,   "Radio priority 1" },
1086     { 1,   "Radio priority 2" },
1087     { 2,   "Radio priority 3" },
1088     { 3,   "Radio priority 4" },
1089     { 4,   "Radio priority unknown" },
1090     { 0,   NULL },
1091 };
1092
1093 static guint16
1094 de_bssgp_qos_profile(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1095 {
1096     proto_item *pi, *pre_item;
1097     guint32 curr_offset;
1098     guint16 peak_bit_rate;
1099     guint8  rate_gran, precedence;
1100     int     link_dir;
1101
1102     curr_offset = offset;
1103
1104     /* octet 3-4 Peak bit rate provided by the network (note)
1105      * NOTE: The bit rate 0 (zero) shall mean "best effort" in this IE.
1106      */
1107     link_dir = gpinfo->link_dir;
1108
1109     peak_bit_rate = tvb_get_ntohs(tvb, curr_offset);
1110     pi = proto_tree_add_text(tree, tvb, curr_offset, 1, "Peak bit rate: ");
1111     if (peak_bit_rate == 0) {
1112         proto_item_append_text(pi, "Best effort");
1113     }else{
1114         rate_gran = tvb_get_guint8(tvb, curr_offset+2)&0xc0;
1115         switch(rate_gran){
1116             case 0:
1117                 /* 100 bits/s increments */
1118                 proto_item_append_text(pi, "%u bits/s", peak_bit_rate * 100);
1119                 break;
1120             case 1:
1121                 /* 1000 bits/s increments */
1122                 proto_item_append_text(pi, "%u kbits/s", peak_bit_rate);
1123                 break;
1124             case 2:
1125                 /* 10000 bits/s increments */
1126                 proto_item_append_text(pi, "%u kbits/s", peak_bit_rate * 10);
1127                 break;
1128             case 3:
1129                 /* 100000 bits/s increments */
1130                 proto_item_append_text(pi, "%u kbits/s", peak_bit_rate * 100);
1131                 break;
1132             default:
1133                 break;
1134         }
1135     }
1136     curr_offset+=2;
1137
1138     /* octet 5 Peak Bit Rate Granularity C/R T A Precedence */
1139     /* If the Gigabit Interface feature has not been negotiated, the "Peak bit rate"
1140      * field is the binary encoding of the peak bit rate information expressed in 100 bits/s
1141      * increments, starting from 0 x 100 bits/s until 65 535 x 100 bits/s (6 Mbps).
1142      *
1143      * If the Gigabit Interface feature has been negotiated, the "Peak bit rate" field is the
1144      * binary encoding of the peak bit rate information expressed in increments as defined by
1145      * the Peak Bit Rate Granularity field.
1146      */
1147     proto_tree_add_item(tree, hf_bssgp_peak_rate_gran, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1148     proto_tree_add_item(tree, hf_bssgp_cr_bit, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1149     proto_tree_add_item(tree, hf_bssgp_t_bit, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1150     proto_tree_add_item(tree, hf_bssgp_a_bit, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1151     precedence = tvb_get_guint8(tvb, curr_offset) & 0x7;
1152     pre_item = proto_tree_add_item(tree, hf_bssgp_precedence, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1153     if(link_dir == P2P_DIR_DL){
1154         proto_item_append_text(pre_item, " %s", val_to_str_const((guint32)precedence, bssgp_precedence_dl, "Radio Priority Unknown(Radio priority 3)"));
1155     }else{
1156         proto_item_append_text(pre_item, " %s", val_to_str_const((guint32)precedence, bssgp_precedence_ul, "Priority Unknown(Low priority)"));
1157     }
1158
1159     curr_offset++;
1160
1161     return(curr_offset-offset);
1162 }
1163 /*
1164  * 11.3.29  Radio Cause
1165  */
1166 static const value_string bssgp_radio_cause_vals[] = {
1167     { 0x00, "Radio contact lost with the MS" },
1168     { 0x01, "Radio link quality insufficient to continue communication" },
1169     { 0x02, "Cell reselection ordered" },
1170     { 0x03, "Cell reselection prepare" },
1171     { 0x04, "Cell reselection failure" },
1172     { 0,    NULL },
1173     /* Otherwise "Reserved (Radio contact lost with the MS)" */
1174 };
1175
1176 static guint16
1177 de_bssgp_ra_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1178 {
1179     guint32 curr_offset;
1180
1181     curr_offset = offset;
1182
1183     proto_tree_add_item(tree, hf_bssgp_ra_cause, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1184     curr_offset++;
1185
1186     return(curr_offset-offset);
1187 }
1188
1189 /*
1190  * 11.3.30  RA-Cap-UPD-Cause
1191  */
1192 static const value_string bssgp_ra_cap_upd_cause_vals[] = {
1193     { 0x00, "OK, RA capability IE present" },
1194     { 0x01, "TLLI unknown in SGSN" },
1195     { 0x02, "No RA capabilities or IMSI available for this MS" },
1196     { 0,    NULL },
1197     /* Otherwise "Reserved (TLLI unknown in SGSN)" */
1198 };
1199
1200 static guint16
1201 de_bssgp_ra_cap_upd_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1202 {
1203     guint32 curr_offset;
1204
1205     curr_offset = offset;
1206
1207     proto_tree_add_item(tree, hf_bssgp_ra_cap_upd_cause, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1208     curr_offset++;
1209
1210     return(curr_offset-offset);
1211 }
1212
1213 /*
1214  * 11.3.31  Routeing Area
1215  */
1216 /* Octets 3 to 8 contain the value part (starting with octet 2) of the
1217  * Routing Area Identification IE defined in 3GPP TS 24.008, not
1218  * including 3GPP TS 24.008 IEI
1219  */
1220 /*
1221  * 11.3.32  R_default_MS
1222  */
1223 static guint16
1224 de_bssgp_r_default_ms(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1225 {
1226     guint32 curr_offset;
1227
1228     curr_offset = offset;
1229
1230     proto_tree_add_item(tree, hf_bssgp_r_default_ms, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
1231     curr_offset+=2;
1232
1233     return(curr_offset-offset);
1234 }
1235
1236 /*
1237  * 11.3.33  Suspend Reference Number
1238  */
1239 static guint16
1240 de_bssgp_suspend_ref_no(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1241 {
1242     guint32 curr_offset;
1243
1244     curr_offset = offset;
1245
1246     /* Unstructured value */
1247     proto_tree_add_item(tree, hf_bssgp_suspend_ref_no, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1248
1249     curr_offset++;
1250
1251     return(curr_offset-offset);
1252 }
1253 /*
1254  * 11.3.34  Tag
1255  */
1256
1257 static guint16
1258 de_bssgp_tag(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1259 {
1260     guint32 curr_offset;
1261
1262     curr_offset = offset;
1263
1264     /* Unstructured value */
1265     proto_tree_add_item(tree, hf_bssgp_tag, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1266
1267     curr_offset++;
1268
1269     return(curr_offset-offset);
1270 }
1271
1272 /*
1273  * 11.3.35  Temporary logical link Identity (TLLI)
1274  * Rest of element coded as the value part of the TLLI information
1275  * element in 3GPP TS 44.018, not including 3GPP TS 44.018 IEI.
1276  */
1277 /*
1278  * 11.3.36  Temporary Mobile Subscriber Identity (TMSI)
1279  */
1280 /* Rest of element coded as the value part of the TMSI/P-TMSI
1281  * information element in 3GPP TS 24.008, not including
1282  * 3GPP TS 24.008 IEI.
1283  */
1284 /*
1285  * 11.3.37  Trace Reference
1286  */
1287 static guint16
1288 de_bssgp_trace_ref(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1289 {
1290     guint32 curr_offset;
1291
1292     curr_offset = offset;
1293
1294     /* octet 3-4 Trace Reference */
1295     proto_tree_add_item(tree, hf_bssgp_trace_ref, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
1296
1297     curr_offset+=2;
1298
1299     return(curr_offset-offset);
1300 }
1301
1302 /*
1303  * 11.3.38  Trace Type
1304  */
1305 /* This is coded as specified in Technical Specification
1306  * 3GPP TS 32.008
1307  * XXX: Coding unknown (Specification withdrawn) 3GPP TS 32.008
1308  */
1309 static guint16
1310 de_bssgp_trace_type(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1311 {
1312     guint32 curr_offset;
1313
1314     curr_offset = offset;
1315
1316
1317     proto_tree_add_text(tree, tvb, curr_offset, len, "Trace Type data ( Coding unknown (Specification withdrawn) 3GPP TS 32.008)");
1318
1319     return(len);
1320 }
1321 /*
1322  * 11.3.39  Transaction Id
1323  */
1324 static guint16
1325 de_bssgp_transaction_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1326 {
1327     guint32 curr_offset;
1328
1329     curr_offset = offset;
1330
1331     proto_tree_add_item(tree, hf_bssgp_transaction_id, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
1332
1333     return(curr_offset-offset);
1334 }
1335 /*
1336  * 11.3.40  Trigger Id
1337  */
1338 static guint16
1339 de_bssgp_trigger_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1340 {
1341     guint32 curr_offset;
1342
1343     curr_offset = offset;
1344
1345     proto_tree_add_item(tree, hf_bssgp_trigger_id, tvb, curr_offset, len, ENC_NA);
1346
1347     return(len);
1348 }
1349 /*
1350  * 11.3.41  Number of octets affected
1351  */
1352 static guint16
1353 de_bssgp_no_of_oct_affected(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1354 {
1355     guint32 curr_offset;
1356     guint32 no_of_oct;
1357
1358     curr_offset = offset;
1359
1360     /* octet 3-5 number of octets transferred or deleted */
1361     no_of_oct = tvb_get_ntoh24(tvb,curr_offset);
1362     proto_tree_add_item(tree, hf_bssgp_no_of_oct, tvb, curr_offset, 3, ENC_BIG_ENDIAN);
1363
1364     curr_offset+=3;
1365
1366     if (add_string)
1367         g_snprintf(add_string, string_len, " - %u", no_of_oct);
1368
1369     return(curr_offset-offset);
1370 }
1371 /*
1372  * 11.3.42  Packet Flow Identifier (PFI)
1373  */
1374 /* Rest of element coded as the value part of the Packet Flow
1375  * Identifier information element in 3GPP TS 24.008, not including
1376  * 3GPP TS 24.008 IEI
1377  */
1378 /*
1379  * 11.3.42a (void)
1380  */
1381 /*
1382  * 11.3.43  Aggregate BSS QoS Profile
1383  */
1384 /* Rest of element coded as the value part of the QoS information
1385  * element in 3GPP TS 24.008, not including 3GPP TS 24.008 IEI and
1386  * length indicator. The shorter 3-byte form of QoS information is not
1387  * allowed in BSSGP PDUs.
1388  * 10.5.6.5
1389  */
1390 /*
1391  * 11.3.44  GPRS Timer
1392  */
1393 static const value_string bssgp_unit_vals[] = {
1394     { 0, "incremented in multiples of 2 s" },
1395     { 1, "incremented in multiples of 1 minute" },
1396     { 2, "incremented in multiples of decihours" },
1397     { 3, "incremented in multiples of 500 msec" },
1398     { 4, "incremented in multiples of 1 minute(Undefined)" },
1399     { 5, "incremented in multiples of 1 minute(Undefined)" },
1400     { 6, "incremented in multiples of 1 minute(Undefined)" },
1401     { 7, "the timer does not expire" },
1402     { 0, NULL},
1403     /* Otherwise "incremented in multiples of 1 minute" */
1404 };
1405
1406 static guint16
1407 de_bssgp_gprs_timer(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1408 {
1409     guint32 curr_offset;
1410
1411     curr_offset = offset;
1412
1413     /*octet 3 Unit Value Timer value */
1414     proto_tree_add_item(tree, hf_bssgp_unit_val, tvb, curr_offset, 3, ENC_BIG_ENDIAN);
1415     proto_tree_add_item(tree, hf_bssgp_gprs_timer, tvb, curr_offset, 3, ENC_BIG_ENDIAN);
1416
1417     curr_offset++;
1418
1419     return(curr_offset-offset);
1420 }
1421 /*
1422  * 11.3.45  Feature Bitmap
1423  */
1424 static guint16
1425 de_bssgp_feature_bitmap(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1426 {
1427     guint32 curr_offset;
1428
1429     curr_offset = offset;
1430     /* MBMS */
1431     proto_tree_add_item(tree, hf_bssgp_mbms, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1432     /* EnhancedRadioStatus */
1433     proto_tree_add_item(tree, hf_bssgp_EnhancedRadioStatus, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1434     /* PFCFC */
1435     proto_tree_add_item(tree, hf_bssgp_pfcfc, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1436     /* RIM */
1437     proto_tree_add_item(tree, hf_bssgp_rim, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1438     /* LCS */
1439     proto_tree_add_item(tree, hf_bssgp_lcs, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1440     /* INR */
1441     proto_tree_add_item(tree, hf_bssgp_inr, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1442     /* CBL */
1443     proto_tree_add_item(tree, hf_bssgp_cbl, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1444     /* PFC */
1445     proto_tree_add_item(tree, hf_bssgp_pfc, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1446
1447     curr_offset++;
1448
1449     return(curr_offset-offset);
1450 }
1451 /*
1452  * 11.3.46  Bucket Full Ratio
1453  */
1454 static guint16
1455 de_bssgp_bucket_full_ratio(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1456 {
1457     guint32 curr_offset;
1458
1459     curr_offset = offset;
1460
1461     /* Ratio of the bucket that is filled up with data */
1462     proto_tree_add_item(tree, hf_bssgp_bucket_full_ratio, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1463
1464     curr_offset++;
1465
1466     return(curr_offset-offset);
1467 }
1468 /*
1469  * 11.3.47  Service UTRAN CCO
1470  */
1471 static const value_string bssgp_service_utran_cco_vals[] = {
1472     { 0, "Network initiated cell change order procedure to UTRAN should be performed" },
1473     { 1, "Network initiated cell change order procedure to UTRAN should not be performed" },
1474     { 2, "Network initiated cell change order procedure to UTRAN shall not be performed" },
1475     { 3, "If received, shall be interpreted as no information available (bits 4-5 valid)" },
1476     { 0,    NULL },
1477     /* Otherwise "No information available" */
1478 };
1479
1480 static const value_string bssgp_service_eutran_cco_vals[] = {
1481     { 0, "If received, shall be interpreted as no information available" },
1482     { 1, "Network initiated cell change order to E-UTRAN or PS handover to E-UTRAN procedure should be performed" },
1483     { 2, "Network initiated cell change order to E-UTRAN or PS handover to E-UTRAN procedure should not be performed" },
1484     { 3, "Network initiated cell change order to E-UTRAN or PS handover to E-UTRAN procedure shall not be performed" },
1485     { 0,    NULL },
1486     /* Otherwise "No information available" */
1487 };
1488
1489 static guint16
1490 de_bssgp_serv_utran_cco(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1491 {
1492     guint32 curr_offset;
1493
1494     curr_offset = offset;
1495
1496     /* Service EUTRAN CCO Value part */
1497     proto_tree_add_item(tree, hf_bssgp_serv_eutran_cco, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1498     /* Service UTRAN CCO Value part */
1499     proto_tree_add_item(tree, hf_bssgp_serv_utran_cco, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1500     curr_offset++;
1501
1502     return(curr_offset-offset);
1503 }
1504
1505 /*
1506  * 11.3.48  NSEI (Network Service Entity Identifier)
1507  */
1508 static guint16
1509 de_bssgp_nsei(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1510 {
1511     guint32 curr_offset;
1512     guint16 nsei;
1513
1514     curr_offset = offset;
1515
1516     nsei = tvb_get_ntohs(tvb, curr_offset);
1517     proto_tree_add_item(tree, hf_bssgp_nsei, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
1518     curr_offset+=2;
1519
1520     col_append_sep_fstr(gpinfo->cinfo, COL_INFO, BSSGP_SEP, "NSEI %u", nsei);
1521
1522
1523     return(curr_offset-offset);
1524 }
1525 /*
1526  * 11.3.49  RRLP APDU
1527  */
1528 static guint16
1529 de_bssgp_rrlp_apdu(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1530 {
1531     tvbuff_t *next_tvb=NULL;
1532     guint32 curr_offset;
1533
1534     curr_offset = offset;
1535
1536     /* The rest of the information element contains an embedded RRLP
1537      * message whose content and encoding are defined according to the
1538      * 3GPP TS 44.031. The RRLP protocol is not octet aligned.
1539      * Therefore, the unused bits in the last octet are padded with zeroes
1540      */
1541
1542     if(len > 0){
1543         next_tvb = tvb_new_subset_remaining(tvb, curr_offset);
1544         proto_tree_add_text(tree, tvb, curr_offset, len, "RRLP APDU");
1545     }
1546
1547     if(next_tvb){
1548         if (rrlp_handle) {
1549             call_dissector(rrlp_handle, next_tvb, gpinfo, gparent_tree);
1550         }else if (data_handle) {
1551             call_dissector(data_handle, next_tvb, gpinfo, gparent_tree);
1552         }
1553     }
1554     return(len);
1555 }
1556
1557 /*
1558  * 11.3.50  LCS QoS
1559  */
1560 /* Rest of element coded as the value part defined in
1561  * 3GPP TS 48.008, not including 3GPP TS 48.008 IEI and
1562  * 3GPP TS 48.008 octet length indicator
1563  */
1564 /*
1565  * 11.3.51  LCS Client Type
1566  */
1567 /* Rest of element coded as the value part defined in
1568  * 3GPP TS 49.031, not including 3GPP TS 49.031 IEI and
1569  * 3GPP TS 49.031 octet length indicator
1570  */
1571 /*
1572  * 11.3.52  Requested GPS Assistance Data
1573  */
1574 /* Rest of element coded as the value part defined in
1575  * 3GPP TS 49.031, not including 3GPP TS 49.031 IEI and
1576  * 3GPP TS 49.031 octet length indicator
1577  */
1578 /*
1579  * 11.3.53  Location Type
1580  */
1581 /* Rest of element coded as the value part defined in
1582  * 3GPP TS 49.031, not including 3GPP TS 49.031 IEI and
1583  * 3GPP TS 49.031 octet length indicator
1584  */
1585 /*
1586  * 11.3.54  Location Estimate
1587  */
1588 /* Rest of element coded as the value part defined in
1589  * 3GPP TS 48.008, not including 3GPP TS 48.008 IEI and
1590  * 3GPP TS 48.008 octet length indicator
1591  */
1592 /*
1593  * 11.3.55  Positioning Data
1594  */
1595 /* Rest of element coded as the value part defined in
1596  * 3GPP TS 49.031, not including 3GPP TS 49.031 IEI and
1597  * 3GPP TS 49.031 octet length indicator
1598  */
1599 /*
1600  * 11.3.56  Deciphering Keys
1601  */
1602 /* Rest of element coded as the value part defined in
1603  * 3GPP TS 49.031, not including 3GPP TS 49.031 IEI and
1604  * 3GPP TS 49.031 octet length indicator
1605  */
1606 /*
1607  * 11.3.57  LCS Priority
1608  */
1609 /* Rest of element coded as the value part defined in
1610  * 3GPP TS 49.031, not including 3GPP TS 49.031 IEI and
1611  * 3GPP TS 49.031 octet length indicator
1612  */
1613 /*
1614  * 11.3.58  LCS Cause
1615  */
1616 /* Rest of element coded as the value part defined in
1617  * 3GPP TS 49.031, not including 3GPP TS 49.031 IEI and
1618  * 3GPP TS 49.031 octet length indicator
1619  */
1620 /*
1621  * 11.3.59  LCS Capability
1622  */
1623 /* Rest of element coded as the value part of the PS LCS Capability
1624  * IE defined in 3GPP TS 24.008, not including 3GPP TS 24.008 IEI
1625  * and length indicator
1626  */
1627 /*
1628  * 11.3.60  RRLP Flags
1629  */
1630
1631 static const true_false_string  bssgp_rrlp_flg1_vals = {
1632     "Not a Positioning Command or final response",
1633     "Position Command (BSS to SGSN) or final response (SGSN to BSS)"
1634 };
1635
1636 static guint16
1637 de_bssgp_rrlp_flags(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1638 {
1639     guint32 curr_offset;
1640
1641     curr_offset = offset;
1642
1643     /* Flag 1 (Octet 3, bit 1): */
1644     proto_tree_add_item(tree, hf_bssgp_rrlp_flag1, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
1645
1646     return(curr_offset-offset);
1647 }
1648
1649 /*
1650  * 11.3.61  RIM Application Identity
1651  */
1652
1653 static const value_string bssgp_rim_appid_vals[] = {
1654     { 0, "Reserved" },
1655     { 1, "Network Assisted Cell Change (NACC)" },
1656     { 2, "System Information 3 (SI3)" },
1657     { 3, "MBMS data channel" },
1658     { 4, "SON Transfer" },
1659     { 5, "UTRA System Information (UTRA SI)" },
1660     { 0,    NULL },
1661 };
1662
1663 static guint16
1664 de_bssgp_rim_app_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1665 {
1666     guint32 curr_offset;
1667
1668     curr_offset = offset;
1669
1670     /* RIM Application Identity */
1671     g_rim_application_identity = tvb_get_guint8(tvb, curr_offset);
1672     proto_tree_add_item(tree, hf_bssgp_rim_app_id, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1673     curr_offset++;
1674
1675     return(curr_offset-offset);
1676 }
1677
1678 /*
1679  * 11.3.62  RIM Sequence Number
1680  */
1681 static guint16
1682 de_bssgp_rim_seq_no(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1683 {
1684     guint32 curr_offset;
1685
1686     curr_offset = offset;
1687
1688     /* RIM Sequence Number */
1689     proto_tree_add_item(tree, hf_bssgp_rim_seq_no, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
1690     curr_offset+=4;
1691
1692     return(curr_offset-offset);
1693 }
1694 /*
1695  * 11.3.62a RIM Container
1696  * 11.3.62a.0   General
1697  * 11.3.62a.1   RAN-INFORMATION-REQUEST RIM Container
1698  */
1699 /* Dissection moved */
1700 /*
1701  * 11.3.62a.2   RAN-INFORMATION RIM Container
1702  * 11.3.62a.3   RAN-INFORMATION-ACK RIM Container
1703  * 11.3.62a.4   RAN-INFORMATION-ERROR RIM Container
1704  * 11.3.62a.5   RAN-INFORMATION-APPLICATION-ERROR RIM Container
1705  */
1706 /*
1707  * 11.3.63  Application Container
1708  * 11.3.63.1    RAN-INFORMATION-REQUEST Application Container
1709  * 11.3.63.1.0  General
1710  */
1711
1712
1713
1714 static guint16
1715 de_bssgp_ran_information_request_app_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1716 {
1717     tvbuff_t *new_tvb = NULL;
1718     guint32 curr_offset;
1719
1720     curr_offset = offset;
1721
1722     switch(g_rim_application_identity){
1723         case 1:
1724             /* 11.3.63.1.1  RAN-INFORMATION-REQUEST Application Container for the NACC Application */
1725             /* Reporting Cell Identifier */
1726             curr_offset = curr_offset + de_bssgp_cell_id(tvb, tree, pinfo,curr_offset, len, add_string, string_len);
1727             break;
1728         case 2:
1729             /* 11.3.63.1.2  RAN-INFORMATION-REQUEST Application Container for the SI3 Application */
1730             /* Reporting Cell Identifier */
1731             curr_offset = curr_offset + de_bssgp_cell_id(tvb, tree, pinfo, curr_offset, len, add_string, string_len);
1732             break;
1733         case 3:
1734             /* 11.3.63.1.3  RAN-INFORMATION-REQUEST Application Container for the MBMS data channel Application */
1735             /* Reporting Cell Identifier */
1736             curr_offset = curr_offset + de_bssgp_cell_id(tvb, tree, pinfo, curr_offset, len, add_string, string_len);
1737             break;
1738         case 4:
1739             {
1740             asn1_ctx_t asn1_ctx;
1741
1742             asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, gpinfo);
1743             /* 11.3.63.1.4  RAN-INFORMATION-REQUEST Application Container for the SON Transfer Application */
1744             /* Reporting Cell Identifier */
1745             /* convert to bit offset */
1746             curr_offset = curr_offset<<3;
1747             curr_offset = dissect_s1ap_Global_ENB_ID(tvb, curr_offset<<3, &asn1_ctx, tree, hf_bssgp_Global_ENB_ID_PDU);
1748             curr_offset = dissect_s1ap_SONtransferRequestContainer(tvb, curr_offset, &asn1_ctx, tree, hf_bssgp_SONtransferRequestContainer_PDU);
1749             curr_offset += 7; curr_offset >>= 3;
1750             }
1751             break;
1752         case 5:
1753             /* 11.3.63.1.5 RAN-INFORMATION Application Container for the UTRA SI Application */
1754             /* Octet 3-m Reporting Cell Identifier
1755              * This field is encoded as the Source Cell Identifier IE (UTRAN Source Cell ID) as defined in
1756              * 3GPP TS 25.413
1757              */
1758             new_tvb = tvb_new_subset_remaining(tvb, curr_offset);
1759             curr_offset = curr_offset + dissect_ranap_SourceCellID_PDU(new_tvb, gpinfo, tree);
1760             break;
1761         default :
1762             proto_tree_add_text(tree, tvb, curr_offset, len, "Unknown RIM Application Identity");
1763             curr_offset+=len;
1764             break;
1765     }
1766
1767
1768     return(curr_offset-offset);
1769 }
1770
1771 /*
1772  * 11.3.63.2    RAN-INFORMATION Application Container Unit
1773  * 11.3.63.2.0  General
1774  */
1775 static const true_false_string  bssgp_si_psi_type_vals = {
1776     "PSI messages as specified for PBCCH (3GPP TS 44.060) follow",
1777     "SI messages as specified for BCCH (3GPP TS 44.018) follow"
1778 };
1779
1780 static const value_string bssgp_rat_discriminator_vals[] = {
1781     { 0, "The reporting RAT is GERAN" },
1782     { 1, "The reporting RAT is UTRAN" },
1783     { 2, "The reporting RAT is E-UTRAN" },
1784     { 0,    NULL },
1785 };
1786 static guint16
1787 de_bssgp_ran_information_app_cont_unit(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1788 {
1789     tvbuff_t *new_tvb = NULL;
1790     guint32 curr_offset;
1791     guint8 type, num_items, rat_type, oct;
1792     int i;
1793
1794     curr_offset = offset;
1795
1796     switch(g_rim_application_identity){
1797         case 1:
1798             /* 11.3.63.2.1 RAN-INFORMATION Application Container for the NACC Application */
1799             /* Reporting Cell Identifier */
1800             curr_offset = curr_offset + de_bssgp_cell_id(tvb, tree, pinfo, curr_offset, len, add_string, string_len);
1801             /* Number of SI/PSI */
1802             num_items = tvb_get_guint8(tvb,curr_offset)>>1;
1803             proto_tree_add_item(tree, hf_bssgp_num_si_psi, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1804             /* Type */
1805             type = tvb_get_guint8(tvb,curr_offset)&0x01;
1806             proto_tree_add_item(tree, hf_bssgp_si_psi_type, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1807             curr_offset++;
1808             /* Octet 12-n SI/PSI */
1809             if(type==1){
1810                 /* If the Type field indicates that "PSI messages as specified for PBCCH (3GPP TS 44.060) follow" then the SI/PSI
1811                  * field contains Packet System Information message instances encoded for PBCCH as specified in
1812                  * 3GPP TS 44.060. Each Packet System Information message contains the MESSAGE_TYPE field followed by the
1813                  * PSI message content. Each message is 22 octets long.
1814                  */
1815                 for (i=0; i < num_items; i++){
1816                     proto_tree_add_text(tree, tvb, curr_offset, 22, "PSI item %u - not dissected yet",i+1);
1817                     curr_offset+=22;
1818                 }
1819             }else{
1820                 /* If the Type field indicates that "SI messages as specified for BCCH (3GPP TS 44.018) follow" then the SI/PSI
1821                  * field contains System Information message instances encoded for BCCH as specified in 3GPP TS 44.018. Each
1822                  * System Information message contains the Message type octet followed by all the IEs composing the message
1823                  * payload. Each message is 21 octets long.
1824                  */
1825                 void            (*msg_fcn_p)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len);
1826                 gint            ett_tree;
1827                 int             hf_idx;
1828                 const gchar     *msg_str;
1829                 proto_item      *si_item;
1830                 proto_tree      *si_tree;
1831
1832                 for (i=0; i < num_items; i++){
1833                     oct = tvb_get_guint8(tvb,curr_offset);
1834                     get_rr_msg_params(oct, &msg_str, &ett_tree, &hf_idx, &msg_fcn_p);
1835                     proto_tree_add_text(tree, tvb, curr_offset, 21, "SI item %u ",i+1);
1836                     si_item = proto_tree_add_item(tree, hf_idx, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1837                     si_tree = proto_item_add_subtree(si_item, ett_tree);
1838                     if (msg_fcn_p == NULL){
1839                         proto_tree_add_text(si_tree, tvb, curr_offset, 21, "Unknown SI message");
1840                     }else{
1841                         (*msg_fcn_p)(tvb, si_tree, gpinfo, curr_offset+1, 20);
1842                     }
1843                     curr_offset+=21;
1844                 }
1845             }
1846             break;
1847         case 2:
1848             /* 11.3.63.2.2 RAN-INFORMATION Application Container for the SI3 Application */
1849             /* Octet 3-10 Reporting Cell Identifier */
1850             /* Reporting Cell Identifier: The parameter is encoded as the value part of the Cell Identifier IE
1851              * defined in sub-clause 11.3.9, not including IEI and Length Indicator.
1852              */
1853             curr_offset = curr_offset + de_bssgp_cell_id(tvb, tree, pinfo, curr_offset, len, add_string, string_len);
1854             /* Octet 11-31 SI3 */
1855             /* SI3: contains the SYSTEM INFORMATION type 3 message encoded for BCCH as specified in 3GPP TS 44.018 ch 9.1.35
1856              * It contains the Message type octet followed by all the IEs composing the message payload.
1857              * The message is 21 octets long.
1858              * dtap_rr_sys_info_3(tvb, tree, curr_offset, len-7)
1859              */
1860             proto_tree_add_text(tree, tvb, curr_offset, 1, "SYSTEM INFORMATION type 3 message");
1861             curr_offset++;
1862             break;
1863         case 3:
1864             /* 11.3.63.2.3 RAN-INFORMATION Application Container for the MBMS data channel Application */
1865             /* Octet 3-10 Reporting Cell Identifier */
1866             curr_offset = curr_offset + de_bssgp_cell_id(tvb, tree, pinfo, curr_offset, len, add_string, string_len);
1867             /* Octet 11-n MBMS data channel report */
1868             proto_tree_add_text(tree, tvb, curr_offset, len-6, "MBMS data channel report - not dissected yet");
1869             break;
1870         case 4:
1871             /* 11.3.63.2.4 RAN-INFORMATION Application Container for the SON Transfer Application */
1872             /* Octet 3 Spare RAT discriminator */
1873             rat_type = tvb_get_guint8(tvb,curr_offset) & 0x0f;
1874             proto_tree_add_item(tree, hf_bssgp_rat_discriminator, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1875             curr_offset++;
1876             /* Octet 4-m Reporting Cell Identifier */
1877             switch(rat_type){
1878                 case 0:
1879                     /* If the RAT discriminator field indicates GERAN, this field is encoded as the value part of the Cell Identifier IE
1880                      * defined in sub-clause 11.3.9, not including IEI and Length Indicator.
1881                      */
1882                     curr_offset = curr_offset + de_bssgp_cell_id(tvb, tree, pinfo, curr_offset, len, add_string, string_len);
1883                     break;
1884                 case 1:
1885                     /* If the RAT discriminator field indicates UTRAN, this field is encoded as the Source Cell Identifier IE (UTRAN
1886                      * Source Cell ID) as defined in 3GPP TS 25.413
1887                      */
1888                     new_tvb = tvb_new_subset_remaining(tvb, curr_offset);
1889                     curr_offset = curr_offset + dissect_ranap_SourceCellID_PDU(new_tvb, gpinfo, tree);
1890                     break;
1891                 case 2:
1892                     /* If the RAT discriminator field indicates E-UTRAN, this field is encoded as the E-UTRAN CGI IE as
1893                      * defined in 3GPP TS 36.413
1894                      */
1895                     new_tvb = tvb_new_subset_remaining(tvb, curr_offset);
1896                     curr_offset = curr_offset + dissect_s1ap_Global_ENB_ID_PDU(new_tvb, gpinfo, tree);
1897                     break;
1898                 default:
1899                     break;
1900             }
1901
1902             break;
1903         case 5:
1904             /* 11.3.63.2.5 RAN-INFORMATION Application Container for the UTRA SI Application */
1905             /* Octet 3-m Reporting Cell Identifier
1906              * Reporting Cell Identifier: This field is encoded as the Source Cell Identifier IE
1907              * (UTRAN Source Cell ID) as defined in 3GPP TS 25.413
1908              */
1909             new_tvb = tvb_new_subset_remaining(tvb, curr_offset);
1910             curr_offset = curr_offset + dissect_ranap_SourceCellID_PDU(new_tvb, gpinfo, tree);
1911             /* Octet (m+1)-n UTRA SI Container
1912              * UTRA SI Container: This field contains System Information Container valid for the reporting cell
1913              * encoded as defined in TS 25.331
1914              */
1915             proto_tree_add_text(tree, tvb, curr_offset, len-(curr_offset-offset), "UTRA SI Container - not dissected yet");
1916             break;
1917
1918         default :
1919             proto_tree_add_text(tree, tvb, curr_offset, len, "Unknown RIM Application Identitys Data");
1920             curr_offset+=len;
1921             break;
1922     }
1923
1924
1925     return(curr_offset-offset);
1926 }
1927 /*
1928  * 11.3.64  Application Error Container
1929  */
1930 static const value_string bssgp_nacc_cause_vals[] = {
1931     { 0, "Other unspecified error" },
1932     { 1, "Syntax error in the Application Container" },
1933     { 2, "Reporting Cell Identifier does not match with the Destination Cell Identifier or with the Source Cell Identifier" },
1934     { 3, "SI/PSI type error" },
1935     { 4, "Inconsistent length of a SI/PSI message" },
1936     { 5, "Inconsistent set of messages" },
1937     { 0,    NULL },
1938 };
1939
1940 static const value_string bssgp_s13_cause_vals[] = {
1941     { 0, "Other unspecified error" },
1942     { 1, "Syntax error in the Application Container" },
1943     { 2, "Reporting Cell Identifier does not match with the Destination Cell Identifier or with the Source Cell Identifier" },
1944     { 3, "Inconsistent length of a SI3 message" },
1945     { 4, "Inconsistent set of messages" },
1946     { 0,    NULL },
1947 };
1948
1949 static const value_string bssgp_mbms_data_ch_cause_vals[] = {
1950     { 0, "Other unspecified error" },
1951     { 1, "Syntax error in the Application Container" },
1952     { 2, "Reporting Cell Identifier does not match with the Destination Cell Identifier or with the Source Cell Identifier" },
1953     { 3, "RAN-INFORMATION/Initial Multiple Report or RANINFORMATION/Single Report PDU exceeds the maximum supported length" },
1954     { 4, "Inconsistent MBMS data channel description" },
1955     { 0,    NULL },
1956 };
1957
1958 static const value_string bssgp_utra_si_cause_vals[] = {
1959     { 0, "Other unspecified error" },
1960     { 1, "Syntax error in the Application Container" },
1961     { 2, "Inconsistent Reporting Cell Identifier" },
1962     { 0,    NULL },
1963 };
1964
1965 static guint16
1966 de_bssgp_ran_app_error_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
1967 {
1968     tvbuff_t *new_tvb = NULL;
1969     guint32 curr_offset;
1970
1971     curr_offset = offset;
1972
1973     switch(g_rim_application_identity){
1974         case 1:
1975             /*
1976              * 11.3.64.1    Application Error Container layout for the NACC application
1977              */
1978             /* Octet 3 NACC Cause */
1979             proto_tree_add_item(tree, hf_bssgp_nacc_cause, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1980             curr_offset++;
1981             /* Erroneous Application Container including IEI and LI */
1982             proto_tree_add_text(tree, tvb, curr_offset, len-(curr_offset-offset), "Erroneous Application Container including IEI and LI");
1983             break;
1984         case 2:
1985             /*
1986              * 11.3.64.2    Application Error Container for the SI3 application
1987              */
1988             /* Octet 3 SI3 Cause */
1989             proto_tree_add_item(tree, hf_bssgp_s13_cause, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
1990             curr_offset++;
1991             /* Erroneous Application Container including IEI and LI */
1992             proto_tree_add_text(tree, tvb, curr_offset, len-(curr_offset-offset), "Erroneous Application Container including IEI and LI");
1993             break;
1994         case 3:
1995             /*
1996              * 11.3.64.3    Application Error Container for the MBMS data channel application
1997              */
1998             /* Octet 3 MBMS data channel Cause */
1999             proto_tree_add_item(tree, hf_bssgp_mbms_data_ch_cause, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2000             curr_offset++;
2001             /* Erroneous Application Container including IEI and LI */
2002             proto_tree_add_text(tree, tvb, curr_offset, len-(curr_offset-offset), "Erroneous Application Container including IEI and LI");
2003             break;
2004         case 4:
2005             /*
2006              * 11.3.64.4    Application Error Container for the SON Transfer Application
2007              */
2008             /* SON Transfer Cause: This field indicates the cause why the Application Error Container IE is sent.
2009              * The "SON Transfer Cause" field is encoded as the SON Transfer Cause IE as defined in 3GPP TS 36.413
2010              */
2011             new_tvb = tvb_new_subset_remaining(tvb, curr_offset);
2012             curr_offset = curr_offset + dissect_s1ap_SONtransferCause_PDU(new_tvb, gpinfo, tree);
2013             /* Erroneous Application Container including IEI and LI */
2014             proto_tree_add_text(tree, tvb, curr_offset, len-(curr_offset-offset), "Erroneous Application Container including IEI and LI");
2015             break;
2016         case 5:
2017             /* 11.3.64.5 Application Error Container for the UTRA SI Application*/
2018             /* Octet 3 UTRA SI Cause */
2019             proto_tree_add_item(tree, hf_bssgp_utra_si_cause, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2020             break;
2021         default :
2022             proto_tree_add_text(tree, tvb, curr_offset, len, "Unknown Application Error Container");
2023             curr_offset+=len;
2024             break;
2025     }
2026     return(len);
2027 }
2028
2029 /*
2030  * 11.3.65  RIM PDU Indications
2031  */
2032 static const value_string bssgp_ran_inf_req_pdu_t_ext_c_vals[] = {
2033     { 0, "RAN-INFORMATION-REQUEST/Stop PDU" },
2034     { 1, "RAN-INFORMATION-REQUEST/Single Report PDU" },
2035     { 2, "RAN-INFORMATION-REQUEST/Multiple Report PDU" },
2036     { 3, "Reserved" },
2037     { 4, "Reserved" },
2038     { 5, "Reserved" },
2039     { 6, "Reserved" },
2040     { 7, "Reserved" },
2041     { 0,    NULL },
2042 };
2043
2044 static const value_string bssgp_ran_inf_pdu_t_ext_c_vals[] = {
2045     { 0, "RAN-INFORMATION/Stop PDU" },
2046     { 1, "RAN-INFORMATION/Single Report PDU" },
2047     { 2, "RAN-INFORMATION/Initial Multiple Report PDU" },
2048     { 3, "RAN-INFORMATION/Multiple Report PDU" },
2049     { 4, "RAN-INFORMATION/End PDU" },
2050     { 5, "Reserved" },
2051     { 6, "Reserved" },
2052     { 7, "Reserved" },
2053     { 0,    NULL },
2054 };
2055
2056 static const true_false_string  bssgp_rim_pdu_ind_ack_vals = {
2057     "ACK requested",
2058     "No ACK requested"
2059 };
2060
2061 static guint16
2062 de_bssgp_rim_pdu_indications(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2063 {
2064     guint32 curr_offset;
2065
2066     curr_offset = offset;
2067
2068     switch(g_pdu_type){
2069         case BSSGP_PDU_RAN_INFORMATION_REQUEST:
2070             /* 11.3.65.1 RAN-INFORMATION-REQUEST RIM PDU Indications */
2071             /* Table 11.3.65.1: RAN-INFORMATION-REQUEST PDU Type Extension coding */
2072             proto_tree_add_item(tree, hf_bssgp_ran_inf_req_pdu_t_ext_c, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2073             /* The ACK field is not used and shall be considered as spare */
2074             curr_offset++;
2075             break;
2076         case BSSGP_PDU_RAN_INFORMATION:
2077             /* 11.3.65.2 RAN-INFORMATION RIM PDU Indications */
2078             /* Table 11.3.65.2: RAN-INFORMATION PDU Type Extension coding */
2079             proto_tree_add_item(tree, hf_bssgp_ran_inf_pdu_t_ext_c, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2080             proto_tree_add_item(tree, hf_bssgp_rim_pdu_ind_ack, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2081             curr_offset++;
2082             break;
2083         case BSSGP_PDU_RAN_INFORMATION_ERROR:
2084             /* 11.3.65.3 RAN-INFORMATION-APPLICATION-ERROR RIM PDU Indications */
2085             proto_tree_add_item(tree, hf_bssgp_rim_pdu_ind_ack, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2086             /* The PDU Type Extension field is not used and shall be considered as spare */
2087             curr_offset++;
2088             break;
2089         default:
2090             break;
2091     }
2092
2093     return(curr_offset-offset);
2094 }
2095
2096 /*
2097  * 11.3.65.0    General
2098  * 11.3.65.1    RAN-INFORMATION-REQUEST RIM PDU Indications
2099  * 11.3.65.2    RAN-INFORMATION RIM PDU Indications
2100  * 11.3.65.3    RAN-INFORMATION-APPLICATION-ERROR RIM PDU Indications
2101  * 11.3.66  (void)
2102  */
2103 /*
2104  * 11.3.67  RIM Protocol Version Number
2105  */
2106 static const value_string bssgp_rim_proto_ver_no_vals[] = {
2107     { 0, "Reserved" },
2108     { 1, "Version 1" },
2109     { 0,    NULL },
2110 };
2111
2112 static guint16
2113 de_bssgp_rim_proto_ver_no(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2114 {
2115     guint32 curr_offset;
2116
2117     curr_offset = offset;
2118
2119     /* Octet 3 RIM Protocol Version Number */
2120     proto_tree_add_item(tree, hf_bssgp_rim_proto_ver_no, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2121     curr_offset++;
2122
2123     return(curr_offset-offset);
2124 }
2125
2126 /*
2127  * 11.3.68  PFC Flow Control parameters
2128  */
2129
2130 static guint16
2131 de_bssgp_pfc_flow_ctrl(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2132 {
2133     proto_tree *pfc_tree;
2134     proto_item *pi, *ti2;
2135
2136     guint32 curr_offset;
2137     guint8 num_pfc, i, pfc_len;
2138     gboolean b_pfc_included;
2139
2140     curr_offset = offset;
2141
2142     num_pfc = tvb_get_guint8(tvb, curr_offset);
2143     pi = proto_tree_add_text(tree, tvb, curr_offset, 1,
2144                "Number of PFCs: ");
2145
2146     if (num_pfc < 12) {
2147         proto_item_append_text(pi, "%u", num_pfc);
2148     }else {
2149         proto_item_append_text(pi, "Reserved");
2150         return (curr_offset-offset);
2151     }
2152     curr_offset++;
2153     if (num_pfc == 0)
2154         return (curr_offset-offset);
2155
2156     pfc_len = (len - 1) / num_pfc;
2157     b_pfc_included = (pfc_len == 6);
2158
2159     for (i = 0; i < num_pfc; i++) {
2160         ti2 = proto_tree_add_text(tree, tvb, curr_offset, pfc_len,
2161                       "PFC (%u)", i + 1);
2162         pfc_tree = proto_item_add_subtree(ti2, ett_bssgp_pfc_flow_control_parameters_pfc);
2163
2164         /* PFI: Packet Flow Identifier.
2165          * Coded as the value part of the Packet Flow Identifier information element in
2166          * 3GPP TS 24.008, not including 3GPP TS 24.008 IEI
2167          */
2168         de_sm_pflow_id(tvb, pfc_tree, pinfo, curr_offset, 1, NULL, 0);
2169         curr_offset++;
2170
2171         /* Bmax_PFC: Bucket size of the PFC. Coded like the value part of BVC Bucket Size, see sub-clause 11.3.5. */
2172         proto_tree_add_item(tree, hf_bssgp_bmax_pfc, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
2173         curr_offset += 2;
2174
2175         /* R_PFC: Bucket Leak Rate of the PFC. Coded as the value part of Bucket Leak Rate (R), see sub-clause 11.3.4. */
2176         proto_tree_add_item(tree, hf_bssgp_r_pfc, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
2177         curr_offset += 2;
2178
2179         if (b_pfc_included) {
2180             /* B_PFC: Bucket Full Ratio of the PFC. This field is only present if the Current Bucket Level (CBL) feature is
2181              * negotiated. Otherwise, the flow control parameters for the next PFC, if any, are provided instead. This field if coded as
2182              * the value part of the Bucket Full Ratio, see sub-clause 11.3.46.
2183              */
2184             proto_tree_add_item(tree, hf_bssgp_b_pfc, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2185             curr_offset++;
2186         }
2187     }
2188     return(curr_offset-offset);
2189 }
2190 /*
2191  * 11.3.69  Global CN-Id
2192  */
2193 /* Coded as octets 3 to 7 of the Global CN-Id IE, defined in
2194  * 3GPP TS 29.018
2195  */
2196 /*
2197  * 11.3.70  RIM Routing Information
2198  */
2199 static const value_string bssgp_ra_discriminator_vals[] = {
2200     { 0, "A Cell Identifier is used to identify a GERAN cell" },
2201     { 1, "A Global RNC-ID is used to identify a UTRAN RNC" },
2202     { 2, "An eNB identifier is used to identify an E-UTRAN eNodeB or HeNB" },
2203     { 0, NULL },
2204 };
2205
2206 static guint16
2207 de_bssgp_rim_routing_inf(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2208 {
2209     guint8 oct;
2210     guint16 rnc_id;
2211     tvbuff_t *new_tvb = NULL;
2212     guint32 curr_offset;
2213
2214     curr_offset = offset;
2215
2216     /* This information element uniquely identifies either a cell within a
2217      * GERAN BSS, a UTRAN RNC or an E-UTRAN eNodeB.
2218      */
2219
2220     /* RIM Routing Address discriminator */
2221     oct  = tvb_get_guint8(tvb,curr_offset);
2222     proto_tree_add_item(tree, hf_bssgp_ra_discriminator, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2223     curr_offset++;
2224     switch(oct){
2225         case 0:
2226             /* RIM Routing Address discriminator = 0000:
2227              * The RIM Routing Address field contains a Cell Identifier
2228              * and is coded as the value part (octet 3 to octet 10) of the
2229              * Cell Identifier information element specified in sub-clause 11.3.9.
2230              */
2231             curr_offset = curr_offset + de_bssgp_cell_id(tvb, tree, pinfo, curr_offset, len, add_string, string_len);
2232             break;
2233         case 1:
2234             /* RIM Routing Address discriminator = 0001:
2235              * The RIM Routing Address field contains an RNC identifier and is coded as follows:
2236              * Octets 4 to 9 contain the value part (starting with octet 2) of the Routing Area Identification IE
2237              * defined in 3GPP TS 24.008, not including 3GPP TS 24.008 IEI
2238              */
2239             curr_offset = curr_offset + de_gmm_rai(tvb, tree, pinfo, curr_offset , 6, add_string, string_len);
2240             /* Octet 10 - 11 RNC-ID (or Extended RNC-ID) */
2241             rnc_id = tvb_get_ntohs(tvb, curr_offset);
2242             proto_tree_add_item(tree, hf_bssgp_rnc_id, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
2243             curr_offset+=2;
2244
2245             if (add_string)
2246                 g_snprintf(add_string, string_len, " %s, RNC-ID %u", add_string, rnc_id);
2247             break;
2248         case 2:
2249             /* RIM Routing Address discriminator = 0010:
2250              * The RIM Routing Address field contains an eNB identifier and is coded as follows:
2251              * Octets 4 to 8 contain the value part (starting with octet 2) of the
2252              * Tracking Area Identity IE defined in 3GPP TS 24.301 [37], not including 3GPP TS 24.301 IEI
2253              */
2254             curr_offset = curr_offset+ de_emm_trac_area_id(tvb, tree, pinfo, curr_offset, 5, add_string, string_len);
2255             /* Octets 9-n contain the Global eNB ID (see 3GPP TS 36.413 [36]) of the eNodeB. */
2256             new_tvb = tvb_new_subset_remaining(tvb, curr_offset);
2257             dissect_s1ap_Global_ENB_ID_PDU(new_tvb, gpinfo, tree);
2258             break;
2259         default:
2260             proto_tree_add_text(tree, tvb, curr_offset, 3, "Unknown RIM Routing Address discriminator");
2261             return len;
2262     }
2263
2264
2265     return len;
2266 }
2267
2268 /*
2269  * 11.3.71  MBMS Session Identity
2270  */
2271 /* MBMS-Session-Identity AVP encoded as in 3GPP TS 29.061 [31],
2272  * excluding AVP Header fields as defined in IETF RFC 3588 [33].
2273  * TS 29.061
2274  * 17.7.11 MBMS-Session-Identity AVP
2275  * The MBMS-Session-Identity AVP (AVP code 908) is of type OctetString. Its length is one octet. It is allocated by the
2276  * BM-SC. Together with TMGI it identifies a transmission of a specific MBMS session. The initial transmission and
2277  * subsequent retransmissions of the MBMS session will use the same values of these parameters. This AVP is optional
2278  * within the Gmb interface.
2279  */
2280 static guint16
2281 de_bssgp_mbms_session_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2282 {
2283     guint32 curr_offset;
2284
2285     curr_offset = offset;
2286
2287     /* MBMS Session Identity */
2288     proto_tree_add_item(tree, hf_bssgp_mbms_session_id, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2289     curr_offset++;
2290
2291     return(curr_offset-offset);
2292 }
2293 /*
2294  * 11.3.72  MBMS Session Duration
2295  */
2296 static guint16
2297 de_bssgp_mbms_session_dur(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2298 {
2299     tvbuff_t *new_tvb;
2300     guint32 curr_offset;
2301
2302     curr_offset = offset;
2303
2304     /* AVP Code: 904 MBMS-Session-Duration Registered by packet-gtp.c */
2305     new_tvb =tvb_new_subset(tvb, offset, len, len);
2306     dissector_try_uint(diameter_3gpp_avp_dissector_table, 904, new_tvb, gpinfo, tree);
2307
2308     return(curr_offset-offset);
2309 }
2310 /*
2311  * 11.3.73  MBMS Service Area Identity List
2312  * octet 3 - 514
2313  * MBMS-Service-Area AVP encoded as in 3GPP TS 29.061,
2314  * excluding AVP Header fields (as defined in IETF RFC 3588 [33]).
2315  *
2316  */
2317 static guint16
2318 de_bssgp_mbms_sai_list(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
2319 {
2320     tvbuff_t *new_tvb;
2321     guint32 curr_offset;
2322
2323     curr_offset = offset;
2324
2325     /* AVP Code: 903 MBMS-Service-Area Registered by packet-gtp.c */
2326     new_tvb =tvb_new_subset(tvb, offset, len, len);
2327     dissector_try_uint(diameter_3gpp_avp_dissector_table, 903, new_tvb, gpinfo, tree);
2328
2329     return(curr_offset-offset);
2330 }
2331 /*
2332  * 11.3.74  MBMS Response
2333  */
2334
2335 static const value_string bssgp_mbms_cause_vals[] = {
2336     { 0, "Acknowledge" },
2337     { 1, "Acknowledge, initiate data transfer" },
2338     { 2, "Acknowledge, data transfer initiated from other SGSN" },
2339     { 3, "Reject - Congestion" },
2340     { 4, "Reject - None of the listed MBMS Service Areas are supported by BSS" },
2341     { 5, "Reject - MBMS Service Context is released due to interrupted data flow" },
2342
2343     { 6, "Unspecified in this version of the protocol" },
2344     { 7, "Unspecified in this version of the protocol" },
2345     { 8, "Unspecified in this version of the protocol" },
2346     { 9, "Unspecified in this version of the protocol" },
2347     { 10, "Unspecified in this version of the protocol" },
2348     { 11, "Unspecified in this version of the protocol" },
2349     { 12, "Unspecified in this version of the protocol" },
2350     { 13, "Unspecified in this version of the protocol" },
2351     { 14, "Unspecified in this version of the protocol" },
2352     { 15, "Unspecified in this version of the protocol" },
2353     { 0, NULL },
2354 };
2355 static value_string_ext bssgp_mbms_cause_vals_ext = VALUE_STRING_EXT_INIT(bssgp_mbms_cause_vals);
2356
2357 static guint16
2358 de_bssgp_mbms_response(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2359 {
2360     guint32 curr_offset;
2361
2362     curr_offset = offset;
2363
2364     /* MBMS Session Identity */
2365     proto_tree_add_item(tree, hf_bssgp_mbms_cause, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2366     curr_offset++;
2367
2368     return(curr_offset-offset);
2369 }
2370 /*
2371  * 11.3.75  MBMS Routing Area List
2372  */
2373 /* Number of Routing Areas (octet 3) */
2374 static const value_string bssgp_mbms_num_ra_ids_vals[] = {
2375     { 0, "Notification shall not be sent to any Routing Areas in the BSS" },
2376     { 1, "'1' Routing Area Identities" },
2377     { 2, "'1' Routing Area Identities" },
2378     { 3, "'1' Routing Area Identities" },
2379     { 4, "'1' Routing Area Identities" },
2380     { 5, "'1' Routing Area Identities" },
2381     { 6, "'1' Routing Area Identities" },
2382     { 7, "'1' Routing Area Identities" },
2383     { 8, "'1' Routing Area Identities" },
2384     { 9, "'1' Routing Area Identities" },
2385     { 10, "'1' Routing Area Identities" },
2386     { 11, "'1' Routing Area Identities" },
2387     { 12, "'1' Routing Area Identities" },
2388     { 13, "'1' Routing Area Identities" },
2389     { 14, "'1' Routing Area Identities" },
2390     { 15, "Notification shall be sent in all Routing Areas in the BSS" },
2391     { 0, NULL },
2392 };
2393 static value_string_ext bssgp_mbms_num_ra_ids_vals_ext = VALUE_STRING_EXT_INIT(bssgp_mbms_num_ra_ids_vals);
2394
2395 static guint16
2396 de_bssgp_mbms_ra_list(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2397 {
2398     proto_item *ti;
2399     proto_tree *rai_tree;
2400     guint32 curr_offset;
2401     guint8 num_ra_ids;
2402     int i;
2403
2404     curr_offset = offset;
2405
2406     /* octet 3 Number of Routing Area Identifications Spare Spare Spare Spare */
2407     num_ra_ids = tvb_get_guint8(tvb,curr_offset) >> 4;
2408     proto_tree_add_item(tree, hf_bssgp_mbms_num_ra_ids, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2409
2410     /* octet 4 - 11 Routing Area Identification 1 (etc)*/
2411     for (i = 0; i < num_ra_ids; i++) {
2412         ti = proto_tree_add_text(tree, tvb, curr_offset, 8, "Routing Area Identification (%u)", i + 1);
2413         rai_tree = proto_item_add_subtree(ti, ett_bssgp_ra_id);
2414
2415         /* The element is coded as the Routing Area Identification information element in
2416          * 3GPP TS 24.008, not including 3GPP TS 24.008 IEI and 3GPP TS 24.008 length indicator.
2417          */
2418         de_gmm_rai(tvb, rai_tree, pinfo, curr_offset , 6, NULL, 0);
2419
2420         curr_offset+=8;
2421     }
2422
2423     return(curr_offset-offset);
2424 }
2425
2426 /*
2427  * 11.3.76  MBMS Session Information
2428  */
2429
2430 static const true_false_string  tfs_bssgp_bc_mc = {
2431     "Multicast Session",
2432     "Broadcast Session"
2433 };
2434 static guint16
2435 de_bssgp_mbms_session_inf(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2436 {
2437     guint32 curr_offset;
2438
2439     curr_offset = offset;
2440
2441     /* MBMS Session Identity */
2442     proto_tree_add_item(tree, hf_bssgp_session_inf, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2443     curr_offset++;
2444
2445     return(curr_offset-offset);
2446 }
2447 /*
2448  * 11.3.77  TMGI (Temporary Mobile Group Identity)
2449  */
2450 /* Rest of element coded as in 3GPP TS 24.008, not including 3GPP
2451  * TS 24.008 IEI and 3GPP TS 24.008 length indicator.
2452  */
2453 /*
2454  * 11.3.78  MBMS Stop Cause
2455  */
2456 static const value_string bssgp_mbms_stop_cause_vals[] = {
2457     { 0, "MBMS Session terminated by upstream node" },
2458     { 1, "MBMS Session terminated by SGSN" },
2459
2460     { 2, "Unspecified in this version of the protocol" },
2461     { 3, "Unspecified in this version of the protocol" },
2462     { 4, "Unspecified in this version of the protocol" },
2463     { 5, "Unspecified in this version of the protocol" },
2464     { 6, "Unspecified in this version of the protocol" },
2465     { 7, "Unspecified in this version of the protocol" },
2466     { 8, "Unspecified in this version of the protocol" },
2467     { 9, "Unspecified in this version of the protocol" },
2468     { 10, "Unspecified in this version of the protocol" },
2469     { 11, "Unspecified in this version of the protocol" },
2470     { 12, "Unspecified in this version of the protocol" },
2471     { 13, "Unspecified in this version of the protocol" },
2472     { 14, "Unspecified in this version of the protocol" },
2473     { 15, "Unspecified in this version of the protocol" },
2474     { 0, NULL },
2475 };
2476 static value_string_ext bssgp_mbms_stop_cause_vals_ext = VALUE_STRING_EXT_INIT(bssgp_mbms_stop_cause_vals);
2477
2478 static guint16
2479 de_bssgp_mbms_stop_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2480 {
2481     guint32 curr_offset;
2482
2483     curr_offset = offset;
2484
2485     /* MBMS Session Identity */
2486     proto_tree_add_item(tree, hf_bssgp_mbms_stop_cause, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2487     curr_offset++;
2488
2489     return(curr_offset-offset);
2490 }
2491 /*
2492  * 11.3.79  Source BSS to Target BSS Transparent Container
2493  */
2494 /* The actual function moved to after defining the enums */
2495
2496 /*
2497  * 11.3.80  Target BSS to Source BSS Transparent Container
2498  */
2499 /*
2500  * 11.3.81  NAS container for PS Handover
2501  */
2502 /*
2503  * 11.3.82  PFCs to be set-up list
2504  */
2505 static guint16
2506 de_bssgp_pfcs_to_be_set_up_list(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2507 {
2508     proto_tree *pfc_tree, *pft_tree, *abqp_tree, *arp_tree, *t10_tree;
2509     proto_item *pi, *ti2;
2510
2511     guint32 curr_offset;
2512     guint8 num_pfc, i, pfc_len;
2513
2514     curr_offset = offset;
2515
2516     num_pfc = tvb_get_guint8(tvb, curr_offset);
2517     pi = proto_tree_add_text(tree, tvb, curr_offset, 1,
2518                "Number of PFCs: ");
2519
2520     if (num_pfc < 12) {
2521         proto_item_append_text(pi, "%u", num_pfc);
2522     }else {
2523         proto_item_append_text(pi, "Reserved");
2524         return (len);
2525     }
2526     curr_offset++;
2527     if (num_pfc == 0)
2528         return (curr_offset-offset);
2529
2530     pfc_len = (len - 1) / num_pfc;
2531
2532     for (i = 0; i < num_pfc; i++) {
2533         ti2 = proto_tree_add_text(tree, tvb, curr_offset, pfc_len,
2534                       "PFC (%u)", i + 1);
2535         pfc_tree = proto_item_add_subtree(ti2, ett_bssgp_pfcs_to_be_set_up_list);
2536
2537         de_sm_pflow_id(tvb, pfc_tree, pinfo, curr_offset, 1, NULL, 0);
2538         curr_offset++;
2539
2540         /* PFT: Packet Flow Timer. Coded as the GPRS Timer information element,
2541          * see sub-clause 11.3.44.
2542          */
2543         proto_tree_add_text(pfc_tree, tvb, curr_offset, 3, "Packet Flow Timer(PFT)");
2544         pft_tree = proto_item_add_subtree(ti2, ett_bssgp_pfcs_to_be_set_up_list_pft);
2545         proto_tree_add_item(pft_tree, hf_bssgp_unit_val, tvb, curr_offset, 3, ENC_BIG_ENDIAN);
2546         proto_tree_add_item(pft_tree, hf_bssgp_gprs_timer, tvb, curr_offset, 3, ENC_BIG_ENDIAN);
2547         curr_offset += 3;
2548
2549         /* ABQP: Aggregate BSS QoS Profile.
2550          * Coded as the Aggregate BSS QoS Profile information element, see sub-clause 11.3.43.
2551          */
2552         proto_tree_add_text(pfc_tree, tvb, curr_offset, 3, "Aggregate BSS QoS Profile(ABQP)");
2553         abqp_tree = proto_item_add_subtree(ti2, ett_bssgp_pfcs_to_be_set_up_list_abqp);
2554         /* Unsure about length 16 */
2555         curr_offset = curr_offset + de_sm_qos(tvb, abqp_tree, pinfo, curr_offset, 16, NULL, 0);
2556
2557         /* Allocation/Retention Priority: Allocation Retention Priority.
2558          * Coded as the Priority information element, see subclause 11.3.27.
2559          * This information element is optionally included.
2560          */
2561         if(pfc_len>17){
2562             proto_tree_add_text(pfc_tree, tvb, curr_offset, 3, "Allocation/Retention Priority");
2563             arp_tree = proto_item_add_subtree(ti2, ett_bssgp_pfcs_to_be_set_up_list_arp);
2564             curr_offset = curr_offset + be_prio(tvb, arp_tree, pinfo, curr_offset, 1, NULL, 0);
2565         }
2566         /* T10: T10.
2567          * Coded as the GPRS Timer information element, see sub-clause 11.3.44.
2568          * This information element shall be present for a PFC if the Allocation/Retention Priority
2569          * is present and if queuing is allowed for the PFC.
2570          */
2571         if(pfc_len>18){
2572             proto_tree_add_text(pfc_tree, tvb, curr_offset, 3, "T10");
2573             t10_tree = proto_item_add_subtree(ti2, ett_bssgp_pfcs_to_be_set_up_list_t10);
2574             proto_tree_add_item(t10_tree, hf_bssgp_unit_val, tvb, curr_offset, 3, ENC_BIG_ENDIAN);
2575             proto_tree_add_item(t10_tree, hf_bssgp_gprs_timer, tvb, curr_offset, 3, ENC_BIG_ENDIAN);
2576             curr_offset += 3;
2577         }
2578     }
2579     return(curr_offset-offset);
2580 }
2581 /*
2582  * 11.3.83  List of set-up PFCs
2583  */
2584 static guint16
2585 de_bssgp_list_of_setup_pfcs(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2586 {
2587     proto_tree *pfc_tree;
2588     proto_item *pi, *ti2;
2589
2590     guint32 curr_offset;
2591     guint8 num_pfc, i;
2592
2593     curr_offset = offset;
2594
2595     num_pfc = tvb_get_guint8(tvb, curr_offset);
2596     pi = proto_tree_add_text(tree, tvb, curr_offset, 1,
2597                "Number of PFCs: ");
2598
2599     if (num_pfc < 12) {
2600         proto_item_append_text(pi, "%u", num_pfc);
2601     }else {
2602         proto_item_append_text(pi, "Reserved");
2603         return (curr_offset-offset);
2604     }
2605     curr_offset++;
2606     if (num_pfc == 0)
2607         return (curr_offset-offset);
2608
2609     for (i = 0; i < num_pfc; i++) {
2610         ti2 = proto_tree_add_text(tree, tvb, curr_offset, 1,
2611                       "PFC (%u)", i + 1);
2612         pfc_tree = proto_item_add_subtree(ti2, ett_bssgp_list_of_setup_pfcs);
2613
2614         de_sm_pflow_id(tvb, pfc_tree, pinfo, curr_offset, 1, NULL, 0);
2615         curr_offset++;
2616
2617     }
2618
2619     return(curr_offset-offset);
2620 }
2621 /*
2622  * 11.3.84  Extended Feature Bitmap
2623  */
2624 static guint16
2625 de_bssgp_ext_feature_bitmap(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2626 {
2627     guint32 curr_offset;
2628
2629     curr_offset = offset;
2630
2631     /* Gigabit Interface */
2632     proto_tree_add_item(tree, hf_bssgp_gb_if, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2633     /* PS Handover */
2634     proto_tree_add_item(tree, hf_bssgp_ps_ho, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2635     curr_offset++;
2636
2637     return(curr_offset-offset);
2638 }
2639 /*
2640  * 11.3.85  Source to Target Transparent Container
2641  */
2642 static guint16
2643 de_bssgp_src_to_trg_transp_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2644 {
2645     guint32 curr_offset;
2646
2647     curr_offset = offset;
2648
2649     /* Octets 3-? Source to Target Transparent Container content coded as
2650      * specified in 3GPP TS 25.413 or 3GPP TS 36.413.
2651      * In inter-RAT handovers ... RANAP specification 3GPP TS 25.413, excluding RANAP tag.
2652      * In inter-RAT handover to E-UTRAN ... encoding is defined in 3GPP TS 36.413
2653      */
2654     proto_tree_add_item(tree, hf_bssgp_src_to_trg_transp_cont, tvb, curr_offset, len, ENC_NA);
2655
2656     return(len);
2657 }
2658
2659 /*
2660  * 11.3.86  Target to Source Transparent Container
2661  */
2662 static guint16
2663 de_bssgp_trg_to_src_transp_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2664 {
2665     guint32 curr_offset;
2666
2667     curr_offset = offset;
2668
2669     /* Rest of element coded as either a complete Handover to UTRAN
2670      * Command radio interface message (as defined in 3GPP TS
2671      * 25.331) or a complete Radio Bearer Reconfiguration radio
2672      * interface message (as defined in 3GPP TS 44.118) or a complete
2673      * DL-DCCH-Message including a complete
2674      * RRCConnectionReconfiguration radio interface message (as
2675      * defined in 3GPP TS 36.331)
2676      */
2677     proto_tree_add_item(tree, hf_bssgp_trg_to_src_transp_cont, tvb, curr_offset, len, ENC_NA);
2678
2679     return(len);
2680 }
2681
2682 /*
2683  * 11.3.87  RNC Identifier
2684  */
2685 static guint16
2686 de_bssgp_rnc_identifier(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2687 {
2688     guint32 curr_offset;
2689     guint16 rnc_id;
2690
2691     curr_offset = offset;
2692     /* Octets 3-8 Octets 3 to 8 contain the value part (starting with octet 2) of the
2693      * Routing Area Identification IE defined in 3GPP TS 24.008, not including 3GPP TS 24.008 IEI
2694      */
2695     curr_offset = curr_offset + de_gmm_rai(tvb, tree, pinfo, curr_offset, 6, add_string, string_len);
2696     /* Octet 9 - 10 RNC ID (or Extended RNC-ID or Corresponding RNC-ID) */
2697     rnc_id = tvb_get_ntohs(tvb, curr_offset);
2698     proto_tree_add_item(tree, hf_bssgp_rnc_id, tvb, curr_offset, 2, ENC_BIG_ENDIAN);
2699     curr_offset+=2;
2700
2701     if (add_string)
2702         g_snprintf(add_string, string_len, " %s, RNC-ID %u", add_string, rnc_id);
2703
2704     return(curr_offset-offset);
2705
2706 }
2707 /*
2708  * 11.3.88  Page Mode
2709  */
2710 /* PAGE_MODE (2 bit field) */
2711
2712 static const value_string bssgp_page_mode_vals[] = {
2713     { 0, "Normal Paging" },
2714     { 1, "Extended Paging" },
2715     { 2, "Paging Reorganization" },
2716     { 3, "Same as before" },
2717     { 0,    NULL },
2718 };
2719 static guint16
2720 de_bssgp_page_mode(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2721 {
2722     guint32 curr_offset;
2723
2724     curr_offset = offset;
2725
2726     proto_tree_add_item(tree, hf_bssgp_page_mode, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2727     curr_offset++;
2728
2729     return(curr_offset-offset);
2730 }
2731 /*
2732  * 11.3.89  Container ID
2733  */
2734 static guint16
2735 de_bssgp_container_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2736 {
2737     guint32 curr_offset;
2738
2739     curr_offset = offset;
2740
2741     proto_tree_add_item(tree, hf_bssgp_container_id, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2742     curr_offset++;
2743
2744     return(curr_offset-offset);
2745 }
2746
2747 /*
2748  * 11.3.90  Global TFI
2749  */
2750 static const value_string bssgp_global_tfi_vals[] = {
2751     { 0, "UPLINK_TFI" },
2752     { 1, "DOWNLINK_TFI" },
2753     { 0,    NULL },
2754 };
2755
2756 static guint16
2757 de_bssgp_global_tfi(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2758 {
2759     guint32 curr_offset;
2760     guint32 bit_offset;
2761     guint8  gtfi;
2762
2763     curr_offset = offset;
2764
2765     /* Bits 6 - 1 Global TFI coded as specified in 3GPP TS 44.060 */
2766     bit_offset = (curr_offset << 3) +3;
2767     gtfi = tvb_get_bits8(tvb,bit_offset,1);
2768     proto_tree_add_bits_item(tree, hf_bssgp_global_tfi, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2769     bit_offset++;
2770     /* < Global TFI IE > ::=
2771      *    { 0 < UPLINK_TFI : bit (5) >
2772      *    | 1 < DOWNLINK_TFI : bit (5) > } ;
2773      */
2774     if(gtfi == 0){
2775         /* UPLINK_TFI (5 bit field)
2776          * This field identifies an uplink TBF. This field is coded the same as the
2777          * TFI field defined in sub-clause 12.15.
2778          * This field is encoded as a binary number. Range 0 to 31
2779          */
2780         proto_tree_add_bits_item(tree, hf_bssgp_ul_tfi, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2781     }else{
2782         /* DOWNLINK_TFI (5 bit field)
2783          * This field identifies an uplink TBF. This field is coded the same as the
2784          * TFI field defined in sub-clause 12.15.
2785          * This field is encoded as a binary number. Range 0 to 31
2786          */
2787         proto_tree_add_bits_item(tree, hf_bssgp_dl_tfi, tvb, bit_offset, 1, ENC_BIG_ENDIAN);
2788     }
2789     curr_offset++;
2790
2791     return(curr_offset-offset);
2792 }
2793 /*
2794  * 11.3.91  IMEI
2795  */
2796 /* Octets 3-10 contain the IMEI coded as the value part of the Mobile
2797  * Identity IE defined in 3GPP TS 24.008
2798  * (NOTE 1)
2799  */
2800 /*
2801  * 11.3.92  Time to MBMS Data Transfer
2802  */
2803 static guint16
2804 de_bssgp_time_to_MBMS_data_tran(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2805 {
2806     guint32 curr_offset;
2807     guint8 value;
2808
2809     curr_offset = offset;
2810
2811     /* 0 = 1s etc */
2812     value = tvb_get_guint8(tvb,curr_offset) + 1;
2813     proto_tree_add_uint(tree, hf_bssgp_time_to_MBMS_data_tran, tvb, curr_offset, 1, value);
2814
2815     return(len);
2816 }
2817 /*
2818  * 11.3.93  MBMS Session Repetition Number
2819  */
2820 static guint16
2821 de_bssgp_mbms_session_rep_no(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2822 {
2823     guint32 curr_offset;
2824
2825     curr_offset = offset;
2826
2827     proto_tree_add_item(tree, hf_bssgp_mbms_session_rep_no, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2828     curr_offset++;
2829
2830     return(len);
2831 }
2832 /*
2833  * 11.3.94  Inter RAT Handover Info
2834  */
2835 static guint16
2836 de_bssgp_inter_rat_ho_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2837 {
2838     tvbuff_t    *new_tvb;
2839     guint32 curr_offset;
2840
2841     curr_offset = offset;
2842
2843     new_tvb = tvb_new_subset_remaining(tvb, curr_offset);
2844     /*
2845      * Inter RAT Handover Information coded as specified in 3GPP
2846      * Technical Specification 25.331
2847      */
2848     dissect_rrc_InterRATHandoverInfo_PDU(new_tvb, gpinfo, tree);
2849
2850     return(len);
2851 }
2852 /*
2853  * 11.3.95  PS Handover Command
2854  */
2855 static guint16
2856 de_bssgp_ps_ho_cmd(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2857 {
2858     guint32 curr_offset;
2859
2860     curr_offset = offset;
2861
2862     /* Octet 3-? Rest of element coded as a complete PS Handover Command
2863     * radio interface message as defined in 3GPP TS 44.060 (carrying
2864     * the PS Handover to A/Gb Mode Payload)
2865     */
2866     proto_tree_add_item(tree, hf_bssgp_ps_ho_cmd, tvb, curr_offset, len, ENC_NA);
2867
2868
2869     return(len);
2870 }
2871
2872 /*
2873  * 11.3.95a PS Handover Indications
2874  */
2875 static guint16
2876 de_bssgp_ps_ho_indications(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2877 {
2878     guint32 curr_offset;
2879
2880     curr_offset = offset;
2881
2882     /* SI/PSI */
2883     proto_tree_add_item(tree, hf_bssgp_sipsi, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2884     curr_offset++;
2885
2886     return(curr_offset-offset);
2887 }
2888
2889 /*
2890  * 11.3.95b SI/PSI Container
2891  */
2892
2893 static const value_string type_vals[] = {
2894     { 0, "SI messages as specified for BCCH (3GPP TS 44.018) follow" },
2895     { 1, "PSI messages as specified for PBCCH (3GPP TS 44.060) follow" },
2896     { 0,    NULL },
2897 };
2898 static guint16
2899 de_bssgp_sipsi_container(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2900 {
2901     guint32 curr_offset;
2902     guint8 oct,num, type, i;
2903
2904     curr_offset = offset;
2905
2906     oct = tvb_get_guint8(tvb, curr_offset);
2907     num = oct >>1;
2908     type = oct & 1;
2909     proto_tree_add_text(tree, tvb, curr_offset, 1,
2910                "Number of SI/PSI: %u",num);
2911
2912     /* Type */
2913     proto_tree_add_item(tree, hf_bssgp_type, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
2914     curr_offset++;
2915     if (type==0){
2916         /* BCCH (3GPP TS 44.018) */
2917         for (i = 0; i < num; i++) {
2918             proto_tree_add_text(tree, tvb, curr_offset, 21, "SI (%u)", i + 1);
2919             curr_offset+=21;
2920         }
2921     }else{
2922         /* PBCCH (3GPP TS 44.060) */
2923         for (i = 0; i < num; i++) {
2924             proto_tree_add_text(tree, tvb, curr_offset, 22, "PSI (%u)", i + 1);
2925             curr_offset+=22;
2926         }
2927     }
2928
2929     return(curr_offset-offset);
2930 }
2931 /*
2932  * 11.3.95c Active PFCs List
2933  */
2934 static guint16
2935 de_bssgp_active_pfcs_list(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2936 {
2937     proto_tree *pfc_tree;
2938     proto_item *pi, *ti2;
2939
2940     guint32 curr_offset;
2941     guint8 num_pfc, i;
2942
2943     curr_offset = offset;
2944
2945     num_pfc = tvb_get_guint8(tvb, curr_offset);
2946     pi = proto_tree_add_text(tree, tvb, curr_offset, 1,
2947                "Number of PFCs: ");
2948
2949     if (num_pfc < 12) {
2950         proto_item_append_text(pi, "%u", num_pfc);
2951     }else {
2952         proto_item_append_text(pi, "Reserved");
2953         return (curr_offset-offset);
2954     }
2955     curr_offset++;
2956     if (num_pfc == 0)
2957         return (curr_offset-offset);
2958
2959     for (i = 0; i < num_pfc; i++) {
2960         ti2 = proto_tree_add_text(tree, tvb, curr_offset, 1, "PFC (%u)", i + 1);
2961         pfc_tree = proto_item_add_subtree(ti2, ett_bssgp_pfc_flow_control_parameters_pfc);
2962
2963         de_sm_pflow_id(tvb, pfc_tree, pinfo, curr_offset, 1, NULL, 0);
2964         curr_offset++;
2965
2966     }
2967
2968     return(curr_offset-offset);
2969 }
2970 /*
2971  * 11.3.96  Velocity Data
2972  */
2973 static guint16
2974 de_bssgp_velocity_data(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string, int string_len)
2975 {
2976     guint32 curr_offset;
2977
2978     curr_offset = offset;
2979
2980     /* The rest of the information element contains an octet sequence
2981      * identical to that for Description of Velocity defined in 3GPP TS
2982      * 23.032.
2983      */
2984     curr_offset = dissect_description_of_velocity(tvb, tree, pinfo, curr_offset, len, add_string, string_len);
2985
2986     return(curr_offset-offset);
2987 }
2988 /*
2989  * 11.3.97  DTM Handover Command
2990  */
2991 static guint16
2992 de_bssgp_dtm_ho_cmd(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
2993 {
2994     guint32 curr_offset;
2995
2996     curr_offset = offset;
2997
2998     /* Rest of element coded as a complete DTM Handover Command
2999      * radio interface message as defined in 3GPP TS 44.060 (carrying
3000      * the DTM Handover to A/Gb Mode Payload)
3001      */
3002     proto_tree_add_text(tree, tvb, curr_offset, len, "DTM Handover Command data");
3003
3004     return(len);
3005 }
3006 /*
3007  * 11.3.98  CS Indication
3008  */
3009 static guint16
3010 de_bssgp_cs_indication(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3011 {
3012     guint32 curr_offset;
3013
3014     curr_offset = offset;
3015
3016     /* CS Indication Contents
3017      * CS Indication Contents: This identifies a particular handover attempt for this MS. This shall be identical to the PS
3018      * Indication Contents value in the corresponding PS Indication IE included in the Old BSS to New BSS Information IE
3019      * (see 3GPP TS 48.008). The choice of the value of this field is implementation specific, with the requirement that
3020      * consecutive handover attempts for the same mobile station shall not have the same CS Indication Contents value.
3021      */
3022     proto_tree_add_item(tree, hf_bssgp_cs_indication, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3023     curr_offset++;
3024
3025     return(curr_offset-offset);
3026 }
3027 /*
3028  * 11.3.99  Requested GANSS Assistance Data
3029  */
3030 /* Rest of element coded as the value part defined in
3031  * 3GPP TS 49.031, not including 3GPP TS 49.031 IEI and
3032  * 3GPP TS 49.031 octet length indicator
3033  */
3034 /*
3035  * 11.3.100     GANSS Location Type
3036  */
3037 /* Rest of element coded as the value part defined in
3038  * 3GPP TS 49.031, not including 3GPP TS 49.031 IEI and
3039  * 3GPP TS 49.031 octet length indicator
3040  */
3041 /*
3042  * 11.3.101     GANSS Positioning Data
3043  */
3044 /* Rest of element coded as the value part defined in
3045  * 3GPP TS 49.031, not including 3GPP TS 49.031 IEI and
3046  * 3GPP TS 49.031 octet length indicator
3047  */
3048 /*
3049  * 11.3.102     Flow Control Granularity
3050  */
3051 static const value_string bssgp_flow_control_gran_vals[] = {
3052     { 0, "100 octets or bits/s increments" },
3053     { 1, "1000 octets or bits/s increments" },
3054     { 2, "10000 octets or bits/s increments" },
3055     { 3, "100000 octets or bits/s increments" },
3056     { 0,    NULL },
3057 };
3058
3059
3060 static guint16
3061 de_bssgp_flow_control_gran(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3062 {
3063     guint32 curr_offset;
3064
3065     curr_offset = offset;
3066
3067     /* Granularity */
3068     proto_tree_add_item(tree, hf_bssgp_flow_control_gran, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3069     curr_offset++;
3070
3071     return(curr_offset-offset);
3072 }
3073 /*
3074  * 11.3.103     eNB Identifier
3075  */
3076 static guint16
3077 de_bssgp_enb_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string, int string_len)
3078 {
3079     tvbuff_t    *new_tvb;
3080     guint32 curr_offset;
3081
3082     curr_offset = offset;
3083
3084     /* Octets 3 to 7 contain the value part (starting with octet 2) of the
3085      * Tracking Area Identity IE defined in 3GPP TS 24.301 [37], not
3086      * including 3GPP TS 24.301 IEI [37]
3087     */
3088     curr_offset = curr_offset+ de_emm_trac_area_id(tvb, tree, pinfo, curr_offset, 5, add_string, string_len);
3089
3090     /* Octets 8-n contain the Global eNB ID (see 3GPP TS 36.413) of the eNodeB. */
3091     new_tvb = tvb_new_subset_remaining(tvb, curr_offset);
3092     dissect_s1ap_Global_ENB_ID_PDU(new_tvb, gpinfo, tree);
3093
3094     return(len);
3095 }
3096 /*
3097  * 11.3.104     E-UTRAN Inter RAT Handover Info
3098  */
3099 static guint16
3100 de_bssgp_e_utran_inter_rat_ho_info(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3101 {
3102     tvbuff_t    *new_tvb;
3103     guint32 curr_offset;
3104
3105     curr_offset = offset;
3106
3107     new_tvb = tvb_new_subset_remaining(tvb, curr_offset);
3108     /*
3109      * Formatted and coded according to the UE-EUTRA-Capability IE
3110      * defined in 3GPP Technical Specification 36.331. The most
3111      * significant bit of the first octet of the octet string contains bit 8 of
3112      * the first octet of the IE.
3113      */
3114     dissect_lte_rrc_UE_EUTRA_Capability_PDU(new_tvb, gpinfo, tree);
3115
3116     return(len);
3117 }
3118 /*
3119  * 11.3.105     Subscriber Profile ID for RAT/Frequency priority
3120  */
3121
3122 static guint16
3123 de_bssgp_sub_prof_id_f_rat_freq_prio(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3124 {
3125     guint32 curr_offset;
3126     guint8 value;
3127
3128     curr_offset = offset;
3129
3130     /* Octet 3 contains a number in binary representation ranging from 0 to 255.
3131      * The Subscriber Profile ID for RAT/Frequency priority is given by
3132      * the indicated value +1.
3133      */
3134     value = tvb_get_guint8(tvb,curr_offset) + 1;
3135     proto_tree_add_uint(tree, hf_bssgp_sub_prof_id_f_rat_freq_prio, tvb, curr_offset, 1, value);
3136     curr_offset++;
3137
3138     return(curr_offset-offset);
3139 }
3140 /*
3141  * 11.3.106     Request for Inter-RAT Handover Info
3142  */
3143 static guint16
3144 de_bssgp_req_for_inter_rat_ho_inf(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3145 {
3146     guint32 curr_offset;
3147
3148     curr_offset = offset;
3149
3150     /*octet 3 Spare E-UTRAN Inter RAT Handover Info Req Inter RAT Handover Info Req */
3151     proto_tree_add_item(tree, hf_bssgp_eutran_irat_ho_inf_req, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3152     proto_tree_add_item(tree, hf_bssgp_irat_ho_inf_req, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3153     curr_offset++;
3154
3155     return(curr_offset-offset);
3156 }
3157 /*
3158  * 11.3.107     Reliable Inter-RAT Handover Info
3159  */
3160 static guint16
3161 de_bssgp_reliable_inter_rat_ho_inf(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3162 {
3163     guint32 curr_offset;
3164
3165     curr_offset = offset;
3166
3167     /* Reliable Inter RAT Handover Info Indicator */
3168     proto_tree_add_item(tree, hf_bssgp_rel_int_rat_ho_inf_ind, tvb, curr_offset, 1, ENC_BIG_ENDIAN);
3169     curr_offset++;
3170
3171     return(curr_offset-offset);
3172 }
3173 /*
3174  * 11.3.108     SON Transfer Application Identity
3175  */
3176 static guint16
3177 de_bssgp_son_transfer_app_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset _U_, guint len _U_, gchar *add_string _U_, int string_len _U_)
3178 {
3179     /* SON Transfer Application Identity: This field is encoded as the SON Transfer Application Identity IE
3180      * as defined in 3GPP TS 36.413
3181      */
3182     dissect_s1ap_SONtransferApplicationIdentity_PDU(tvb, gpinfo, tree);
3183
3184     return(len);
3185 }
3186 /*
3187  * 11.3.109     CSG Identifier
3188  */
3189
3190 /* Cell Access Mode (bit 1 of octet 7) */
3191 static const value_string bssgp_cell_access_mode_vals[] = {
3192     { 0, "CSG cell" },
3193     { 1, "Hybrid cell" },
3194     { 0,    NULL },
3195 };
3196
3197 static guint16
3198 de_bssgp_csg_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3199 {
3200     guint32 curr_offset;
3201
3202     curr_offset = offset;
3203
3204     /* Octets 3 to 6 contain the CSG Identity (CSG-ID) of the cell (defined in
3205      * 3GPP TS 23.003) as reported by the mobile station (see 3GPP TS
3206      * 44.060). Bits 4 to 8 of octet 6 are spare and set to zero.
3207      */
3208     proto_tree_add_item(tree, hf_bssgp_csg_id, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
3209     curr_offset+=4;
3210     /* Cell Access Mode */
3211     proto_tree_add_item(tree, hf_bssgp_cell_acc_mode, tvb, curr_offset, 4, ENC_BIG_ENDIAN);
3212     curr_offset++;
3213
3214     return(curr_offset-offset);
3215 }
3216 /*
3217  * 11.3.110     Tracking Area Code
3218  */
3219 /*
3220  * Octets 3 to 5 contain the value part (starting with octet 2) of the TAC
3221  * IE defined in 3GPP TS 24.301.
3222  */
3223 /*
3224  * 11.3.111     Redirect Attempt Flag
3225  * 11.3.112     Redirection Indication
3226  * 11.3.113     Redirection Completed
3227 */
3228
3229
3230 const value_string bssgp_elem_strings[] = {
3231     { 0x00, "Alignment Octets" },                                   /* 11.3.1   Alignment octets */
3232     { 0x01, "Bmax default MS" },                                    /* 11.3.2   Bmax default MS  */
3233     { 0x02, "BSS Area Indication" },                                /* 11.3.3   BSS Area Indication  */
3234     { 0x03, "Bucket Leak Rate (R)" },                               /* 11.3.4   Bucket Leak Rate (R) */
3235     { 0x04, "BVCI (BSSGP Virtual Connection Identifier)" },         /* 11.3.6   BVCI (BSSGP Virtual Connection Identifier)  */
3236     { 0x05, "BVC Bucket size" },                                    /* 11.3.5   BVC Bucket Size */
3237     { 0x06, "BVC Measurement" },                                    /* 11.3.7   BVC Measurement */
3238     { 0x07, "Cause" },                                              /* 11.3.8   Cause */
3239     { 0x08, "Cell Identifier" },                                    /* 11.3.9   Cell Identifier */
3240     { 0x09, "Channel needed" },                                     /* 11.3.10  Channel needed */
3241     { 0x0a, "DRX Parameters" },                                     /* 11.3.11  DRX Parameters */
3242     { 0x0b, "eMLPP-Priority" },                                     /* 11.3.12  eMLPP-Priority */
3243     { 0x0c, "Flush Action" },                                       /* 11.3.13  Flush Action */
3244     { 0x0d, "IMSI" },                                               /* 11.3.14  IMSI */
3245     { 0x0e, "LLC-PDU" },                                            /* 11.3.15  LLC-PDU */
3246     { 0x0f, "LLC Frames Discarded" },                               /* 11.3.16  LLC Frames Discarded  */
3247     { 0x10, "Location Area" },                                      /* 11.3.17  Location Area  */
3248     { 0x11, "Mobile Id" },                                          /* 11.3.20  Mobile Id */
3249     { 0x12, "MS Bucket Size" },                                     /* 11.3.21  MS Bucket Size */
3250     { 0x13, "MS Radio Access Capability" },                         /* 11.3.22  MS Radio Access Capability GSM_A_PDU_TYPE_GM, DE_MS_RAD_ACC_CAP */
3251     { 0x14, "OMC Id" },                                             /* 11.3.23  OMC Id */
3252     { 0x15, "PDU In Error" },                                       /* 11.3.24  PDU In Error */
3253     { 0x16, "PDU Lifetime" },                                       /* 11.3.25  PDU Lifetime */
3254     { 0x17, "Priority" },                                           /* 11.3.27  Priority */
3255     { 0x18, "QoS Profile" },                                        /* 11.3.28  QoS Profile */
3256     { 0x19, "Radio Cause" },                                        /* 11.3.29  Radio Cause */
3257     { 0x1a, "RA-Cap-UPD-Cause" },                                   /* 11.3.30  RA-Cap-UPD-Cause */
3258     { 0x1b, "Routeing Area" },                                      /* 11.3.31  Routeing Area */
3259     { 0x1c, "R_default_MS" },                                       /* 11.3.32  R_default_MS */
3260     { 0x1d, "Suspend Reference Number" },                           /* 11.3.33  Suspend Reference Number */
3261     { 0x1e, "Tag" },                                                /* 11.3.34  Tag */
3262     { 0x1f, "Temporary logical link Identity (TLLI)" },             /* 11.3.35  Temporary logical link Identity (TLLI) GSM_A_PDU_TYPE_RR, DE_RR_TLLI*/
3263     { 0x20, "Temporary Mobile Subscriber Identity (TMSI)" },        /* 11.3.36  Temporary Mobile Subscriber Identity (TMSI)GSM_A_PDU_TYPE_RR, DE_RR_TMSI_PTMSI */
3264     { 0x21, "Trace Reference" },                                    /* 11.3.37  Trace Reference */
3265     { 0x22, "Trace Type" },                                         /* 11.3.38  Trace Type */
3266     { 0x23, "Transaction Id" },                                     /* 11.3.39  Transaction Id */
3267     { 0x24, "Trigger Id" },                                         /* 11.3.40  Trigger Id */
3268     { 0x25, "Number of octets affected" },                          /* 11.3.41  Number of octets affected */
3269     { 0x26, "LSA Identifier List" },                                /* 11.3.18  LSA Identifier List */
3270     { 0x27, "LSA Information" },                                    /* 11.3.19  LSA Information */
3271     { 0x28, "Packet Flow Identifier (PFI)" },                       /* 11.3.42  Packet Flow Identifier (PFI) GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID*/
3272                                                                     /* 11.3.42a (void) */
3273     { 0x29, "GPRS Timer" },                                         /* 11.3.44  GPRS Timer */
3274     { 0x3a, "Aggregate BSS QoS Profile" },                          /* 11.3.43  Aggregate BSS QoS Profile GSM_A_PDU_TYPE_GM, DE_QOS*/
3275     { 0x3b, "Feature Bitmap" },                                     /* 11.3.45  Feature Bitmap */
3276     { 0x3c, "Bucket Full Ratio" },                                  /* 11.3.46  Bucket Full Ratio */
3277     { 0x3d, "Service UTRAN CCO" },                                  /* 11.3.47  Service UTRAN CCO */
3278     { 0x3e, "NSEI (Network Service Entity Identifier)" },           /* 11.3.48  NSEI (Network Service Entity Identifier) */
3279     { 0x00, "RRLP APDU" },                                          /* 11.3.49 RRLP APDU */
3280                                                                     /* 11.3.50  LCS QoS BSSGP_IEI_LCS_QOS, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_LCSQOS*/
3281                                                                     /* 11.3.51  LCS Client Type BSSGP_IEI_LCS_CLIENT_TYPE, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_LCS_CLIENT_TYPE*/
3282                                                                     /* 11.3.52  Requested GPS Assistance Data BSSGP_IEI_REQUESTED_GPS_ASSISTANCE_DATA, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_REQ_GPS_ASSIST_D*/
3283                                                                     /* 11.3.53  Location Type 0x7c, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_GANSS_LOC_TYPE*/
3284                                                                     /* 11.3.54  Location Estimate BSSGP_IEI_LOCATION_ESTIMATE, GSM_A_PDU_TYPE_BSSMAP, BE_LOC_EST*/
3285                                                                     /* 11.3.55  Positioning Data 0x7d, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_POS_DATA*/
3286                                                                     /* 11.3.56  Deciphering Keys BSSGP_IEI_DECIPHERING_KEYS, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_DECIPH_KEYS */
3287                                                                     /* 11.3.57  LCS Priority BSSGP_IEI_LCS_PRIORITY, GSM_A_PDU_TYPE_BSSMAP, BE_LCS_PRIO;*/
3288                                                                     /* 11.3.58  LCS Cause BSSGP_IEI_LCS_CAUSE, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_LCS_CAUSE */
3289                                                                     /* 11.3.59  LCS Capability 0x49 , GSM_A_PDU_TYPE_GM, DE_PS_LCS_CAP*/
3290     { 0x00, "RRLP Flags" },                                         /* 11.3.60  RRLP Flags */
3291     { 0x00, "RIM Application Identity" },                           /* 11.3.61  RIM Application Identity */
3292     { 0x00, "RIM Sequence Number" },                                /* 11.3.62  RIM Sequence Number */
3293  /* 11.3.62a    RIM Container */
3294  /* 11.3.62a.0  General */
3295     { 0x00, "RAN-INFORMATION-REQUEST RIM Container" },              /* 11.3.62a.1   RAN-INFORMATION-REQUEST RIM Container */
3296     { 0x00, "RAN-INFORMATION RIM Container" },                      /* 11.3.62a.2   RAN-INFORMATION RIM Container */
3297     { 0x00, "RAN-INFORMATION-ACK RIM Container" },                  /* 11.3.62a.3   RAN-INFORMATION-ACK RIM Container */
3298     { 0x00, "RAN-INFORMATION-ERROR RIM Container" },                /* 11.3.62a.4   RAN-INFORMATION-ERROR RIM Container */
3299     { 0x00, "RAN-INFORMATION-APPLICATION-ERROR RIM Container" },    /* 11.3.62a.5   RAN-INFORMATION-APPLICATION-ERROR RIM Container */
3300  /* 11.3.63 Application Container */
3301     { 0x00, "RAN-INFORMATION-REQUEST Application Container" },      /* 11.3.63.1    RAN-INFORMATION-REQUEST Application Container */
3302  /* 11.3.63.1.0 General */
3303  /* 11.3.63.1.1 RAN-INFORMATION-REQUEST Application Container for the NACC Application */
3304  /* 11.3.63.1.2 RAN-INFORMATION-REQUEST Application Container for the SI3 Application */
3305  /* 11.3.63.1.3 RAN-INFORMATION-REQUEST Application Container for the MBMS data channel Application */
3306  /* 11.3.63.1.4 RAN-INFORMATION-REQUEST Application Container for the SON Transfer Application */
3307     { 0x00, "RAN-INFORMATION Application Container Unit" },         /* 11.3.63.2    RAN-INFORMATION Application Container Unit */
3308  /* 11.3.63.2.0 General */
3309  /* 11.3.63.2.1 RAN-INFORMATION Application Container for the NACC Application */
3310  /* 11.3.63.2.2 RAN-INFORMATION Application Container for the SI3 Application */
3311  /* 11.3.63.2.3 RAN-INFORMATION Application Container for the MBMS data channel Application */
3312  /* 11.3.63.2.4 RAN-INFORMATION Application Container for the SON Transfer Application */
3313     { 0x00, "Application Error Container" },                        /* 11.3.64  Application Error Container */
3314  /* 11.3.64.1   Application Error Container layout for the NACC application */
3315  /* 11.3.64.2   Application Error Container for the SI3 application */
3316  /* 11.3.64.3   Application Error Container for the MBMS data channel application */
3317  /* 11.3.64.4   Application Error Container for the SON Transfer Application */
3318     { 0x00, "RIM PDU Indications" },                                /* 11.3.65  RIM PDU Indications */
3319  /* 11.3.65.0   General */
3320  /* 11.3.65.1   RAN-INFORMATION-REQUEST RIM PDU Indications */
3321  /* 11.3.65.2   RAN-INFORMATION RIM PDU Indications */
3322  /* 11.3.65.3   RAN-INFORMATION-APPLICATION-ERROR RIM PDU Indications */
3323  /* 11.3.66 (void) */
3324     { 0x00, "RIM Protocol Version Number" },                            /* 11.3.67  RIM Protocol Version Number */
3325     { 0x00, "PFC Flow Control parameters" },                        /* 11.3.68  PFC Flow Control parameters */
3326  /* 0x53, SGSAP_PDU_TYPE, DE_SGSAP_GLOBAL_CN_ID */                  /* 11.3.69  Global CN-Id */
3327     { 0x00, "RIM Routing Information" },                            /* 11.3.70  RIM Routing Information */
3328     { 0x00, "MBMS Session Identity" },                              /* 11.3.71 MBMS Session Identity */
3329     { 0x00, "MBMS Session Duration" },                              /* 11.3.72  MBMS Session Duration */
3330     { 0x00, "MBMS Service Area Identity List" },                    /* 11.3.73  MBMS Service Area Identity List */
3331     { 0x00, "MBMS Response" },                                      /* 11.3.74  MBMS Response */
3332     { 0x00, "MBMS Routing Area List" },                             /* 11.3.75  MBMS Routing Area List */
3333     { 0x00, "MBMS Session Information" },                           /* 11.3.76  MBMS Session Information */
3334  /* ELEM_MAND_TELV(GSM_A_PDU_TYPE_GM, DE_TMGI,  */                  /* 11.3.77  TMGI (Temporary Mobile Group Identity) */
3335     { 0x00, "MBMS Stop Cause" },                                    /* 11.3.78  MBMS Stop Cause */
3336     { 0x00, "Source BSS to Target BSS Transparent Container" },     /* 11.3.79  Source BSS to Target BSS Transparent Container */
3337     { 0x00, "Target BSS to Source BSS Transparent Container" },     /* 11.3.80  Target BSS to Source BSS Transparent Container */
3338  /* 11.3.81 NAS container for PS Handover */
3339     { 0x00, "PFCs to be set-up list" },                             /* 11.3.82  PFCs to be set-up list */
3340     { 0x00, "List of set-up PFCs" },                                /* 11.3.83  List of set-up PFCs */
3341     { 0x00, "Extended Feature Bitmap" },                            /* 11.3.84  Extended Feature Bitmap */
3342     { 0x00, "Source to Target Transparent Container" },             /* 11.3.85  Source to Target Transparent Container */
3343     { 0x00, "Target to Source Transparent Container" },             /* 11.3.86  Target to Source Transparent Container */
3344     { 0x00, "RNC Identifier" },                                     /* 11.3.87  RNC Identifier */
3345     { 0x00, "Page Mode" },                                          /* 11.3.88  Page Mode */
3346     { 0x00, "Container ID" },                                       /* 11.3.89  Container ID */
3347     { 0x00, "Global TFI" },                                         /* 11.3.90  Global TFI */
3348  /* 11.3.91 IMEI */
3349     { 0x00, "Time to MBMS Data Transfer" },                         /* 11.3.92  Time to MBMS Data Transfer */
3350     { 0x00, "MBMS Session Repetition Number" },                     /* 11.3.93  MBMS Session Repetition Number */
3351     { 0x00, "Inter RAT Handover Info" },                            /* 11.3.94  Inter RAT Handover Info */
3352     { 0x00, "PS Handover Command" },                                /* 11.3.95  PS Handover Command */
3353     { 0x00, "PS Handover Indications" },                            /* 11.3.95a PS Handover Indications */
3354     { 0x00, "SI/PSI Container" },                                   /* 11.3.95b SI/PSI Container */
3355     { 0x00, "Active PFCs List" },                                   /* 11.3.95c Active PFCs List */
3356     { 0x00, "Velocity Data" },                                      /* 11.3.96  Velocity Data */
3357     { 0x00, "DTM Handover Command" },                               /* 11.3.97  DTM Handover Command */
3358     { 0x00, "PS Handover Indications" },                            /* 11.3.98  CS Indication */
3359                                                                     /* 11.3.99  Requested GANSS Assistance Data 0x7b, GSM_A_PDU_TYPE_BSSMAP, BE_GANSS_ASS_DTA*/
3360                                                                     /* 11.3.100     GANSS Location Type 0x7c, GSM_A_PDU_TYPE_BSSMAP, BE_GANSS_LOC_TYP*/
3361                                                                     /* 11.3.101     GANSS Positioning Data ENC_BIG_ENDIAN);*/
3362     { 0x00, "Flow Control Granularity" },                           /* 11.3.102     Flow Control Granularity */
3363     { 0x00, "eNB Identifier" },                                     /* 11.3.103     eNB Identifier */
3364     { 0x00, "E-UTRAN Inter RAT Handover Info" },                    /* 11.3.104     E-UTRAN Inter RAT Handover Info */
3365     { 0x00, "Subscriber Profile ID for RAT/Frequency priority" },   /* 11.3.105 Subscriber Profile ID for RAT/Frequency priority */
3366     { 0x00, "Request for Inter-RAT Handover Info" },                /* 11.3.106 Request for Inter-RAT Handover Info */
3367     { 0x00, "Reliable Inter-RAT Handover Info" },                   /* 11.3.107 Reliable Inter-RAT Handover Info */
3368     { 0x00, "Reliable Inter-RAT Handover Info" },                   /* 11.3.108 SON Transfer Application Identity */
3369     { 0x00, "CSG Identifier" },                                     /* 11.3.109 CSG Identifier */
3370 /* 11.3.110 Tracking Area Code */
3371
3372     { 0, NULL }
3373 };
3374
3375 #define NUM_BSSGP_ELEM (sizeof(bssgp_elem_strings)/sizeof(value_string))
3376 gint ett_bssgp_elem[NUM_BSSGP_ELEM];
3377
3378
3379 typedef enum
3380 {
3381     DE_BSSGP_ALIGNMENT_OCTETS,                                  /* 11.3.1   0x00 Alignment octets */
3382     DE_BSSGP_BMAX_DEFAULT_MS,                                   /* 11.3.2   0x01 Bmax default MS  */
3383     DE_BSSGP_BSS_AREA_IND,                                      /* 11.3.3   0x02 BSS Area Indication */
3384     DE_BSSGP_BUCKET_LEAK_RATE,                                  /* 11.3.4   0x03 Bucket Leak Rate (R) */
3385     DE_BSSGP_BVCI,                                              /* 11.3.6   0x04 BVCI (BSSGP Virtual Connection Identifier)  */
3386     DE_BSSGP_BVC_BUCKET_SIZE,                                   /* 11.3.5   0x05 BVC Bucket Size */
3387     DE_BSSGP_BVC_MEAS,                                          /* 11.3.7   0x06 BVC Measurement */
3388     DE_BSSGP_CAUSE,                                             /* 11.3.8   0x07 Cause */
3389     DE_BSSGP_CELL_ID,                                           /* 11.3.9   0x08 Cell Identifier */
3390     DE_BSSGP_CHLN_NEEDED,                                       /* 11.3.10  0x09 Channel needed */
3391     DE_BBSGP_DRX_PARAM,                                         /* 11.3.11  0x0a DRX Parameters GSM_A_PDU_TYPE_GM, DE_DRX_PARAM */
3392     DE_BBSGP_EMLPP_PRIO,                                        /* 11.3.12  0x0b eMLPP-Priority GSM_A_PDU_TYPE_BSSMAP, BE_EMLPP_PRIO*/
3393     DE_BSSGP_FLUSH_ACTION,                                      /* 11.3.13  0x0c Flush Action */
3394     DE_BSSGP_IMSI,                                              /* 11.3.14  0x0d IMSI */
3395     DE_BSSGP_LLC_PDU,                                           /* 11.3.15  0x0e LLC-PDU */
3396     DE_BSSGP_LLC_FRAMES_DISC,                                   /* 11.3.16  0x0f LLC Frames Discarded  */
3397     DE_BSSGP_LAI    ,                                           /* 11.3.17  0x10 Location Area  GSM_A_PDU_TYPE_COMMON, DE_LAI*/
3398     DE_BSSGP_MID,                                               /* 11.3.20  0x11 Mobile Id GSM_A_PDU_TYPE_COMMON, DE_MID*/
3399     DE_BSSGP_MS_BUCKET_SIZE,                                    /* 11.3.21  0x12 MS Bucket Size */
3400     DE_BSSGP_MS_RAD_ACC_CAP,                                    /* 11.3.22  0x13 MS Radio Access Capability GSM_A_PDU_TYPE_GM, DE_MS_RAD_ACC_CAP*/
3401     DE_BSSGP_OMC_ID,                                            /* 11.3.23  0x14 OMC Id */
3402     DE_BSSGP_PDU_IN_ERROR,                                      /* 11.3.24  0x15 PDU In Error */
3403     DE_BSSGP_PDU_LIFETIME,                                      /* 11.3.25  0x16 PDU Lifetime */
3404     DE_BSSP_PRIORITY,                                           /* 11.3.27  0x17    Priority */
3405     DE_BSSGP_QOS_PROFILE,                                       /* 11.3.28  0x18 QoS Profile */
3406     DE_BSSGP_RA_CAUSE,                                          /* 11.3.29  0x19 Radio Cause */
3407     DE_BSSGP_RA_CAP_UPD_CAUSE,                                  /* 11.3.30  0x1a RA-Cap-UPD-Cause */
3408     DE_BSSGP_RAI,                                               /* 11.3.31  0x1b Routeing Area GSM_A_PDU_TYPE_GM, DE_RAI*/
3409     DE_BSSGP_R_DEFAULT_MS,                                      /* 11.3.32  0x1c R_default_MS */
3410     DE_BBSGP_SUSPEND_REF_NO,                                    /* 11.3.33  0x1d Suspend Reference Number */
3411     DE_BSSGP_TAG,                                               /* 11.3.34  0x1e Tag */
3412     DE_BSSGP_TLLI,                                              /* 11.3.35  0x1f Temporary logical link Identity (TLLI) GSM_A_PDU_TYPE_RR, DE_RR_TLLI*/
3413     DE_BSSGP_TMSI_PTMSI,                                        /* 11.3.36  0x20 Temporary Mobile Subscriber Identity (TMSI) GSM_A_PDU_TYPE_RR, DE_RR_TMSI_PTMSI*/
3414     DE_BSSGP_TRACE_REF,                                         /* 11.3.37  0x21 Trace Reference */
3415     DE_BSSGP_TRACE_TYPE,                                        /* 11.3.38  0x22 Trace Type */
3416     DE_BSSGP_TRANSACTION_ID,                                    /* 11.3.39  0x23 Transaction Id */
3417     DE_BSSGP_TRIGGER_ID,                                        /* 11.3.40  0x24 Trigger Id */
3418     DE_BSSGP_NO_OF_OCT_AFFECTED,                                /* 11.3.41  0x25 Number of octets affected */
3419     DE_BSSGP_LSA_ID_LIST,                                       /* 11.3.18  0x26 LSA Identifier List GSM_A_PDU_TYPE_BSSMAP, BE_LSA_ID_LIST*/
3420     DE_BSSGP_LSA_INFO,                                          /* 11.3.19  0x27 LSA Information GSM_A_PDU_TYPE_BSSMAP, BE_LSA_INFO */
3421     DE_BSSGP_ACKET_FLOW_ID,                                     /* 11.3.42  0x28 Packet Flow Identifier (PFI)  GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID*/
3422     DE_BSSGP_GPRS_TIMER,                                        /* 11.3.44  0x29 GPRS Timer */
3423     DE_BSSGP_QOS,                                               /* 11.3.43  0x3a Aggregate BSS QoS Profile GSM_A_PDU_TYPE_GM, DE_QOS*/
3424     DE_BSSGP_FEATURE_BITMAP,                                    /* 11.3.45  0x3b Feature Bitmap */
3425     DE_BSSGP_BUCKET_FULL_RATIO,                                 /* 11.3.46  0x3c Bucket Full Ratio */
3426     DE_BSSGP_SERV_UTRAN_CCO,                                    /* 11.3.47  0x3d Service UTRAN CCO */
3427     DE_BSSGP_NSEI,                                              /* 11.3.48  0x3e NSEI (Network Service Entity Identifier) */
3428     DE_BSSGP_RRLP_APDU,                                         /* 11.3.49 RRLP APDU */
3429     DE_BSSGP_RRLP_FLAGS,                                        /* 11.3.60  RRLP Flags */
3430     DE_BSSGP_RIM_APP_ID,                                        /* 11.3.61  RIM Application Identity */
3431     DE_BSSGP_RIM_SEQ_NO,                                        /* 11.3.62  RIM Sequence Number */
3432     DE_BSSGP_RAN_INF_REQUEST_RIM_CONT,                          /* 11.3.62a.1   RAN-INFORMATION-REQUEST RIM Container */
3433     DE_BSSGP_RAN_INF_RIM_CONT,                                  /* 11.3.62a.2   RAN-INFORMATION RIM Container */
3434     DE_BSSGP_RAN_INFORMATION_ACK_RIM_CONT,                      /* 11.3.62a.3   RAN-INFORMATION-ACK RIM Container */
3435     DE_BSSGP_RAN_INFORMATION_ERROR_RIM_CONT,                    /* 11.3.62a.4   RAN-INFORMATION-ERROR RIM Container */
3436     DE_BSSGP_RAN_INF_APP_ERROR_RIM_CONT,                        /* 11.3.62a.5   RAN-INFORMATION-APPLICATION-ERROR RIM Container */
3437     DE_BSSGP_RAN_INFORMATION_REQUEST_APP_CONT,                  /* 11.3.63.1    RAN-INFORMATION-REQUEST Application Container */
3438     DE_BSSGP_RAN_INFORMATION_APP_CONT_UNIT,                     /* 11.3.63.2    RAN-INFORMATION Application Container Unit */
3439     DE_BSSGP_RAN_APP_ERROR_CONT,                                /* 11.3.64  Application Error Container */
3440     DE_BSSGP_RIM_PDU_INDICATIONS,                               /* 11.3.65  RIM PDU Indications */
3441     DE_BSSGP_RIM_PROTO_VER_NO,                                  /* 11.3.67  RIM Protocol Version Number */
3442
3443     DE_BSSGP_PFC_FLOW_CTRL,                                     /* 11.3.68  PFC Flow Control parameters */
3444     DE_BSSGP_RIM_ROUTING_INF,                                   /* 11.3.70  RIM Routing Information */
3445
3446     DE_BSSGP_MBMS_SESSION_ID,                                   /* 11.3.71  MBMS Session Identity */
3447     DE_BSSGP_MBMS_SESSION_DUR,                                  /* 11.3.72  MBMS Session Duration */
3448     DE_BSSGP_MBMS_SAI_LIST,                                     /* 11.3.73  MBMS Service Area Identity List */
3449     DE_BSSGP_MBMS_RESPONSE,                                     /* 11.3.74  MBMS Response */
3450     DE_BSSGP_MBMS_RA_LIST,                                      /* 11.3.75  MBMS Routing Area List */
3451     DE_BSSGP_MBMS_SESSION_INF,                                  /* 11.3.76  MBMS Session Information */
3452
3453     DE_BSSGP_TMGI,                                              /* 11.3.77  TMGI (Temporary Mobile Group Identity) GSM_A_PDU_TYPE_GM, DE_TMGI*/
3454     DE_BSSGP_MBMS_STOP_CAUSE,                                   /* 11.3.78  MBMS Stop Cause */
3455     DE_BSSGP_SOURCE_BSS_TO_TARGET_BSS_TRANSP_CONT,              /* 11.3.79  Source BSS to Target BSS Transparent Container */
3456     DE_BSSGP_TARGET_BSS_TO_SOURCE_BSS_TRANSP_CONT,              /* 11.3.80  Target BSS to Source BSS Transparent Container */
3457     DE_BSSGP_PFCS_TO_BE_SET_UP_LIST,                            /* 11.3.82  PFCs to be set-up list */
3458     DE_BSSGP_LIST_OF_SETUP_PFCS,                                /* 11.3.83  List of set-up PFCs */
3459     DE_BSSGP_EXT_FEATURE_BITMAP,                                /* 11.3.84  Extended Feature Bitmap */
3460     DE_BSSGP_SRC_TO_TRG_TRANSP_CONT,                            /* 11.3.85  Source to Target Transparent Container */
3461     DE_BSSGP_TRG_TO_SRC_TRANSP_CONT,                            /* 11.3.86  Target to Source Transparent Container */
3462     BE_BSSGP_RNC_ID,                                            /* 11.3.87  RNC Identifier */
3463     DE_BSSGP_PAGE_MODE,                                         /* 11.3.88  Page Mode */
3464     DE_BSSGP_CONTAINER_ID,                                      /* 11.3.89  Container ID */
3465     DE_BSSGP_GLOBAL_TFI,                                        /* 11.3.90  Global TFI */
3466     DE_BSSGP_TIME_TO_MBMS_DATA_TRAN,                            /* 11.3.92  Time to MBMS Data Transfer */
3467     DE_BSSGP_MBMS_SESSION_REP_NO,                               /* 11.3.93  MBMS Session Repetition Number */
3468
3469     DE_BSSGP_INTER_RAT_HO_INFO,                                 /* 11.3.94  Inter RAT Handover Info */
3470     DE_BSSGP_PS_HO_CMD,                                         /* 11.3.95  PS Handover Command */
3471     DE_BSSGP_PS_HO_INDICATIONS,                                 /* 11.3.95a PS Handover Indications */
3472     DE_BSSGP_SIPSI_CONTAINER,                                   /* 11.3.95b SI/PSI Container */
3473     DE_BSSGP_ACTIVE_PFCS_LIST,                                  /* 11.3.95c Active PFCs List */
3474     DE_BSSGP_VELOCITY_DATA,                                     /* 11.3.96  Velocity Data */
3475     DE_BBSGP_DTM_HO_CMD,                                        /* 11.3.97  DTM Handover Command */
3476     DE_BSSGP_CS_INDICATION,                                     /* 11.3.98  CS Indication */
3477     DE_BSSGP_FLOW_CONTROL_GRAN,                                 /* 11.3.102 Flow Control Granularity */
3478     DE_BSSGP_ENB_ID,                                            /* 11.3.103     eNB Identifier */
3479     DE_BSSGP_E_UTRAN_INTER_RAT_HO_INFO,                         /* 11.3.104 E-UTRAN Inter RAT Handover Info */
3480     DE_BSSGP_SUB_PROF_ID_F_RAT_FRQ_PRIO,                        /* 11.3.105 Subscriber Profile ID for RAT/Frequency priority */
3481     DE_BSSGP_REQ_FOR_INTER_RAT_HO_INFO,                         /* 11.3.106 Request for Inter-RAT Handover Info */
3482     DE_BSSGP_RELIABLE_INTER_RAT_HO_INF,                         /* 11.3.107 Reliable Inter-RAT Handover Info */
3483     DE_BSSGP_SON_TRANSFER_APP_ID,                               /* 11.3.108 SON Transfer Application Identity */
3484     DE_BSSGP_CSG_ID,                                            /* 11.3.109 CSG Identifier */
3485     DE_BSSGP_NONE                                               /* NONE */
3486 }
3487 bssgp_elem_idx_t;
3488
3489 guint16 (*bssgp_elem_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string, int string_len) = {
3490     de_bssgp_aligment_octets,                                   /* 11.3.1   0x00 Alignment octets */
3491     de_bssgp_bmax_default_ms,                                   /* 11.3.2   0x01 Bmax default MS  */
3492     de_bssgp_bss_area_ind,                                      /* 11.3.3   0x02 BSS Area Indication */
3493     de_bssgp_bucket_leak_rate,                                  /* 11.3.4   0x03 Bucket Leak Rate (R) */
3494     de_bssgp_bvci,                                              /* 11.3.6   0x04 BVCI (BSSGP Virtual Connection Identifier)  */
3495     de_bssgp_bvc_bucket_size,                                   /* 11.3.5   0x05 BVC Bucket Size */
3496     de_bssgp_bvc_meas,                                          /* 11.3.7   0x06 BVC Measurement */
3497     de_bssgp_cause,                                             /* 11.3.8   0x07 Cause */
3498     de_bssgp_cell_id,                                           /* 11.3.9   0x08 Cell Identifier */
3499     de_bssgp_chnl_needed,                                       /* 11.3.10  0x09 Channel needed */
3500     NULL,                                                       /* 11.3.11  0x0a DRX Parameters */
3501     NULL,                                                       /* 11.3.12  0x0b eMLPP-Priority */
3502     de_bssgp_flush_action,                                      /* 11.3.13  0x0c Flush Action */
3503     de_mid,                                                     /* 11.3.14  0x0d IMSI */
3504     de_bssgp_llc_pdu,                                           /* 11.3.15  0x0e LLC-PDU */
3505     de_bssgp_llc_frames_disc,                                   /* 11.3.16  0x0f LLC Frames Discarded  */
3506     NULL,                                                       /* 11.3.17  0x10 Location Area  */
3507     NULL,                                                       /* 11.3.20  0x11 Mobile Id */
3508     de_bssgp_ms_bucket_size,                                    /* 11.3.21  0x12 MS Bucket Size */
3509     NULL,                                                       /* 11.3.22  0x13 MS Radio Access Capability */
3510     de_bssgp_omc_id,                                            /* 11.3.23  0x14 OMC Id */
3511     de_bssgp_pdu_in_error,                                      /* 11.3.24  0x15 PDU In Error */
3512     de_bssgp_pdu_lifetime,                                      /* 11.3.25  0x16 PDU Lifetime */
3513     NULL,                                                       /* 11.3.27  0x17    Priority */
3514     de_bssgp_qos_profile,                                       /* 11.3.28  0x18 QoS Profile */
3515     de_bssgp_ra_cause,                                          /* 11.3.29  0x19 Radio Cause */
3516     de_bssgp_ra_cap_upd_cause,                                  /* 11.3.30  0x1a RA-Cap-UPD-Cause */
3517     NULL,                                                       /* 11.3.31  0x1b Routeing Area */
3518     de_bssgp_r_default_ms,                                      /* 11.3.32  0x1c R_default_MS */
3519     de_bssgp_suspend_ref_no,                                    /* 11.3.33  0x1d Suspend Reference Number */
3520     de_bssgp_tag,                                               /* 11.3.34  0x1e Tag */
3521     NULL,                                                       /* 11.3.35  0x1f Temporary logical link Identity (TLLI) */
3522     NULL,                                                       /* 11.3.36  0x20 Temporary Mobile Subscriber Identity (TMSI) */
3523     de_bssgp_trace_ref,                                         /* 11.3.37  0x21 Trace Reference */
3524     de_bssgp_trace_type,                                        /* 11.3.38  0x22 Trace Type */
3525     de_bssgp_transaction_id,                                    /* 11.3.39  0x23 Transaction Id */
3526     de_bssgp_trigger_id,                                        /* 11.3.40  0x24 Trigger Id */
3527     de_bssgp_no_of_oct_affected,                                /* 11.3.41  0x25 Number of octets affected */
3528     NULL,                                                       /* 11.3.18  0x26 LSA Identifier List GSM_A_PDU_TYPE_BSSMAP, BE_LSA_ID_LIST*/
3529     NULL,                                                       /* 11.3.19  0x27 LSA Information */
3530     NULL,                                                       /* 11.3.42  0x28 Packet Flow Identifier (PFI) */
3531     de_bssgp_gprs_timer,                                        /* 11.3.44  0x29 GPRS Timer */
3532     NULL,                                                       /* 11.3.43  0x3a Aggregate BSS QoS Profile */
3533     de_bssgp_feature_bitmap,                                    /* 11.3.45  0x3b Feature Bitmap */
3534     de_bssgp_bucket_full_ratio,                                 /* 11.3.46  0x3c Bucket Full Ratio */
3535     de_bssgp_serv_utran_cco,                                    /* 11.3.47  0x3d Service UTRAN CCO */
3536     de_bssgp_nsei,                                              /* 11.3.48  0x3e NSEI (Network Service Entity Identifier) */
3537     de_bssgp_rrlp_apdu,                                         /* 11.3.49 RRLP APDU */
3538     de_bssgp_rrlp_flags,                                        /* 11.3.60  RRLP Flags */
3539     de_bssgp_rim_app_id,                                        /* 11.3.61  RIM Application Identity */
3540     de_bssgp_rim_seq_no,                                        /* 11.3.62  RIM Sequence Number */
3541     de_bssgp_ran_inf_request_rim_cont,                          /* 11.3.62a.1 RAN-INFORMATION-REQUEST RIM Container */
3542     de_bssgp_ran_inf_rim_cont,                                  /* 11.3.62a.2 RAN-INFORMATION RIM Container */
3543     de_bssgp_ran_inf_ack_rim_cont,                              /* 11.3.62a.3   RAN-INFORMATION-ACK RIM Container */
3544     de_bssgp_ran_inf_error_rim_cont,                            /* 11.3.62a.4   RAN-INFORMATION-ERROR RIM Container */
3545     de_bssgp_ran_inf_app_error_rim_cont,                        /* 11.3.62a.5   RAN-INFORMATION-APPLICATION-ERROR RIM Container */
3546
3547     de_bssgp_ran_information_request_app_cont,                  /* 11.3.63.1 RAN-INFORMATION-REQUEST Application Container */
3548     de_bssgp_ran_information_app_cont_unit,                     /* 11.3.63.2 RAN-INFORMATION Application Container Unit */
3549     de_bssgp_ran_app_error_cont,                                /* 11.3.64  Application Error Container */
3550     de_bssgp_rim_pdu_indications,                               /* 11.3.65  RIM PDU Indications */
3551     de_bssgp_rim_proto_ver_no,                                  /* 11.3.67  RIM Protocol Version Number */
3552
3553     de_bssgp_pfc_flow_ctrl,                                     /* 11.3.68  PFC Flow Control parameters */
3554     de_bssgp_rim_routing_inf,                                   /* 11.3.70  RIM Routing Information */
3555     de_bssgp_mbms_session_id,                                   /* 11.3.71  MBMS Session Identity */
3556     de_bssgp_mbms_session_dur,                                  /* 11.3.72  MBMS Session Duration */
3557     de_bssgp_mbms_sai_list,                                     /* 11.3.73  MBMS Service Area Identity List */
3558     de_bssgp_mbms_response,                                     /* 11.3.74  MBMS Response */
3559     de_bssgp_mbms_ra_list,                                      /* 11.3.75  MBMS Routing Area List */
3560     de_bssgp_mbms_session_inf,                                  /* 11.3.76  MBMS Session Information */
3561     NULL,                                                       /* 11.3.77  TMGI (Temporary Mobile Group Identity) */
3562     de_bssgp_mbms_stop_cause,                                   /* 11.3.78  MBMS Stop Cause */
3563     de_bssgp_source_BSS_to_target_BSS_transp_cont,              /* 11.3.79  Source BSS to Target BSS Transparent Container */
3564     de_bssgp_target_BSS_to_source_BSS_transp_cont,              /* 11.3.80  Target BSS to Source BSS Transparent Container */
3565     de_bssgp_pfcs_to_be_set_up_list,                            /* 11.3.82  PFCs to be set-up list */
3566     de_bssgp_list_of_setup_pfcs,                                /* 11.3.83  List of set-up PFCs */
3567     de_bssgp_ext_feature_bitmap,                                /* 11.3.84  Extended Feature Bitmap */
3568     de_bssgp_src_to_trg_transp_cont,                            /* 11.3.85  Source to Target Transparent Container */
3569     de_bssgp_trg_to_src_transp_cont,                            /* 11.3.86  Target to Source Transparent Container */
3570     de_bssgp_rnc_identifier,                                    /* 11.3.87  RNC Identifier */
3571     de_bssgp_page_mode,                                         /* 11.3.88  Page Mode */
3572     de_bssgp_container_id,                                      /* 11.3.89  Container ID */
3573     de_bssgp_global_tfi,                                        /* 11.3.90  Global TFI */
3574     de_bssgp_time_to_MBMS_data_tran,                            /* 11.3.92  Time to MBMS Data Transfer */
3575     de_bssgp_mbms_session_rep_no,                               /* 11.3.93  MBMS Session Repetition Number */
3576     de_bssgp_inter_rat_ho_info,                                 /* 11.3.94  Inter RAT Handover Info */
3577     de_bssgp_ps_ho_cmd,                                         /* 11.3.95  PS Handover Command */
3578     de_bssgp_ps_ho_indications,                                 /* 11.3.95a PS Handover Indications */
3579     de_bssgp_sipsi_container,                                   /* 11.3.95b SI/PSI Container */
3580     de_bssgp_active_pfcs_list,                                  /* 11.3.95c Active PFCs List */
3581     de_bssgp_velocity_data,                                     /* 11.3.96  Velocity Data */
3582     de_bssgp_dtm_ho_cmd,                                        /* 11.3.97  DTM Handover Command */
3583     de_bssgp_cs_indication,                                     /* 11.3.98  CS Indication */
3584     de_bssgp_flow_control_gran,                                 /* 11.3.102 Flow Control Granularity */
3585     de_bssgp_enb_id,                                            /* 11.3.103     eNB Identifier */
3586     de_bssgp_e_utran_inter_rat_ho_info,                         /* 11.3.104 E-UTRAN Inter RAT Handover Info */
3587     de_bssgp_sub_prof_id_f_rat_freq_prio,                       /* 11.3.105 Subscriber Profile ID for RAT/Frequency priority */
3588     de_bssgp_reliable_inter_rat_ho_inf,                         /* 11.3.107 Reliable Inter-RAT Handover Info */
3589     de_bssgp_req_for_inter_rat_ho_inf,                          /* 11.3.106 Request for Inter-RAT Handover Info */
3590     de_bssgp_son_transfer_app_id,                               /* 11.3.108 SON Transfer Application Identity */
3591     de_bssgp_csg_id,                                            /* 11.3.109 CSG Identifier */
3592
3593     NULL,   /* NONE */
3594 };
3595
3596 /*
3597  * 11.3.62a RIM Container
3598  * 11.3.62a.0   General
3599  * 11.3.62a.1   RAN-INFORMATION-REQUEST RIM Container
3600  */
3601 static guint16
3602 de_bssgp_ran_inf_request_rim_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3603 {
3604     guint32 curr_offset;
3605     guint32 consumed;
3606     guint   curr_len;
3607
3608     curr_offset = offset;
3609     curr_len = len;
3610
3611     /* RAN-INFORMATION-REQUEST RIM Container Contents coded as
3612      * defined in table 11.3.62a.1b
3613      */
3614     /* RIM Application Identity RIM Application Identity/11.3.61 M TLV 3 */
3615     ELEM_IN_ELEM_MAND_TELV(BSSGP_IEI_RIM_APP_ID, BSSGP_PDU_TYPE, DE_BSSGP_RIM_APP_ID, NULL);
3616     /* RIM Sequence Number RIM Sequence Number/11.3.62 M TLV 6 */
3617     ELEM_IN_ELEM_MAND_TELV(BSSGP_IEI_RIM_SEQUENCE_NUMBER, BSSGP_PDU_TYPE, DE_BSSGP_RIM_SEQ_NO, NULL);
3618     /* RIM PDU Indications RIM PDU Indications/11.3.65 M TLV 3 */
3619     ELEM_IN_ELEM_MAND_TELV(BSSGP_IEI_RIM_PDU_INDICATIONS, BSSGP_PDU_TYPE, DE_BSSGP_RIM_PDU_INDICATIONS, NULL);
3620     /* RIM Protocol Version Number RIM Protocol Version Number/11.3.67 O TLV 3 */
3621     ELEM_IN_ELEM_OPT_TELV(BSSGP_IEI_RIM_PROTOCOL_VERSION, BSSGP_PDU_TYPE, DE_BSSGP_RIM_PROTO_VER_NO, NULL);
3622     /* Application Container (note 1) RAN-INFORMATION-REQUEST Application Container/11.3.63.1 C TLV 4-? */
3623     ELEM_IN_ELEM_OPT_TELV(BSSGP_IEI_RAN_INF_REQUEST_APP_CONTAINER, BSSGP_PDU_TYPE, DE_BSSGP_RAN_INFORMATION_REQUEST_APP_CONT, NULL);
3624     /* SON Transfer Application Identity (note 2) SON Transfer Application Identity/11.3.108 C TLV 3-m */
3625     ELEM_IN_ELEM_OPT_TELV(0x84, BSSGP_PDU_TYPE, DE_BSSGP_SON_TRANSFER_APP_ID, NULL);
3626
3627     return(curr_offset-offset);
3628 }
3629 /*
3630  * 11.3.62a.2   RAN-INFORMATION RIM Container
3631  */
3632 static guint16
3633 de_bssgp_ran_inf_rim_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3634 {
3635     guint32 curr_offset;
3636     guint32 consumed;
3637     guint   curr_len;
3638
3639     curr_offset = offset;
3640     curr_len = len;
3641
3642     /* RAN-INFORMATION RIM Container Contents coded as
3643      * defined in table 11.3.62a.2b
3644      */
3645     /* RIM Application Identity RIM Application Identity /11.3.61 M TLV 3 */
3646     ELEM_IN_ELEM_MAND_TELV(BSSGP_IEI_RIM_APP_ID, BSSGP_PDU_TYPE, DE_BSSGP_RIM_APP_ID, NULL);
3647     /* RIM Sequence Number RIM Sequence Number /11.3.62 M TLV 6 */
3648     ELEM_IN_ELEM_MAND_TELV(BSSGP_IEI_RIM_SEQUENCE_NUMBER, BSSGP_PDU_TYPE, DE_BSSGP_RIM_SEQ_NO, NULL);
3649     /* RIM PDU Indications RIM PDU Indications /11.3.65. M TLV 3 */
3650     ELEM_IN_ELEM_MAND_TELV(BSSGP_IEI_RIM_PDU_INDICATIONS, BSSGP_PDU_TYPE, DE_BSSGP_RIM_PDU_INDICATIONS, NULL);
3651     /* RIM Protocol Version Number RIM Protocol Version Number/11.3.67 O TLV 3 */
3652     ELEM_IN_ELEM_OPT_TELV(BSSGP_IEI_RIM_PROTOCOL_VERSION, BSSGP_PDU_TYPE, DE_BSSGP_RIM_PROTO_VER_NO, NULL);
3653     /* Application Container (NOTE 1) RAN-INFORMATION Application Container /11.3.63.2 C (Note 1) TLV 4-? */
3654     ELEM_IN_ELEM_OPT_TELV(BSSGP_IEI_RAN_INF_APP_CONTAINER, BSSGP_PDU_TYPE, DE_BSSGP_RAN_INFORMATION_APP_CONT_UNIT, NULL);
3655     /* Application Error Container (NOTE 1) Application Error Container/11.3.64 C (Note 1) TLV n */
3656     ELEM_IN_ELEM_OPT_TELV(BSSGP_IEI_APPLICATION_ERROR_CONTAINER, BSSGP_PDU_TYPE, DE_BSSGP_RAN_APP_ERROR_CONT, NULL);
3657     /* SON Transfer Application Identity (note 2) SON Transfer Application Identity/11.3.108 C TLV 3-m */
3658     ELEM_IN_ELEM_OPT_TELV(0x84, BSSGP_PDU_TYPE, DE_BSSGP_SON_TRANSFER_APP_ID, NULL);
3659
3660     return(curr_offset-offset);
3661 }
3662
3663 /*
3664  * 11.3.62a.3   RAN-INFORMATION-ACK RIM Container
3665  */
3666 static guint16
3667 de_bssgp_ran_inf_ack_rim_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3668 {
3669     guint32 curr_offset;
3670     guint32 consumed;
3671     guint   curr_len;
3672
3673     curr_offset = offset;
3674     curr_len = len;
3675
3676     /* RAN-INFORMATION-ACK RIM Container Contents coded as
3677      * defined in table 11.3.62a.3b
3678      */
3679     /* RIM Application Identity RIM Application Identity /11.3.61 M TLV 3 */
3680     ELEM_IN_ELEM_MAND_TELV(BSSGP_IEI_RIM_APP_ID, BSSGP_PDU_TYPE, DE_BSSGP_RIM_APP_ID, NULL);
3681     /* RIM Sequence Number RIM Sequence Number /11.3.62 M TLV 6 */
3682     ELEM_IN_ELEM_MAND_TELV(BSSGP_IEI_RIM_SEQUENCE_NUMBER, BSSGP_PDU_TYPE, DE_BSSGP_RIM_SEQ_NO, NULL);
3683     /* RIM Protocol Version Number RIM Protocol Version Number/11.3.67 O TLV 4 */
3684     ELEM_IN_ELEM_OPT_TELV(BSSGP_IEI_RIM_PROTOCOL_VERSION, BSSGP_PDU_TYPE, DE_BSSGP_RIM_PROTO_VER_NO, NULL);
3685     /* SON Transfer Application Identity (note 1) SON Transfer Application Identity/11.3.108 C TLV 3-m */
3686     ELEM_IN_ELEM_OPT_TELV(0x84, BSSGP_PDU_TYPE, DE_BSSGP_SON_TRANSFER_APP_ID, NULL);
3687
3688     return(curr_offset-offset);
3689 }
3690 /*
3691  * 11.3.62a.4   RAN-INFORMATION-ERROR RIM Container
3692  */
3693 static guint16
3694 de_bssgp_ran_inf_error_rim_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3695 {
3696     guint32 curr_offset;
3697     guint32 consumed;
3698     guint   curr_len;
3699
3700     curr_offset = offset;
3701     curr_len = len;
3702
3703     /* RAN-INFORMATION-ERROR RIM Container Contents coded as
3704      * defined in table 11.3.62a.4b
3705      */
3706     /* RIM Application Identity RIM Application Identity /11.3.61 M TLV 3 */
3707     ELEM_IN_ELEM_MAND_TELV(BSSGP_IEI_RIM_APP_ID, BSSGP_PDU_TYPE, DE_BSSGP_RIM_APP_ID, NULL);
3708     /* RIM Cause Cause/11.3.8 M TLV 3 */
3709     ELEM_IN_ELEM_MAND_TELV(BSSGP_IEI_CAUSE,BSSGP_PDU_TYPE, DE_BSSGP_CAUSE, " - RIM");
3710     /* RIM Sequence Number RIM Sequence Number /11.3.62 M TLV 6 */
3711     ELEM_IN_ELEM_MAND_TELV(BSSGP_IEI_RIM_SEQUENCE_NUMBER, BSSGP_PDU_TYPE, DE_BSSGP_RIM_SEQ_NO, NULL);
3712     /* RIM Protocol Version Number RIM Protocol Version Number/11.3.67 O TLV 3 */
3713     ELEM_IN_ELEM_OPT_TELV(BSSGP_IEI_RIM_PROTOCOL_VERSION, BSSGP_PDU_TYPE, DE_BSSGP_RIM_PROTO_VER_NO, NULL);
3714     /* PDU in Error PDU in Error/11.3.24 M TLV 3-? */
3715     ELEM_IN_ELEM_OPT_TELV(0x15, BSSGP_PDU_TYPE, DE_BSSGP_PDU_IN_ERROR , NULL);
3716     /* SON Transfer Application Identity (note 1) SON Transfer Application Identity/11.3.108 C TLV 3-m */
3717     ELEM_IN_ELEM_OPT_TELV(0x84, BSSGP_PDU_TYPE, DE_BSSGP_SON_TRANSFER_APP_ID, NULL);
3718
3719     return(curr_offset-offset);
3720 }
3721 /*
3722  * 11.3.62a.5   RAN-INFORMATION-APPLICATION-ERROR RIM Container
3723  */
3724 static guint16
3725 de_bssgp_ran_inf_app_error_rim_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3726 {
3727     guint32 curr_offset;
3728     guint32 consumed;
3729     guint   curr_len;
3730
3731     curr_offset = offset;
3732     curr_len = len;
3733
3734     /* RRAN-INFORMATION-APPLICATION-ERROR RIM Container
3735      * Contents coded as defined in table 11.3.62a.5b
3736      */
3737     /* RIM Application Identity RIM Application Identity /11.3.61 M TLV 3 */
3738     ELEM_IN_ELEM_MAND_TELV(BSSGP_IEI_RIM_APP_ID, BSSGP_PDU_TYPE, DE_BSSGP_RIM_APP_ID, NULL);
3739     /* RIM Sequence Number RIM Sequence Number /11.3.62 M TLV 6 */
3740     ELEM_IN_ELEM_MAND_TELV(BSSGP_IEI_RIM_SEQUENCE_NUMBER, BSSGP_PDU_TYPE, DE_BSSGP_RIM_SEQ_NO, NULL);
3741     /* RIM PDU Indications RIM PDU Indications /11.3.65. M TLV 3 */
3742     ELEM_IN_ELEM_MAND_TELV(BSSGP_IEI_RIM_PDU_INDICATIONS, BSSGP_PDU_TYPE, DE_BSSGP_RIM_PDU_INDICATIONS, NULL);
3743     /* RIM Protocol Version Number RIM Protocol Version Number/11.3.67 O TLV 3 */
3744     ELEM_IN_ELEM_OPT_TELV(BSSGP_IEI_RIM_PROTOCOL_VERSION, BSSGP_PDU_TYPE, DE_BSSGP_RIM_PROTO_VER_NO, NULL);
3745     /* Application Error Container Application Error Container/11.3.64 M TLV n */
3746     ELEM_IN_ELEM_MAND_TELV(BSSGP_IEI_APPLICATION_ERROR_CONTAINER, BSSGP_PDU_TYPE, DE_BSSGP_RAN_APP_ERROR_CONT, NULL);
3747     /* SON Transfer Application Identity (note 1) SON Transfer Application Identity/11.3.108 C TLV 3-m */
3748     ELEM_IN_ELEM_OPT_TELV(0x84, BSSGP_PDU_TYPE, DE_BSSGP_SON_TRANSFER_APP_ID, NULL);
3749
3750     return(curr_offset-offset);
3751 }
3752
3753 /*
3754  * 11.3.79  Source BSS to Target BSS Transparent Container
3755  */
3756 guint16
3757 de_bssgp_source_BSS_to_target_BSS_transp_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3758 {
3759     guint32 curr_offset;
3760     guint32 consumed;
3761     guint   curr_len;
3762
3763     curr_offset = offset;
3764     curr_len = len;
3765
3766
3767     /* Octet 3-? Source BSS to Target BSS Transparent Container Contents coded
3768      * as defined in table 11.3.79.b
3769      */
3770     /* MS Radio Access Capability MS Radio Access Capability/11.3.22 M TLV 7-? */
3771     ELEM_IN_ELEM_MAND_TELV(BSSGP_IEI_MS_RADIO_ACCESS_CAPABILITY, GSM_A_PDU_TYPE_GM, DE_MS_RAD_ACC_CAP , NULL);
3772     /* Inter RAT Handover Info Inter RAT Handover Info/11.3.94 O (note 1) TLV 3-? */
3773     ELEM_IN_ELEM_OPT_TELV(0x73, BSSGP_PDU_TYPE, DE_BSSGP_INTER_RAT_HO_INFO, NULL);
3774     /* Page Mode Page Mode/11.3.88 O (note 2, note 3) TLV 3 */
3775     ELEM_IN_ELEM_OPT_TELV(0x6d, BSSGP_PDU_TYPE, DE_BSSGP_PAGE_MODE, NULL);
3776     /* Container ID Container ID/11.3.89 O (note 2) TLV 3 */
3777     ELEM_IN_ELEM_OPT_TELV(0x6e, BSSGP_PDU_TYPE, DE_BSSGP_CONTAINER_ID, NULL);
3778     /* Global TFI Global TFI/11.3.90 O (note 2, note 3) TLV 3 */
3779     ELEM_IN_ELEM_OPT_TELV(0x6f, BSSGP_PDU_TYPE, DE_BSSGP_GLOBAL_TFI, NULL);
3780     /* PS Handover Indications PS Handover Indications/11.3.95a O TLV 3 */
3781     ELEM_IN_ELEM_OPT_TELV(0x75, BSSGP_PDU_TYPE, DE_BSSGP_PS_HO_INDICATIONS, NULL);
3782     /* CS Indication CS Indication/11.3.98 O (note 3) TLV 3 */
3783     ELEM_IN_ELEM_OPT_TELV(0x7a, BSSGP_PDU_TYPE, DE_BSSGP_CS_INDICATION, NULL);
3784     /* E-UTRAN Inter RAT Handover Info E-UTRAN Inter RAT HandoverInfo/11.3.104 O (note 1) TLV 3-? */
3785     ELEM_IN_ELEM_OPT_TELV(0x80, BSSGP_PDU_TYPE, DE_BSSGP_E_UTRAN_INTER_RAT_HO_INFO, NULL);
3786
3787     return(curr_offset-offset);
3788 }
3789
3790 /*
3791  * 11.3.80 Target BSS to Source BSS Transparent Container
3792  */
3793 guint16
3794 de_bssgp_target_BSS_to_source_BSS_transp_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
3795 {
3796     guint32 curr_offset;
3797     guint32 consumed;
3798     guint   curr_len;
3799
3800     curr_offset = offset;
3801     curr_len = len;
3802
3803
3804     /* Octet 3-? Target BSS to Source BSS Transparent Container Contents coded
3805      * as defined in table 11.3.80.b
3806      */
3807
3808     /* PS Handover Command PS Handover Command/11.3.95 O (Note 2) TLV 4-? */
3809     ELEM_IN_ELEM_OPT_TELV(0x74, BSSGP_PDU_TYPE, DE_BSSGP_PS_HO_CMD, NULL);
3810     /* SI/PSI Container SI/PSI Container/11.3.95b O (Note 1) TLV 3-? */
3811     ELEM_IN_ELEM_OPT_TELV(0x76, BSSGP_PDU_TYPE, DE_BSSGP_SIPSI_CONTAINER, NULL);
3812     /* DTM Handover Command DTM Handover Command/11.3.97 O (Note 2) TLV 22-? */
3813     ELEM_IN_ELEM_OPT_TELV(0x79, BSSGP_PDU_TYPE, DE_BBSGP_DTM_HO_CMD, NULL);
3814
3815     return(curr_offset-offset);
3816 }
3817
3818 /* MESSAGE FUNCTIONS */
3819
3820 /*
3821  * 10.2 PDU functional definitions and contents at RL and BSSGP SAPs
3822  * 10.2.1 DL-UNITDATA
3823  */
3824 static void
3825 bssgp_dl_unitdata(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
3826 {
3827     guint32 curr_offset;
3828     guint32 consumed;
3829     guint   curr_len;
3830
3831     curr_offset = offset;
3832     curr_len = len;
3833
3834     /* This PDU is sent to the BSS to transfer an LLC-PDU across the radio interface to an MS. */
3835     pinfo->link_dir = P2P_DIR_DL;
3836
3837     /* TLLI (current) TLLI/11.3.35 M V 4 */
3838     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_TLLI, " - current");
3839     /* QoS Profile (note 1) QoS Profile/11.3.28 M V 3 */
3840     ELEM_MAND_V(BSSGP_PDU_TYPE, DE_BSSGP_QOS_PROFILE, NULL);
3841
3842     /* PDU Lifetime PDU Lifetime/11.3.25 M TLV 4 */
3843     ELEM_MAND_TELV(0x16, BSSGP_PDU_TYPE, DE_BSSGP_PDU_LIFETIME, NULL);
3844     /* MS Radio Access Capability (note 2) MS Radio Access Capability/11.3.22 O TLV 7-? */
3845     ELEM_OPT_TELV(BSSGP_IEI_MS_RADIO_ACCESS_CAPABILITY, GSM_A_PDU_TYPE_GM, DE_MS_RAD_ACC_CAP , NULL);
3846     /* Priority (note 3) Priority/11.3.27 O TLV 3 */
3847     ELEM_OPT_TELV(0x17, GSM_A_PDU_TYPE_BSSMAP, BE_PRIO, NULL);
3848     /* DRX Parameters DRX Parameters/11.3.11 O TLV 4 */
3849     ELEM_OPT_TELV(0x0a , GSM_A_PDU_TYPE_GM, DE_DRX_PARAM , NULL);
3850     /* IMSI IMSI/11.3.14 O TLV 5-10 */
3851     ELEM_OPT_TELV(BSSGP_IEI_IMSI, BSSGP_PDU_TYPE, DE_BSSGP_IMSI , NULL);
3852     /* TLLI (old) TLLI/11.3.35 O TLV 6 */
3853     ELEM_OPT_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , " - old");
3854     /* PFI PFI/11.3.42 O TLV 3 */
3855     ELEM_OPT_TELV( BSSGP_IEI_PFI , GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID , NULL);
3856     /* LSA Information LSA Information/11.3.19 O TLV 7-? */
3857     ELEM_OPT_TELV(0x27, GSM_A_PDU_TYPE_BSSMAP, BE_LSA_INFO, NULL);
3858     /* Service UTRAN CCO Service UTRAN CCO/11.3.47 O TLV 3 */
3859     ELEM_OPT_TELV(BSSGP_IEI_SERVICE_UTRAN_CCO, BSSGP_PDU_TYPE, DE_BSSGP_SERV_UTRAN_CCO, NULL);
3860
3861     /* Subscriber Profile ID for RAT/Frequency priority (note 5)
3862      * Subscriber Profile ID for RAT/Frequency priority/11.3.105 O TLV 3
3863      */
3864     ELEM_OPT_TELV(0x81, BSSGP_PDU_TYPE, DE_BSSGP_SUB_PROF_ID_F_RAT_FRQ_PRIO, NULL);
3865     /* Alignment octets Alignment octets/11.3.1 O TLV 2-5 */
3866     ELEM_OPT_TELV(0x00, BSSGP_PDU_TYPE, DE_BSSGP_ALIGNMENT_OCTETS, NULL);
3867     /* LLC-PDU (note 4) LLC-PDU/11.3.15 M TLV 2-? */
3868     ELEM_MAND_TELV(0x0e, BSSGP_PDU_TYPE, DE_BSSGP_LLC_PDU, NULL);
3869
3870     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
3871 }
3872 /*
3873  * 10.2.2   UL-UNITDATA
3874  */
3875 static void
3876 bssgp_ul_unitdata(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
3877 {
3878     guint32 curr_offset;
3879     guint32 consumed;
3880     guint   curr_len;
3881
3882     curr_offset = offset;
3883     curr_len = len;
3884
3885     /* This PDU transfers an MS's LLC-PDU and its associated radio interface information across the Gb-interface.
3886      * Direction: BSS to SGSN
3887      */
3888     pinfo->link_dir = P2P_DIR_UL;
3889     /* TLLI TLLI/11.3.35 M V 4 */
3890     ELEM_MAND_V(GSM_A_PDU_TYPE_RR, DE_RR_TLLI, NULL);
3891     /* QoS Profile QoS Profile/11.3.28 M V 3 */
3892     ELEM_MAND_V(BSSGP_PDU_TYPE, DE_BSSGP_QOS_PROFILE, NULL);
3893     /* Cell Identifier Cell Identifier/11.3.9 M TLV 10 */
3894     ELEM_OPT_TELV(BSSGP_IEI_CELL_IDENTIFIER, BSSGP_PDU_TYPE, DE_BSSGP_CELL_ID , NULL);
3895     /* PFI PFI/11.3.42 O TLV 3 */
3896     ELEM_OPT_TELV(BSSGP_IEI_PFI , GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID , NULL);
3897     /* LSA Identifier List LSA Identifier List/11.3.18 O TLV 3-?  */
3898     ELEM_OPT_TELV(0x26, GSM_A_PDU_TYPE_BSSMAP, BE_LSA_ID_LIST, NULL);
3899     /* Alignment octets Alignment octets/11.3.1 O TLV 2-5  */
3900     ELEM_OPT_TELV(0x00, BSSGP_PDU_TYPE, DE_BSSGP_ALIGNMENT_OCTETS, NULL);
3901     /* LLC-PDU (note) LLC-PDU/11.3.15 M TLV 2-?  */
3902     ELEM_MAND_TELV(0x0e, BSSGP_PDU_TYPE, DE_BSSGP_LLC_PDU, NULL);
3903
3904     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
3905 }
3906 /*
3907  * 10.2.3   RA-CAPABILITY
3908  */
3909 static void
3910 bssgp_ra_cap(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
3911 {
3912     guint32 curr_offset;
3913     guint32 consumed;
3914     guint   curr_len;
3915
3916     curr_offset = offset;
3917     curr_len = len;
3918
3919     /* This PDU informs the BSS of the new Radio Access Capability of an MS. */
3920     pinfo->link_dir = P2P_DIR_UL;
3921
3922     /* TLLI TLLI/11.3.35 M TLV 6 */
3923     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
3924     /* MS Radio Access Capability MS Radio Access Capability/11.3.22 M TLV 7-? */
3925     ELEM_MAND_TELV(BSSGP_IEI_MS_RADIO_ACCESS_CAPABILITY, GSM_A_PDU_TYPE_GM, DE_MS_RAD_ACC_CAP , NULL);
3926
3927     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
3928 }
3929
3930 /*
3931  * 10.2.4   (void)
3932  */
3933 /*
3934  * 10.2.5   DL-MBMS-UNITDATA
3935  */
3936 static void
3937 bssgp_dl_mbms_unitdata(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
3938 {
3939     guint32 curr_offset;
3940     guint32 consumed;
3941     guint   curr_len;
3942
3943     curr_offset = offset;
3944     curr_len = len;
3945
3946     /* This PDU is sent to the BSS to transfer an LLC-PDU across the radio interface.
3947      * Direction: SGSN to BSS
3948      */
3949     pinfo->link_dir = P2P_DIR_DL;
3950
3951     /* PDU Lifetime PDU Lifetime/11.3.25 M TLV 4  */
3952     ELEM_MAND_TELV(0x16, BSSGP_PDU_TYPE, DE_BSSGP_PDU_LIFETIME, NULL);
3953     /* TMGI TMGI/ 11.3.77 M TLV 3-8 */
3954     ELEM_MAND_TELV(0x5c, GSM_A_PDU_TYPE_GM, DE_TMGI, NULL);
3955     /* MBMS Session Identity MBMS Session Identity/ 11.3.71 O TLV 3 */
3956     ELEM_OPT_TELV(0x5d, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_SESSION_ID, NULL);
3957     /* Alignment octets Alignment octets/11.3.1 O TLV 2-5 */
3958     ELEM_OPT_TELV(0x00, BSSGP_PDU_TYPE, DE_BSSGP_ALIGNMENT_OCTETS, NULL);
3959     /* LLC-PDU LLC-PDU/11.3.15 M TLV 3-? */
3960     ELEM_MAND_TELV(0x0e, BSSGP_PDU_TYPE, DE_BSSGP_LLC_PDU, NULL);
3961
3962
3963     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
3964 }
3965
3966 /*
3967  * 10.2.6   UL-MBMS-UNITDATA
3968  */
3969 static void
3970 bssgp_ul_mbms_unitdata(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
3971 {
3972     guint32 curr_offset;
3973     guint32 consumed;
3974     guint   curr_len;
3975
3976     curr_offset = offset;
3977     curr_len = len;
3978
3979     /* This PDU transfers an LLC-PDU for an MBMS session across the Gb-interface.
3980      * Direction: BSS to SGSN */
3981     pinfo->link_dir = P2P_DIR_UL;
3982
3983     /* TMGI TMGI/ 11.3.77 M TLV 3-8 */
3984     ELEM_MAND_TELV(0x5c, GSM_A_PDU_TYPE_GM, DE_TMGI, NULL);
3985     /* MBMS Session Identity MBMS Session Identity/ 11.3.71 O TLV 3 */
3986     ELEM_OPT_TELV(0x5d, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_SESSION_ID, NULL);
3987     /* Alignment octets Alignment octets/11.3.1 O TLV 2-5 */
3988     ELEM_OPT_TELV(0x00, BSSGP_PDU_TYPE, DE_BSSGP_ALIGNMENT_OCTETS, NULL);
3989     /* LLC-PDU (note 1) LLC-PDU/11.3.15 M TLV 2-? */
3990     ELEM_MAND_TELV(0x0e, BSSGP_PDU_TYPE, DE_BSSGP_LLC_PDU, NULL);
3991
3992     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
3993 }
3994
3995 /*
3996  * 10.3 PDU functional definitions and contents at GMM SAP
3997  * 10.3.1   PAGING PS
3998  */
3999
4000 static void
4001 bssgp_paging_ps(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4002 {
4003     guint32 curr_offset;
4004     guint32 consumed;
4005     guint   curr_len;
4006
4007     curr_offset = offset;
4008     curr_len = len;
4009     /* This PDU indicates that a BSS shall initiate the packet paging procedure for an MS within a group of cells.
4010      * Direction: SGSN to BSS */
4011     pinfo->link_dir = P2P_DIR_DL;
4012
4013     /* IMSI IMSI/11.3.14 M TLV 5 -10 */
4014     ELEM_MAND_TELV(BSSGP_IEI_IMSI, BSSGP_PDU_TYPE, DE_BSSGP_IMSI , NULL);
4015     /* DRX Parameters DRX Parameters/11.3.11 O TLV 4 */
4016     ELEM_OPT_TELV(0x0a , GSM_A_PDU_TYPE_GM, DE_DRX_PARAM , NULL);
4017     /* BVCI a) BVCI/11.3.6 C TLV 4 */
4018     ELEM_OPT_TELV(BSSGP_IEI_BVCI, BSSGP_PDU_TYPE, DE_BSSGP_BVCI , NULL);
4019     /* Location Area (note) Location Area/11.3.17 C TLV 7 */
4020     ELEM_OPT_TELV(0x10,GSM_A_PDU_TYPE_COMMON, DE_LAI, NULL);
4021     /* Routeing Area (note) Routeing Area/11.3.31 C TLV 8 */
4022     ELEM_OPT_TELV(0x1b,GSM_A_PDU_TYPE_GM, DE_RAI, NULL);
4023     /* BSS Area Indication (note) BSS Area Indication/11.3.3 C TLV 3 */
4024     ELEM_OPT_TELV(0x02,BSSGP_PDU_TYPE, DE_BSSGP_BSS_AREA_IND, NULL);
4025     /* PFI PFI/11.3.42 O TLV 3 */
4026     ELEM_OPT_TELV(BSSGP_IEI_PFI , GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID , NULL);
4027     /* ABQP ABQP/11.3.43 O TLV 13-? */
4028     ELEM_OPT_TELV(0x3a , GSM_A_PDU_TYPE_GM, DE_QOS , NULL);
4029     /* QoS Profile QoS Profile/11.3.28 M TLV 5 */
4030     ELEM_MAND_TELV(0x18,BSSGP_PDU_TYPE, DE_BSSGP_QOS_PROFILE, NULL);
4031     /* P-TMSI TMSI/11.3.36 O TLV 6 */
4032     ELEM_OPT_TELV(BSSGP_IEI_TMSI,GSM_A_PDU_TYPE_RR, DE_RR_TMSI_PTMSI, NULL);
4033
4034     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4035 }
4036
4037 /*
4038  * 10.3.2   PAGING CS
4039  */
4040 static void
4041 bssgp_paging_cs(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4042 {
4043     guint32 curr_offset;
4044     guint32 consumed;
4045     guint   curr_len;
4046
4047     curr_offset = offset;
4048     curr_len = len;
4049     /* This PDU indicates that a BSS shall initiate a circuit-switched paging procedure for an MS within a group of cells.
4050      * Direction: SGSN to BSS
4051      */
4052     pinfo->link_dir = P2P_DIR_DL;
4053     /* IMSI IMSI/11.3.14 M TLV 5 -10 */
4054     ELEM_MAND_TELV(BSSGP_IEI_IMSI, BSSGP_PDU_TYPE, DE_BSSGP_IMSI , NULL);
4055     /* DRX Parameters DRX Parameters/11.3.11 M TLV 4 */
4056     ELEM_MAND_TELV(0x0a , GSM_A_PDU_TYPE_GM, DE_DRX_PARAM , NULL);
4057     /* BVCI a) BVCI/11.3.6 C TLV 4 */
4058     ELEM_OPT_TELV(BSSGP_IEI_BVCI, BSSGP_PDU_TYPE, DE_BSSGP_BVCI , NULL);
4059     /* Location Area (note 1) Location Area/11.3.17 C TLV 7 */
4060     ELEM_OPT_TELV(0x10,GSM_A_PDU_TYPE_COMMON, DE_LAI, NULL);
4061     /* Routeing Area (note 1) Routeing Area/11.3.31 C TLV 8 */
4062     ELEM_OPT_TELV(0x1b,GSM_A_PDU_TYPE_GM, DE_RAI, NULL);
4063     /* BSS Area Indication (note 1) BSS Area Indication/11.3.3 C TLV 3 */
4064     ELEM_OPT_TELV(0x02,BSSGP_PDU_TYPE, DE_BSSGP_BSS_AREA_IND, NULL);
4065     /* TLLI TLLI/11.3.35 O TLV 6 */
4066     ELEM_OPT_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4067     /* Channel needed (note 2) Channel needed/11.3.10 O TLV 3 */
4068     ELEM_OPT_TELV(0x09, BSSGP_PDU_TYPE, DE_BSSGP_CHLN_NEEDED , NULL);
4069     /* eMLPP-Priority (note 2) eMLPP-Priority/11.3.12 O TLV 3 */
4070     ELEM_OPT_TELV(0x0b, GSM_A_PDU_TYPE_BSSMAP, BE_EMLPP_PRIO, NULL);
4071     /* TMSI (note 2) TMSI/11.3.36 O TLV 6 */
4072     ELEM_OPT_TELV(BSSGP_IEI_TMSI,GSM_A_PDU_TYPE_RR, DE_RR_TMSI_PTMSI, NULL);
4073     /* Global CN-Id (note 2) Global CN-Id/11.3.69 O TLV 7 */
4074     ELEM_OPT_TELV(0x53, SGSAP_PDU_TYPE, DE_SGSAP_GLOBAL_CN_ID, NULL);
4075
4076     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4077 }
4078
4079 /*
4080  * 10.3.3   RA-CAPABILITY-UPDATE
4081  */
4082 static void
4083 bssgp_ra_cap_upd(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4084 {
4085     guint32 curr_offset;
4086     guint32 consumed;
4087     guint   curr_len;
4088
4089     curr_offset = offset;
4090     curr_len = len;
4091     /* This PDU requests that the SGSN send an MS's current Radio Access capability or IMSI to the BSS. */
4092     /* Direction: BSS to SGSN */
4093     pinfo->link_dir = P2P_DIR_UL;
4094
4095     /* TLLI TLLI/11.3.35 M TLV 6 */
4096     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4097     /* Tag Tag/11.3.34 M TLV 3 */
4098     ELEM_MAND_TELV(BSSGP_IEI_TAG, BSSGP_PDU_TYPE, DE_BSSGP_TAG , NULL);
4099     /* IMSI (note) IMSI/11.3.14 C TLV 5 -10 */
4100     ELEM_OPT_TELV(BSSGP_IEI_IMSI, BSSGP_PDU_TYPE, DE_BSSGP_IMSI , NULL);
4101     /* RA-Cap-UPD-CAUSE RA-Cap-UPDCAUSE/11.3.30 M TLV 3 */
4102     ELEM_OPT_TELV(BSSGP_IEI_RA_CAP_UPD_CAUSE, BSSGP_PDU_TYPE, DE_BSSGP_RA_CAP_UPD_CAUSE , NULL);
4103     /* MS Radio Access Capability MS Radio Access Capability/11.3.22 C TLV 7-? */
4104     ELEM_OPT_TELV(BSSGP_IEI_MS_RADIO_ACCESS_CAPABILITY, GSM_A_PDU_TYPE_GM, DE_MS_RAD_ACC_CAP , NULL);
4105
4106     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4107 }
4108
4109 /*
4110  * 10.3.4   RA-CAPABILITY-UPDATE-ACK
4111  */
4112
4113 static void
4114 bssgp_ra_cap_upd_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4115 {
4116     guint32 curr_offset;
4117     guint32 consumed;
4118     guint   curr_len;
4119
4120     curr_offset = offset;
4121     curr_len = len;
4122     /* This PDU provides the BSS with an MS's current Radio Access capability and IMSI */
4123     /* Direction: SGSN to BSS */
4124     pinfo->link_dir = P2P_DIR_DL;
4125
4126     /* TLLI TLLI/11.3.35 M TLV 6 */
4127     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4128     /* Tag Tag/11.3.34 M TLV 3 */
4129     ELEM_MAND_TELV(BSSGP_IEI_TAG, BSSGP_PDU_TYPE, DE_BSSGP_TAG , NULL);
4130     /* IMSI (note) IMSI/11.3.14 C TLV 5 -10 */
4131     ELEM_OPT_TELV(BSSGP_IEI_IMSI, BSSGP_PDU_TYPE, DE_BSSGP_IMSI , NULL);
4132     /* RA-Cap-UPD-CAUSE RA-Cap-UPDCAUSE/11.3.30 M TLV 3 */
4133     ELEM_OPT_TELV(BSSGP_IEI_RA_CAP_UPD_CAUSE, BSSGP_PDU_TYPE, DE_BSSGP_RA_CAP_UPD_CAUSE , NULL);
4134     /* MS Radio Access Capability MS Radio Access Capability/11.3.22 C TLV 7-? */
4135     ELEM_OPT_TELV(BSSGP_IEI_MS_RADIO_ACCESS_CAPABILITY, GSM_A_PDU_TYPE_GM, DE_MS_RAD_ACC_CAP , NULL);
4136
4137     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4138 }
4139
4140 /*
4141  * 10.3.5   RADIO-STATUS
4142  */
4143 static void
4144 bssgp_ra_status(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4145 {
4146     guint32 curr_offset;
4147     guint32 consumed;
4148     guint   curr_len;
4149
4150     curr_offset = offset;
4151     curr_len = len;
4152
4153     /* This PDU indicates that an exception condition related to the radio interface has occurred. */
4154     /* BSS to SGSN */
4155     pinfo->link_dir = P2P_DIR_UL;
4156
4157     /* TLLI (note) TLLI/11.3.35 C TLV 6 */
4158     ELEM_OPT_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4159     /* TMSI (note) TMSI/11.3.36 C TLV 6 */
4160     ELEM_OPT_TELV(BSSGP_IEI_TMSI,GSM_A_PDU_TYPE_RR, DE_RR_TMSI_PTMSI, NULL);
4161     /* IMSI (note) IMSI/11.3.14 C TLV 5-10 */
4162     ELEM_OPT_TELV(BSSGP_IEI_IMSI, BSSGP_PDU_TYPE, DE_BSSGP_IMSI , NULL);
4163     /* Radio Cause Radio Cause/11.3.29 M TLV 3 */
4164     ELEM_MAND_TELV(BSSGP_IEI_RADIO_CAUSE, BSSGP_PDU_TYPE, DE_BSSGP_RA_CAUSE , NULL);
4165
4166     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4167 }
4168 /*
4169  * 10.3.6   SUSPEND
4170  */
4171 static void
4172 bssgp_suspend(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4173 {
4174     guint32 curr_offset;
4175     guint32 consumed;
4176     guint   curr_len;
4177
4178     curr_offset = offset;
4179     curr_len = len;
4180
4181     /* This PDU indicates that an MS wishes to suspend its GPRS service. */
4182     /* Direction: BSS to SGSN */
4183     pinfo->link_dir = P2P_DIR_UL;
4184
4185     /* TLLI TLLI/11.3.35 M TLV 6 */
4186     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4187     /* Routeing Area Routeing Area/11.3.31 M TLV 8 */
4188     ELEM_MAND_TELV(0x1b,GSM_A_PDU_TYPE_GM, DE_RAI, NULL);
4189
4190     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4191 }
4192 /*
4193  * 10.3.7   SUSPEND-ACK
4194  */
4195 void
4196 bssgp_suspend_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4197 {
4198     guint32 curr_offset;
4199     guint32 consumed;
4200     guint   curr_len;
4201
4202     curr_offset = offset;
4203     curr_len = len;
4204
4205     /* This PDU positively acknowledges the reception of a SUSPEND PDU for an MS. */
4206     /* Direction: SGSN to BSS */
4207     pinfo->link_dir = P2P_DIR_DL;
4208
4209     /* TLLI TLLI/11.3.35 M TLV 6 */
4210     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4211     /* Routeing Area Routeing Area/11.3.31 M TLV 8 */
4212     ELEM_MAND_TELV(0x1b,GSM_A_PDU_TYPE_GM, DE_RAI, NULL);
4213     /* Suspend Reference Number Suspend Reference Number/11.3.33 M TLV 3 */
4214     ELEM_MAND_TELV(0x1d,BSSGP_PDU_TYPE, DE_BBSGP_SUSPEND_REF_NO, NULL);
4215
4216
4217     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4218 }
4219 /*
4220  * 10.3.8   SUSPEND-NACK
4221  */
4222 static void
4223 bssgp_suspend_nack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4224 {
4225     guint32 curr_offset;
4226     guint32 consumed;
4227     guint   curr_len;
4228
4229     curr_offset = offset;
4230     curr_len = len;
4231
4232
4233     /* This PDU negatively acknowledges the reception of a SUSPEND PDU for an MS. */
4234     /* Direction: SGSN to BSS */
4235     pinfo->link_dir = P2P_DIR_DL;
4236
4237     /* TLLI TLLI/11.3.35 M TLV 6 */
4238     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4239     /* Routeing Area Routeing Area/11.3.31 M TLV 8 */
4240     ELEM_MAND_TELV(0x1b,GSM_A_PDU_TYPE_GM, DE_RAI, NULL);
4241     /* Cause Cause/11.3.8 O TLV 3 */
4242     ELEM_MAND_TELV(BSSGP_IEI_CAUSE,BSSGP_PDU_TYPE, DE_BSSGP_CAUSE, NULL);
4243
4244     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4245 }
4246 /*
4247  * 10.3.9   RESUME
4248  */
4249 static void
4250 bssgp_resume(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4251 {
4252     guint32 curr_offset;
4253     guint32 consumed;
4254     guint   curr_len;
4255
4256     curr_offset = offset;
4257     curr_len = len;
4258
4259     /* This PDU indicates that an MS wishes to RESUME its GPRS service. */
4260     /* Direction: BSS to SGSN */
4261     pinfo->link_dir = P2P_DIR_UL;
4262
4263     /* TLLI TLLI/11.3.35 M TLV 6 */
4264     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4265     /* Routeing Area Routeing Area/11.3.31 M TLV 8 */
4266     ELEM_MAND_TELV(0x1b,GSM_A_PDU_TYPE_GM, DE_RAI, NULL);
4267     /* Suspend Reference Number Suspend Reference Number/11.3.33 M TLV 3 */
4268     ELEM_MAND_TELV(0x1d,BSSGP_PDU_TYPE, DE_BBSGP_SUSPEND_REF_NO, NULL);
4269
4270     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4271 }
4272 /*
4273  * 10.3.10  RESUME-ACK
4274  */
4275
4276 static void
4277 bssgp_resume_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4278 {
4279     guint32 curr_offset;
4280     guint32 consumed;
4281     guint   curr_len;
4282
4283     curr_offset = offset;
4284     curr_len = len;
4285
4286     /* This PDU positively acknowledges the reception of a RESUME PDU for an MS. */
4287     /* Direction: SGSN to BSS */
4288     pinfo->link_dir = P2P_DIR_DL;
4289
4290     /* TLLI TLLI/11.3.35 M TLV 6 */
4291     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4292     /* Routeing Area Routeing Area/11.3.31 M TLV 8 */
4293     ELEM_MAND_TELV(0x1b,GSM_A_PDU_TYPE_GM, DE_RAI, NULL);
4294
4295     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4296 }
4297 /*
4298  * 10.3.11  RESUME-NACK
4299  */
4300
4301 static void
4302 bssgp_resume_nack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4303 {
4304     guint32 curr_offset;
4305     guint32 consumed;
4306     guint   curr_len;
4307
4308     curr_offset = offset;
4309     curr_len = len;
4310
4311     /* This PDU negatively acknowledges the reception of a RESUME PDU for an MS. */
4312     /* Direction: SGSN to BSS */
4313     pinfo->link_dir = P2P_DIR_DL;
4314
4315     /* TLLI TLLI/11.3.35 M TLV 6 */
4316     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4317     /* Routeing Area Routeing Area/11.3.31 M TLV 8 */
4318     ELEM_MAND_TELV(0x1b,GSM_A_PDU_TYPE_GM, DE_RAI, NULL);
4319     /* Cause Cause/11.3.8 O TLV 3 */
4320     ELEM_OPT_TELV(BSSGP_IEI_CAUSE,BSSGP_PDU_TYPE, DE_BSSGP_CAUSE, NULL);
4321
4322     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4323 }
4324 /*
4325  * 10.4 PDU functional definitions and contents at NM SAP
4326  * 10.4.1   FLUSH-LL
4327  */
4328 static void
4329 bssgp_flush_ll(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4330 {
4331     guint32 curr_offset;
4332     guint32 consumed;
4333     guint   curr_len;
4334
4335     curr_offset = offset;
4336     curr_len = len;
4337
4338     /* This PDU informs a BSS that an MS has moved from one cell to another. */
4339     /* Direction: SGSN to BSS */
4340     pinfo->link_dir = P2P_DIR_DL;
4341
4342     /* TLLI TLLI/11.3.35 M TLV 6 */
4343     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4344     /* BVCI (old) BVCI/11.3.6 M TLV 4 */
4345     ELEM_MAND_TELV(BSSGP_IEI_BVCI, BSSGP_PDU_TYPE, DE_BSSGP_BVCI , " - Old");
4346     /* BVCI (new) BVCI/11.3.6 O TLV 4 */
4347     ELEM_OPT_TELV(BSSGP_IEI_BVCI, BSSGP_PDU_TYPE, DE_BSSGP_BVCI , " - New");
4348     /* NSEI (new) NSEI/11.3.48 O (note) TLV 4 */
4349     ELEM_OPT_TELV(0x3e, GSM_A_PDU_TYPE_RR, DE_BSSGP_NSEI , " - New");
4350
4351     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4352 }
4353 /*
4354  * 10.4.2   FLUSH-LL-ACK
4355  */
4356 static void
4357 bssgp_flush_ll_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4358 {
4359     guint32 curr_offset;
4360     guint32 consumed;
4361     guint   curr_len;
4362
4363     curr_offset = offset;
4364     curr_len = len;
4365
4366     /* This PDU indicates that LLC-PDU(s) buffered for an MS in the old cell
4367      * have been either deleted or transferred to the new cell within the routing area. */
4368     /* Direction: BSS to SGSN */
4369     pinfo->link_dir = P2P_DIR_UL;
4370
4371     /* TLLI TLLI/11.3.35 M TLV 6 */
4372     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4373     /* Flush Action Flush Action/11.3.13 M TLV 3 */
4374     ELEM_MAND_TELV(0x0c, BSSGP_PDU_TYPE, DE_BSSGP_FLUSH_ACTION , NULL);
4375     /* BVCI (new) BVCI/11.3.13 C (note 1) TLV 4 */
4376     ELEM_OPT_TELV(BSSGP_IEI_BVCI, BSSGP_PDU_TYPE, DE_BSSGP_BVCI , " - New");
4377     /* Number of octets affected Number of octets affected/11.3.41 M TLV 5 */
4378     ELEM_MAND_TELV(BSSGP_IEI_NUMBER_OF_OCTETS_AFFECTED, BSSGP_PDU_TYPE, DE_BSSGP_NO_OF_OCT_AFFECTED , NULL);
4379     /* NSEI (new) NSEI/11.3.48 C (note 2) TLV 4 */
4380     ELEM_OPT_TELV(0x3e, GSM_A_PDU_TYPE_RR, DE_BSSGP_NSEI , " - New");
4381
4382
4383     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4384 }
4385 /*
4386  * 10.4.3   LLC-DISCARDED
4387  */
4388 static void
4389 bssgp_llc_discarded(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4390 {
4391     guint32 curr_offset;
4392     guint32 consumed;
4393     guint   curr_len;
4394
4395     curr_offset = offset;
4396     curr_len = len;
4397
4398     /* Direction: BSS to SGSN */
4399     pinfo->link_dir = P2P_DIR_UL;
4400
4401     /* TLLI TLLI/11.3.35 M TLV 6 */
4402     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4403     /* LLC Frames Discarded LLC Frames Discarded/11.3.16 M TLV 3 */
4404     ELEM_MAND_TELV(BSSGP_IEI_LLC_FRAMES_DISCARDED, BSSGP_PDU_TYPE, DE_BSSGP_LLC_FRAMES_DISC , NULL);
4405     /* BVCI BVCI/11.3.6 M TLV 4 */
4406     ELEM_MAND_TELV(BSSGP_IEI_BVCI, BSSGP_PDU_TYPE, DE_BSSGP_BVCI , NULL);
4407     /* Number of octets deleted Number of octets affected/11.3.41 M TLV 5 */
4408     ELEM_MAND_TELV(BSSGP_IEI_NUMBER_OF_OCTETS_AFFECTED, BSSGP_PDU_TYPE, DE_BSSGP_NO_OF_OCT_AFFECTED , NULL);
4409     /* PFI (note) PFI/11.3.42 O TLV 3 */
4410     ELEM_OPT_TELV(BSSGP_IEI_PFI , GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID , NULL);
4411
4412     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4413 }
4414
4415 /*
4416  * 10.4.4   FLOW-CONTROL-BVC
4417  */
4418 static void
4419 bssgp_flow_control_bvc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4420 {
4421     guint32 curr_offset;
4422     guint32 consumed;
4423     guint   curr_len;
4424
4425     curr_offset = offset;
4426     curr_len = len;
4427
4428     /* This PDU informs the flow control mechanism at an SGSN of the status of a
4429      * BVC's maximum acceptable SGSN to BSS throughput on the Gb interface.
4430      */
4431     /* Direction: BSS to SGSN */
4432     pinfo->link_dir = P2P_DIR_UL;
4433
4434     /* Tag Tag/11.3.34 M TLV 3 */
4435     ELEM_MAND_TELV(BSSGP_IEI_TAG, BSSGP_PDU_TYPE, DE_BSSGP_TAG , NULL);
4436     /* BVC Bucket Size BVC Bucket Size/11.3.5 M TLV 4 */
4437     ELEM_MAND_TELV(0x05, BSSGP_PDU_TYPE, DE_BSSGP_BVC_BUCKET_SIZE , NULL);
4438     /* Bucket Leak Rate Bucket Leak Rate/11.3.4 M TLV 4 */
4439     ELEM_MAND_TELV(BSSGP_IEI_BUCKET_LEAK_RATE, BSSGP_PDU_TYPE, DE_BSSGP_BUCKET_LEAK_RATE , NULL);
4440     /* Bmax default MS Bmax default MS/11.3.2 M TLV 4 */
4441     ELEM_MAND_TELV(0x01, BSSGP_PDU_TYPE, DE_BSSGP_BMAX_DEFAULT_MS , NULL);
4442     /* R_default_MS R_default_MS/11.3.32 M TLV 4 */
4443     ELEM_MAND_TELV(0x1c, BSSGP_PDU_TYPE, DE_BSSGP_R_DEFAULT_MS , NULL);
4444     /* Bucket_Full Ratio Bucket_Full Ratio/11.3.46 C TLV 3 */
4445     ELEM_OPT_TELV(BSSGP_IEI_BUCKET_FULL_RATIO, BSSGP_PDU_TYPE, DE_BSSGP_BUCKET_FULL_RATIO , NULL);
4446     /* BVC Measurement BVC Measurement/11.3.7 O TLV 4  */
4447     ELEM_OPT_TELV(0x06, BSSGP_PDU_TYPE, DE_BSSGP_BVC_MEAS , NULL);
4448     /* Flow Control Granularity (note) Flow Control Granularity/11.3.102 O TLV 3 */
4449     ELEM_OPT_TELV(0x7e, BSSGP_PDU_TYPE, DE_BSSGP_FLOW_CONTROL_GRAN , NULL);
4450
4451     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4452 }
4453
4454 /*
4455  * 10.4.5   FLOW-CONTROL-BVC-ACK
4456  */
4457 static void
4458 bssgp_flow_control_bvc_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4459 {
4460     guint32 curr_offset;
4461     guint32 consumed;
4462     guint   curr_len;
4463
4464     curr_offset = offset;
4465     curr_len = len;
4466
4467     /* This PDU informs the flow control mechanism at the BSS that the SGSN has received
4468      * the FLOW-CONTROL-BVC PDU indicated by the Tag.
4469      */
4470
4471     /* Direction: SGSN to BSS */
4472     pinfo->link_dir = P2P_DIR_DL;
4473
4474     /* Tag Tag/11.3.34 M TLV 3 */
4475     ELEM_MAND_TELV(BSSGP_IEI_TAG, BSSGP_PDU_TYPE, DE_BSSGP_TAG , NULL);
4476
4477     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4478 }
4479
4480 /*
4481  * 10.4.6   FLOW-CONTROL-MS
4482  */
4483 static void
4484 bssgp_flow_control_ms(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4485 {
4486     guint32 curr_offset;
4487     guint32 consumed;
4488     guint   curr_len;
4489
4490     curr_offset = offset;
4491     curr_len = len;
4492
4493     /* This PDU informs the flow control mechanism at an SGSN of the status of an MS's
4494      * maximum acceptable SGSN to BSS throughput on the Gb interface.
4495      */
4496
4497     /* Direction: BSS to SGSN */
4498     pinfo->link_dir = P2P_DIR_UL;
4499
4500     /* TLLI TLLI/11.3.35 M TLV 6 */
4501     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4502     /* Tag Tag/11.3.34 M TLV 3 */
4503     ELEM_MAND_TELV(BSSGP_IEI_TAG, BSSGP_PDU_TYPE, DE_BSSGP_TAG , NULL);
4504     /* MS Bucket Size MS Bucket Size/11.3.21 M TLV 4 */
4505     ELEM_MAND_TELV(BSSGP_IEI_MS_BUCKET_SIZE, BSSGP_PDU_TYPE, DE_BSSGP_MS_BUCKET_SIZE , NULL);
4506     /* Bucket Leak rate Bucket Leak rate/11.3.4 M TLV 4 */
4507     ELEM_MAND_TELV(BSSGP_IEI_BUCKET_LEAK_RATE, BSSGP_PDU_TYPE, DE_BSSGP_BUCKET_LEAK_RATE , NULL);
4508     /* Bucket_Full Ratio Bucket_Full Ratio/11.3.46 C TLV 3 */
4509     ELEM_OPT_TELV(BSSGP_IEI_BUCKET_FULL_RATIO, BSSGP_PDU_TYPE, DE_BSSGP_BUCKET_FULL_RATIO , NULL);
4510     /* Flow Control Granularity (note) Flow Control Granularity/11.3.102 O TLV 3 */
4511     ELEM_OPT_TELV(0x7e, BSSGP_PDU_TYPE, DE_BSSGP_FLOW_CONTROL_GRAN , NULL);
4512
4513     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4514 }
4515 /*
4516  * 10.4.7   FLOW-CONTROL-MS-ACK
4517  */
4518 static void
4519 bssgp_flow_control_ms_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4520 {
4521     guint32 curr_offset;
4522     guint32 consumed;
4523     guint   curr_len;
4524
4525     curr_offset = offset;
4526     curr_len = len;
4527
4528     /* This PDU informs the flow control mechanism at the BSS that the SGSN has received
4529      * the FLOW-CONTROL-MS PDU indicated by the TLLI and the Tag. */
4530     /* Direction: SGSN to BSS */
4531     pinfo->link_dir = P2P_DIR_DL;
4532
4533     /* TLLI TLLI/11.3.35 M TLV 6  */
4534     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4535     /* Tag Tag/11.3.34 M TLV 3 */
4536     ELEM_MAND_TELV(BSSGP_IEI_TAG, BSSGP_PDU_TYPE, DE_BSSGP_TAG , NULL);
4537
4538     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4539 }
4540 /*
4541  * 10.4.8   BVC-BLOCK
4542  */
4543
4544 static void
4545 bssgp_bvc_block(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4546 {
4547     guint32 curr_offset;
4548     guint32 consumed;
4549     guint   curr_len;
4550
4551     curr_offset = offset;
4552     curr_len = len;
4553
4554     /* This PDU indicates that the contained BVC shall be blocked at the recipient entity. */
4555     /* BSS to SGSN */
4556     pinfo->link_dir = P2P_DIR_UL;
4557
4558     /* BVCI BVCI/11.3.6 M TLV 4 */
4559     ELEM_MAND_TELV(BSSGP_IEI_BVCI, BSSGP_PDU_TYPE, DE_BSSGP_BVCI , NULL);
4560     /* Cause Cause/11.3.8 M TLV 3 */
4561     ELEM_MAND_TELV(BSSGP_IEI_CAUSE,BSSGP_PDU_TYPE, DE_BSSGP_CAUSE, NULL);
4562
4563     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4564 }
4565
4566 /*
4567  * 10.4.9   BVC-BLOCK-ACK
4568  */
4569 static void
4570 bssgp_bvc_block_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4571 {
4572     guint32 curr_offset;
4573     guint32 consumed;
4574     guint   curr_len;
4575
4576     curr_offset = offset;
4577     curr_len = len;
4578
4579     /* This PDU acknowledges that a BVC has been blocked. */
4580     /* SGSN to BSS */
4581     pinfo->link_dir = P2P_DIR_DL;
4582
4583     /* BVCI BVCI/11.3.6 M TLV 4 */
4584     ELEM_MAND_TELV(BSSGP_IEI_BVCI, BSSGP_PDU_TYPE, DE_BSSGP_BVCI , NULL);
4585
4586     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4587 }
4588
4589 /*
4590  * 10.4.10  BVC-UNBLOCK
4591  */
4592 static void
4593 bssgp_bvc_un_block(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4594 {
4595     guint32 curr_offset;
4596     guint32 consumed;
4597     guint   curr_len;
4598
4599     curr_offset = offset;
4600     curr_len = len;
4601
4602     /* This PDU indicates that the identified BVC shall be unblocked at the recipient entity. */
4603     /* Direction: BSS to SGSN */
4604     pinfo->link_dir = P2P_DIR_UL;
4605
4606     /* BVCI BVCI/11.3.6 M TLV 4 */
4607     ELEM_MAND_TELV(BSSGP_IEI_BVCI, BSSGP_PDU_TYPE, DE_BSSGP_BVCI , NULL);
4608
4609
4610     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4611 }
4612 /*
4613  * 10.4.11  BVC-UNBLOCK-ACK
4614  */
4615
4616 static void
4617 bssgp_bvc_un_block_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4618 {
4619     guint32 curr_offset;
4620     guint32 consumed;
4621     guint   curr_len;
4622
4623     curr_offset = offset;
4624     curr_len = len;
4625
4626     /* This PDU acknowledges that a BVC has been unblocked. */
4627     /* Direction: SGSN to BSS */
4628     pinfo->link_dir = P2P_DIR_DL;
4629
4630     /* BVCI BVCI/11.3.6 M TLV 4 */
4631     ELEM_MAND_TELV(BSSGP_IEI_BVCI, BSSGP_PDU_TYPE, DE_BSSGP_BVCI , NULL);
4632
4633     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4634 }
4635
4636 /*
4637  * 10.4.12  BVC-RESET
4638  */
4639
4640 static void
4641 bssgp_bvc_reset(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4642 {
4643     guint32 curr_offset;
4644     guint32 consumed;
4645     guint   curr_len;
4646
4647     curr_offset = offset;
4648     curr_len = len;
4649
4650     /* This PDU indicates that BVC initialisation is required, e.g. because of a BVC failure. */
4651     /* Direction: SGSN to BSS, BSS to SGSN */
4652
4653     /* BVCI BVCI/11.3.6 M TLV 4 */
4654     ELEM_MAND_TELV(BSSGP_IEI_BVCI, BSSGP_PDU_TYPE, DE_BSSGP_BVCI , NULL);
4655     /* Cause Cause/11.3.8 M TLV 3 */
4656     ELEM_MAND_TELV(BSSGP_IEI_CAUSE,BSSGP_PDU_TYPE, DE_BSSGP_CAUSE, NULL);
4657     /* Cell Identifier (note 1) C TLV 10 */
4658     ELEM_OPT_TELV(BSSGP_IEI_CELL_IDENTIFIER, BSSGP_PDU_TYPE, DE_BSSGP_CELL_ID , NULL);
4659     /* Feature bitmap (note 2) Feature bitmap/11.3.45 O TLV 3 */
4660     ELEM_OPT_TELV(0x3b, BSSGP_PDU_TYPE, DE_BSSGP_FEATURE_BITMAP , NULL);
4661     /* Extended Feature Bitmap (note 3) Extended Feature Bitmap/11.3.84 O TLV 3 */
4662     ELEM_OPT_TELV(0x69, BSSGP_PDU_TYPE, DE_BSSGP_EXT_FEATURE_BITMAP , NULL);
4663
4664     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4665 }
4666
4667 /*
4668  * 10.4.13  BVC-RESET-ACK
4669  */
4670
4671 static void
4672 bssgp_bvc_reset_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4673 {
4674     guint32 curr_offset;
4675     guint32 consumed;
4676     guint   curr_len;
4677
4678     curr_offset = offset;
4679     curr_len = len;
4680
4681     /* This PDU indicates that BVC initialisation has been executed */
4682     /* BSS to SGSN, SGSN to BSS */
4683
4684     /* BVCI BVCI/11.3.6 M TLV 4 */
4685     ELEM_MAND_TELV(BSSGP_IEI_BVCI, BSSGP_PDU_TYPE, DE_BSSGP_BVCI , NULL);
4686     /* Cell Identifier (note 1) C TLV 10 */
4687     ELEM_OPT_TELV(BSSGP_IEI_CELL_IDENTIFIER, BSSGP_PDU_TYPE, DE_BSSGP_CELL_ID , NULL);
4688     /* Feature bitmap (note 2) Feature bitmap/11.3.45 O TLV 3 */
4689     ELEM_OPT_TELV(0x3b, BSSGP_PDU_TYPE, DE_BSSGP_FEATURE_BITMAP , NULL);
4690     /* Extended Feature Bitmap (note 3) Extended Feature Bitmap/11.3.84 O TLV 3 */
4691     ELEM_OPT_TELV(0x69, BSSGP_PDU_TYPE, DE_BSSGP_EXT_FEATURE_BITMAP , NULL);
4692
4693     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4694 }
4695
4696 /*
4697  * 10.4.14  STATUS
4698  */
4699 static void
4700 bssgp_status(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4701 {
4702     guint32 curr_offset;
4703     guint32 consumed;
4704     guint   curr_len;
4705
4706     curr_offset = offset;
4707     curr_len = len;
4708
4709     /* This PDU indicates that an exception condition occurred. */
4710     /* Direction: SGSN to BSS, BSS to SGSN */
4711
4712     /* Cause Cause/11.3.8 M TLV 3 */
4713     ELEM_MAND_TELV(BSSGP_IEI_CAUSE,BSSGP_PDU_TYPE, DE_BSSGP_CAUSE, NULL);
4714     /* BVCI BVCI/11.3.6 C TLV 4 */
4715     ELEM_MAND_TELV(BSSGP_IEI_BVCI, BSSGP_PDU_TYPE, DE_BSSGP_BVCI , NULL);
4716     /* PDU In Error (note) PDU In Error/11.3.24 O TLV 3-? */
4717     ELEM_MAND_TELV(0x15, BSSGP_PDU_TYPE, DE_BSSGP_PDU_IN_ERROR , NULL);
4718
4719     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4720 }
4721 /*
4722  * 10.4.15  SGSN-INVOKE-TRACE
4723  */
4724 static void
4725 bssgp_sgsn_invoke_trace(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4726 {
4727     guint32 curr_offset;
4728     guint32 consumed;
4729     guint   curr_len;
4730
4731     curr_offset = offset;
4732     curr_len = len;
4733
4734     /* This PDU indicates that the BSS shall begin the production of a trace record for an MS. */
4735     /* Direction: SGSN to BSS */
4736
4737     pinfo->link_dir = P2P_DIR_UL;
4738
4739     /* Trace Type Trace Type/11.3.38 M TLV 3 */
4740     ELEM_MAND_TELV(0x22, BSSGP_PDU_TYPE, DE_BSSGP_BVCI , NULL);
4741     /* Trace Reference Trace Reference/11.3.37 M TLV 4 */
4742     ELEM_MAND_TELV(0x21, BSSGP_PDU_TYPE, DE_BSSGP_TRACE_REF , NULL);
4743     /* Trigger Id Trigger Id/11.3.40 O TLV 4-24 */
4744     ELEM_OPT_TELV(0x24, BSSGP_PDU_TYPE, DE_BSSGP_TRIGGER_ID , NULL);
4745     /* Mobile Id Mobile Id/11.3.20 O TLV 3-10 */
4746     ELEM_OPT_TELV(0x11,GSM_A_PDU_TYPE_COMMON, DE_MID, NULL);
4747     /* OMC Id OMC Id/11.3.23 O TLV 4-24 */
4748     ELEM_OPT_TELV(0x14,GSM_A_PDU_TYPE_COMMON, DE_BSSGP_OMC_ID, NULL);
4749     /* TransactionId TransactionId/11.3.39 O TLV 4 */
4750     ELEM_OPT_TELV(0x23, BSSGP_PDU_TYPE, DE_BSSGP_TRANSACTION_ID , NULL);
4751
4752     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4753 }
4754
4755 /*
4756  * 10.4.16  DOWNLOAD-BSS-PFC
4757  */
4758 static void
4759 bssgp_download_bss_pfc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4760 {
4761     guint32 curr_offset;
4762     guint32 consumed;
4763     guint   curr_len;
4764
4765     curr_offset = offset;
4766     curr_len = len;
4767
4768     /* This PDU requests a SGSN to initiate a CREATE-BSS-PFC procedure. */
4769     /* Direction: BSS to SGSN */
4770     pinfo->link_dir = P2P_DIR_UL;
4771
4772     /* TLLI TLLI/11.3.35 M TLV 6 */
4773     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4774     /* PFI PFI/11.3.42 M TLV 3 */
4775     ELEM_MAND_TELV(BSSGP_IEI_PFI , GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID , NULL);
4776
4777     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4778 }
4779
4780 /*
4781  * 10.4.17  CREATE-BSS-PFC
4782  */
4783 static void
4784 bssgp_create_bss_pfc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4785 {
4786     guint32 curr_offset;
4787     guint32 consumed;
4788     guint   curr_len;
4789
4790     curr_offset = offset;
4791     curr_len = len;
4792
4793     /* This PDU allows the SGSN to request that a BSS create or modify a BSS Packet Flow Context. */
4794     /* Direction: SGSN to BSS */
4795     pinfo->link_dir = P2P_DIR_DL;
4796
4797     /* TLLI TLLI/11.3.35 M TLV 6 */
4798     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4799     /* IMSI IMSI/11.3.14 O (note 4) TLV 5 -10 */
4800     ELEM_OPT_TELV(BSSGP_IEI_IMSI, BSSGP_PDU_TYPE, DE_BSSGP_IMSI , NULL);
4801     /* PFI PFI/11.3.42 M TLV 3 */
4802     ELEM_MAND_TELV(BSSGP_IEI_PFI , GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID , NULL);
4803     /* PFT GPRS Timer/11.3.44 M TLV 3 */
4804     ELEM_MAND_TELV(0x29, BSSGP_PDU_TYPE, DE_BSSGP_GPRS_TIMER , " - PFT");
4805     /* ABQP ABQP/11.3.43 M TLV 13-? */
4806     ELEM_MAND_TELV(0x3a , GSM_A_PDU_TYPE_GM, DE_QOS , NULL);
4807     /* Service UTRAN CCO Service UTRAN CCO/11.3.47 O TLV 3 */
4808     ELEM_OPT_TELV(BSSGP_IEI_SERVICE_UTRAN_CCO, BSSGP_PDU_TYPE, DE_BSSGP_SERV_UTRAN_CCO, NULL);
4809     /* MS Radio Access Capability MS Radio Access Capability/11.3.22 O (note 1) TLV 7-? */
4810     ELEM_OPT_TELV(BSSGP_IEI_MS_RADIO_ACCESS_CAPABILITY, GSM_A_PDU_TYPE_GM, DE_MS_RAD_ACC_CAP , NULL);
4811     /* Allocation/Retention Priority Priority/11.3.27 O TLV 3 */
4812     ELEM_OPT_TELV(0x17, GSM_A_PDU_TYPE_BSSMAP, BE_PRIO, NULL);
4813     /* T10 GPRS Timer/11.3.44 C (note 2) TLV 3 */
4814     ELEM_MAND_TELV(BSSGP_IEI_GPRS_TIMER, BSSGP_PDU_TYPE, DE_BSSGP_GPRS_TIMER , " - T10");
4815     /* Inter RAT Handover Info Inter RAT Handover Info/11.3.94 O (note 3) TLV 3-? */
4816     ELEM_OPT_TELV(0x73, BSSGP_PDU_TYPE, DE_BSSGP_INTER_RAT_HO_INFO, NULL);
4817     /* E-UTRAN Inter RAT Handover Info E-UTRAN Inter RAT Handover Info/11.3.104 O (note 3) TLV 3-? */
4818     ELEM_OPT_TELV(0x80, BSSGP_PDU_TYPE, DE_BSSGP_E_UTRAN_INTER_RAT_HO_INFO, NULL);
4819     /* Subscriber Profile ID for RAT/Frequency priority (note 5)
4820      * Subscriber Profile ID for RAT/Frequency priority/11.3.105 O TLV 3
4821      */
4822     ELEM_OPT_TELV(0x81, BSSGP_PDU_TYPE, DE_BSSGP_SUB_PROF_ID_F_RAT_FRQ_PRIO, NULL);
4823
4824     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4825 }
4826
4827 /*
4828  * 10.4.18  CREATE-BSS-PFC-ACK
4829  */
4830 static void
4831 bssgp_create_bss_pfc_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4832 {
4833     guint32 curr_offset;
4834     guint32 consumed;
4835     guint   curr_len;
4836
4837     curr_offset = offset;
4838     curr_len = len;
4839
4840     /* This PDU allows the BSS to acknowledge a request from the SGSN for the creation
4841      * or modification of a BSS Packet Flow Context.
4842      */
4843     /* Direction: BSS to SGSN */
4844     pinfo->link_dir = P2P_DIR_UL;
4845
4846     /* TLLI TLLI/11.3.35 M TLV 6 */
4847     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4848     /* PFI PFI/11.3.42 M TLV 3 */
4849     ELEM_MAND_TELV(BSSGP_IEI_PFI , GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID , NULL);
4850     /* ABQP ABQP/11.3.43 M TLV 13-? */
4851     ELEM_MAND_TELV(0x3a , GSM_A_PDU_TYPE_GM, DE_QOS , NULL);
4852     /* Cause Cause/11.3.8 O TLV 3 */
4853     ELEM_OPT_TELV(BSSGP_IEI_CAUSE,BSSGP_PDU_TYPE, DE_BSSGP_CAUSE, NULL);
4854
4855     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4856 }
4857 /*
4858  * 10.4.19  CREATE-BSS-PFC-NACK
4859  */
4860 static void
4861 bssgp_create_bss_pfc_nack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4862 {
4863     guint32 curr_offset;
4864     guint32 consumed;
4865     guint   curr_len;
4866
4867     curr_offset = offset;
4868     curr_len = len;
4869
4870     /* This PDU allows the BSS to Nack a request from the SGSN for the
4871      * creation of a BSS Packet Flow Context
4872      */
4873     /* Direction: BSS to SGSN */
4874     pinfo->link_dir = P2P_DIR_UL;
4875
4876     /* TLLI TLLI/11.3.35 M TLV 6 */
4877     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4878     /* PFI PFI/11.3.42 M TLV 3 */
4879     ELEM_MAND_TELV(BSSGP_IEI_PFI , GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID , NULL);
4880     /* Cause Cause/11.3.8 M TLV 3 */
4881     ELEM_MAND_TELV(BSSGP_IEI_CAUSE,BSSGP_PDU_TYPE, DE_BSSGP_CAUSE, NULL);
4882
4883     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4884 }
4885 /*
4886  * 10.4.20  MODIFY-BSS-PFC
4887  */
4888 static void
4889 bssgp_modify_bss_pfc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4890 {
4891     guint32 curr_offset;
4892     guint32 consumed;
4893     guint   curr_len;
4894
4895     curr_offset = offset;
4896     curr_len = len;
4897
4898     /* This PDU allows the BSS to request a modification of a BSS Packet Flow Context. */
4899     /* Direction: BSS to SGSN */
4900     pinfo->link_dir = P2P_DIR_UL;
4901
4902     /* TLLI TLLI/11.3.35 M TLV 6 */
4903     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4904     /* PFI PFI/11.3.42 M TLV 3 */
4905     ELEM_MAND_TELV(BSSGP_IEI_PFI , GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID , NULL);
4906     /* ABQP ABQP/11.3.43 M TLV 13-? */
4907     ELEM_MAND_TELV(0x3a , GSM_A_PDU_TYPE_GM, DE_QOS , NULL);
4908
4909     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4910 }
4911
4912 /*
4913  * 10.4.21  MODIFY-BSS-PFC-ACK
4914  */
4915 static void
4916 bssgp_modify_bss_pfc_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4917 {
4918     guint32 curr_offset;
4919     guint32 consumed;
4920     guint   curr_len;
4921
4922     curr_offset = offset;
4923     curr_len = len;
4924
4925     /* This PDU allows the SGSN to acknowledge a modification to a BSS Packet Flow Context. */
4926     /* Direction: SGSN to BSS */
4927     pinfo->link_dir = P2P_DIR_DL;
4928
4929     /* TLLI TLLI/11.3.35 M TLV 6 */
4930     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4931     /* PFI PFI/11.3.42 M TLV 3 */
4932     ELEM_MAND_TELV(BSSGP_IEI_PFI , GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID , NULL);
4933     /* PFT GPRS Timer/11.3.44 M TLV 3 */
4934     ELEM_MAND_TELV(BSSGP_IEI_GPRS_TIMER, BSSGP_PDU_TYPE, DE_BSSGP_GPRS_TIMER , " - PFT");
4935     /* ABQP ABQP/11.3.43 M TLV 13-? */
4936     ELEM_MAND_TELV(0x3a , GSM_A_PDU_TYPE_GM, DE_QOS , NULL);
4937
4938
4939     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4940 }
4941 /*
4942  * 10.4.22  DELETE-BSS-PFC
4943  */
4944 static void
4945 bssgp_delete_bss_pfc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4946 {
4947     guint32 curr_offset;
4948     guint32 consumed;
4949     guint   curr_len;
4950
4951     curr_offset = offset;
4952     curr_len = len;
4953
4954     /* This PDU allows the SGSN to request that a BSS delete a BSS Packet Flow Context. */
4955     /* Direction: SGSN to BSS */
4956     pinfo->link_dir = P2P_DIR_DL;
4957
4958     /* TLLI TLLI/11.3.35 M TLV 6 */
4959     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4960     /* PFI PFI/11.3.42 M TLV 3 */
4961     ELEM_MAND_TELV(BSSGP_IEI_PFI , GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID , NULL);
4962
4963     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4964 }
4965 /*
4966  * 10.4.23  DELETE-BSS-PFC-ACK
4967  */
4968 static void
4969 bssgp_delete_bss_pfc_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4970 {
4971     guint32 curr_offset;
4972     guint32 consumed;
4973     guint   curr_len;
4974
4975     curr_offset = offset;
4976     curr_len = len;
4977
4978     /* This PDU allows the BSS to acknowledge a request for the deletion of a BSS Packet Flow Context. */
4979     /* Direction: BSS to SGSN */
4980     pinfo->link_dir = P2P_DIR_UL;
4981
4982     /* TLLI TLLI/11.3.35 M TLV 6 */
4983     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
4984     /* PFI PFI/11.3.42 M TLV 3 */
4985     ELEM_MAND_TELV(BSSGP_IEI_PFI , GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID , NULL);
4986
4987     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
4988 }
4989 /*
4990  * 10.4.24  FLOW-CONTROL-PFC
4991  */
4992 static void
4993 bssgp_flow_cntrl_pfc(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
4994 {
4995     guint32 curr_offset;
4996     guint32 consumed;
4997     guint   curr_len;
4998
4999     curr_offset = offset;
5000     curr_len = len;
5001
5002     /* This PDU provides the SGSN with flow control information regarding one or more PFC(s) of a given Mobile Station. */
5003     /* Direction: BSS to SGSN */
5004     pinfo->link_dir = P2P_DIR_UL;
5005
5006     /* TLLI TLLI/11.3.35 M TLV 6 */
5007     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
5008     /* Tag Tag/11.3.34 M TLV 3 */
5009     ELEM_MAND_TELV(BSSGP_IEI_TAG, BSSGP_PDU_TYPE, DE_BSSGP_TAG , NULL);
5010     /* MS Bucket Size MS Bucket Size/11.3.21 O TLV 4 */
5011     ELEM_OPT_TELV(BSSGP_IEI_MS_BUCKET_SIZE, BSSGP_PDU_TYPE, DE_BSSGP_MS_BUCKET_SIZE , NULL);
5012     /* Bucket Leak rate Bucket Leak rate/11.3.4 O TLV 4 */
5013     ELEM_OPT_TELV(0x3b, BSSGP_PDU_TYPE, DE_BSSGP_FEATURE_BITMAP , NULL);
5014     /* Bucket_Full Ratio Bucket_Full Ratio/11.3.46 O TLV 3 */
5015     ELEM_OPT_TELV(BSSGP_IEI_BUCKET_FULL_RATIO, BSSGP_PDU_TYPE, DE_BSSGP_BUCKET_FULL_RATIO , NULL);
5016     /* PFC flow control parameters PFC flow control parameters/11.3.68 M TLV */
5017     ELEM_MAND_TELV(0x52, BSSGP_PDU_TYPE, DE_BSSGP_PFC_FLOW_CTRL , NULL);
5018     /* Flow Control Granularity (note) Flow Control Granularity/11.3.102 O TLV 3 */
5019     ELEM_OPT_TELV(0x7e, BSSGP_PDU_TYPE, DE_BSSGP_FLOW_CONTROL_GRAN , NULL);
5020
5021     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5022 }
5023 /*
5024  * 10.4.25  FLOW-CONTROL-PFC-ACK
5025  */
5026 static void
5027 bssgp_flow_cntrl_pfc_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5028 {
5029     guint32 curr_offset;
5030     guint32 consumed;
5031     guint   curr_len;
5032
5033     curr_offset = offset;
5034     curr_len = len;
5035
5036     /* This PDU informs the flow control mechanism at the BSS that the SGSN has received the FLOW-CONTROL-PFC
5037      * PDU indicated by the TLLI and the Tag.
5038      */
5039     /* Direction: SGSN to BSS */
5040     pinfo->link_dir = P2P_DIR_DL;
5041
5042     /* TLLI TLLI/11.3.35 M TLV 6 */
5043     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
5044     /* Tag Tag/11.3.34 M TLV 3 */
5045     ELEM_MAND_TELV(BSSGP_IEI_TAG, BSSGP_PDU_TYPE, DE_BSSGP_TAG , NULL);
5046
5047     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5048 }
5049 /*
5050  * 10.4.26  DELETE-BSS-PFC-REQ
5051  */
5052 static void
5053 bssgp_delete_bss_pfc_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5054 {
5055     guint32 curr_offset;
5056     guint32 consumed;
5057     guint   curr_len;
5058
5059     curr_offset = offset;
5060     curr_len = len;
5061
5062     /* This PDU allows the BSS to inform the SGSN that the BSS Packet Flow Context cannot be supported anymore */
5063     /* Direction: BSS to SGSN */
5064     pinfo->link_dir = P2P_DIR_UL;
5065
5066     /* TLLI TLLI/11.3.35 M TLV 6 */
5067     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
5068     /* PFI PFI/11.3.42 M TLV 3 */
5069     ELEM_MAND_TELV(BSSGP_IEI_PFI , GSM_A_PDU_TYPE_GM, DE_PACKET_FLOW_ID , NULL);
5070     /* Cause Cause/11.3.8 M TLV 3 */
5071     ELEM_MAND_TELV(BSSGP_IEI_CAUSE,BSSGP_PDU_TYPE, DE_BSSGP_CAUSE, NULL);
5072
5073     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5074 }
5075 /*
5076  * 10.4.27  PS-HANDOVER-REQUIRED
5077  */
5078 static void
5079 bssgp_ps_ho_required(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5080 {
5081     guint32 curr_offset;
5082     guint32 consumed;
5083     guint   curr_len;
5084
5085     curr_offset = offset;
5086     curr_len = len;
5087
5088     /* This PDU initiates the allocation of resources in the target system for an MS. */
5089     /* Direction: BSS to SGSN */
5090     pinfo->link_dir = P2P_DIR_UL;
5091
5092     /* TLLI TLLI/11.3.35 M TLV 6 */
5093     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
5094     /* Cause Cause/11.3.8 M TLV 3 */
5095     ELEM_MAND_TELV(BSSGP_IEI_CAUSE,BSSGP_PDU_TYPE, DE_BSSGP_CAUSE, NULL);
5096     /* Source Cell Identifier Cell Identifier/11.3.9 M TLV 10 */
5097     ELEM_MAND_TELV(BSSGP_IEI_CELL_IDENTIFIER, BSSGP_PDU_TYPE, DE_BSSGP_CELL_ID , " - Source");
5098     /* Target Cell Identifier (note 2) Cell Identifier/11.3.9 C TLV 10 */
5099     ELEM_OPT_TELV(BSSGP_IEI_CELL_IDENTIFIER, BSSGP_PDU_TYPE, DE_BSSGP_CELL_ID , " - Target");
5100     /* Source BSS to Target BSS Transparent Container (note 1)
5101      * Source BSS to Target BSS Transparent Container/11.3.79 C TLV 10-?
5102      */
5103     ELEM_OPT_TELV(0x64,BSSGP_PDU_TYPE, DE_BSSGP_SOURCE_BSS_TO_TARGET_BSS_TRANSP_CONT, NULL);
5104     /* Target RNC Identifier (note 2) (note 3) RNC Identifier/11.3.87 C TLV 10 */
5105     ELEM_OPT_TELV(0x6c,BSSGP_PDU_TYPE, BE_BSSGP_RNC_ID, " - Target");
5106     /* Source to Target Transparent Container (note 1)
5107      * Source to Target Transparent Container/11.3.85 C TLV 3-?
5108      */
5109     ELEM_OPT_TELV(0x6a,BSSGP_PDU_TYPE, DE_BSSGP_SRC_TO_TRG_TRANSP_CONT, NULL);
5110     /* Active PFCs List Active PFCs List/11.3.95c M TLV 3-? */
5111     ELEM_OPT_TELV(0x77,BSSGP_PDU_TYPE, DE_BSSGP_ACTIVE_PFCS_LIST, NULL);
5112     /* Target eNB identifier (note 2) (note 3) eNB Identifier/11.3.103 C TLV 3-n */
5113     ELEM_OPT_TELV(0x7f,BSSGP_PDU_TYPE, DE_BSSGP_ENB_ID, " - Target");
5114     /* Reliable Inter RAT Handover Info (note 4)
5115      * Reliable Inter RAT Handover Info/11.3.107 C TLV 3
5116      */
5117     ELEM_OPT_TELV(0x83,BSSGP_PDU_TYPE, DE_BSSGP_RELIABLE_INTER_RAT_HO_INF, NULL);
5118     /* CSG Identifier (note 5) CSG Identifier/11.3.109 C TLV 7 */
5119     ELEM_OPT_TELV(0x85,BSSGP_PDU_TYPE, DE_BSSGP_CSG_ID, NULL);
5120     /* TAC (note 6) Tracking Area Code/11.3.110 C TLV 5 */
5121     ELEM_OPT_TELV(0x86, NAS_PDU_TYPE_EMM, DE_EMM_TRAC_AREA_ID, NULL);
5122
5123     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5124 }
5125 /*
5126  * 10.4.28  PS-HANDOVER-REQUIRED-ACK
5127  */
5128 static void
5129 bssgp_ps_ho_required_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5130 {
5131     guint32 curr_offset;
5132     guint32 consumed;
5133     guint   curr_len;
5134
5135     curr_offset = offset;
5136     curr_len = len;
5137
5138     /* This PDU indicates that resources have been allocated in the target system and
5139      * that the BSS may initiate the channel change attempt for the corresponding MS.
5140      */
5141     /* Direction: SGSN to BSS */
5142     pinfo->link_dir = P2P_DIR_DL;
5143
5144     /* TLLI TLLI/11.3.35 M TLV 6 */
5145     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
5146     /* List of set-up PFCs List of set-up PFCs/11.3.83 M TLV 3-?S */
5147     ELEM_MAND_TELV(0x68,BSSGP_PDU_TYPE, DE_BSSGP_LIST_OF_SETUP_PFCS, NULL);
5148     /* Target BSS to Source BSS Transparent Container (note)
5149      * Target BSS to Source BSS Transparent Container/11.3.80 C TLV 3-?
5150      */
5151     ELEM_MAND_TELV(0x65,BSSGP_PDU_TYPE, DE_BSSGP_TARGET_BSS_TO_SOURCE_BSS_TRANSP_CONT, NULL);
5152     /* Target to Source Transparent Container (note)
5153      * Target to Source Transparent Container/11.3.86 C TLV 3-?
5154      */
5155     ELEM_MAND_TELV(0x6b,BSSGP_PDU_TYPE, DE_BSSGP_TRG_TO_SRC_TRANSP_CONT, NULL);
5156
5157     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5158 }
5159
5160 /*
5161  * 10.4.29  PS-HANDOVER-REQUIRED-NACK
5162  */
5163 static void
5164 bssgp_ps_ho_required_nack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5165 {
5166     guint32 curr_offset;
5167     guint32 consumed;
5168     guint   curr_len;
5169
5170     curr_offset = offset;
5171     curr_len = len;
5172
5173     /* This PDU informs the source BSS about failed resource allocation in the target system. */
5174     /* Direction: SGSN to BSS */
5175     pinfo->link_dir = P2P_DIR_DL;
5176
5177     /* TLLI TLLI/11.3.35 M TLV 6 */
5178     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
5179     /* Cause Cause/11.3.8 M TLV 3 */
5180     ELEM_MAND_TELV(BSSGP_IEI_CAUSE,BSSGP_PDU_TYPE, DE_BSSGP_CAUSE, NULL);
5181
5182     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5183 }
5184 /*
5185  * 10.4.30  PS-HANDOVER-REQUEST
5186  */
5187 static void
5188 bssgp_ps_ho_request(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5189 {
5190     guint32 curr_offset;
5191     guint32 consumed;
5192     guint   curr_len;
5193
5194     curr_offset = offset;
5195     curr_len = len;
5196
5197     /* This PDU initiates the allocation of resources for one or more PFCs in the target BSS for an MS. */
5198     /* Direction: SGSN to BSS */
5199     pinfo->link_dir = P2P_DIR_DL;
5200
5201     /* TLLI TLLI/11.3.35 M TLV 6 */
5202     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
5203     /* IMSI IMSI/11.3.14 M TLV 5-10 */
5204     ELEM_MAND_TELV(BSSGP_IEI_IMSI, BSSGP_PDU_TYPE, DE_BSSGP_IMSI , NULL);
5205     /* Cause Cause/11.3.8 M TLV 3 */
5206     ELEM_MAND_TELV(BSSGP_IEI_CAUSE,BSSGP_PDU_TYPE, DE_BSSGP_CAUSE, NULL);
5207     /* Source Cell Identifier (note 1) Cell Identifier/11.3.9 C TLV 10 */
5208     ELEM_OPT_TELV(BSSGP_IEI_CELL_IDENTIFIER, BSSGP_PDU_TYPE, DE_BSSGP_CELL_ID , " - Source");
5209     /* Source RNC Identifier (note 1) RNC Identifier/11.3.87 C TLV 10 */
5210     ELEM_OPT_TELV(0x6c,BSSGP_PDU_TYPE, BE_BSSGP_RNC_ID, " - Source");
5211     /* Target Cell Identifier Cell Identifier/11.3.9 M TLV 10 */
5212     ELEM_OPT_TELV(BSSGP_IEI_CELL_IDENTIFIER, BSSGP_PDU_TYPE, DE_BSSGP_CELL_ID , " - Target");
5213     /* Source BSS to Target BSS Transparent Container Source BSS to Target BSS Transparent Container/11.3.79 M TLV 7-? */
5214     ELEM_OPT_TELV(0x64,BSSGP_PDU_TYPE, DE_BSSGP_SOURCE_BSS_TO_TARGET_BSS_TRANSP_CONT, NULL);
5215     /* PFCs to be set-up list PFCs to be set-up list/11.3.82 M TLV 22-? */
5216     ELEM_OPT_TELV(0x67,BSSGP_PDU_TYPE, DE_BSSGP_PFCS_TO_BE_SET_UP_LIST, NULL);
5217     /* NAS container for PS Handover NAS container for PS Handover/11.3.81 O TLV 3-? */
5218     ELEM_OPT_TELV(0x66,GSM_A_PDU_TYPE_COMMON, DE_NAS_CONT_FOR_PS_HO, NULL);
5219     /* Service UTRAN CCO Service UTRAN CCO/11.3.47 O TLV 3 */
5220     ELEM_OPT_TELV(BSSGP_IEI_SERVICE_UTRAN_CCO, BSSGP_PDU_TYPE, DE_BSSGP_SERV_UTRAN_CCO, NULL);
5221     /* Subscriber Profile ID for RAT/Frequency priority (note 2) Subscriber Profile ID for RAT/Frequency priority/11.3.105 O TLV 3 */
5222     ELEM_OPT_TELV(0x81, BSSGP_PDU_TYPE, DE_BSSGP_SUB_PROF_ID_F_RAT_FRQ_PRIO, NULL);
5223     /* Reliable Inter RAT Handover Info (note 3) Reliable Inter RAT Handover Info/11.3.107 C TLV 3 */
5224     ELEM_OPT_TELV(0x83,BSSGP_PDU_TYPE, DE_BSSGP_RELIABLE_INTER_RAT_HO_INF, NULL);
5225
5226     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5227 }
5228
5229 /*
5230  * 10.4.31  PS-HANDOVER-REQUEST-ACK
5231  */
5232 static void
5233 bssgp_ps_ho_request_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5234 {
5235     guint32 curr_offset;
5236     guint32 consumed;
5237     guint   curr_len;
5238
5239     curr_offset = offset;
5240     curr_len = len;
5241
5242     /* This PDU acknowledges the successful allocation of resources in the target BSS. */
5243     /* Direction: BSS to SGSN */
5244     pinfo->link_dir = P2P_DIR_UL;
5245
5246     /* TLLI TLLI/11.3.35 M TLV 6 */
5247     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
5248     /* List of set-up PFCs List of set-up PFCs/11.3.83 M TLV 3-? */
5249     ELEM_MAND_TELV(0x68,BSSGP_PDU_TYPE, DE_BSSGP_LIST_OF_SETUP_PFCS, NULL);
5250     /* Target BSS to Source BSS Transparent Container Target BSS to Source BSS Transparent Container/11.3.80 M TLV 3-? */
5251     ELEM_MAND_TELV(0x65,BSSGP_PDU_TYPE, DE_BSSGP_TARGET_BSS_TO_SOURCE_BSS_TRANSP_CONT, NULL);
5252
5253     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5254 }
5255 /*
5256  * 10.4.32  PS-HANDOVER-REQUEST-NACK
5257  */
5258 static void
5259 bssgp_ps_ho_request_nack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5260 {
5261     guint32 curr_offset;
5262     guint32 consumed;
5263     guint   curr_len;
5264
5265     curr_offset = offset;
5266     curr_len = len;
5267
5268     /* This PDU informs the SGSN about failed resource allocation in the target BSS. */
5269     /* BSS to SGSN */
5270     pinfo->link_dir = P2P_DIR_UL;
5271
5272     /* TLLI TLLI/11.3.35 M TLV 6 */
5273     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
5274     /* Cause Cause/11.3.8 M TLV 3 */
5275     ELEM_MAND_TELV(BSSGP_IEI_CAUSE,BSSGP_PDU_TYPE, DE_BSSGP_CAUSE, NULL);
5276
5277     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5278 }
5279
5280 /*
5281  * 10.4.33  PS-HANDOVER-COMPLETE
5282  */
5283 static void
5284 bssgp_ps_ho_complete(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5285 {
5286     guint32 curr_offset;
5287     guint32 consumed;
5288     guint   curr_len;
5289
5290     curr_offset = offset;
5291     curr_len = len;
5292
5293     /* This PDU informs the SGSN about successful channel change for an MS. */
5294     /* BSS to SGSN */
5295     pinfo->link_dir = P2P_DIR_UL;
5296
5297     /* TLLI TLLI/11.3.35 M TLV 6 */
5298     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
5299     /* IMSI IMSI/11.3.14 M TLV 5-10 */
5300     ELEM_MAND_TELV(BSSGP_IEI_IMSI, BSSGP_PDU_TYPE, DE_BSSGP_IMSI , NULL);
5301     /* Target Cell Identifier (note 1) Cell Identifier/11.3.9 O TLV 10 */
5302     ELEM_OPT_TELV(BSSGP_IEI_CELL_IDENTIFIER, BSSGP_PDU_TYPE, DE_BSSGP_CELL_ID , " - Target");
5303     /* Request for Inter RAT Handover Info (note 2) Request for Inter RAT Handover Info/11.3.106 C TLV 3 */
5304     ELEM_OPT_TELV(0x82, BSSGP_PDU_TYPE, DE_BSSGP_REQ_FOR_INTER_RAT_HO_INFO , NULL);
5305
5306     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5307 }
5308 /*
5309  * 10.4.34  PS-HANDOVER-CANCEL
5310  */
5311 static void
5312 bssgp_ps_ho_cancel(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5313 {
5314     guint32 curr_offset;
5315     guint32 consumed;
5316     guint   curr_len;
5317
5318     curr_offset = offset;
5319     curr_len = len;
5320
5321     /* This PDU cancels the handover for an MS. */
5322     /* BSS to SGSN */
5323     pinfo->link_dir = P2P_DIR_UL;
5324
5325     /* TLLI TLLI/11.3.35 M TLV 6 */
5326     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
5327     /* Cause Cause/11.3.8 M TLV 3 */
5328     ELEM_IN_ELEM_MAND_TELV(BSSGP_IEI_CAUSE,BSSGP_PDU_TYPE, DE_BSSGP_CAUSE, NULL);
5329     /* Source Cell Identifier Cell Identifier/11.3.9 M TLV 10 */
5330     ELEM_OPT_TELV(BSSGP_IEI_CELL_IDENTIFIER, BSSGP_PDU_TYPE, DE_BSSGP_CELL_ID , " - Source");
5331     /* Target Cell Identifier (note 1) Cell Identifier/11.3.9 O TLV 10 */
5332     ELEM_OPT_TELV(BSSGP_IEI_CELL_IDENTIFIER, BSSGP_PDU_TYPE, DE_BSSGP_CELL_ID , " - Target");
5333     /* Target RNC Identifier (note 1) (note 2) RNC Identifier/11.3.87 C TLV 10 */
5334     ELEM_OPT_TELV(0x6c,BSSGP_PDU_TYPE, BE_BSSGP_RNC_ID, " - Target");
5335     /* Target eNB Identifier (note 1) (note 2) eNB Identifier/11.3.103 C TLV 3-n */
5336     ELEM_OPT_TELV(0x7f,BSSGP_PDU_TYPE, DE_BSSGP_ENB_ID, " - Target");
5337
5338     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5339 }
5340
5341 /*
5342  * 10.4.35  PS-HANDOVER-COMPLETE-ACK
5343  */
5344 static void
5345 bssgp_ps_ho_complete_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5346 {
5347     guint32 curr_offset;
5348     guint32 consumed;
5349     guint   curr_len;
5350
5351     curr_offset = offset;
5352     curr_len = len;
5353
5354     /* This PDU provides to the BSS the Inter RAT Handover Info IE or
5355      * E-UTRAN Inter RAT Handover Info IE or both. It is sent only if
5356      * requested by the BSS and it shall contain at least one of the
5357      * inter-RAT capabilities.
5358      */
5359
5360     /* SGSN to BSS */
5361     pinfo->link_dir = P2P_DIR_DL;
5362
5363     /* TLLI TLLI/11.3.35 M TLV 6 */
5364     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
5365     /* Inter RAT Handover Info Inter RAT Handover Info/11.3.94 C (note 1) TLV 3-? */
5366     ELEM_OPT_TELV(0x73, BSSGP_PDU_TYPE, DE_BSSGP_INTER_RAT_HO_INFO, NULL);
5367     /* E-UTRAN Inter RAT Handover Info E-UTRAN Inter RAT Handover Info/11.3.104 C (note 1) TLV 3-? */
5368     ELEM_OPT_TELV(0x80, BSSGP_PDU_TYPE, DE_BSSGP_E_UTRAN_INTER_RAT_HO_INFO, NULL);
5369
5370     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5371 }
5372 /*
5373  * 10.5 PDU functional definitions and contents at LCS SAP
5374  * 10.5.1   PERFORM-LOCATION-REQUEST
5375  */
5376 static void
5377 bssgp_perform_loc_request(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5378 {
5379     guint32 curr_offset;
5380     guint32 consumed;
5381     guint   curr_len;
5382
5383     curr_offset = offset;
5384     curr_len = len;
5385
5386     /* This PDU informs the SGSN about failed resource allocation in the target BSS. */
5387     /* BSS to SGSN */
5388     pinfo->link_dir = P2P_DIR_UL;
5389
5390     /* TLLI TLLI/11.3.35 M TLV 6 */
5391     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
5392     /* IMSI IMSI/11.3.14 M TLV 5-10 */
5393     ELEM_MAND_TELV(BSSGP_IEI_IMSI, BSSGP_PDU_TYPE, DE_BSSGP_IMSI , NULL);
5394     /* DRX Parameters (note 1) DRX Parameters/11.3.11 O TLV 4 */
5395     ELEM_OPT_TELV(0x86, NAS_PDU_TYPE_EMM, DE_EMM_TRAC_AREA_ID, NULL);
5396     /* BVCI (PCU-PTP) BVCI/11.3.6 M TLV 4 */
5397     ELEM_MAND_TELV(BSSGP_IEI_BVCI, BSSGP_PDU_TYPE, DE_BSSGP_BVCI , " - (PCU-PTP)");
5398     /* NSEI (PCU-PTP) NSEI/11.3.48 M TLV 4-? */
5399     ELEM_OPT_TELV(0x3e, GSM_A_PDU_TYPE_RR, DE_BSSGP_NSEI , " - (PCU-PTP)");
5400     /* Location Type Location Type/11.3.53 M TLV 3-? */
5401     ELEM_OPT_TELV(0x7c, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_GANSS_LOC_TYPE, NULL);
5402     /* Cell Identifier Cell Identifier/11.3.9 M TLV 10 */
5403     ELEM_OPT_TELV(BSSGP_IEI_CELL_IDENTIFIER, BSSGP_PDU_TYPE, DE_BSSGP_CELL_ID , NULL);
5404     /* LCS Capability (note 2) LCS Capability/11.3.59 O TLV 3-? */
5405     ELEM_OPT_TELV( BSSGP_IEI_LCS_CAPABILITY , GSM_A_PDU_TYPE_GM, DE_PS_LCS_CAP , NULL);
5406     /* LCS Priority LCS Priority/11.3.57 O TLV 3-? */
5407     ELEM_OPT_TELV(BSSGP_IEI_LCS_PRIORITY, GSM_A_PDU_TYPE_BSSMAP, BE_LCS_PRIO, NULL);
5408     /* LCS QoS LCS QoS/11.3.50 O TLV 3-? */
5409     ELEM_OPT_TELV(BSSGP_IEI_LCS_QOS, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_LCSQOS, NULL);
5410     /* LCS Client Type (note 3) LCS Client Type/11.3.51 C TLV 3-? */
5411     ELEM_OPT_TELV(BSSGP_IEI_LCS_CLIENT_TYPE, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_LCS_CLIENT_TYPE, NULL);
5412     /* Requested GPS Assistance Data (note 4) Requested GPS Assistance Data/11.3.52 O TLV 3-? */
5413     ELEM_OPT_TELV(BSSGP_IEI_REQUESTED_GPS_ASSISTANCE_DATA, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_REQ_GPS_ASSIST_D, NULL);
5414     /* IMEI (note 5) IMEI/11.3.91 O TLV 10 */
5415     ELEM_OPT_TELV(0x70,GSM_A_PDU_TYPE_COMMON, DE_MID, NULL);
5416     /* GANSS Location Type GANSS Location Type / 11.3.100 C TLV 3 */
5417     ELEM_OPT_TELV(0x7c, GSM_A_PDU_TYPE_BSSMAP, BE_GANSS_LOC_TYP, NULL);
5418     /* Requested GANSS Assistance Data (note 6) Requested GANSS Assistance Data/11.3.99 O TLV 3-? */
5419     ELEM_OPT_TLV(0x7b, GSM_A_PDU_TYPE_BSSMAP, BE_GANSS_ASS_DTA, NULL);
5420
5421     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5422 }
5423
5424 /*
5425  * 10.5.2   PERFORM-LOCATION-RESPONSE
5426  */
5427 static void
5428 bssgp_perform_loc_response(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5429 {
5430     guint32 curr_offset;
5431     guint32 consumed;
5432     guint   curr_len;
5433
5434     curr_offset = offset;
5435     curr_len = len;
5436
5437     /*This PDU allows the BSS to respond to the SGSN after the completion of the location procedure. */
5438     /* Direction: BSS to SGSN */
5439     pinfo->link_dir = P2P_DIR_UL;
5440
5441     /* TLLI TLLI/11.3.35 M TLV 6 */
5442     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
5443     /* BVCI (PCU-PTP) BVCI/11.3.6 M TLV 4 */
5444     ELEM_MAND_TELV(BSSGP_IEI_BVCI, BSSGP_PDU_TYPE, DE_BSSGP_BVCI , " - (PCU-PTP)");
5445     /* Location Estimate (note 1) Location Estimate/11.3.54 C TLV 3-? */
5446     ELEM_OPT_TELV(BSSGP_IEI_LOCATION_ESTIMATE, GSM_A_PDU_TYPE_BSSMAP, BE_LOC_EST, NULL);
5447     /* Positioning Data Positioning Data/11.3.55 O TLV 3-? */
5448     ELEM_OPT_TELV(0x7d, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_POS_DATA, NULL);
5449     /* Deciphering Keys (note 2) Deciphering Keys/11.3.56 C TLV 3-? */
5450     ELEM_OPT_TELV(BSSGP_IEI_DECIPHERING_KEYS, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_DECIPH_KEYS, NULL);
5451     /* LCS Cause (note 3) LCS Cause/11.3.58 O TLV 3-? */
5452     ELEM_OPT_TELV(BSSGP_IEI_LCS_CAUSE, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_LCS_CAUSE, NULL);
5453     /* Velocity Data Velocity Data/11.3.96 O TLV 3-? */
5454     ELEM_MAND_TELV(0x78, BSSGP_PDU_TYPE, DE_BSSGP_VELOCITY_DATA , NULL);
5455     /* GANSS Positioning Data GANSS Positioning Data /11.3.101 O TLV 3-? */
5456     ELEM_OPT_TELV(0x7d, GSM_A_PDU_TYPE_BSSMAP, BE_GANSS_POS_DTA, NULL);
5457
5458     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5459 }
5460
5461 /*
5462  * 10.5.3   PERFORM-LOCATION-ABORT
5463  */
5464 static void
5465 bssgp_perform_loc_response_abort(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5466 {
5467     guint32 curr_offset;
5468     guint32 consumed;
5469     guint   curr_len;
5470
5471     curr_offset = offset;
5472     curr_len = len;
5473
5474     /*This PDU allows the SGSN to request the BSS to ABORT the LCS procedure */
5475     /* Direction: SGSN to BSS */
5476     pinfo->link_dir = P2P_DIR_DL;
5477
5478     /* TLLI TLLI/11.3.35 M TLV 6 */
5479     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
5480     /* BVCI (PCU-PTP) BVCI/11.3.6 M TLV 4 */
5481     ELEM_MAND_TELV(BSSGP_IEI_BVCI, BSSGP_PDU_TYPE, DE_BSSGP_BVCI , " - (PCU-PTP)");
5482     /* LCS Cause LCS Cause/11.3.58 M TLV 3-? */
5483     ELEM_MAND_TELV(BSSGP_IEI_LCS_CAUSE, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_LCS_CAUSE, NULL);
5484
5485     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5486 }
5487
5488 /*
5489  * 10.5.4   POSITION-COMMAND
5490  */
5491 static void
5492 bssgp_pos_cmd(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5493 {
5494     guint32 curr_offset;
5495     guint32 consumed;
5496     guint   curr_len;
5497
5498     curr_offset = offset;
5499     curr_len = len;
5500
5501     /* This PDU allows the BSS to request the SGSN to perform the position command procedure. */
5502     /* Direction: BSS to SGSN */
5503     pinfo->link_dir = P2P_DIR_UL;
5504
5505     /* TLLI TLLI/11.3.35 M TLV 6 */
5506     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
5507     /* BVCI (PCU-PTP) BVCI/11.3.6 M TLV 4 */
5508     ELEM_MAND_TELV(BSSGP_IEI_BVCI, BSSGP_PDU_TYPE, DE_BSSGP_BVCI , " - (PCU-PTP)");
5509     /* RRLP Flags RRLP Flags/11.3.60 M TLV 3 */
5510     ELEM_MAND_TELV(BSSGP_IEI_RRLP_FLAGS, BSSGP_PDU_TYPE, DE_BSSGP_RRLP_FLAGS , NULL);
5511     /* RRLP APDU RRLP APDU/11.3.49 M TLV 3-? */
5512     ELEM_MAND_TELV(BSSGP_IEI_RRLP_APDU, BSSGP_PDU_TYPE, DE_BSSGP_RRLP_APDU , NULL);
5513
5514     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5515 }
5516
5517 /*
5518  * 10.5.5   POSITION-RESPONSE
5519  */
5520 static void
5521 bssgp_pos_resp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5522 {
5523     guint32 curr_offset;
5524     guint32 consumed;
5525     guint   curr_len;
5526
5527     curr_offset = offset;
5528     curr_len = len;
5529
5530     /* This PDU allows the SGSN to respond to the position command request procedure. */
5531     /* Direction: SGSN to BSS */
5532     pinfo->link_dir = P2P_DIR_DL;
5533
5534     /* TLLI TLLI/11.3.35 M TLV 6 */
5535     ELEM_MAND_TELV(BSSGP_IEI_TLLI, GSM_A_PDU_TYPE_RR, DE_RR_TLLI , NULL);
5536     /* BVCI (PCU-PTP) BVCI/11.3.6 M TLV 4 */
5537     ELEM_MAND_TELV(BSSGP_IEI_BVCI, BSSGP_PDU_TYPE, DE_BSSGP_BVCI , " - (PCU-PTP)");
5538     /* RRLP Flags a) RRLP Flags/11.3.60 C TLV 3 */
5539     ELEM_OPT_TELV(BSSGP_IEI_RRLP_FLAGS, BSSGP_PDU_TYPE, DE_BSSGP_RRLP_FLAGS , NULL);
5540     /* RRLP APDU a) RRLP APDU/11.3.49 C TLV 3-? */
5541     ELEM_OPT_TELV(BSSGP_IEI_RRLP_APDU, BSSGP_PDU_TYPE, DE_BSSGP_RRLP_APDU , NULL);
5542     /* LCS Cause b) LCS Cause/11.3.58 O TLV 3-? */
5543     ELEM_OPT_TELV(BSSGP_IEI_LCS_CAUSE, GSM_PDU_TYPE_BSSMAP_LE, DE_BMAPLE_LCS_CAUSE, NULL);
5544
5545     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5546 }
5547
5548 /*
5549  * 10.6 PDU functional definitions and contents at RIM SAP
5550  * 10.6.1   RAN-INFORMATION-REQUEST
5551  */
5552 static void
5553 bssgp_ran_inf_request(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5554 {
5555     guint32 curr_offset;
5556     guint32 consumed;
5557     guint   curr_len;
5558
5559     curr_offset = offset;
5560     curr_len = len;
5561
5562     /* The RAN-INFORMATION-REQUEST PDU allows a controlling BSS to request information from another BSS. */
5563     /* Direction: BSS to SGSN - SGSN to BSS */
5564
5565     /* Destination Cell Identifier RIM Routing Information/11.3.70 M TLV 3-? */
5566     ELEM_MAND_TELV(BSSGP_IEI_RIM_ROUTING_INFORMATION, BSSGP_PDU_TYPE, DE_BSSGP_RIM_ROUTING_INF , " - Destination Cell Identifier");
5567     /* Source Cell Identifier RIM Routing Information/11.3.70 M TLV 3-? */
5568     ELEM_MAND_TELV(BSSGP_IEI_RIM_ROUTING_INFORMATION, BSSGP_PDU_TYPE, DE_BSSGP_RIM_ROUTING_INF , " - Source Cell Identifier");
5569     /* RIM Container RAN-INFORMATION-REQUEST RIM Container/11.3.62a.1 M TLV 3-? */
5570     ELEM_OPT_TELV(BSSGP_IEI_RAN_INF_REQUEST_RIM_CONTAINER, BSSGP_PDU_TYPE, DE_BSSGP_RAN_INF_REQUEST_RIM_CONT, NULL);
5571
5572     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5573 }
5574
5575 /*
5576  * 10.6.2   RAN-INFORMATION
5577  */
5578 static void
5579 bssgp_ran_inf(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5580 {
5581     guint32 curr_offset;
5582     guint32 consumed;
5583     guint   curr_len;
5584
5585     curr_offset = offset;
5586     curr_len = len;
5587
5588     /* The RAN-INFORMATION PDU allows a serving BSS to send information to a controlling BSS. */
5589     /* Direction: BSS to SGSN SGSN to BSS */
5590
5591     /* Destination Cell Identifier RIM Routing Information/11.3.70 M TLV 3-? */
5592     ELEM_MAND_TELV(BSSGP_IEI_RIM_ROUTING_INFORMATION, BSSGP_PDU_TYPE, DE_BSSGP_RIM_ROUTING_INF , " - Destination Cell Identifier");
5593     /* Source Cell Identifier RIM Routing Information/11.3.70 M TLV 3-? */
5594     ELEM_MAND_TELV(BSSGP_IEI_RIM_ROUTING_INFORMATION, BSSGP_PDU_TYPE, DE_BSSGP_RIM_ROUTING_INF , " - Source Cell Identifier");
5595     /* RIM Container RAN-INFORMATION RIM Container/11.3.62a.2 M TLV 3-? */
5596     ELEM_MAND_TELV(BSSGP_IEI_RAN_INF_RIM_CONTAINER, BSSGP_PDU_TYPE, DE_BSSGP_RAN_INF_RIM_CONT , " - Source Cell Identifier");
5597
5598
5599     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5600 }
5601
5602 /*
5603  * 10.6.3   RAN-INFORMATION-ACK
5604  */
5605 static void
5606 bssgp_ran_inf_request_ack(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5607 {
5608     guint32 curr_offset;
5609     guint32 consumed;
5610     guint   curr_len;
5611
5612     curr_offset = offset;
5613     curr_len = len;
5614
5615     /* The RAN-INFORMATION-ACK PDU allows a controlling BSS to acknowledge the reception of a RANINFORMATION
5616      * PDU and a serving BSS to acknowledge the reception of a RAN-INFORMATION-APPLICATIONERROR PDU.
5617      */
5618
5619     /* Direction: BSS to SGSN SGSN to BSS */
5620
5621     /* Destination Cell Identifier RIM Routing Information/11.3.70 M TLV 3-? */
5622     ELEM_MAND_TELV(BSSGP_IEI_RIM_ROUTING_INFORMATION, BSSGP_PDU_TYPE, DE_BSSGP_RIM_ROUTING_INF , " - Destination Cell Identifier");
5623     /* Source Cell Identifier RIM Routing Information/11.3.70 M TLV 3-? */
5624     ELEM_MAND_TELV(BSSGP_IEI_RIM_ROUTING_INFORMATION, BSSGP_PDU_TYPE, DE_BSSGP_RIM_ROUTING_INF , " - Source Cell Identifier");
5625     /* RIM Container RAN-INFORMATION-ACK RIM Container/11.3.62a.3 M TLV 3-? */
5626     ELEM_MAND_TELV(BSSGP_IEI_RAN_INF_ACK_RIM_CONTAINER, BSSGP_PDU_TYPE, DE_BSSGP_RAN_INFORMATION_ACK_RIM_CONT , NULL);
5627
5628     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5629 }
5630
5631 /*
5632  * 10.6.4   RAN-INFORMATION-ERROR
5633  */
5634
5635 static void
5636 bssgp_ran_inf_err(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5637 {
5638     guint32 curr_offset;
5639     guint32 consumed;
5640     guint   curr_len;
5641
5642     curr_offset = offset;
5643     curr_len = len;
5644
5645     /* The RAN-INFORMATION-ERROR PDU allows a BSS to send an error PDU back to an originating BSS as a response
5646      * to a RAN-INFORMATION, a RAN-INFORMATION-REQUEST, a RAN-INFORMATION-ACK or a RANINFORMATION-APPLICATION-ERROR PDU.
5647      */
5648
5649     /* Direction: BSS to SGSN SGSN to BSS */
5650
5651     /* Destination Cell Identifier RIM Routing Information/11.3.70 M TLV 3-? */
5652     ELEM_MAND_TELV(BSSGP_IEI_RIM_ROUTING_INFORMATION, BSSGP_PDU_TYPE, DE_BSSGP_RIM_ROUTING_INF , " - Destination Cell Identifier");
5653     /* Source Cell Identifier RIM Routing Information/11.3.70 M TLV 3-? */
5654     ELEM_MAND_TELV(BSSGP_IEI_RIM_ROUTING_INFORMATION, BSSGP_PDU_TYPE, DE_BSSGP_RIM_ROUTING_INF , " - Source Cell Identifier");
5655     /* RIM Container RAN-INFORMATION-ERROR RIM Container/11.3.62a.4 M TLV 3-? */
5656     ELEM_MAND_TELV(BSSGP_IEI_RAN_INF_ERROR_RIM_CONTAINER, BSSGP_PDU_TYPE, DE_BSSGP_RAN_INFORMATION_ERROR_RIM_CONT , NULL);
5657
5658     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5659 }
5660 /*
5661  * 10.6.5   RAN-INFORMATION-APPLICATION-ERROR
5662  */
5663 static void
5664 bssgp_ran_inf_app_err(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5665 {
5666     guint32 curr_offset;
5667     guint32 consumed;
5668     guint   curr_len;
5669
5670     curr_offset = offset;
5671     curr_len = len;
5672
5673     /* The RAN-INFORMATION-APPLICATION-ERROR PDU allows a controlling BSS to inform the serving BSS about
5674      * erroneous application information in a previously received RAN-INFORMATION PDU.
5675      */
5676
5677     /* Direction: BSS to SGSN SGSN to BSS */
5678
5679     /* Destination Cell Identifier RIM Routing Information/11.3.70 M TLV 3-? */
5680     ELEM_MAND_TELV(BSSGP_IEI_RIM_ROUTING_INFORMATION, BSSGP_PDU_TYPE, DE_BSSGP_RIM_ROUTING_INF , " - Destination Cell Identifier");
5681     /* Source Cell Identifier RIM Routing Information/11.3.70 M TLV 3-? */
5682     ELEM_MAND_TELV(BSSGP_IEI_RIM_ROUTING_INFORMATION, BSSGP_PDU_TYPE, DE_BSSGP_RIM_ROUTING_INF , " - Source Cell Identifier");
5683     /* RIM Container RAN-INFORMATION-APPLICATION ERROR RIM Container/11.3.62a.5 M TLV 3-? */
5684     ELEM_MAND_TELV(BSSGP_IEI_RAN_INF_APP_ERROR_RIM_CONTAINER, BSSGP_PDU_TYPE, DE_BSSGP_RAN_INF_APP_ERROR_RIM_CONT , NULL);
5685
5686     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5687 }
5688
5689 /*
5690  * 10.7 PDU functional definitions and contents at MBMS SAP
5691  * 10.7.1   MBMS-SESSION-START-REQUEST
5692  */
5693 static void
5694 bssgp_mbms_session_start_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5695 {
5696     guint32 curr_offset;
5697     guint32 consumed;
5698     guint   curr_len;
5699
5700     curr_offset = offset;
5701     curr_len = len;
5702
5703     /* This PDU allows a SGSN to request BSS to start an MBMS session. */
5704
5705     /* Direction: SGSN to BSS */
5706     pinfo->link_dir = P2P_DIR_DL;
5707
5708     /* TMGI TMGI/11.3.77 M TLV 3-8  */
5709     ELEM_MAND_TELV(0x5c, GSM_A_PDU_TYPE_GM, DE_TMGI, NULL);
5710     /* MBMS Session Identity MBMS Session Identity/11.3.71 O TLV 3 */
5711     ELEM_OPT_TELV(0x5d, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_SESSION_ID, NULL);
5712     /* ABQP ABQP/11.3.43 M TLV 13-? */
5713     ELEM_MAND_TELV(0x3a , GSM_A_PDU_TYPE_GM, DE_QOS , NULL);
5714     /* MBMS Service Area Identity List MBMS Service Area Identity List/11.3.73 M TLV 4-? */
5715     ELEM_MAND_TELV(0x5f, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_SAI_LIST, NULL);
5716     /* MBMS Routing Area List MBMS Routing Area List/11.3.75 M TLV 3-? */
5717     ELEM_MAND_TELV(0x61, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_RA_LIST, NULL);
5718     /* MBMS Session Duration MBMS Session Duration/11.3.72 M TLV 3-? */
5719     ELEM_MAND_TELV(0x5e, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_SESSION_DUR, NULL);
5720     /* MBMS Session Information MBMS Session Information/11.3.76 M TLV 3 */
5721     ELEM_MAND_TELV(0x62, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_SESSION_INF, NULL);
5722     /* Time to MBMS Data Transfer Time to MBMS Data Transfer/11.3.92 M TLV 3 */
5723     ELEM_MAND_TELV(0x71, BSSGP_PDU_TYPE, DE_BSSGP_TIME_TO_MBMS_DATA_TRAN, NULL);
5724     /* Allocation/Retention Priority Priority/11.3.27 O TLV 3 */
5725     ELEM_OPT_TELV(0x17, GSM_A_PDU_TYPE_BSSMAP, BE_PRIO, NULL);
5726     /* MBMS Session Repetition Number MBMS Session Repetition Number/11.3.93 O TLV 3 */
5727     ELEM_MAND_TELV(0x72, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_SESSION_REP_NO, NULL);
5728
5729
5730     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5731 }
5732 /*
5733  * 10.7.2   MBMS-SESSION-START-RESPONSE
5734  */
5735 static void
5736 bssgp_mbms_session_start_resp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5737 {
5738     guint32 curr_offset;
5739     guint32 consumed;
5740     guint   curr_len;
5741
5742     curr_offset = offset;
5743     curr_len = len;
5744
5745     /* This PDU allows a BSS to acknowledge to SGSN that it will start an MBMS session or to indicate to SGSN why the
5746      * MBMS Service Context cannot be created or is released by the BSS.
5747      */
5748
5749     /* Direction: BSS to SGSN */
5750     pinfo->link_dir = P2P_DIR_UL;
5751
5752     /* TMGI TMGI/ 11.3.77 M TLV 3-8 */
5753     ELEM_MAND_TELV(0x5c, GSM_A_PDU_TYPE_GM, DE_TMGI, NULL);
5754     /* MBMS Session Identity MBMS Session Identity/ 11.3.71 O TLV 3 */
5755     ELEM_OPT_TELV(0x5d, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_SESSION_ID, NULL);
5756     /* MBMS Response MBMS Response/ 11.3.74 M TLV 3 */
5757     ELEM_OPT_TELV(0x60, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_RESPONSE, NULL);
5758
5759     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5760 }
5761
5762 /*
5763  * 10.7.3   MBMS-SESSION-STOP-REQUEST
5764  */
5765 static void
5766 bssgp_mbms_session_stop_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5767 {
5768     guint32 curr_offset;
5769     guint32 consumed;
5770     guint   curr_len;
5771
5772     curr_offset = offset;
5773     curr_len = len;
5774
5775     /* This PDU allows a SGSN to request BSS to stop an MBMS session. */
5776
5777     /* Direction: SGSN to BSS */
5778     pinfo->link_dir = P2P_DIR_DL;
5779
5780     /* TMGI TMGI/ 11.3.77 M TLV 3-8 */
5781     ELEM_MAND_TELV(0x5c, GSM_A_PDU_TYPE_GM, DE_TMGI, NULL);
5782     /* MBMS Session Identity MBMS Session Identity/ 11.3.71 O TLV 3 */
5783     ELEM_OPT_TELV(0x5d, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_SESSION_ID, NULL);
5784     /* MBMS Stop Cause MBMS Stop Cause/11.3.78 M TLV 3 */
5785     ELEM_OPT_TELV(0x63, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_STOP_CAUSE, NULL);
5786
5787     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5788 }
5789 /*
5790  * 10.7.4   MBMS-SESSION-STOP-RESPONSE
5791  */
5792 static void
5793 bssgp_mbms_session_stop_resp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5794 {
5795     guint32 curr_offset;
5796     guint32 consumed;
5797     guint   curr_len;
5798
5799     curr_offset = offset;
5800     curr_len = len;
5801
5802     /* This PDU allows a BSS to acknowledge to SGSN that it will stop an MBMS session. */
5803
5804     /* Direction: BSS to SGSN */
5805     pinfo->link_dir = P2P_DIR_UL;
5806
5807     /* TMGI TMGI/ 11.3.77 M TLV 3-8 */
5808     ELEM_MAND_TELV(0x5c, GSM_A_PDU_TYPE_GM, DE_TMGI, NULL);
5809     /* MBMS Session Identity MBMS Session Identity/ 11.3.71 O TLV 3 */
5810     ELEM_OPT_TELV(0x5d, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_SESSION_ID, NULL);
5811     /* MBMS Response MBMS Response/ 11.3.74 M TLV 3 */
5812     ELEM_OPT_TELV(0x60, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_RESPONSE, NULL);
5813
5814     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5815 }
5816 /*
5817  * 10.7.5   MBMS-SESSION-UPDATE-REQUEST
5818  */
5819 static void
5820 bssgp_mbms_session_update_req(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5821 {
5822     guint32 curr_offset;
5823     guint32 consumed;
5824     guint   curr_len;
5825
5826     curr_offset = offset;
5827     curr_len = len;
5828
5829     /* This PDU allows an SGSN to request BSS to update the MBMS service area list
5830      * of an ongoing MBMS broadcast service session.
5831      */
5832
5833     /* Direction: BSS to SGSN */
5834     pinfo->link_dir = P2P_DIR_UL;
5835
5836     /* TMGI TMGI/ 11.3.77 M TLV 3-8 */
5837     ELEM_MAND_TELV(0x5c, GSM_A_PDU_TYPE_GM, DE_TMGI, NULL);
5838     /* MBMS Session Identity MBMS Session Identity/ 11.3.71 O TLV 3 */
5839     ELEM_OPT_TELV(0x5d, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_SESSION_ID, NULL);
5840     /* ABQP ABQP/11.3.43 M TLV 13-? */
5841     ELEM_MAND_TELV(0x3a , GSM_A_PDU_TYPE_GM, DE_QOS , NULL);
5842     /* MBMS Service Area Identity List MBMS Service Area Identity List/11.3.73 M TLV 4-? */
5843     ELEM_MAND_TELV(0x5f, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_SAI_LIST, NULL);
5844     /* MBMS Routing Area List MBMS Routing Area List/11.3.75 M TLV 3-? */
5845     ELEM_MAND_TELV(0x61, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_RA_LIST, NULL);
5846     /* MBMS Session Duration MBMS Session Duration/11.3.72 M TLV 3-? */
5847     ELEM_MAND_TELV(0x5e, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_SESSION_DUR, NULL);
5848     /* MBMS Session Information MBMS Session Information/11.3.76 M TLV 3 */
5849     ELEM_MAND_TELV(0x62, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_SESSION_INF, NULL);
5850     /* Time to MBMS Data Transfer Time to MBMS Data Transfer/11.3.92 M TLV 3 */
5851     ELEM_MAND_TELV(0x71, BSSGP_PDU_TYPE, DE_BSSGP_TIME_TO_MBMS_DATA_TRAN, NULL);
5852     /* Allocation/Retention Priority Priority/11.3.27 O TLV 3 */
5853     ELEM_OPT_TELV(0x17, GSM_A_PDU_TYPE_BSSMAP, BE_PRIO, NULL);
5854     /* MBMS Session Repetition Number MBMS Session Repetition Number/11.3.93 O TLV 3 */
5855     ELEM_MAND_TELV(0x72, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_SESSION_REP_NO, NULL);
5856
5857     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5858 }
5859 /*
5860  * 10.7.6   MBMS-SESSION-UPDATE-RESPONSE
5861  */
5862 static void
5863 bssgp_mbms_session_uptate_resp(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
5864 {
5865     guint32 curr_offset;
5866     guint32 consumed;
5867     guint   curr_len;
5868
5869     curr_offset = offset;
5870     curr_len = len;
5871
5872     /* This PDU allows a BSS to acknowledge to SGSN that it will update the MBMS service area list of an ongoing MBMS
5873      * broadcast service session or to indicate to SGSN why the MBMS Service Context cannot be created or is released by the BSS.
5874      */
5875
5876     /* Direction: BSS to SGSN */
5877     pinfo->link_dir = P2P_DIR_UL;
5878
5879     /* TMGI TMGI/ 11.3.77 M TLV 3-8 */
5880     ELEM_MAND_TELV(0x5c, GSM_A_PDU_TYPE_GM, DE_TMGI, NULL);
5881     /* MBMS Session Identity MBMS Session Identity/ 11.3.71 O TLV 3 */
5882     ELEM_OPT_TELV(0x5d, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_SESSION_ID, NULL);
5883     /* MBMS Response MBMS Response/ 11.3.74 M TLV 3 */
5884     ELEM_OPT_TELV(0x60, BSSGP_PDU_TYPE, DE_BSSGP_MBMS_RESPONSE, NULL);
5885
5886     EXTRANEOUS_DATA_CHECK_EXPERT(curr_len, 0, pinfo);
5887 }
5888
5889 static const value_string bssgp_msg_strings[] = {
5890 /* 0x00 */  { BSSGP_PDU_DL_UNITDATA,                  "DL-UNITDATA" },                  /* 10.2.1 DL-UNITDATA */
5891 /* 0x01 */  { BSSGP_PDU_UL_UNITDATA,                  "UL-UNITDATA" },                  /* 10.2.2 UL-UNITDATA */
5892 /* 0x02 */  { BSSGP_PDU_RA_CAPABILITY,                "RA-CAPABILITY" },                /* 10.2.3 RA-CAPABILITY */
5893 /* NOTE 1: This value was allocated in an earlier version of the protocol and shall not be used */
5894 /* 0x03 */  { BSSGP_PDU_PTM_UNITDATA,                 "Reserved" },                     /* 10.2.4 (void) */
5895 /* 0x04 */  { BSSGP_PDU_DL_MBMS_UNITDATA,             "DL-MBMS-UNITDATA" },             /* 10.2.5 DL-MBMS-UNITDATA */
5896 /* 0x05 */  { BSSGP_PDU_UL_MBMS_UNITDATA,             "UL-MBMS-UNITDATA" },             /* 10.2.6 UL-MBMS-UNITDATA */
5897 /* 0x06 */  { BSSGP_PDU_PAGING_PS,                    "PAGING-PS" },                    /* 10.3.1 PAGING PS */
5898 /* 0x07 */  { BSSGP_PDU_PAGING_CS,                    "PAGING-CS" },                    /* 10.3.2 PAGING CS */
5899 /* 0x08 */  { BSSGP_PDU_RA_CAPABILITY_UPDATE,         "RA-CAPABILITY-UPDATE" },         /* 10.3.3 RA-CAPABILITY-UPDATE */
5900 /* 0x09 */  { BSSGP_PDU_RA_CAPABILITY_UPDATE_ACK,     "RA-CAPABILITY-UPDATE-ACK" },     /* 10.3.4 RA-CAPABILITY-UPDATE-ACK */
5901 /* 0x0a */  { BSSGP_PDU_RADIO_STATUS,                 "RADIO-STATUS" },                 /* 10.3.5 RADIO-STATUS */
5902 /* 0x0b */  { BSSGP_PDU_SUSPEND,                      "SUSPEND" },                      /* 10.3.6 SUSPEND */
5903 /* 0x0c */  { BSSGP_PDU_SUSPEND_ACK,                  "SUSPEND-ACK" },                  /* 10.3.7 SUSPEND-ACK */
5904 /* 0x0d */  { BSSGP_PDU_SUSPEND_NACK,                 "SUSPEND-NACK" },                 /* 10.3.8 SUSPEND-NACK */
5905 /* 0x0e */  { BSSGP_PDU_RESUME,                       "RESUME" },                       /* 10.3.9 RESUME */
5906 /* 0x0f */  { BSSGP_PDU_RESUME_ACK,                   "RESUME-ACK" },                   /* 10.3.10 RESUME-ACK */
5907 /* 0x10 */  { BSSGP_PDU_RESUME_NACK,                  "RESUME-NACK" },                  /* 10.3.11 RESUME-NACK */
5908 /* 0x11 to 0x1f Reserved */
5909 /* 0x11 */  { BSSGP_PDU_RESERVED_0X11,                 "Reserved" },                    /*  */
5910 /* 0x12 */  { BSSGP_PDU_RESERVED_0X12,                 "Reserved" },                    /*  */
5911 /* 0x13 */  { BSSGP_PDU_RESERVED_0X13,                 "Reserved" },                    /*  */
5912 /* 0x14 */  { BSSGP_PDU_RESERVED_0X14,                 "Reserved" },                    /*  */
5913 /* 0x15 */  { BSSGP_PDU_RESERVED_0X15,                 "Reserved" },                    /*  */
5914 /* 0x16 */  { BSSGP_PDU_RESERVED_0X16,                 "Reserved" },                    /*  */
5915 /* 0x17 */  { BSSGP_PDU_RESERVED_0X17,                 "Reserved" },                    /*  */
5916 /* 0x18 */  { BSSGP_PDU_RESERVED_0X18,                 "Reserved" },                    /*  */
5917 /* 0x19 */  { BSSGP_PDU_RESERVED_0X19,                 "Reserved" },                    /*  */
5918 /* 0x1a */  { BSSGP_PDU_RESERVED_0X1A,                 "Reserved" },                    /*  */
5919 /* 0x1b */  { BSSGP_PDU_RESERVED_0X1B,                 "Reserved" },                    /*  */
5920 /* 0x1c */  { BSSGP_PDU_RESERVED_0X1C,                 "Reserved" },                    /*  */
5921 /* 0x1d */  { BSSGP_PDU_RESERVED_0X1D,                 "Reserved" },                    /*  */
5922 /* 0x1e */  { BSSGP_PDU_RESERVED_0X1E,                 "Reserved" },                    /*  */
5923 /* 0x1f */  { BSSGP_PDU_RESERVED_0X1F,                 "Reserved" },                    /*  */
5924
5925 /* 0x20 */  { BSSGP_PDU_BVC_BLOCK,                    "BVC-BLOCK" },                    /* 10.4.8 BVC-BLOCK */
5926 /* 0x21 */  { BSSGP_PDU_BVC_BLOCK_ACK,                "BVC-BLOCK-ACK" },                /* 10.4.9 BVC-BLOCK-ACK */
5927 /* 0x22 */  { BSSGP_PDU_BVC_RESET,                    "BVC-RESET" },                    /* 10.4.12 BVC-RESET */
5928 /* 0x23 */  { BSSGP_PDU_BVC_RESET_ACK,                "BVC-RESET-ACK" },                /* 10.4.13 BVC-RESET-ACK */
5929 /* 0x24 */  { BSSGP_PDU_BVC_UNBLOCK,                  "UNBLOCK" },                      /* 10.4.10 BVC-UNBLOCK */
5930 /* 0x25 */  { BSSGP_PDU_BVC_UNBLOCK_ACK,              "UNBLOCK-ACK" },                  /* 10.4.11 BVC-UNBLOCK-ACK */
5931 /* 0x26 */  { BSSGP_PDU_FLOW_CONTROL_BVC,             "FLOW-CONTROL-BVC" },             /* 10.4.4 FLOW-CONTROL-BVC */
5932 /* 0x27 */  { BSSGP_PDU_FLOW_CONTROL_BVC_ACK,         "FLOW-CONTROL-BVC-ACK" },         /* 10.4.5 FLOW-CONTROL-BVC-ACK */
5933 /* 0x28 */  { BSSGP_PDU_FLOW_CONTROL_MS,              "FLOW-CONTROL-MS" },              /* 10.4.6 FLOW-CONTROL-MS */
5934 /* 0x29 */  { BSSGP_PDU_FLOW_CONTROL_MS_ACK,          "FLOW-CONTROL-MS-ACK" },          /* 10.4.7 FLOW-CONTROL-MS-ACK */
5935 /* 0x2a */  { BSSGP_PDU_FLUSH_LL,                     "FLUSH-LL" },                     /* 10.4.1 FLUSH-LL */
5936 /* 0x2b */  { BSSGP_PDU_FLUSH_LL_ACK,                 "FLUSH_LL_ACK" },                 /* 10.4.2 FLUSH-LL-ACK */
5937 /* 0x2c */  { BSSGP_PDU_LLC_DISCARDED,                "LLC-DISCARDED" },                /* 10.4.3 LLC-DISCARDED */
5938 /* 0x2d */  { BSSGP_PDU_FLOW_CONTROL_PFC,             "FLOW-CONTROL-PFC" },             /* 10.4.24 FLOW-CONTROL-PFC */
5939 /* 0x2e */  { BSSGP_PDU_FLOW_CONTROL_PFC_ACK,         "FLOW-CONTROL-PFC-ACK" },         /* 10.4.25 FLOW-CONTROL-PFC-ACK */
5940 /* 0x2f to 0x3f Reserved */
5941 /* 0x2f */  { BSSGP_PDU_RESERVED_0X2F,                 "Reserved" },                    /*  */
5942 /* 0x30 */  { BSSGP_PDU_RESERVED_0X30,                 "Reserved" },                    /*  */
5943 /* 0x31 */  { BSSGP_PDU_RESERVED_0X31,                 "Reserved" },                    /*  */
5944 /* 0x32 */  { BSSGP_PDU_RESERVED_0X32,                 "Reserved" },                    /*  */
5945 /* 0x33 */  { BSSGP_PDU_RESERVED_0X33,                 "Reserved" },                    /*  */
5946 /* 0x34 */  { BSSGP_PDU_RESERVED_0X34,                 "Reserved" },                    /*  */
5947 /* 0x35 */  { BSSGP_PDU_RESERVED_0X35,                 "Reserved" },                    /*  */
5948 /* 0x36 */  { BSSGP_PDU_RESERVED_0X36,                 "Reserved" },                    /*  */
5949 /* 0x37 */  { BSSGP_PDU_RESERVED_0X37,                 "Reserved" },                    /*  */
5950 /* 0x38 */  { BSSGP_PDU_RESERVED_0X38,                 "Reserved" },                    /*  */
5951 /* 0x39 */  { BSSGP_PDU_RESERVED_0X39,                 "Reserved" },                    /*  */
5952 /* 0x3a */  { BSSGP_PDU_RESERVED_0X3A,                 "Reserved" },                    /*  */
5953 /* 0x3b */  { BSSGP_PDU_RESERVED_0X3B,                 "Reserved" },                    /*  */
5954 /* 0x3c */  { BSSGP_PDU_RESERVED_0X3C,                 "Reserved" },                    /*  */
5955 /* 0x3d */  { BSSGP_PDU_RESERVED_0X3D,                 "Reserved" },                    /*  */
5956 /* 0x3e */  { BSSGP_PDU_RESERVED_0X3E,                 "Reserved" },                    /*  */
5957 /* 0x3f */  { BSSGP_PDU_RESERVED_0X3F,                 "Reserved" },                    /*  */
5958
5959 /* 0x40 */  { BSSGP_PDU_SGSN_INVOKE_TRACE,            "SGSN-INVOKE-TRACE" },            /* 10.4.15 SGSN-INVOKE-TRACE */
5960 /* 0x41 */  { BSSGP_PDU_STATUS,                       "STATUS" },                       /* 10.4.14 STATUS */
5961 /* 0x42 to 0x4f Reserved */
5962 /* 0x42 */  { BSSGP_PDU_RESERVED_0X42,                 "Reserved" },                    /*  */
5963 /* 0x43 */  { BSSGP_PDU_RESERVED_0X43,                 "Reserved" },                    /*  */
5964 /* 0x44 */  { BSSGP_PDU_RESERVED_0X44,                 "Reserved" },                    /*  */
5965 /* 0x45 */  { BSSGP_PDU_RESERVED_0X45,                 "Reserved" },                    /*  */
5966 /* 0x46 */  { BSSGP_PDU_RESERVED_0X46,                 "Reserved" },                    /*  */
5967 /* 0x47 */  { BSSGP_PDU_RESERVED_0X47,                 "Reserved" },                    /*  */
5968 /* 0x48 */  { BSSGP_PDU_RESERVED_0X48,                 "Reserved" },                    /*  */
5969 /* 0x49 */  { BSSGP_PDU_RESERVED_0X49,                 "Reserved" },                    /*  */
5970 /* 0x4a */  { BSSGP_PDU_RESERVED_0X4A,                 "Reserved" },                    /*  */
5971 /* 0x4b */  { BSSGP_PDU_RESERVED_0X4B,                 "Reserved" },                    /*  */
5972 /* 0x4c */  { BSSGP_PDU_RESERVED_0X4C,                 "Reserved" },                    /*  */
5973 /* 0x4d */  { BSSGP_PDU_RESERVED_0X4D,                 "Reserved" },                    /*  */
5974 /* 0x4e */  { BSSGP_PDU_RESERVED_0X4E,                 "Reserved" },                    /*  */
5975 /* 0x4f */  { BSSGP_PDU_RESERVED_0X4F,                 "Reserved" },                    /*  */
5976 /* 0x50 */  { BSSGP_PDU_DOWNLOAD_BSS_PFC,              "DOWNLOAD-BSS-PFC" },            /* 10.4.16  DOWNLOAD-BSS-PFC */
5977 /* 0x51 */  { BSSGP_PDU_CREATE_BSS_PFC,                "CREATE-BSS-PFC" },              /* 10.4.17 CREATE-BSS-PFC */
5978 /* 0x52 */  { BSSGP_PDU_CREATE_BSS_PFC_ACK,            "CREATE-BSS-PFC-ACK" },          /* 10.4.18 CREATE-BSS-PFC-ACK */
5979 /* 0x53 */  { BSSGP_PDU_CREATE_BSS_PFC_NACK,           "CREATE-BSS-PFC-NACK" },         /* 10.4.19 CREATE-BSS-PFC-NACK */
5980 /* 0x54 */  { BSSGP_PDU_MODIFY_BSS_PFC,                "MODIFY-BSS-PFC" },              /* 10.4.20 MODIFY-BSS-PFC */
5981 /* 0x55 */  { BSSGP_PDU_MODIFY_BSS_PFC_ACK,            "MODIFY-BSS-PFC-ACK" },          /* 10.4.21 MODIFY-BSS-PFC-ACK */
5982 /* 0x56 */  { BSSGP_PDU_DELETE_BSS_PFC,                "DELETE-BSS-PFC" },              /* 10.4.22 DELETE-BSS-PFC */
5983 /* 0x57 */  { BSSGP_PDU_DELETE_BSS_PFC_ACK,            "DELETE-BSS-PFC-ACK" },          /* 10.4.23 DELETE-BSS-PFC-ACK */
5984 /* 0x58 */  { BSSGP_PDU_DELETE_BSS_PFC_REQ,            "DELETE-BSS-PFC-REQ" },          /* 10.4.26 DELETE-BSS-PFC-REQ */
5985 /* 0x59 */  { BSSGP_PDU_PS_HANDOVER_REQUIRED,          "PS-HANDOVER-REQUIRED" },        /* 10.4.27 PS-HANDOVER-REQUIRED */
5986 /* 0x5a */  { BSSGP_PDU_PS_HANDOVER_REQUIRED_ACK,      "PS-HANDOVER-REQUIRED-ACK" },    /* 10.4.28 PS-HANDOVER-REQUIRED-ACK */
5987 /* 0x5b */  { BSSGP_PDU_PS_HANDOVER_REQUIRED_NACK,     "PS-HANDOVER-REQUIRED-NACK" },   /* 10.4.29 PS-HANDOVER-REQUIRED-NACK */
5988 /* 0x5c */  { BSSGP_PDU_PS_HANDOVER_REQUEST,           "PS-HANDOVER-REQUEST" },         /* 10.4.30 PS-HANDOVER-REQUEST */
5989 /* 0x5d */  { BSSGP_PDU_PS_HANDOVER_REQUEST_ACK,       "PS-HANDOVER-REQUEST-ACK" },     /* 10.4.31 PS-HANDOVER-REQUEST-ACK */
5990 /* 0x5e */  { BSSGP_PDU_PS_HANDOVER_REQUEST_NACK,      "PS-HANDOVER-REQUEST-NACK" },    /* 10.4.31 10.4.32 PS-HANDOVER-REQUEST-NACK */
5991
5992 /* 0x5f */  { BSSGP_PDU_RESERVED_0X5F,                 "Reserved" },                    /*  */
5993
5994 /* 0x60 */  { BSSGP_PDU_PERFORM_LOCATION_REQUEST,     "PERFORM-LOCATION-REQUEST" },     /* 10.5.1 PERFORM-LOCATION-REQUEST */
5995 /* 0x61 */  { BSSGP_PDU_PERFORM_LOCATION_RESPONSE,    "PERFORM-LOCATION-RESPONSE" },    /* 10.5.2 PERFORM-LOCATION-RESPONSE */
5996 /* 0x62 */  { BSSGP_PDU_PERFORM_LOCATION_ABORT,       "PERFORM-LOCATION-ABORT" },       /* 10.5.3 PERFORM-LOCATION-ABORT */
5997 /* 0x63 */  { BSSGP_PDU_POSITION_COMMAND,             "POSITION-COMMAND" },             /* 10.5.4 POSITION-COMMAND */
5998 /* 0x64 */  { BSSGP_PDU_POSITION_RESPONSE,            "POSITION-RESPONSE" },            /* 10.5.5 POSITION-RESPONSE */
5999
6000 /* 0x65 */  { BSSGP_PDU_RESERVED_0X65,                 "Reserved" },                    /*  */
6001 /* 0x66 */  { BSSGP_PDU_RESERVED_0X66,                 "Reserved" },                    /*  */
6002 /* 0x67 */  { BSSGP_PDU_RESERVED_0X67,                 "Reserved" },                    /*  */
6003 /* 0x68 */  { BSSGP_PDU_RESERVED_0X68,                 "Reserved" },                    /*  */
6004 /* 0x69 */  { BSSGP_PDU_RESERVED_0X69,                 "Reserved" },                    /*  */
6005 /* 0x6a */  { BSSGP_PDU_RESERVED_0X6A,                 "Reserved" },                    /*  */
6006 /* 0x6b */  { BSSGP_PDU_RESERVED_0X6B,                 "Reserved" },                    /*  */
6007 /* 0x6b */  { BSSGP_PDU_RESERVED_0X6C,                 "Reserved" },                    /*  */
6008 /* 0x6d */  { BSSGP_PDU_RESERVED_0X6D,                 "Reserved" },                    /*  */
6009 /* 0x6e */  { BSSGP_PDU_RESERVED_0X6E,                 "Reserved" },                    /*  */
6010 /* 0x6f */  { BSSGP_PDU_RESERVED_0X6F,                 "Reserved" },                    /*  */
6011
6012 /* 0x70 */  { BSSGP_PDU_RAN_INFORMATION,              "RAN-INFORMATION" },              /* 10.6.2 RAN-INFORMATION */
6013 /* 0x71 */  { BSSGP_PDU_RAN_INFORMATION_REQUEST,      "RAN-INFORMATION-REQUEST" },      /* 10.6.1 RAN-INFORMATION-REQUEST */
6014 /* 0x72 */  { BSSGP_PDU_RAN_INFORMATION_ACK,          "RAN-INFORMATION-ACK" },          /* 10.6.3 RAN-INFORMATION-ACK */
6015 /* 0x73 */  { BSSGP_PDU_RAN_INFORMATION_ERROR,        "RAN-INFORMATION-ERROR" },        /* 10.6.4 RAN-INFORMATION-ERROR */
6016 /* 0x74 */  { BSSGP_PDU_RAN_INFORMATION_APP_ERROR,    "RAN-INFORMATION-APPLICATION-ERROR" }, /* 10.6.5 RAN-INFORMATION-APPLICATION-ERROR */
6017 /* 0x75 */  { BSSGP_PDU_RESERVED_0X75,                 "Reserved" },                    /*  */
6018 /* 0x76 */  { BSSGP_PDU_RESERVED_0X76,                 "Reserved" },                    /*  */
6019 /* 0x77 */  { BSSGP_PDU_RESERVED_0X77,                 "Reserved" },                    /*  */
6020 /* 0x78 */  { BSSGP_PDU_RESERVED_0X78,                 "Reserved" },                    /*  */
6021 /* 0x79 */  { BSSGP_PDU_RESERVED_0X79,                 "Reserved" },                    /*  */
6022 /* 0x7a */  { BSSGP_PDU_RESERVED_0X7A,                 "Reserved" },                    /*  */
6023 /* 0x7b */  { BSSGP_PDU_RESERVED_0X7B,                 "Reserved" },                    /*  */
6024 /* 0x7c */  { BSSGP_PDU_RESERVED_0X7C,                 "Reserved" },                    /*  */
6025 /* 0x7d */  { BSSGP_PDU_RESERVED_0X7D,                 "Reserved" },                    /*  */
6026 /* 0x7e */  { BSSGP_PDU_RESERVED_0X7E,                 "Reserved" },                    /*  */
6027 /* 0x7f */  { BSSGP_PDU_RESERVED_0X7F,                 "Reserved" },                    /*  */
6028 /* 0x80 */  { BSSGP_PDU_MBMS_SESSION_START_REQ,        "MBMS-SESSION-START-REQUEST" },  /* 10.7.1   MBMS-SESSION-START-REQUEST */
6029 /* 0x81 */  { BSSGP_PDU_MBMS_SESSION_START_RESP,       "MBMS-SESSION-START-RESPONSE" }, /* 10.7.2   MBMS-SESSION-START-RESPONSE */
6030 /* 0x82 */  { BSSGP_PDU_MBMS_SESSION_STOP_REQ,         "MBMS-SESSION-STOP-REQUEST" },   /* 10.7.3   MBMS-SESSION-STOP-REQUEST */
6031 /* 0x83 */  { BSSGP_PDU_MBMS_SESSION_STOP_RESP,        "MBMS-SESSION-STOP-RESPONSE" },  /* 10.7.4   MBMS-SESSION-STOP-RESPONSE */
6032 /* 0x84 */  { BSSGP_PDU_MBMS_SESSION_UPDATE_REQ,       "MBMS-SESSION-UPDATE-REQUEST" }, /* 10.7.5   MBMS-SESSION-UPDATE-REQUEST */
6033 /* 0x85 */  { BSSGP_PDU_MBMS_SESSION_UPDATE_RESP,      "MBMS-SESSION-UPDATE-RESPONSE" },/* 10.7.6   MBMS-SESSION-UPDATE-RESPONSE */
6034
6035 /* 0x86 */  { BSSGP_PDU_RESERVED_0X86,                 "Reserved" },                    /*  */
6036 /* 0x87 */  { BSSGP_PDU_RESERVED_0X87,                 "Reserved" },                    /*  */
6037 /* 0x88 */  { BSSGP_PDU_RESERVED_0X88,                 "Reserved" },                    /*  */
6038 /* 0x89 */  { BSSGP_PDU_RESERVED_0X89,                 "Reserved" },                    /*  */
6039 /* 0x8a */  { BSSGP_PDU_RESERVED_0X8A,                 "Reserved" },                    /*  */
6040 /* 0x8b */  { BSSGP_PDU_RESERVED_0X8B,                 "Reserved" },                    /*  */
6041 /* 0x8c */  { BSSGP_PDU_RESERVED_0X8C,                 "Reserved" },                    /*  */
6042 /* 0x8d */  { BSSGP_PDU_RESERVED_0X8D,                 "Reserved" },                    /*  */
6043 /* 0x8e */  { BSSGP_PDU_RESERVED_0X8E,                 "Reserved" },                    /*  */
6044 /* 0x8f */  { BSSGP_PDU_RESERVED_0X8F,                 "Reserved" },                    /*  */
6045 /* 0x90 */  { BSSGP_PDU_RESERVED_0X90,                 "Reserved" },                    /*  */
6046
6047 /* 0x91 */  {BSSGP_PDU_PS_HANDOVER_COMPLETE,           "PS-HANDOVER-COMPLETE" },        /* 10.4.33  PS-HANDOVER-COMPLETE */
6048 /* 0x92 */  {BSSGP_PDU_PS_HANDOVER_CANCEL,             "PS-HANDOVER-CANCEL" },          /* 10.4.34  PS-HANDOVER-CANCEL */
6049 /* 0x93 */  {BSSGP_PDU_PS_HANDOVER_COMPLETE_ACK,       "PS-HANDOVER-COMPLETE-ACK" },    /* 10.4.35  PS-HANDOVER-COMPLETE-ACK*/
6050
6051     { 0,    NULL }
6052 };
6053 static value_string_ext bssgp_msg_strings_ext = VALUE_STRING_EXT_INIT(bssgp_msg_strings);
6054
6055 #define NUM_BSSGP_MSG (sizeof(bssgp_msg_strings)/sizeof(value_string))
6056 static gint ett_bssgp_msg[NUM_BSSGP_MSG];
6057 static void (*bssgp_msg_fcn[])(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len) = {
6058 /* 0x00 to 0x10 */
6059     bssgp_dl_unitdata,                  /* 10.2.1 DL-UNITDATA */
6060     bssgp_ul_unitdata,                  /* 10.2.2 UL-UNITDATA */
6061     bssgp_ra_cap,                       /* 10.2.3 RA-CAPABILITY */
6062     NULL,                               /* 10.2.4 (void) */
6063     bssgp_dl_mbms_unitdata,             /* 10.2.5 DL-MBMS-UNITDATA */
6064     bssgp_ul_mbms_unitdata,             /* 10.2.6 UL-MBMS-UNITDATA */
6065     bssgp_paging_ps,                    /* 10.3.1 PAGING PS */
6066     bssgp_paging_cs,                    /* 10.3.2 PAGING CS */
6067     bssgp_ra_cap_upd,                   /* 10.3.3 RA-CAPABILITY-UPDATE */
6068     bssgp_ra_cap_upd_ack,               /* 10.3.3 RA-CAPABILITY-UPDATE */
6069     bssgp_ra_status,                    /* 10.3.5 RADIO-STATUS */
6070     bssgp_suspend,                      /* 10.3.6 SUSPEND */
6071     bssgp_suspend_ack,                  /* 10.3.7 SUSPEND-ACK */
6072     bssgp_suspend_nack,                 /* 10.3.8 SUSPEND-NACK */
6073     bssgp_resume,                       /* 10.3.9 RESUME */
6074     bssgp_resume_ack,                   /* 10.3.10 RESUME-ACK */
6075     bssgp_resume_nack,                  /* 10.3.11 RESUME-NACK */
6076
6077 /* 0x11 to 0x1f Reserved */
6078     NULL,                            /* 0x11 */
6079     NULL,                            /* 0x12 */
6080     NULL,                            /* 0x13 */
6081     NULL,                            /* 0x14 */
6082     NULL,                            /* 0x15 */
6083     NULL,                            /* 0x16 */
6084     NULL,                            /* 0x17 */
6085     NULL,                            /* 0x18 */
6086     NULL,                            /* 0x19 */
6087     NULL,                            /* 0x1A */
6088     NULL,                            /* 0x1B */
6089     NULL,                            /* 0x1C */
6090     NULL,                            /* 0x1D */
6091     NULL,                            /* 0x1E */
6092     NULL,                            /* 0x1F */
6093
6094 /* 0x20 to 0x2e */
6095     bssgp_bvc_block,                    /* 10.4.8 BVC-BLOCK */
6096     bssgp_bvc_block_ack,                /* 10.4.9 BVC-BLOCK-ACK */
6097     bssgp_bvc_reset,                    /* 10.4.12 BVC-RESET */
6098     bssgp_bvc_reset_ack,                /* 10.4.13 BVC-RESET-ACK */
6099     bssgp_bvc_un_block,                 /* 10.4.10 BVC-UNBLOCK */
6100     bssgp_bvc_un_block_ack,             /* 10.4.11 BVC-UNBLOCK-ACK */
6101     bssgp_flow_control_bvc,             /* 10.4.4 FLOW-CONTROL-BVC */
6102     bssgp_flow_control_bvc_ack,         /* 10.4.5 FLOW-CONTROL-BVC-ACK */
6103     bssgp_flow_control_ms,              /* 10.4.6 FLOW-CONTROL-MS */
6104     bssgp_flow_control_ms_ack,          /* 10.4.7 FLOW-CONTROL-MS-ACK */
6105     bssgp_flush_ll,                     /* 10.4.1 FLUSH-LL */
6106     bssgp_flush_ll_ack,                 /* 10.4.2 FLUSH-LL-ACK */
6107     bssgp_llc_discarded,                /* 10.4.3 LLC-DISCARDED */
6108     bssgp_flow_cntrl_pfc,               /* 10.4.24 FLOW-CONTROL-PFC */
6109     bssgp_flow_cntrl_pfc_ack,           /* 10.4.25 FLOW-CONTROL-PFC-ACK */
6110
6111 /* 0x2f to 0x3f Reserved */
6112     NULL,                              /* 0x2f */
6113     NULL,                              /* 0x30 */
6114     NULL,                              /* 0x31 */
6115     NULL,                              /* 0x32 */
6116     NULL,                              /* 0x33 */
6117     NULL,                              /* 0x34 */
6118     NULL,                              /* 0x35 */
6119     NULL,                              /* 0x36 */
6120     NULL,                              /* 0x37 */
6121     NULL,                              /* 0x38 */
6122     NULL,                              /* 0x39 */
6123     NULL,                              /* 0x3A */
6124     NULL,                              /* 0x3B */
6125     NULL,                              /* 0x3C */
6126     NULL,                              /* 0x3D */
6127     NULL,                              /* 0x3E */
6128     NULL,                              /* 0x3F */
6129
6130 /* 0x40 to 0x41 */
6131     bssgp_sgsn_invoke_trace,            /* 10.4.15 SGSN-INVOKE-TRACE */
6132     bssgp_status,                       /* 10.4.14 STATUS */
6133
6134 /* 0x42 to 0x4f Reserved */
6135     NULL,                              /* 0x42 */
6136     NULL,                              /* 0x43 */
6137     NULL,                              /* 0x44 */
6138     NULL,                              /* 0x45 */
6139     NULL,                              /* 0x46 */
6140     NULL,                              /* 0x47 */
6141     NULL,                              /* 0x48 */
6142     NULL,                              /* 0x49 */
6143     NULL,                              /* 0x4A */
6144     NULL,                              /* 0x4B */
6145     NULL,                              /* 0x4C */
6146     NULL,                              /* 0x4D */
6147     NULL,                              /* 0x4E */
6148     NULL,                              /* 0x4F */
6149
6150 /* 0x50 to 0x5e */
6151     bssgp_download_bss_pfc,             /* 10.4.16    DOWNLOAD-BSS-PFC */
6152     bssgp_create_bss_pfc,               /* 10.4.17 CREATE-BSS-PFC */
6153     bssgp_create_bss_pfc_ack,           /* 10.4.18 CREATE-BSS-PFC-ACK */
6154     bssgp_create_bss_pfc_nack,          /* 10.4.19 CREATE-BSS-PFC-NACK */
6155     bssgp_modify_bss_pfc,               /* 10.4.20 MODIFY-BSS-PFC */
6156     bssgp_modify_bss_pfc_ack,           /* 10.4.21 MODIFY-BSS-PFC-ACK */
6157     bssgp_delete_bss_pfc,               /* 10.4.22 DELETE-BSS-PFC */
6158     bssgp_delete_bss_pfc_ack,           /* 10.4.23 DELETE-BSS-PFC-ACK */
6159     bssgp_delete_bss_pfc_req,           /* 10.4.26 DELETE-BSS-PFC-REQ */
6160     bssgp_ps_ho_required,               /* 10.4.27 PS-HANDOVER-REQUIRED */
6161     bssgp_ps_ho_required_ack,           /* 10.4.28 PS-HANDOVER-REQUIRED-ACK */
6162     bssgp_ps_ho_required_nack,          /* 10.4.29 PS-HANDOVER-REQUIRED-NACK */
6163     bssgp_ps_ho_request,                /* 10.4.30 PS-HANDOVER-REQUEST */
6164     bssgp_ps_ho_request_ack,            /* 10.4.31 PS-HANDOVER-REQUEST-ACK */
6165     bssgp_ps_ho_request_nack,           /* 10.4.31 10.4.32 PS-HANDOVER-REQUEST-NACK */
6166
6167 /* 0x5f Reserved */
6168     NULL,                              /* 0x5F */
6169
6170 /* 0x60 */
6171     bssgp_perform_loc_request,          /* 10.5.1 PERFORM-LOCATION-REQUEST */
6172     bssgp_perform_loc_response,         /* 10.5.2 PERFORM-LOCATION-RESPONSE */
6173     bssgp_perform_loc_response_abort,   /* 10.5.3 PERFORM-LOCATION-ABORT */
6174     bssgp_pos_cmd,                      /* 10.5.4 POSITION-COMMAND */
6175     bssgp_pos_resp,                     /* 10.5.5 POSITION-RESPONSE */
6176
6177 /* 0x65 to 0x6f Reserved */
6178     NULL,                              /* 0x65 */
6179     NULL,                              /* 0x66 */
6180     NULL,                              /* 0x67 */
6181     NULL,                              /* 0x68 */
6182     NULL,                              /* 0x69 */
6183     NULL,                              /* 0x6a */
6184     NULL,                              /* 0x6b */
6185     NULL,                              /* 0x6c */
6186     NULL,                              /* 0x6d */
6187     NULL,                              /* 0x6e */
6188     NULL,                              /* 0x6f */
6189     bssgp_ran_inf,                     /* 10.6.2 RAN-INFORMATION */
6190     bssgp_ran_inf_request,             /* 10.6.1 RAN-INFORMATION-REQUEST */
6191     bssgp_ran_inf_request_ack,         /* 10.6.3 RAN-INFORMATION-ACK */
6192     bssgp_ran_inf_err,                 /* 10.6.4 RAN-INFORMATION-ERROR */
6193     bssgp_ran_inf_app_err,             /* 10.6.5 RAN-INFORMATION-APPLICATION-ERROR */
6194     NULL,                              /* 0x75 */
6195     NULL,                              /* 0x76 */
6196     NULL,                              /* 0x77 */
6197     NULL,                              /* 0x78 */
6198     NULL,                              /* 0x79 */
6199     NULL,                              /* 0x7a */
6200     NULL,                              /* 0x7b */
6201     NULL,                              /* 0x7c */
6202     NULL,                              /* 0x7d */
6203     NULL,                              /* 0x7e */
6204     NULL,                              /* 0x7f */
6205     bssgp_mbms_session_start_req,      /* 10.7.1    MBMS-SESSION-START-REQUEST */
6206     bssgp_mbms_session_start_resp,     /* 10.7.2    MBMS-SESSION-START-RESPONSE */
6207     bssgp_mbms_session_stop_req,       /* 10.7.3    MBMS-SESSION-STOP-REQUEST */
6208     bssgp_mbms_session_stop_resp,      /* 10.7.4    MBMS-SESSION-STOP-RESPONSE */
6209     bssgp_mbms_session_update_req,     /* 10.7.5    MBMS-SESSION-UPDATE-REQUEST */
6210     bssgp_mbms_session_uptate_resp,    /* 10.7.6    MBMS-SESSION-UPDATE-RESPONSE */
6211     NULL,                              /* 0x86 */
6212     NULL,                              /* 0x87 */
6213     NULL,                              /* 0x88 */
6214     NULL,                              /* 0x89 */
6215     NULL,                              /* 0x8a */
6216     NULL,                              /* 0x8b */
6217     NULL,                              /* 0x8c */
6218     NULL,                              /* 0x8d */
6219     NULL,                              /* 0x8e */
6220     NULL,                              /* 0x8f */
6221     NULL,                              /* 0x90 */
6222     bssgp_ps_ho_complete,              /* 0x91 10.4.33  PS-HANDOVER-COMPLETE */
6223     bssgp_ps_ho_cancel,                /* 0x92 10.4.34  PS-HANDOVER-CANCEL */
6224     bssgp_ps_ho_complete_ack,          /* 0x93 10.4.35  PS-HANDOVER-COMPLETE-ACK*/
6225     NULL,    /* NONE */
6226 };
6227
6228 void get_bssgp_msg_params(guint8 oct, const gchar **msg_str, int *ett_tree, int *hf_idx, msg_fcn *msg_fcn)
6229 {
6230     gint            idx;
6231
6232     *msg_str = match_strval_idx_ext((guint32) (oct & 0xff), &bssgp_msg_strings_ext, &idx);
6233     *ett_tree = ett_bssgp_msg[idx];
6234     *hf_idx = hf_bssgp_msg_type;
6235     *msg_fcn = bssgp_msg_fcn[idx];
6236
6237     return;
6238 }
6239
6240 static void
6241 dissect_bssgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
6242 {
6243
6244     proto_item *ti;
6245     proto_tree *bssgp_tree = NULL;
6246     int               offset = 0;
6247     guint32           len;
6248     const gchar       *msg_str = NULL;
6249     gint              ett_tree;
6250     int               hf_idx;
6251     void              (*msg_fcn)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len);
6252
6253     /* Save pinfo */
6254     gpinfo = pinfo;
6255     g_rim_application_identity = 0;
6256     gparent_tree = tree;
6257     len = tvb_length(tvb);
6258
6259     col_set_str(pinfo->cinfo, COL_PROTOCOL, "BSSGP");
6260
6261     col_clear(pinfo->cinfo, COL_INFO);
6262
6263
6264     g_pdu_type = tvb_get_guint8(tvb,offset);
6265     if (tree) {
6266         ti = proto_tree_add_item(tree, proto_bssgp, tvb, 0, -1, ENC_NA);
6267         bssgp_tree = proto_item_add_subtree(ti, ett_bssgp);
6268     }
6269
6270     /* Messge type IE*/
6271     msg_fcn = NULL;
6272     ett_tree = -1;
6273     hf_idx = -1;
6274     msg_str = NULL;
6275
6276     get_bssgp_msg_params(g_pdu_type, &msg_str, &ett_tree, &hf_idx, &msg_fcn);
6277
6278     if(msg_str){
6279         col_add_fstr(pinfo->cinfo, COL_INFO, "%s", msg_str);
6280     }else{
6281         proto_tree_add_text(bssgp_tree, tvb, offset, 1,"Unknown message 0x%x",g_pdu_type);
6282         return;
6283     }
6284
6285     /*
6286      * Add BSSGP message name
6287      */
6288     proto_tree_add_item(bssgp_tree, hf_idx, tvb, offset, 1, ENC_BIG_ENDIAN);
6289     offset++;
6290
6291
6292     /*
6293      * decode elements
6294      */
6295     if (msg_fcn == NULL)
6296     {
6297         proto_tree_add_text(bssgp_tree, tvb, offset, len - offset, "Message Elements");
6298     }
6299     else
6300     {
6301         (*msg_fcn)(tvb, bssgp_tree, pinfo, offset, len - offset);
6302     }
6303 }
6304
6305 void
6306 proto_register_bssgp(void)
6307 {
6308     guint       i;
6309     guint       last_offset;
6310
6311     static hf_register_info hf[] = {
6312         { &hf_bssgp_msg_type,
6313           { "PDU Type", "bssgp.pdu_type",
6314             FT_UINT8, BASE_HEX|BASE_EXT_STRING, &bssgp_msg_strings_ext, 0x0,
6315             NULL, HFILL }
6316         },
6317         { &hf_bssgp_elem_id,
6318           { "Element ID", "bssgp.elem_id",
6319             FT_UINT8, BASE_DEC, NULL, 0,
6320             NULL, HFILL }
6321         },
6322         { &hf_bssgp_bss_area_ind,
6323           { "BSS indicator", "bssgp.bss_ind",
6324             FT_UINT8, BASE_HEX, NULL, 0x0,
6325             NULL, HFILL }
6326         },
6327         { &hf_bssgp_bvci,
6328           { "BVCI", "bssgp.bvci",
6329             FT_UINT16, BASE_HEX, NULL, 0x0,
6330             NULL, HFILL }
6331         },
6332         { &hf_bssgp_bmax,
6333           { "Bmax(x 100 or in increments as defined by the Flow Control Granularity IE)", "bssgp.bmax",
6334             FT_UINT16, BASE_DEC, NULL, 0x0,
6335             NULL, HFILL }
6336         },
6337         { &hf_bssgp_r,
6338           { "R(x 100 or in increments as defined by the Flow Control Granularity IE)", "bssgp.r",
6339             FT_UINT16, BASE_DEC, NULL, 0x0,
6340             NULL, HFILL }
6341         },
6342         { &hf_bssgp_r_pfc,
6343           { "R_PFC(x 100 or in increments as defined by the Flow Control Granularity IE)", "bssgp.r_pfc",
6344             FT_UINT16, BASE_DEC, NULL, 0x0,
6345             NULL, HFILL }
6346         },
6347         { &hf_bssgp_bucket_size,
6348           { "Bmax(x 100 or in increments as defined by the Flow Control Granularity IE)", "bssgp.bucket_size",
6349             FT_UINT16, BASE_DEC, NULL, 0x0,
6350             NULL, HFILL }
6351         },
6352         { &hf_bssgp_bmax_pfc,
6353           { "Bmax_PFC(x 100 or in increments as defined by the Flow Control Granularity IE)", "bssgp.bmax_pfc",
6354             FT_UINT16, BASE_DEC, NULL, 0x0,
6355             NULL, HFILL }
6356         },
6357         { &hf_bssgp_omc_id,
6358           { "OMC identity", "bssgp.omc_id",
6359             FT_BYTES, BASE_NONE, NULL, 0x0,
6360             NULL, HFILL }
6361         },
6362         { &hf_bssgp_nsei,
6363           { "NSEI", "bssgp.nsei",
6364             FT_UINT16, BASE_HEX, NULL, 0x0,
6365             NULL, HFILL }
6366         },
6367         { &hf_bssgp_rrlp_flag1,
6368           { "Flag 1", "bssgp.rrlp_flag1",
6369             FT_BOOLEAN, 8, TFS(&bssgp_rrlp_flg1_vals), 0x01,
6370             NULL, HFILL }
6371         },
6372         { &hf_bssgp_ci,
6373           { "CI", "bssgp.ci",
6374             FT_UINT16, BASE_HEX, NULL, 0x0,
6375             "Cell Identity", HFILL }
6376         },
6377         { &hf_bssgp_flush_action,
6378           { "Action", "bssgp.flush_action",
6379             FT_UINT8, BASE_DEC, VALS(bssgp_flush_action_vals), 0x0,
6380             NULL, HFILL }
6381         },
6382         { &hf_bssgp_llc_frames_disc,
6383           { "Number of frames discarded", "bssgp.llc_frames_disc",
6384             FT_UINT8, BASE_DEC, NULL, 0x0,
6385             NULL, HFILL }
6386         },
6387         { &hf_bssgp_ra_discriminator,
6388           { "Routing Address Discriminator", "bssgp.rad",
6389             FT_UINT8, BASE_DEC, VALS(bssgp_ra_discriminator_vals), 0x0f,
6390             NULL, HFILL }
6391         },
6392         { &hf_bssgp_rim_app_id,
6393           { "RIM Application Identity", "bssgp.rim_app_id",
6394             FT_UINT8, BASE_DEC, VALS(bssgp_rim_appid_vals), 0x0,
6395             NULL, HFILL }
6396         },
6397         { &hf_bssgp_rim_seq_no,
6398           { "RIM Sequence Number", "bssgp.rim_seq_no",
6399             FT_UINT32, BASE_DEC, NULL, 0x0,
6400             NULL, HFILL }
6401         },
6402         { &hf_bssgp_rat_discriminator,
6403           { "RAT discriminator", "bssgp.rat_discriminator",
6404             FT_UINT8, BASE_DEC, VALS(bssgp_rat_discriminator_vals), 0x0f,
6405             NULL, HFILL }
6406         },
6407         { &hf_bssgp_nacc_cause,
6408           { "NACC Cause", "bssgp.nacc_cause",
6409             FT_UINT8, BASE_DEC, VALS(bssgp_nacc_cause_vals), 0x0,
6410             NULL, HFILL }
6411         },
6412         { &hf_bssgp_s13_cause,
6413           { "SI3 Cause", "bssgp.s13_cause",
6414             FT_UINT8, BASE_DEC, VALS(bssgp_s13_cause_vals), 0x0,
6415             NULL, HFILL }
6416         },
6417         { &hf_bssgp_mbms_data_ch_cause,
6418           { "MBMS data channel Cause", "bssgp.mbms_data_ch_cause",
6419             FT_UINT8, BASE_DEC, VALS(bssgp_mbms_data_ch_cause_vals), 0x0,
6420             NULL, HFILL }
6421         },
6422         { &hf_bssgp_utra_si_cause,
6423           { "UTRA SI Cause", "bssgp.utra_si_cause",
6424             FT_UINT8, BASE_DEC, VALS(bssgp_utra_si_cause_vals), 0x0,
6425             NULL, HFILL }
6426         },
6427         { &hf_bssgp_num_si_psi,
6428           { "Number of SI/PSI", "bssgp.num_si_psi",
6429             FT_UINT8, BASE_DEC, NULL, 0xfe,
6430             NULL, HFILL }
6431         },
6432         {&hf_bssgp_si_psi_type,
6433          { "Type", "bssgp.si_psi_type",
6434            FT_BOOLEAN, 8, TFS(&bssgp_si_psi_type_vals), 0x01,
6435            NULL, HFILL }
6436         },
6437         { &hf_bssgp_ran_inf_req_pdu_t_ext_c,
6438           { "PDU Type Extension", "bssgp.ran_inf_req_pdu_t_ext_c",
6439             FT_UINT8, BASE_DEC, VALS(bssgp_ran_inf_req_pdu_t_ext_c_vals), 0x0e,
6440             NULL, HFILL }
6441         },
6442         { &hf_bssgp_ran_inf_pdu_t_ext_c,
6443           { "PDU Type Extension", "bssgp.ran_inf_pdu_t_ext_c",
6444             FT_UINT8, BASE_DEC, VALS(bssgp_ran_inf_pdu_t_ext_c_vals), 0x0e,
6445             NULL, HFILL }
6446         },
6447         {&hf_bssgp_rim_pdu_ind_ack,
6448          { "ACK", "bssgp.rim_pdu_ind_ack",
6449            FT_BOOLEAN, 8, TFS(&bssgp_rim_pdu_ind_ack_vals), 0x01,
6450            NULL, HFILL }
6451         },
6452         { &hf_bssgp_rim_proto_ver_no,
6453           { "RIM Protocol Version Number", "bssgp.rim_proto_ver_no",
6454             FT_UINT8, BASE_DEC, VALS(bssgp_rim_proto_ver_no_vals), 0x0,
6455             NULL, HFILL }
6456         },
6457         { &hf_bssgp_delay_val,
6458           { "Delay Value (in centi-seconds)", "bssgp.delay_val",
6459             FT_UINT16, BASE_DEC, NULL, 0x0,
6460             NULL, HFILL }
6461         },
6462         { &hf_bssgp_cause,
6463           { "Cause", "bssgp.cause",
6464             FT_UINT8, BASE_DEC|BASE_EXT_STRING, &bssgp_cause_vals_ext, 0x0,
6465             NULL, HFILL }
6466         },
6467         { &hf_bssgp_peak_rate_gran,
6468           { "Peak Bit Rate Granularity", "bssgp.peak_rate_gran",
6469             FT_UINT8, BASE_DEC, NULL, 0xc0,
6470             NULL, HFILL }
6471         },
6472         { &hf_bssgp_cr_bit,
6473           { "C/R", "bssgp.cr_bit",
6474             FT_BOOLEAN, 8, TFS(&bssgp_cr_bit_vals), 0x20,
6475             NULL, HFILL }
6476         },
6477         { &hf_bssgp_t_bit,
6478           { "T", "bssgp.t_bit",
6479             FT_BOOLEAN, 8, TFS(&bssgp_t_bit_vals), 0x10,
6480             NULL, HFILL }
6481         },
6482         { &hf_bssgp_a_bit,
6483           { "A", "bssgp.a_bit",
6484             FT_BOOLEAN, 8, TFS(&bssgp_a_bit_vals), 0x08,
6485             NULL, HFILL }
6486         },
6487         { &hf_bssgp_ra_cause,
6488           { "Radio Cause", "bssgp.ra_cause",
6489             FT_UINT8, BASE_DEC, VALS(bssgp_radio_cause_vals), 0x00,
6490             NULL, HFILL }
6491         },
6492         { &hf_bssgp_ra_cap_upd_cause,
6493           { "RA-Cap-UPD Cause", "bssgp.ra_cap_upd_cause",
6494             FT_UINT8, BASE_DEC, VALS(bssgp_ra_cap_upd_cause_vals), 0x00,
6495             NULL, HFILL }
6496         },
6497         { &hf_bssgp_r_default_ms,
6498           { "R_default_MS(x 100 or in increments as defined by the Flow Control Granularity IE)", "bssgp.r_default_ms",
6499             FT_UINT16, BASE_DEC, NULL, 0x0,
6500             NULL, HFILL }
6501         },
6502
6503         { &hf_bssgp_suspend_ref_no,
6504           { "Suspend Reference Number", "bssgp.suspend_ref_no",
6505             FT_UINT8, BASE_DEC, NULL, 0x00,
6506             NULL, HFILL }
6507         },
6508         { &hf_bssgp_tag,
6509           { "Tag", "bssgp.tag",
6510             FT_UINT8, BASE_DEC, NULL, 0x00,
6511             NULL, HFILL }
6512         },
6513         { &hf_bssgp_trace_ref,
6514           { "Trace Reference", "bssgp.trace_ref",
6515             FT_UINT16, BASE_DEC, NULL, 0x00,
6516             NULL, HFILL }
6517         },
6518         { &hf_bssgp_trigger_id,
6519           { "Entity Identity", "bssgp.entity_id",
6520             FT_BYTES, BASE_NONE, NULL, 0x00,
6521             NULL, HFILL }
6522         },
6523         { &hf_bssgp_transaction_id,
6524           { "Transaction Id", "bssgp.transaction_id",
6525             FT_UINT16, BASE_DEC, NULL, 0x00,
6526             NULL, HFILL }
6527         },
6528         { &hf_bssgp_no_of_oct,
6529           { "Number of octets transferred or deleted", "bssgp.no_of_oct",
6530             FT_UINT24, BASE_DEC, NULL, 0x00,
6531             NULL, HFILL }
6532         },
6533         { &hf_bssgp_unit_val,
6534           { "Unit Value", "bssgp.unit_val",
6535             FT_UINT8, BASE_DEC, VALS(bssgp_unit_vals), 0xe0,
6536             NULL, HFILL }
6537         },
6538         { &hf_bssgp_gprs_timer,
6539           { "Unit Value", "bssgp.gprs_timer",
6540             FT_UINT8, BASE_DEC, NULL, 0x1f,
6541             NULL, HFILL }
6542         },
6543
6544         { &hf_bssgp_mbms,
6545           { "MBMS Procedures", "bssgp.mbms",
6546             FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
6547             NULL, HFILL }
6548         },
6549         { &hf_bssgp_EnhancedRadioStatus,
6550           { "Enhanced Radio Status Procedures", "bssgp.enhancedradiostatus",
6551             FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
6552             NULL, HFILL }
6553         },
6554         { &hf_bssgp_pfcfc,
6555           { "PFC Flow Control Procedures", "bssgp.pfcfc",
6556             FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
6557             NULL, HFILL }
6558         },
6559         { &hf_bssgp_rim,
6560           { "RAN Information Management (RIM) procedures", "bssgp.rim",
6561             FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
6562             NULL, HFILL }
6563         },
6564         { &hf_bssgp_lcs,
6565           { "LCS Procedures", "bssgp.lcs",
6566             FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
6567             NULL, HFILL }
6568         },
6569         { &hf_bssgp_inr,
6570           { "Inter-NSE re-routing(INR)", "bssgp.inr",
6571             FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
6572             NULL, HFILL }
6573         },
6574         { &hf_bssgp_cbl,
6575           { "Current Bucket Level(CBL) Procedures", "bssgp.cbl",
6576             FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
6577             NULL, HFILL }
6578         },
6579         { &hf_bssgp_pfc,
6580           { "Packet Flow Context(PFC) Procedures", "bssgp.pfc",
6581             FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
6582             NULL, HFILL }
6583         },
6584         { &hf_bssgp_bucket_full_ratio,
6585           { "Ratio of the bucket that is filled up with data", "bssgp.bucket_full_ratio",
6586             FT_UINT8, BASE_DEC, NULL, 0x0,
6587             "B current x (100 / Bmax)", HFILL }
6588         },
6589         { &hf_bssgp_b_pfc,
6590           { "B_PFC: Bucket Full Ratio of the PFC", "bssgp.b_pfc",
6591             FT_UINT8, BASE_DEC, NULL, 0x0,
6592             "B current x (100 / Bmax)", HFILL }
6593         },
6594
6595         { &hf_bssgp_precedence,
6596           { "Precedence", "bssgp.precedence",
6597             FT_UINT8, BASE_DEC, NULL, 0x07,
6598             NULL, HFILL }
6599         },
6600         { &hf_bssgp_serv_utran_cco,
6601           { "Service UTRAN CCO", "bssgp.serv_utran_cco",
6602             FT_UINT8, BASE_DEC, VALS(bssgp_service_utran_cco_vals), 0x07,
6603             NULL, HFILL }
6604         },
6605         { &hf_bssgp_mbms_session_id,
6606           { "MBMS Session ID", "bssgp.mbms_session_id",
6607             FT_UINT8, BASE_DEC, NULL, 0x0,
6608             NULL, HFILL }
6609         },
6610         { &hf_bssgp_mbms_cause,
6611           { "Cause", "bssgp.mbms_cause",
6612             FT_UINT8, BASE_DEC|BASE_EXT_STRING, &bssgp_mbms_cause_vals_ext, 0x0f,
6613             NULL, HFILL }
6614         },
6615         { &hf_bssgp_mbms_stop_cause,
6616           { "Stop Cause", "bssgp.mbms_stop_cause",
6617             FT_UINT8, BASE_DEC|BASE_EXT_STRING, &bssgp_mbms_stop_cause_vals_ext, 0x0f,
6618             NULL, HFILL }
6619         },
6620         { &hf_bssgp_session_inf,
6621           { "BC/MC", "bssgp.session_inf",
6622             FT_BOOLEAN, 8, TFS(&tfs_bssgp_bc_mc), 0x01,
6623             NULL, HFILL }
6624         },
6625         { &hf_bssgp_mbms_num_ra_ids,
6626           { "Number of Routing Area Identifications", "bssgp.mbms_num_ra_ids",
6627             FT_UINT8, BASE_DEC|BASE_EXT_STRING, &bssgp_mbms_num_ra_ids_vals_ext, 0xf0,
6628             NULL, HFILL }
6629         },
6630         { &hf_bssgp_gb_if,
6631           { "Gigabit Interface", "bssgp.gb_if",
6632             FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
6633             NULL, HFILL }
6634         },
6635         { &hf_bssgp_ps_ho,
6636           { "PS Handover", "bssgp.ps_ho",
6637             FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
6638             NULL, HFILL }
6639         },
6640         { &hf_bssgp_src_to_trg_transp_cont,
6641           { "Source to Target Transparent Container", "bssgp.src_to_trg_transp_cont",
6642             FT_BYTES, FT_NONE, NULL, 0x0,
6643             NULL, HFILL }
6644         },
6645         { &hf_bssgp_trg_to_src_transp_cont,
6646           { "Target to Source Transparent Container", "bssgp.trg_to_src_transp_cont",
6647             FT_BYTES, FT_NONE, NULL, 0x0,
6648             NULL, HFILL }
6649         },
6650         { &hf_bssgp_rnc_id,
6651           { "RNC ID", "bssgp.rnc_id",
6652             FT_UINT16, BASE_DEC, NULL, 0x0,
6653             NULL, HFILL }
6654         },
6655         { &hf_bssgp_page_mode,
6656           { "PAGE_MODE", "bssgp.page_mode",
6657             FT_UINT8, BASE_DEC, VALS(bssgp_page_mode_vals), 0x03,
6658             NULL, HFILL }
6659         },
6660         { &hf_bssgp_container_id,
6661           { "Container ID", "bssgp.container_id",
6662             FT_UINT8, BASE_DEC, NULL, 0x03,
6663             NULL, HFILL }
6664         },
6665         { &hf_bssgp_global_tfi,
6666           { "Global TFI", "bssgp.global_tfi",
6667             FT_UINT8, BASE_DEC, VALS(bssgp_global_tfi_vals), 0x0,
6668             NULL, HFILL }
6669         },
6670         { &hf_bssgp_ul_tfi,
6671           { "UPLINK_TFI", "bssgp.ul_tfi",
6672             FT_UINT8, BASE_DEC, NULL, 0x0,
6673             NULL, HFILL }
6674         },
6675         { &hf_bssgp_dl_tfi,
6676           { "DOWNLINK_TFI", "bssgp.dl_tfi",
6677             FT_UINT8, BASE_DEC, NULL, 0x0,
6678             NULL, HFILL }
6679         },
6680         { &hf_bssgp_time_to_MBMS_data_tran,
6681           { "Time to MBMS Data Transfer", "bssgp.time_to_mbms_data_tran",
6682             FT_UINT8, BASE_DEC, NULL, 0x0,
6683             NULL, HFILL }
6684         },
6685         { &hf_bssgp_mbms_session_rep_no,
6686           { "MBMS-Session-Repetition-Number", "bssgp.mbms_session_rep_no",
6687             FT_UINT8, BASE_DEC, NULL, 0x0,
6688             NULL, HFILL }
6689         },
6690         { &hf_bssgp_ps_ho_cmd,
6691           { "PS Handover Command", "bssgp.ps_ho_cmd",
6692             FT_BYTES, BASE_NONE, NULL, 0x0,
6693             NULL, HFILL }
6694         },
6695         { &hf_bssgp_sipsi,
6696           { "SI/PSI", "bssgp.sipsi",
6697             FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x01,
6698             NULL, HFILL }
6699         },
6700         { &hf_bssgp_type,
6701           { "Type", "bssgp.type",
6702             FT_UINT8, BASE_DEC, VALS(type_vals), 0x01,
6703             NULL, HFILL }
6704         },
6705         { &hf_bssgp_cs_indication,
6706           { "CS Indication Contents", "bssgp.cs_indication",
6707             FT_UINT8, BASE_HEX, NULL, 0x0,
6708             NULL, HFILL }
6709         },
6710
6711         { &hf_bssgp_flow_control_gran,
6712           { "Granularity", "bssgp.flow_control_gran",
6713             FT_UINT8, BASE_DEC, VALS(bssgp_flow_control_gran_vals), 0x03,
6714             NULL, HFILL }
6715         },
6716         { &hf_bssgp_serv_eutran_cco,
6717           { "Service EUTRAN CCO", "bssgp.serv_eutran_cco",
6718             FT_UINT8, BASE_DEC, VALS(bssgp_service_eutran_cco_vals), 0x18,
6719             NULL, HFILL }
6720         },
6721         { &hf_bssgp_sub_prof_id_f_rat_freq_prio,
6722           { "Subscriber Profile ID for RAT/Frequency priority", "bssgp.sub_prof_id_f_rat_freq_prio",
6723             FT_UINT8, BASE_DEC, NULL, 0x0,
6724             NULL, HFILL }
6725         },
6726         { &hf_bssgp_eutran_irat_ho_inf_req,
6727           { "E-UTRAN Inter RAT Handover Info", "bssgp.eutran_irat_ho_inf_req",
6728             FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x02,
6729             NULL, HFILL }
6730         },
6731         { &hf_bssgp_irat_ho_inf_req,
6732           { "Inter RAT Handover Info", "bssgp.irat_ho_inf_req",
6733             FT_BOOLEAN, 8, TFS(&tfs_requested_not_requested), 0x01,
6734             NULL, HFILL }
6735         },
6736
6737         { &hf_bssgp_rel_int_rat_ho_inf_ind,
6738           { "Inter RAT Handover Info", "bssgp.rel_int_rat_ho_inf_ind",
6739             FT_BOOLEAN, 8, TFS(&tfs_reliable_not_reliable), 0x01,
6740             NULL, HFILL }
6741         },
6742         { &hf_bssgp_csg_id,
6743           { "CSG Identity (CSG-ID)", "bssgp.csg_id",
6744             FT_UINT32, BASE_HEX, NULL, 0xffffff0f,
6745             NULL, HFILL }
6746         },
6747         { &hf_bssgp_cell_acc_mode,
6748           { "Cell Access Mode", "bssgp.cell_acc_mode",
6749             FT_UINT8, BASE_DEC, VALS(bssgp_cell_access_mode_vals), 0x01,
6750             NULL, HFILL }
6751         },
6752         { &hf_bssgp_Global_ENB_ID_PDU,
6753           { "Global-ENB-ID", "bssgp.Global_ENB_ID",
6754             FT_NONE, BASE_NONE, NULL, 0,
6755             NULL, HFILL }
6756         },
6757         { &hf_bssgp_SONtransferRequestContainer_PDU,
6758           { "SONtransferRequestContainer", "bssgp.SONtransferRequestContainer",
6759             FT_UINT32, BASE_DEC, VALS(s1ap_SONtransferRequestContainer_vals), 0,
6760             NULL, HFILL }},
6761
6762     };
6763
6764     /* Setup protocol subtree array */
6765 #define NUM_INDIVIDUAL_ELEMS    10
6766     gint *ett[NUM_INDIVIDUAL_ELEMS +
6767               NUM_BSSGP_ELEM +
6768               NUM_BSSGP_MSG];
6769     ett[0] = &ett_bssgp;
6770     ett[1] = &ett_bssgp_list_of_setup_pfcs;
6771     ett[2] = &ett_bssgp_pfcs_to_be_set_up_list_t10;
6772     ett[3] = &ett_bssgp_pfcs_to_be_set_up_list_arp;
6773     ett[4] = &ett_bssgp_pfcs_to_be_set_up_list_abqp;
6774     ett[5] = &ett_bssgp_pfcs_to_be_set_up_list_pft;
6775     ett[6] = &ett_bssgp_pfcs_to_be_set_up_list;
6776     ett[7] = &ett_bssgp_new;
6777     ett[8] = &ett_bssgp_pfc_flow_control_parameters_pfc;
6778     ett[9] = &ett_bssgp_ra_id,
6779
6780         last_offset = NUM_INDIVIDUAL_ELEMS;
6781
6782     for (i=0; i < NUM_BSSGP_ELEM; i++, last_offset++)
6783     {
6784         ett_bssgp_elem[i] = -1;
6785         ett[last_offset] = &ett_bssgp_elem[i];
6786     }
6787
6788     for (i=0; i < NUM_BSSGP_MSG; i++, last_offset++)
6789     {
6790         ett_bssgp_msg[i] = -1;
6791         ett[last_offset] = &ett_bssgp_msg[i];
6792     }
6793
6794     /* Register the protocol name and description */
6795     proto_bssgp = proto_register_protocol("Base Station Subsystem GPRS Protocol", "BSSGP", "bssgp");
6796
6797     /* Required function calls to register the header fields and subtrees used */
6798     proto_register_field_array(proto_bssgp, hf, array_length(hf));
6799     proto_register_subtree_array(ett, array_length(ett));
6800     register_dissector("bssgp", dissect_bssgp, proto_bssgp);
6801
6802     /* Register configuration options */
6803     bssgp_module = prefs_register_protocol(proto_bssgp, NULL);
6804     prefs_register_bool_preference(bssgp_module, "decode_nri",
6805                                    "Decode NRI",
6806                                    "Decode NRI (for use with SGSN in Pool)",
6807                                    &bssgp_decode_nri);
6808     prefs_register_uint_preference(bssgp_module, "nri_length", "NRI length",
6809                                    "NRI length, in bits",
6810                                    10, &bssgp_nri_length);
6811 }
6812
6813 /* If this dissector uses sub-dissector registration add a registration routine.
6814  */
6815 void
6816 proto_reg_handoff_bssgp(void)
6817 {
6818     llc_handle = find_dissector("llcgprs");
6819     rrlp_handle = find_dissector("rrlp");
6820     data_handle = find_dissector("data");
6821
6822     diameter_3gpp_avp_dissector_table = find_dissector_table("diameter.3gpp");
6823 }