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