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