PageRenderTime 106ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 2ms

/epan/dissectors/packet-gtp.c

https://github.com/labx-technologies-llc/wireshark
C | 9445 lines | 7201 code | 1112 blank | 1132 comment | 318 complexity | f1cd73c8f2c7cc48f57bd0e3f69b39be MD5 | raw file
Possible License(s): GPL-2.0, BSD-3-Clause
  1. /* packet-gtp.c
  2. *
  3. * $Id$
  4. *
  5. * Routines for GTP dissection
  6. * Copyright 2001, Michal Melerowicz <michal.melerowicz@nokia.com>
  7. * Nicolas Balkota <balkota@mac.com>
  8. *
  9. * Updates and corrections:
  10. * Copyright 2006 - 2009, Anders Broman <anders.broman@ericsson.com>
  11. *
  12. * Added Bearer control mode dissection:
  13. * Copyright 2011, Grzegorz Szczytowski <grzegorz.szczytowski@gmail.com>
  14. *
  15. * Updates and corrections:
  16. * Copyright 2011-2013, Anders Broman <anders.broman@ericsson.com>
  17. *
  18. * PDCP PDU number extension header support added by Martin Isaksson <martin.isaksson@ericsson.com>
  19. *
  20. * Control Plane Request-Response tracking code Largely based on similar routines in
  21. * packet-ldap.c by Ronnie Sahlberg
  22. * Added by Kari Tiirikainen <kari.tiirikainen@nsn.com>
  23. *
  24. * Wireshark - Network traffic analyzer
  25. * By Gerald Combs <gerald@wireshark.org>
  26. * Copyright 1998 Gerald Combs
  27. *
  28. * This program is free software; you can redistribute it and/or
  29. * modify it under the terms of the GNU General Public License
  30. * as published by the Free Software Foundation; either version 2
  31. * of the License, or (at your option) any later version.
  32. *
  33. * This program is distributed in the hope that it will be useful,
  34. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  35. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  36. * GNU General Public License for more details.
  37. *
  38. * You should have received a copy of the GNU General Public License
  39. * along with this program; if not, write to the Free Software
  40. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  41. *
  42. * GTP v0: 3GPP TS 09.60
  43. *
  44. * http://www.3gpp.org/ftp/Specs/html-info/0960.htm
  45. *
  46. * GTP v1: 3GPP TS 29.060
  47. *
  48. * http://www.3gpp.org/ftp/Specs/html-info/29060.htm
  49. *
  50. * GTP': 3GPP TS 32.295
  51. *
  52. * http://www.3gpp.org/ftp/Specs/html-info/32295.htm
  53. */
  54. #include "config.h"
  55. #include <epan/conversation.h>
  56. #include <epan/packet.h>
  57. #include <epan/prefs.h>
  58. #include <epan/expert.h>
  59. #include <epan/sminmpec.h>
  60. #include <epan/asn1.h>
  61. #include <epan/tap.h>
  62. #include "packet-ppp.h"
  63. #include "packet-radius.h"
  64. #include "packet-bssap.h"
  65. #include "packet-gsm_a_common.h"
  66. #include "packet-gsm_map.h"
  67. #include "packet-gprscdr.h"
  68. #include "packet-per.h"
  69. #include "packet-ranap.h"
  70. #include "packet-bssgp.h"
  71. #include "packet-e212.h"
  72. #include "packet-gtp.h"
  73. static dissector_table_t ppp_subdissector_table;
  74. static dissector_table_t gtp_priv_ext_dissector_table;
  75. static dissector_table_t gtp_cdr_fmt_dissector_table;
  76. #define GTPv0_PORT 3386
  77. #define GTPv1C_PORT 2123 /* 3G Control PDU */
  78. #define GTPv1U_PORT 2152 /* 3G T-PDU */
  79. #define GTPv0_HDR_LENGTH 20
  80. #define GTPv1_HDR_LENGTH 12
  81. #define GTP_PRIME_HDR_LENGTH 6
  82. /* to check compliance with ETSI */
  83. #define GTP_MANDATORY 1
  84. #define GTP_OPTIONAL 2
  85. #define GTP_CONDITIONAL 4
  86. #define GTP_TPDU_AS_NONE -1
  87. #define GTP_TPDU_AS_TPDU 0
  88. #define GTP_TPDU_AS_SYNC 2
  89. static gboolean g_gtp_over_tcp = TRUE;
  90. static guint g_gtpv0_port = GTPv0_PORT;
  91. static guint g_gtpv1c_port = GTPv1C_PORT;
  92. static guint g_gtpv1u_port = GTPv1U_PORT;
  93. void proto_reg_handoff_gtp(void);
  94. static int proto_gtp = -1;
  95. /*KTi*/
  96. static int hf_gtp_ie_id = -1;
  97. static int hf_gtp_response_in = -1;
  98. static int hf_gtp_response_to = -1;
  99. static int hf_gtp_time = -1;
  100. static int hf_gtp_apn = -1;
  101. static int hf_gtp_cause = -1;
  102. static int hf_gtp_chrg_char = -1;
  103. static int hf_gtp_chrg_char_s = -1;
  104. static int hf_gtp_chrg_char_n = -1;
  105. static int hf_gtp_chrg_char_p = -1;
  106. static int hf_gtp_chrg_char_f = -1;
  107. static int hf_gtp_chrg_char_h = -1;
  108. static int hf_gtp_chrg_char_r = -1;
  109. static int hf_gtp_chrg_id = -1;
  110. static int hf_gtp_chrg_ipv4 = -1;
  111. static int hf_gtp_chrg_ipv6 = -1;
  112. static int hf_gtp_ext_flow_label = -1;
  113. static int hf_gtp_ext_id = -1;
  114. static int hf_gtp_ext_val = -1;
  115. static int hf_gtp_ext_hdr = -1;
  116. static int hf_gtp_ext_hdr_next = -1;
  117. static int hf_gtp_ext_hdr_length = -1;
  118. static int hf_gtp_ext_hdr_pdcpsn = -1;
  119. static int hf_gtp_ext_hdr_udp_port = -1;
  120. static int hf_gtp_flags = -1;
  121. static int hf_gtp_flags_ver = -1;
  122. static int hf_gtp_prime_flags_ver = -1;
  123. static int hf_gtp_flags_pt = -1;
  124. static int hf_gtp_flags_spare1 = -1;
  125. static int hf_gtp_flags_hdr_length = -1;
  126. static int hf_gtp_flags_snn = -1;
  127. static int hf_gtp_flags_spare2 = -1;
  128. static int hf_gtp_flags_e = -1;
  129. static int hf_gtp_flags_s = -1;
  130. static int hf_gtp_flags_pn = -1;
  131. static int hf_gtp_flow_ii = -1;
  132. static int hf_gtp_flow_label = -1;
  133. static int hf_gtp_flow_sig = -1;
  134. static int hf_gtp_gsn_addr_len = -1;
  135. static int hf_gtp_gsn_addr_type = -1;
  136. static int hf_gtp_gsn_ipv4 = -1;
  137. static int hf_gtp_gsn_ipv6 = -1;
  138. static int hf_gtp_imsi = -1;
  139. static int hf_gtp_length = -1;
  140. static int hf_gtp_map_cause = -1;
  141. static int hf_gtp_message_type = -1;
  142. static int hf_gtp_ms_reason = -1;
  143. static int hf_gtp_ms_valid = -1;
  144. static int hf_gtp_npdu_number = -1;
  145. static int hf_gtp_node_ipv4 = -1;
  146. static int hf_gtp_node_ipv6 = -1;
  147. static int hf_gtp_nsapi = -1;
  148. static int hf_gtp_ptmsi = -1;
  149. static int hf_gtp_ptmsi_sig = -1;
  150. static int hf_gtp_qos_version = -1;
  151. static int hf_gtp_qos_spare1 = -1;
  152. static int hf_gtp_qos_delay = -1;
  153. static int hf_gtp_qos_mean = -1;
  154. static int hf_gtp_qos_peak = -1;
  155. static int hf_gtp_qos_spare2 = -1;
  156. static int hf_gtp_qos_precedence = -1;
  157. static int hf_gtp_qos_spare3 = -1;
  158. static int hf_gtp_qos_reliability = -1;
  159. static int hf_gtp_qos_al_ret_priority = -1;
  160. static int hf_gtp_qos_traf_class = -1;
  161. static int hf_gtp_qos_del_order = -1;
  162. static int hf_gtp_qos_del_err_sdu = -1;
  163. static int hf_gtp_qos_max_sdu_size = -1;
  164. static int hf_gtp_qos_max_ul = -1;
  165. static int hf_gtp_qos_max_dl = -1;
  166. static int hf_gtp_qos_res_ber = -1;
  167. static int hf_gtp_qos_sdu_err_ratio = -1;
  168. static int hf_gtp_qos_trans_delay = -1;
  169. static int hf_gtp_qos_traf_handl_prio = -1;
  170. static int hf_gtp_qos_guar_ul = -1;
  171. static int hf_gtp_qos_guar_dl = -1;
  172. static int hf_gtp_qos_src_stat_desc = -1;
  173. static int hf_gtp_qos_sig_ind = -1;
  174. static int hf_gtp_qos_arp_pvi = -1;
  175. static int hf_gtp_qos_arp_pl = -1;
  176. static int hf_gtp_qos_arp_pci = -1;
  177. static int hf_gtp_qos_qci = -1;
  178. static int hf_gtp_qos_ul_mbr = -1;
  179. static int hf_gtp_qos_dl_mbr = -1;
  180. static int hf_gtp_qos_ul_gbr = -1;
  181. static int hf_gtp_qos_dl_gbr = -1;
  182. static int hf_gtp_qos_ul_apn_ambr = -1;
  183. static int hf_gtp_qos_dl_apn_ambr = -1;
  184. static int hf_gtp_pkt_flow_id = -1;
  185. static int hf_gtp_rab_gtpu_dn = -1;
  186. static int hf_gtp_rab_gtpu_up = -1;
  187. static int hf_gtp_rab_pdu_dn = -1;
  188. static int hf_gtp_rab_pdu_up = -1;
  189. static int hf_gtp_rai_rac = -1;
  190. static int hf_gtp_rai_lac = -1;
  191. static int hf_gtp_tac = -1;
  192. static int hf_gtp_eci = -1;
  193. static int hf_gtp_ranap_cause = -1;
  194. static int hf_gtp_recovery = -1;
  195. static int hf_gtp_reorder = -1;
  196. static int hf_gtp_rnc_ipv4 = -1;
  197. static int hf_gtp_rnc_ipv6 = -1;
  198. static int hf_gtp_rp = -1;
  199. static int hf_gtp_rp_nsapi = -1;
  200. static int hf_gtp_rp_sms = -1;
  201. static int hf_gtp_rp_spare = -1;
  202. static int hf_gtp_sel_mode = -1;
  203. static int hf_gtp_seq_number = -1;
  204. static int hf_gtp_sndcp_number = -1;
  205. static int hf_gtp_tear_ind = -1;
  206. static int hf_gtp_teid = -1;
  207. static int hf_gtp_teid_cp = -1;
  208. static int hf_gtp_ulink_teid_cp = -1;
  209. static int hf_gtp_teid_data = -1;
  210. static int hf_gtp_ulink_teid_data = -1;
  211. static int hf_gtp_teid_ii = -1;
  212. static int hf_gtp_tft_code = -1;
  213. static int hf_gtp_tft_spare = -1;
  214. static int hf_gtp_tft_number = -1;
  215. static int hf_gtp_tft_eval = -1;
  216. static int hf_gtp_tid = -1;
  217. static int hf_gtp_tlli = -1;
  218. static int hf_gtp_tr_comm = -1;
  219. static int hf_gtp_trace_ref = -1;
  220. static int hf_gtp_trace_type = -1;
  221. static int hf_gtp_user_addr_pdp_org = -1;
  222. static int hf_gtp_user_addr_pdp_type = -1;
  223. static int hf_gtp_user_ipv4 = -1;
  224. static int hf_gtp_user_ipv6 = -1;
  225. static int hf_gtp_security_mode = -1;
  226. static int hf_gtp_no_of_vectors = -1;
  227. static int hf_gtp_cipher_algorithm = -1;
  228. static int hf_gtp_cksn_ksi = -1;
  229. static int hf_gtp_cksn = -1;
  230. static int hf_gtp_ksi = -1;
  231. static int hf_gtp_ext_length = -1;
  232. static int hf_gtp_utran_field = -1;
  233. static int hf_gtp_ext_apn_res = -1;
  234. static int hf_gtp_ext_rat_type = -1;
  235. static int hf_gtp_ext_geo_loc_type = -1;
  236. static int hf_gtp_ext_sac = -1;
  237. static int hf_gtp_ext_imeisv = -1;
  238. static int hf_gtp_target_rnc_id = -1;
  239. static int hf_gtp_target_ext_rnc_id = -1;
  240. static int hf_gtp_bssgp_cause = -1;
  241. static int hf_gtp_bssgp_ra_discriminator = -1;
  242. static int hf_gtp_sapi = -1;
  243. static int hf_gtp_xid_par_len = -1;
  244. static int hf_gtp_earp_pvi = -1;
  245. static int hf_gtp_earp_pl = -1;
  246. static int hf_gtp_earp_pci = -1;
  247. static int hf_gtp_cdr_app = -1;
  248. static int hf_gtp_cdr_rel = -1;
  249. static int hf_gtp_cdr_ver = -1;
  250. static int hf_gtp_cmn_flg_ppc = -1;
  251. static int hf_gtp_cmn_flg_mbs_srv_type = -1;
  252. static int hf_gtp_cmn_flg_mbs_ran_pcd_rdy = -1;
  253. static int hf_gtp_cmn_flg_mbs_cnt_inf = -1;
  254. static int hf_gtp_cmn_flg_nrsn = -1;
  255. static int hf_gtp_cmn_flg_no_qos_neg = -1;
  256. static int hf_gtp_cmn_flg_upgrd_qos_sup = -1;
  257. static int hf_gtp_cmn_flg_dual_addr_bearer_flg = -1;
  258. static int hf_gtp_tmgi = -1;
  259. static int hf_gtp_mbms_ses_dur_days = -1;
  260. static int hf_gtp_mbms_ses_dur_s = -1;
  261. static int hf_gtp_no_of_mbms_sa_codes = -1;
  262. static int hf_gtp_mbms_sa_code = -1;
  263. static int hf_gtp_mbs_2g_3g_ind = -1;
  264. static int hf_gtp_time_2_dta_tr = -1;
  265. static int hf_gtp_ext_ei = -1;
  266. static int hf_gtp_ext_gcsi = -1;
  267. static int hf_gtp_ext_dti = -1;
  268. static int hf_gtp_ra_prio_lcs = -1;
  269. static int hf_gtp_bcm = -1;
  270. static int hf_gtp_fqdn = -1;
  271. static int hf_gtp_rim_routing_addr = -1;
  272. static int hf_gtp_mbms_flow_id = -1;
  273. static int hf_gtp_mbms_dist_indic = -1;
  274. static int hf_gtp_ext_apn_ambr_ul = -1;
  275. static int hf_gtp_ext_apn_ambr_dl = -1;
  276. static int hf_gtp_ext_sub_ue_ambr_ul = -1;
  277. static int hf_gtp_ext_sub_ue_ambr_dl = -1;
  278. static int hf_gtp_ext_auth_ue_ambr_ul = -1;
  279. static int hf_gtp_ext_auth_ue_ambr_dl = -1;
  280. static int hf_gtp_ext_auth_apn_ambr_ul = -1;
  281. static int hf_gtp_ext_auth_apn_ambr_dl = -1;
  282. static int hf_gtp_ext_ggsn_back_off_time_units = -1;
  283. static int hf_gtp_ext_ggsn_back_off_timer = -1;
  284. static int hf_gtp_higher_br_16mb_flg = -1;
  285. static int hf_gtp_max_mbr_apn_ambr_ul = -1;
  286. static int hf_gtp_max_mbr_apn_ambr_dl = -1;
  287. /* Initialize the subtree pointers */
  288. static gint ett_gtp = -1;
  289. static gint ett_gtp_flags = -1;
  290. static gint ett_gtp_ext = -1;
  291. static gint ett_gtp_ext_hdr = -1;
  292. static gint ett_gtp_qos = -1;
  293. static gint ett_gtp_qos_arp = -1;
  294. static gint ett_gtp_flow_ii = -1;
  295. static gint ett_gtp_rp = -1;
  296. static gint ett_gtp_pkt_flow_id = -1;
  297. static gint ett_gtp_trip = -1;
  298. static gint ett_gtp_quint = -1;
  299. static gint ett_gtp_proto = -1;
  300. static gint ett_gtp_gsn_addr = -1;
  301. static gint ett_gtp_tft = -1;
  302. static gint ett_gtp_tft_pf = -1;
  303. static gint ett_gtp_tft_flags = -1;
  304. static gint ett_gtp_rab_setup = -1;
  305. static gint ett_gtp_hdr_list = -1;
  306. static gint ett_gtp_node_addr = -1;
  307. static gint ett_gtp_rel_pack = -1;
  308. static gint ett_gtp_can_pack = -1;
  309. static gint ett_gtp_data_resp = -1;
  310. static gint ett_gtp_net_cap = -1;
  311. static gint ett_gtp_tmgi = -1;
  312. static gint ett_gtp_cdr_ver = -1;
  313. static gint ett_gtp_cdr_dr = -1;
  314. static gint ett_gtp_uli_rai = -1;
  315. static gboolean g_gtp_etsi_order = FALSE;
  316. static gint dissect_tpdu_as = -1;
  317. static const enum_val_t gtp_decode_tpdu_as[] = {
  318. {"none", "None", GTP_TPDU_AS_NONE},
  319. {"tpdu", "TPDU", GTP_TPDU_AS_TPDU},
  320. {"sync", "SYNC", GTP_TPDU_AS_SYNC},
  321. {NULL, NULL, 0}
  322. };
  323. static int gtp_tap = -1;
  324. static int gtpv1_tap = -1;
  325. /* Definition of flags masks */
  326. #define GTP_VER_MASK 0xE0
  327. static const true_false_string gtp_hdr_length_vals = {
  328. "6-Octet Header",
  329. "20-Octet Header"
  330. };
  331. static const value_string ver_types[] = {
  332. {0, "GTP release 97/98 version"},
  333. {1, "GTP release 99 version"},
  334. {2, "GTPv2-C"},
  335. {3, "None"},
  336. {4, "None"},
  337. {5, "None"},
  338. {6, "None"},
  339. {7, "None"},
  340. {0, NULL}
  341. };
  342. static const value_string pt_types[] = {
  343. {0, "GTP'"},
  344. {1, "GTP"},
  345. {0, NULL}
  346. };
  347. #define GTP_PT_MASK 0x10
  348. #define GTP_SPARE1_MASK 0x0E
  349. #define GTP_SPARE2_MASK 0x08
  350. #define GTP_E_MASK 0x04
  351. #define GTP_S_MASK 0x02
  352. #define GTP_SNN_MASK 0x01
  353. #define GTP_PN_MASK 0x01
  354. #define GTP_EXT_HDR_NO_MORE_EXT_HDRS 0x00
  355. #define GTP_EXT_HDR_MBMS_SUPPORT_IND 0x01
  356. #define GTP_EXT_HDR_MS_INFO_CHG_REP_SUPP_IND 0x02
  357. #define GTP_EXT_HDR_UDP_PORT 0x40
  358. #define GTP_EXT_HDR_PDCP_SN 0xC0
  359. #define GTP_EXT_HDR_SUSPEND_REQ 0xC1
  360. #define GTP_EXT_HDR_SUSPEND_RESP 0xC2
  361. static const value_string next_extension_header_fieldvals[] = {
  362. {GTP_EXT_HDR_NO_MORE_EXT_HDRS, "No more extension headers"},
  363. {GTP_EXT_HDR_MBMS_SUPPORT_IND, "MBMS support indication"},
  364. {GTP_EXT_HDR_MS_INFO_CHG_REP_SUPP_IND, "MS Info Change Reporting support indication"},
  365. {GTP_EXT_HDR_UDP_PORT, "UDP Port number"},
  366. {GTP_EXT_HDR_PDCP_SN, "PDCP PDU number"},
  367. {GTP_EXT_HDR_SUSPEND_REQ, "Suspend Request"},
  368. {GTP_EXT_HDR_SUSPEND_RESP, "Suspend Response"},
  369. {0, NULL}
  370. };
  371. /* Definition of 3G charging characteristics masks */
  372. #define GTP_MASK_CHRG_CHAR_S 0xF000
  373. #define GTP_MASK_CHRG_CHAR_N 0x0800
  374. #define GTP_MASK_CHRG_CHAR_P 0x0400
  375. #define GTP_MASK_CHRG_CHAR_F 0x0200
  376. #define GTP_MASK_CHRG_CHAR_H 0x0100
  377. #define GTP_MASK_CHRG_CHAR_R 0x00FF
  378. /* Traffic Flow Templates mask */
  379. #define GTPv1_TFT_CODE_MASK 0xE0
  380. #define GTPv1_TFT_SPARE_MASK 0x10
  381. #define GTPv1_TFT_NUMBER_MASK 0x0F
  382. /* Definition of GSN Address masks */
  383. #define GTP_EXT_GSN_ADDR_TYPE_MASK 0xC0
  384. #define GTP_EXT_GSN_ADDR_LEN_MASK 0x3F
  385. /* Definition of QoS masks */
  386. #define GTP_EXT_QOS_SPARE1_MASK 0xC0
  387. #define GTP_EXT_QOS_DELAY_MASK 0x38
  388. #define GTP_EXT_QOS_RELIABILITY_MASK 0x07
  389. #define GTP_EXT_QOS_PEAK_MASK 0xF0
  390. #define GTP_EXT_QOS_SPARE2_MASK 0x08
  391. #define GTP_EXT_QOS_PRECEDENCE_MASK 0x07
  392. #define GTP_EXT_QOS_SPARE3_MASK 0xE0
  393. #define GTP_EXT_QOS_MEAN_MASK 0x1F
  394. #define GTP_EXT_QOS_TRAF_CLASS_MASK 0xE0
  395. #define GTP_EXT_QOS_DEL_ORDER_MASK 0x18
  396. #define GTP_EXT_QOS_DEL_ERR_SDU_MASK 0x07
  397. #define GTP_EXT_QOS_RES_BER_MASK 0xF0
  398. #define GTP_EXT_QOS_SDU_ERR_RATIO_MASK 0x0F
  399. #define GTP_EXT_QOS_TRANS_DELAY_MASK 0xFC
  400. #define GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK 0x03
  401. #define GTP_EXT_QOS_SRC_STAT_DESC_MASK 0x0F
  402. #define GTP_EXT_QOS_SIG_IND_MASK 0x10
  403. /* Definition of Radio Priority's masks */
  404. #define GTPv1_EXT_RP_NSAPI_MASK 0xF0
  405. #define GTPv1_EXT_RP_SPARE_MASK 0x08
  406. #define GTPv1_EXT_RP_MASK 0x07
  407. static const value_string gtp_message_type[] = {
  408. {GTP_MSG_UNKNOWN, "For future use"},
  409. {GTP_MSG_ECHO_REQ, "Echo request"},
  410. {GTP_MSG_ECHO_RESP, "Echo response"},
  411. {GTP_MSG_VER_NOT_SUPP, "Version not supported"},
  412. {GTP_MSG_NODE_ALIVE_REQ, "Node alive request"},
  413. {GTP_MSG_NODE_ALIVE_RESP, "Node alive response"},
  414. {GTP_MSG_REDIR_REQ, "Redirection request"},
  415. {GTP_MSG_REDIR_RESP, "Redirection response"},
  416. /*
  417. * 8-15 For future use. Shall not be sent. If received,
  418. * shall be treated as an Unknown message.
  419. */
  420. #if 0
  421. { 8, "Unknown message(For future use)"},
  422. { 9, "Unknown message(For future use)"},
  423. { 10, "Unknown message(For future use)"},
  424. { 11, "Unknown message(For future use)"},
  425. { 12, "Unknown message(For future use)"},
  426. { 13, "Unknown message(For future use)"},
  427. { 14, "Unknown message(For future use)"},
  428. { 15, "Unknown message(For future use)"},
  429. #endif
  430. {GTP_MSG_CREATE_PDP_REQ, "Create PDP context request"},
  431. {GTP_MSG_CREATE_PDP_RESP, "Create PDP context response"},
  432. {GTP_MSG_UPDATE_PDP_REQ, "Update PDP context request"},
  433. {GTP_MSG_UPDATE_PDP_RESP, "Update PDP context response"},
  434. {GTP_MSG_DELETE_PDP_REQ, "Delete PDP context request"},
  435. {GTP_MSG_DELETE_PDP_RESP, "Delete PDP context response"},
  436. {GTP_MSG_INIT_PDP_CONTEXT_ACT_REQ, "Initiate PDP Context Activation Request"},
  437. {GTP_MSG_INIT_PDP_CONTEXT_ACT_RESP, "Initiate PDP Context Activation Response"},
  438. /*
  439. * 24-25 For future use. Shall not be sent. If received,
  440. * shall be treated as an Unknown message.
  441. */
  442. {GTP_MSG_DELETE_AA_PDP_REQ, "Delete AA PDP Context Request"},
  443. {GTP_MSG_DELETE_AA_PDP_RESP, "Delete AA PDP Context Response"},
  444. {GTP_MSG_ERR_IND, "Error indication"},
  445. {GTP_MSG_PDU_NOTIFY_REQ, "PDU notification request"},
  446. {GTP_MSG_PDU_NOTIFY_RESP, "PDU notification response"},
  447. {GTP_MSG_PDU_NOTIFY_REJ_REQ, "PDU notification reject request"},
  448. {GTP_MSG_PDU_NOTIFY_REJ_RESP, "PDU notification reject response"},
  449. {GTP_MSG_SUPP_EXT_HDR, "Supported extension header notification"},
  450. {GTP_MSG_SEND_ROUT_INFO_REQ, "Send routing information for GPRS request"},
  451. {GTP_MSG_SEND_ROUT_INFO_RESP, "Send routing information for GPRS response"},
  452. {GTP_MSG_FAIL_REP_REQ, "Failure report request"},
  453. {GTP_MSG_FAIL_REP_RESP, "Failure report response"},
  454. {GTP_MSG_MS_PRESENT_REQ, "Note MS GPRS present request"},
  455. {GTP_MSG_MS_PRESENT_RESP, "Note MS GPRS present response"},
  456. /* 38-47 For future use. Shall not be sent. If received,
  457. * shall be treated as an Unknown message.
  458. */
  459. #if 0
  460. { 38, "Unknown message(For future use)"},
  461. { 39, "Unknown message(For future use)"},
  462. { 40, "Unknown message(For future use)"},
  463. { 41, "Unknown message(For future use)"},
  464. { 42, "Unknown message(For future use)"},
  465. { 43, "Unknown message(For future use)"},
  466. { 44, "Unknown message(For future use)"},
  467. { 45, "Unknown message(For future use)"},
  468. { 46, "Unknown message(For future use)"},
  469. { 47, "Unknown message(For future use)"},
  470. #endif
  471. {GTP_MSG_IDENT_REQ, "Identification request"},
  472. {GTP_MSG_IDENT_RESP, "Identification response"},
  473. {GTP_MSG_SGSN_CNTXT_REQ, "SGSN context request"},
  474. {GTP_MSG_SGSN_CNTXT_RESP, "SGSN context response"},
  475. {GTP_MSG_SGSN_CNTXT_ACK, "SGSN context acknowledgement"},
  476. {GTP_MSG_FORW_RELOC_REQ, "Forward relocation request"},
  477. {GTP_MSG_FORW_RELOC_RESP, "Forward relocation response"},
  478. {GTP_MSG_FORW_RELOC_COMP, "Forward relocation complete"},
  479. {GTP_MSG_RELOC_CANCEL_REQ, "Relocation cancel request"},
  480. {GTP_MSG_RELOC_CANCEL_RESP, "Relocation cancel response"},
  481. {GTP_MSG_FORW_SRNS_CNTXT, "Forward SRNS context"},
  482. {GTP_MSG_FORW_RELOC_ACK, "Forward relocation complete acknowledge"},
  483. {GTP_MSG_FORW_SRNS_CNTXT_ACK, "Forward SRNS context acknowledge"},
  484. /* 61-69 For future use. Shall not be sent. If received,
  485. * shall be treated as an Unknown message.
  486. */
  487. #if 0
  488. { 61, "Unknown message(For future use)"},
  489. { 62, "Unknown message(For future use)"},
  490. { 63, "Unknown message(For future use)"},
  491. { 64, "Unknown message(For future use)"},
  492. { 65, "Unknown message(For future use)"},
  493. { 66, "Unknown message(For future use)"},
  494. { 67, "Unknown message(For future use)"},
  495. { 68, "Unknown message(For future use)"},
  496. { 69, "Unknown message(For future use)"},
  497. #endif
  498. {GTP_MSG_RAN_INFO_RELAY, "RAN Information Relay"},
  499. /* 71-95 For future use. Shall not be sent. If received,
  500. * shall be treated as an Unknown message.
  501. */
  502. #if 0
  503. { 71, "Unknown message(For future use)"},
  504. { 72, "Unknown message(For future use)"},
  505. { 73, "Unknown message(For future use)"},
  506. { 74, "Unknown message(For future use)"},
  507. { 75, "Unknown message(For future use)"},
  508. { 76, "Unknown message(For future use)"},
  509. { 77, "Unknown message(For future use)"},
  510. { 78, "Unknown message(For future use)"},
  511. { 79, "Unknown message(For future use)"},
  512. { 80, "Unknown message(For future use)"},
  513. { 81, "Unknown message(For future use)"},
  514. { 82, "Unknown message(For future use)"},
  515. { 83, "Unknown message(For future use)"},
  516. { 84, "Unknown message(For future use)"},
  517. { 85, "Unknown message(For future use)"},
  518. { 86, "Unknown message(For future use)"},
  519. { 87, "Unknown message(For future use)"},
  520. { 88, "Unknown message(For future use)"},
  521. { 89, "Unknown message(For future use)"},
  522. { 90, "Unknown message(For future use)"},
  523. { 91, "Unknown message(For future use)"},
  524. { 92, "Unknown message(For future use)"},
  525. { 93, "Unknown message(For future use)"},
  526. { 94, "Unknown message(For future use)"},
  527. { 95, "Unknown message(For future use)"},
  528. #endif
  529. {GTP_MBMS_NOTIFY_REQ, "MBMS Notification Request"},
  530. {GTP_MBMS_NOTIFY_RES, "MBMS Notification Response"},
  531. {GTP_MBMS_NOTIFY_REJ_REQ, "MBMS Notification Reject Request"},
  532. {GTP_MBMS_NOTIFY_REJ_RES, "MBMS Notification Reject Response"},
  533. {GTP_CREATE_MBMS_CNTXT_REQ, "Create MBMS Context Request"},
  534. {GTP_CREATE_MBMS_CNTXT_RES, "Create MBMS Context Response"},
  535. {GTP_UPD_MBMS_CNTXT_REQ, "Update MBMS Context Request"},
  536. {GTP_UPD_MBMS_CNTXT_RES, "Update MBMS Context Response"},
  537. {GTP_DEL_MBMS_CNTXT_REQ, "Delete MBMS Context Request"},
  538. {GTP_DEL_MBMS_CNTXT_RES, "Delete MBMS Context Response"},
  539. /* 106 - 111 For future use. Shall not be sent. If received,
  540. * shall be treated as an Unknown message.
  541. */
  542. #if 0
  543. { 106, "Unknown message(For future use)"},
  544. { 107, "Unknown message(For future use)"},
  545. { 108, "Unknown message(For future use)"},
  546. { 109, "Unknown message(For future use)"},
  547. { 110, "Unknown message(For future use)"},
  548. { 111, "Unknown message(For future use)"},
  549. #endif
  550. {GTP_MBMS_REG_REQ, "MBMS Registration Request"},
  551. {GTP_MBMS_REG_RES, "MBMS Registration Response"},
  552. {GTP_MBMS_DE_REG_REQ, "MBMS De-Registration Request"},
  553. {GTP_MBMS_DE_REG_RES, "MBMS De-Registration Response"},
  554. {GTP_MBMS_SES_START_REQ, "MBMS Session Start Request"},
  555. {GTP_MBMS_SES_START_RES, "MBMS Session Start Response"},
  556. {GTP_MBMS_SES_STOP_REQ, "MBMS Session Stop Request"},
  557. {GTP_MBMS_SES_STOP_RES, "MBMS Session Stop Response"},
  558. {GTP_MBMS_SES_UPD_REQ, "MBMS Session Update Request"},
  559. {GTP_MBMS_SES_UPD_RES, "MBMS Session Update Response"},
  560. /* 122-127 For future use. Shall not be sent.
  561. * If received, shall be treated as an Unknown message.
  562. */
  563. #if 0
  564. { 122, "Unknown message(For future use)"},
  565. { 123, "Unknown message(For future use)"},
  566. { 124, "Unknown message(For future use)"},
  567. { 125, "Unknown message(For future use)"},
  568. { 126, "Unknown message(For future use)"},
  569. { 127, "Unknown message(For future use)"},
  570. #endif
  571. {GTP_MS_INFO_CNG_NOT_REQ, "MS Info Change Notification Request"},
  572. {GTP_MS_INFO_CNG_NOT_RES, "MS Info Change Notification Response"},
  573. /* 130-239 For future use. Shall not be sent. If received,
  574. * shall be treated as an Unknown message.
  575. */
  576. #if 0
  577. { 130, "Unknown message(For future use)"},
  578. { 131, "Unknown message(For future use)"},
  579. { 132, "Unknown message(For future use)"},
  580. { 133, "Unknown message(For future use)"},
  581. { 134, "Unknown message(For future use)"},
  582. { 135, "Unknown message(For future use)"},
  583. { 136, "Unknown message(For future use)"},
  584. { 137, "Unknown message(For future use)"},
  585. { 138, "Unknown message(For future use)"},
  586. { 139, "Unknown message(For future use)"},
  587. { 140, "Unknown message(For future use)"},
  588. { 141, "Unknown message(For future use)"},
  589. { 142, "Unknown message(For future use)"},
  590. { 143, "Unknown message(For future use)"},
  591. { 144, "Unknown message(For future use)"},
  592. { 145, "Unknown message(For future use)"},
  593. { 146, "Unknown message(For future use)"},
  594. { 147, "Unknown message(For future use)"},
  595. { 148, "Unknown message(For future use)"},
  596. { 149, "Unknown message(For future use)"},
  597. { 150, "Unknown message(For future use)"},
  598. { 151, "Unknown message(For future use)"},
  599. { 152, "Unknown message(For future use)"},
  600. { 153, "Unknown message(For future use)"},
  601. { 154, "Unknown message(For future use)"},
  602. { 155, "Unknown message(For future use)"},
  603. { 156, "Unknown message(For future use)"},
  604. { 157, "Unknown message(For future use)"},
  605. { 158, "Unknown message(For future use)"},
  606. { 159, "Unknown message(For future use)"},
  607. #endif
  608. {GTP_MSG_DATA_TRANSF_REQ, "Data record transfer request"},
  609. {GTP_MSG_DATA_TRANSF_RESP, "Data record transfer response"},
  610. /* 242-253 For future use. Shall not be sent. If received,
  611. * shall be treated as an Unknown message.
  612. */
  613. #if 0
  614. { 242, "Unknown message(For future use)"},
  615. { 243, "Unknown message(For future use)"},
  616. { 244, "Unknown message(For future use)"},
  617. { 245, "Unknown message(For future use)"},
  618. { 246, "Unknown message(For future use)"},
  619. { 247, "Unknown message(For future use)"},
  620. { 248, "Unknown message(For future use)"},
  621. { 249, "Unknown message(For future use)"},
  622. { 250, "Unknown message(For future use)"},
  623. { 251, "Unknown message(For future use)"},
  624. { 252, "Unknown message(For future use)"},
  625. { 253, "Unknown message(For future use)"},
  626. #endif
  627. {GTP_MSG_END_MARKER, "End Marker"},
  628. {GTP_MSG_TPDU, "T-PDU"},
  629. {0, NULL}
  630. };
  631. static value_string_ext gtp_message_type_ext = VALUE_STRING_EXT_INIT(gtp_message_type);
  632. /* definitions of fields in extension header */
  633. #define GTP_EXT_CAUSE 0x01
  634. #define GTP_EXT_IMSI 0x02
  635. #define GTP_EXT_RAI 0x03
  636. #define GTP_EXT_TLLI 0x04
  637. #define GTP_EXT_PTMSI 0x05
  638. #define GTP_EXT_QOS_GPRS 0x06
  639. #define GTP_EXT_REORDER 0x08
  640. #define GTP_EXT_AUTH_TRI 0x09
  641. #define GTP_EXT_MAP_CAUSE 0x0B
  642. #define GTP_EXT_PTMSI_SIG 0x0C
  643. #define GTP_EXT_MS_VALID 0x0D
  644. #define GTP_EXT_RECOVER 0x0E
  645. #define GTP_EXT_SEL_MODE 0x0F
  646. #define GTP_EXT_16 0x10
  647. #define GTP_EXT_FLOW_LABEL 0x10
  648. #define GTP_EXT_TEID 0x10 /* 0xFF10 3G */
  649. #define GTP_EXT_17 0x11
  650. #define GTP_EXT_FLOW_SIG 0x11
  651. #define GTP_EXT_TEID_CP 0x11 /* 0xFF11 3G */
  652. #define GTP_EXT_18 0x12
  653. #define GTP_EXT_FLOW_II 0x12
  654. #define GTP_EXT_TEID_II 0x12 /* 0xFF12 3G */
  655. #define GTP_EXT_19 0x13 /* 19 TV Teardown Ind 7.7.16 */
  656. #define GTP_EXT_MS_REASON 0x13 /* same as 0x1D GTPv1_EXT_MS_REASON */
  657. #define GTP_EXT_TEAR_IND 0x13 /* 0xFF13 3G */
  658. #define GTP_EXT_NSAPI 0x14 /* 3G */
  659. #define GTP_EXT_RANAP_CAUSE 0x15 /* 3G */
  660. #define GTP_EXT_RAB_CNTXT 0x16 /* 3G */
  661. #define GTP_EXT_RP_SMS 0x17 /* 3G */
  662. #define GTP_EXT_RP 0x18 /* 3G */
  663. #define GTP_EXT_PKT_FLOW_ID 0x19 /* 3G */
  664. #define GTP_EXT_CHRG_CHAR 0x1A /* 3G */
  665. #define GTP_EXT_TRACE_REF 0x1B /* 3G */
  666. #define GTP_EXT_TRACE_TYPE 0x1C /* 3G */
  667. #define GTPv1_EXT_MS_REASON 0x1D /* 3G 29 TV MS Not Reachable Reason 7.7.25A */
  668. /* 117-126 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
  669. #define GTP_EXT_TR_COMM 0x7E /* charging */
  670. #define GTP_EXT_CHRG_ID 0x7F /* 127 TV Charging ID 7.7.26 */
  671. #define GTP_EXT_USER_ADDR 0x80
  672. #define GTP_EXT_MM_CNTXT 0x81
  673. #define GTP_EXT_PDP_CNTXT 0x82
  674. #define GTP_EXT_APN 0x83
  675. #define GTP_EXT_PROTO_CONF 0x84
  676. #define GTP_EXT_GSN_ADDR 0x85
  677. #define GTP_EXT_MSISDN 0x86
  678. #define GTP_EXT_QOS_UMTS 0x87 /* 3G */
  679. #define GTP_EXT_AUTH_QUI 0x88 /* 3G */
  680. #define GTP_EXT_TFT 0x89 /* 3G */
  681. #define GTP_EXT_TARGET_ID 0x8A /* 3G */
  682. #define GTP_EXT_UTRAN_CONT 0x8B /* 3G */
  683. #define GTP_EXT_RAB_SETUP 0x8C /* 3G */
  684. #define GTP_EXT_HDR_LIST 0x8D /* 3G */
  685. #define GTP_EXT_TRIGGER_ID 0x8E /* 3G 142 7.7.41 */
  686. #define GTP_EXT_OMC_ID 0x8F /* 3G 143 TLV OMC Identity 7.7.42 */
  687. #define GTP_EXT_RAN_TR_CONT 0x90 /* 3G 144 TLV RAN Transparent Container 7.7.43 */
  688. #define GTP_EXT_PDP_CONT_PRIO 0x91 /* 3G 145 TLV PDP Context Prioritization 7.7.45 */
  689. #define GTP_EXT_ADD_RAB_SETUP_INF 0x92 /* 3G 146 TLV Additional RAB Setup Information 7.7.45A */
  690. #define GTP_EXT_SSGN_NO 0x93 /* 3G 147 TLV SGSN Number 7.7.47 */
  691. #define GTP_EXT_COMMON_FLGS 0x94 /* 3G 148 TLV Common Flags 7.7.48 */
  692. #define GTP_EXT_APN_RES 0x95 /* 3G 149 */
  693. #define GTP_EXT_RA_PRIO_LCS 0x96 /* 3G 150 TLV Radio Priority LCS 7.7.25B */
  694. #define GTP_EXT_RAT_TYPE 0x97 /* 3G 151 TLV RAT Type 7.7.50 */
  695. #define GTP_EXT_USR_LOC_INF 0x98 /* 3G 152 TLV User Location Information 7.7.51 */
  696. #define GTP_EXT_MS_TIME_ZONE 0x99 /* 3G 153 TLV MS Time Zone 7.7.52 */
  697. #define GTP_EXT_IMEISV 0x9A /* 3G 154 TLV IMEI(SV) 7.7.53 */
  698. #define GTP_EXT_CAMEL_CHG_INF_CON 0x9B /* 3G 155 TLV CAMEL Charging Information Container 7.7.54 */
  699. #define GTP_EXT_MBMS_UE_CTX 0x9C /* 3G 156 TLV MBMS UE Context 7.7.55 */
  700. #define GTP_EXT_TMGI 0x9D /* 3G 157 TLV Temporary Mobile Group Identity (TMGI) 7.7.56 */
  701. #define GTP_EXT_RIM_RA 0x9E /* 3G 158 TLV RIM Routing Address 7.7.57 */
  702. #define GTP_EXT_MBMS_PROT_CONF_OPT 0x9F /* 3G 159 TLV MBMS Protocol Configuration Options 7.7.58 */
  703. #define GTP_EXT_MBMS_SA 0xA0 /* 3G 160 TLV MBMS Service Area 7.7.60 */
  704. #define GTP_EXT_SRC_RNC_PDP_CTX_INF 0xA1 /* 3G 161 TLV Source RNC PDCP context info 7.7.61 */
  705. #define GTP_EXT_ADD_TRS_INF 0xA2 /* 3G 162 TLV Additional Trace Info 7.7.62 */
  706. #define GTP_EXT_HOP_COUNT 0xA3 /* 3G 163 TLV Hop Counter 7.7.63 */
  707. #define GTP_EXT_SEL_PLMN_ID 0xA4 /* 3G 164 TLV Selected PLMN ID 7.7.64 */
  708. #define GTP_EXT_MBMS_SES_ID 0xA5 /* 3G 165 TLV MBMS Session Identifier 7.7.65 */
  709. #define GTP_EXT_MBMS_2G_3G_IND 0xA6 /* 3G 166 TLV MBMS 2G/3G Indicator 7.7.66 */
  710. #define GTP_EXT_ENH_NSAPI 0xA7 /* 3G 167 TLV Enhanced NSAPI 7.7.67 */
  711. #define GTP_EXT_MBMS_SES_DUR 0xA8 /* 3G 168 TLV MBMS Session Duration 7.7.59 */
  712. #define GTP_EXT_ADD_MBMS_TRS_INF 0xA9 /* 3G 169 TLV Additional MBMS Trace Info 7.7.68 */
  713. #define GTP_EXT_MBMS_SES_ID_REP_NO 0xAA /* 3G 170 TLV MBMS Session Identity Repetition Number 7.7.69 */
  714. #define GTP_EXT_MBMS_TIME_TO_DATA_TR 0xAB /* 3G 171 TLV MBMS Time To Data Transfer 7.7.70 */
  715. #define GTP_EXT_PS_HO_REQ_CTX 0xAC /* 3G 172 TLV PS Handover Request Context 7.7.71 */
  716. #define GTP_EXT_BSS_CONT 0xAD /* 3G 173 TLV BSS Container 7.7.72 */
  717. #define GTP_EXT_CELL_ID 0xAE /* 3G 174 TLV Cell Identification 7.7.73 */
  718. #define GTP_EXT_PDU_NO 0xAF /* 3G 175 TLV PDU Numbers 7.7.74 */
  719. #define GTP_EXT_BSSGP_CAUSE 0xB0 /* 3G 176 TLV BSSGP Cause 7.7.75 */
  720. #define GTP_EXT_REQ_MBMS_BEARER_CAP 0xB1 /* 3G 177 TLV Required MBMS bearer capabilities 7.7.76 */
  721. #define GTP_EXT_RIM_ROUTING_ADDR_DISC 0xB2 /* 3G 178 TLV RIM Routing Address Discriminator 7.7.77 */
  722. #define GTP_EXT_LIST_OF_SETUP_PFCS 0xB3 /* 3G 179 TLV List of set-up PFCs 7.7.78 */
  723. #define GTP_EXT_PS_HANDOVER_XIP_PAR 0xB4 /* 3G 180 TLV PS Handover XID Parameters 7.7.79 */
  724. #define GTP_EXT_MS_INF_CHG_REP_ACT 0xB5 /* 3G 181 TLV MS Info Change Reporting Action 7.7.80 */
  725. #define GTP_EXT_DIRECT_TUNNEL_FLGS 0xB6 /* 3G 182 TLV Direct Tunnel Flags 7.7.81 */
  726. #define GTP_EXT_CORRELATION_ID 0xB7 /* 3G 183 TLV Correlation-ID 7.7.82 */
  727. #define GTP_EXT_BEARER_CONTROL_MODE 0xB8 /* 3G 184 TLV Bearer Control Mode 7.7.83 */
  728. #define GTP_EXT_MBMS_FLOW_ID 0xB9 /* 3G 185 TLV MBMS Flow Identifier 7.7.84 */
  729. #define GTP_EXT_MBMS_IP_MCAST_DIST 0xBA /* 3G 186 TLV MBMS IP Multicast Distribution 7.7.85 */
  730. #define GTP_EXT_MBMS_DIST_ACK 0xBB /* 3G 187 TLV MBMS Distribution Acknowledgement 7.7.86 */
  731. #define GTP_EXT_RELIABLE_IRAT_HO_INF 0xBC /* 3G 188 TLV Reliable INTER RAT HANDOVER INFO 7.7.87 */
  732. #define GTP_EXT_RFSP_INDEX 0xBD /* 3G 189 TLV RFSP Index 7.7.88 */
  733. #define GTP_EXT_FQDN 0xBE /* 3G 190 TLV Fully Qualified Domain Name (FQDN) 7.7.90 */
  734. #define GTP_EXT_EVO_ALLO_RETE_P1 0xBF /* 3G 191 TLV Evolved Allocation/Retention Priority I 7.7.91 */
  735. #define GTP_EXT_EVO_ALLO_RETE_P2 0xC0 /* 3G 192 TLV Evolved Allocation/Retention Priority II 7.7.92 */
  736. #define GTP_EXT_EXTENDED_COMMON_FLGS 0xC1 /* 3G 193 TLV Extended Common Flags 7.7.93 */
  737. #define GTP_EXT_UCI 0xC2 /* 3G 194 TLV User CSG Information (UCI) 7.7.94 */
  738. #define GTP_EXT_CSG_INF_REP_ACT 0xC3 /* 3G 195 TLV CSG Information Reporting Action 7.7.95 */
  739. #define GTP_EXT_CSG_ID 0xC4 /* 3G 196 TLV CSG ID 7.7.96 */
  740. #define GTP_EXT_CMI 0xC5 /* 3G 197 TLV CSG Membership Indication (CMI) 7.7.97 */
  741. #define GTP_EXT_AMBR 0xC6 /* 3G 198 TLV Aggregate Maximum Bit Rate (AMBR) 7.7.98 */
  742. #define GTP_EXT_UE_NETWORK_CAP 0xC7 /* 3G 199 TLV UE Network Capability 7.7.99 */
  743. #define GTP_EXT_UE_AMBR 0xC8 /* 3G 200 TLV UE-AMBR 7.7.100 */
  744. #define GTP_EXT_APN_AMBR_WITH_NSAPI 0xC9 /* 3G 201 TLV APN-AMBR with NSAPI 7.7.101 */
  745. #define GTP_EXT_GGSN_BACK_OFF_TIME 0xCA /* 3G 202 TLV GGSN Back-Off Time 7.7.102 */
  746. #define GTP_EXT_SIG_PRI_IND 0xCB /* 3G 203 TLV Signalling Priority Indication 7.7.103 */
  747. #define GTP_EXT_SIG_PRI_IND_W_NSAPI 0xCC /* 3G 204 TLV Signalling Priority Indication with NSAPI 7.7.104 */
  748. #define GTP_EXT_HIGHER_BR_16MB_FLG 0xCD /* 3G 205 TLV Higher bitrates than 16 Mbps flag 7.7.105 */
  749. #define GTP_EXT_MAX_MBR_APN_AMBR 0xCE /* 3G 206 TLV Max MBR/APN-AMBR 7.7.106 */
  750. #define GTP_EXT_ADD_MM_CTX_SRVCC 0xCF /* 3G 207 TLV Additional MM context for SRVCC 7.7.107 */
  751. #define GTP_EXT_ADD_FLGS_SRVCC 0xD0 /* 3G 208 TLV Additional flags for SRVCC 7.7.108 */
  752. #define GTP_EXT_STN_SR 0xD1 /* 3G 209 TLV STN-SR 7.7.109 */
  753. #define GTP_EXT_C_MSISDN 0xD2 /* 3G 210 TLV C-MSISDN 7.7.110 */
  754. #define GTP_EXT_EXT_RANAP_CAUSE 0xD3 /* 3G 211 TLV Extended RANAP Cause 7.7.111 */
  755. /* 212-238 TLV Spare. For future use. */
  756. /* 239-250 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33])*/
  757. #define GTP_EXT_C1 0xC1
  758. #define GTP_EXT_C2 0xC2
  759. #define GTP_EXT_REL_PACK 0xF9 /* charging */
  760. #define GTP_EXT_CAN_PACK 0xFA /* charging */
  761. #define GTP_EXT_CHRG_ADDR 0xFB /* 3G 251 TLV Charging Gateway Address 7.7.44 */
  762. /* 252-254 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33])*/
  763. #define GTP_EXT_DATA_REQ 0xFC /* charging */
  764. #define GTP_EXT_DATA_RESP 0xFD /* charging */
  765. #define GTP_EXT_NODE_ADDR 0xFE /* charging */
  766. #define GTP_EXT_PRIV_EXT 0xFF
  767. static const value_string gtp_val[] = {
  768. {GTP_EXT_CAUSE, "Cause of operation"},
  769. {GTP_EXT_IMSI, "IMSI"},
  770. {GTP_EXT_RAI, "Routing Area Identity"},
  771. {GTP_EXT_TLLI, "Temporary Logical Link Identity"},
  772. {GTP_EXT_PTMSI, "Packet TMSI"},
  773. /* 6 */ {GTP_EXT_QOS_GPRS, "Quality of Service"},
  774. /* 6-7 Spare */
  775. /* 8 */ {GTP_EXT_REORDER, "Reorder required"},
  776. /* 9 */ {GTP_EXT_AUTH_TRI, "Authentication triplets"},
  777. /* 10 Spare */
  778. /* 11 */ {GTP_EXT_MAP_CAUSE, "MAP cause"},
  779. /* 12 */ {GTP_EXT_PTMSI_SIG, "P-TMSI signature"},
  780. /* 13 */ {GTP_EXT_MS_VALID, "MS validated"},
  781. /* 14 */ {GTP_EXT_RECOVER, "Recovery"},
  782. /* 15 */ {GTP_EXT_SEL_MODE, "Selection mode"},
  783. /* 16 */ {GTP_EXT_16, "Flow label data I"},
  784. /* 16 */ /* ??? {GTP_EXT_FLOW_LABEL, "Flow label data I"}, */
  785. /* 16 */ /* ??? {GTP_EXT_TEID, "Tunnel Endpoint Identifier Data I"}, */ /* 3G */
  786. {GTP_EXT_17, "Flow label signalling"},
  787. /* ??? {GTP_EXT_FLOW_SIG, "Flow label signalling"}, */
  788. /* ??? {GTP_EXT_TEID_CP, "Tunnel Endpoint Identifier Data Control Plane"}, */ /* 3G */
  789. {GTP_EXT_18, "Flow label data II"},
  790. /* ??? {GTP_EXT_FLOW_II, "Flow label data II"}, */
  791. /* ??? {GTP_EXT_TEID_II, "Tunnel Endpoint Identifier Data II"}, */ /* 3G */
  792. {GTP_EXT_19, "MS not reachable reason"},
  793. /* ??? {GTP_EXT_MS_REASON, "MS not reachable reason"}, */
  794. /* ??? {GTP_EXT_TEAR_IND, "Teardown ID"}, */ /* 3G */
  795. {GTP_EXT_NSAPI, "NSAPI"}, /* 3G */
  796. {GTP_EXT_RANAP_CAUSE, "RANAP cause"}, /* 3G */
  797. {GTP_EXT_RAB_CNTXT, "RAB context"}, /* 3G */
  798. {GTP_EXT_RP_SMS, "Radio Priority for MO SMS"}, /* 3G */
  799. {GTP_EXT_RP, "Radio Priority"}, /* 3G */
  800. {GTP_EXT_PKT_FLOW_ID, "Packet Flow ID"}, /* 3G */
  801. {GTP_EXT_CHRG_CHAR, "Charging characteristics"}, /* 3G */
  802. {GTP_EXT_TRACE_REF, "Trace references"}, /* 3G */
  803. {GTP_EXT_TRACE_TYPE, "Trace type"}, /* 3G */
  804. /* 29 */ {GTPv1_EXT_MS_REASON, "MS not reachable reason"}, /* 3G */
  805. /* 117-126 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
  806. /* 126 */ {GTP_EXT_TR_COMM, "Packet transfer command"}, /* charging */
  807. /* 127 */ {GTP_EXT_CHRG_ID, "Charging ID"},
  808. {GTP_EXT_USER_ADDR, "End user address"},
  809. {GTP_EXT_MM_CNTXT, "MM context"},
  810. {GTP_EXT_PDP_CNTXT, "PDP context"},
  811. {GTP_EXT_APN, "Access Point Name"},
  812. {GTP_EXT_PROTO_CONF, "Protocol configuration options"},
  813. {GTP_EXT_GSN_ADDR, "GSN address"},
  814. {GTP_EXT_MSISDN, "MS international PSTN/ISDN number"},
  815. {GTP_EXT_QOS_UMTS, "Quality of service (UMTS)"}, /* 3G */
  816. {GTP_EXT_AUTH_QUI, "Authentication quintuplets"}, /* 3G */
  817. {GTP_EXT_TFT, "Traffic Flow Template (TFT)"}, /* 3G */
  818. {GTP_EXT_TARGET_ID, "Target (RNC) identification"}, /* 3G */
  819. {GTP_EXT_UTRAN_CONT, "UTRAN transparent field"}, /* 3G */
  820. {GTP_EXT_RAB_SETUP, "RAB setup information"}, /* 3G */
  821. {GTP_EXT_HDR_LIST, "Extension Header Types List"}, /* 3G */
  822. {GTP_EXT_TRIGGER_ID, "Trigger Id"}, /* 3G */
  823. {GTP_EXT_OMC_ID, "OMC Identity"}, /* 3G */
  824. {GTP_EXT_RAN_TR_CONT, "RAN Transparent Container"}, /* 7.7.43 */
  825. {GTP_EXT_PDP_CONT_PRIO, "PDP Context Prioritization"}, /* 7.7.45 */
  826. {GTP_EXT_ADD_RAB_SETUP_INF, "Additional RAB Setup Information"}, /* 7.7.45A */
  827. {GTP_EXT_SSGN_NO, "SGSN Number"}, /* 7.7.47 */
  828. {GTP_EXT_COMMON_FLGS, "Common Flags"}, /* 7.7.48 */
  829. {GTP_EXT_APN_RES, "APN Restriction"}, /* 3G */
  830. {GTP_EXT_RA_PRIO_LCS, "Radio Priority LCS"}, /* 7.7.25B */
  831. {GTP_EXT_RAT_TYPE, "RAT Type"}, /* 3G */
  832. {GTP_EXT_USR_LOC_INF, "User Location Information"}, /* 7.7.51 */
  833. {GTP_EXT_MS_TIME_ZONE, "MS Time Zone"}, /* 7.7.52 */
  834. {GTP_EXT_IMEISV, "IMEI(SV)"}, /* 3G */
  835. {GTP_EXT_CAMEL_CHG_INF_CON, "CAMEL Charging Information Container"}, /* 7.7.54 */
  836. {GTP_EXT_MBMS_UE_CTX, "MBMS UE Context"}, /* 7.7.55 */
  837. {GTP_EXT_TMGI, "Temporary Mobile Group Identity (TMGI)"}, /* 7.7.56 */
  838. {GTP_EXT_RIM_RA, "RIM Routing Address"}, /* 7.7.57 */
  839. {GTP_EXT_MBMS_PROT_CONF_OPT, "MBMS Protocol Configuration Options"}, /* 7.7.58 */
  840. {GTP_EXT_MBMS_SA, "MBMS Service Area"}, /* 7.7.60 */
  841. {GTP_EXT_SRC_RNC_PDP_CTX_INF, "Source RNC PDCP context info"}, /* 7.7.61 */
  842. {GTP_EXT_ADD_TRS_INF, "Additional Trace Info"}, /* 7.7.62 */
  843. {GTP_EXT_HOP_COUNT, "Hop Counter"}, /* 7.7.63 */
  844. {GTP_EXT_SEL_PLMN_ID, "Selected PLMN ID"}, /* 7.7.64 */
  845. {GTP_EXT_MBMS_SES_ID, "MBMS Session Identifier"}, /* 7.7.65 */
  846. {GTP_EXT_MBMS_2G_3G_IND, "MBMS 2G/3G Indicator"}, /* 7.7.66 */
  847. {GTP_EXT_ENH_NSAPI, "Enhanced NSAPI"}, /* 7.7.67 */
  848. {GTP_EXT_MBMS_SES_DUR, "MBMS Session Duration"}, /* 7.7.59 */
  849. {GTP_EXT_ADD_MBMS_TRS_INF, "Additional MBMS Trace Info"}, /* 7.7.68 */
  850. {GTP_EXT_MBMS_SES_ID_REP_NO, "MBMS Session Identity Repetition Number"}, /* 7.7.69 */
  851. {GTP_EXT_MBMS_TIME_TO_DATA_TR, "MBMS Time To Data Transfer"}, /* 7.7.70 */
  852. {GTP_EXT_PS_HO_REQ_CTX, "PS Handover Request Context"}, /* 7.7.71 */
  853. {GTP_EXT_BSS_CONT, "BSS Container"}, /* 7.7.72 */
  854. {GTP_EXT_CELL_ID, "Cell Identification"}, /* 7.7.73 */
  855. {GTP_EXT_PDU_NO, "PDU Numbers"}, /* 7.7.74 */
  856. {GTP_EXT_BSSGP_CAUSE, "BSSGP Cause"}, /* 7.7.75 */
  857. {GTP_EXT_REQ_MBMS_BEARER_CAP, "Required MBMS bearer capabilities"}, /* 7.7.76 */
  858. {GTP_EXT_RIM_ROUTING_ADDR_DISC, "RIM Routing Address Discriminator"}, /* 7.7.77 */
  859. {GTP_EXT_LIST_OF_SETUP_PFCS, "List of set-up PFCs"}, /* 7.7.78 */
  860. /* 180 */ {GTP_EXT_PS_HANDOVER_XIP_PAR, " PS Handover XID Parameters"}, /* 7.7.79 */
  861. /* 181 */ {GTP_EXT_MS_INF_CHG_REP_ACT, "MS Info Change Reporting Action"}, /* 7.7.80 */
  862. /* 182 */ {GTP_EXT_DIRECT_TUNNEL_FLGS, "Direct Tunnel Flags"}, /* 7.7.81 */
  863. /* 183 */ {GTP_EXT_CORRELATION_ID, "Correlation-ID"}, /* 7.7.82 */
  864. /* 184 */ {GTP_EXT_BEARER_CONTROL_MODE, "Bearer Control Mode"}, /* 7.7.83 */
  865. /* 185 */ {GTP_EXT_MBMS_FLOW_ID, "MBMS Flow Identifier"}, /* 7.7.84 */
  866. /* 186 */ {GTP_EXT_MBMS_IP_MCAST_DIST, "MBMS IP Multicast Distribution"}, /* 7.7.85 */
  867. /* 187 */ {GTP_EXT_MBMS_DIST_ACK, "MBMS Distribution Acknowledgement"}, /* 7.7.86 */
  868. /* 188 */ {GTP_EXT_RELIABLE_IRAT_HO_INF, "Reliable INTER RAT HANDOVER INFO"}, /* 7.7.87 */
  869. /* 189 */ {GTP_EXT_RFSP_INDEX, "RFSP Index"}, /* 7.7.88 */
  870. /* 190 */ {GTP_EXT_FQDN, "Fully Qualified Domain Name (FQDN)"}, /* 7.7.90 */
  871. /* 191 */ {GTP_EXT_EVO_ALLO_RETE_P1, "Evolved Allocation/Retention Priority I"}, /* 7.7.91 */
  872. /* 192 */ {GTP_EXT_EVO_ALLO_RETE_P2, "Evolved Allocation/Retention Priority II"}, /* 7.7.92 */
  873. /* 193 */ {GTP_EXT_EXTENDED_COMMON_FLGS, "Extended Common Flags"}, /* 7.7.93 */
  874. /* 194 */ {GTP_EXT_UCI, "User CSG Information (UCI)"}, /* 7.7.94 */
  875. /* 195 */ {GTP_EXT_CSG_INF_REP_ACT, "CSG Information Reporting Action"}, /* 7.7.95 */
  876. /* 196 */ {GTP_EXT_CSG_ID, "CSG ID"}, /* 7.7.96 */
  877. /* 197 */ {GTP_EXT_CMI, "CSG Membership Indication (CMI)"}, /* 7.7.97 */
  878. /* 198 */ {GTP_EXT_AMBR, "Aggregate Maximum Bit Rate (AMBR)"}, /* 7.7.98 */
  879. /* 199 */ {GTP_EXT_UE_NETWORK_CAP, "UE Network Capability"}, /* 7.7.99 */
  880. /* 200 */ {GTP_EXT_UE_AMBR, "UE-AMBR"}, /* 7.7.100 */
  881. /* 201 */ {GTP_EXT_APN_AMBR_WITH_NSAPI, "APN-AMBR with NSAPI"}, /* 7.7.101 */
  882. /* 202 */ {GTP_EXT_GGSN_BACK_OFF_TIME, "GGSN Back-Off Time"}, /* 7.7.102 */
  883. /* 203 */ {GTP_EXT_SIG_PRI_IND, "Signalling Priority Indication"}, /* 7.7.103 */
  884. /* 204 */ {GTP_EXT_SIG_PRI_IND_W_NSAPI, "Signalling Priority Indication with NSAPI"}, /* 7.7.104 */
  885. /* 205 */ {GTP_EXT_HIGHER_BR_16MB_FLG, "Higher bitrates than 16 Mbps flag"}, /* 7.7.105 */
  886. /* 206 */ {GTP_EXT_MAX_MBR_APN_AMBR, "Max MBR/APN-AMBR"}, /* 7.7.106 */
  887. /* 207 */ {GTP_EXT_ADD_MM_CTX_SRVCC, "Additional MM context for SRVCC"}, /* 7.7.107 */
  888. /* 208 */ {GTP_EXT_ADD_FLGS_SRVCC, "Additional flags for SRVCC"}, /* 7.7.108 */
  889. /* 209 */ {GTP_EXT_STN_SR, "STN-SR"}, /* 7.7.109 */
  890. /* 210 */ {GTP_EXT_C_MSISDN, "C-MSISDN"}, /* 7.7.110 */
  891. /* 211 */ {GTP_EXT_EXT_RANAP_CAUSE, "Extended RANAP Cause"}, /* 7.7.111 */
  892. /* 212-238 TLV Spare. For future use. */
  893. /* 239-250 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
  894. /* 249 */ {GTP_EXT_REL_PACK, "Sequence numbers of released packets IE"}, /* charging */
  895. /* 250 */ {GTP_EXT_CAN_PACK, "Sequence numbers of canceled packets IE"}, /* charging */
  896. /* 251 */ {GTP_EXT_CHRG_ADDR, "Charging Gateway address"}, /* 7.7.44 */
  897. /* 252-254 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
  898. /* 252 */ {GTP_EXT_DATA_REQ, "Data record packet"}, /* charging */
  899. /* 253 */ {GTP_EXT_DATA_RESP, "Requests responded"}, /* charging */
  900. /* 254 */ {GTP_EXT_NODE_ADDR, "Address of recommended node"}, /* charging */
  901. /* 255 */ {GTP_EXT_PRIV_EXT, "Private Extension"},
  902. {0, NULL}
  903. };
  904. static value_string_ext gtp_val_ext = VALUE_STRING_EXT_INIT(gtp_val);
  905. /* It seems like some IE's are renamed in gtpv1 at least reading
  906. * 3GPP TS 29.060 version 6.11.0 Release 6
  907. */
  908. static const value_string gtpv1_val[] = {
  909. /* 1 */ {GTP_EXT_CAUSE, "Cause of operation"},
  910. /* 2 */ {GTP_EXT_IMSI, "IMSI"},
  911. /* 3 */ {GTP_EXT_RAI, "Routing Area Identity"},
  912. /* 4 */ {GTP_EXT_TLLI, "Temporary Logical Link Identity"},
  913. /* 5 */ {GTP_EXT_PTMSI, "Packet TMSI"},
  914. /* 6 */ {GTP_EXT_QOS_GPRS, "Quality of Service"},
  915. /* 6-7 Spare */
  916. /* 7 */ {7, "Spare"},
  917. /* 8 */ {GTP_EXT_REORDER, "Reorder required"},
  918. /* 9 */ {GTP_EXT_AUTH_TRI, "Authentication triplets"},
  919. /* 10 Spare */
  920. /* 10 */ {10, "Spare"},
  921. /* 11 */ {GTP_EXT_MAP_CAUSE, "MAP cause"},
  922. /* 12 */ {GTP_EXT_PTMSI_SIG, "P-TMSI signature"},
  923. /* 13 */ {GTP_EXT_MS_VALID, "MS validated"},
  924. /* 14 */ {GTP_EXT_RECOVER, "Recovery"},
  925. /* 15 */ {GTP_EXT_SEL_MODE, "Selection mode"},
  926. /* 16 */ {GTP_EXT_TEID, "Tunnel Endpoint Identifier Data I"}, /* 3G */
  927. /* 17 */ {GTP_EXT_TEID_CP, "Tunnel Endpoint Identifier Data Control Plane"}, /* 3G */
  928. /* 18 */ {GTP_EXT_TEID_II, "Tunnel Endpoint Identifier Data II"}, /* 3G */
  929. /* 19 */ {GTP_EXT_TEAR_IND, "Teardown ID"}, /* 3G */
  930. /* 20 */ {GTP_EXT_NSAPI, "NSAPI"}, /* 3G */
  931. /* 21 */ {GTP_EXT_RANAP_CAUSE, "RANAP cause"}, /* 3G */
  932. /* 22 */ {GTP_EXT_RAB_CNTXT, "RAB context"}, /* 3G */
  933. /* 23 */ {GTP_EXT_RP_SMS, "Radio Priority for MO SMS"}, /* 3G */
  934. /* 24 */ {GTP_EXT_RP, "Radio Priority"}, /* 3G */
  935. /* 25 */ {GTP_EXT_PKT_FLOW_ID, "Packet Flow ID"}, /* 3G */
  936. /* 26 */ {GTP_EXT_CHRG_CHAR, "Charging characteristics"}, /* 3G */
  937. /* 27 */ {GTP_EXT_TRACE_REF, "Trace references"}, /* 3G */
  938. /* 28 */ {GTP_EXT_TRACE_TYPE, "Trace type"}, /* 3G */
  939. /* 29 */ {GTPv1_EXT_MS_REASON, "MS not reachable reason"}, /* 3G */
  940. /* 117-126 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
  941. /* 126 */ {GTP_EXT_TR_COMM, "Packet transfer command"}, /* charging */
  942. /* 127 */ {GTP_EXT_CHRG_ID, "Charging ID"},
  943. /* 128 */ {GTP_EXT_USER_ADDR, "End user address"},
  944. /* 129 */ {GTP_EXT_MM_CNTXT, "MM context"},
  945. /* 130 */ {GTP_EXT_PDP_CNTXT, "PDP context"},
  946. /* 131 */ {GTP_EXT_APN, "Access Point Name"},
  947. /* 132 */ {GTP_EXT_PROTO_CONF, "Protocol configuration options"},
  948. /* 133 */ {GTP_EXT_GSN_ADDR, "GSN address"},
  949. /* 134 */ {GTP_EXT_MSISDN, "MS international PSTN/ISDN number"},
  950. /* 135 */ {GTP_EXT_QOS_UMTS, "Quality of service (UMTS)"}, /* 3G */
  951. /* 136 */ {GTP_EXT_AUTH_QUI, "Authentication quintuplets"}, /* 3G */
  952. /* 137 */ {GTP_EXT_TFT, "Traffic Flow Template (TFT)"}, /* 3G */
  953. /* 138 */ {GTP_EXT_TARGET_ID, "Target (RNC) identification"}, /* 3G */
  954. /* 139 */ {GTP_EXT_UTRAN_CONT, "UTRAN transparent field"}, /* 3G */
  955. /* 140 */ {GTP_EXT_RAB_SETUP, "RAB setup information"}, /* 3G */
  956. /* 141 */ {GTP_EXT_HDR_LIST, "Extension Header Types List"}, /* 3G */
  957. /* 142 */ {GTP_EXT_TRIGGER_ID, "Trigger Id"}, /* 3G */
  958. /* 143 */ {GTP_EXT_OMC_ID, "OMC Identity"}, /* 3G */
  959. /* 144 */ {GTP_EXT_RAN_TR_CONT, "RAN Transparent Container"}, /* 7.7.43 */
  960. /* 145 */ {GTP_EXT_PDP_CONT_PRIO, "PDP Context Prioritization"}, /* 7.7.45 */
  961. /* 146 */ {GTP_EXT_ADD_RAB_SETUP_INF, "Additional RAB Setup Information"}, /* 7.7.45A */
  962. /* 147 */ {GTP_EXT_SSGN_NO, "SGSN Number"}, /* 7.7.47 */
  963. /* 148 */ {GTP_EXT_COMMON_FLGS, "Common Flags"}, /* 7.7.48 */
  964. /* 149 */ {GTP_EXT_APN_RES, "APN Restriction"}, /* 3G */
  965. /* 150 */ {GTP_EXT_RA_PRIO_LCS, "Radio Priority LCS"}, /* 7.7.25B */
  966. /* 151 */ {GTP_EXT_RAT_TYPE, "RAT Type"}, /* 3G */
  967. /* 152 */ {GTP_EXT_USR_LOC_INF, "User Location Information"}, /* 7.7.51 */
  968. /* 153 */ {GTP_EXT_MS_TIME_ZONE, "MS Time Zone"}, /* 7.7.52 */
  969. /* 154 */ {GTP_EXT_IMEISV, "IMEI(SV)"}, /* 3G */
  970. /* 155 */ {GTP_EXT_CAMEL_CHG_INF_CON, "CAMEL Charging Information Container"}, /* 7.7.54 */
  971. /* 156 */ {GTP_EXT_MBMS_UE_CTX, "MBMS UE Context"}, /* 7.7.55 */
  972. /* 157 */ {GTP_EXT_TMGI, "Temporary Mobile Group Identity (TMGI)"}, /* 7.7.56 */
  973. /* 158 */ {GTP_EXT_RIM_RA, "RIM Routing Address"}, /* 7.7.57 */
  974. /* 159 */ {GTP_EXT_MBMS_PROT_CONF_OPT, "MBMS Protocol Configuration Options"}, /* 7.7.58 */
  975. /* 160 */ {GTP_EXT_MBMS_SA, "MBMS Service Area"}, /* 7.7.60 */
  976. /* 161 */ {GTP_EXT_SRC_RNC_PDP_CTX_INF, "Source RNC PDCP context info"}, /* 7.7.61 */
  977. /* 162 */ {GTP_EXT_ADD_TRS_INF, "Additional Trace Info"}, /* 7.7.62 */
  978. /* 163 */ {GTP_EXT_HOP_COUNT, "Hop Counter"}, /* 7.7.63 */
  979. /* 164 */ {GTP_EXT_SEL_PLMN_ID, "Selected PLMN ID"}, /* 7.7.64 */
  980. /* 165 */ {GTP_EXT_MBMS_SES_ID, "MBMS Session Identifier"}, /* 7.7.65 */
  981. /* 166 */ {GTP_EXT_MBMS_2G_3G_IND, "MBMS 2G/3G Indicator"}, /* 7.7.66 */
  982. /* 167 */ {GTP_EXT_ENH_NSAPI, "Enhanced NSAPI"}, /* 7.7.67 */
  983. /* 168 */ {GTP_EXT_MBMS_SES_DUR, "MBMS Session Duration"}, /* 7.7.59 */
  984. /* 169 */ {GTP_EXT_ADD_MBMS_TRS_INF, "Additional MBMS Trace Info"}, /* 7.7.68 */
  985. /* 170 */ {GTP_EXT_MBMS_SES_ID_REP_NO, "MBMS Session Identity Repetition Number"}, /* 7.7.69 */
  986. /* 171 */ {GTP_EXT_MBMS_TIME_TO_DATA_TR, "MBMS Time To Data Transfer"}, /* 7.7.70 */
  987. /* 172 */ {GTP_EXT_PS_HO_REQ_CTX, "PS Handover Request Context"}, /* 7.7.71 */
  988. /* 173 */ {GTP_EXT_BSS_CONT, "BSS Container"}, /* 7.7.72 */
  989. /* 174 */ {GTP_EXT_CELL_ID, "Cell Identification"}, /* 7.7.73 */
  990. /* 175 */ {GTP_EXT_PDU_NO, "PDU Numbers"}, /* 7.7.74 */
  991. /* 176 */ {GTP_EXT_BSSGP_CAUSE, "BSSGP Cause"}, /* 7.7.75 */
  992. /* 177 */ {GTP_EXT_REQ_MBMS_BEARER_CAP, "Required MBMS bearer capabilities"}, /* 7.7.76 */
  993. /* 178 */ {GTP_EXT_RIM_ROUTING_ADDR_DISC, "RIM Routing Address Discriminator"}, /* 7.7.77 */
  994. /* 179 */ {GTP_EXT_LIST_OF_SETUP_PFCS, "List of set-up PFCs"}, /* 7.7.78 */
  995. /* 180 */ {GTP_EXT_PS_HANDOVER_XIP_PAR, "PS Handover XID Parameters"}, /* 7.7.79 */
  996. /* 181 */ {GTP_EXT_MS_INF_CHG_REP_ACT, "MS Info Change Reporting Action"}, /* 7.7.80 */
  997. /* 182 */ {GTP_EXT_DIRECT_TUNNEL_FLGS, "Direct Tunnel Flags"}, /* 7.7.81 */
  998. /* 183 */ {GTP_EXT_CORRELATION_ID, "Correlation-ID"}, /* 7.7.82 */
  999. /* 184 */ {GTP_EXT_BEARER_CONTROL_MODE, "Bearer Control Mode"}, /* 7.7.83 */
  1000. /* 185 */ {GTP_EXT_MBMS_FLOW_ID, "MBMS Flow Identifier"}, /* 7.7.84 */
  1001. /* 186 */ {GTP_EXT_MBMS_IP_MCAST_DIST, "MBMS IP Multicast Distribution"}, /* 7.7.85 */
  1002. /* 187 */ {GTP_EXT_MBMS_DIST_ACK, "MBMS Distribution Acknowledgement"}, /* 7.7.86 */
  1003. /* 188 */ {GTP_EXT_RELIABLE_IRAT_HO_INF, "Reliable INTER RAT HANDOVER INFO"}, /* 7.7.87 */
  1004. /* 190 */ {GTP_EXT_RFSP_INDEX, "RFSP Index"}, /* 7.7.88 */
  1005. /* 190 */ {GTP_EXT_FQDN, "Fully Qualified Domain Name (FQDN)"}, /* 7.7.90 */
  1006. /* 191 */ {GTP_EXT_EVO_ALLO_RETE_P1, "Evolved Allocation/Retention Priority I"}, /* 7.7.91 */
  1007. /* 192 */ {GTP_EXT_EVO_ALLO_RETE_P2, "Evolved Allocation/Retention Priority II"}, /* 7.7.92 */
  1008. /* 193 */ {GTP_EXT_EXTENDED_COMMON_FLGS, "Extended Common Flags"}, /* 7.7.93 */
  1009. /* 194 */ {GTP_EXT_UCI, "User CSG Information (UCI)"}, /* 7.7.94 */
  1010. /* 195 */ {GTP_EXT_CSG_INF_REP_ACT, "CSG Information Reporting Action"}, /* 7.7.95 */
  1011. /* 196 */ {GTP_EXT_CSG_ID, "CSG ID"}, /* 7.7.96 */
  1012. /* 197 */ {GTP_EXT_CMI, "CSG Membership Indication (CMI)"}, /* 7.7.97 */
  1013. /* 198 */ {198, "Aggregate Maximum Bit Rate (AMBR)"}, /* 7.7.98 */
  1014. /* 199 */ {199, "UE Network Capability"}, /* 7.7.99 */
  1015. /* 200 */ {200, "UE-AMBR"}, /* 7.7.100 */
  1016. /* 201 */ {201, "APN-AMBR with NSAPI"}, /* 7.7.101 */
  1017. /* 202 */ {202, "GGSN Back-Off Time"}, /* 7.7.102 */
  1018. /* 203 */ {203, "Signalling Priority Indication"}, /* 7.7.103 */
  1019. /* 204 */ {204, "Signalling Priority Indication with NSAPI"}, /* 7.7.104 */
  1020. /* 205 */ {205, "Higher bitrates than 16 Mbps flag"}, /* 7.7.105 */
  1021. /* 206 */ {206, "Max MBR/APN-AMBR"}, /* 7.7.106 */
  1022. /* 207 */ {207, "Additional MM context for SRVCC"}, /* 7.7.107 */
  1023. /* 208 */ {208, "Additional flags for SRVCC"}, /* 7.7.108 */
  1024. /* 209 */ {209, "STN-SR"}, /* 7.7.109 */
  1025. /* 210 */ {210, "C-MSISDN"}, /* 7.7.110 */
  1026. /* 211 */ {211, "Extended RANAP Cause"}, /* 7.7.111 */
  1027. /* 212-238 TLV Spare. For future use. */
  1028. /* 239-250 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
  1029. /* 249 */ {GTP_EXT_REL_PACK, "Sequence numbers of released packets IE"}, /* charging */
  1030. /* 250 */ {GTP_EXT_CAN_PACK, "Sequence numbers of canceled packets IE"}, /* charging */
  1031. /* 251 */ {GTP_EXT_CHRG_ADDR, "Charging Gateway address"}, /* 7.7.44 */
  1032. /* 252-254 Reserved for the GPRS charging protocol (see GTP' in 3GPP TS 32.295 [33]) */
  1033. /* 252 */ {GTP_EXT_DATA_REQ, "Data record packet"}, /* charging */
  1034. /* 253 */ {GTP_EXT_DATA_RESP, "Requests responded"}, /* charging */
  1035. /* 254 */ {GTP_EXT_NODE_ADDR, "Address of recommended node"}, /* charging */
  1036. /* 255 */ {GTP_EXT_PRIV_EXT, "Private Extension"},
  1037. {0, NULL}
  1038. };
  1039. static value_string_ext gtpv1_val_ext = VALUE_STRING_EXT_INIT(gtpv1_val);
  1040. /* GPRS: 9.60 v7.6.0, page 37
  1041. * UMTS: 29.060 v4.0, page 45
  1042. * ETSI TS 129 060 V9.4.0 (2010-10) Ch 7.7.1
  1043. */
  1044. static const value_string cause_type[] = {
  1045. { 0, "Request IMSI"},
  1046. { 1, "Request IMEI"},
  1047. { 2, "Request IMSI and IMEI"},
  1048. { 3, "No identity needed"},
  1049. { 4, "MS refuses"},
  1050. { 5, "MS is not GPRS responding"},
  1051. { 6, "Reactivation Requested"},
  1052. { 7, "PDP address inactivity timer expires"},
  1053. /* For future use 8-48 */
  1054. /* Cause values reserved for GPRS charging
  1055. * protocol use (see GTP' in 3GPP TS 32.295 [33])
  1056. * 49-63
  1057. */
  1058. { 59, "System failure"}, /* charging */
  1059. { 60, "The transmit buffers are becoming full"}, /* charging */
  1060. { 61, "The receive buffers are becoming full"}, /* charging */
  1061. { 62, "Another node is about to go down"}, /* charging */
  1062. { 63, "This node is about to go down"}, /* charging */
  1063. /* For future use 64-127 */
  1064. {128, "Request accepted"},
  1065. {129, "New PDP type due to network preference"},
  1066. {130, "New PDP type due to single address bearer only"},
  1067. /* For future use 131-176 */
  1068. /* Cause values reserved for GPRS charging
  1069. * protocol use (see GTP' in 3GPP TS 32.295 [33])
  1070. * 177-191
  1071. */
  1072. {177, "CDR decoding error"},
  1073. {192, "Non-existent"},
  1074. {193, "Invalid message format"},
  1075. {194, "IMSI not known"},
  1076. {195, "MS is GPRS detached"},
  1077. {196, "MS is not GPRS responding"},
  1078. {197, "MS refuses"},
  1079. {198, "Version not supported"},
  1080. {199, "No resource available"},
  1081. {200, "Service not supported"},
  1082. {201, "Mandatory IE incorrect"},
  1083. {202, "Mandatory IE missing"},
  1084. {203, "Optional IE incorrect"},
  1085. {204, "System failure"},
  1086. {205, "Roaming restriction"},
  1087. {206, "P-TMSI signature mismatch"},
  1088. {207, "GPRS connection suspended"},
  1089. {208, "Authentication failure"},
  1090. {209, "User authentication failed"},
  1091. {210, "Context not found"},
  1092. {211, "All PDP dynamic addresses are occupied"},
  1093. {212, "No memory is available"},
  1094. {213, "Relocation failure"},
  1095. {214, "Unknown mandatory extension header"},
  1096. {215, "Semantic error in the TFT operation"},
  1097. {216, "Syntactic error in the TFT operation"},
  1098. {217, "Semantic errors in packet filter(s)"},
  1099. {218, "Syntactic errors in packet filter(s)"},
  1100. {219, "Missing or unknown APN"},
  1101. {220, "Unknown PDP address or PDP type"},
  1102. {221, "PDP context without TFT already activated"},
  1103. {222, "APN access denied - no subscription"},
  1104. {223, "APN Restriction type incompatibility with currently active PDP Contexts"},
  1105. {224, "MS MBMS Capabilities Insufficient"},
  1106. {225, "Invalid Correlation-ID"},
  1107. {226, "MBMS Bearer Context Superseded"},
  1108. {227, "Bearer Control Mode violation"},
  1109. {228, "Collision with network initiated request"},
  1110. {229, "APN Congestion"},
  1111. {230, "Bearer handling not supported"},
  1112. /* For future use 231-240 */
  1113. /* Cause values reserved for GPRS charging
  1114. * protocol use (see GTP' in 3GPP TS 32.295 [33])
  1115. * 241-255
  1116. */
  1117. {252, "Request related to possibly duplicated packets already fulfilled"}, /* charging */
  1118. {253, "Request already fulfilled"}, /* charging */
  1119. {254, "Sequence numbers of released/cancelled packets IE incorrect"}, /* charging */
  1120. {255, "Request not fulfilled"}, /* charging */
  1121. {0, NULL}
  1122. };
  1123. value_string_ext cause_type_ext = VALUE_STRING_EXT_INIT(cause_type);
  1124. /* GPRS: 9.02 v7.7.0
  1125. * UMTS: 29.002 v4.2.1, chapter 17.5, page 268
  1126. * Imported gsm_old_GSMMAPLocalErrorcode_vals from gsm_map from gsm_map
  1127. */
  1128. static const value_string gsn_addr_type[] = {
  1129. {0x00, "IPv4"},
  1130. {0x01, "IPv6"},
  1131. {0, NULL}
  1132. };
  1133. static const value_string pdp_type[] = {
  1134. {0x00, "X.25"},
  1135. {0x01, "PPP"},
  1136. {0x02, "OSP:IHOSS"},
  1137. {0x21, "IPv4"},
  1138. {0x57, "IPv6"},
  1139. {0x8d, "IPv4v6"},
  1140. {0, NULL}
  1141. };
  1142. static const value_string pdp_org_type[] = {
  1143. {0, "ETSI"},
  1144. {1, "IETF"},
  1145. {0, NULL}
  1146. };
  1147. static const value_string qos_delay_type[] = {
  1148. {0x00, "Subscribed delay class (in MS to network direction)"},
  1149. {0x01, "Delay class 1"},
  1150. {0x02, "Delay class 2"},
  1151. {0x03, "Delay class 3"},
  1152. {0x04, "Delay class 4 (best effort)"},
  1153. {0x07, "Reserved"},
  1154. {0, NULL}
  1155. };
  1156. static const value_string qos_reliability_type[] = {
  1157. {0x00, "Subscribed reliability class (in MS to network direction)"},
  1158. {0x01, "Acknowledged GTP, LLC, and RLC; Protected data"},
  1159. {0x02, "Unacknowledged GTP, Ack LLC/RLC, Protected data"},
  1160. {0x03, "Unacknowledged GTP/LLC, Ack RLC, Protected data"},
  1161. {0x04, "Unacknowledged GTP/LLC/RLC, Protected data"},
  1162. {0x05, "Unacknowledged GTP/LLC/RLC, Unprotected data"},
  1163. {0x07, "Reserved"},
  1164. {0, NULL}
  1165. };
  1166. static const value_string qos_peak_type[] = {
  1167. {0x00, "Subscribed peak throughput (in MS to network direction)"},
  1168. {0x01, "Up to 1 000 oct/s"},
  1169. {0x02, "Up to 2 000 oct/s"},
  1170. {0x03, "Up to 4 000 oct/s"},
  1171. {0x04, "Up to 8 000 oct/s"},
  1172. {0x05, "Up to 16 000 oct/s"},
  1173. {0x06, "Up to 32 000 oct/s"},
  1174. {0x07, "Up to 64 000 oct/s"},
  1175. {0x08, "Up to 128 000 oct/s"},
  1176. {0x09, "Up to 256 000 oct/s"},
  1177. /* QoS Peak throughput classes from 0x0A to 0x0F (from 10 to 15) are subscribed */
  1178. {0x0A, "Reserved"},
  1179. {0x0B, "Reserved"},
  1180. {0x0C, "Reserved"},
  1181. {0x0D, "Reserved"},
  1182. {0x0E, "Reserved"},
  1183. {0x0F, "Reserved"},
  1184. {0, NULL}
  1185. };
  1186. static const value_string qos_precedence_type[] = {
  1187. {0x00, "Subscribed precedence (in MS to network direction)"},
  1188. {0x01, "High priority"},
  1189. {0x02, "Normal priority"},
  1190. {0x03, "Low priority"},
  1191. {0x07, "Reserved"},
  1192. {0, NULL}
  1193. };
  1194. static const value_string qos_mean_type[] = {
  1195. {0x00, "Subscribed mean throughput (in MS to network direction)"},
  1196. {0x01, "100 oct/h"}, /* Class 2 */
  1197. {0x02, "200 oct/h"}, /* Class 3 */
  1198. {0x03, "500 oct/h"}, /* Class 4 */
  1199. {0x04, "1 000 oct/h"}, /* Class 5 */
  1200. {0x05, "2 000 oct/h"}, /* Class 6 */
  1201. {0x06, "5 000 oct/h"}, /* Class 7 */
  1202. {0x07, "10 000 oct/h"}, /* Class 8 */
  1203. {0x08, "20 000 oct/h"}, /* Class 9 */
  1204. {0x09, "50 000 oct/h"}, /* Class 10 */
  1205. {0x0A, "100 000 oct/h"}, /* Class 11 */
  1206. {0x0B, "200 000 oct/h"}, /* Class 12 */
  1207. {0x0C, "500 000 oct/h"}, /* Class 13 */
  1208. {0x0D, "1 000 000 oct/h"}, /* Class 14 */
  1209. {0x0E, "2 000 000 oct/h"}, /* Class 15 */
  1210. {0x0F, "5 000 000 oct/h"}, /* Class 16 */
  1211. {0x10, "10 000 000 oct/h"}, /* Class 17 */
  1212. {0x11, "20 000 000 oct/h"}, /* Class 18 */
  1213. {0x12, "50 000 000 oct/h"}, /* Class 19 */
  1214. /* QoS Mean throughput classes from 0x13 to 0x1E (from 19 to 30) are subscribed */
  1215. {0x13, "Reserved"},
  1216. {0x14, "Reserved"},
  1217. {0x15, "Reserved"},
  1218. {0x16, "Reserved"},
  1219. {0x17, "Reserved"},
  1220. {0x18, "Reserved"},
  1221. {0x19, "Reserved"},
  1222. {0x1A, "Reserved"},
  1223. {0x1B, "Reserved"},
  1224. {0x1C, "Reserved"},
  1225. {0x1D, "Reserved"},
  1226. {0x1E, "Reserved"},
  1227. {0x1F, "Best effort"}, /* Class 1 */
  1228. {0, NULL}
  1229. };
  1230. static value_string_ext qos_mean_type_ext = VALUE_STRING_EXT_INIT(qos_mean_type);
  1231. static const value_string qos_del_err_sdu[] = {
  1232. {0x00, "Subscribed delivery of erroneous SDUs (in MS to network direction)"},
  1233. {0x01, "No detect ('-')"},
  1234. {0x02, "Erroneous SDUs are delivered ('yes')"},
  1235. {0x03, "Erroneous SDUs are not delivered ('no')"},
  1236. {0x07, "Reserved"}, /* All other values are reserved */
  1237. {0, NULL}
  1238. };
  1239. static const value_string qos_del_order[] = {
  1240. {0x00, "Subscribed delivery order (in MS to network direction)"},
  1241. {0x01, "With delivery order ('yes')"},
  1242. {0x02, "Without delivery order ('no')"},
  1243. {0x03, "Reserved"}, /* All other values are reserved */
  1244. {0, NULL}
  1245. };
  1246. static const value_string qos_traf_class[] = {
  1247. {0x00, "Subscribed traffic class (in MS to network direction)"},
  1248. {0x01, "Conversational class"},
  1249. {0x02, "Streaming class"},
  1250. {0x03, "Interactive class"},
  1251. {0x04, "Background class"},
  1252. {0x07, "Reserved"}, /* All other values are reserved */
  1253. {0, NULL}
  1254. };
  1255. static const value_string qos_max_sdu_size[] = {
  1256. {0x00, "Subscribed maximum SDU size (in MS to network direction"},
  1257. /* For values from 0x01 to 0x96 (from 1 to 150), use a granularity of 10 octets */
  1258. {0x97, "1502 octets"},
  1259. {0x98, "1510 octets"},
  1260. {0x99, "1520 octets"},
  1261. {0, NULL} /* All other values are reserved */
  1262. };
  1263. static const value_string qos_max_ul[] = {
  1264. {0x00, "Subscribed maximum bit rate for uplink (in MS to network direction)"},
  1265. /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
  1266. /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
  1267. /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
  1268. {0xFF, "0 kbps"},
  1269. {0, NULL}
  1270. };
  1271. static const value_string qos_max_dl[] = {
  1272. {0x00, "Subscribed maximum bit rate for downlink (in MS to network direction)"},
  1273. /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
  1274. /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
  1275. /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
  1276. {0xFF, "0 kbps"},
  1277. {0, NULL}
  1278. };
  1279. static const value_string qos_res_ber[] = {
  1280. {0x00, "Subscribed residual BER (in MS to network direction)"},
  1281. {0x01, "1/20 = 5x10^-2"},
  1282. {0x02, "1/100 = 1x10^-2"},
  1283. {0x03, "1/200 = 5x10^-3"},
  1284. {0x04, "1/250 = 4x10^-3"},
  1285. {0x05, "1/1 000 = 1x10^-3"},
  1286. {0x06, "1/10 000 = 1x10^-4"},
  1287. {0x07, "1/100 000 = 1x10^-5"},
  1288. {0x08, "1/1 000 000 = 1x10^-6"},
  1289. {0x09, "3/50 000 000 = 6x10^-8"},
  1290. {0x0F, "Reserved"}, /* All other values are reserved */
  1291. {0, NULL}
  1292. };
  1293. static const value_string qos_sdu_err_ratio[] = {
  1294. {0x00, "Subscribed SDU error ratio (in MS to network direction)"},
  1295. {0x01, "1/100 = 1x10^-2"},
  1296. {0x02, "7/1000 = 7x10^-3"},
  1297. {0x03, "1/1 000 = 1x10^-3"},
  1298. {0x04, "1/10 000 = 1x10^-4"},
  1299. {0x05, "1/100 000 = 1x10^-5"},
  1300. {0x06, "1/1 000 000 = 1x10^-6"},
  1301. {0x07, "1/10 = 1x10^-1"},
  1302. {0x0F, "Reserved"}, /* All other values are reserved */
  1303. {0, NULL}
  1304. };
  1305. static const value_string qos_traf_handl_prio[] = {
  1306. {0x00, "Subscribed traffic handling priority (in MS to network direction)"},
  1307. {0x01, "Priority level 1"},
  1308. {0x02, "Priority level 2"},
  1309. {0x03, "Priority level 3"},
  1310. {0, NULL}
  1311. };
  1312. static const value_string qos_trans_delay[] = {
  1313. {0x00, "Subscribed Transfer Delay (in MS to network direction)"},
  1314. {0x01, "10 ms"}, /* Using a granularity of 10 ms */
  1315. {0x02, "20 ms"},
  1316. {0x03, "30 ms"},
  1317. {0x04, "40 ms"},
  1318. {0x05, "50 ms"},
  1319. {0x06, "60 ms"},
  1320. {0x07, "70 ms"},
  1321. {0x08, "80 ms"},
  1322. {0x09, "90 ms"},
  1323. {0x0A, "100 ms"},
  1324. {0x0B, "110 ms"},
  1325. {0x0C, "120 ms"},
  1326. {0x0D, "130 ms"},
  1327. {0x0E, "140 ms"},
  1328. {0x0F, "150 ms"},
  1329. {0x10, "200 ms"}, /* (For values from 0x10 to 0x1F, value = 200 ms + (value - 0x10) * 50 ms */
  1330. {0x11, "250 ms"},
  1331. {0x12, "300 ms"},
  1332. {0x13, "350 ms"},
  1333. {0x14, "400 ms"},
  1334. {0x15, "450 ms"},
  1335. {0x16, "500 ms"},
  1336. {0x17, "550 ms"},
  1337. {0x18, "600 ms"},
  1338. {0x19, "650 ms"},
  1339. {0x1A, "700 ms"},
  1340. {0x1B, "750 ms"},
  1341. {0x1C, "800 ms"},
  1342. {0x1D, "850 ms"},
  1343. {0x1E, "900 ms"},
  1344. {0x1F, "950 ms"},
  1345. {0x20, "1000 ms"}, /* For values from 0x20 to 0x3E, value = 1000 ms + (value - 0x20) * 100 ms */
  1346. {0x21, "1100 ms"},
  1347. {0x22, "1200 ms"},
  1348. {0x23, "1300 ms"},
  1349. {0x24, "1400 ms"},
  1350. {0x25, "1500 ms"},
  1351. {0x26, "1600 ms"},
  1352. {0x27, "1700 ms"},
  1353. {0x28, "1800 ms"},
  1354. {0x29, "1900 ms"},
  1355. {0x2A, "2000 ms"},
  1356. {0x2B, "2100 ms"},
  1357. {0x2C, "2200 ms"},
  1358. {0x2D, "2300 ms"},
  1359. {0x2E, "2400 ms"},
  1360. {0x2F, "2500 ms"},
  1361. {0x30, "2600 ms"},
  1362. {0x31, "2700 ms"},
  1363. {0x32, "2800 ms"},
  1364. {0x33, "2900 ms"},
  1365. {0x34, "3000 ms"},
  1366. {0x35, "3100 ms"},
  1367. {0x36, "3200 ms"},
  1368. {0x37, "3300 ms"},
  1369. {0x38, "3400 ms"},
  1370. {0x39, "3500 ms"},
  1371. {0x3A, "3600 ms"},
  1372. {0x3B, "3700 ms"},
  1373. {0x3C, "3800 ms"},
  1374. {0x3D, "3900 ms"},
  1375. {0x3E, "4000 ms"},
  1376. {0x3F, "Reserved"},
  1377. {0, NULL}
  1378. };
  1379. static value_string_ext qos_trans_delay_ext = VALUE_STRING_EXT_INIT(qos_trans_delay);
  1380. static const value_string qos_guar_ul[] = {
  1381. {0x00, "Subscribed guaranteed bit rate for uplink (in MS to network direction)"},
  1382. /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
  1383. /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
  1384. /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
  1385. {0xFF, "0 kbps"},
  1386. {0, NULL}
  1387. };
  1388. static const value_string src_stat_desc_vals[] = {
  1389. {0x00, "unknown"},
  1390. {0x01, "speech"},
  1391. {0, NULL}
  1392. };
  1393. static const true_false_string gtp_sig_ind = {
  1394. "Optimised for signalling traffic",
  1395. "Not optimised for signalling traffic"
  1396. };
  1397. static const value_string qos_guar_dl[] = {
  1398. {0x00, "Subscribed guaranteed bit rate for downlink (in MS to network direction)"},
  1399. /* For values from 0x01 to 0x3F (from 1 to 63), use a granularity of 1 kbps */
  1400. /* For values from 0x40 to 0x7F, value = 64 kbps + (value - 0x40) * 8 kbps */
  1401. /* For values from 0x80 to 0xFE, value = 576 kbps + (value - 0x80) * 64 kbps */
  1402. {0xFF, "0 kbps"},
  1403. {0, NULL}
  1404. };
  1405. static const value_string sel_mode_type[] = {
  1406. {0, "MS or network provided APN, subscribed verified"},
  1407. {1, "MS provided APN, subscription not verified"},
  1408. {2, "Network provided APN, subscription not verified"},
  1409. {3, "For future use (Network provided APN, subscription not verified"}, /* Shall not be sent. If received, shall be sent as value 2 */
  1410. {0, NULL}
  1411. };
  1412. static const value_string tr_comm_type[] = {
  1413. {1, "Send data record packet"},
  1414. {2, "Send possibly duplicated data record packet"},
  1415. {3, "Cancel data record packet"},
  1416. {4, "Release data record packet"},
  1417. {0, NULL}
  1418. };
  1419. /* TODO: CHeck if all ms_reasons are included */
  1420. static const value_string ms_not_reachable_type[] = {
  1421. { 0, "No paging response via the MSC"},
  1422. { 1, "IMSI detached"},
  1423. { 2, "Roaming restriction"},
  1424. { 3, "Deregistered in the HLR for non GPRS"},
  1425. { 4, "MS purge for non GPRS"},
  1426. { 5, "No paging response via the SGSN"},
  1427. { 6, "GPRS detached"},
  1428. { 7, "Deregistered in the HLR for non GPRS"},
  1429. { 8, "MS purged for GPRS"},
  1430. { 9, "Unidentified subscriber via the MSC"},
  1431. {10, "Unidentified subscriber via the SGSN"},
  1432. {11, "Deregistered in the HSS/HLR for IMS"},
  1433. {12, "No response via the IP-SM-GW"},
  1434. {0, NULL}
  1435. };
  1436. /* UMTS: 25.413 v3.4.0, chapter 9.2.1.4, page 80
  1437. */
  1438. static const value_string ranap_cause_type[] = {
  1439. /* Radio Network Layer Cause (1-->64) */
  1440. { 1, "RAB preempted"},
  1441. { 2, "Trelocoverall Expiry"},
  1442. { 3, "Trelocprep Expiry"},
  1443. { 4, "Treloccomplete Expiry"},
  1444. { 5, "Tqueuing Expiry"},
  1445. { 6, "Relocation Triggered"},
  1446. { 7, "TRELOCalloc Expiry"},
  1447. { 8, "Unable to Establish During Relocation"},
  1448. { 9, "Unknown Target RNC"},
  1449. { 10, "Relocation Cancelled"},
  1450. { 11, "Successful Relocation"},
  1451. { 12, "Requested Ciphering and/or Integrity Protection Algorithms not Supported"},
  1452. { 13, "Change of Ciphering and/or Integrity Protection is not supported"},
  1453. { 14, "Failure in the Radio Interface Procedure"},
  1454. { 15, "Release due to UTRAN Generated Reason"},
  1455. { 16, "User Inactivity"},
  1456. { 17, "Time Critical Relocation"},
  1457. { 18, "Requested Traffic Class not Available"},
  1458. { 19, "Invalid RAB Parameters Value"},
  1459. { 20, "Requested Maximum Bit Rate not Available"},
  1460. { 21, "Requested Guaranteed Bit Rate not Available"},
  1461. { 22, "Requested Transfer Delay not Achievable"},
  1462. { 23, "Invalid RAB Parameters Combination"},
  1463. { 24, "Condition Violation for SDU Parameters"},
  1464. { 25, "Condition Violation for Traffic Handling Priority"},
  1465. { 26, "Condition Violation for Guaranteed Bit Rate"},
  1466. { 27, "User Plane Versions not Supported"},
  1467. { 28, "Iu UP Failure"},
  1468. { 29, "Relocation Failure in Target CN/RNC or Target System"},
  1469. { 30, "Invalid RAB ID"},
  1470. { 31, "No Remaining RAB"},
  1471. { 32, "Interaction with other procedure"},
  1472. { 33, "Requested Maximum Bit Rate for DL not Available"},
  1473. { 34, "Requested Maximum Bit Rate for UL not Available"},
  1474. { 35, "Requested Guaranteed Bit Rate for DL not Available"},
  1475. { 36, "Requested Guaranteed Bit Rate for UL not Available"},
  1476. { 37, "Repeated Integrity Checking Failure"},
  1477. { 38, "Requested Report Type not supported"},
  1478. { 39, "Request superseded"},
  1479. { 40, "Release due to UE generated signalling connection release"},
  1480. { 41, "Resource Optimisation Relocation"},
  1481. { 42, "Requested Information Not Available"},
  1482. { 43, "Relocation desirable for radio reasons"},
  1483. { 44, "Relocation not supported in Target RNC or Target System"},
  1484. { 45, "Directed Retry"},
  1485. { 46, "Radio Connection With UE Lost"},
  1486. { 47, "rNC-unable-to-establish-all-RFCs"},
  1487. { 48, "deciphering-keys-not-available"},
  1488. { 49, "dedicated-assistance-data-not-available"},
  1489. { 50, "relocation-target-not-allowed"},
  1490. { 51, "location-reporting-congestion"},
  1491. { 52, "reduce-load-in-serving-cell"},
  1492. { 53, "no-radio-resources-available-in-target-cell"},
  1493. { 54, "gERAN-Iumode-failure"},
  1494. { 55, "access-restricted-due-to-shared-networks"},
  1495. { 56, "incoming-relocation-not-supported-due-to-PUESBINE-feature"},
  1496. { 57, "traffic-load-in-the-target-cell-higher-than-in-the-source-cell"},
  1497. { 58, "mBMS-no-multicast-service-for-this-UE"},
  1498. { 59, "mBMS-unknown-UE-ID"},
  1499. { 60, "successful-MBMS-session-start-no-data-bearer-necessary"},
  1500. { 61, "mBMS-superseded-due-to-NNSF"},
  1501. { 62, "mBMS-UE-linking-already-done"},
  1502. { 63, "mBMS-UE-de-linking-failure-no-existing-UE-linking"},
  1503. { 64, "tMGI-unknown"},
  1504. /* Transport Layer Cause (65-->80) */
  1505. { 65, "Signalling Transport Resource Failure"},
  1506. { 66, "Iu Transport Connection Failed to Establish"},
  1507. /* NAS Cause (81-->96) */
  1508. { 81, "User Restriction Start Indication"},
  1509. { 82, "User Restriction End Indication"},
  1510. { 83, "Normal Release"},
  1511. /* Protocol Cause (97-->112) */
  1512. { 97, "Transfer Syntax Error"},
  1513. { 98, "Semantic Error"},
  1514. { 99, "Message not compatible with receiver state"},
  1515. { 100, "Abstract Syntax Error (Reject)"},
  1516. { 101, "Abstract Syntax Error (Ignore and Notify)"},
  1517. { 102, "Abstract Syntax Error (Falsely Constructed Message"},
  1518. /* Miscellaneous Cause (113-->128) */
  1519. { 113, "O & M Intervention"},
  1520. { 114, "No Resource Available"},
  1521. { 115, "Unspecified Failure"},
  1522. { 116, "Network Optimisation"},
  1523. /* Non-standard Cause (129-->255) */
  1524. /* ranap_CauseRadioNetworkExtension ??
  1525. { 257, "iP-multicast-address-and-APN-not-valid" },
  1526. { 258, "mBMS-de-registration-rejected-due-to-implicit-registration" },
  1527. { 259, "mBMS-request-superseded" },
  1528. { 260, "mBMS-de-registration-during-session-not-allowed" },
  1529. { 261, "mBMS-no-data-bearer-necessary" },
  1530. */
  1531. {0, NULL}
  1532. };
  1533. static value_string_ext ranap_cause_type_ext = VALUE_STRING_EXT_INIT(ranap_cause_type);
  1534. static const value_string mm_sec_modep[] = {
  1535. {0, "Used cipher value, UMTS keys and Quintuplets"},
  1536. {1, "GSM key and triplets"},
  1537. {2, "UMTS key and quintuplets"},
  1538. {3, "GSM key and quintuplets"},
  1539. {0, NULL}
  1540. };
  1541. static const value_string gtp_cipher_algorithm[] = {
  1542. {0, "No ciphering"},
  1543. {1, "GEA/1"},
  1544. {2, "GEA/2"},
  1545. {3, "GEA/3"},
  1546. {4, "GEA/4"},
  1547. {5, "GEA/5"},
  1548. {6, "GEA/6"},
  1549. {7, "GEA/7"},
  1550. {0, NULL}
  1551. };
  1552. static const value_string gtp_ext_rat_type_vals[] = {
  1553. {0, "Reserved"},
  1554. {1, "UTRAN"},
  1555. {2, "GERAN"},
  1556. {3, "WLAN"},
  1557. {4, "GAN"},
  1558. {5, "HSPA Evolution"},
  1559. {0, NULL}
  1560. };
  1561. #define MM_PROTO_GROUP_CALL_CONTROL 0x00
  1562. #define MM_PROTO_BROADCAST_CALL_CONTROL 0x01
  1563. #define MM_PROTO_PDSS1 0x02
  1564. #define MM_PROTO_CALL_CONTROL 0x03
  1565. #define MM_PROTO_PDSS2 0x04
  1566. #define MM_PROTO_MM_NON_GPRS 0x05
  1567. #define MM_PROTO_RR_MGMT 0x06
  1568. #define MM_PROTO_MM_GPRS 0x08
  1569. #define MM_PROTO_SMS 0x09
  1570. #define MM_PROTO_SESSION_MGMT 0x0A
  1571. #define MM_PROTO_NON_CALL_RELATED 0x0B
  1572. static const value_string tft_code_type[] = {
  1573. {0, "Spare"},
  1574. {1, "Create new TFT"},
  1575. {2, "Delete existing TFT"},
  1576. {3, "Add packet filters to existing TFT"},
  1577. {4, "Replace packet filters in existing TFT"},
  1578. {5, "Delete packet filters from existing TFT"},
  1579. {6, "Reserved"},
  1580. {7, "Reserved"},
  1581. {0, NULL}
  1582. };
  1583. static dissector_handle_t ip_handle;
  1584. static dissector_handle_t ipv6_handle;
  1585. static dissector_handle_t ppp_handle;
  1586. static dissector_handle_t sync_handle;
  1587. static dissector_handle_t data_handle;
  1588. static dissector_handle_t gtpcdr_handle;
  1589. static dissector_handle_t sndcpxid_handle;
  1590. static dissector_handle_t gtpv2_handle;
  1591. static dissector_handle_t bssgp_handle;
  1592. static dissector_table_t bssap_pdu_type_table;
  1593. static gtp_msg_hash_t *gtp_match_response(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gint seq_nr, guint msgtype);
  1594. static int decode_gtp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1595. static int decode_gtp_imsi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1596. static int decode_gtp_rai(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1597. static int decode_gtp_tlli(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1598. static int decode_gtp_ptmsi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1599. static int decode_gtp_qos_gprs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1600. static int decode_gtp_reorder(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1601. static int decode_gtp_auth_tri(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1602. static int decode_gtp_map_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1603. static int decode_gtp_ptmsi_sig(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1604. static int decode_gtp_ms_valid(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1605. static int decode_gtp_recovery(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1606. static int decode_gtp_sel_mode(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1607. static int decode_gtp_16(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1608. static int decode_gtp_17(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1609. static int decode_gtp_18(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1610. static int decode_gtp_19(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1611. static int decode_gtp_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1612. static int decode_gtp_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1613. static int decode_gtp_rab_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1614. static int decode_gtp_rp_sms(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1615. static int decode_gtp_rp(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1616. static int decode_gtp_pkt_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1617. static int decode_gtp_chrg_char(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1618. static int decode_gtp_trace_ref(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1619. static int decode_gtp_trace_type(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1620. static int decode_gtp_ms_reason(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1621. static int decode_gtp_tr_comm(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1622. static int decode_gtp_chrg_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1623. static int decode_gtp_user_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1624. static int decode_gtp_mm_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1625. static int decode_gtp_pdp_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1626. static int decode_gtp_apn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1627. static int decode_gtp_gsn_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1628. static int decode_gtp_proto_conf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1629. static int decode_gtp_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1630. static int decode_gtp_qos_umts(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1631. static int decode_gtp_auth_qui(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1632. static int decode_gtp_tft(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1633. static int decode_gtp_target_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1634. static int decode_gtp_utran_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1635. static int decode_gtp_rab_setup(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1636. static int decode_gtp_hdr_list(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1637. static int decode_gtp_trigger_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1638. static int decode_gtp_omc_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1639. static int decode_gtp_ran_tr_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1640. static int decode_gtp_pdp_cont_prio(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1641. static int decode_gtp_add_rab_setup_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1642. static int decode_gtp_ssgn_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1643. static int decode_gtp_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1644. static int decode_gtp_apn_res(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1645. static int decode_gtp_ra_prio_lcs(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1646. static int decode_gtp_rat_type(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1647. static int decode_gtp_usr_loc_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1648. static int decode_gtp_ms_time_zone(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1649. static int decode_gtp_imeisv(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1650. static int decode_gtp_camel_chg_inf_con(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1651. static int decode_gtp_mbms_ue_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1652. static int decode_gtp_tmgi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1653. static int decode_gtp_rim_ra(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1654. static int decode_gtp_mbms_prot_conf_opt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1655. static int decode_gtp_mbms_sa(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1656. static int decode_gtp_src_rnc_pdp_ctx_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1657. static int decode_gtp_add_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1658. static int decode_gtp_hop_count(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1659. static int decode_gtp_sel_plmn_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1660. static int decode_gtp_mbms_ses_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1661. static int decode_gtp_mbms_2g_3g_ind(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1662. static int decode_gtp_enh_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1663. static int decode_gtp_mbms_ses_dur(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1664. static int decode_gtp_add_mbms_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1665. static int decode_gtp_mbms_ses_id_rep_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1666. static int decode_gtp_mbms_time_to_data_tr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1667. static int decode_gtp_ps_ho_req_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1668. static int decode_gtp_bss_cont(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1669. static int decode_gtp_cell_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1670. static int decode_gtp_pdu_no(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1671. static int decode_gtp_bssgp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1672. static int decode_gtp_mbms_bearer_cap(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1673. static int decode_gtp_rim_ra_disc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1674. static int decode_gtp_lst_set_up_pfc(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1675. static int decode_gtp_ps_handover_xid(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1676. static int decode_gtp_direct_tnl_flg(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1677. static int decode_gtp_ms_inf_chg_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1678. static int decode_gtp_corrl_id(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1679. static int decode_gtp_fqdn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1680. static int decode_gtp_evolved_allc_rtn_p1(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1681. static int decode_gtp_evolved_allc_rtn_p2(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1682. static int decode_gtp_extended_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1683. static int decode_gtp_uci(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1684. static int decode_gtp_csg_inf_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1685. static int decode_gtp_csg_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1686. static int decode_gtp_cmi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1687. static int decode_gtp_apn_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1688. static int decode_gtp_ue_network_cap(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1689. static int decode_gtp_ue_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1690. static int decode_gtp_apn_ambr_with_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1691. static int decode_gtp_ggsn_back_off_time(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1692. static int decode_gtp_sig_pri_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1693. static int decode_gtp_sig_pri_ind_w_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1694. static int decode_gtp_higher_br_16mb_flg(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1695. static int decode_gtp_max_mbr_apn_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1696. static int decode_gtp_add_mm_ctx_srvcc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1697. static int decode_gtp_add_flgs_srvcc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1698. static int decode_gtp_stn_sr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1699. static int decode_gtp_c_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1700. static int decode_gtp_ext_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1701. static int decode_gtp_bearer_cntrl_mod(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1702. static int decode_gtp_mbms_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1703. static int decode_gtp_mbms_ip_mcast_dist(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1704. static int decode_gtp_mbms_dist_ack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1705. static int decode_gtp_reliable_irat_ho_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1706. static int decode_gtp_rfsp_index(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree);
  1707. static int decode_gtp_chrg_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1708. static int decode_gtp_rel_pack(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1709. static int decode_gtp_can_pack(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1710. static int decode_gtp_data_req(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1711. static int decode_gtp_data_resp(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1712. static int decode_gtp_node_addr(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1713. static int decode_gtp_priv_ext(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1714. static int decode_gtp_unknown(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree);
  1715. typedef struct _gtp_opt {
  1716. int optcode;
  1717. int (*decode) (tvbuff_t *, int, packet_info *, proto_tree *);
  1718. } gtp_opt_t;
  1719. static const gtp_opt_t gtpopt[] = {
  1720. /* 0x01 */ {GTP_EXT_CAUSE, decode_gtp_cause},
  1721. /* 0x02 */ {GTP_EXT_IMSI, decode_gtp_imsi},
  1722. /* 0x03 */ {GTP_EXT_RAI, decode_gtp_rai},
  1723. /* 0x04 */ {GTP_EXT_TLLI, decode_gtp_tlli},
  1724. /* 0x05 */ {GTP_EXT_PTMSI, decode_gtp_ptmsi},
  1725. /* 0x06 */ {GTP_EXT_QOS_GPRS, decode_gtp_qos_gprs},
  1726. /* 0x07 */
  1727. /* 0x08 */ {GTP_EXT_REORDER, decode_gtp_reorder},
  1728. /* 0x09 */ {GTP_EXT_AUTH_TRI, decode_gtp_auth_tri},
  1729. /* 0x0a */
  1730. /* 0x0b */ {GTP_EXT_MAP_CAUSE, decode_gtp_map_cause},
  1731. /* 0x0c */ {GTP_EXT_PTMSI_SIG, decode_gtp_ptmsi_sig},
  1732. /* 0x0d */ {GTP_EXT_MS_VALID, decode_gtp_ms_valid},
  1733. /* 0x0e */ {GTP_EXT_RECOVER, decode_gtp_recovery},
  1734. /* 0x0f */ {GTP_EXT_SEL_MODE, decode_gtp_sel_mode},
  1735. /* 0x10 */ {GTP_EXT_16, decode_gtp_16},
  1736. /* 0x11 */ {GTP_EXT_17, decode_gtp_17},
  1737. /* 0x12 */ {GTP_EXT_18, decode_gtp_18},
  1738. /* 0x13 */ {GTP_EXT_19, decode_gtp_19},
  1739. /* 0x14 */ {GTP_EXT_NSAPI, decode_gtp_nsapi},
  1740. /* 0x15 */ {GTP_EXT_RANAP_CAUSE, decode_gtp_ranap_cause},
  1741. /* 0x16 */ {GTP_EXT_RAB_CNTXT, decode_gtp_rab_cntxt},
  1742. /* 0x17 */ {GTP_EXT_RP_SMS, decode_gtp_rp_sms},
  1743. /* 0x18 */ {GTP_EXT_RP, decode_gtp_rp},
  1744. /* 0x19 */ {GTP_EXT_PKT_FLOW_ID, decode_gtp_pkt_flow_id},
  1745. /* 0x1a */ {GTP_EXT_CHRG_CHAR, decode_gtp_chrg_char},
  1746. /* 0x1b */ {GTP_EXT_TRACE_REF, decode_gtp_trace_ref},
  1747. /* 0x1c */ {GTP_EXT_TRACE_TYPE, decode_gtp_trace_type},
  1748. /* 0x1d */ {GTPv1_EXT_MS_REASON, decode_gtp_ms_reason},
  1749. /* 0x7e */ {GTP_EXT_TR_COMM, decode_gtp_tr_comm},
  1750. /* 0x7f */ {GTP_EXT_CHRG_ID, decode_gtp_chrg_id},
  1751. /* 0x80 */ {GTP_EXT_USER_ADDR, decode_gtp_user_addr},
  1752. /* 0x81 */ {GTP_EXT_MM_CNTXT, decode_gtp_mm_cntxt},
  1753. /* 0x82 */ {GTP_EXT_PDP_CNTXT, decode_gtp_pdp_cntxt},
  1754. /* 0x83 */ {GTP_EXT_APN, decode_gtp_apn},
  1755. /* 0x84 */ {GTP_EXT_PROTO_CONF, decode_gtp_proto_conf},
  1756. /* 0x85 */ {GTP_EXT_GSN_ADDR, decode_gtp_gsn_addr},
  1757. /* 0x86 */ {GTP_EXT_MSISDN, decode_gtp_msisdn},
  1758. /* 0x87 */ {GTP_EXT_QOS_UMTS, decode_gtp_qos_umts}, /* 3G */
  1759. /* 0x88 */ {GTP_EXT_AUTH_QUI, decode_gtp_auth_qui}, /* 3G */
  1760. /* 0x89 */ {GTP_EXT_TFT, decode_gtp_tft}, /* 3G */
  1761. /* 0x8a */ {GTP_EXT_TARGET_ID, decode_gtp_target_id}, /* 3G */
  1762. /* 0x8b */ {GTP_EXT_UTRAN_CONT, decode_gtp_utran_cont}, /* 3G */
  1763. /* 0x8c */ {GTP_EXT_RAB_SETUP, decode_gtp_rab_setup}, /* 3G */
  1764. /* 0x8d */ {GTP_EXT_HDR_LIST, decode_gtp_hdr_list}, /* 3G */
  1765. /* 0x8e */ {GTP_EXT_TRIGGER_ID, decode_gtp_trigger_id}, /* 3G */
  1766. /* 0x8f */ {GTP_EXT_OMC_ID, decode_gtp_omc_id}, /* 3G */
  1767. /* TS 29 060 V6.11.0 */
  1768. /* 0x90 */ {GTP_EXT_RAN_TR_CONT, decode_gtp_ran_tr_cont}, /* 7.7.43 */
  1769. /* 0x91 */ {GTP_EXT_PDP_CONT_PRIO, decode_gtp_pdp_cont_prio}, /* 7.7.45 */
  1770. /* 0x92 */ {GTP_EXT_ADD_RAB_SETUP_INF, decode_gtp_add_rab_setup_inf}, /* 7.7.45A */
  1771. /* 0x93 */ {GTP_EXT_SSGN_NO, decode_gtp_ssgn_no}, /* 7.7.47 */
  1772. /* 0x94 */ {GTP_EXT_COMMON_FLGS, decode_gtp_common_flgs}, /* 7.7.48 */
  1773. /* 0x95 */ {GTP_EXT_APN_RES, decode_gtp_apn_res}, /* 3G */
  1774. /* 0x96 */ {GTP_EXT_RA_PRIO_LCS, decode_gtp_ra_prio_lcs}, /* 7.7.25B */
  1775. /* 0x97 */ {GTP_EXT_RAT_TYPE, decode_gtp_rat_type}, /* 3G */
  1776. /* 0x98 */ {GTP_EXT_USR_LOC_INF, decode_gtp_usr_loc_inf}, /* 7.7.51 */
  1777. /* 0x99 */ {GTP_EXT_MS_TIME_ZONE, decode_gtp_ms_time_zone}, /* 7.7.52 */
  1778. /* 0x9a */ {GTP_EXT_IMEISV, decode_gtp_imeisv}, /* 3G 7.7.53 */
  1779. /* 0x9b */ {GTP_EXT_CAMEL_CHG_INF_CON, decode_gtp_camel_chg_inf_con}, /* 7.7.54 */
  1780. /* 0x9c */ {GTP_EXT_MBMS_UE_CTX, decode_gtp_mbms_ue_ctx}, /* 7.7.55 */
  1781. /* 0x9d */ {GTP_EXT_TMGI, decode_gtp_tmgi}, /* 7.7.56 */
  1782. /* 0x9e */ {GTP_EXT_RIM_RA, decode_gtp_rim_ra}, /* 7.7.57 */
  1783. /* 0x9f */ {GTP_EXT_MBMS_PROT_CONF_OPT, decode_gtp_mbms_prot_conf_opt}, /* 7.7.58 */
  1784. /* 0xa0 */ {GTP_EXT_MBMS_SA, decode_gtp_mbms_sa}, /* 7.7.60 */
  1785. /* 0xa1 */ {GTP_EXT_SRC_RNC_PDP_CTX_INF, decode_gtp_src_rnc_pdp_ctx_inf}, /* 7.7.61 */
  1786. /* 0xa2 */ {GTP_EXT_ADD_TRS_INF, decode_gtp_add_trs_inf}, /* 7.7.62 */
  1787. /* 0xa3 */ {GTP_EXT_HOP_COUNT, decode_gtp_hop_count}, /* 7.7.63 */
  1788. /* 0xa4 */ {GTP_EXT_SEL_PLMN_ID, decode_gtp_sel_plmn_id}, /* 7.7.64 */
  1789. /* 0xa5 */ {GTP_EXT_MBMS_SES_ID, decode_gtp_mbms_ses_id}, /* 7.7.65 */
  1790. /* 0xa6 */ {GTP_EXT_MBMS_2G_3G_IND, decode_gtp_mbms_2g_3g_ind}, /* 7.7.66 */
  1791. /* 0xa7 */ {GTP_EXT_ENH_NSAPI, decode_gtp_enh_nsapi}, /* 7.7.67 */
  1792. /* 0xa8 */ {GTP_EXT_MBMS_SES_DUR, decode_gtp_mbms_ses_dur}, /* 7.7.59 */
  1793. /* 0xa9 */ {GTP_EXT_ADD_MBMS_TRS_INF, decode_gtp_add_mbms_trs_inf}, /* 7.7.68 */
  1794. /* 0xaa */ {GTP_EXT_MBMS_SES_ID_REP_NO, decode_gtp_mbms_ses_id_rep_no}, /* 7.7.69 */
  1795. /* 0xab */ {GTP_EXT_MBMS_TIME_TO_DATA_TR, decode_gtp_mbms_time_to_data_tr}, /* 7.7.70 */
  1796. /* 0xac */ {GTP_EXT_PS_HO_REQ_CTX, decode_gtp_ps_ho_req_ctx}, /* 7.7.71 */
  1797. /* 0xad */ {GTP_EXT_BSS_CONT, decode_gtp_bss_cont}, /* 7.7.72 */
  1798. /* 0xae */ {GTP_EXT_CELL_ID, decode_gtp_cell_id}, /* 7.7.73 */
  1799. /* 0xaf */ {GTP_EXT_PDU_NO, decode_gtp_pdu_no}, /* 7.7.74 */
  1800. /* 0xb0 */ {GTP_EXT_BSSGP_CAUSE, decode_gtp_bssgp_cause}, /* 7.7.75 */
  1801. /* 0xb1 */ {GTP_EXT_REQ_MBMS_BEARER_CAP, decode_gtp_mbms_bearer_cap}, /* 7.7.76 */
  1802. /* 0xb2 */ {GTP_EXT_RIM_ROUTING_ADDR_DISC, decode_gtp_rim_ra_disc}, /* 7.7.77 */
  1803. /* 0xb3 */ {GTP_EXT_LIST_OF_SETUP_PFCS, decode_gtp_lst_set_up_pfc}, /* 7.7.78 */
  1804. /* 0xb4 */ {GTP_EXT_PS_HANDOVER_XIP_PAR, decode_gtp_ps_handover_xid}, /* 7.7.79 */
  1805. /* 0xb5 */ {GTP_EXT_MS_INF_CHG_REP_ACT, decode_gtp_ms_inf_chg_rep_act}, /* 7.7.80 */
  1806. /* 0xb6 */ {GTP_EXT_DIRECT_TUNNEL_FLGS, decode_gtp_direct_tnl_flg}, /* 7.7.81 */
  1807. /* 0xb7 */ {GTP_EXT_CORRELATION_ID, decode_gtp_corrl_id}, /* 7.7.82 */
  1808. /* 0xb8 */ {GTP_EXT_BEARER_CONTROL_MODE, decode_gtp_bearer_cntrl_mod}, /* 7.7.83 */
  1809. /* 0xb9 */ {GTP_EXT_MBMS_FLOW_ID, decode_gtp_mbms_flow_id}, /* 7.7.84 */
  1810. /* 0xba */ {GTP_EXT_MBMS_IP_MCAST_DIST, decode_gtp_mbms_ip_mcast_dist}, /* 7.7.85 */
  1811. /* 0xba */ {GTP_EXT_MBMS_DIST_ACK, decode_gtp_mbms_dist_ack}, /* 7.7.86 */
  1812. /* 0xbc */ {GTP_EXT_RELIABLE_IRAT_HO_INF, decode_gtp_reliable_irat_ho_inf}, /* 7.7.87 */
  1813. /* 0xbd */ {GTP_EXT_RFSP_INDEX, decode_gtp_rfsp_index}, /* 7.7.87 */
  1814. /* 0xbe */ {GTP_EXT_FQDN, decode_gtp_fqdn}, /* 7.7.90 */
  1815. /* 0xbf */ {GTP_EXT_EVO_ALLO_RETE_P1, decode_gtp_evolved_allc_rtn_p1}, /* 7.7.91 */
  1816. /* 0xc0 */ {GTP_EXT_EVO_ALLO_RETE_P2, decode_gtp_evolved_allc_rtn_p2}, /* 7.7.92 */
  1817. /* 0xc1 */ {GTP_EXT_EXTENDED_COMMON_FLGS, decode_gtp_extended_common_flgs}, /* 7.7.93 */
  1818. /* 0xc2 */ {GTP_EXT_UCI, decode_gtp_uci}, /* 7.7.94 */
  1819. /* 0xc3 */ {GTP_EXT_CSG_INF_REP_ACT, decode_gtp_csg_inf_rep_act}, /* 7.7.95 */
  1820. /* 0xc4 */ {GTP_EXT_CSG_ID, decode_gtp_csg_id}, /* 7.7.96 */
  1821. /* 0xc5 */ {GTP_EXT_CMI, decode_gtp_cmi}, /* 7.7.97 */
  1822. /* 0xc6 */ {GTP_EXT_AMBR, decode_gtp_apn_ambr}, /* 7.7.98 */
  1823. /* 0xc7 */ {GTP_EXT_UE_NETWORK_CAP, decode_gtp_ue_network_cap}, /* 7.7.99 */
  1824. /* 0xc8 */ {GTP_EXT_UE_AMBR, decode_gtp_ue_ambr}, /* 7.7.100 */
  1825. /* 0xc9 */ {GTP_EXT_APN_AMBR_WITH_NSAPI, decode_gtp_apn_ambr_with_nsapi}, /* 7.7.101 */
  1826. /* 0xCA */ {GTP_EXT_GGSN_BACK_OFF_TIME, decode_gtp_ggsn_back_off_time}, /* 7.7.102 */
  1827. /* 0xCB */ {GTP_EXT_SIG_PRI_IND, decode_gtp_sig_pri_ind}, /* 7.7.103 */
  1828. /* 0xCC */ {GTP_EXT_SIG_PRI_IND_W_NSAPI, decode_gtp_sig_pri_ind_w_nsapi}, /* 7.7.104 */
  1829. /* 0xCD */ {GTP_EXT_HIGHER_BR_16MB_FLG, decode_gtp_higher_br_16mb_flg}, /* 7.7.105 */
  1830. /* 0xCE */ {GTP_EXT_MAX_MBR_APN_AMBR, decode_gtp_max_mbr_apn_ambr}, /* 7.7.106 */
  1831. /* 0xCF */ {GTP_EXT_ADD_MM_CTX_SRVCC, decode_gtp_add_mm_ctx_srvcc}, /* 7.7.107 */
  1832. /* 0xD0 */ {GTP_EXT_ADD_FLGS_SRVCC, decode_gtp_add_flgs_srvcc}, /* 7.7.108 */
  1833. /* 0xD1 */ {GTP_EXT_STN_SR, decode_gtp_stn_sr}, /* 7.7.109 */
  1834. /* 0xD2 */ {GTP_EXT_C_MSISDN, decode_gtp_c_msisdn}, /* 7.7.110 */
  1835. /* 0xD3 */ {GTP_EXT_EXT_RANAP_CAUSE, decode_gtp_ext_ranap_cause}, /* 7.7.111 */
  1836. /* 0xf9 */ {GTP_EXT_REL_PACK, decode_gtp_rel_pack}, /* charging */
  1837. /* 0xfa */ {GTP_EXT_CAN_PACK, decode_gtp_can_pack}, /* charging */
  1838. /* 0xfb */ {GTP_EXT_CHRG_ADDR, decode_gtp_chrg_addr},
  1839. /* 0xfc */ {GTP_EXT_DATA_REQ, decode_gtp_data_req}, /* charging */
  1840. /* 0xfd */ {GTP_EXT_DATA_RESP, decode_gtp_data_resp}, /* charging */
  1841. /* 0xfe */ {GTP_EXT_NODE_ADDR, decode_gtp_node_addr},
  1842. /* 0xff */ {GTP_EXT_PRIV_EXT, decode_gtp_priv_ext},
  1843. {0, decode_gtp_unknown}
  1844. };
  1845. #define NUM_GTP_IES 255
  1846. static gint ett_gtp_ies[NUM_GTP_IES];
  1847. /*struct _gtp_hdr {
  1848. guint8 flags;
  1849. guint8 message;
  1850. guint16 length;
  1851. };*/
  1852. static guint8 gtp_version = 0;
  1853. static const char *yesno[] = { "no", "yes" };
  1854. #define BCD2CHAR(d) ((d) | 0x30)
  1855. static gchar *
  1856. id_to_str(tvbuff_t *tvb, gint offset)
  1857. {
  1858. static gchar str[17] = " ";
  1859. guint8 bits8to5, bits4to1;
  1860. int i, j;
  1861. guint8 ad;
  1862. for (i = j = 0; i < 8; i++) {
  1863. ad = tvb_get_guint8(tvb, offset + i);
  1864. bits8to5 = hi_nibble(ad);
  1865. bits4to1 = lo_nibble(ad);
  1866. if (bits4to1 <= 9)
  1867. str[j++] = BCD2CHAR(bits4to1);
  1868. else
  1869. str[j++] = ' ';
  1870. if (bits8to5 <= 9)
  1871. str[j++] = BCD2CHAR(bits8to5);
  1872. else
  1873. str[j++] = ' ';
  1874. }
  1875. str[j] = '\0';
  1876. return str;
  1877. }
  1878. /* Next definitions and function check_field_presence checks if given field
  1879. * in GTP packet is compliant with ETSI
  1880. */
  1881. typedef struct _header {
  1882. guint8 code;
  1883. guint8 presence;
  1884. } ext_header;
  1885. typedef struct _message {
  1886. guint8 code;
  1887. ext_header fields[32];
  1888. } _gtp_mess_items;
  1889. /* ---------------------
  1890. * GPRS messages
  1891. * ---------------------*/
  1892. static _gtp_mess_items gprs_mess_items[] = {
  1893. {
  1894. GTP_MSG_ECHO_REQ, {
  1895. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  1896. {0, 0}
  1897. }
  1898. },
  1899. {
  1900. GTP_MSG_ECHO_RESP, {
  1901. {GTP_EXT_RECOVER, GTP_MANDATORY},
  1902. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  1903. {0, 0}
  1904. }
  1905. },
  1906. {
  1907. GTP_MSG_VER_NOT_SUPP, {
  1908. {0, 0}
  1909. }
  1910. },
  1911. {
  1912. GTP_MSG_NODE_ALIVE_REQ, {
  1913. {GTP_EXT_NODE_ADDR, GTP_MANDATORY},
  1914. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  1915. {0, 0}
  1916. }
  1917. },
  1918. {
  1919. GTP_MSG_NODE_ALIVE_RESP, {
  1920. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  1921. {0, 0}
  1922. }
  1923. },
  1924. {
  1925. GTP_MSG_REDIR_REQ, {
  1926. {GTP_EXT_CAUSE, GTP_MANDATORY},
  1927. {GTP_EXT_NODE_ADDR, GTP_OPTIONAL},
  1928. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  1929. {0, 0}
  1930. }
  1931. },
  1932. {
  1933. GTP_MSG_REDIR_RESP, {
  1934. {GTP_EXT_CAUSE, GTP_MANDATORY},
  1935. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  1936. {0, 0}
  1937. }
  1938. },
  1939. {
  1940. GTP_MSG_CREATE_PDP_REQ, {
  1941. {GTP_EXT_QOS_GPRS, GTP_MANDATORY},
  1942. {GTP_EXT_RECOVER, GTP_OPTIONAL},
  1943. {GTP_EXT_SEL_MODE, GTP_MANDATORY},
  1944. {GTP_EXT_FLOW_LABEL, GTP_MANDATORY},
  1945. {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
  1946. {GTP_EXT_MSISDN, GTP_MANDATORY},
  1947. {GTP_EXT_USER_ADDR, GTP_MANDATORY},
  1948. {GTP_EXT_APN, GTP_MANDATORY},
  1949. {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
  1950. {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
  1951. {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
  1952. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  1953. {0, 0}
  1954. }
  1955. },
  1956. {
  1957. GTP_MSG_CREATE_PDP_RESP, {
  1958. {GTP_EXT_CAUSE, GTP_MANDATORY},
  1959. {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL},
  1960. {GTP_EXT_REORDER, GTP_CONDITIONAL},
  1961. {GTP_EXT_RECOVER, GTP_OPTIONAL},
  1962. {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL},
  1963. {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
  1964. {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
  1965. {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
  1966. {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
  1967. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
  1968. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
  1969. {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
  1970. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  1971. {0, 0}
  1972. }
  1973. },
  1974. {
  1975. GTP_MSG_UPDATE_PDP_REQ, {
  1976. {GTP_EXT_QOS_GPRS, GTP_MANDATORY},
  1977. {GTP_EXT_RECOVER, GTP_OPTIONAL},
  1978. {GTP_EXT_FLOW_LABEL, GTP_MANDATORY},
  1979. {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
  1980. {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
  1981. {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
  1982. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  1983. {0, 0},
  1984. }
  1985. },
  1986. {
  1987. GTP_MSG_UPDATE_PDP_RESP, {
  1988. {GTP_EXT_CAUSE, GTP_MANDATORY},
  1989. {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL},
  1990. {GTP_EXT_RECOVER, GTP_OPTIONAL},
  1991. {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL},
  1992. {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
  1993. {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
  1994. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
  1995. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
  1996. {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
  1997. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  1998. {0, 0}
  1999. }
  2000. },
  2001. {
  2002. GTP_MSG_DELETE_PDP_REQ, {
  2003. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2004. {0, 0}
  2005. }
  2006. },
  2007. {
  2008. GTP_MSG_DELETE_PDP_RESP, {
  2009. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2010. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2011. {0, 0},
  2012. }
  2013. },
  2014. {
  2015. GTP_MSG_INIT_PDP_CONTEXT_ACT_REQ, {
  2016. {GTP_EXT_QOS_GPRS, GTP_MANDATORY},
  2017. {GTP_EXT_RECOVER, GTP_OPTIONAL},
  2018. {GTP_EXT_SEL_MODE, GTP_MANDATORY},
  2019. {GTP_EXT_FLOW_LABEL, GTP_MANDATORY},
  2020. {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
  2021. {GTP_EXT_USER_ADDR, GTP_MANDATORY},
  2022. {GTP_EXT_APN, GTP_MANDATORY},
  2023. {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
  2024. {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
  2025. {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
  2026. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2027. {0, 0}
  2028. }
  2029. },
  2030. {
  2031. GTP_MSG_INIT_PDP_CONTEXT_ACT_RESP, {
  2032. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2033. {GTP_EXT_QOS_GPRS, GTP_CONDITIONAL},
  2034. {GTP_EXT_REORDER, GTP_CONDITIONAL},
  2035. {GTP_EXT_RECOVER, GTP_OPTIONAL},
  2036. {GTP_EXT_FLOW_LABEL, GTP_CONDITIONAL},
  2037. {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
  2038. {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
  2039. {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
  2040. {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
  2041. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
  2042. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
  2043. {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
  2044. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2045. {0, 0}
  2046. }
  2047. },
  2048. {
  2049. GTP_MSG_DELETE_AA_PDP_REQ, {
  2050. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2051. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2052. {0, 0}
  2053. }
  2054. },
  2055. {
  2056. GTP_MSG_DELETE_AA_PDP_RESP, {
  2057. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2058. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2059. {0, 0}
  2060. }
  2061. },
  2062. {
  2063. GTP_MSG_ERR_IND, {
  2064. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2065. {0, 0}
  2066. }
  2067. },
  2068. {
  2069. GTP_MSG_PDU_NOTIFY_REQ, {
  2070. {GTP_EXT_USER_ADDR, GTP_MANDATORY},
  2071. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2072. {0, 0}
  2073. }
  2074. },
  2075. {
  2076. GTP_MSG_PDU_NOTIFY_RESP, {
  2077. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2078. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2079. {0, 0}
  2080. }
  2081. },
  2082. {
  2083. GTP_MSG_PDU_NOTIFY_REJ_REQ, {
  2084. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2085. {GTP_EXT_USER_ADDR, GTP_MANDATORY},
  2086. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2087. {0, 0}
  2088. }
  2089. },
  2090. {
  2091. GTP_MSG_PDU_NOTIFY_REJ_RESP, {
  2092. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2093. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2094. {0, 0}
  2095. }
  2096. },
  2097. {
  2098. GTP_MSG_SEND_ROUT_INFO_REQ, {
  2099. {GTP_EXT_IMSI, GTP_MANDATORY},
  2100. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2101. {0, 0}
  2102. }
  2103. },
  2104. {
  2105. GTP_MSG_SEND_ROUT_INFO_RESP, {
  2106. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2107. {GTP_EXT_IMSI, GTP_MANDATORY},
  2108. {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
  2109. {GTP_EXT_MS_REASON, GTP_OPTIONAL},
  2110. {GTP_EXT_GSN_ADDR, GTP_OPTIONAL},
  2111. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2112. {0, 0}
  2113. }
  2114. },
  2115. {
  2116. GTP_MSG_FAIL_REP_REQ, {
  2117. {GTP_EXT_IMSI, GTP_MANDATORY},
  2118. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2119. {0, 0}
  2120. }
  2121. },
  2122. {
  2123. GTP_MSG_FAIL_REP_RESP, {
  2124. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2125. {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
  2126. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2127. {0, 0}
  2128. }
  2129. },
  2130. {
  2131. GTP_MSG_MS_PRESENT_REQ, {
  2132. {GTP_EXT_IMSI, GTP_MANDATORY},
  2133. {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
  2134. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2135. {0, 0}
  2136. }
  2137. },
  2138. {
  2139. GTP_MSG_MS_PRESENT_RESP, {
  2140. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2141. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2142. {0, 0}
  2143. }
  2144. },
  2145. {
  2146. GTP_MSG_IDENT_REQ, {
  2147. {GTP_EXT_RAI, GTP_MANDATORY},
  2148. {GTP_EXT_PTMSI, GTP_MANDATORY},
  2149. {GTP_EXT_PTMSI_SIG, GTP_OPTIONAL},
  2150. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2151. {0, 0}
  2152. }
  2153. },
  2154. {
  2155. GTP_MSG_IDENT_RESP, {
  2156. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2157. {GTP_EXT_IMSI, GTP_CONDITIONAL},
  2158. {GTP_EXT_AUTH_TRI, GTP_OPTIONAL},
  2159. {GTP_EXT_AUTH_QUI, GTP_OPTIONAL},
  2160. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2161. {0, 0}
  2162. }
  2163. },
  2164. {
  2165. GTP_MSG_SGSN_CNTXT_REQ, {
  2166. {GTP_EXT_IMSI, GTP_CONDITIONAL},
  2167. {GTP_EXT_RAI, GTP_MANDATORY},
  2168. {GTP_EXT_TLLI, GTP_MANDATORY},
  2169. {GTP_EXT_PTMSI_SIG, GTP_OPTIONAL},
  2170. {GTP_EXT_MS_VALID, GTP_OPTIONAL},
  2171. {GTP_EXT_FLOW_SIG, GTP_MANDATORY},
  2172. {0, 0}
  2173. }
  2174. },
  2175. {
  2176. GTP_MSG_SGSN_CNTXT_RESP, {
  2177. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2178. {GTP_EXT_IMSI, GTP_CONDITIONAL},
  2179. {GTP_EXT_FLOW_SIG, GTP_CONDITIONAL},
  2180. {GTP_EXT_MM_CNTXT, GTP_CONDITIONAL},
  2181. {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL},
  2182. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2183. {0, 0}
  2184. }
  2185. },
  2186. {
  2187. GTP_MSG_SGSN_CNTXT_ACK, {
  2188. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2189. {GTP_EXT_FLOW_II, GTP_CONDITIONAL},
  2190. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
  2191. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2192. {0, 0}
  2193. }
  2194. },
  2195. {
  2196. GTP_MSG_DATA_TRANSF_REQ, {
  2197. {GTP_EXT_TR_COMM, GTP_MANDATORY},
  2198. {GTP_EXT_DATA_REQ, GTP_CONDITIONAL},
  2199. {GTP_EXT_REL_PACK, GTP_CONDITIONAL},
  2200. {GTP_EXT_CAN_PACK, GTP_CONDITIONAL},
  2201. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2202. {0, 0}
  2203. }
  2204. },
  2205. {
  2206. GTP_MSG_DATA_TRANSF_RESP, {
  2207. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2208. {GTP_EXT_DATA_RESP, GTP_MANDATORY},
  2209. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2210. {0, 0}
  2211. }
  2212. },
  2213. {
  2214. 0, {
  2215. {0, 0}
  2216. }
  2217. }
  2218. };
  2219. /* -----------------------------
  2220. * UMTS messages
  2221. * -----------------------------*/
  2222. static _gtp_mess_items umts_mess_items[] = {
  2223. /* 7.2 Path Management Messages */
  2224. {
  2225. GTP_MSG_ECHO_REQ, {
  2226. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2227. {0, 0}
  2228. }
  2229. },
  2230. {
  2231. GTP_MSG_ECHO_RESP, {
  2232. {GTP_EXT_RECOVER, GTP_MANDATORY},
  2233. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2234. {0, 0}
  2235. }
  2236. },
  2237. {
  2238. GTP_MSG_VER_NOT_SUPP, {
  2239. {0, 0}
  2240. }
  2241. },
  2242. {
  2243. GTP_MSG_SUPP_EXT_HDR, {
  2244. {GTP_EXT_HDR_LIST, GTP_MANDATORY},
  2245. {0, 0}
  2246. }
  2247. },
  2248. /* ??? */
  2249. {
  2250. GTP_MSG_NODE_ALIVE_REQ, {
  2251. {GTP_EXT_NODE_ADDR, GTP_MANDATORY},
  2252. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2253. {0, 0}
  2254. }
  2255. },
  2256. {
  2257. GTP_MSG_NODE_ALIVE_RESP, {
  2258. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2259. {0, 0}
  2260. }
  2261. },
  2262. {
  2263. GTP_MSG_REDIR_REQ, {
  2264. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2265. {GTP_EXT_NODE_ADDR, GTP_OPTIONAL},
  2266. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2267. {0, 0}
  2268. }
  2269. },
  2270. {
  2271. GTP_MSG_REDIR_REQ, {
  2272. {0, 0}
  2273. }
  2274. },
  2275. /* 7.3 Tunnel Management Messages */
  2276. {
  2277. GTP_MSG_CREATE_PDP_REQ, {
  2278. {GTP_EXT_IMSI, GTP_CONDITIONAL},
  2279. /* RAI is in TS 29.060 V6.11.0 */
  2280. {GTP_EXT_RAI, GTP_OPTIONAL}, /* Routeing Area Identity (RAI) Optional 7.7.3 */
  2281. {GTP_EXT_RECOVER, GTP_OPTIONAL},
  2282. {GTP_EXT_SEL_MODE, GTP_CONDITIONAL},
  2283. {GTP_EXT_TEID, GTP_MANDATORY},
  2284. {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
  2285. {GTP_EXT_NSAPI, GTP_MANDATORY},
  2286. {GTP_EXT_NSAPI, GTP_CONDITIONAL},
  2287. {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL},
  2288. {GTP_EXT_TRACE_REF, GTP_OPTIONAL},
  2289. {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL},
  2290. {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
  2291. {GTP_EXT_APN, GTP_CONDITIONAL},
  2292. {GTP_EXT_PROTO_CONF, GTP_CONDITIONAL},
  2293. {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
  2294. {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
  2295. {GTP_EXT_MSISDN, GTP_CONDITIONAL},
  2296. {GTP_EXT_QOS_UMTS, GTP_MANDATORY},
  2297. {GTP_EXT_TFT, GTP_CONDITIONAL},
  2298. {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL},
  2299. {GTP_EXT_OMC_ID, GTP_OPTIONAL},
  2300. /* TS 29.060 V6.11.0 */
  2301. {GTP_EXT_APN_RES, GTP_OPTIONAL},
  2302. {GTP_EXT_RAT_TYPE, GTP_OPTIONAL},
  2303. {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL},
  2304. {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL},
  2305. {GTP_EXT_IMEISV, GTP_OPTIONAL},
  2306. {GTP_EXT_CAMEL_CHG_INF_CON, GTP_OPTIONAL},
  2307. {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL},
  2308. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2309. {0, 0}
  2310. }
  2311. },
  2312. {
  2313. GTP_MSG_CREATE_PDP_RESP, {
  2314. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2315. {GTP_EXT_REORDER, GTP_CONDITIONAL},
  2316. {GTP_EXT_RECOVER, GTP_OPTIONAL},
  2317. {GTP_EXT_TEID, GTP_CONDITIONAL},
  2318. {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
  2319. {GTP_EXT_NSAPI, GTP_CONDITIONAL},
  2320. {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
  2321. {GTP_EXT_USER_ADDR, GTP_CONDITIONAL},
  2322. {GTP_EXT_PROTO_CONF, GTP_OPTIONAL},
  2323. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
  2324. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
  2325. {GTP_EXT_QOS_UMTS, GTP_CONDITIONAL},
  2326. {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
  2327. /* TS 29.060 V6.11.0 */
  2328. {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
  2329. {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL}, /* Common Flags Optional 7.7.48 */
  2330. {GTP_EXT_APN_RES, GTP_OPTIONAL}, /* APN Restriction Optional 7.7.49 */
  2331. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2332. {0, 0}
  2333. }
  2334. },
  2335. { /* checked, SGSN -> GGSN */
  2336. GTP_MSG_UPDATE_PDP_REQ, {
  2337. {GTP_EXT_IMSI, GTP_CONDITIONAL},
  2338. {GTP_EXT_RAI, GTP_OPTIONAL}, /* Routeing Area Identity (RAI) Optional 7.7.3 */
  2339. {GTP_EXT_RECOVER, GTP_OPTIONAL},
  2340. {GTP_EXT_TEID, GTP_MANDATORY},
  2341. {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
  2342. {GTP_EXT_NSAPI, GTP_MANDATORY},
  2343. {GTP_EXT_TRACE_REF, GTP_OPTIONAL},
  2344. {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL},
  2345. {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
  2346. {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* SGSN Address for Control Plane Mandatory GSN Address 7.7.32 */
  2347. {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* SGSN Address for User Traffic Mandatory GSN Address 7.7.32 */
  2348. {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
  2349. {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for User Traffic Conditional GSN Address 7.7.32 */
  2350. {GTP_EXT_QOS_UMTS, GTP_MANDATORY},
  2351. {GTP_EXT_TFT, GTP_OPTIONAL},
  2352. {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL},
  2353. {GTP_EXT_OMC_ID, GTP_OPTIONAL},
  2354. {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL}, /* Common Flags Optional 7.7.48 */
  2355. {GTP_EXT_RAT_TYPE, GTP_OPTIONAL}, /* RAT Type Optional 7.7.50 */
  2356. {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL}, /* User Location Information Optional 7.7.51 */
  2357. {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL}, /* MS Time Zone Optional 7.7.52 */
  2358. {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL}, /* Additonal Trace Info Optional 7.7.62 */
  2359. {GTP_EXT_DIRECT_TUNNEL_FLGS, GTP_OPTIONAL}, /* Direct Tunnel Flags 7.7.81 */
  2360. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2361. {0, 0}
  2362. }
  2363. },
  2364. { /* checked, GGSN -> SGSN */
  2365. GTP_MSG_UPDATE_PDP_RESP, {
  2366. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2367. {GTP_EXT_RECOVER, GTP_OPTIONAL},
  2368. {GTP_EXT_TEID, GTP_CONDITIONAL},
  2369. {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
  2370. {GTP_EXT_CHRG_ID, GTP_CONDITIONAL},
  2371. {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
  2372. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
  2373. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
  2374. {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
  2375. {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for User Traffic Conditional GSN Address 7.7.32 */
  2376. {GTP_EXT_QOS_UMTS, GTP_CONDITIONAL},
  2377. {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL},
  2378. {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
  2379. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2380. {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL}, /* Common Flags Optional 7.7.48 */
  2381. {GTP_EXT_APN_RES, GTP_OPTIONAL}, /* APN Restriction Optional 7.7.49 */
  2382. {0, 0}
  2383. }
  2384. },
  2385. {
  2386. GTP_MSG_DELETE_PDP_REQ, {
  2387. {GTP_EXT_TEAR_IND, GTP_CONDITIONAL},
  2388. {GTP_EXT_NSAPI, GTP_MANDATORY},
  2389. {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
  2390. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2391. {0, 0}
  2392. }
  2393. },
  2394. {
  2395. GTP_MSG_DELETE_PDP_RESP, {
  2396. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2397. {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
  2398. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2399. {0, 0}
  2400. }
  2401. },
  2402. {
  2403. GTP_MSG_ERR_IND, {
  2404. {GTP_EXT_TEID, GTP_MANDATORY},
  2405. {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* GSN Address Mandatory 7.7.32 */
  2406. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2407. {0, 0}
  2408. }
  2409. },
  2410. {
  2411. GTP_MSG_PDU_NOTIFY_REQ, {
  2412. {GTP_EXT_IMSI, GTP_MANDATORY},
  2413. {GTP_EXT_TEID_CP, GTP_MANDATORY},
  2414. {GTP_EXT_USER_ADDR, GTP_MANDATORY},
  2415. {GTP_EXT_APN, GTP_MANDATORY},
  2416. {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
  2417. {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
  2418. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2419. {0, 0}
  2420. }
  2421. },
  2422. {
  2423. GTP_MSG_PDU_NOTIFY_RESP, {
  2424. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2425. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2426. {0, 0}
  2427. }
  2428. },
  2429. {
  2430. GTP_MSG_PDU_NOTIFY_REJ_REQ, {
  2431. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2432. {GTP_EXT_TEID_CP, GTP_MANDATORY},
  2433. {GTP_EXT_USER_ADDR, GTP_MANDATORY},
  2434. {GTP_EXT_APN, GTP_MANDATORY},
  2435. {GTP_EXT_PROTO_CONF, GTP_OPTIONAL}, /* Protocol Configuration Options Optional 7.7.31 */
  2436. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2437. {0, 0}
  2438. }
  2439. },
  2440. {
  2441. GTP_MSG_PDU_NOTIFY_REJ_RESP, {
  2442. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2443. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2444. {0, 0}
  2445. }
  2446. },
  2447. /* 7.4 Location Management Messages */
  2448. {
  2449. GTP_MSG_SEND_ROUT_INFO_REQ, {
  2450. {GTP_EXT_IMSI, GTP_MANDATORY},
  2451. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2452. {0, 0}
  2453. }
  2454. },
  2455. {
  2456. GTP_MSG_SEND_ROUT_INFO_RESP, {
  2457. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2458. {GTP_EXT_IMSI, GTP_MANDATORY},
  2459. {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
  2460. {GTPv1_EXT_MS_REASON, GTP_OPTIONAL},
  2461. {GTP_EXT_GSN_ADDR, GTP_OPTIONAL},
  2462. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2463. {0, 0}
  2464. }
  2465. },
  2466. {
  2467. GTP_MSG_FAIL_REP_REQ, {
  2468. {GTP_EXT_IMSI, GTP_MANDATORY},
  2469. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2470. {0, 0}
  2471. }
  2472. },
  2473. {
  2474. GTP_MSG_FAIL_REP_RESP, {
  2475. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2476. {GTP_EXT_MAP_CAUSE, GTP_OPTIONAL},
  2477. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2478. {0, 0}
  2479. }
  2480. },
  2481. {
  2482. GTP_MSG_MS_PRESENT_REQ, {
  2483. {GTP_EXT_IMSI, GTP_MANDATORY},
  2484. {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
  2485. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2486. {0, 0}
  2487. }
  2488. },
  2489. {
  2490. GTP_MSG_MS_PRESENT_RESP, {
  2491. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2492. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2493. {0, 0}
  2494. }
  2495. },
  2496. /* 7.5 Mobility Management Messages */
  2497. {
  2498. GTP_MSG_IDENT_REQ, {
  2499. {GTP_EXT_RAI, GTP_MANDATORY},
  2500. {GTP_EXT_PTMSI, GTP_MANDATORY},
  2501. {GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL},
  2502. {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* SGSN Address for Control Plane Optional 7.7.32 */
  2503. {GTP_EXT_HOP_COUNT, GTP_OPTIONAL}, /* Hop Counter Optional 7.7.63 */
  2504. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2505. {0, 0}
  2506. }
  2507. },
  2508. {
  2509. GTP_MSG_IDENT_RESP, {
  2510. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2511. {GTP_EXT_IMSI, GTP_CONDITIONAL},
  2512. {GTP_EXT_AUTH_TRI, GTP_CONDITIONAL},
  2513. {GTP_EXT_AUTH_QUI, GTP_CONDITIONAL},
  2514. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2515. {0, 0}
  2516. }
  2517. },
  2518. {
  2519. GTP_MSG_SGSN_CNTXT_REQ, {
  2520. {GTP_EXT_IMSI, GTP_CONDITIONAL},
  2521. {GTP_EXT_RAI, GTP_MANDATORY},
  2522. {GTP_EXT_TLLI, GTP_CONDITIONAL},
  2523. {GTP_EXT_PTMSI, GTP_CONDITIONAL},
  2524. {GTP_EXT_PTMSI_SIG, GTP_CONDITIONAL},
  2525. {GTP_EXT_MS_VALID, GTP_OPTIONAL},
  2526. {GTP_EXT_TEID_CP, GTP_MANDATORY},
  2527. {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
  2528. {GTP_EXT_GSN_ADDR, GTP_OPTIONAL}, /* Alternative SGSN Address for Control Plane Optional 7.7.32 */
  2529. {GTP_EXT_SSGN_NO, GTP_OPTIONAL}, /* SGSN Number Optional 7.7.47 */
  2530. {GTP_EXT_HOP_COUNT, GTP_OPTIONAL}, /* Hop Counter Optional 7.7.63 */
  2531. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2532. {0, 0}
  2533. }
  2534. },
  2535. {
  2536. GTP_MSG_SGSN_CNTXT_RESP, {
  2537. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2538. {GTP_EXT_IMSI, GTP_CONDITIONAL},
  2539. {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
  2540. {GTP_EXT_RAB_CNTXT, GTP_CONDITIONAL}, /* RAB Context Conditional 7.7.19 */
  2541. {GTP_EXT_RP_SMS, GTP_OPTIONAL},
  2542. {GTP_EXT_RP, GTP_OPTIONAL},
  2543. {GTP_EXT_PKT_FLOW_ID, GTP_OPTIONAL},
  2544. {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL}, /* CharingCharacteristics Optional 7.7.23 */
  2545. {GTP_EXT_RA_PRIO_LCS, GTP_OPTIONAL}, /* Radio Priority LCS Optional 7.7.25B */
  2546. {GTP_EXT_MM_CNTXT, GTP_CONDITIONAL},
  2547. {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL},
  2548. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
  2549. {GTP_EXT_PDP_CONT_PRIO, GTP_OPTIONAL}, /* PDP Context Prioritization Optional 7.7.45 */
  2550. {GTP_EXT_MBMS_UE_CTX, GTP_OPTIONAL}, /* MBMS UE Context Optional 7.7.55 */
  2551. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2552. {0, 0}
  2553. }
  2554. },
  2555. {
  2556. GTP_MSG_SGSN_CNTXT_ACK, {
  2557. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2558. {GTP_EXT_TEID_II, GTP_CONDITIONAL},
  2559. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
  2560. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2561. {0, 0}
  2562. }
  2563. },
  2564. {
  2565. GTP_MSG_FORW_RELOC_REQ, {
  2566. {GTP_EXT_IMSI, GTP_MANDATORY},
  2567. {GTP_EXT_TEID_CP, GTP_MANDATORY},
  2568. {GTP_EXT_RANAP_CAUSE, GTP_MANDATORY},
  2569. {GTP_EXT_CHRG_CHAR, GTP_OPTIONAL}, /* CharingCharacteristics Optional 7.7.23 */
  2570. {GTP_EXT_MM_CNTXT, GTP_MANDATORY},
  2571. {GTP_EXT_PDP_CNTXT, GTP_CONDITIONAL},
  2572. {GTP_EXT_GSN_ADDR, GTP_MANDATORY},
  2573. {GTP_EXT_TARGET_ID, GTP_MANDATORY},
  2574. {GTP_EXT_UTRAN_CONT, GTP_MANDATORY},
  2575. {GTP_EXT_PDP_CONT_PRIO, GTP_OPTIONAL}, /* PDP Context Prioritization Optional 7.7.45 */
  2576. {GTP_EXT_MBMS_UE_CTX, GTP_OPTIONAL}, /* MBMS UE Context Optional 7.7.55 */
  2577. {GTP_EXT_SEL_PLMN_ID, GTP_OPTIONAL}, /* Selected PLMN ID Optional 7.7.64 */
  2578. {GTP_EXT_PS_HO_REQ_CTX, GTP_OPTIONAL}, /* PS Handover Request Context Optional 7.7.71 */
  2579. {GTP_EXT_BSS_CONT, GTP_OPTIONAL}, /* BSS Container Optional 7.7.72 */
  2580. {GTP_EXT_CELL_ID, GTP_OPTIONAL}, /* Cell Identification Optional 7.7.73 */
  2581. {GTP_EXT_BSSGP_CAUSE, GTP_OPTIONAL}, /* BSSGP Cause Optional 7.7.75 */
  2582. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2583. {GTP_EXT_SSGN_NO, GTP_OPTIONAL},
  2584. {0, 0}
  2585. }
  2586. },
  2587. {
  2588. GTP_MSG_FORW_RELOC_RESP, {
  2589. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2590. {GTP_EXT_TEID_CP, GTP_CONDITIONAL},
  2591. {GTP_EXT_TEID_II, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Data II Optional 7.7.15 */
  2592. {GTP_EXT_RANAP_CAUSE, GTP_CONDITIONAL},
  2593. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL},
  2594. {GTP_EXT_UTRAN_CONT, GTP_OPTIONAL},
  2595. {GTP_EXT_RAB_SETUP, GTP_CONDITIONAL},
  2596. {GTP_EXT_ADD_RAB_SETUP_INF, GTP_CONDITIONAL}, /* Additional RAB Setup Information Conditional 7.7.45A */
  2597. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2598. {0, 0}
  2599. }
  2600. },
  2601. {
  2602. GTP_MSG_FORW_RELOC_COMP, {
  2603. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2604. {0, 0}
  2605. }
  2606. },
  2607. {
  2608. GTP_MSG_RELOC_CANCEL_REQ, {
  2609. {GTP_EXT_IMSI, GTP_MANDATORY},
  2610. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2611. {0, 0}
  2612. }
  2613. },
  2614. {
  2615. GTP_MSG_RELOC_CANCEL_RESP, {
  2616. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2617. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2618. {0, 0}
  2619. }
  2620. },
  2621. {
  2622. GTP_MSG_FORW_RELOC_ACK, {
  2623. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2624. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2625. {0, 0}
  2626. }
  2627. },
  2628. {
  2629. GTP_MSG_FORW_SRNS_CNTXT_ACK, {
  2630. {GTP_EXT_CAUSE, GTP_MANDATORY},
  2631. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2632. {0, 0}
  2633. }
  2634. },
  2635. {
  2636. GTP_MSG_FORW_SRNS_CNTXT, {
  2637. {GTP_EXT_RAB_CNTXT, GTP_MANDATORY},
  2638. {GTP_EXT_SRC_RNC_PDP_CTX_INF, GTP_OPTIONAL}, /* Source RNC PDCP context info Optional 7.7.61 */
  2639. {GTP_EXT_PDU_NO, GTP_OPTIONAL}, /* PDU Numbers Optional 7.7.74 */
  2640. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2641. {0, 0}
  2642. }
  2643. },
  2644. /* 7.5.14 RAN Information Management Messages */
  2645. {
  2646. GTP_MSG_RAN_INFO_RELAY, {
  2647. {GTP_EXT_RAN_TR_CONT, GTP_MANDATORY}, /* RAN Transparent Container Mandatory 7.7.43 */
  2648. {GTP_EXT_RIM_RA, GTP_OPTIONAL}, /* RIM Routing Address Optional 7.7.57 */
  2649. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2650. {0, 0}
  2651. }
  2652. },
  2653. /* 7.5A MBMS Messages
  2654. * 7.5A.1 UE Specific MBMS Messages
  2655. */
  2656. {
  2657. GTP_MBMS_NOTIFY_REQ, {
  2658. {GTP_EXT_IMSI, GTP_MANDATORY}, /* IMSI Mandatory 7.7.2 */
  2659. {GTP_EXT_TEID_CP, GTP_MANDATORY}, /* Tunnel Endpoint Identifier Control Plane Mandatory 7.7.14 */
  2660. {GTP_EXT_NSAPI, GTP_MANDATORY}, /* NSAPI Mandatory 7.7.17 */
  2661. {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
  2662. {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
  2663. {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* GGSN Address for Control Plane Mandatory 7.7.32 */
  2664. {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
  2665. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
  2666. {0, 0}
  2667. }
  2668. },
  2669. {
  2670. GTP_MBMS_NOTIFY_RES, {
  2671. {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
  2672. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2673. {0, 0}
  2674. }
  2675. },
  2676. {
  2677. GTP_MBMS_NOTIFY_REJ_REQ, {
  2678. {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
  2679. {GTP_EXT_TEID_CP, GTP_MANDATORY}, /* Tunnel Endpoint Identifier Control Plane Mandatory 7.7.14 */
  2680. {GTP_EXT_NSAPI, GTP_MANDATORY}, /* NSAPI Mandatory 7.7.17 */
  2681. {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
  2682. {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
  2683. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2684. {0, 0}
  2685. }
  2686. },
  2687. {
  2688. GTP_MBMS_NOTIFY_REJ_RES, {
  2689. {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
  2690. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2691. {0, 0}
  2692. }
  2693. },
  2694. {
  2695. GTP_CREATE_MBMS_CNTXT_REQ, {
  2696. {GTP_EXT_IMSI, GTP_CONDITIONAL}, /* IMSI Conditional 7.7.2 */
  2697. {GTP_EXT_RAI, GTP_MANDATORY}, /* Routeing Area Identity (RAI) Mandatory 7.7.3 */
  2698. {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
  2699. {GTP_EXT_SEL_MODE, GTP_CONDITIONAL}, /* Selection mode Conditional 7.7.12 */
  2700. {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
  2701. {GTP_EXT_TRACE_REF, GTP_OPTIONAL}, /* Trace Reference Optional 7.7.24 */
  2702. {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL}, /* Trace Type Optional 7.7.25 */
  2703. {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
  2704. {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
  2705. {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* SGSN Address for signalling Mandatory GSN Address 7.7.32 */
  2706. {GTP_EXT_MSISDN, GTP_CONDITIONAL}, /* MSISDN Conditional 7.7.33 */
  2707. {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL}, /* Trigger Id Optional 7.7.41 */
  2708. {GTP_EXT_OMC_ID, GTP_OPTIONAL}, /* OMC Identity Optional 7.7.42 */
  2709. {GTP_EXT_RAT_TYPE, GTP_OPTIONAL}, /* RAT Type Optional 7.7.50 */
  2710. {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL}, /* User Location Information Optional 7.7.51 */
  2711. {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL}, /* MS Time Zone Optional 7.7.52 */
  2712. {GTP_EXT_IMEISV, GTP_OPTIONAL}, /* IMEI(SV) Optional 7.7.53 */
  2713. {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
  2714. {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL}, /* Additonal Trace Info Optional 7.7.62 */
  2715. {GTP_EXT_ENH_NSAPI, GTP_MANDATORY}, /* Enhanced NSAPI Mandatory 7.7.67 */
  2716. {GTP_EXT_ADD_MBMS_TRS_INF, GTP_OPTIONAL}, /* Additional MBMS Trace Info Optional 7.7.68 */
  2717. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2718. {0, 0}
  2719. }
  2720. },
  2721. {
  2722. GTP_CREATE_MBMS_CNTXT_RES, {
  2723. {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
  2724. {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
  2725. {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
  2726. {GTP_EXT_CHRG_ID, GTP_CONDITIONAL}, /* Charging ID Conditional 7.7.26 */
  2727. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
  2728. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* Alternative GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
  2729. {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Charging Gateway Address Optional 7.7.44 */
  2730. {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
  2731. {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
  2732. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2733. {0, 0}
  2734. }
  2735. },
  2736. {
  2737. GTP_UPD_MBMS_CNTXT_REQ, {
  2738. {GTP_EXT_IMSI, GTP_CONDITIONAL}, /* IMSI Conditional 7.7.2 */
  2739. {GTP_EXT_RAI, GTP_MANDATORY}, /* Routeing Area Identity (RAI) Mandatory 7.7.3 */
  2740. {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
  2741. {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
  2742. {GTP_EXT_TRACE_REF, GTP_OPTIONAL}, /* Trace Reference Optional 7.7.24 */
  2743. {GTP_EXT_TRACE_TYPE, GTP_OPTIONAL}, /* Trace Type Optional 7.7.25 */
  2744. {GTP_EXT_GSN_ADDR, GTP_MANDATORY}, /* SGSN Address for Control Plane Mandatory GSN Address 7.7.32 */
  2745. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* Alternative SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
  2746. {GTP_EXT_TRIGGER_ID, GTP_OPTIONAL}, /* Trigger Id Optional 7.7.41 */
  2747. {GTP_EXT_OMC_ID, GTP_OPTIONAL}, /* OMC Identity Optional 7.7.42 */
  2748. {GTP_EXT_RAT_TYPE, GTP_OPTIONAL}, /* RAT Type Optional 7.7.50 */
  2749. {GTP_EXT_USR_LOC_INF, GTP_OPTIONAL}, /* User Location Information Optional 7.7.51 */
  2750. {GTP_EXT_MS_TIME_ZONE, GTP_OPTIONAL}, /* MS Time Zone Optional 7.7.52 */
  2751. {GTP_EXT_ADD_TRS_INF, GTP_OPTIONAL}, /* Additional Trace Info Optional 7.7.62 */
  2752. {GTP_EXT_ENH_NSAPI, GTP_MANDATORY}, /* Enhanced NSAPI Mandatory 7.7.67 */
  2753. {GTP_EXT_ADD_MBMS_TRS_INF, GTP_OPTIONAL}, /* Additional MBMS Trace Info Optional 7.7.68 */
  2754. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2755. {0, 0}
  2756. }
  2757. },
  2758. {
  2759. GTP_UPD_MBMS_CNTXT_RES, {
  2760. {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
  2761. {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
  2762. {GTP_EXT_TEID_CP, GTP_MANDATORY}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
  2763. {GTP_EXT_CHRG_ID, GTP_CONDITIONAL}, /* Charging ID Conditional 7.7.26 */
  2764. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
  2765. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* Alternative GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
  2766. {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Charging Gateway Address Optional 7.7.44 */
  2767. {GTP_EXT_CHRG_ADDR, GTP_OPTIONAL}, /* Alternative Charging Gateway Address Optional 7.7.44 */
  2768. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
  2769. {0, 0}
  2770. }
  2771. },
  2772. {
  2773. GTP_DEL_MBMS_CNTXT_REQ, {
  2774. {GTP_EXT_IMSI, GTP_CONDITIONAL}, /* IMSI Conditional 7.7.2 */
  2775. {GTP_EXT_TEID_CP, GTP_MANDATORY}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
  2776. {GTP_EXT_USER_ADDR, GTP_CONDITIONAL}, /* End User Address Conditional 7.7.27 */
  2777. {GTP_EXT_APN, GTP_CONDITIONAL}, /* Access Point Name Conditional 7.7.30 */
  2778. {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
  2779. {GTP_EXT_ENH_NSAPI, GTP_MANDATORY}, /* Enhanced NSAPI Conditional 7.7.67 */
  2780. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
  2781. {0, 0}
  2782. }
  2783. },
  2784. {
  2785. GTP_DEL_MBMS_CNTXT_RES, {
  2786. {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
  2787. {GTP_EXT_MBMS_PROT_CONF_OPT, GTP_OPTIONAL}, /* MBMS Protocol Configuration Options Optional 7.7.58 */
  2788. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL},
  2789. {0, 0}
  2790. }
  2791. },
  2792. {
  2793. GTP_MBMS_REG_REQ, {
  2794. {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
  2795. {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
  2796. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
  2797. {0, 0}
  2798. }
  2799. },
  2800. {
  2801. GTP_MBMS_REG_RES, {
  2802. {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
  2803. {GTP_EXT_TMGI, GTP_MANDATORY}, /* Temporary Mobile Group Identity (TMGI) Conditional 7.7.56 */
  2804. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
  2805. {0, 0}
  2806. }
  2807. },
  2808. {
  2809. GTP_MBMS_DE_REG_REQ, {
  2810. {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
  2811. {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
  2812. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
  2813. {0, 0}
  2814. }
  2815. },
  2816. {
  2817. GTP_MBMS_DE_REG_RES, {
  2818. {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
  2819. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
  2820. {0, 0}
  2821. }
  2822. },
  2823. {
  2824. GTP_MBMS_SES_START_REQ, {
  2825. {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
  2826. {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
  2827. {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
  2828. {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
  2829. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* GGSN Address for Control Plane Conditional GSN Address 7.7.32 */
  2830. {GTP_EXT_QOS_UMTS, GTP_MANDATORY}, /* Quality of Service Profile Mandatory 7.7.34 */
  2831. {GTP_EXT_COMMON_FLGS, GTP_OPTIONAL}, /* Common Flags Mandatory 7.7.48 */
  2832. {GTP_EXT_TMGI, GTP_MANDATORY}, /* Temporary Mobile Group Identity (TMGI) Mandatory 7.7.56 */
  2833. {GTP_EXT_MBMS_SES_DUR, GTP_MANDATORY}, /* MBMS Session Duration Mandatory 7.7.59 */
  2834. {GTP_EXT_MBMS_SA, GTP_MANDATORY}, /* MBMS Service Area Mandatory 7.7.60 */
  2835. {GTP_EXT_MBMS_SES_ID, GTP_OPTIONAL}, /* MBMS Session Identifier Optional 7.7.65 */
  2836. {GTP_EXT_MBMS_2G_3G_IND, GTP_MANDATORY}, /* MBMS 2G/3G Indicator Mandatory 7.7.66 */
  2837. {GTP_EXT_MBMS_SES_ID_REP_NO, GTP_OPTIONAL}, /* MBMS Session Identity Repetition Number Optional 7.7.69 */
  2838. {GTP_EXT_MBMS_TIME_TO_DATA_TR, GTP_MANDATORY}, /* MBMS Time To Data Transfer Mandatory 7.7.70 */
  2839. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
  2840. {0, 0}
  2841. }
  2842. },
  2843. {
  2844. GTP_MBMS_SES_START_RES, {
  2845. {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
  2846. {GTP_EXT_RECOVER, GTP_OPTIONAL}, /* Recovery Optional 7.7.11 */
  2847. {GTP_EXT_TEID, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Data I Conditional 7.7.13 */
  2848. {GTP_EXT_TEID_CP, GTP_CONDITIONAL}, /* Tunnel Endpoint Identifier Control Plane Conditional 7.7.14 */
  2849. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* SGSN Address for Control Plane Conditional GSN Address 7.7.32 */
  2850. {GTP_EXT_GSN_ADDR, GTP_CONDITIONAL}, /* SGSN Address for user traffic Conditional GSN Address 7.7.32 */
  2851. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
  2852. {0, 0}
  2853. }
  2854. },
  2855. {
  2856. GTP_MBMS_SES_STOP_REQ, {
  2857. {GTP_EXT_USER_ADDR, GTP_MANDATORY}, /* End User Address Mandatory 7.7.27 */
  2858. {GTP_EXT_APN, GTP_MANDATORY}, /* Access Point Name Mandatory 7.7.30 */
  2859. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
  2860. {0, 0}
  2861. }
  2862. },
  2863. {
  2864. GTP_MBMS_SES_STOP_RES, {
  2865. {GTP_EXT_CAUSE, GTP_MANDATORY}, /* Cause Mandatory 7.7.1 */
  2866. {GTP_EXT_PRIV_EXT, GTP_OPTIONAL}, /* Private Extension Optional 7.7.46 */
  2867. {0, 0}
  2868. }
  2869. },
  2870. {
  2871. 0, {
  2872. {0, 0}
  2873. }
  2874. }
  2875. };
  2876. /* Data structure attached to a conversation,
  2877. to keep track of request/response-pairs
  2878. */
  2879. typedef struct gtp_conv_info_t {
  2880. struct gtp_conv_info_t *next;
  2881. GHashTable *unmatched;
  2882. GHashTable *matched;
  2883. } gtp_conv_info_t;
  2884. static gtp_conv_info_t *gtp_info_items = NULL;
  2885. static guint
  2886. gtp_sn_hash(gconstpointer k)
  2887. {
  2888. const gtp_msg_hash_t *key = (const gtp_msg_hash_t *)k;
  2889. return key->seq_nr;
  2890. }
  2891. static gint
  2892. gtp_sn_equal_matched(gconstpointer k1, gconstpointer k2)
  2893. {
  2894. const gtp_msg_hash_t *key1 = (const gtp_msg_hash_t *)k1;
  2895. const gtp_msg_hash_t *key2 = (const gtp_msg_hash_t *)k2;
  2896. if ( key1->req_frame && key2->req_frame && (key1->req_frame != key2->req_frame) ) {
  2897. return 0;
  2898. }
  2899. if ( key1->rep_frame && key2->rep_frame && (key1->rep_frame != key2->rep_frame) ) {
  2900. return 0;
  2901. }
  2902. return key1->seq_nr == key2->seq_nr;
  2903. }
  2904. static gint
  2905. gtp_sn_equal_unmatched(gconstpointer k1, gconstpointer k2)
  2906. {
  2907. const gtp_msg_hash_t *key1 = (const gtp_msg_hash_t *)k1;
  2908. const gtp_msg_hash_t *key2 = (const gtp_msg_hash_t *)k2;
  2909. return key1->seq_nr == key2->seq_nr;
  2910. }
  2911. static gtp_msg_hash_t *
  2912. gtp_match_response(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gint seq_nr, guint msgtype)
  2913. {
  2914. gtp_msg_hash_t gcr, *gcrp = NULL;
  2915. gtp_conv_info_t *gtp_info = (gtp_conv_info_t *)pinfo->private_data;
  2916. gcr.seq_nr=seq_nr;
  2917. switch (msgtype) {
  2918. case GTP_MSG_ECHO_REQ:
  2919. case GTP_MSG_CREATE_PDP_REQ:
  2920. case GTP_MSG_UPDATE_PDP_REQ:
  2921. case GTP_MSG_DELETE_PDP_REQ:
  2922. gcr.is_request=TRUE;
  2923. gcr.req_frame=pinfo->fd->num;
  2924. gcr.rep_frame=0;
  2925. break;
  2926. case GTP_MSG_ECHO_RESP:
  2927. case GTP_MSG_CREATE_PDP_RESP:
  2928. case GTP_MSG_UPDATE_PDP_RESP:
  2929. case GTP_MSG_DELETE_PDP_RESP:
  2930. gcr.is_request=FALSE;
  2931. gcr.req_frame=0;
  2932. gcr.rep_frame=pinfo->fd->num;
  2933. break;
  2934. default:
  2935. gcr.is_request=FALSE;
  2936. gcr.req_frame=0;
  2937. gcr.rep_frame=0;
  2938. break;
  2939. }
  2940. gcrp = (gtp_msg_hash_t *)g_hash_table_lookup(gtp_info->matched, &gcr);
  2941. if (gcrp) {
  2942. gcrp->is_request=gcr.is_request;
  2943. } else {
  2944. /*no match, let's try to make one*/
  2945. switch (msgtype) {
  2946. case GTP_MSG_ECHO_REQ:
  2947. case GTP_MSG_CREATE_PDP_REQ:
  2948. case GTP_MSG_UPDATE_PDP_REQ:
  2949. case GTP_MSG_DELETE_PDP_REQ:
  2950. gcr.seq_nr=seq_nr;
  2951. gcrp=(gtp_msg_hash_t *)g_hash_table_lookup(gtp_info->unmatched, &gcr);
  2952. if (gcrp) {
  2953. g_hash_table_remove(gtp_info->unmatched, gcrp);
  2954. }
  2955. /* if we cant reuse the old one, grab a new chunk */
  2956. if (!gcrp) {
  2957. gcrp = se_new(gtp_msg_hash_t);
  2958. }
  2959. gcrp->seq_nr=seq_nr;
  2960. gcrp->req_frame = pinfo->fd->num;
  2961. gcrp->req_time = pinfo->fd->abs_ts;
  2962. gcrp->rep_frame = 0;
  2963. gcrp->msgtype = msgtype;
  2964. gcrp->is_request = TRUE;
  2965. g_hash_table_insert(gtp_info->unmatched, gcrp, gcrp);
  2966. return NULL;
  2967. break;
  2968. case GTP_MSG_ECHO_RESP:
  2969. case GTP_MSG_CREATE_PDP_RESP:
  2970. case GTP_MSG_UPDATE_PDP_RESP:
  2971. case GTP_MSG_DELETE_PDP_RESP:
  2972. gcr.seq_nr=seq_nr;
  2973. gcrp=(gtp_msg_hash_t *)g_hash_table_lookup(gtp_info->unmatched, &gcr);
  2974. if (gcrp) {
  2975. if (!gcrp->rep_frame) {
  2976. g_hash_table_remove(gtp_info->unmatched, gcrp);
  2977. gcrp->rep_frame=pinfo->fd->num;
  2978. gcrp->is_request=FALSE;
  2979. g_hash_table_insert(gtp_info->matched, gcrp, gcrp);
  2980. }
  2981. }
  2982. break;
  2983. default:
  2984. break;
  2985. }
  2986. }
  2987. /* we have found a match */
  2988. if (gcrp) {
  2989. proto_item *it;
  2990. if (gcrp->is_request) {
  2991. it = proto_tree_add_uint(tree, hf_gtp_response_in, tvb, 0, 0, gcrp->rep_frame);
  2992. PROTO_ITEM_SET_GENERATED(it);
  2993. } else {
  2994. nstime_t ns;
  2995. it = proto_tree_add_uint(tree, hf_gtp_response_to, tvb, 0, 0, gcrp->req_frame);
  2996. PROTO_ITEM_SET_GENERATED(it);
  2997. nstime_delta(&ns, &pinfo->fd->abs_ts, &gcrp->req_time);
  2998. it = proto_tree_add_time(tree, hf_gtp_time, tvb, 0, 0, &ns);
  2999. PROTO_ITEM_SET_GENERATED(it);
  3000. }
  3001. }
  3002. return gcrp;
  3003. }
  3004. static int
  3005. check_field_presence(guint8 message, guint8 field, int *position)
  3006. {
  3007. guint i = 0;
  3008. _gtp_mess_items *mess_items;
  3009. switch (gtp_version) {
  3010. case 0:
  3011. mess_items = gprs_mess_items;
  3012. break;
  3013. case 1:
  3014. mess_items = umts_mess_items;
  3015. break;
  3016. default:
  3017. return -2;
  3018. }
  3019. while (mess_items[i].code) {
  3020. if (mess_items[i].code == message) {
  3021. while (mess_items[i].fields[*position].code) {
  3022. if (mess_items[i].fields[*position].code == field) {
  3023. (*position)++;
  3024. return 0;
  3025. } else {
  3026. if (mess_items[i].fields[*position].presence == GTP_MANDATORY) {
  3027. return mess_items[i].fields[(*position)++].code;
  3028. } else {
  3029. (*position)++;
  3030. }
  3031. }
  3032. }
  3033. return -1;
  3034. }
  3035. i++;
  3036. }
  3037. return -2;
  3038. }
  3039. /* Decoders of fields in extension headers, each function returns no of bytes from field */
  3040. /* GPRS: 9.60 v7.6.0, chapter
  3041. * UMTS: 29.060 v4.0, chapter
  3042. * 7.7.1 Cause
  3043. */
  3044. static int
  3045. decode_gtp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3046. {
  3047. guint8 cause;
  3048. cause = tvb_get_guint8(tvb, offset + 1);
  3049. proto_tree_add_uint(tree, hf_gtp_cause, tvb, offset, 2, cause);
  3050. return 2;
  3051. }
  3052. /* GPRS: 9.60 v7.6.0, chapter 7.9.2
  3053. * UMTS: 29.060 v4.0, chapter 7.7.2
  3054. */
  3055. static int
  3056. decode_gtp_imsi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3057. {
  3058. const gchar *imsi_str;
  3059. /* Octets 2 - 9 IMSI */
  3060. imsi_str = tvb_bcd_dig_to_ep_str( tvb, offset+1, 8, NULL, FALSE);
  3061. proto_tree_add_string(tree, hf_gtp_imsi, tvb, offset+1, 8, imsi_str);
  3062. return 9;
  3063. }
  3064. /* GPRS: 9.60 v7.6.0, chapter 7.9.3
  3065. * UMTS: 29.060 v4.0, chapter 7.7.3 Routeing Area Identity (RAI)
  3066. */
  3067. static int
  3068. decode_gtp_rai(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3069. {
  3070. proto_tree *ext_tree_rai;
  3071. proto_item *te;
  3072. te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_ext_const(GTP_EXT_RAI, &gtp_val_ext, "Unknown message"));
  3073. ext_tree_rai = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_RAI]);
  3074. dissect_e212_mcc_mnc(tvb, pinfo, ext_tree_rai, offset+1, TRUE);
  3075. proto_tree_add_item(ext_tree_rai, hf_gtp_rai_lac, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
  3076. proto_tree_add_item(ext_tree_rai, hf_gtp_rai_rac, tvb, offset + 6, 1, ENC_BIG_ENDIAN);
  3077. return 7;
  3078. }
  3079. /* GPRS: 9.60 v7.6.0, chapter 7.9.4, page 39
  3080. * UMTS: 29.060 v4.0, chapter 7.7.4 Temporary Logical Link Identity (TLLI)
  3081. */
  3082. static int
  3083. decode_gtp_tlli(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3084. {
  3085. guint32 tlli;
  3086. tlli = tvb_get_ntohl(tvb, offset + 1);
  3087. proto_tree_add_uint(tree, hf_gtp_tlli, tvb, offset, 5, tlli);
  3088. return 5;
  3089. }
  3090. /* GPRS: 9.60 v7.6.0, chapter 7.9.5, page 39
  3091. * UMTS: 29.060 v4.0, chapter 7.7.5 Packet TMSI (P-TMSI)
  3092. */
  3093. static int
  3094. decode_gtp_ptmsi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3095. {
  3096. guint32 ptmsi;
  3097. ptmsi = tvb_get_ntohl(tvb, offset + 1);
  3098. proto_tree_add_uint(tree, hf_gtp_ptmsi, tvb, offset, 5, ptmsi);
  3099. return 5;
  3100. }
  3101. /*
  3102. * adjust - how many bytes before offset should be highlighted
  3103. */
  3104. static int
  3105. decode_qos_gprs(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos_str, guint8 adjust)
  3106. {
  3107. guint8 spare1, delay, reliability, peak, spare2, precedence, spare3, mean;
  3108. proto_tree *ext_tree_qos;
  3109. proto_item *te;
  3110. spare1 = tvb_get_guint8(tvb, offset) & GTP_EXT_QOS_SPARE1_MASK;
  3111. delay = tvb_get_guint8(tvb, offset) & GTP_EXT_QOS_DELAY_MASK;
  3112. reliability = tvb_get_guint8(tvb, offset) & GTP_EXT_QOS_RELIABILITY_MASK;
  3113. peak = tvb_get_guint8(tvb, offset + 1) & GTP_EXT_QOS_PEAK_MASK;
  3114. spare2 = tvb_get_guint8(tvb, offset + 1) & GTP_EXT_QOS_SPARE2_MASK;
  3115. precedence = tvb_get_guint8(tvb, offset + 1) & GTP_EXT_QOS_PRECEDENCE_MASK;
  3116. spare3 = tvb_get_guint8(tvb, offset + 2) & GTP_EXT_QOS_SPARE3_MASK;
  3117. mean = tvb_get_guint8(tvb, offset + 2) & GTP_EXT_QOS_MEAN_MASK;
  3118. te = proto_tree_add_text(tree, tvb, offset - adjust, 3 + adjust, "%s: delay: %u, reliability: %u, peak: %u, precedence: %u, mean: %u",
  3119. qos_str, (delay >> 3) & 0x07, reliability, (peak >> 4) & 0x0F, precedence, mean);
  3120. ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
  3121. if (adjust != 0) {
  3122. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare1, tvb, offset, 1, spare1);
  3123. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_delay, tvb, offset, 1, delay);
  3124. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_reliability, tvb, offset, 1, reliability);
  3125. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_peak, tvb, offset + 1, 1, peak);
  3126. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare2, tvb, offset + 1, 1, spare2);
  3127. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_precedence, tvb, offset + 1, 1, precedence);
  3128. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare3, tvb, offset + 2, 1, spare3);
  3129. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_mean, tvb, offset + 2, 1, mean);
  3130. }
  3131. return 3;
  3132. }
  3133. /* GPRS: 9.60 v7.6.0, chapter 7.9.6, page 39
  3134. * 4.08
  3135. * 3.60
  3136. * UMTS: not present
  3137. * TODO: check if length is included: ETSI 4.08 vs 9.60
  3138. */
  3139. static int
  3140. decode_gtp_qos_gprs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3141. {
  3142. return (1 + decode_qos_gprs(tvb, offset + 1, tree, "Quality of Service", 1));
  3143. }
  3144. /* GPRS: 9.60 v7.6.0, chapter 7.9.7, page 39
  3145. * UMTS: 29.060 v4.0, chapter 7.7.6 Reordering Required
  3146. */
  3147. static int
  3148. decode_gtp_reorder(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3149. {
  3150. guint8 reorder;
  3151. reorder = tvb_get_guint8(tvb, offset + 1) & 0x01;
  3152. proto_tree_add_boolean(tree, hf_gtp_reorder, tvb, offset, 2, reorder);
  3153. return 2;
  3154. }
  3155. /* GPRS: 9.60 v7.6.0, chapter 7.9.8, page 40
  3156. * 4.08 v7.1.2, chapter 10.5.3.1+
  3157. * UMTS: 29.060 v4.0, chapter 7.7.7
  3158. * TODO: Add blurb support by registering items in the protocol registration
  3159. */
  3160. static int
  3161. decode_gtp_auth_tri(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3162. {
  3163. proto_tree *ext_tree_auth_tri;
  3164. proto_item *te;
  3165. te = proto_tree_add_text(tree, tvb, offset, 29, "%s", val_to_str_ext_const(GTP_EXT_AUTH_TRI, &gtp_val_ext, "Unknown message"));
  3166. ext_tree_auth_tri = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_AUTH_TRI]);
  3167. proto_tree_add_text(ext_tree_auth_tri, tvb, offset + 1, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset + 1, 16));
  3168. proto_tree_add_text(ext_tree_auth_tri, tvb, offset + 17, 4, "SRES: %s", tvb_bytes_to_str(tvb, offset + 17, 4));
  3169. proto_tree_add_text(ext_tree_auth_tri, tvb, offset + 21, 8, "Kc: %s", tvb_bytes_to_str(tvb, offset + 21, 8));
  3170. return 1 + 16 + 4 + 8;
  3171. }
  3172. /* GPRS: 9.60 v7.6.0, chapter 7.9.9, page 40
  3173. * 9.02 v7.7.0, page 1090
  3174. * UMTS: 29.060 v4.0, chapter 7.7.8, page 48
  3175. * 29.002 v4.2.1, chapter 17.5, page 268
  3176. */
  3177. static int
  3178. decode_gtp_map_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3179. {
  3180. guint8 map_cause;
  3181. map_cause = tvb_get_guint8(tvb, offset + 1);
  3182. proto_tree_add_uint(tree, hf_gtp_map_cause, tvb, offset, 2, map_cause);
  3183. return 2;
  3184. }
  3185. /* GPRS: 9.60 v7.6.0, chapter 7.9.10, page 41
  3186. * UMTS: 29.060 v4.0, chapter 7.7.9, page 48
  3187. */
  3188. static int
  3189. decode_gtp_ptmsi_sig(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3190. {
  3191. guint32 ptmsi_sig;
  3192. ptmsi_sig = tvb_get_ntoh24(tvb, offset + 1);
  3193. proto_tree_add_uint(tree, hf_gtp_ptmsi_sig, tvb, offset, 4, ptmsi_sig);
  3194. return 4;
  3195. }
  3196. /* GPRS: 9.60 v7.6.0, chapter 7.9.11, page 41
  3197. * UMTS: 29.060 v4.0, chapter 7.7.10, page 49
  3198. */
  3199. static int
  3200. decode_gtp_ms_valid(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3201. {
  3202. guint8 ms_valid;
  3203. ms_valid = tvb_get_guint8(tvb, offset + 1) & 0x01;
  3204. proto_tree_add_boolean(tree, hf_gtp_ms_valid, tvb, offset, 2, ms_valid);
  3205. return 2;
  3206. }
  3207. /* GPRS: 9.60 v7.6.0, chapter 7.9.12, page 41
  3208. * UMTS: 29.060 v4.0, chapter 7.7.11 Recovery
  3209. */
  3210. static int
  3211. decode_gtp_recovery(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3212. {
  3213. guint8 recovery;
  3214. recovery = tvb_get_guint8(tvb, offset + 1);
  3215. proto_tree_add_uint(tree, hf_gtp_recovery, tvb, offset, 2, recovery);
  3216. return 2;
  3217. }
  3218. /* GPRS: 9.60 v7.6.0, chapter 7.9.13, page 42
  3219. * UMTS: 29.060 v4.0, chapter 7.7.12 Selection Mode
  3220. */
  3221. static const gchar *
  3222. dissect_radius_selection_mode(proto_tree * tree, tvbuff_t * tvb, packet_info* pinfo _U_)
  3223. {
  3224. guint8 sel_mode;
  3225. /* Value in ASCII(UTF-8) */
  3226. sel_mode = tvb_get_guint8(tvb, 0) - 0x30;
  3227. proto_tree_add_uint(tree, hf_gtp_sel_mode, tvb, 0, 1, sel_mode);
  3228. return val_to_str_const(sel_mode, sel_mode_type, "Unknown");
  3229. }
  3230. static int
  3231. decode_gtp_sel_mode(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3232. {
  3233. proto_tree_add_item(tree, hf_gtp_sel_mode, tvb, offset, 2, ENC_BIG_ENDIAN);
  3234. return 2;
  3235. }
  3236. /* GPRS: 9.60 v7.6.0, chapter 7.9.14, page 42
  3237. * UMTS: 29.060 v4.0, chapter 7.7.13, page 50
  3238. */
  3239. static int
  3240. decode_gtp_16(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3241. {
  3242. guint16 ext_flow_label;
  3243. guint32 teid_data;
  3244. switch (gtp_version) {
  3245. case 0:
  3246. ext_flow_label = tvb_get_ntohs(tvb, offset + 1);
  3247. proto_tree_add_uint(tree, hf_gtp_ext_flow_label, tvb, offset, 3, ext_flow_label);
  3248. return 3;
  3249. case 1:
  3250. teid_data = tvb_get_ntohl(tvb, offset + 1);
  3251. proto_tree_add_uint(tree, hf_gtp_teid_data, tvb, offset, 5, teid_data);
  3252. return 5;
  3253. default:
  3254. proto_tree_add_text(tree, tvb, offset, 1, "Flow label/TEID Data I : GTP version not supported");
  3255. return 3;
  3256. }
  3257. }
  3258. /* GPRS: 9.60 v7.6.0, chapter 7.9.15, page 42
  3259. * UMTS: 29.060 v4.0, chapter 7.7.14, page 42
  3260. */
  3261. static int
  3262. decode_gtp_17(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3263. {
  3264. guint16 flow_sig;
  3265. guint32 teid_cp;
  3266. switch (gtp_version) {
  3267. case 0:
  3268. flow_sig = tvb_get_ntohs(tvb, offset + 1);
  3269. proto_tree_add_uint(tree, hf_gtp_flow_sig, tvb, offset, 3, flow_sig);
  3270. return 3;
  3271. case 1:
  3272. teid_cp = tvb_get_ntohl(tvb, offset + 1);
  3273. proto_tree_add_uint(tree, hf_gtp_teid_cp, tvb, offset, 5, teid_cp);
  3274. return 5;
  3275. default:
  3276. proto_tree_add_text(tree, tvb, offset, 1, "Flow label signalling/TEID control plane : GTP version not supported");
  3277. return 3;
  3278. }
  3279. }
  3280. /* GPRS: 9.60 v7.6.0, chapter 7.9.16, page 42
  3281. * UMTS: 29.060 v4.0, chapter 7.7.15, page 51
  3282. */
  3283. static int
  3284. decode_gtp_18(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3285. {
  3286. guint16 flow_ii;
  3287. guint32 teid_ii;
  3288. proto_tree *ext_tree_flow_ii;
  3289. proto_item *te;
  3290. switch (gtp_version) {
  3291. case 0:
  3292. te = proto_tree_add_text(tree, tvb, offset, 4, "%s", val_to_str_ext_const(GTP_EXT_FLOW_II, &gtp_val_ext, "Unknown message"));
  3293. ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_FLOW_II]);
  3294. proto_tree_add_item(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
  3295. flow_ii = tvb_get_ntohs(tvb, offset + 2);
  3296. proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_flow_ii, tvb, offset + 2, 2, flow_ii);
  3297. return 4;
  3298. case 1:
  3299. te = proto_tree_add_text(tree, tvb, offset, 6, "%s", val_to_str_ext_const(GTP_EXT_TEID_II, &gtpv1_val_ext, "Unknown message"));
  3300. ext_tree_flow_ii = proto_item_add_subtree(te, ett_gtp_flow_ii);
  3301. proto_tree_add_item(ext_tree_flow_ii, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
  3302. teid_ii = tvb_get_ntohl(tvb, offset + 2);
  3303. proto_tree_add_uint(ext_tree_flow_ii, hf_gtp_teid_ii, tvb, offset + 2, 4, teid_ii);
  3304. return 6;
  3305. default:
  3306. proto_tree_add_text(tree, tvb, offset, 1, "Flow data II/TEID Data II : GTP Version not supported");
  3307. return 4;
  3308. }
  3309. }
  3310. /* GPRS: 9.60 v7.6.0, chapter 7.9.16A, page 43
  3311. * UMTS: 29.060 v4.0, chapter 7.7.16, page 51
  3312. * Check if all ms_reason types are included
  3313. */
  3314. static int
  3315. decode_gtp_19(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3316. {
  3317. guint8 field19;
  3318. field19 = tvb_get_guint8(tvb, offset + 1);
  3319. switch (gtp_version) {
  3320. case 0:
  3321. proto_tree_add_uint(tree, hf_gtp_ms_reason, tvb, offset, 2, field19);
  3322. break;
  3323. case 1:
  3324. proto_tree_add_boolean(tree, hf_gtp_tear_ind, tvb, offset, 2, field19 & 0x01);
  3325. break;
  3326. default:
  3327. proto_tree_add_text(tree, tvb, offset, 1, "Information Element Type = 19 : GTP Version not supported");
  3328. break;
  3329. }
  3330. return 2;
  3331. }
  3332. /* GPRS: not present
  3333. * UMTS: 29.060 v4.0, chapter 7.7.17, page 51
  3334. */
  3335. static int
  3336. decode_gtp_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3337. {
  3338. guint8 nsapi;
  3339. proto_tree *ext_tree;
  3340. proto_item *te;
  3341. te = proto_tree_add_text(tree, tvb, offset, 10, "%s", val_to_str_ext_const(GTP_EXT_NSAPI, &gtp_val_ext, "Unknown message"));
  3342. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_NSAPI]);
  3343. nsapi = tvb_get_guint8(tvb, offset + 1) & 0x0F;
  3344. proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
  3345. proto_item_append_text(te, ": %u",nsapi);
  3346. return 2;
  3347. }
  3348. /* GPRS: not present
  3349. * UMTS: 29.060 v4.0, chapter 7.7.18, page 52
  3350. */
  3351. static int
  3352. decode_gtp_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3353. {
  3354. guint8 ranap;
  3355. ranap = tvb_get_guint8(tvb, offset + 1);
  3356. if ((ranap > 0) && (ranap <= 64))
  3357. proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
  3358. ranap, "%s (Radio Network Layer Cause) : %s (%u)",
  3359. val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
  3360. val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
  3361. if ((ranap > 64) && (ranap <= 80))
  3362. proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
  3363. ranap, "%s (Transport Layer Cause) : %s (%u)",
  3364. val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
  3365. val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
  3366. if ((ranap > 80) && (ranap <= 96))
  3367. proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2,
  3368. ranap, "%s (NAS Cause) : %s (%u)",
  3369. val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
  3370. val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
  3371. if ((ranap > 96) && (ranap <= 112))
  3372. proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
  3373. "%s (Protocol Cause) : %s (%u)",
  3374. val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
  3375. val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
  3376. if ((ranap > 112) && (ranap <= 128))
  3377. proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
  3378. "%s (Miscellaneous Cause) : %s (%u)",
  3379. val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
  3380. val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
  3381. if ((ranap > 128) /* && (ranap <= 255) */ )
  3382. proto_tree_add_uint_format(tree, hf_gtp_ranap_cause, tvb, offset, 2, ranap,
  3383. "%s (Non-standard Cause) : %s (%u)",
  3384. val_to_str_ext_const(GTP_EXT_RANAP_CAUSE, &gtp_val_ext, "Unknown"),
  3385. val_to_str_ext_const(ranap, &ranap_cause_type_ext, "Unknown RANAP Cause"), ranap);
  3386. return 2;
  3387. }
  3388. /* GPRS: not present
  3389. * UMTS: 29.060 v4.0, chapter 7.7.19, page 52
  3390. */
  3391. static int
  3392. decode_gtp_rab_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3393. {
  3394. proto_tree *ext_tree_rab_cntxt;
  3395. proto_item *te;
  3396. te = proto_tree_add_text(tree, tvb, offset, 10, "%s", val_to_str_ext_const(GTP_EXT_RAB_CNTXT, &gtp_val_ext, "Unknown message"));
  3397. ext_tree_rab_cntxt = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_RAB_CNTXT]);
  3398. proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
  3399. proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_dn, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
  3400. proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_gtpu_up, tvb, offset + 4, 2, ENC_BIG_ENDIAN);
  3401. proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_pdu_dn, tvb, offset + 6, 2, ENC_BIG_ENDIAN);
  3402. proto_tree_add_item(ext_tree_rab_cntxt, hf_gtp_rab_pdu_up, tvb, offset + 8, 2, ENC_BIG_ENDIAN);
  3403. return 10;
  3404. }
  3405. /* GPRS: not present
  3406. * UMTS: 29.060 v4.0, chapter 7.7.20, page 53
  3407. */
  3408. static int
  3409. decode_gtp_rp_sms(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3410. {
  3411. guint8 rp_sms;
  3412. rp_sms = tvb_get_guint8(tvb, offset + 1) & 0x07;
  3413. proto_tree_add_uint(tree, hf_gtp_rp_sms, tvb, offset, 2, rp_sms);
  3414. return 2;
  3415. }
  3416. /* GPRS: not present
  3417. * UMTS: 29.060 v4.0, chapter 7.7.21, page 53
  3418. */
  3419. static int
  3420. decode_gtp_rp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3421. {
  3422. proto_tree *ext_tree_rp;
  3423. proto_item *te;
  3424. guint8 nsapi, rp, spare;
  3425. nsapi = tvb_get_guint8(tvb, offset + 1) & 0xF0;
  3426. spare = tvb_get_guint8(tvb, offset + 1) & 0x08;
  3427. rp = tvb_get_guint8(tvb, offset + 1) & 0x07;
  3428. te = proto_tree_add_uint_format(tree, hf_gtp_rp, tvb, offset, 2, rp, "Radio Priority for NSAPI(%u) : %u", nsapi, rp);
  3429. ext_tree_rp = proto_item_add_subtree(te, ett_gtp_rp);
  3430. proto_tree_add_uint(ext_tree_rp, hf_gtp_rp_nsapi, tvb, offset + 1, 1, nsapi);
  3431. proto_tree_add_uint(ext_tree_rp, hf_gtp_rp_spare, tvb, offset + 1, 1, spare);
  3432. proto_tree_add_uint(ext_tree_rp, hf_gtp_rp, tvb, offset + 1, 1, rp);
  3433. return 2;
  3434. }
  3435. /* GPRS: not present
  3436. * UMTS: 29.060 v4.0, chapter 7.7.22, page 53
  3437. */
  3438. static int
  3439. decode_gtp_pkt_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3440. {
  3441. proto_tree *ext_tree_pkt_flow_id;
  3442. proto_item *te;
  3443. guint8 nsapi, pkt_flow_id;
  3444. nsapi = tvb_get_guint8(tvb, offset + 1) & 0x0F;
  3445. pkt_flow_id = tvb_get_guint8(tvb, offset + 2);
  3446. te = proto_tree_add_uint_format(tree, hf_gtp_pkt_flow_id, tvb, offset, 3, pkt_flow_id, "Packet Flow ID for NSAPI(%u) : %u", nsapi, pkt_flow_id);
  3447. ext_tree_pkt_flow_id = proto_item_add_subtree(te, ett_gtp_pkt_flow_id);
  3448. proto_tree_add_item(ext_tree_pkt_flow_id, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
  3449. proto_tree_add_uint_format(ext_tree_pkt_flow_id, hf_gtp_pkt_flow_id, tvb,
  3450. offset + 2, 1, pkt_flow_id, "%s : %u", val_to_str_ext_const(GTP_EXT_PKT_FLOW_ID, &gtp_val_ext, "Unknown message"), pkt_flow_id);
  3451. return 3;
  3452. }
  3453. /* GPRS: not present
  3454. * UMTS: 29.060 v4.0, chapter 7.7.23, page 53
  3455. * TODO: Differenciate these uints?
  3456. */
  3457. static int
  3458. decode_gtp_chrg_char(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3459. {
  3460. guint16 chrg_char;
  3461. proto_item *te;
  3462. proto_tree *ext_tree_chrg_char;
  3463. chrg_char = tvb_get_ntohs(tvb, offset + 1);
  3464. te = proto_tree_add_uint(tree, hf_gtp_chrg_char, tvb, offset, 3, chrg_char);
  3465. /*"%s: %x", val_to_str_ext_const (GTP_EXT_CHRG_CHAR, &gtp_val_ext, "Unknown message"), chrg_char); */
  3466. ext_tree_chrg_char = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_CHRG_CHAR]);
  3467. proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_s, tvb, offset + 1, 2, chrg_char);
  3468. proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_n, tvb, offset + 1, 2, chrg_char);
  3469. proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_p, tvb, offset + 1, 2, chrg_char);
  3470. proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_f, tvb, offset + 1, 2, chrg_char);
  3471. proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_h, tvb, offset + 1, 2, chrg_char);
  3472. proto_tree_add_uint(ext_tree_chrg_char, hf_gtp_chrg_char_r, tvb, offset + 1, 2, chrg_char);
  3473. return 3;
  3474. }
  3475. /* GPRS: not present
  3476. * UMTS: 29.060 v4.0, chapter 7.7.24, page
  3477. */
  3478. static int
  3479. decode_gtp_trace_ref(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3480. {
  3481. guint16 trace_ref;
  3482. trace_ref = tvb_get_ntohs(tvb, offset + 1);
  3483. proto_tree_add_uint(tree, hf_gtp_trace_ref, tvb, offset, 3, trace_ref);
  3484. return 3;
  3485. }
  3486. /* GPRS: not present
  3487. * UMTS: 29.060 v4.0, chapter 7.7.25, page
  3488. */
  3489. static int
  3490. decode_gtp_trace_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3491. {
  3492. guint16 trace_type;
  3493. trace_type = tvb_get_ntohs(tvb, offset + 1);
  3494. proto_tree_add_uint(tree, hf_gtp_trace_type, tvb, offset, 3, trace_type);
  3495. return 3;
  3496. }
  3497. /* GPRS: 9.60 v7.6.0, chapter 7.9.16A
  3498. * UMTS: 29.060 v4.0, chapter 7.7.25A, page
  3499. */
  3500. static int
  3501. decode_gtp_ms_reason(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3502. {
  3503. guint8 reason;
  3504. reason = tvb_get_guint8(tvb, offset + 1);
  3505. /* Reason for Absence is defined in 3GPP TS 23.040 */
  3506. proto_tree_add_uint(tree, hf_gtp_ms_reason, tvb, offset, 2, reason);
  3507. return 2;
  3508. }
  3509. /* GPRS: ?
  3510. * UMTS: 29.060 v6.11.0, chapter 7.7.25B
  3511. * Radio Priority LCS
  3512. */
  3513. static int
  3514. decode_gtp_ra_prio_lcs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3515. {
  3516. guint16 length;
  3517. proto_tree *ext_tree;
  3518. proto_item *te;
  3519. length = tvb_get_ntohs(tvb, offset + 1);
  3520. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_RA_PRIO_LCS, &gtp_val_ext, "Unknown"));
  3521. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_RA_PRIO_LCS]);
  3522. offset++;
  3523. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  3524. offset = offset + 2;
  3525. proto_tree_add_item(ext_tree, hf_gtp_ra_prio_lcs, tvb, offset, 1, ENC_BIG_ENDIAN);
  3526. return 3 + length;
  3527. }
  3528. /* GPRS: 12.15 v7.6.0, chapter 7.3.3, page 45
  3529. * UMTS: 33.015
  3530. */
  3531. static int
  3532. decode_gtp_tr_comm(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3533. {
  3534. guint8 tr_command;
  3535. tr_command = tvb_get_guint8(tvb, offset + 1);
  3536. proto_tree_add_uint(tree, hf_gtp_tr_comm, tvb, offset, 2, tr_command);
  3537. return 2;
  3538. }
  3539. /* GPRS: 9.60 v7.6.0, chapter 7.9.17, page 43
  3540. * UMTS: 29.060 v4.0, chapter 7.7.26, page 55
  3541. */
  3542. static int
  3543. decode_gtp_chrg_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3544. {
  3545. guint32 chrg_id;
  3546. chrg_id = tvb_get_ntohl(tvb, offset + 1);
  3547. proto_tree_add_uint(tree, hf_gtp_chrg_id, tvb, offset, 5, chrg_id);
  3548. return 5;
  3549. }
  3550. /* GPRS: 9.60 v7.6.0, chapter 7.9.18, page 43
  3551. * UMTS: 29.060 v4.0, chapter 7.7.27, page 55
  3552. */
  3553. static int
  3554. decode_gtp_user_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  3555. {
  3556. guint16 length;
  3557. guint8 pdp_typ, pdp_org;
  3558. guint32 addr_ipv4;
  3559. struct e_in6_addr addr_ipv6;
  3560. proto_tree *ext_tree_user;
  3561. proto_item *te;
  3562. length = tvb_get_ntohs(tvb, offset + 1);
  3563. pdp_org = tvb_get_guint8(tvb, offset + 3) & 0x0F;
  3564. pdp_typ = tvb_get_guint8(tvb, offset + 4);
  3565. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s (%s/%s)",
  3566. val_to_str_ext_const(GTP_EXT_USER_ADDR, &gtp_val_ext, "Unknown message"),
  3567. val_to_str_const(pdp_org, pdp_org_type, "Unknown PDP Organization"),
  3568. val_to_str_const(pdp_typ, pdp_type, "Unknown PDP Type"));
  3569. ext_tree_user = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_USER_ADDR]);
  3570. proto_tree_add_text(ext_tree_user, tvb, offset + 1, 2, "Length : %u", length);
  3571. proto_tree_add_uint(ext_tree_user, hf_gtp_user_addr_pdp_org, tvb, offset + 3, 1, pdp_org);
  3572. proto_tree_add_uint(ext_tree_user, hf_gtp_user_addr_pdp_type, tvb, offset + 4, 1, pdp_typ);
  3573. if (length == 2) {
  3574. if ((pdp_org == 0) && (pdp_typ == 1))
  3575. proto_item_append_text(te, " (Point to Point Protocol)");
  3576. else if (pdp_typ == 2)
  3577. proto_item_append_text(te, " (Octet Stream Protocol)");
  3578. } else if (length > 2) {
  3579. switch (pdp_typ) {
  3580. case 0x21:
  3581. addr_ipv4 = tvb_get_ipv4(tvb, offset + 5);
  3582. proto_tree_add_ipv4(ext_tree_user, hf_gtp_user_ipv4, tvb, offset + 5, 4, addr_ipv4);
  3583. proto_item_append_text(te, " : %s", ip_to_str((guint8 *) & addr_ipv4));
  3584. break;
  3585. case 0x57:
  3586. tvb_get_ipv6(tvb, offset + 5, &addr_ipv6);
  3587. proto_tree_add_ipv6(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 5, 16, (guint8 *) & addr_ipv6);
  3588. proto_item_append_text(te, " : %s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
  3589. break;
  3590. case 0x8d:
  3591. addr_ipv4 = tvb_get_ipv4(tvb, offset + 5);
  3592. proto_tree_add_ipv4(ext_tree_user, hf_gtp_user_ipv4, tvb, offset + 5, 4, addr_ipv4);
  3593. tvb_get_ipv6(tvb, offset + 9, &addr_ipv6);
  3594. proto_tree_add_ipv6(ext_tree_user, hf_gtp_user_ipv6, tvb, offset + 9, 16, (guint8 *) & addr_ipv6);
  3595. proto_item_append_text(te, " : %s / %s", ip_to_str((guint8 *) & addr_ipv4),
  3596. ip6_to_str((struct e_in6_addr *) &addr_ipv6));
  3597. break;
  3598. }
  3599. } else
  3600. proto_item_append_text(te, " : empty PDP Address");
  3601. return 3 + length;
  3602. }
  3603. static int
  3604. decode_triplet(tvbuff_t * tvb, int offset, proto_tree * tree, guint16 count)
  3605. {
  3606. proto_tree *ext_tree_trip;
  3607. proto_item *te_trip;
  3608. guint16 i;
  3609. for (i = 0; i < count; i++) {
  3610. te_trip = proto_tree_add_text(tree, tvb, offset + i * 28, 28, "Triplet no%x", i);
  3611. ext_tree_trip = proto_item_add_subtree(te_trip, ett_gtp_trip);
  3612. proto_tree_add_text(ext_tree_trip, tvb, offset + i * 28, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset + i * 28, 16));
  3613. proto_tree_add_text(ext_tree_trip, tvb, offset + i * 28 + 16, 4, "SRES: %s", tvb_bytes_to_str(tvb, offset + i * 28 + 16, 4));
  3614. proto_tree_add_text(ext_tree_trip, tvb, offset + i * 28 + 20, 8, "Kc: %s", tvb_bytes_to_str(tvb, offset + i * 28 + 20, 8));
  3615. }
  3616. return count * 28;
  3617. }
  3618. /* adjust - how many bytes before quintuplet should be highlighted
  3619. */
  3620. static int
  3621. decode_quintuplet(tvbuff_t * tvb, int offset, proto_tree * tree, guint16 count)
  3622. {
  3623. proto_tree *ext_tree_quint;
  3624. proto_item *te_quint;
  3625. guint16 q_offset, i;
  3626. guint8 xres_len, auth_len;
  3627. q_offset = 0;
  3628. for (i = 0; i < count; i++) {
  3629. te_quint = proto_tree_add_text(tree, tvb, offset, -1, "Quintuplet #%x", i + 1);
  3630. ext_tree_quint = proto_item_add_subtree(te_quint, ett_gtp_quint);
  3631. proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset, 16));
  3632. q_offset = q_offset + 16;
  3633. xres_len = tvb_get_guint8(tvb, offset + q_offset);
  3634. proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 1, "XRES length: %u", xres_len);
  3635. q_offset++;
  3636. proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, xres_len, "XRES: %s", tvb_bytes_to_str(tvb, offset + q_offset, xres_len));
  3637. q_offset = q_offset + xres_len;
  3638. proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 16, "Quintuplet Ciphering Key: %s", tvb_bytes_to_str(tvb, offset + q_offset, 16));
  3639. q_offset = q_offset + 16;
  3640. proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 16, "Quintuplet Integrity Key: %s", tvb_bytes_to_str(tvb, offset + q_offset, 16));
  3641. q_offset = q_offset + 16;
  3642. auth_len = tvb_get_guint8(tvb, offset + q_offset);
  3643. proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, 1, "Authentication length: %u", auth_len);
  3644. q_offset++;
  3645. proto_tree_add_text(ext_tree_quint, tvb, offset + q_offset, auth_len, "AUTH: %s", tvb_bytes_to_str(tvb, offset + q_offset, auth_len));
  3646. q_offset = q_offset + auth_len;
  3647. proto_item_set_end(te_quint, tvb, offset + q_offset);
  3648. }
  3649. return q_offset;
  3650. }
  3651. /* GPRS: 9.60 v7.6.0, chapter 7.9.19 page
  3652. * UMTS: 29.060 v4.0, chapter 7.7.28 page 57
  3653. * TODO: - check if for quintuplets first 2 bytes are length, according to AuthQuint
  3654. * - finish displaying last 3 parameters
  3655. */
  3656. static int
  3657. decode_gtp_mm_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree)
  3658. {
  3659. guint16 length, quint_len, con_len;
  3660. guint8 count, sec_mode, len, iei;
  3661. proto_tree *ext_tree_mm;
  3662. proto_item *te;
  3663. proto_item *tf = NULL;
  3664. proto_tree *tf_tree = NULL;
  3665. te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_ext_const(GTP_EXT_MM_CNTXT, &gtp_val_ext, "Unknown message"));
  3666. ext_tree_mm = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_MM_CNTXT]);
  3667. /* Octet 2 - 3 */
  3668. length = tvb_get_ntohs(tvb, offset + 1);
  3669. if (length < 1)
  3670. return 3;
  3671. /* Octet 4 (cksn)*/
  3672. /* Octet 5 */
  3673. sec_mode = (tvb_get_guint8(tvb, offset + 4) >> 6) & 0x03;
  3674. count = (tvb_get_guint8(tvb, offset + 4) >> 3) & 0x07;
  3675. proto_tree_add_text(ext_tree_mm, tvb, offset + 1, 2, "Length: %x", length);
  3676. if (gtp_version == 0)
  3677. sec_mode = 1;
  3678. switch (sec_mode) {
  3679. case 0: /* Used cipher value, UMTS keys and Quintuplets */
  3680. proto_tree_add_item(ext_tree_mm, hf_gtp_cksn_ksi, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
  3681. proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
  3682. proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
  3683. proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
  3684. proto_tree_add_text(ext_tree_mm, tvb, offset + 5, 16, "Ciphering key CK: %s", tvb_bytes_to_str(tvb, offset + 5, 16));
  3685. proto_tree_add_text(ext_tree_mm, tvb, offset + 21, 16, "Integrity key IK: %s", tvb_bytes_to_str(tvb, offset + 21, 16));
  3686. quint_len = tvb_get_ntohs(tvb, offset + 37);
  3687. proto_tree_add_text(ext_tree_mm, tvb, offset + 37, 2, "Quintuplets length: 0x%x (%u)", quint_len, quint_len);
  3688. offset = offset + decode_quintuplet(tvb, offset + 39, ext_tree_mm, count) + 39;
  3689. break;
  3690. case 1: /* GSM key and triplets */
  3691. proto_tree_add_item(ext_tree_mm, hf_gtp_cksn, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
  3692. if (gtp_version != 0)
  3693. proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
  3694. proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
  3695. proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
  3696. proto_tree_add_text(ext_tree_mm, tvb, offset + 5, 8, "Ciphering key Kc: %s", tvb_bytes_to_str(tvb, offset + 5, 8));
  3697. offset = offset + decode_triplet(tvb, offset + 13, ext_tree_mm, count) + 13;
  3698. break;
  3699. case 2: /* UMTS key and quintuplets */
  3700. proto_tree_add_item(ext_tree_mm, hf_gtp_ksi, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
  3701. proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
  3702. proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
  3703. proto_tree_add_text(ext_tree_mm, tvb, offset + 5, 16, "Ciphering key CK: %s", tvb_bytes_to_str(tvb, offset + 5, 16));
  3704. proto_tree_add_text(ext_tree_mm, tvb, offset + 21, 16, "Integrity key IK: %s", tvb_bytes_to_str(tvb, offset + 21, 16));
  3705. quint_len = tvb_get_ntohs(tvb, offset + 37);
  3706. proto_tree_add_text(ext_tree_mm, tvb, offset + 37, 2, "Quintuplets length: 0x%x (%u)", quint_len, quint_len);
  3707. offset = offset + decode_quintuplet(tvb, offset + 39, ext_tree_mm, count) + 39;
  3708. break;
  3709. case 3: /* GSM key and quintuplets */
  3710. proto_tree_add_item(ext_tree_mm, hf_gtp_cksn, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
  3711. proto_tree_add_item(ext_tree_mm, hf_gtp_security_mode, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
  3712. proto_tree_add_item(ext_tree_mm, hf_gtp_no_of_vectors, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
  3713. proto_tree_add_item(ext_tree_mm, hf_gtp_cipher_algorithm, tvb, offset + 4, 1, ENC_BIG_ENDIAN);
  3714. proto_tree_add_text(ext_tree_mm, tvb, offset + 5, 8,
  3715. "Ciphering key Kc: %s", tvb_bytes_to_str(tvb, offset + 5, 8));
  3716. quint_len = tvb_get_ntohs(tvb, offset + 13);
  3717. proto_tree_add_text(ext_tree_mm, tvb, offset + 13, 2, "Quintuplets length: 0x%x (%u)", quint_len, quint_len);
  3718. offset = offset + decode_quintuplet(tvb, offset + 15, ext_tree_mm, count) + 15;
  3719. break;
  3720. default:
  3721. break;
  3722. }
  3723. /*
  3724. * 3GPP TS 24.008 10.5.5.6 ( see packet-gsm_a.c )
  3725. */
  3726. de_gmm_drx_param(tvb, ext_tree_mm, pinfo, offset, 2, NULL, 0);
  3727. offset = offset + 2;
  3728. len = tvb_get_guint8(tvb, offset);
  3729. tf = proto_tree_add_text(ext_tree_mm, tvb, offset, len + 1, "MS Network Capability");
  3730. tf_tree = proto_item_add_subtree(tf, ett_gtp_net_cap);
  3731. proto_tree_add_text(tf_tree, tvb, offset, 1, "Length of MS network capability contents: %u", len);
  3732. offset++;
  3733. /*
  3734. * GPP TS 24.008 10.5.5.12 ( see packet-gsm_a.c )
  3735. */
  3736. de_gmm_ms_net_cap(tvb, tf_tree, pinfo, offset, len, NULL, 0);
  3737. offset = offset + len;
  3738. /* 3GPP TS 29.060 version 9.4.0 Release 9
  3739. * The two octets Container Length holds the length of the Container, excluding the Container Length octets.
  3740. * Container contains one or several optional information elements as described in the clause "Overview", from the clause
  3741. * "General message format and information elements coding" in 3GPP TS 24.008 [5]. For the definition of the IEI see
  3742. * table 47a, "IEIs for information elements used in the container". The IMEISV shall, if available, be included in the
  3743. * Container. The IMEISV is included in the Mobile identity IE. If Container is not included, its Length field value shall
  3744. * be set to 0. If the MS is emergency attached and the MS is UICCless or the IMSI is unauthenticated, the International
  3745. * Mobile Equipment Identity (IMEI) shall be used as the MS identity.
  3746. *
  3747. * Table 47A: IEIs for information elements used in the container
  3748. * IEI Information element
  3749. * 0x23 Mobile identity
  3750. *
  3751. * NOTE: In 3GPP TS 24.008 [5] the IEI definition is
  3752. * message dependent. The table is added to
  3753. * have a unique definition in the present
  3754. * document for the used IEI in the MMcontext.
  3755. */
  3756. con_len = tvb_get_ntohs(tvb, offset);
  3757. proto_tree_add_text(ext_tree_mm, tvb, offset, 2, "Container length: %u", con_len);
  3758. offset = offset + 2;
  3759. if (con_len > 0) {
  3760. proto_tree_add_text(ext_tree_mm, tvb, offset, con_len, "Container");
  3761. iei = tvb_get_guint8(tvb,offset);
  3762. if (iei == 0x23) {
  3763. proto_tree_add_text(ext_tree_mm, tvb, offset, 1, "Mobile identity IEI %u",iei);
  3764. offset++;
  3765. len = tvb_get_guint8(tvb,offset);
  3766. proto_tree_add_text(ext_tree_mm, tvb, offset, 1, "Length %u",len);
  3767. offset++;
  3768. de_mid(tvb, ext_tree_mm, pinfo, offset, len, NULL, 0);
  3769. } else {
  3770. proto_tree_add_text(ext_tree_mm, tvb, offset, 1, "Unknown IEI %u - Later spec than TS 29.060 9.4.0 used?",iei);
  3771. }
  3772. }
  3773. return 3 + length;
  3774. }
  3775. /* Function to extract the value of an hexadecimal octet. Only the lower
  3776. * nybble will be non-zero in the output.
  3777. * */
  3778. static guint8
  3779. hex2dec(guint8 x)
  3780. {
  3781. if ((x >= 'a') && (x <= 'f'))
  3782. x = x - 'a' + 10;
  3783. else if ((x >= 'A') && (x <= 'F'))
  3784. x = x - 'A' + 10;
  3785. else if ((x >= '0') && (x <= '9'))
  3786. x = x - '0';
  3787. else
  3788. x = 0;
  3789. return x;
  3790. }
  3791. /* Wrapper function to add UTF-8 decoding for QoS attributes in
  3792. * RADIUS messages.
  3793. * */
  3794. static guint8
  3795. wrapped_tvb_get_guint8(tvbuff_t * tvb, int offset, int type)
  3796. {
  3797. if (type == 2)
  3798. return (hex2dec(tvb_get_guint8(tvb, offset)) << 4 | hex2dec(tvb_get_guint8(tvb, offset + 1)));
  3799. else
  3800. return tvb_get_guint8(tvb, offset);
  3801. }
  3802. /* WARNING : actually length is coded on 2 octets for QoS profile but on 1 octet for PDP Context!
  3803. * so type means length of length :-)
  3804. *
  3805. * WARNING :) type does not mean length of length any more... see below for
  3806. * type = 3!
  3807. */
  3808. static int
  3809. decode_qos_umts(tvbuff_t * tvb, int offset, proto_tree * tree, const gchar * qos_str, guint8 type)
  3810. {
  3811. guint length;
  3812. guint8 al_ret_priority;
  3813. guint8 delay, reliability, peak, precedence, mean, spare1, spare2, spare3;
  3814. guint8 traf_class, del_order, del_err_sdu;
  3815. guint8 max_sdu_size, max_ul, max_dl, max_ul_ext, max_dl_ext;
  3816. guint8 res_ber, sdu_err_ratio;
  3817. guint8 trans_delay, traf_handl_prio;
  3818. guint8 guar_ul, guar_dl, guar_ul_ext, guar_dl_ext;
  3819. guint8 src_stat_desc, sig_ind;
  3820. proto_tree *ext_tree_qos, *ext_tree_qos_arp;
  3821. proto_item *te;
  3822. int mss, mu, md, gu, gd;
  3823. guint8 arp, qci;
  3824. guint32 apn_ambr;
  3825. guint64 br;
  3826. /* Will keep if the input is UTF-8 encoded (as in RADIUS messages).
  3827. * If 1, input is *not* UTF-8 encoded (i.e. each input octet corresponds
  3828. * to one byte to be dissected).
  3829. * If 2, input is UTF-8 encoded (i.e. each *couple* of input octets
  3830. * corresponds to one byte to be dissected)
  3831. * */
  3832. guint8 utf8_type = 1;
  3833. /* Will keep the release indicator as indicated in the RADIUS message */
  3834. guint8 rel_ind = 0;
  3835. /* In RADIUS messages the QoS has a version field of two octets prepended.
  3836. * As of 29.061 v.3.a.0, there is an hyphen between "Release Indicator" and
  3837. * <release specific QoS IE UTF-8 encoding>. Even if it sounds rather
  3838. * inconsistent and unuseful, I will check hyphen presence here and
  3839. * will signal its presence.
  3840. * */
  3841. guint8 hyphen;
  3842. /* Will keep the value that will be returned
  3843. * */
  3844. int retval = 0;
  3845. switch (type) {
  3846. case 1:
  3847. length = tvb_get_guint8(tvb, offset);
  3848. te = proto_tree_add_text(tree, tvb, offset, length + 1, "%s", qos_str);
  3849. ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
  3850. proto_tree_add_text(ext_tree_qos, tvb, offset, 1, "Length: %u", length);
  3851. offset++;
  3852. retval = length + 1;
  3853. break;
  3854. case 2:
  3855. length = tvb_get_ntohs(tvb, offset + 1);
  3856. te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", qos_str);
  3857. ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
  3858. proto_tree_add_text(ext_tree_qos, tvb, offset + 1, 2, "Length: %u", length);
  3859. offset += 3; /* +1 because of first 0x86 byte for UMTS QoS */
  3860. retval = length + 3;
  3861. break;
  3862. case 3:
  3863. /* For QoS inside RADIUS Client messages from GGSN/P-GW */
  3864. utf8_type = 2;
  3865. /* The field in the RADIUS message is the length of the tvb we were given */
  3866. length = tvb_length(tvb);
  3867. te = proto_tree_add_text(tree, tvb, offset, length, "%s", qos_str);
  3868. ext_tree_qos = proto_item_add_subtree(te, ett_gtp_qos);
  3869. rel_ind = wrapped_tvb_get_guint8(tvb, offset, 2);
  3870. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_version, tvb, offset, 2, rel_ind);
  3871. /* Hyphen handling */
  3872. hyphen = tvb_get_guint8(tvb, offset + 2);
  3873. if (hyphen == ((guint8) '-')) {
  3874. /* Hyphen is present, put in protocol tree */
  3875. proto_tree_add_text(ext_tree_qos, tvb, offset + 2, 1, "Hyphen separator: -");
  3876. offset++; /* "Get rid" of hyphen */
  3877. }
  3878. /* Now, we modify offset here and in order to use type later
  3879. * effectively.*/
  3880. offset++;
  3881. length -= offset;
  3882. length /= 2;
  3883. retval = length + 2; /* Actually, will be ignored. */
  3884. break;
  3885. default:
  3886. /* XXX - what should we do with the length here? */
  3887. length = 0;
  3888. retval = 0;
  3889. ext_tree_qos = NULL;
  3890. break;
  3891. }
  3892. if ((type == 3) && (rel_ind == 8)) {
  3893. /* Release 8 or higher P-GW QoS profile */
  3894. offset++;
  3895. arp = wrapped_tvb_get_guint8(tvb, offset, 2);
  3896. te = proto_tree_add_text(ext_tree_qos, tvb, offset, 2, "Allocation/Retention Priority");
  3897. ext_tree_qos_arp = proto_item_add_subtree(te, ett_gtp_qos_arp);
  3898. proto_tree_add_boolean(ext_tree_qos_arp, hf_gtp_qos_arp_pci, tvb, offset, 2, arp);
  3899. proto_tree_add_uint(ext_tree_qos_arp, hf_gtp_qos_arp_pl, tvb, offset, 2, arp);
  3900. proto_tree_add_boolean(ext_tree_qos_arp, hf_gtp_qos_arp_pvi, tvb, offset, 2, arp);
  3901. offset += 2;
  3902. qci = wrapped_tvb_get_guint8(tvb, offset, 2);
  3903. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_qci, tvb, offset, 2, qci);
  3904. offset += 2;
  3905. if (qci <= 4) {
  3906. /* GBR QCI */
  3907. br = ((guint64)wrapped_tvb_get_guint8(tvb, offset , 2) << 32) |
  3908. ((guint64)wrapped_tvb_get_guint8(tvb, offset+2, 2) << 24) |
  3909. ((guint64)wrapped_tvb_get_guint8(tvb, offset+4, 2) << 16) |
  3910. ((guint64)wrapped_tvb_get_guint8(tvb, offset+6, 2) << 8) |
  3911. (guint64)wrapped_tvb_get_guint8(tvb, offset+8, 2);
  3912. proto_tree_add_uint64(ext_tree_qos, hf_gtp_qos_ul_mbr, tvb, offset, 10, br);
  3913. offset += 10;
  3914. br = ((guint64)wrapped_tvb_get_guint8(tvb, offset , 2) << 32) |
  3915. ((guint64)wrapped_tvb_get_guint8(tvb, offset+2, 2) << 24) |
  3916. ((guint64)wrapped_tvb_get_guint8(tvb, offset+4, 2) << 16) |
  3917. ((guint64)wrapped_tvb_get_guint8(tvb, offset+6, 2) << 8) |
  3918. (guint64)wrapped_tvb_get_guint8(tvb, offset+8, 2);
  3919. proto_tree_add_uint64(ext_tree_qos, hf_gtp_qos_dl_mbr, tvb, offset, 10, br);
  3920. offset += 10;
  3921. br = ((guint64)wrapped_tvb_get_guint8(tvb, offset , 2) << 32) |
  3922. ((guint64)wrapped_tvb_get_guint8(tvb, offset+2, 2) << 24) |
  3923. ((guint64)wrapped_tvb_get_guint8(tvb, offset+4, 2) << 16) |
  3924. ((guint64)wrapped_tvb_get_guint8(tvb, offset+6, 2) << 8) |
  3925. (guint64)wrapped_tvb_get_guint8(tvb, offset+8, 2);
  3926. proto_tree_add_uint64(ext_tree_qos, hf_gtp_qos_ul_gbr, tvb, offset, 10, br);
  3927. offset += 10;
  3928. br = ((guint64)wrapped_tvb_get_guint8(tvb, offset , 2) << 32) |
  3929. ((guint64)wrapped_tvb_get_guint8(tvb, offset+2, 2) << 24) |
  3930. ((guint64)wrapped_tvb_get_guint8(tvb, offset+4, 2) << 16) |
  3931. ((guint64)wrapped_tvb_get_guint8(tvb, offset+6, 2) << 8) |
  3932. (guint64)wrapped_tvb_get_guint8(tvb, offset+8, 2);
  3933. proto_tree_add_uint64(ext_tree_qos, hf_gtp_qos_dl_gbr, tvb, offset, 10, br);
  3934. } else {
  3935. /* non GBR QCI */
  3936. apn_ambr = (wrapped_tvb_get_guint8(tvb, offset , 2) << 24) |
  3937. (wrapped_tvb_get_guint8(tvb, offset+2, 2) << 16) |
  3938. (wrapped_tvb_get_guint8(tvb, offset+4, 2) << 8) |
  3939. wrapped_tvb_get_guint8(tvb, offset+6, 2);
  3940. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_ul_apn_ambr, tvb, offset, 8, apn_ambr);
  3941. offset += 8;
  3942. apn_ambr = (wrapped_tvb_get_guint8(tvb, offset , 2) << 24) |
  3943. (wrapped_tvb_get_guint8(tvb, offset+2, 2) << 16) |
  3944. (wrapped_tvb_get_guint8(tvb, offset+4, 2) << 8) |
  3945. wrapped_tvb_get_guint8(tvb, offset+6, 2);
  3946. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_dl_apn_ambr, tvb, offset, 8, apn_ambr);
  3947. }
  3948. return retval;
  3949. }
  3950. /* In RADIUS messages there is no allocation-retention priority
  3951. * so I don't need to wrap the following call to tvb_get_guint8
  3952. * */
  3953. al_ret_priority = tvb_get_guint8(tvb, offset);
  3954. /* All calls are wrapped to take into account the possibility that the
  3955. * input is UTF-8 encoded. If utf8_type is equal to 1, the final value
  3956. * of the offset will be the same as in the previous version of this
  3957. * dissector, and the wrapped function will serve as a dumb wrapper;
  3958. * otherwise, if utf_8_type is 2, the offset is correctly shifted by
  3959. * two bytes for needed shift, and the wrapped function will unencode
  3960. * two values from the input.
  3961. * */
  3962. spare1 = wrapped_tvb_get_guint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE1_MASK;
  3963. delay = wrapped_tvb_get_guint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_DELAY_MASK;
  3964. reliability = wrapped_tvb_get_guint8(tvb, offset + (1 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_RELIABILITY_MASK;
  3965. peak = wrapped_tvb_get_guint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_PEAK_MASK;
  3966. spare2 = wrapped_tvb_get_guint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE2_MASK;
  3967. precedence = wrapped_tvb_get_guint8(tvb, offset + (2 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_PRECEDENCE_MASK;
  3968. spare3 = wrapped_tvb_get_guint8(tvb, offset + (3 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SPARE3_MASK;
  3969. mean = wrapped_tvb_get_guint8(tvb, offset + (3 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_MEAN_MASK;
  3970. /* In RADIUS messages there is no allocation-retention priority */
  3971. if (type != 3)
  3972. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_al_ret_priority, tvb, offset, 1, al_ret_priority);
  3973. /* All additions must take care of the fact that QoS fields in RADIUS
  3974. * messages are UTF-8 encoded, so we have to use the same trick as above.
  3975. * */
  3976. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare1, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, spare1);
  3977. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_delay, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, delay);
  3978. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_reliability, tvb, offset + (1 - 1) * utf8_type + 1, utf8_type, reliability);
  3979. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_peak, tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, peak);
  3980. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare2, tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, spare2);
  3981. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_precedence, tvb, offset + (2 - 1) * utf8_type + 1, utf8_type, precedence);
  3982. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_spare3, tvb, offset + (3 - 1) * utf8_type + 1, utf8_type, spare3);
  3983. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_mean, tvb, offset + (3 - 1) * utf8_type + 1, utf8_type, mean);
  3984. /* TS 24.008 V 7.8.0
  3985. * The quality of service is a type 4 information element with a minimum length of 14 octets and a maximum length of 18
  3986. * octets. The QoS requested by the MS shall be encoded both in the QoS attributes specified in octets 3-5 and in the QoS
  3987. * attributes specified in octets 6-14.
  3988. * In the MS to network direction and in the network to MS direction the following applies:
  3989. * - Octets 15-18 are optional. If octet 15 is included, then octet 16 shall also be included, and octets 17 and 18 may
  3990. * be included.
  3991. * - If octet 17 is included, then octet 18 shall also be included.
  3992. * - A QoS IE received without octets 6-18, without octets 14-18, without octets 15-18, or without octets 17-18 shall
  3993. * be accepted by the receiving entity.
  3994. */
  3995. if (length > 4) {
  3996. /* See above for the need of wrapping
  3997. *
  3998. */
  3999. /* Octet 6 */
  4000. traf_class = wrapped_tvb_get_guint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_TRAF_CLASS_MASK;
  4001. del_order = wrapped_tvb_get_guint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_DEL_ORDER_MASK;
  4002. del_err_sdu = wrapped_tvb_get_guint8(tvb, offset + (4 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_DEL_ERR_SDU_MASK;
  4003. max_sdu_size = wrapped_tvb_get_guint8(tvb, offset + (5 - 1) * utf8_type + 1, utf8_type);
  4004. max_ul = wrapped_tvb_get_guint8(tvb, offset + (6 - 1) * utf8_type + 1, utf8_type);
  4005. max_dl = wrapped_tvb_get_guint8(tvb, offset + (7 - 1) * utf8_type + 1, utf8_type);
  4006. res_ber = wrapped_tvb_get_guint8(tvb, offset + (8 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_RES_BER_MASK;
  4007. sdu_err_ratio = wrapped_tvb_get_guint8(tvb, offset + (8 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SDU_ERR_RATIO_MASK;
  4008. trans_delay = wrapped_tvb_get_guint8(tvb, offset + (9 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_TRANS_DELAY_MASK;
  4009. traf_handl_prio = wrapped_tvb_get_guint8(tvb, offset + (9 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK;
  4010. guar_ul = wrapped_tvb_get_guint8(tvb, offset + (10 - 1) * utf8_type + 1, utf8_type);
  4011. /* Octet 13 */
  4012. guar_dl = wrapped_tvb_get_guint8(tvb, offset + (11 - 1) * utf8_type + 1, utf8_type);
  4013. src_stat_desc = 0;
  4014. sig_ind = 0;
  4015. max_dl_ext = 0;
  4016. guar_dl_ext = 0;
  4017. max_ul_ext = 0;
  4018. guar_ul_ext = 0;
  4019. if (length > 13) {
  4020. src_stat_desc = wrapped_tvb_get_guint8(tvb, offset + (12 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SRC_STAT_DESC_MASK;
  4021. sig_ind = wrapped_tvb_get_guint8(tvb, offset + (12 - 1) * utf8_type + 1, utf8_type) & GTP_EXT_QOS_SIG_IND_MASK;
  4022. }
  4023. if (length > 14) {
  4024. max_dl_ext = wrapped_tvb_get_guint8(tvb, offset + (13 - 1) * utf8_type + 1, utf8_type);
  4025. guar_dl_ext = wrapped_tvb_get_guint8(tvb, offset + (14 - 1) * utf8_type + 1, utf8_type);
  4026. }
  4027. if (length > 16) {
  4028. max_ul_ext = wrapped_tvb_get_guint8(tvb, offset + (15 - 1) * utf8_type + 1, utf8_type);
  4029. guar_ul_ext = wrapped_tvb_get_guint8(tvb, offset + (16 - 1) * utf8_type + 1, utf8_type);
  4030. }
  4031. /*
  4032. * See above comments for the changes
  4033. */
  4034. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_traf_class, tvb, offset + (4 - 1) * utf8_type + 1, utf8_type, traf_class);
  4035. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_del_order, tvb, offset + (4 - 1) * utf8_type + 1, utf8_type, del_order);
  4036. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_del_err_sdu, tvb, offset + (4 - 1) * utf8_type + 1, utf8_type, del_err_sdu);
  4037. if (max_sdu_size == 0 || max_sdu_size > 150)
  4038. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_sdu_size, tvb, offset + (5 - 1) * utf8_type + 1, utf8_type, max_sdu_size);
  4039. if ((max_sdu_size > 0) && (max_sdu_size <= 150)) {
  4040. mss = max_sdu_size * 10;
  4041. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_sdu_size, tvb, offset + (5 - 1) * utf8_type + 1, utf8_type, mss,
  4042. "Maximum SDU size: %u octets", mss);
  4043. }
  4044. if (max_ul == 0 || max_ul == 255)
  4045. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, max_ul);
  4046. if ((max_ul > 0) && (max_ul <= 63))
  4047. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, max_ul,
  4048. "Maximum bit rate for uplink: %u kbps", max_ul);
  4049. if ((max_ul > 63) && (max_ul <= 127)) {
  4050. mu = 64 + (max_ul - 64) * 8;
  4051. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, mu,
  4052. "Maximum bit rate for uplink: %u kbps", mu);
  4053. }
  4054. if ((max_ul > 127) && (max_ul <= 254)) {
  4055. mu = 576 + (max_ul - 128) * 64;
  4056. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (6 - 1) * utf8_type + 1, utf8_type, mu,
  4057. "Maximum bit rate for uplink: %u kbps", mu);
  4058. }
  4059. if (max_dl == 0 || max_dl == 255)
  4060. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, max_dl);
  4061. if ((max_dl > 0) && (max_dl <= 63))
  4062. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, max_dl,
  4063. "Maximum bit rate for downlink: %u kbps", max_dl);
  4064. if ((max_dl > 63) && (max_dl <= 127)) {
  4065. md = 64 + (max_dl - 64) * 8;
  4066. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, md,
  4067. "Maximum bit rate for downlink: %u kbps", md);
  4068. }
  4069. if ((max_dl > 127) && (max_dl <= 254)) {
  4070. md = 576 + (max_dl - 128) * 64;
  4071. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (7 - 1) * utf8_type + 1, utf8_type, md,
  4072. "Maximum bit rate for downlink: %u kbps", md);
  4073. }
  4074. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_res_ber, tvb, offset + (8 - 1) * utf8_type + 1, utf8_type, res_ber);
  4075. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_sdu_err_ratio, tvb, offset + (8 - 1) * utf8_type + 1, utf8_type, sdu_err_ratio);
  4076. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_trans_delay, tvb, offset + (9 - 1) * utf8_type + 1, utf8_type, trans_delay);
  4077. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_traf_handl_prio, tvb, offset + (9 - 1) * utf8_type + 1, utf8_type, traf_handl_prio);
  4078. if (guar_ul == 0 || guar_ul == 255)
  4079. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, guar_ul);
  4080. if ((guar_ul > 0) && (guar_ul <= 63))
  4081. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, guar_ul,
  4082. "Guaranteed bit rate for uplink: %u kbps", guar_ul);
  4083. if ((guar_ul > 63) && (guar_ul <= 127)) {
  4084. gu = 64 + (guar_ul - 64) * 8;
  4085. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, gu,
  4086. "Guaranteed bit rate for uplink: %u kbps", gu);
  4087. }
  4088. if ((guar_ul > 127) && (guar_ul <= 254)) {
  4089. gu = 576 + (guar_ul - 128) * 64;
  4090. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (10 - 1) * utf8_type + 1, utf8_type, gu,
  4091. "Guaranteed bit rate for uplink: %u kbps", gu);
  4092. }
  4093. /* Octet 13 */
  4094. if (guar_dl == 0 || guar_dl == 255)
  4095. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, guar_dl);
  4096. if ((guar_dl > 0) && (guar_dl <= 63))
  4097. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, guar_dl,
  4098. "Guaranteed bit rate for downlink: %u kbps", guar_dl);
  4099. if ((guar_dl > 63) && (guar_dl <= 127)) {
  4100. gd = 64 + (guar_dl - 64) * 8;
  4101. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, gd,
  4102. "Guaranteed bit rate for downlink: %u kbps", gd);
  4103. }
  4104. if ((guar_dl > 127) && (guar_dl <= 254)) {
  4105. gd = 576 + (guar_dl - 128) * 64;
  4106. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (11 - 1) * utf8_type + 1, utf8_type, gd,
  4107. "Guaranteed bit rate for downlink: %u kbps", gd);
  4108. }
  4109. if(length > 13) {
  4110. proto_tree_add_uint(ext_tree_qos, hf_gtp_qos_src_stat_desc, tvb, offset + (12 - 1) * utf8_type + 1, utf8_type, src_stat_desc);
  4111. proto_tree_add_boolean(ext_tree_qos, hf_gtp_qos_sig_ind, tvb, offset + (12 - 1) * utf8_type + 1, utf8_type, sig_ind);
  4112. }
  4113. if(length > 14) {
  4114. /* Octet 15 */
  4115. if ((max_dl_ext > 0) && (max_dl_ext <= 0x4a)) {
  4116. md = 8600 + max_dl_ext * 100;
  4117. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
  4118. "Ext Maximum bit rate for downlink: %u kbps", md);
  4119. }
  4120. if ((max_dl_ext > 0x4a) && (max_dl_ext <= 0xba)) {
  4121. md = 16 + (max_dl_ext-0x4a);
  4122. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
  4123. "Ext Maximum bit rate for downlink: %u Mbps", md);
  4124. }
  4125. if ((max_dl_ext > 0xba) && (max_dl_ext <= 0xfa)) {
  4126. md = 128 + (max_dl_ext-0xba)*2;
  4127. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_dl, tvb, offset + (13 - 1) * utf8_type + 1, utf8_type, md,
  4128. "Ext Maximum bit rate for downlink: %u Mbps", md);
  4129. }
  4130. /* Octet 16 */
  4131. if(guar_dl_ext == 0)
  4132. proto_tree_add_text(ext_tree_qos, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, "Use the value indicated by the Guaranteed bit rate for downlink in octet 13");
  4133. if ((guar_dl_ext > 0) && (guar_dl_ext <= 0x4a)) {
  4134. gd = 8600 + guar_dl_ext * 100;
  4135. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
  4136. "Ext Guaranteed bit rate for downlink: %u kbps", gd);
  4137. }
  4138. if ((guar_dl_ext > 0x4a) && (max_dl_ext <= 0xba)) {
  4139. gd = 16 + (guar_dl_ext-0x4a);
  4140. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
  4141. "Ext Guaranteed bit rate for downlink: %u Mbps", gd);
  4142. }
  4143. if ((guar_dl_ext > 0xba) && (max_dl_ext <= 0xfa)) {
  4144. gd = 128 + (guar_dl_ext-0xba)*2;
  4145. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_dl, tvb, offset + (14 - 1) * utf8_type + 1, utf8_type, gd,
  4146. "Ext Guaranteed bit rate for downlink: %u Mbps", gd);
  4147. }
  4148. }
  4149. if(length > 16) {
  4150. /* Octet 17
  4151. * This field is an extension of the Maximum bit rate for uplink in octet 8. The coding is identical to that of the Maximum bit
  4152. * rate for downlink (extended).
  4153. */
  4154. if ((max_ul_ext > 0) && (max_ul_ext <= 0x4a)) {
  4155. md = 8600 + max_ul_ext * 100;
  4156. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
  4157. "Ext Maximum bit rate for uplink: %u kbps", md);
  4158. }
  4159. if ((max_ul_ext > 0x4a) && (max_ul_ext <= 0xba)) {
  4160. md = 16 + (max_ul_ext-0x4a);
  4161. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
  4162. "Ext Maximum bit rate for uplink: %u Mbps", md);
  4163. }
  4164. if ((max_ul_ext > 0xba) && (max_ul_ext <= 0xfa)) {
  4165. md = 128 + (max_ul_ext-0xba)*2;
  4166. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_max_ul, tvb, offset + (15 - 1) * utf8_type + 1, utf8_type, md,
  4167. "Ext Maximum bit rate for uplink: %u Mbps", md);
  4168. }
  4169. /* Octet 18 */
  4170. if (guar_ul_ext == 0)
  4171. proto_tree_add_text(ext_tree_qos, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, "Use the value indicated by the Guaranteed bit rate for uplink in octet 12");
  4172. if ((guar_ul_ext > 0) && (guar_ul_ext <= 0x4a)) {
  4173. gd = 8600 + guar_ul_ext * 100;
  4174. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
  4175. "Ext Guaranteed bit rate for uplink: %u kbps", gd);
  4176. }
  4177. if ((guar_ul_ext > 0x4a) && (max_ul_ext <= 0xba)) {
  4178. gd = 16 + (guar_ul_ext-0x4a);
  4179. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
  4180. "Ext Guaranteed bit rate for uplink: %u Mbps", gd);
  4181. }
  4182. if ((guar_ul_ext > 0xba) && (max_ul_ext <= 0xfa)) {
  4183. gd = 128 + (guar_ul_ext-0xba)*2;
  4184. proto_tree_add_uint_format(ext_tree_qos, hf_gtp_qos_guar_ul, tvb, offset + (16 - 1) * utf8_type + 1, utf8_type, gd,
  4185. "Ext Guaranteed bit rate for uplink: %u Mbps", gd);
  4186. }
  4187. }
  4188. }
  4189. return retval;
  4190. }
  4191. /* Diameter 3GPP AVP Code: 5 3GPP-GPRS Negotiated QoS profile */
  4192. static int
  4193. dissect_diameter_3gpp_qosprofile(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_) {
  4194. decode_qos_umts(tvb, 0, tree, "UMTS GTP QoS Profile", 3);
  4195. return tvb_length(tvb);
  4196. }
  4197. static const gchar *
  4198. dissect_radius_qos_umts(proto_tree * tree, tvbuff_t * tvb, packet_info* pinfo _U_)
  4199. {
  4200. decode_qos_umts(tvb, 0, tree, "UMTS GTP QoS Profile", 3);
  4201. return tvb_get_ephemeral_string(tvb, 0, tvb_length(tvb));
  4202. }
  4203. #define MAX_APN_LENGTH 100
  4204. static void
  4205. decode_apn(tvbuff_t * tvb, int offset, guint16 length, proto_tree * tree, proto_item *item)
  4206. {
  4207. guint8 str[MAX_APN_LENGTH+1];
  4208. guint curr_len;
  4209. /* init buffer and copy it */
  4210. memset(str, 0, MAX_APN_LENGTH);
  4211. tvb_memcpy(tvb, str, offset, length<MAX_APN_LENGTH?length:MAX_APN_LENGTH);
  4212. curr_len = 0;
  4213. while ((curr_len < length) && (curr_len < MAX_APN_LENGTH))
  4214. {
  4215. guint step = str[curr_len];
  4216. str[curr_len] = '.';
  4217. curr_len += step+1;
  4218. }
  4219. /* High light bytes including the first lenght byte */
  4220. proto_tree_add_string(tree, hf_gtp_apn, tvb, offset, length, str+1);
  4221. if(item){
  4222. proto_item_append_text(item, ": %s", str+1);
  4223. }
  4224. }
  4225. static void
  4226. decode_fqdn(tvbuff_t * tvb, int offset, guint16 length, proto_tree * tree)
  4227. {
  4228. guint8 *fqdn = NULL;
  4229. int name_len, tmp;
  4230. if (length > 0) {
  4231. name_len = tvb_get_guint8(tvb, offset);
  4232. if (name_len < 0x20) {
  4233. fqdn = tvb_get_ephemeral_string(tvb, offset + 1, length - 1);
  4234. for (;;) {
  4235. if (name_len >= length - 1)
  4236. break;
  4237. tmp = name_len;
  4238. name_len = name_len + fqdn[tmp] + 1;
  4239. fqdn[tmp] = '.';
  4240. }
  4241. } else
  4242. fqdn = tvb_get_ephemeral_string(tvb, offset, length);
  4243. proto_tree_add_string(tree, hf_gtp_fqdn, tvb, offset, length, fqdn);
  4244. }
  4245. }
  4246. /*
  4247. * GPRS: 9.60 v7.6.0, chapter 7.9.20
  4248. * UMTS: 29.060 v4.0, chapter 7.7.29 PDP Context
  4249. * TODO: unify addr functions
  4250. */
  4251. static int
  4252. decode_gtp_pdp_cntxt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  4253. {
  4254. guint8 ggsn_addr_len, apn_len, trans_id, vaa, asi, order;
  4255. guint8 nsapi, sapi, pdu_send_no, pdu_rec_no;
  4256. guint8 pdp_cntxt_id, pdp_type_org, pdp_type_num, pdp_addr_len;
  4257. guint16 length, sn_down, sn_up, up_flow;
  4258. guint32 addr_ipv4;
  4259. struct e_in6_addr addr_ipv6;
  4260. proto_tree *ext_tree_pdp;
  4261. proto_item *te;
  4262. length = tvb_get_ntohs(tvb, offset + 1);
  4263. te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", val_to_str_ext_const(GTP_EXT_PDP_CNTXT, &gtp_val_ext, "Unknown message"));
  4264. ext_tree_pdp = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_PDP_CNTXT]);
  4265. vaa = (tvb_get_guint8(tvb, offset + 3) >> 6) & 0x01;
  4266. asi = (tvb_get_guint8(tvb, offset + 3) >> 5) & 0x01;
  4267. order = (tvb_get_guint8(tvb, offset + 3) >> 4) & 0x01;
  4268. nsapi = tvb_get_guint8(tvb, offset + 3) & 0x0F;
  4269. sapi = tvb_get_guint8(tvb, offset + 4) & 0x0F;
  4270. proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 1, "VPLMN address allowed: %s", yesno[vaa]);
  4271. proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 1, "Activity Status Indicator: %s", yesno[asi]);
  4272. proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 1, "Reordering required: %s", yesno[order]);
  4273. proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 1, "NSAPI: %u", nsapi);
  4274. proto_tree_add_text(ext_tree_pdp, tvb, offset + 4, 1, "SAPI: %u", sapi);
  4275. switch (gtp_version) {
  4276. case 0:
  4277. decode_qos_gprs(tvb, offset + 5, ext_tree_pdp, "QoS subscribed", 0);
  4278. decode_qos_gprs(tvb, offset + 8, ext_tree_pdp, "QoS requested", 0);
  4279. decode_qos_gprs(tvb, offset + 11, ext_tree_pdp, "QoS negotiated", 0);
  4280. offset = offset + 14;
  4281. break;
  4282. case 1:
  4283. offset = offset + 5;
  4284. offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS subscribed", 1);
  4285. offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS requested", 1);
  4286. offset = offset + decode_qos_umts(tvb, offset, ext_tree_pdp, "QoS negotiated", 1);
  4287. break;
  4288. default:
  4289. break;
  4290. }
  4291. sn_down = tvb_get_ntohs(tvb, offset);
  4292. sn_up = tvb_get_ntohs(tvb, offset + 2);
  4293. pdu_send_no = tvb_get_guint8(tvb, offset + 4);
  4294. pdu_rec_no = tvb_get_guint8(tvb, offset + 5);
  4295. proto_tree_add_text(ext_tree_pdp, tvb, offset, 2, "Sequence number down: %u", sn_down);
  4296. proto_tree_add_text(ext_tree_pdp, tvb, offset + 2, 2, "Sequence number up: %u", sn_up);
  4297. proto_tree_add_text(ext_tree_pdp, tvb, offset + 4, 1, "Send N-PDU number: %u", pdu_send_no);
  4298. proto_tree_add_text(ext_tree_pdp, tvb, offset + 5, 1, "Receive N-PDU number: %u", pdu_rec_no);
  4299. switch (gtp_version) {
  4300. case 0:
  4301. up_flow = tvb_get_ntohs(tvb, offset + 6);
  4302. proto_tree_add_text(ext_tree_pdp, tvb, offset + 6, 2, "Uplink flow label signalling: %u", up_flow);
  4303. offset = offset + 8;
  4304. break;
  4305. case 1:
  4306. pdp_cntxt_id = tvb_get_guint8(tvb, offset + 14);
  4307. proto_tree_add_item(ext_tree_pdp, hf_gtp_ulink_teid_cp, tvb, offset + 6, 4, ENC_BIG_ENDIAN);
  4308. proto_tree_add_item(ext_tree_pdp, hf_gtp_ulink_teid_data, tvb, offset + 10, 4, ENC_BIG_ENDIAN);
  4309. proto_tree_add_text(ext_tree_pdp, tvb, offset + 14, 1, "PDP context identifier: %u", pdp_cntxt_id);
  4310. offset = offset + 15;
  4311. break;
  4312. default:
  4313. break;
  4314. }
  4315. pdp_type_org = tvb_get_guint8(tvb, offset) & 0x0F;
  4316. pdp_type_num = tvb_get_guint8(tvb, offset + 1);
  4317. pdp_addr_len = tvb_get_guint8(tvb, offset + 2);
  4318. proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "PDP organization: %s", val_to_str_const(pdp_type_org, pdp_type, "Unknown PDP org"));
  4319. proto_tree_add_text(ext_tree_pdp, tvb, offset + 1, 1, "PDP type: %s", val_to_str_const(pdp_type_num, pdp_type, "Unknown PDP type"));
  4320. proto_tree_add_text(ext_tree_pdp, tvb, offset + 2, 1, "PDP address length: %u", pdp_addr_len);
  4321. if (pdp_addr_len > 0) {
  4322. switch (pdp_type_num) {
  4323. case 0x21:
  4324. addr_ipv4 = tvb_get_ipv4(tvb, offset + 3);
  4325. proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 4, "PDP address: %s", ip_to_str((guint8 *) & addr_ipv4));
  4326. break;
  4327. case 0x57:
  4328. tvb_get_ipv6(tvb, offset + 3, &addr_ipv6);
  4329. proto_tree_add_text(ext_tree_pdp, tvb, offset + 3, 16, "PDP address: %s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
  4330. break;
  4331. default:
  4332. break;
  4333. }
  4334. }
  4335. offset = offset + 3 + pdp_addr_len;
  4336. ggsn_addr_len = tvb_get_guint8(tvb, offset);
  4337. proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN address length: %u", ggsn_addr_len);
  4338. switch (ggsn_addr_len) {
  4339. case 4:
  4340. addr_ipv4 = tvb_get_ipv4(tvb, offset + 1);
  4341. proto_tree_add_text(ext_tree_pdp, tvb, offset + 1, 4, "GGSN Address for control plane: %s", ip_to_str((guint8 *) & addr_ipv4));
  4342. break;
  4343. case 16:
  4344. tvb_get_ipv6(tvb, offset + 1, &addr_ipv6);
  4345. proto_tree_add_text(ext_tree_pdp, tvb, offset + 1, 16, "GGSN Address for User Traffic: %s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
  4346. break;
  4347. default:
  4348. break;
  4349. }
  4350. offset = offset + 1 + ggsn_addr_len;
  4351. if (gtp_version == 1) {
  4352. ggsn_addr_len = tvb_get_guint8(tvb, offset);
  4353. proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "GGSN 2 address length: %u", ggsn_addr_len);
  4354. switch (ggsn_addr_len) {
  4355. case 4:
  4356. addr_ipv4 = tvb_get_ipv4(tvb, offset + 1);
  4357. proto_tree_add_text(ext_tree_pdp, tvb, offset + 1, 4, "GGSN 2 address: %s", ip_to_str((guint8 *) & addr_ipv4));
  4358. break;
  4359. case 16:
  4360. tvb_get_ipv6(tvb, offset + 1, &addr_ipv6);
  4361. proto_tree_add_text(ext_tree_pdp, tvb, offset + 1, 16, "GGSN 2 address: %s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
  4362. break;
  4363. default:
  4364. break;
  4365. }
  4366. offset = offset + 1 + ggsn_addr_len;
  4367. }
  4368. apn_len = tvb_get_guint8(tvb, offset);
  4369. proto_tree_add_text(ext_tree_pdp, tvb, offset, 1, "APN length: %u", apn_len);
  4370. decode_apn(tvb, offset + 1, apn_len, ext_tree_pdp, NULL);
  4371. offset = offset + 1 + apn_len;
  4372. /*
  4373. * The Transaction Identifier is the 4 or 12 bit Transaction Identifier used in the 3GPP TS 24.008 [5] Session Management
  4374. * messages which control this PDP Context. If the length of the Transaction Identifier is 4 bit, the second octet shall be
  4375. * set to all zeros. The encoding is defined in 3GPP TS 24.007 [3]. The latest Transaction Identifier sent from SGSN to
  4376. * MS is stored in the PDP context IE.
  4377. * NOTE: Bit 5-8 of the first octet in the encoding defined in 3GPP TS 24.007 [3] is mapped into bit 1-4 of the first
  4378. * octet in this field.
  4379. */
  4380. trans_id = tvb_get_guint8(tvb, offset);
  4381. proto_tree_add_text(ext_tree_pdp, tvb, offset, 2, "Transaction identifier: %u", trans_id);
  4382. return 3 + length;
  4383. }
  4384. /* GPRS: 9.60, v7.6.0, chapter 7.9.21
  4385. * UMTS: 29.060, v4.0, chapter 7.7.30
  4386. */
  4387. static int
  4388. decode_gtp_apn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  4389. {
  4390. guint16 length;
  4391. proto_tree *ext_tree_apn;
  4392. proto_item *te;
  4393. length = tvb_get_ntohs(tvb, offset + 1);
  4394. te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", val_to_str_ext_const(GTP_EXT_APN, &gtp_val_ext, "Unknown field"));
  4395. ext_tree_apn = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_APN]);
  4396. proto_tree_add_text(ext_tree_apn, tvb, offset + 1, 2, "APN length : %u", length);
  4397. decode_apn(tvb, offset + 3, length, ext_tree_apn, te);
  4398. return 3 + length;
  4399. }
  4400. /* GPRS: 9.60 v7.6.0, chapter 7.9.22
  4401. * 4.08 v. 7.1.2, chapter 10.5.6.3 (p.580)
  4402. * UMTS: 29.060 v4.0, chapter 7.7.31 Protocol Configuration Options
  4403. * 24.008, v4.2, chapter 10.5.6.3
  4404. */
  4405. int
  4406. decode_gtp_proto_conf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree)
  4407. {
  4408. guint16 length;
  4409. tvbuff_t *next_tvb;
  4410. proto_tree *ext_tree_proto;
  4411. proto_item *te;
  4412. length = tvb_get_ntohs(tvb, offset + 1);
  4413. te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", val_to_str_ext_const(GTP_EXT_PROTO_CONF, &gtp_val_ext, "Unknown message"));
  4414. ext_tree_proto = proto_item_add_subtree(te, ett_gtp_proto);
  4415. proto_tree_add_text(ext_tree_proto, tvb, offset + 1, 2, "Length: %u", length);
  4416. if (length < 1)
  4417. return 3;
  4418. /* The Protocol Configuration Options contains external network protocol options that may be necessary to transfer
  4419. * between the GGSN and the MS. The content and the coding of the Protocol Configuration are defined in octet 3-z of the
  4420. * Protocol Configuration Options in3GPP TS 24.008 [5].
  4421. */
  4422. next_tvb = tvb_new_subset(tvb, offset + 3, length, length);
  4423. de_sm_pco(next_tvb, ext_tree_proto, pinfo, 0, length, NULL, 0);
  4424. return 3 + length;
  4425. }
  4426. /* GPRS: 9.60 v7.6.0, chapter 7.9.23
  4427. * UMTS: 29.060 v4.0, chapter 7.7.32
  4428. */
  4429. static int
  4430. decode_gtp_gsn_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  4431. {
  4432. guint8 addr_type, addr_len;
  4433. guint16 length;
  4434. guint32 addr_ipv4;
  4435. struct e_in6_addr addr_ipv6;
  4436. proto_tree *ext_tree_gsn_addr;
  4437. proto_item *te;
  4438. length = tvb_get_ntohs(tvb, offset + 1);
  4439. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "GSN address : ");
  4440. ext_tree_gsn_addr = proto_item_add_subtree(te, ett_gtp_gsn_addr);
  4441. switch (length) {
  4442. case 4:
  4443. proto_tree_add_text(ext_tree_gsn_addr, tvb, offset + 1, 2, "GSN address length : %u", length);
  4444. addr_ipv4 = tvb_get_ipv4(tvb, offset + 3);
  4445. proto_item_append_text(te, "%s", ip_to_str((guint8 *) & addr_ipv4));
  4446. proto_tree_add_ipv4(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset + 3, 4, addr_ipv4);
  4447. break;
  4448. case 5:
  4449. proto_tree_add_text(ext_tree_gsn_addr, tvb, offset + 1, 2, "GSN address Information Element length : %u", length);
  4450. addr_type = tvb_get_guint8(tvb, offset + 3) & 0xC0;
  4451. proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset + 3, 1, addr_type);
  4452. addr_len = tvb_get_guint8(tvb, offset + 3) & 0x3F;
  4453. proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset + 3, 1, addr_len);
  4454. addr_ipv4 = tvb_get_ipv4(tvb, offset + 4);
  4455. proto_item_append_text(te, "%s", ip_to_str((guint8 *) & addr_ipv4));
  4456. proto_tree_add_ipv4(ext_tree_gsn_addr, hf_gtp_gsn_ipv4, tvb, offset + 4, 4, addr_ipv4);
  4457. break;
  4458. case 16:
  4459. proto_tree_add_text(ext_tree_gsn_addr, tvb, offset + 1, 2, "GSN address length : %u", length);
  4460. tvb_get_ipv6(tvb, offset + 3, &addr_ipv6);
  4461. proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
  4462. proto_tree_add_ipv6(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset + 3, 16, (guint8 *) & addr_ipv6);
  4463. break;
  4464. case 17:
  4465. proto_tree_add_text(ext_tree_gsn_addr, tvb, offset + 1, 2, "GSN address Information Element length : %u", length);
  4466. addr_type = tvb_get_guint8(tvb, offset + 3) & 0xC0;
  4467. proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_type, tvb, offset + 3, 1, addr_type);
  4468. addr_len = tvb_get_guint8(tvb, offset + 3) & 0x3F;
  4469. proto_tree_add_uint(ext_tree_gsn_addr, hf_gtp_gsn_addr_len, tvb, offset + 3, 1, addr_len);
  4470. tvb_get_ipv6(tvb, offset + 4, &addr_ipv6);
  4471. proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
  4472. proto_tree_add_ipv6(ext_tree_gsn_addr, hf_gtp_gsn_ipv6, tvb, offset + 4, 16, (guint8 *) & addr_ipv6);
  4473. break;
  4474. default:
  4475. proto_item_append_text(te, "unknown type or wrong length");
  4476. break;
  4477. }
  4478. return 3 + length;
  4479. }
  4480. /* GPRS: 9.60 v7.6.0, chapter 7.9.24
  4481. * UMTS: 29.060 v4.0, chapter 7.7.33
  4482. */
  4483. static int
  4484. decode_gtp_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree)
  4485. {
  4486. guint16 length;
  4487. tvbuff_t *next_tvb;
  4488. proto_tree *ext_tree_proto;
  4489. proto_item *te;
  4490. length = tvb_get_ntohs(tvb, offset + 1);
  4491. te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", val_to_str_ext_const(GTP_EXT_MSISDN, &gtp_val_ext, "Unknown message"));
  4492. ext_tree_proto = proto_item_add_subtree(te, ett_gtp_proto);
  4493. proto_tree_add_text(ext_tree_proto, tvb, offset + 1, 2, "Length: %u", length);
  4494. length = tvb_get_ntohs(tvb, offset + 1);
  4495. if (length < 1)
  4496. return 3;
  4497. next_tvb = tvb_new_subset(tvb, offset+3, length, length);
  4498. dissect_gsm_map_msisdn(next_tvb, pinfo, ext_tree_proto);
  4499. return 3 + length;
  4500. }
  4501. /* GPRS: not present
  4502. * UMTS: 29.060 v4.0, chapter 7.7.34
  4503. * 24.008 v4.2, chapter 10.5.6.5
  4504. */
  4505. static int
  4506. decode_gtp_qos_umts(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  4507. {
  4508. return decode_qos_umts(tvb, offset, tree, "Quality of Service", 2);
  4509. }
  4510. /* GPRS: not present
  4511. * UMTS: 29.060 v4.0, chapter 7.7.35
  4512. */
  4513. static int
  4514. decode_gtp_auth_qui(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  4515. {
  4516. proto_tree *ext_tree;
  4517. proto_item *te_quint;
  4518. guint16 length;
  4519. guint8 xres_len, auth_len;
  4520. length = tvb_get_ntohs(tvb, offset + 1);
  4521. te_quint = proto_tree_add_text(tree, tvb, offset, length + 1, "Quintuplet");
  4522. ext_tree = proto_item_add_subtree(te_quint, ett_gtp_quint);
  4523. offset++;
  4524. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  4525. offset = offset + 2;
  4526. proto_tree_add_text(ext_tree, tvb, offset, 16, "RAND: %s", tvb_bytes_to_str(tvb, offset, 16));
  4527. offset = offset + 16;
  4528. xres_len = tvb_get_guint8(tvb, offset);
  4529. proto_tree_add_text(ext_tree, tvb, offset, 1, "XRES length: %u", xres_len);
  4530. offset++;
  4531. proto_tree_add_text(ext_tree, tvb, offset, xres_len, "XRES: %s", tvb_bytes_to_str(tvb, offset, xres_len));
  4532. offset = offset + xres_len;
  4533. proto_tree_add_text(ext_tree, tvb, offset, 16, "Quintuplet Ciphering Key: %s", tvb_bytes_to_str(tvb, offset, 16));
  4534. offset = offset + 16;
  4535. proto_tree_add_text(ext_tree, tvb, offset, 16, "Quintuplet Integrity Key: %s", tvb_bytes_to_str(tvb, offset, 16));
  4536. offset = offset + 16;
  4537. auth_len = tvb_get_guint8(tvb, offset);
  4538. proto_tree_add_text(ext_tree, tvb, offset, 1, "Authentication length: %u", auth_len);
  4539. offset++;
  4540. proto_tree_add_text(ext_tree, tvb, offset, auth_len, "AUTH: %s", tvb_bytes_to_str(tvb, offset, auth_len));
  4541. return (3 + length);
  4542. }
  4543. /* GPRS: not present
  4544. * UMTS: 29.060 v4.0, chapter 7.7.36
  4545. * 24.008 v4.2, chapter 10.5.6.12
  4546. */
  4547. static int
  4548. decode_gtp_tft(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  4549. {
  4550. guint16 length, port1, port2, tos;
  4551. guint8 tft_flags, tft_code, no_packet_filters, i, pf_id, pf_eval, pf_len, pf_content_id, proto;
  4552. guint pf_offset;
  4553. guint32 mask_ipv4, addr_ipv4, ipsec_id, label;
  4554. struct e_in6_addr addr_ipv6, mask_ipv6;
  4555. proto_tree *ext_tree_tft, *ext_tree_tft_pf, *ext_tree_tft_flags;
  4556. proto_item *te, *tee, *tef;
  4557. length = tvb_get_ntohs(tvb, offset + 1);
  4558. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Traffic flow template");
  4559. ext_tree_tft = proto_item_add_subtree(te, ett_gtp_tft);
  4560. tft_flags = tvb_get_guint8(tvb, offset + 3);
  4561. tft_code = (tft_flags >> 5) & 0x07;
  4562. no_packet_filters = tft_flags & 0x0F;
  4563. proto_tree_add_text(ext_tree_tft, tvb, offset + 1, 2, "TFT length: %u", length);
  4564. tef = proto_tree_add_text(ext_tree_tft, tvb, offset + 3, 1, "TFT flags");
  4565. ext_tree_tft_flags = proto_item_add_subtree(tef, ett_gtp_tft_flags);
  4566. proto_tree_add_uint(ext_tree_tft_flags, hf_gtp_tft_code, tvb, offset + 3, 1, tft_flags);
  4567. proto_tree_add_uint(ext_tree_tft_flags, hf_gtp_tft_spare, tvb, offset + 3, 1, tft_flags);
  4568. proto_tree_add_uint(ext_tree_tft_flags, hf_gtp_tft_number, tvb, offset + 3, 1, tft_flags);
  4569. offset = offset + 4;
  4570. for (i = 0; i < no_packet_filters; i++) {
  4571. pf_id = tvb_get_guint8(tvb, offset);
  4572. tee = proto_tree_add_text(ext_tree_tft, tvb, offset, 1, "Packet filter id: %u", pf_id);
  4573. ext_tree_tft_pf = proto_item_add_subtree(tee, ett_gtp_tft_pf);
  4574. offset++;
  4575. if (tft_code != 2) {
  4576. pf_eval = tvb_get_guint8(tvb, offset);
  4577. pf_len = tvb_get_guint8(tvb, offset + 1);
  4578. proto_tree_add_uint(ext_tree_tft_pf, hf_gtp_tft_eval, tvb, offset, 1, pf_eval);
  4579. proto_tree_add_text(ext_tree_tft_pf, tvb, offset + 1, 1, "Content length: %u", pf_len);
  4580. offset = offset + 2;
  4581. pf_offset = 0;
  4582. while (pf_offset < pf_len) {
  4583. pf_content_id = tvb_get_guint8(tvb, offset + pf_offset);
  4584. switch (pf_content_id) {
  4585. /* address IPv4 and mask = 8 bytes */
  4586. case 0x10:
  4587. addr_ipv4 = tvb_get_ipv4(tvb, offset + pf_offset + 1);
  4588. mask_ipv4 = tvb_get_ipv4(tvb, offset + pf_offset + 5);
  4589. proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 9, "ID 0x10: IPv4/mask: %s/%s", ip_to_str((guint8 *) & addr_ipv4),
  4590. ip_to_str((guint8 *) & mask_ipv4));
  4591. pf_offset = pf_offset + 9;
  4592. break;
  4593. /* address IPv6 and mask = 32 bytes */
  4594. case 0x20:
  4595. tvb_get_ipv6(tvb, offset + pf_offset + 1, &addr_ipv6);
  4596. tvb_get_ipv6(tvb, offset + pf_offset + 17, &mask_ipv6);
  4597. proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 33, "ID 0x20: IPv6/mask: %s/%s",
  4598. ip6_to_str((struct e_in6_addr *) &addr_ipv6), ip6_to_str((struct e_in6_addr *) &mask_ipv6));
  4599. pf_offset = pf_offset + 33;
  4600. break;
  4601. /* protocol identifier/next header type = 1 byte */
  4602. case 0x30:
  4603. proto = tvb_get_guint8(tvb, offset + pf_offset + 1);
  4604. proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 2, "ID 0x30: IPv4 protocol identifier/IPv6 next header: %u (%x)",
  4605. proto, proto);
  4606. pf_offset = pf_offset + 2;
  4607. break;
  4608. /* single destination port type = 2 bytes */
  4609. case 0x40:
  4610. port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
  4611. proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 3, "ID 0x40: destination port: %u", port1);
  4612. pf_offset = pf_offset + 3;
  4613. break;
  4614. /* destination port range type = 4 bytes */
  4615. case 0x41:
  4616. port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
  4617. port2 = tvb_get_ntohs(tvb, offset + pf_offset + 3);
  4618. proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x41: destination port range: %u - %u", port1, port2);
  4619. pf_offset = pf_offset + 5;
  4620. break;
  4621. /* single source port type = 2 bytes */
  4622. case 0x50:
  4623. port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
  4624. proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 3, "ID 0x50: source port: %u", port1);
  4625. pf_offset = pf_offset + 3;
  4626. break;
  4627. /* source port range type = 4 bytes */
  4628. case 0x51:
  4629. port1 = tvb_get_ntohs(tvb, offset + pf_offset + 1);
  4630. port2 = tvb_get_ntohs(tvb, offset + pf_offset + 3);
  4631. proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x51: source port range: %u - %u", port1, port2);
  4632. pf_offset = pf_offset + 5;
  4633. break;
  4634. /* security parameter index type = 4 bytes */
  4635. case 0x60:
  4636. ipsec_id = tvb_get_ntohl(tvb, offset + pf_offset + 1);
  4637. proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 5, "ID 0x60: security parameter index: %x", ipsec_id);
  4638. pf_offset = pf_offset + 5;
  4639. break;
  4640. /* type of service/traffic class type = 2 bytes */
  4641. case 0x70:
  4642. tos = tvb_get_ntohs(tvb, offset + pf_offset + 1);
  4643. proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 2, "ID 0x70: Type of Service/Traffic Class: %u (%x)", tos, tos);
  4644. pf_offset = pf_offset + 3;
  4645. break;
  4646. /* flow label type = 3 bytes */
  4647. case 0x80:
  4648. label = tvb_get_ntoh24(tvb, offset + pf_offset + 1) & 0x0FFFFF;
  4649. proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 4, "ID 0x80: Flow Label: %u (%x)", label, label);
  4650. pf_offset = pf_offset + 4;
  4651. break;
  4652. default:
  4653. proto_tree_add_text(ext_tree_tft_pf, tvb, offset + pf_offset, 1, "Unknown value: %x ", pf_content_id);
  4654. pf_offset++; /* to avoid infinite loop */
  4655. break;
  4656. }
  4657. }
  4658. offset = offset + pf_offset;
  4659. }
  4660. }
  4661. return 3 + length;
  4662. }
  4663. /* GPRS: not present
  4664. * UMTS: 3GPP TS 29.060 version 10.4.0 Release 10, chapter 7.7.37
  4665. * Type = 138 (Decimal)
  4666. * 25.413(RANAP) TargetID
  4667. * There are several CRs to to this IE make sure to check with a recent spec if dissection is questioned.
  4668. */
  4669. static int
  4670. decode_gtp_target_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  4671. {
  4672. guint16 length;
  4673. proto_item *te;
  4674. proto_tree *ext_tree;
  4675. length = tvb_get_ntohs(tvb, offset + 1);
  4676. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Target Identification");
  4677. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_TARGET_ID]);
  4678. offset = offset + 1;
  4679. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  4680. offset = offset + 2;
  4681. /* Quote from specification:
  4682. * The Target Identification information element contains the identification of a target RNC. Octets 4-n shall contain a
  4683. * non-transparent copy of the corresponding IEs (see subclause 7.7.2) and be encoded as specified in Figure 51 below.
  4684. * The "Target RNC-ID" part of the "Target ID" parameter is specified in 3GPP TS 25.413 [7].
  4685. * NOTE 1: The ASN.1 parameter "Target ID" is forwarded non-transparently in order to maintain backward compatibility.
  4686. * NOTE 2: The preamble of the "Target RNC-ID" (numerical value of e.g. 0x20) however shall not be included in
  4687. * octets 4-n. Also the optional "iE-Extensions" parameter shall not be included into the GTP IE.
  4688. */
  4689. /* Octet 4-6 MCC + MNC */
  4690. dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, TRUE);
  4691. offset+=3;
  4692. /* Octet 7-8 LAC */
  4693. proto_tree_add_item(ext_tree, hf_gtp_rai_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
  4694. offset+=2;
  4695. /* Octet 9 RAC */
  4696. proto_tree_add_item(ext_tree, hf_gtp_rai_rac, tvb, offset, 1, ENC_BIG_ENDIAN);
  4697. offset++;
  4698. /* Octet 10-11 RNC-ID*/
  4699. proto_tree_add_item(ext_tree, hf_gtp_target_rnc_id, tvb, offset, 2, ENC_BIG_ENDIAN);
  4700. /* If the optional Extended RNC-ID is not included, then the length variable 'n' = 8 and the overall length of the IE is 11
  4701. * octets. Otherwise, 'n' = 10 and the overall length of the IE is 13 octets
  4702. */
  4703. if(length == 10){
  4704. proto_tree_add_item(ext_tree, hf_gtp_target_ext_rnc_id, tvb, offset, 2, ENC_BIG_ENDIAN);
  4705. }
  4706. return 3 + length;
  4707. }
  4708. /* GPRS: not present
  4709. * UMTS: 29.060 v4.0, chapter 7.7.38
  4710. */
  4711. static int
  4712. decode_gtp_utran_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  4713. {
  4714. guint16 length;
  4715. proto_item *te;
  4716. proto_tree *ext_tree;
  4717. length = tvb_get_ntohs(tvb, offset + 1);
  4718. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "UTRAN transparent Container");
  4719. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_UTRAN_CONT]);
  4720. offset = offset + 1;
  4721. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  4722. offset = offset + 2;
  4723. proto_tree_add_item(ext_tree, hf_gtp_utran_field, tvb, offset, length, ENC_NA);
  4724. return 3 + length;
  4725. }
  4726. /* GPRS: not present
  4727. * UMTS: 29.060 v4.0, chapter 7.7.39
  4728. */
  4729. static int
  4730. decode_gtp_rab_setup(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  4731. {
  4732. guint32 teid, addr_ipv4;
  4733. guint16 length;
  4734. struct e_in6_addr addr_ipv6;
  4735. proto_tree *ext_tree_rab_setup;
  4736. proto_item *te;
  4737. length = tvb_get_ntohs(tvb, offset + 1);
  4738. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Radio Access Bearer Setup Information");
  4739. ext_tree_rab_setup = proto_item_add_subtree(te, ett_gtp_rab_setup);
  4740. proto_tree_add_text(ext_tree_rab_setup, tvb, offset + 1, 2, "RAB setup length : %u", length);
  4741. proto_tree_add_item(ext_tree_rab_setup, hf_gtp_nsapi, tvb, offset + 3, 1, ENC_BIG_ENDIAN);
  4742. if (length > 1) {
  4743. teid = tvb_get_ntohl(tvb, offset + 4);
  4744. proto_tree_add_uint(ext_tree_rab_setup, hf_gtp_teid_data, tvb, offset + 4, 4, teid);
  4745. switch (length) {
  4746. case 12:
  4747. addr_ipv4 = tvb_get_ipv4(tvb, offset + 8);
  4748. proto_tree_add_ipv4(ext_tree_rab_setup, hf_gtp_rnc_ipv4, tvb, offset + 8, 4, addr_ipv4);
  4749. break;
  4750. case 24:
  4751. tvb_get_ipv6(tvb, offset + 8, &addr_ipv6);
  4752. proto_tree_add_ipv6(ext_tree_rab_setup, hf_gtp_rnc_ipv6, tvb, offset + 8, 16, (guint8 *) & addr_ipv6);
  4753. break;
  4754. default:
  4755. break;
  4756. }
  4757. }
  4758. return 3 + length;
  4759. }
  4760. /* GPRS: not present
  4761. * UMTS: 29.060 v4.0, chapter 7.7.40
  4762. */
  4763. static int
  4764. decode_gtp_hdr_list(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  4765. {
  4766. int i;
  4767. guint8 length, hdr;
  4768. proto_tree *ext_tree_hdr_list;
  4769. proto_item *te;
  4770. length = tvb_get_guint8(tvb, offset + 1);
  4771. te = proto_tree_add_text(tree, tvb, offset, 2 + length, "%s", val_to_str_ext_const(GTP_EXT_HDR_LIST, &gtp_val_ext, "Unknown"));
  4772. ext_tree_hdr_list = proto_item_add_subtree(te, ett_gtp_hdr_list);
  4773. proto_tree_add_text(ext_tree_hdr_list, tvb, offset + 1, 1, "Number of Extension Header Types in list (i.e., length) : %u", length);
  4774. for (i = 0; i < length; i++) {
  4775. hdr = tvb_get_guint8(tvb, offset + 2 + i);
  4776. proto_tree_add_text(ext_tree_hdr_list, tvb, offset + 2 + i, 1, "No. %u --> Extension Header Type value : %s (0x%02x)", i + 1,
  4777. val_to_str_const(hdr, next_extension_header_fieldvals, "Unknown Extension Header Type"), hdr);
  4778. }
  4779. return 2 + length;
  4780. }
  4781. /* GPRS: not present
  4782. * UMTS: 29.060 v4.0, chapter 7.7.41
  4783. * TODO: find TriggerID description
  4784. */
  4785. static int
  4786. decode_gtp_trigger_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  4787. {
  4788. guint16 length;
  4789. length = tvb_get_ntohs(tvb, offset + 1);
  4790. proto_tree_add_text(tree, tvb, offset, 3 + length, "%s length : %u", val_to_str_ext_const(GTP_EXT_TRIGGER_ID, &gtp_val_ext, "Unknown"), length);
  4791. return 3 + length;
  4792. }
  4793. /* GPRS: not present
  4794. * UMTS: 29.060 v4.0, chapter 7.7.42
  4795. * TODO: find OMC-ID description
  4796. */
  4797. static int
  4798. decode_gtp_omc_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  4799. {
  4800. guint16 length;
  4801. length = tvb_get_ntohs(tvb, offset + 1);
  4802. proto_tree_add_text(tree, tvb, offset, 3 + length, "%s length : %u", val_to_str_ext_const(GTP_EXT_OMC_ID, &gtp_val_ext, "Unknown"), length);
  4803. return 3 + length;
  4804. }
  4805. /* GPRS: 9.60 v7.6.0, chapter 7.9.25
  4806. * UMTS: 29.060 v6.11.0, chapter 7.7.44 Charging Gateway Address
  4807. */
  4808. static int
  4809. decode_gtp_chrg_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  4810. {
  4811. guint16 length;
  4812. guint32 addr_ipv4;
  4813. struct e_in6_addr addr_ipv6;
  4814. proto_tree *ext_tree_chrg_addr;
  4815. proto_item *te;
  4816. length = tvb_get_ntohs(tvb, offset + 1);
  4817. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_CHRG_ADDR, &gtp_val_ext, "Unknown"));
  4818. ext_tree_chrg_addr = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_CHRG_ADDR]);
  4819. proto_tree_add_text(ext_tree_chrg_addr, tvb, offset + 1, 2, "%s length : %u", val_to_str_ext_const(GTP_EXT_CHRG_ADDR, &gtp_val_ext, "Unknown"), length);
  4820. switch (length) {
  4821. case 4:
  4822. addr_ipv4 = tvb_get_ipv4(tvb, offset + 3);
  4823. proto_item_append_text(te, "%s", ip_to_str((guint8 *) & addr_ipv4));
  4824. proto_tree_add_ipv4(ext_tree_chrg_addr, hf_gtp_chrg_ipv4, tvb, offset + 3, 4, addr_ipv4);
  4825. break;
  4826. case 16:
  4827. tvb_get_ipv6(tvb, offset + 3, &addr_ipv6);
  4828. proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
  4829. proto_tree_add_ipv6(ext_tree_chrg_addr, hf_gtp_chrg_ipv6, tvb, offset + 3, 16, (guint8 *) & addr_ipv6);
  4830. break;
  4831. default:
  4832. proto_item_append_text(te, "unknown type or wrong length");
  4833. break;
  4834. }
  4835. return 3 + length;
  4836. }
  4837. /* GPRS: ?
  4838. * UMTS: 29.060 V9.4.0, chapter 7.7.43 RAN Transparent Container
  4839. * The information in the value part of the RAN Transparent Container IE contains all information elements (starting with
  4840. * and including the BSSGP "PDU Type") in either of the RAN INFORMATION, RAN INFORMATION REQUEST,
  4841. * RAN INFORMATION ACK or RAN INFORMATION ERROR messages respectively as specified in 3GPP TS 48.018
  4842. */
  4843. static int
  4844. decode_gtp_ran_tr_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  4845. {
  4846. guint16 length;
  4847. proto_tree *ext_tree;
  4848. proto_item *te;
  4849. tvbuff_t *next_tvb;
  4850. length = tvb_get_ntohs(tvb, offset + 1);
  4851. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_RAN_TR_CONT, &gtp_val_ext, "Unknown"));
  4852. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_RAN_TR_CONT]);
  4853. offset++;
  4854. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  4855. offset = offset + 2;
  4856. next_tvb = tvb_new_subset(tvb, offset, length, length);
  4857. if (bssgp_handle) {
  4858. col_set_fence(pinfo->cinfo, COL_INFO);
  4859. call_dissector(bssgp_handle, next_tvb, pinfo, ext_tree);
  4860. }
  4861. return 3 + length;
  4862. }
  4863. /* GPRS: ?
  4864. * UMTS: 29.060 v6.11.0, chapter 7.7.45 PDP Context Prioritization
  4865. */
  4866. static int
  4867. decode_gtp_pdp_cont_prio(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  4868. {
  4869. guint16 length;
  4870. proto_tree *ext_tree;
  4871. proto_item *te;
  4872. length = tvb_get_ntohs(tvb, offset + 1);
  4873. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_PDP_CONT_PRIO, &gtp_val_ext, "Unknown"));
  4874. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_PDP_CONT_PRIO]);
  4875. offset++;
  4876. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  4877. offset = offset + 2;
  4878. /* TODO add decoding of data */
  4879. proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
  4880. return 3 + length;
  4881. }
  4882. /* GPRS: ?
  4883. * UMTS: 29.060 v6.11.0, chapter 7.7.45A Additional RAB Setup Information
  4884. */
  4885. static int
  4886. decode_gtp_add_rab_setup_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  4887. {
  4888. guint16 length;
  4889. proto_tree *ext_tree;
  4890. proto_item *te;
  4891. length = tvb_get_ntohs(tvb, offset + 1);
  4892. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_ADD_RAB_SETUP_INF, &gtp_val_ext, "Unknown"));
  4893. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_ADD_RAB_SETUP_INF]);
  4894. offset++;
  4895. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  4896. offset = offset + 2;
  4897. /* TODO add decoding of data */
  4898. proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
  4899. return 3 + length;
  4900. }
  4901. /* GPRS: ?
  4902. * UMTS: 29.060 v6.11.0, chapter 7.7.47 SGSN Number
  4903. */
  4904. static int
  4905. decode_gtp_ssgn_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  4906. {
  4907. guint16 length;
  4908. proto_tree *ext_tree;
  4909. proto_item *te;
  4910. length = tvb_get_ntohs(tvb, offset + 1);
  4911. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_SSGN_NO, &gtp_val_ext, "Unknown"));
  4912. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_SSGN_NO]);
  4913. offset++;
  4914. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  4915. offset = offset + 2;
  4916. /* TODO add decoding of data */
  4917. proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
  4918. return 3 + length;
  4919. }
  4920. /* GPRS: ?
  4921. * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.48 Common Flags
  4922. */
  4923. static int
  4924. decode_gtp_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  4925. {
  4926. guint16 length;
  4927. proto_tree *ext_tree;
  4928. proto_item *te;
  4929. length = tvb_get_ntohs(tvb, offset + 1);
  4930. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_COMMON_FLGS, &gtp_val_ext, "Unknown"));
  4931. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_COMMON_FLGS]);
  4932. offset++;
  4933. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  4934. offset = offset + 2;
  4935. /* Dual Address Bearer Flag */
  4936. proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_dual_addr_bearer_flg, tvb, offset, 1, ENC_BIG_ENDIAN);
  4937. /* Upgrade QoS Supported */
  4938. proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_upgrd_qos_sup, tvb, offset, 1, ENC_BIG_ENDIAN);
  4939. /* NRSN bit field */
  4940. proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_nrsn, tvb, offset, 1, ENC_BIG_ENDIAN);
  4941. /* No QoS negotiation */
  4942. proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_no_qos_neg, tvb, offset, 1, ENC_BIG_ENDIAN);
  4943. /* MBMS Counting Information bi */
  4944. proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_cnt_inf, tvb, offset, 1, ENC_BIG_ENDIAN);
  4945. /* RAN Procedures Ready */
  4946. proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_ran_pcd_rdy, tvb, offset, 1, ENC_BIG_ENDIAN);
  4947. /* MBMS Service Type */
  4948. proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_mbs_srv_type, tvb, offset, 1, ENC_BIG_ENDIAN);
  4949. /* Prohibit Payload Compression */
  4950. proto_tree_add_item(ext_tree, hf_gtp_cmn_flg_ppc, tvb, offset, 1, ENC_BIG_ENDIAN);
  4951. return 3 + length;
  4952. }
  4953. /* GPRS: ?
  4954. * UMTS: 29.060 v6.11.0, chapter 7.7.49
  4955. */
  4956. static int
  4957. decode_gtp_apn_res(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  4958. {
  4959. guint16 length;
  4960. proto_tree *ext_tree_apn_res;
  4961. proto_item *te;
  4962. length = tvb_get_ntohs(tvb, offset + 1);
  4963. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s : ", val_to_str_ext_const(GTP_EXT_APN_RES, &gtp_val_ext, "Unknown"));
  4964. ext_tree_apn_res = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_APN_RES]);
  4965. offset++;
  4966. proto_tree_add_item(ext_tree_apn_res, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  4967. offset = offset + 2;
  4968. /* Restriction Type value */
  4969. if (length != 1) {
  4970. proto_item *expert_item;
  4971. expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
  4972. expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length);
  4973. PROTO_ITEM_SET_GENERATED(expert_item);
  4974. return 3 + length;
  4975. }
  4976. proto_tree_add_item(ext_tree_apn_res, hf_gtp_ext_apn_res, tvb, offset, length, ENC_BIG_ENDIAN);
  4977. return 3 + length;
  4978. }
  4979. /* GPRS: ?
  4980. * UMTS: 29.060 v6.11.0, chapter 7.7.50 RAT Type
  4981. * RAT Type
  4982. * Type = 151 (Decimal)
  4983. */
  4984. static int
  4985. decode_gtp_rat_type(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  4986. {
  4987. guint16 length;
  4988. proto_tree *ext_tree_rat_type;
  4989. proto_item *te;
  4990. length = tvb_get_ntohs(tvb, offset + 1);
  4991. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_RAT_TYPE, &gtp_val_ext, "Unknown"));
  4992. ext_tree_rat_type = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_RAT_TYPE]);
  4993. offset++;
  4994. proto_tree_add_item(ext_tree_rat_type, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  4995. offset = offset + 2;
  4996. /* RAT Type value */
  4997. if (length != 1) {
  4998. proto_item *expert_item;
  4999. expert_item = proto_tree_add_text(tree, tvb, 0, length, "Wrong length indicated. Expected 1, got %u", length);
  5000. expert_add_info_format(pinfo, expert_item, PI_MALFORMED, PI_ERROR, "Wrong length indicated. Expected 1, got %u", length);
  5001. PROTO_ITEM_SET_GENERATED(expert_item);
  5002. return 3 + length;
  5003. }
  5004. proto_tree_add_item(ext_tree_rat_type, hf_gtp_ext_rat_type, tvb, offset, length, ENC_BIG_ENDIAN);
  5005. proto_item_append_text(te, ": %s", val_to_str_const(tvb_get_guint8(tvb,offset), gtp_ext_rat_type_vals, "Unknown"));
  5006. return 3 + length;
  5007. }
  5008. /* GPRS: ?
  5009. * UMTS: 29.060 v6.11.0, chapter 7.7.51
  5010. * User Location Information
  5011. * Type = 152 (Decimal)
  5012. */
  5013. static const
  5014. gchar *dissect_radius_user_loc(proto_tree * tree, tvbuff_t * tvb, packet_info* pinfo)
  5015. {
  5016. int offset = 0;
  5017. guint8 geo_loc_type;
  5018. guint16 length = tvb_length(tvb);
  5019. /* Geographic Location Type */
  5020. proto_tree_add_item(tree, hf_gtp_ext_geo_loc_type, tvb, offset, 1, ENC_BIG_ENDIAN);
  5021. geo_loc_type = tvb_get_guint8(tvb, offset);
  5022. offset++;
  5023. switch(geo_loc_type) {
  5024. case 0:
  5025. /* Geographic Location field included and it holds the Cell Global
  5026. * Identification (CGI) of where the user currently is registered.
  5027. * CGI is defined in sub-clause 4.3.1 of 3GPP TS 23.003 [2].
  5028. */
  5029. /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 0) */
  5030. be_cell_id_aux(tvb, tree, pinfo, offset, length - 1, NULL, 0, 0);
  5031. break;
  5032. case 1:
  5033. /* Geographic Location field included and it holds the Service
  5034. * Area Identity (SAI) of where the user currently is registered.
  5035. * SAI is defined in sub-clause 9.2.3.9 of 3GPP TS 25.413 [7].
  5036. */
  5037. /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 4) */
  5038. be_cell_id_aux(tvb, tree, pinfo, offset, length - 1, NULL, 0, 4);
  5039. offset = offset + 5;
  5040. proto_tree_add_item(tree, hf_gtp_ext_sac, tvb, offset, 2, ENC_BIG_ENDIAN);
  5041. break;
  5042. case 2:
  5043. /* Geographic Location field included and it holds the Routing
  5044. * Area Identification (RAI) of where the user currently is
  5045. * registered. RAI is defined in sub-clause 4.2 of 3GPP TS 23.003
  5046. * [2].
  5047. */
  5048. dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, TRUE);
  5049. offset+=3;
  5050. proto_tree_add_item(tree, hf_gtp_rai_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
  5051. offset+=2;
  5052. proto_tree_add_item(tree, hf_gtp_rai_rac, tvb, offset, 1, ENC_BIG_ENDIAN);
  5053. break;
  5054. case 128:
  5055. /* Geographic Location field included and it holds the Tracking
  5056. * Area Identity (TAI) of where the user currently is registered.
  5057. * TAI is defined in sub-clause 8.21.4 of 3GPP TS 29.274.
  5058. */
  5059. dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, TRUE);
  5060. offset+=3;
  5061. proto_tree_add_item(tree, hf_gtp_tac, tvb, offset, 2, ENC_BIG_ENDIAN);
  5062. break;
  5063. case 129:
  5064. /* Geographic Location field included and it holds the E-UTRAN Cell
  5065. * Global Identifier (ECGI) of where the user currently is registered.
  5066. * ECGI is defined in sub-clause 8.21.5 of 3GPP TS 29.274.
  5067. */
  5068. dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, TRUE);
  5069. offset+=3;
  5070. proto_tree_add_item(tree, hf_gtp_eci, tvb, offset, 4, ENC_BIG_ENDIAN);
  5071. break;
  5072. case 130:
  5073. /* Geographic Location field included and it holds the Tracking
  5074. * Area Identity (TAI) and E-UTRAN CellGlobal Identifier (ECGI)
  5075. * of where the user currently is registered.
  5076. * TAI is defined in sub-clause 8.21.4 of 3GPP TS 29.274.
  5077. * ECGI is defined in sub-clause 8.21.5 of 3GPP TS 29.274.
  5078. */
  5079. dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, TRUE);
  5080. offset+=3;
  5081. proto_tree_add_item(tree, hf_gtp_tac, tvb, offset, 2, ENC_BIG_ENDIAN);
  5082. offset += 2;
  5083. dissect_e212_mcc_mnc(tvb, pinfo, tree, offset, TRUE);
  5084. offset+=3;
  5085. proto_tree_add_item(tree, hf_gtp_eci, tvb, offset, 4, ENC_BIG_ENDIAN);
  5086. break;
  5087. default:
  5088. proto_tree_add_text(tree, tvb, offset, length - 1, "Unknown Location type data");
  5089. break;
  5090. }
  5091. return tvb_bytes_to_str(tvb, 0, length);
  5092. }
  5093. /*
  5094. * 7.7.51 User Location Information
  5095. */
  5096. static int
  5097. decode_gtp_usr_loc_inf(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree)
  5098. {
  5099. guint16 length;
  5100. proto_tree *ext_tree, *rai_tree;
  5101. proto_item *te, *fi;
  5102. guint8 geo_loc_type;
  5103. length = tvb_get_ntohs(tvb, offset + 1);
  5104. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_USR_LOC_INF, &gtp_val_ext, "Unknown"));
  5105. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_USR_LOC_INF]);
  5106. offset++;
  5107. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5108. offset = offset + 2;
  5109. /* TODO add decoding of data */
  5110. /* Geographic Location Type */
  5111. proto_tree_add_item(ext_tree, hf_gtp_ext_geo_loc_type, tvb, offset, 1, ENC_BIG_ENDIAN);
  5112. geo_loc_type = tvb_get_guint8(tvb, offset);
  5113. offset++;
  5114. switch(geo_loc_type) {
  5115. case 0:
  5116. /* Geographic Location field included and it holds the Cell Global
  5117. * Identification (CGI) of where the user currently is registered.
  5118. * CGI is defined in sub-clause 4.3.1 of 3GPP TS 23.003 [2].
  5119. */
  5120. /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 0) */
  5121. be_cell_id_aux(tvb, ext_tree, pinfo, offset, length - 1, NULL, 0, 0);
  5122. break;
  5123. case 1:
  5124. /* Geographic Location field included and it holds the Service
  5125. * Area Identity (SAI) of where the user currently is registered.
  5126. * SAI is defined in sub-clause 9.2.3.9 of 3GPP TS 25.413 [7].
  5127. */
  5128. /* Use gsm_a's function to dissect Geographic Location by faking disc ( last 4) */
  5129. be_cell_id_aux(tvb, ext_tree, pinfo, offset, length - 1, NULL, 0, 4);
  5130. offset = offset + 5;
  5131. proto_tree_add_item(ext_tree, hf_gtp_ext_sac, tvb, offset, 2, ENC_BIG_ENDIAN);
  5132. break;
  5133. case 2:
  5134. /* Geographic Location field included and it holds the Routing
  5135. * Area Identification (RAI) of where the user currently is
  5136. * registered. RAI is defined in sub-clause 4.2 of 3GPP TS 23.003
  5137. * [2].
  5138. */
  5139. fi = proto_tree_add_text(ext_tree, tvb, offset + 1, 7, "Routeing Area Identity (RAI)");
  5140. rai_tree = proto_item_add_subtree(fi, ett_gtp_uli_rai);
  5141. dissect_e212_mcc_mnc(tvb, pinfo, rai_tree, offset, TRUE);
  5142. offset+=3;
  5143. proto_tree_add_item(rai_tree, hf_gtp_rai_lac, tvb, offset, 2, ENC_BIG_ENDIAN);
  5144. offset+=2;
  5145. proto_tree_add_item(rai_tree, hf_gtp_rai_rac, tvb, offset, 1, ENC_BIG_ENDIAN);
  5146. break;
  5147. default:
  5148. proto_tree_add_text(tree, tvb, offset, length - 1, "Unknown Location type data");
  5149. break;
  5150. }
  5151. return 3 + length;
  5152. }
  5153. static const value_string daylight_saving_time_vals[] = {
  5154. {0, "No adjustment"},
  5155. {1, "+1 hour adjustment for Daylight Saving Time"},
  5156. {2, "+2 hours adjustment for Daylight Saving Time"},
  5157. {3, "Reserved"},
  5158. {0, NULL}
  5159. };
  5160. /* GPRS: ?
  5161. * UMTS: 29.060 v6.11.0, chapter 7.7.52
  5162. * MS Time Zone
  5163. * Type = 153 (Decimal)
  5164. * The ' MS Time Zone' IE is used to indicate the offset between universal time and local time
  5165. * in steps of 15 minutes of where the MS currently resides. The 'Time Zone' field uses the same
  5166. * format as the 'Time Zone' IE in 3GPP TS 24.008 (10.5.3.8)
  5167. * its value shall be set as defined in 3GPP TS 22.042
  5168. */
  5169. static int
  5170. decode_gtp_ms_time_zone(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5171. {
  5172. guint16 length;
  5173. proto_tree *ext_tree;
  5174. proto_item *te;
  5175. guint8 data;
  5176. char sign;
  5177. length = tvb_get_ntohs(tvb, offset + 1);
  5178. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s: ", val_to_str_ext_const(GTP_EXT_MS_TIME_ZONE, &gtp_val_ext, "Unknown"));
  5179. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_MS_TIME_ZONE]);
  5180. offset++;
  5181. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5182. offset = offset + 2;
  5183. /* 3GPP TS 23.040 version 6.6.0 Release 6
  5184. * 9.2.3.11 TP-Service-Centre-Time-Stamp (TP-SCTS)
  5185. * :
  5186. * The Time Zone indicates the difference, expressed in quarters of an hour,
  5187. * between the local time and GMT. In the first of the two semi-octets,
  5188. * the first bit (bit 3 of the seventh octet of the TP-Service-Centre-Time-Stamp field)
  5189. * represents the algebraic sign of this difference (0: positive, 1: negative).
  5190. */
  5191. data = tvb_get_guint8(tvb, offset);
  5192. sign = (data & 0x08) ? '-' : '+';
  5193. data = (data >> 4) + (data & 0x07) * 10;
  5194. proto_tree_add_text(ext_tree, tvb, offset, 1, "Timezone: GMT %c %d hours %d minutes", sign, data / 4, data % 4 * 15);
  5195. proto_item_append_text(te, "GMT %c %d hours %d minutes", sign, data / 4, data % 4 * 15);
  5196. offset++;
  5197. data = tvb_get_guint8(tvb, offset) & 0x3;
  5198. proto_tree_add_text(ext_tree, tvb, offset, 1, "%s", val_to_str_const(data, daylight_saving_time_vals, "Unknown"));
  5199. return 3 + length;
  5200. }
  5201. /* GPRS: ?
  5202. * UMTS: 29.060 v6.11.0, chapter 7.7.53
  5203. * International Mobile Equipment Identity (and Software Version) (IMEI(SV))
  5204. * Type = 154 (Decimal)
  5205. */
  5206. static int
  5207. decode_gtp_imeisv(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5208. {
  5209. guint16 length;
  5210. proto_tree *ext_imeisv;
  5211. proto_item *te;
  5212. tvbuff_t *next_tvb;
  5213. const char *digit_str;
  5214. length = tvb_get_ntohs(tvb, offset + 1);
  5215. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_IMEISV, &gtp_val_ext, "Unknown"));
  5216. ext_imeisv = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_IMEISV]);
  5217. offset++;
  5218. proto_tree_add_item(ext_imeisv, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5219. offset = offset + 2;
  5220. /* IMEI(SV)
  5221. * The structure of the IMEI and IMEISV are defined in sub-clause 6.2 of 3GPP TS 23.003 [2].
  5222. * The 'IMEI(SV)' field shall contain the IMEISV if it is available. If only the IMEI is available,
  5223. * then the IMEI shall be placed in the IMEI(SV) field and the last semi-octet of octet 11 shall be
  5224. * set to '1111'. Both IMEI and IMEISV are BCD encoded.
  5225. */
  5226. next_tvb = tvb_new_subset(tvb, offset, length, length);
  5227. digit_str = unpack_digits(next_tvb, 0);
  5228. proto_tree_add_string(ext_imeisv, hf_gtp_ext_imeisv, next_tvb, 0, -1, digit_str);
  5229. proto_item_append_text(te, ": %s", digit_str);
  5230. return 3 + length;
  5231. }
  5232. /* GPRS: ?
  5233. * UMTS: 29.060 v6.11.0, chapter 7.7.54
  5234. * CAMEL Charging Information Container
  5235. * Type = 155 (Decimal)
  5236. */
  5237. static int
  5238. decode_gtp_camel_chg_inf_con(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5239. {
  5240. guint16 length;
  5241. proto_tree *ext_tree;
  5242. proto_item *te;
  5243. length = tvb_get_ntohs(tvb, offset + 1);
  5244. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_CAMEL_CHG_INF_CON, &gtp_val_ext, "Unknown"));
  5245. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_CAMEL_CHG_INF_CON]);
  5246. offset++;
  5247. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5248. offset = offset + 2;
  5249. /* TODO add decoding of data */
  5250. proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
  5251. return 3 + length;
  5252. }
  5253. /* GPRS: ?
  5254. * UMTS: 29.060 v6.11.0, chapter 7.7.55
  5255. * MBMS UE Context
  5256. */
  5257. static int
  5258. decode_gtp_mbms_ue_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5259. {
  5260. guint16 length;
  5261. proto_tree *ext_tree;
  5262. proto_item *te;
  5263. length = tvb_get_ntohs(tvb, offset + 1);
  5264. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_UE_CTX, &gtp_val_ext, "Unknown"));
  5265. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_MBMS_UE_CTX]);
  5266. offset++;
  5267. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5268. offset = offset + 2;
  5269. /* TODO add decoding of data */
  5270. proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
  5271. return 3 + length;
  5272. }
  5273. /* GPRS: ?
  5274. * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.56
  5275. * Temporary Mobile Group Identity (TMGI)
  5276. * The Temporary Mobile Group Identity (TMGI) information element contains
  5277. * a TMGI allocated by the BM-SC. It is coded as in the value part defined
  5278. * in 3GPP T S 24.008 [5] (i.e. the IEI and octet length indicator are not included).
  5279. */
  5280. static int
  5281. decode_gtp_tmgi(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree)
  5282. {
  5283. guint16 length;
  5284. proto_tree *ext_tree, *tmgi_tree;
  5285. proto_item *te, *ti;
  5286. tvbuff_t *next_tvb;
  5287. length = tvb_get_ntohs(tvb, offset + 1);
  5288. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_TMGI, &gtp_val_ext, "Unknown"));
  5289. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_TMGI]);
  5290. offset++;
  5291. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5292. offset = offset + 2;
  5293. ti = proto_tree_add_item(ext_tree, hf_gtp_tmgi, tvb, offset, length, ENC_NA);
  5294. tmgi_tree = proto_item_add_subtree(ti, ett_gtp_tmgi);
  5295. next_tvb = tvb_new_subset(tvb, offset, length, length);
  5296. de_mid(next_tvb, tmgi_tree, pinfo, 0, length, NULL, 0);
  5297. return 3 + length;
  5298. }
  5299. /* GPRS: ?
  5300. * UMTS: 29.060 v6.11.0, chapter 7.7.57
  5301. * RIM Routing Address
  5302. */
  5303. static int
  5304. decode_gtp_rim_ra(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5305. {
  5306. guint16 length;
  5307. proto_tree *ext_tree;
  5308. proto_item *te;
  5309. length = tvb_get_ntohs(tvb, offset + 1);
  5310. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_RIM_RA, &gtp_val_ext, "Unknown"));
  5311. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_RIM_RA]);
  5312. offset++;
  5313. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5314. offset = offset + 2;
  5315. /* To dissect the Address the Routing Address discriminator must be known */
  5316. /*
  5317. * Octets 4-n are coded according to 3GPP TS 48.018 [20] 11.3.77 RIM Routing Information IE octets 4-n.
  5318. */
  5319. proto_tree_add_item(ext_tree, hf_gtp_rim_routing_addr, tvb, offset, length, ENC_NA);
  5320. return 3 + length;
  5321. }
  5322. /* GPRS: ?
  5323. * UMTS: 29.060 v6.11.0, chapter 7.7.58
  5324. * MBMS Protocol Configuration Options
  5325. */
  5326. static int
  5327. decode_gtp_mbms_prot_conf_opt(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5328. {
  5329. guint16 length;
  5330. proto_tree *ext_tree;
  5331. proto_item *te;
  5332. length = tvb_get_ntohs(tvb, offset + 1);
  5333. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_PROT_CONF_OPT, &gtp_val_ext, "Unknown"));
  5334. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_MBMS_PROT_CONF_OPT]);
  5335. offset++;
  5336. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5337. offset = offset + 2;
  5338. /* TODO add decoding of data */
  5339. proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
  5340. return 3 + length;
  5341. }
  5342. /* GPRS: ?
  5343. * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.59
  5344. * MBMS Session Duration
  5345. */
  5346. /* Used for Diameter */
  5347. static int
  5348. dissect_gtp_mbms_ses_dur(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, void *data _U_)
  5349. {
  5350. int offset = 0;
  5351. proto_tree_add_item(tree, hf_gtp_mbms_ses_dur_days, tvb, offset, 3, ENC_BIG_ENDIAN);
  5352. proto_tree_add_item(tree, hf_gtp_mbms_ses_dur_s, tvb, offset, 3, ENC_BIG_ENDIAN);
  5353. return 3;
  5354. }
  5355. static int
  5356. decode_gtp_mbms_ses_dur(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5357. {
  5358. guint16 length;
  5359. proto_tree *ext_tree;
  5360. proto_item *te;
  5361. length = tvb_get_ntohs(tvb, offset + 1);
  5362. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_SES_DUR, &gtp_val_ext, "Unknown"));
  5363. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_MBMS_SES_DUR]);
  5364. offset++;
  5365. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5366. offset = offset + 2;
  5367. /* The MBMS Session Duration is defined in 3GPP TS 23.246 [26].
  5368. * The MBMS Session Duration information element indicates the estimated
  5369. * session duration of the MBMS service data transmission if available.
  5370. * The payload shall be encoded as per the MBMS-Session-Duration AVP defined
  5371. * in 3GPP TS 29.061 [27], excluding the AVP Header fields
  5372. * (as defined in IETF RFC 3588 [36], section 4.1).
  5373. */
  5374. /* The MBMS-Session-Duration AVP (AVP code 904) is of type OctetString
  5375. * with a length of three octets and indicates the estimated session duration
  5376. * (MBMS Service data transmission). Bits 0 to 16 (17 bits) express seconds, for which the
  5377. * maximum allowed value is 86400 seconds. Bits 17 to 23 (7 bits) express days,
  5378. * for which the maximum allowed value is 18 days. For the whole session duration the seconds
  5379. * and days are added together and the maximum session duration is 19 days.
  5380. */
  5381. proto_tree_add_item(ext_tree, hf_gtp_mbms_ses_dur_days, tvb, offset, 3, ENC_BIG_ENDIAN);
  5382. proto_tree_add_item(ext_tree, hf_gtp_mbms_ses_dur_s, tvb, offset, 3, ENC_BIG_ENDIAN);
  5383. return 3 + length;
  5384. }
  5385. /* GPRS: ?
  5386. * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.60
  5387. * MBMS Service Area
  5388. */
  5389. static int
  5390. dissect_gtp_3gpp_mbms_service_area(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_) {
  5391. int offset = 0;
  5392. guint8 no_of_mbms_sa_codes;
  5393. int i;
  5394. /* The MBMS Service Area is defined in 3GPP TS 23.246 [26].
  5395. * The MBMS Service Area information element indicates the area over
  5396. * which the Multimedia Broadcast/Multicast Service is to be distributed.
  5397. * The payload shall be encoded as per the MBMS-Service-Area AVP defined
  5398. * in 3GPP TS 29.061 [27], excluding the AVP Header fields (as defined in
  5399. * IETF RFC 3588 [36], section 4.1).
  5400. */
  5401. /* Number N of MBMS service area codes coded as:
  5402. * 1 binary value is '00000000'
  5403. * ... ...
  5404. * 256 binary value is '11111111'
  5405. */
  5406. no_of_mbms_sa_codes = tvb_get_guint8(tvb, offset) + 1;
  5407. proto_tree_add_uint(tree, hf_gtp_no_of_mbms_sa_codes, tvb, offset, 1, no_of_mbms_sa_codes);
  5408. offset++;
  5409. /* A consecutive list of N MBMS service area codes
  5410. * The MBMS Service Area Identity and its semantics are defined in 3GPP TS 23.003
  5411. * The length of an MBMS service area code is 2 octets.
  5412. */
  5413. for (i = 0; i < no_of_mbms_sa_codes; i++) {
  5414. proto_tree_add_item(tree, hf_gtp_mbms_sa_code, tvb, offset, 2, ENC_BIG_ENDIAN);
  5415. offset = offset + 2;
  5416. }
  5417. return offset;
  5418. }
  5419. static int
  5420. decode_gtp_mbms_sa(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5421. {
  5422. tvbuff_t *next_tvb;
  5423. guint16 length;
  5424. proto_tree *ext_tree;
  5425. proto_item *te;
  5426. length = tvb_get_ntohs(tvb, offset + 1);
  5427. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_SA, &gtp_val_ext, "Unknown"));
  5428. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_MBMS_SA]);
  5429. offset++;
  5430. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5431. offset = offset + 2;
  5432. next_tvb = tvb_new_subset(tvb, offset, length-3, length-3);
  5433. dissect_gtp_3gpp_mbms_service_area(next_tvb, pinfo, ext_tree, NULL);
  5434. return 3 + length;
  5435. }
  5436. /* GPRS: ?
  5437. * UMTS: 29.060 v6.11.0, chapter 7.7.61
  5438. * Source RNC PDCP context info
  5439. */
  5440. static int
  5441. decode_gtp_src_rnc_pdp_ctx_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5442. {
  5443. guint16 length;
  5444. proto_tree *ext_tree;
  5445. proto_item *te;
  5446. length = tvb_get_ntohs(tvb, offset + 1);
  5447. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_SRC_RNC_PDP_CTX_INF, &gtp_val_ext, "Unknown"));
  5448. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_SRC_RNC_PDP_CTX_INF]);
  5449. offset++;
  5450. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5451. offset = offset + 2;
  5452. /* TODO add decoding of data */
  5453. proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
  5454. return 3 + length;
  5455. }
  5456. /* GPRS: ?
  5457. * UMTS: 29.060 v6.11.0, chapter 7.7.62
  5458. * Additional Trace Info
  5459. */
  5460. static int
  5461. decode_gtp_add_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5462. {
  5463. guint16 length;
  5464. proto_tree *ext_tree;
  5465. proto_item *te;
  5466. length = tvb_get_ntohs(tvb, offset + 1);
  5467. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_ADD_TRS_INF, &gtp_val_ext, "Unknown"));
  5468. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_ADD_TRS_INF]);
  5469. offset++;
  5470. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5471. offset = offset + 2;
  5472. /* TODO add decoding of data */
  5473. proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
  5474. return 3 + length;
  5475. }
  5476. /* GPRS: ?
  5477. * UMTS: 29.060 v6.11.0, chapter 7.7.63
  5478. * Hop Counter
  5479. */
  5480. static int
  5481. decode_gtp_hop_count(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5482. {
  5483. guint16 length;
  5484. proto_tree *ext_tree;
  5485. proto_item *te;
  5486. length = tvb_get_ntohs(tvb, offset + 1);
  5487. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_HOP_COUNT, &gtp_val_ext, "Unknown"));
  5488. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_HOP_COUNT]);
  5489. offset++;
  5490. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5491. offset = offset + 2;
  5492. /* TODO add decoding of data */
  5493. proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
  5494. return 3 + length;
  5495. }
  5496. /* GPRS: ?
  5497. * UMTS: 29.060 v6.11.0, chapter 7.7.64
  5498. * Selected PLMN ID
  5499. */
  5500. static int
  5501. decode_gtp_sel_plmn_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5502. {
  5503. guint16 length;
  5504. proto_tree *ext_tree;
  5505. proto_item *te;
  5506. length = tvb_get_ntohs(tvb, offset + 1);
  5507. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_SEL_PLMN_ID, &gtp_val_ext, "Unknown"));
  5508. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_MBMS_SES_ID]);
  5509. offset++;
  5510. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5511. offset = offset + 2;
  5512. dissect_e212_mcc_mnc(tvb, pinfo, ext_tree, offset, FALSE);
  5513. return 3 + length;
  5514. }
  5515. /* GPRS: ?
  5516. * UMTS: 29.060 v6.11.0, chapter 7.7.65
  5517. * MBMS Session Identifier
  5518. */
  5519. static int
  5520. decode_gtp_mbms_ses_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5521. {
  5522. guint16 length;
  5523. proto_tree *ext_tree;
  5524. proto_item *te;
  5525. length = tvb_get_ntohs(tvb, offset + 1);
  5526. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_SES_ID, &gtp_val_ext, "Unknown"));
  5527. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_MBMS_SES_ID]);
  5528. offset++;
  5529. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5530. offset = offset + 2;
  5531. /* TODO add decoding of data */
  5532. proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
  5533. return 3 + length;
  5534. }
  5535. /* GPRS: ?
  5536. * UMTS: 29.060 v6.11.0, chapter 7.7.66
  5537. * MBMS 2G/3G Indicator
  5538. */
  5539. static const value_string gtp_mbs_2g_3g_ind_vals[] = {
  5540. {0, "2G only"},
  5541. {1, "3G only"},
  5542. {2, "Both 2G and 3G"},
  5543. {0, NULL}
  5544. };
  5545. static int
  5546. decode_gtp_mbms_2g_3g_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5547. {
  5548. guint16 length;
  5549. proto_tree *ext_tree;
  5550. proto_item *te;
  5551. length = tvb_get_ntohs(tvb, offset + 1);
  5552. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_2G_3G_IND, &gtp_val_ext, "Unknown"));
  5553. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_MBMS_2G_3G_IND]);
  5554. offset++;
  5555. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5556. offset = offset + 2;
  5557. /* MBMS 2G/3G Indicator */
  5558. proto_tree_add_item(ext_tree, hf_gtp_mbs_2g_3g_ind, tvb, offset, 1, ENC_BIG_ENDIAN);
  5559. return 3 + length;
  5560. }
  5561. /* GPRS: ?
  5562. * UMTS: 29.060 v6.11.0, chapter 7.7.67
  5563. * Enhanced NSAPI
  5564. */
  5565. static int
  5566. decode_gtp_enh_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5567. {
  5568. guint16 length;
  5569. proto_tree *ext_tree;
  5570. proto_item *te;
  5571. length = tvb_get_ntohs(tvb, offset + 1);
  5572. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_ENH_NSAPI, &gtpv1_val_ext, "Unknown"));
  5573. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_ENH_NSAPI]);
  5574. offset++;
  5575. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5576. offset = offset + 2;
  5577. /* TODO add decoding of data */
  5578. proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
  5579. return 3 + length;
  5580. }
  5581. /* GPRS: ?
  5582. * UMTS: 29.060 v6.11.0, chapter 7.7.68
  5583. * Additional MBMS Trace Info
  5584. */
  5585. static int
  5586. decode_gtp_add_mbms_trs_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5587. {
  5588. guint16 length;
  5589. proto_tree *ext_tree;
  5590. proto_item *te;
  5591. length = tvb_get_ntohs(tvb, offset + 1);
  5592. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_ADD_MBMS_TRS_INF, &gtpv1_val_ext, "Unknown"));
  5593. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_ADD_MBMS_TRS_INF]);
  5594. offset++;
  5595. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5596. offset = offset + 2;
  5597. /* TODO add decoding of data */
  5598. proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
  5599. return 3 + length;
  5600. }
  5601. /* GPRS: ?
  5602. * UMTS: 29.060 v6.11.0, chapter 7.7.69
  5603. * MBMS Session Identity Repetition Number
  5604. */
  5605. static int
  5606. decode_gtp_mbms_ses_id_rep_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5607. {
  5608. guint16 length;
  5609. proto_tree *ext_tree;
  5610. proto_item *te;
  5611. length = tvb_get_ntohs(tvb, offset + 1);
  5612. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_SES_ID_REP_NO, &gtpv1_val_ext, "Unknown"));
  5613. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_MBMS_SES_ID_REP_NO]);
  5614. offset++;
  5615. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5616. offset = offset + 2;
  5617. /* TODO add decoding of data */
  5618. proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
  5619. return 3 + length;
  5620. }
  5621. /* GPRS: ?
  5622. * UMTS: 3GPP TS 29.060 version 7.8.0 Release 7
  5623. * MBMS Time To Data Transfer
  5624. */
  5625. /* Used for Diameter */
  5626. static int
  5627. dissect_gtp_mbms_time_to_data_tr(tvbuff_t * tvb, packet_info * pinfo _U_, proto_tree * tree, void *data _U_)
  5628. {
  5629. int offset = 0;
  5630. guint8 time_2_dta_tr;
  5631. time_2_dta_tr = tvb_get_guint8(tvb, offset) + 1;
  5632. proto_tree_add_uint(tree, hf_gtp_time_2_dta_tr, tvb, offset, 1, time_2_dta_tr);
  5633. return 3;
  5634. }
  5635. static int
  5636. decode_gtp_mbms_time_to_data_tr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5637. {
  5638. guint16 length;
  5639. proto_tree *ext_tree;
  5640. proto_item *te;
  5641. guint8 time_2_dta_tr;
  5642. length = tvb_get_ntohs(tvb, offset + 1);
  5643. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_TIME_TO_DATA_TR, &gtpv1_val_ext, "Unknown"));
  5644. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_MBMS_TIME_TO_DATA_TR]);
  5645. offset++;
  5646. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5647. offset = offset + 2;
  5648. /* TODO add decoding of data
  5649. * The MBMS Time To Data Transfer is defined in 3GPP TS 23.246 [26].
  5650. * The MBMS Time To Data Transfer information element contains a
  5651. * MBMS Time To Data Transfer allocated by the BM-SC.
  5652. * The payload shall be encoded as per the MBMS-Time-To-Data-Transfer AVP
  5653. * defined in 3GPP TS 29.061 [27], excluding the AVP Header fields
  5654. * (as defined in IETF RFC 3588 [36], section 4.1).
  5655. */
  5656. /* The coding is specified as per the Time to MBMS Data Transfer Value Part Coding
  5657. * of the Time to MBMS Data Transfer IE in 3GPP TS 48.018
  5658. * Bits
  5659. * 8 7 6 5 4 3 2 1
  5660. * 0 0 0 0 0 0 0 0 1s
  5661. * 0 0 0 0 0 0 0 1 2s
  5662. * 0 0 0 0 0 0 1 0 3s
  5663. * :
  5664. * 1 1 1 1 1 1 1 1 256s
  5665. */
  5666. time_2_dta_tr = tvb_get_guint8(tvb, offset) + 1;
  5667. proto_tree_add_uint(ext_tree, hf_gtp_time_2_dta_tr, tvb, offset, 1, time_2_dta_tr);
  5668. return 3 + length;
  5669. }
  5670. /* GPRS: ?
  5671. * UMTS: 29.060 v6.11.0, chapter 7.7.71
  5672. * PS Handover Request Context
  5673. */
  5674. static int
  5675. decode_gtp_ps_ho_req_ctx(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5676. {
  5677. guint16 length;
  5678. proto_tree *ext_tree;
  5679. proto_item *te;
  5680. length = tvb_get_ntohs(tvb, offset + 1);
  5681. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_PS_HO_REQ_CTX, &gtpv1_val_ext, "Unknown"));
  5682. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_PS_HO_REQ_CTX]);
  5683. offset++;
  5684. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5685. offset = offset + 2;
  5686. /* TODO add decoding of data */
  5687. proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
  5688. return 3 + length;
  5689. }
  5690. /* GPRS: ?
  5691. * UMTS: 29.060 v6.11.0, chapter 7.7.72
  5692. * BSS Container
  5693. */
  5694. static int
  5695. decode_gtp_bss_cont(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5696. {
  5697. guint16 length;
  5698. proto_tree *ext_tree;
  5699. proto_item *te;
  5700. length = tvb_get_ntohs(tvb, offset + 1);
  5701. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_BSS_CONT, &gtpv1_val_ext, "Unknown"));
  5702. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_BSS_CONT]);
  5703. offset++;
  5704. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5705. offset = offset + 2;
  5706. /* TODO add decoding of data */
  5707. proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
  5708. /*
  5709. * The content of this container is defined in 3GPP TS 48.018
  5710. */
  5711. return 3 + length;
  5712. }
  5713. /* GPRS: ?
  5714. * UMTS: 29.060 v6.11.0, chapter 7.7.73
  5715. * Cell Identification
  5716. */
  5717. static int
  5718. decode_gtp_cell_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5719. {
  5720. guint16 length;
  5721. proto_tree *ext_tree;
  5722. proto_item *te;
  5723. length = tvb_get_ntohs(tvb, offset + 1);
  5724. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_CELL_ID, &gtpv1_val_ext, "Unknown"));
  5725. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_CELL_ID]);
  5726. offset++;
  5727. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5728. offset = offset + 2;
  5729. /* TODO add decoding of data */
  5730. proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
  5731. /*
  5732. * for PS handover from A/Gb mode, the identification of a target cell (Cell ID 1) and the identification of the
  5733. * source cell (Cell ID 2) as defined in 3GPP TS 48.018 [20].
  5734. *
  5735. * for PS handover from Iu mode, the identification of a target cell (Cell ID 1)) and the identification of the
  5736. * source RNC (RNC-ID) as defined in 3GPP TS 48.018
  5737. */
  5738. return 3 + length;
  5739. }
  5740. /* GPRS: ?
  5741. * UMTS: 29.060 v6.11.0, chapter 7.7.74
  5742. * PDU Numbers
  5743. */
  5744. static int
  5745. decode_gtp_pdu_no(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5746. {
  5747. guint16 length;
  5748. proto_tree *ext_tree;
  5749. proto_item *te;
  5750. length = tvb_get_ntohs(tvb, offset + 1);
  5751. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_PDU_NO, &gtpv1_val_ext, "Unknown"));
  5752. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_PDU_NO]);
  5753. offset++;
  5754. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5755. offset = offset + 2;
  5756. /* TODO add decoding of data */
  5757. proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
  5758. return 3 + length;
  5759. }
  5760. /* GPRS: ?
  5761. * UMTS: 29.060 v6.11.0, chapter 7.7.75
  5762. * BSSGP Cause
  5763. */
  5764. static int
  5765. decode_gtp_bssgp_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5766. {
  5767. guint16 length;
  5768. proto_tree *ext_tree;
  5769. proto_item *te;
  5770. length = tvb_get_ntohs(tvb, offset + 1);
  5771. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_BSSGP_CAUSE, &gtpv1_val_ext, "Unknown"));
  5772. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_BSSGP_CAUSE]);
  5773. offset++;
  5774. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5775. offset = offset + 2;
  5776. /*
  5777. * The BSSGP Cause information element contains the cause as defined in 3GPP TS 48.018
  5778. */
  5779. proto_tree_add_item(ext_tree, hf_gtp_bssgp_cause, tvb, offset, 2, ENC_BIG_ENDIAN);
  5780. return 3 + length;
  5781. }
  5782. /*
  5783. * Required MBMS bearer capabilities 7.7.76
  5784. */
  5785. static int
  5786. decode_gtp_mbms_bearer_cap(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5787. {
  5788. guint16 length;
  5789. proto_tree *ext_tree;
  5790. proto_item *te;
  5791. length = tvb_get_ntohs(tvb, offset + 1);
  5792. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_REQ_MBMS_BEARER_CAP, &gtpv1_val_ext, "Unknown"));
  5793. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_REQ_MBMS_BEARER_CAP]);
  5794. offset++;
  5795. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5796. #if 0 /* Fix Dead Store Warning */
  5797. offset = offset + 2;
  5798. #endif
  5799. /* The payload shall be encoded as per the
  5800. * Required-MBMS-Bearer-Capabilities AVP defined in 3GPP TS 29.061 [27],
  5801. * excluding the AVP Header fields (as defined in IETF RFC 3588 [36], section 4.1).
  5802. */
  5803. /* TODO Add decoding (call Diameter dissector???) */
  5804. return 3 + length;
  5805. }
  5806. /*
  5807. * RIM Routing Address Discriminator 7.7.77
  5808. */
  5809. static const value_string gtp_bssgp_ra_discriminator_vals[] = {
  5810. { 0, "A Cell Identifier is used to identify a GERAN cell" },
  5811. { 1, "A Global RNC-ID is used to identify a UTRAN RNC" },
  5812. { 2, "An eNB identifier is used to identify an E-UTRAN eNodeB or HeNB" },
  5813. { 0, NULL }
  5814. };
  5815. static int
  5816. decode_gtp_rim_ra_disc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5817. {
  5818. guint16 length;
  5819. proto_tree *ext_tree;
  5820. proto_item *te;
  5821. length = tvb_get_ntohs(tvb, offset + 1);
  5822. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_RIM_ROUTING_ADDR_DISC, &gtpv1_val_ext, "Unknown"));
  5823. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_RIM_ROUTING_ADDR_DISC]);
  5824. offset++;
  5825. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5826. offset = offset + 2;
  5827. /* Octet 4 bits 4 - 1 is coded according to 3GPP TS 48.018 [20]
  5828. * RIM Routing Information IE octet 3 bits 4 - 1.
  5829. * Bits 8 - 5 are coded "0000".
  5830. */
  5831. proto_tree_add_item(ext_tree, hf_gtp_bssgp_ra_discriminator, tvb, offset, 1, ENC_BIG_ENDIAN);
  5832. return 3 + length;
  5833. }
  5834. /*
  5835. * List of set-up PFCs 7.7.78
  5836. */
  5837. static int
  5838. decode_gtp_lst_set_up_pfc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5839. {
  5840. guint16 length;
  5841. proto_tree *ext_tree;
  5842. proto_item *te;
  5843. length = tvb_get_ntohs(tvb, offset + 1);
  5844. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_LIST_OF_SETUP_PFCS, &gtpv1_val_ext, "Unknown"));
  5845. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_LIST_OF_SETUP_PFCS]);
  5846. offset++;
  5847. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5848. offset = offset + 2;
  5849. /* TODO add decoding of data */
  5850. proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
  5851. return 3 + length;
  5852. }
  5853. /*
  5854. * PS Handover XID Parameters 7.7.79
  5855. */
  5856. static int
  5857. decode_gtp_ps_handover_xid(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5858. {
  5859. guint16 length;
  5860. proto_tree *ext_tree;
  5861. proto_item *te;
  5862. tvbuff_t *next_tvb;
  5863. guint8 sapi;
  5864. guint8 xid_par_len;
  5865. length = tvb_get_ntohs(tvb, offset + 1);
  5866. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_PS_HANDOVER_XIP_PAR, &gtpv1_val_ext, "Unknown"));
  5867. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_PS_HANDOVER_XIP_PAR]);
  5868. offset++;
  5869. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5870. offset = offset + 2;
  5871. sapi = tvb_get_guint8(tvb, offset) & 0x0F;
  5872. proto_tree_add_uint(ext_tree, hf_gtp_sapi, tvb, offset, 1, sapi);
  5873. offset++;
  5874. xid_par_len = tvb_get_guint8(tvb, offset);
  5875. proto_tree_add_uint(ext_tree, hf_gtp_xid_par_len, tvb, offset, 1, xid_par_len);
  5876. offset++;
  5877. if (sndcpxid_handle) {
  5878. next_tvb = tvb_new_subset_remaining(tvb, offset);
  5879. call_dissector(sndcpxid_handle, next_tvb, pinfo, tree);
  5880. } else
  5881. proto_tree_add_text(tree, tvb, offset, 0, "Data");
  5882. return 4 + length;
  5883. }
  5884. /*
  5885. * MS Info Change Reporting Action 7.7.80
  5886. */
  5887. static int
  5888. decode_gtp_ms_inf_chg_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5889. {
  5890. guint16 length;
  5891. proto_tree *ext_tree;
  5892. proto_item *te;
  5893. length = tvb_get_ntohs(tvb, offset + 1);
  5894. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MS_INF_CHG_REP_ACT, &gtpv1_val_ext, "Unknown"));
  5895. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_MS_INF_CHG_REP_ACT]);
  5896. offset++;
  5897. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5898. offset = offset + 2;
  5899. /* TODO add decoding of data */
  5900. proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
  5901. return 3 + length;
  5902. }
  5903. /*
  5904. * Direct Tunnel Flags 7.7.81
  5905. */
  5906. static int
  5907. decode_gtp_direct_tnl_flg(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5908. {
  5909. guint16 length;
  5910. proto_tree *ext_tree;
  5911. proto_item *te;
  5912. length = tvb_get_ntohs(tvb, offset + 1);
  5913. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_DIRECT_TUNNEL_FLGS, &gtpv1_val_ext, "Unknown"));
  5914. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_DIRECT_TUNNEL_FLGS]);
  5915. offset++;
  5916. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5917. offset = offset + 2;
  5918. /* TODO add decoding of data */
  5919. proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
  5920. proto_tree_add_item(ext_tree, hf_gtp_ext_ei, tvb, offset, 1, ENC_BIG_ENDIAN);
  5921. proto_tree_add_item(ext_tree, hf_gtp_ext_gcsi, tvb, offset, 1, ENC_BIG_ENDIAN);
  5922. proto_tree_add_item(ext_tree, hf_gtp_ext_dti, tvb, offset, 1, ENC_BIG_ENDIAN);
  5923. #if 0 /* Fix Dead Store Warning */
  5924. offset++;
  5925. #endif
  5926. return 3 + length;
  5927. }
  5928. /*
  5929. * Correlation-ID 7.7.82
  5930. */
  5931. static int
  5932. decode_gtp_corrl_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5933. {
  5934. guint16 length;
  5935. proto_tree *ext_tree;
  5936. proto_item *te;
  5937. length = tvb_get_ntohs(tvb, offset + 1);
  5938. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_CORRELATION_ID, &gtpv1_val_ext, "Unknown"));
  5939. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_CORRELATION_ID]);
  5940. offset++;
  5941. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5942. offset = offset + 2;
  5943. /* TODO add decoding of data */
  5944. proto_tree_add_text(ext_tree, tvb, offset, length, "Data not decoded yet");
  5945. return 3 + length;
  5946. }
  5947. /*
  5948. * Bearer Control Mode 7.7.83
  5949. * version 10.0.0
  5950. */
  5951. static const value_string gtp_pdp_bcm_type_vals[] = {
  5952. {0, "MS_only"},
  5953. {1, "MS/NW"},
  5954. {0, NULL}
  5955. };
  5956. static int
  5957. decode_gtp_bearer_cntrl_mod(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5958. {
  5959. guint16 length;
  5960. proto_tree *ext_tree;
  5961. proto_item *te;
  5962. length = tvb_get_ntohs(tvb, offset + 1);
  5963. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_BEARER_CONTROL_MODE, &gtpv1_val_ext, "Unknown"));
  5964. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_BEARER_CONTROL_MODE]);
  5965. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  5966. offset++;
  5967. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5968. offset = offset + 2;
  5969. proto_tree_add_item(ext_tree, hf_gtp_bcm, tvb, offset, 1, ENC_BIG_ENDIAN);
  5970. return 3 + length;
  5971. }
  5972. /*
  5973. * 7.7.84 MBMS Flow Identifier
  5974. */
  5975. static int
  5976. decode_gtp_mbms_flow_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5977. {
  5978. guint16 length;
  5979. proto_tree *ext_tree;
  5980. proto_item *te;
  5981. length = tvb_get_ntohs(tvb, offset + 1);
  5982. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_FLOW_ID, &gtpv1_val_ext, "Unknown"));
  5983. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_MBMS_FLOW_ID]);
  5984. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  5985. offset++;
  5986. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  5987. offset = offset + 2;
  5988. /* 4-n MBMS Flow Identifier */
  5989. proto_tree_add_item(ext_tree, hf_gtp_mbms_flow_id, tvb, offset, length, ENC_NA);
  5990. return 3 + length;
  5991. }
  5992. /*
  5993. * 7.7.85 MBMS IP Multicast Distribution
  5994. */
  5995. static int
  5996. decode_gtp_mbms_ip_mcast_dist(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  5997. {
  5998. guint16 length;
  5999. proto_tree *ext_tree;
  6000. proto_item *te;
  6001. length = tvb_get_ntohs(tvb, offset + 1);
  6002. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_IP_MCAST_DIST, &gtpv1_val_ext, "Unknown"));
  6003. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_MBMS_IP_MCAST_DIST]);
  6004. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6005. offset++;
  6006. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6007. offset = offset + 2;
  6008. proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet");
  6009. return 3 + length;
  6010. }
  6011. /*
  6012. * 7.7.86 MBMS Distribution Acknowledgement
  6013. */
  6014. /* Table 7.7.86.1: Distribution Indication values */
  6015. static const value_string gtp_mbms_dist_indic_vals[] = {
  6016. {0, "No RNCs have accepted IP multicast distribution"},
  6017. {1, "All RNCs have accepted IP multicast distribution"},
  6018. {2, "Some RNCs have accepted IP multicast distribution"},
  6019. {3, "Spare. For future use."},
  6020. {0, NULL}
  6021. };
  6022. static int
  6023. decode_gtp_mbms_dist_ack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6024. {
  6025. guint16 length;
  6026. proto_tree *ext_tree;
  6027. proto_item *te;
  6028. length = tvb_get_ntohs(tvb, offset + 1);
  6029. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_DIST_ACK, &gtpv1_val_ext, "Unknown"));
  6030. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_MBMS_DIST_ACK]);
  6031. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6032. offset++;
  6033. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6034. offset = offset + 2;
  6035. /* Distribution Indication values */
  6036. proto_tree_add_item(ext_tree, hf_gtp_mbms_dist_indic, tvb, offset, 1, ENC_BIG_ENDIAN);
  6037. return 3 + length;
  6038. }
  6039. /*
  6040. * 7.7.87 Reliable INTER RAT HANDOVER INFO
  6041. */
  6042. static int
  6043. decode_gtp_reliable_irat_ho_inf(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6044. {
  6045. guint16 length;
  6046. proto_tree *ext_tree;
  6047. proto_item *te;
  6048. length = tvb_get_ntohs(tvb, offset + 1);
  6049. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_RELIABLE_IRAT_HO_INF, &gtpv1_val_ext, "Unknown"));
  6050. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_RELIABLE_IRAT_HO_INF]);
  6051. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6052. offset++;
  6053. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6054. offset = offset + 2;
  6055. proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet");
  6056. return 3 + length;
  6057. }
  6058. /*
  6059. * 7.7.88 RFSP Index
  6060. */
  6061. static int
  6062. decode_gtp_rfsp_index(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6063. {
  6064. guint16 length;
  6065. proto_tree *ext_tree;
  6066. proto_item *te;
  6067. length = tvb_get_ntohs(tvb, offset + 1);
  6068. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_RFSP_INDEX, &gtpv1_val_ext, "Unknown"));
  6069. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_RFSP_INDEX]);
  6070. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6071. offset++;
  6072. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6073. offset = offset + 2;
  6074. proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet");
  6075. return 3 + length;
  6076. }
  6077. /*
  6078. * 7.7.89 PDP Type
  6079. */
  6080. /*
  6081. * 7.7.90 Fully Qualified Domain Name (FQDN)
  6082. */
  6083. static int
  6084. decode_gtp_fqdn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6085. {
  6086. guint16 length;
  6087. proto_tree *ext_tree;
  6088. proto_item *te;
  6089. length = tvb_get_ntohs(tvb, offset + 1);
  6090. te = proto_tree_add_text(tree, tvb, offset, length + 3, "%s", val_to_str_ext_const(GTP_EXT_FQDN, &gtp_val_ext, "Unknown field"));
  6091. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_FQDN]);
  6092. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6093. proto_tree_add_text(ext_tree, tvb, offset + 1, 2, "FQDN length : %u", length);
  6094. decode_fqdn(tvb, offset + 3, length, ext_tree);
  6095. return 3 + length;
  6096. }
  6097. /*
  6098. * 7.7.91 Evolved Allocation/Retention Priority I
  6099. */
  6100. static int
  6101. decode_gtp_evolved_allc_rtn_p1(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6102. {
  6103. guint16 length;
  6104. proto_tree *ext_tree;
  6105. proto_item *te;
  6106. length = tvb_get_ntohs(tvb, offset + 1);
  6107. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_EVO_ALLO_RETE_P1, &gtpv1_val_ext, "Unknown"));
  6108. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_EVO_ALLO_RETE_P1]);
  6109. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6110. offset++;
  6111. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6112. offset = offset + 2;
  6113. proto_tree_add_item(ext_tree, hf_gtp_earp_pvi, tvb, offset, 1, ENC_BIG_ENDIAN);
  6114. proto_tree_add_item(ext_tree, hf_gtp_earp_pl, tvb, offset, 1, ENC_BIG_ENDIAN);
  6115. proto_tree_add_item(ext_tree, hf_gtp_earp_pci, tvb, offset, 1, ENC_BIG_ENDIAN);
  6116. return 3 + length;
  6117. }
  6118. /*
  6119. * 7.7.92 Evolved Allocation/Retention Priority II
  6120. */
  6121. static int
  6122. decode_gtp_evolved_allc_rtn_p2(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6123. {
  6124. guint16 length;
  6125. proto_tree *ext_tree;
  6126. proto_item *te;
  6127. length = tvb_get_ntohs(tvb, offset + 1);
  6128. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_EVO_ALLO_RETE_P2, &gtpv1_val_ext, "Unknown"));
  6129. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_EVO_ALLO_RETE_P2]);
  6130. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6131. offset++;
  6132. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6133. offset = offset + 2;
  6134. proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset, 1, ENC_BIG_ENDIAN);
  6135. offset++;
  6136. proto_tree_add_item(ext_tree, hf_gtp_earp_pvi, tvb, offset, 1, ENC_BIG_ENDIAN);
  6137. proto_tree_add_item(ext_tree, hf_gtp_earp_pl, tvb, offset, 1, ENC_BIG_ENDIAN);
  6138. proto_tree_add_item(ext_tree, hf_gtp_earp_pci, tvb, offset, 1, ENC_BIG_ENDIAN);
  6139. return 3 + length;
  6140. }
  6141. /*
  6142. * 7.7.93 Extended Common Flags
  6143. */
  6144. static int
  6145. decode_gtp_extended_common_flgs(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6146. {
  6147. guint16 length;
  6148. proto_tree *ext_tree;
  6149. proto_item *te;
  6150. length = tvb_get_ntohs(tvb, offset + 1);
  6151. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_EXTENDED_COMMON_FLGS, &gtpv1_val_ext, "Unknown"));
  6152. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_EXTENDED_COMMON_FLGS]);
  6153. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6154. offset++;
  6155. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6156. offset = offset + 2;
  6157. proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet");
  6158. return 3 + length;
  6159. }
  6160. /*
  6161. * 7.7.94 User CSG Information (UCI)
  6162. */
  6163. static int
  6164. decode_gtp_uci(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6165. {
  6166. guint16 length;
  6167. proto_tree *ext_tree;
  6168. proto_item *te;
  6169. length = tvb_get_ntohs(tvb, offset + 1);
  6170. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_UCI, &gtpv1_val_ext, "Unknown"));
  6171. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_UCI]);
  6172. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6173. offset++;
  6174. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6175. offset = offset + 2;
  6176. proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet");
  6177. return 3 + length;
  6178. }
  6179. /*
  6180. * 7.7.95 CSG Information Reporting Action
  6181. */
  6182. static int
  6183. decode_gtp_csg_inf_rep_act(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6184. {
  6185. guint16 length;
  6186. proto_tree *ext_tree;
  6187. proto_item *te;
  6188. length = tvb_get_ntohs(tvb, offset + 1);
  6189. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_CSG_INF_REP_ACT, &gtpv1_val_ext, "Unknown"));
  6190. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_CSG_INF_REP_ACT]);
  6191. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6192. offset++;
  6193. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6194. offset = offset + 2;
  6195. proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet");
  6196. return 3 + length;
  6197. }
  6198. /*
  6199. * 7.7.96 CSG ID
  6200. */
  6201. static int
  6202. decode_gtp_csg_id(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6203. {
  6204. guint16 length;
  6205. proto_tree *ext_tree;
  6206. proto_item *te;
  6207. length = tvb_get_ntohs(tvb, offset + 1);
  6208. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_CSG_ID, &gtpv1_val_ext, "Unknown"));
  6209. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_CSG_ID]);
  6210. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6211. offset++;
  6212. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6213. offset = offset + 2;
  6214. proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet");
  6215. return 3 + length;
  6216. }
  6217. /*
  6218. * 7.7.97 CSG Membership Indication (CMI)
  6219. */
  6220. static int
  6221. decode_gtp_cmi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6222. {
  6223. guint16 length;
  6224. proto_tree *ext_tree;
  6225. proto_item *te;
  6226. length = tvb_get_ntohs(tvb, offset + 1);
  6227. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_CMI, &gtpv1_val_ext, "Unknown"));
  6228. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_CMI]);
  6229. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6230. offset++;
  6231. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6232. offset = offset + 2;
  6233. proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet");
  6234. return 3 + length;
  6235. }
  6236. /*
  6237. * 7.7.98 APN Aggregate Maximum Bit Rate (APN-AMBR)
  6238. */
  6239. static int
  6240. decode_gtp_apn_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6241. {
  6242. guint16 length;
  6243. proto_tree *ext_tree;
  6244. proto_item *te;
  6245. length = tvb_get_ntohs(tvb, offset + 1);
  6246. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_AMBR, &gtpv1_val_ext, "Unknown"));
  6247. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_RELIABLE_IRAT_HO_INF]);
  6248. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6249. offset++;
  6250. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6251. offset = offset + 2;
  6252. /* APN Aggregate Maximum Bit Rate (APN-AMBR) is defined in clause 9.9.4.2 of 3GPP TS 24.301 [42], but shall be
  6253. * formatted as shown in Figure 7.7.98-1 as Unsigned32 binary integer values in kbps (1000 bits per second).
  6254. */
  6255. /* 4 to 7 APN-AMBR for Uplink */
  6256. te = proto_tree_add_item(ext_tree, hf_gtp_ext_apn_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN);
  6257. proto_item_append_text(te, " kbps");
  6258. offset+=4;
  6259. /* 8 to 11 APN-AMBR for Downlink */
  6260. te = proto_tree_add_item(ext_tree, hf_gtp_ext_apn_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN);
  6261. proto_item_append_text(te, " kbps");
  6262. return 3 + length;
  6263. }
  6264. /*
  6265. * 7.7.99 UE Network Capability
  6266. */
  6267. static int
  6268. decode_gtp_ue_network_cap(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree)
  6269. {
  6270. guint16 length;
  6271. proto_tree *ext_tree;
  6272. proto_item *te;
  6273. length = tvb_get_ntohs(tvb, offset + 1);
  6274. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_UE_NETWORK_CAP, &gtpv1_val_ext, "Unknown"));
  6275. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_UE_NETWORK_CAP]);
  6276. offset++;
  6277. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6278. offset = offset + 2;
  6279. de_emm_ue_net_cap(tvb, ext_tree, pinfo, offset, length, NULL, 0);
  6280. return 3 + length;
  6281. }
  6282. /*
  6283. * 7.7.100 UE-AMBR
  6284. */
  6285. static int
  6286. decode_gtp_ue_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6287. {
  6288. guint16 length;
  6289. proto_tree *ext_tree;
  6290. proto_item *te;
  6291. length = tvb_get_ntohs(tvb, offset + 1);
  6292. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_APN_AMBR_WITH_NSAPI, &gtpv1_val_ext, "Unknown"));
  6293. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_APN_AMBR_WITH_NSAPI]);
  6294. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6295. offset++;
  6296. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6297. offset = offset + 2;
  6298. /* 4 to 7 Subscribed UE-AMBR for Uplink */
  6299. te = proto_tree_add_item(ext_tree, hf_gtp_ext_sub_ue_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN);
  6300. proto_item_append_text(te, " kbps");
  6301. offset+=4;
  6302. /* 8 to 11 Subscribed UE-AMBR for Downlink */
  6303. te = proto_tree_add_item(ext_tree, hf_gtp_ext_sub_ue_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN);
  6304. proto_item_append_text(te, " kbps");
  6305. offset+=4;
  6306. /* Authorized UE-AMBR for Uplink and Downlink fields are present in the IE only if the sender has their valid values
  6307. * available. Otherwise, the fields from m to (n+3) shall not be present.
  6308. */
  6309. if(offset >= length)
  6310. return 3 + length;
  6311. /* m to (m+3) Authorized UE-AMBR for Uplink */
  6312. te = proto_tree_add_item(ext_tree, hf_gtp_ext_auth_ue_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN);
  6313. proto_item_append_text(te, " kbps");
  6314. offset+=4;
  6315. /* (m+4) to (n+3) Authorized UE-AMBR for Downlink */
  6316. te = proto_tree_add_item(ext_tree, hf_gtp_ext_auth_ue_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN);
  6317. proto_item_append_text(te, " kbps");
  6318. proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet");
  6319. return 3 + length;
  6320. }
  6321. /*
  6322. * 7.7.101 APN-AMBR with NSAPI
  6323. */
  6324. static int
  6325. decode_gtp_apn_ambr_with_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6326. {
  6327. guint16 length;
  6328. proto_tree *ext_tree;
  6329. proto_item *te;
  6330. length = tvb_get_ntohs(tvb, offset + 1);
  6331. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_UE_AMBR, &gtpv1_val_ext, "Unknown"));
  6332. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_UE_AMBR]);
  6333. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6334. offset++;
  6335. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6336. offset = offset + 2;
  6337. proto_tree_add_item(ext_tree, hf_gtp_nsapi, tvb, offset + 1, 1, ENC_BIG_ENDIAN);
  6338. offset++;
  6339. /* 5 to 8 Authorized APN-AMBR for Uplink */
  6340. te = proto_tree_add_item(ext_tree, hf_gtp_ext_auth_apn_ambr_ul, tvb, offset, 4, ENC_BIG_ENDIAN);
  6341. proto_item_append_text(te, " kbps");
  6342. offset+=4;
  6343. /* 9 to12 Authorized APN-AMBR for Downlink */
  6344. te = proto_tree_add_item(ext_tree, hf_gtp_ext_auth_apn_ambr_dl, tvb, offset, 4, ENC_BIG_ENDIAN);
  6345. proto_item_append_text(te, " kbps");
  6346. return 3 + length;
  6347. }
  6348. /*
  6349. * 7.7.102 GGSN Back-Off Time
  6350. */
  6351. /* Table 7.7.102.1: GGSN Back-Off Time information element */
  6352. static const value_string gtp_ggsn_back_off_time_units_vals[] = {
  6353. {0, "value is incremented in multiples of 2 seconds"},
  6354. {1, "value is incremented in multiples of 1 minute"},
  6355. {2, "value is incremented in multiples of 10 minutes"},
  6356. {3, "value is incremented in multiples of 1 hour"},
  6357. {4, "value is incremented in multiples of 10 hours"},
  6358. {5, "value indicates that the timer is infinite"},
  6359. {0, NULL}
  6360. };
  6361. static int
  6362. decode_gtp_ggsn_back_off_time(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6363. {
  6364. guint16 length;
  6365. proto_tree *ext_tree;
  6366. proto_item *te;
  6367. length = tvb_get_ntohs(tvb, offset + 1);
  6368. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_GGSN_BACK_OFF_TIME, &gtpv1_val_ext, "Unknown"));
  6369. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_GGSN_BACK_OFF_TIME]);
  6370. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6371. offset++;
  6372. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6373. offset = offset + 2;
  6374. /* 4 Timer unit Timer value */
  6375. proto_tree_add_item(ext_tree, hf_gtp_ext_ggsn_back_off_time_units, tvb, offset, 2, ENC_BIG_ENDIAN);
  6376. proto_tree_add_item(ext_tree, hf_gtp_ext_ggsn_back_off_timer, tvb, offset, 2, ENC_BIG_ENDIAN);
  6377. return 3 + length;
  6378. }
  6379. /*
  6380. * 7.7.103 Signalling Priority Indication
  6381. */
  6382. static int
  6383. decode_gtp_sig_pri_ind(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6384. {
  6385. guint16 length;
  6386. proto_tree *ext_tree;
  6387. proto_item *te;
  6388. length = tvb_get_ntohs(tvb, offset + 1);
  6389. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_SIG_PRI_IND, &gtpv1_val_ext, "Unknown"));
  6390. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_SIG_PRI_IND]);
  6391. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6392. offset++;
  6393. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6394. offset = offset + 2;
  6395. proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet");
  6396. return 3 + length;
  6397. }
  6398. /*
  6399. * 7.7.104 Signalling Priority Indication with NSAPI
  6400. */
  6401. static int
  6402. decode_gtp_sig_pri_ind_w_nsapi(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6403. {
  6404. guint16 length;
  6405. proto_tree *ext_tree;
  6406. proto_item *te;
  6407. length = tvb_get_ntohs(tvb, offset + 1);
  6408. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_SIG_PRI_IND_W_NSAPI, &gtpv1_val_ext, "Unknown"));
  6409. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_SIG_PRI_IND_W_NSAPI]);
  6410. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6411. offset++;
  6412. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6413. offset = offset + 2;
  6414. proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet");
  6415. return 3 + length;
  6416. }
  6417. /*
  6418. * 7.7.105 Higher bitrates than 16 Mbps flag
  6419. */
  6420. static const value_string gtp_higher_br_16mb_flg_vals[] = {
  6421. {0, "Not allowed"},
  6422. {1, "Allowed"},
  6423. {0, NULL}
  6424. };
  6425. static int
  6426. decode_gtp_higher_br_16mb_flg(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6427. {
  6428. guint16 length;
  6429. proto_tree *ext_tree;
  6430. proto_item *te;
  6431. length = tvb_get_ntohs(tvb, offset + 1);
  6432. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_HIGHER_BR_16MB_FLG, &gtpv1_val_ext, "Unknown"));
  6433. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_HIGHER_BR_16MB_FLG]);
  6434. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6435. offset++;
  6436. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6437. offset = offset + 2;
  6438. /* Higher bitrates than 16 Mbps flag */
  6439. proto_tree_add_item(ext_tree, hf_gtp_higher_br_16mb_flg, tvb, offset, 1, ENC_BIG_ENDIAN);
  6440. return 3 + length;
  6441. }
  6442. /*
  6443. * 7.7.106 Max MBR/APN-AMBR
  6444. */
  6445. static int
  6446. decode_gtp_max_mbr_apn_ambr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6447. {
  6448. guint16 length;
  6449. proto_tree *ext_tree;
  6450. proto_item *te;
  6451. guint32 max_ul;
  6452. guint32 max_dl;
  6453. length = tvb_get_ntohs(tvb, offset + 1);
  6454. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MAX_MBR_APN_AMBR, &gtpv1_val_ext, "Unknown"));
  6455. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_MAX_MBR_APN_AMBR]);
  6456. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6457. offset++;
  6458. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6459. offset = offset + 2;
  6460. /* Max MBR/APN-AMBR for uplink */
  6461. max_ul = tvb_get_ntohl(tvb, offset);
  6462. proto_tree_add_uint_format(ext_tree, hf_gtp_max_mbr_apn_ambr_ul, tvb, offset, 4, max_ul, "Max MBR/APN-AMBR for uplink : %u %s",
  6463. (max_ul) > 1000 ? max_ul/1000 : max_ul,
  6464. (max_ul) > 1000 ? "Mbps" : "kbps");
  6465. offset += 4;
  6466. /* Max MBR/APN-AMBR for downlink */
  6467. max_dl = tvb_get_ntohl(tvb, offset);
  6468. proto_tree_add_uint_format(ext_tree, hf_gtp_max_mbr_apn_ambr_dl, tvb, offset, 4, max_dl, "Max MBR/APN-AMBR for downlink : %u %s",
  6469. (max_dl) > 1000 ? max_dl/1000 : max_dl,
  6470. (max_dl) > 1000 ? "Mbps" : "kbps");
  6471. return 3 + length;
  6472. }
  6473. /*
  6474. * 7.7.107 Additional MM context for SRVCC
  6475. */
  6476. static int
  6477. decode_gtp_add_mm_ctx_srvcc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6478. {
  6479. guint16 length;
  6480. proto_tree *ext_tree;
  6481. proto_item *te;
  6482. length = tvb_get_ntohs(tvb, offset + 1);
  6483. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_ADD_MM_CTX_SRVCC, &gtpv1_val_ext, "Unknown"));
  6484. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_ADD_MM_CTX_SRVCC]);
  6485. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6486. offset++;
  6487. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6488. offset = offset + 2;
  6489. proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet");
  6490. return 3 + length;
  6491. }
  6492. /*
  6493. * 7.7.108 Additional flags for SRVCC
  6494. */
  6495. static int
  6496. decode_gtp_add_flgs_srvcc(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6497. {
  6498. guint16 length;
  6499. proto_tree *ext_tree;
  6500. proto_item *te;
  6501. length = tvb_get_ntohs(tvb, offset + 1);
  6502. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_ADD_FLGS_SRVCC, &gtpv1_val_ext, "Unknown"));
  6503. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_ADD_FLGS_SRVCC]);
  6504. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6505. offset++;
  6506. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6507. offset = offset + 2;
  6508. proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet");
  6509. return 3 + length;
  6510. }
  6511. /*
  6512. * 7.7.109 STN-SR
  6513. */
  6514. static int
  6515. decode_gtp_stn_sr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6516. {
  6517. guint16 length;
  6518. proto_tree *ext_tree;
  6519. proto_item *te;
  6520. length = tvb_get_ntohs(tvb, offset + 1);
  6521. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_STN_SR, &gtpv1_val_ext, "Unknown"));
  6522. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_STN_SR]);
  6523. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6524. offset++;
  6525. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6526. offset = offset + 2;
  6527. proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet");
  6528. return 3 + length;
  6529. }
  6530. /*
  6531. * 7.7.110 C-MSISDN
  6532. */
  6533. static int
  6534. decode_gtp_c_msisdn(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6535. {
  6536. guint16 length;
  6537. proto_tree *ext_tree;
  6538. proto_item *te;
  6539. length = tvb_get_ntohs(tvb, offset + 1);
  6540. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_C_MSISDN, &gtpv1_val_ext, "Unknown"));
  6541. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_C_MSISDN]);
  6542. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6543. offset++;
  6544. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6545. offset = offset + 2;
  6546. proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet");
  6547. return 3 + length;
  6548. }
  6549. /*
  6550. * 7.7.111 Extended RANAP Cause
  6551. */
  6552. static int
  6553. decode_gtp_ext_ranap_cause(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6554. {
  6555. guint16 length;
  6556. proto_tree *ext_tree;
  6557. proto_item *te;
  6558. length = tvb_get_ntohs(tvb, offset + 1);
  6559. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_EXT_RANAP_CAUSE, &gtpv1_val_ext, "Unknown"));
  6560. ext_tree = proto_item_add_subtree(te, ett_gtp_ies[GTP_EXT_EXT_RANAP_CAUSE]);
  6561. proto_tree_add_item(ext_tree, hf_gtp_ie_id, tvb, offset, 1, ENC_BIG_ENDIAN);
  6562. offset++;
  6563. proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6564. offset = offset + 2;
  6565. proto_tree_add_text(ext_tree, tvb, offset, length, "The rest of the data is not dissected yet");
  6566. return 3 + length;
  6567. }
  6568. /* GPRS: 12.15
  6569. * UMTS: 33.015
  6570. */
  6571. static int
  6572. decode_gtp_rel_pack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6573. {
  6574. guint16 length, n, number;
  6575. proto_tree *ext_tree_rel_pack;
  6576. proto_item *te;
  6577. length = tvb_get_ntohs(tvb, offset + 1);
  6578. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of released packets IE");
  6579. ext_tree_rel_pack = proto_item_add_subtree(te, ett_gtp_rel_pack);
  6580. n = 0;
  6581. while (n < length) {
  6582. number = tvb_get_ntohs(tvb, offset + 3 + n);
  6583. proto_tree_add_text(ext_tree_rel_pack, tvb, offset + 3 + n, 2, "%u", number);
  6584. n = n + 2;
  6585. }
  6586. return 3 + length;
  6587. }
  6588. /* GPRS: 12.15
  6589. * UMTS: 33.015
  6590. */
  6591. static int
  6592. decode_gtp_can_pack(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6593. {
  6594. guint16 length, n, number;
  6595. proto_tree *ext_tree_can_pack;
  6596. proto_item *te;
  6597. length = tvb_get_ntohs(tvb, offset + 1);
  6598. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Sequence numbers of cancelled packets IE");
  6599. ext_tree_can_pack = proto_item_add_subtree(te, ett_gtp_can_pack);
  6600. n = 0;
  6601. while (n < length) {
  6602. number = tvb_get_ntohs(tvb, offset + 3 + n);
  6603. proto_tree_add_text(ext_tree_can_pack, tvb, offset + 3 + n, 2, "%u", number);
  6604. n = n + 2;
  6605. }
  6606. return 3 + length;
  6607. }
  6608. /* CDRs dissector
  6609. * 3GPP TS 32.295 version 9.0.0 Release 9
  6610. */
  6611. static const value_string gtp_cdr_fmt_vals[] = {
  6612. {1, "Basic Encoding Rules (BER)"},
  6613. {2, "Unaligned basic Packed Encoding Rules (PER)"},
  6614. {3, "Aligned basic Packed Encoding Rules (PER)"},
  6615. {0, NULL}
  6616. };
  6617. static int
  6618. decode_gtp_data_req(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6619. {
  6620. guint16 length, cdr_length;
  6621. guint8 no, format, app_id, rel_id, ver_id, i;
  6622. proto_tree *ext_tree, *ver_tree, *cdr_dr_tree;
  6623. proto_item *te, *fmt_item, *ver_item;
  6624. tvbuff_t *next_tvb;
  6625. te = proto_tree_add_text(tree, tvb, offset, 1, "%s", val_to_str_ext_const(GTP_EXT_DATA_REQ, &gtp_val_ext, "Unknown message"));
  6626. ext_tree = proto_item_add_subtree(te, ett_gtp_ext);
  6627. offset++;
  6628. length = tvb_get_ntohs(tvb, offset);
  6629. proto_tree_add_text(ext_tree, tvb, offset, 2, "Length: %u", length);
  6630. offset+=2;
  6631. /* Octet 4 Number of Data Records */
  6632. no = tvb_get_guint8(tvb, offset);
  6633. proto_tree_add_text(ext_tree, tvb, offset, 1, "Number of data records: %u", no);
  6634. offset++;
  6635. /* Octet 5 Data Record Format */
  6636. format = tvb_get_guint8(tvb, offset);
  6637. fmt_item = proto_tree_add_text(ext_tree, tvb, offset, 1, "Data record format: %u", format);
  6638. offset++;
  6639. /* The value range is 1-255 in decimal. The value '0' should not be used.
  6640. * Only the values 1-10 and 51-255 can be used for standards purposes.
  6641. * Values in the range of 11-50 are to be configured only by operators, and are not subject to standardization.
  6642. */
  6643. if(format < 4) {
  6644. proto_item_append_text(fmt_item, " %s", val_to_str_const(format, gtp_cdr_fmt_vals, "Unknown"));
  6645. /* Octet 6 -7 Data Record Format Version
  6646. * 8 7 6 5 4 3 2 1
  6647. * 6 Application Identifier Release Identifier
  6648. * 7 Version Identifier
  6649. */
  6650. app_id = tvb_get_guint8(tvb,offset);
  6651. rel_id = app_id & 0x0f;
  6652. app_id = app_id >>4;
  6653. ver_id =tvb_get_guint8(tvb,offset+1);
  6654. /* The second octet (#7 in Data Record Packet IE) identifies the version of the TS used to encode the CDR,
  6655. * i.e. its value corresponds to the second digit of the version number of the document [51]
  6656. * (as shown on the cover sheet), plus '1'.
  6657. * E.g. for version 3.4.0, the Version Identifier would be "5".
  6658. * In circumstances where the second digit is an alphabetical character, (e.g. 3.b.0), the corresponding ASCII value shall
  6659. * be taken, e.g. the Version Identifier would be "66" (ASCII(b)).
  6660. */
  6661. if(ver_id < 0x65)
  6662. ver_id = ver_id -1;
  6663. /* XXX We don't handle ASCCI version */
  6664. ver_item = proto_tree_add_text(ext_tree, tvb, offset, 2, "Data record format version: AppId %u Rel %u.%u.0", app_id,rel_id,ver_id);
  6665. ver_tree = proto_item_add_subtree(ver_item, ett_gtp_cdr_ver);
  6666. proto_tree_add_item(ver_tree, hf_gtp_cdr_app, tvb, offset, 1, ENC_BIG_ENDIAN);
  6667. proto_tree_add_item(ver_tree, hf_gtp_cdr_rel, tvb, offset, 1, ENC_BIG_ENDIAN);
  6668. offset++;
  6669. proto_tree_add_item(ver_tree, hf_gtp_cdr_ver, tvb, offset, 1, ENC_BIG_ENDIAN);
  6670. offset++;
  6671. for(i = 0; i < no; ++i) {
  6672. cdr_length = tvb_get_ntohs(tvb, offset);
  6673. te = proto_tree_add_text(ext_tree, tvb, offset, cdr_length+2, "Data record %d", i + 1);
  6674. cdr_dr_tree = proto_item_add_subtree(te, ett_gtp_cdr_dr);
  6675. proto_tree_add_text(cdr_dr_tree, tvb, offset, 2, "Length: %u", cdr_length);
  6676. offset+=2;
  6677. proto_tree_add_text(cdr_dr_tree, tvb, offset, cdr_length, "Content");
  6678. next_tvb = tvb_new_subset_remaining(tvb, offset);
  6679. /* XXX this is for release 6, may not work for higher releases */
  6680. if(format==1) {
  6681. if(rel_id == 6){
  6682. dissect_gprscdr_GPRSCallEventRecord_PDU(next_tvb, pinfo, cdr_dr_tree, NULL);
  6683. }else if((rel_id == 8)||(rel_id == 9)){
  6684. dissect_gprscdr_GPRSRecord_PDU(next_tvb, pinfo, cdr_dr_tree, NULL);
  6685. }
  6686. } else {
  6687. /* Do we have a dissector regestering for this data format? */
  6688. dissector_try_uint(gtp_cdr_fmt_dissector_table, format, next_tvb, pinfo, cdr_dr_tree);
  6689. }
  6690. offset = offset + cdr_length;
  6691. }
  6692. } else {
  6693. /* Proprietary CDR format */
  6694. proto_item_append_text(fmt_item, " Proprietary or un documented format");
  6695. }
  6696. if (gtpcdr_handle) {
  6697. next_tvb = tvb_new_subset_remaining(tvb, offset);
  6698. call_dissector(gtpcdr_handle, next_tvb, pinfo, tree);
  6699. }
  6700. return 3 + length;
  6701. }
  6702. /* GPRS: 12.15
  6703. * UMTS: 33.015
  6704. */
  6705. static int
  6706. decode_gtp_data_resp(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6707. {
  6708. guint16 length, n, number;
  6709. proto_tree *ext_tree_data_resp;
  6710. proto_item *te;
  6711. length = tvb_get_ntohs(tvb, offset + 1);
  6712. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Requests responded");
  6713. ext_tree_data_resp = proto_item_add_subtree(te, ett_gtp_data_resp);
  6714. n = 0;
  6715. while (n < length) {
  6716. number = tvb_get_ntohs(tvb, offset + 3 + n);
  6717. proto_tree_add_text(ext_tree_data_resp, tvb, offset + 3 + n, 2, "%u", number);
  6718. n = n + 2;
  6719. }
  6720. return 3 + length;
  6721. }
  6722. /* GPRS: 12.15
  6723. * UMTS: 33.015
  6724. */
  6725. static int
  6726. decode_gtp_node_addr(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6727. {
  6728. guint16 length;
  6729. guint32 addr_ipv4;
  6730. struct e_in6_addr addr_ipv6;
  6731. proto_tree *ext_tree_node_addr;
  6732. proto_item *te;
  6733. length = tvb_get_ntohs(tvb, offset + 1);
  6734. te = proto_tree_add_text(tree, tvb, offset, 3 + length, "Node address: ");
  6735. ext_tree_node_addr = proto_item_add_subtree(te, ett_gtp_node_addr);
  6736. proto_tree_add_text(ext_tree_node_addr, tvb, offset + 1, 2, "Node address length: %u", length);
  6737. switch (length) {
  6738. case 4:
  6739. addr_ipv4 = tvb_get_ipv4(tvb, offset + 3);
  6740. proto_item_append_text(te, "%s", ip_to_str((guint8 *) & addr_ipv4));
  6741. proto_tree_add_ipv4(ext_tree_node_addr, hf_gtp_node_ipv4, tvb, offset + 3, 4, addr_ipv4);
  6742. break;
  6743. case 16:
  6744. tvb_get_ipv6(tvb, offset + 3, &addr_ipv6);
  6745. proto_item_append_text(te, "%s", ip6_to_str((struct e_in6_addr *) &addr_ipv6));
  6746. proto_tree_add_ipv6(ext_tree_node_addr, hf_gtp_node_ipv6, tvb, offset + 3, 16, (guint8 *) & addr_ipv6);
  6747. break;
  6748. default:
  6749. proto_item_append_text(te, "unknown type or wrong length");
  6750. break;
  6751. }
  6752. return 3 + length;
  6753. }
  6754. /* GPRS: 9.60 v7.6.0, chapter 7.9.26
  6755. * UMTS: 29.060 v4.0, chapter 7.7.46 Private Extension
  6756. *
  6757. */
  6758. static int
  6759. decode_gtp_priv_ext(tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * tree)
  6760. {
  6761. guint16 length, ext_id;
  6762. proto_tree *ext_tree_priv_ext;
  6763. proto_item *te;
  6764. tvbuff_t *next_tvb;
  6765. te = proto_tree_add_text(tree, tvb, offset, 1, "%s : ", val_to_str_ext_const(GTP_EXT_PRIV_EXT, &gtp_val_ext, "Unknown message"));
  6766. ext_tree_priv_ext = proto_item_add_subtree(te, ett_gtp_ext);
  6767. offset++;
  6768. length = tvb_get_ntohs(tvb, offset);
  6769. proto_tree_add_item(ext_tree_priv_ext, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
  6770. offset = offset + 2;
  6771. if (length >= 2) {
  6772. ext_id = tvb_get_ntohs(tvb, offset);
  6773. proto_tree_add_uint(ext_tree_priv_ext, hf_gtp_ext_id, tvb, offset, 2, ext_id);
  6774. proto_item_append_text(te, "%s (%u)", val_to_str_ext_const(ext_id, &sminmpec_values_ext, "Unknown"), ext_id);
  6775. offset = offset + 2;
  6776. if (length > 2) {
  6777. next_tvb = tvb_new_subset(tvb, offset, length-2, length-2);
  6778. if(!dissector_try_uint(gtp_priv_ext_dissector_table, ext_id, next_tvb, pinfo, ext_tree_priv_ext)){
  6779. proto_tree_add_item(ext_tree_priv_ext, hf_gtp_ext_val, tvb, offset, length - 2, ENC_NA);
  6780. }
  6781. }
  6782. }
  6783. return 3 + length;
  6784. }
  6785. static int
  6786. decode_gtp_unknown(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
  6787. {
  6788. proto_tree_add_text(tree, tvb, offset, 1, "Unknown extension header");
  6789. return tvb_length_remaining(tvb, offset);
  6790. }
  6791. static int
  6792. dissect_gtp_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
  6793. {
  6794. guint8 octet;
  6795. gtp_hdr_t *gtp_hdr = NULL;
  6796. proto_tree *gtp_tree = NULL, *ext_tree;
  6797. proto_item *ti = NULL, *tf, *ext_hdr_len_item;
  6798. int i, offset = 0, checked_field, mandatory;
  6799. gboolean gtp_prime;
  6800. int seq_no = 0;
  6801. int flow_label = 0;
  6802. guint8 pdu_no, next_hdr = 0;
  6803. guint8 ext_hdr_val;
  6804. guint ext_hdr_length;
  6805. guint16 ext_hdr_pdcpsn;
  6806. gchar *tid_str;
  6807. tvbuff_t *next_tvb;
  6808. guint8 sub_proto;
  6809. guint8 acfield_len = 0;
  6810. guint8 control_field;
  6811. gtp_msg_hash_t *gcrp = NULL;
  6812. conversation_t *conversation;
  6813. gtp_conv_info_t *gtp_info;
  6814. void* pd_save;
  6815. /* Do we have enough bytes for the version and message type? */
  6816. if (!tvb_bytes_exist(tvb, 0, 2)) {
  6817. /* No - reject the packet. */
  6818. return 0;
  6819. }
  6820. octet = tvb_get_guint8(tvb, 0);
  6821. if (((octet >> 5) & 0x07) > 2) {
  6822. /* Version > 2; reject the packet */
  6823. return 0;
  6824. }
  6825. octet = tvb_get_guint8(tvb, 1);
  6826. if (octet == GTP_MSG_UNKNOWN || try_val_to_str(octet, gtp_message_type) == NULL) {
  6827. /* Unknown message type; reject the packet */
  6828. return 0;
  6829. }
  6830. /* Setting everything to 0, so that the TEID is 0 for GTP version 0
  6831. * The magic number should perhaps be replaced.
  6832. */
  6833. gtp_hdr = ep_new0(gtp_hdr_t);
  6834. /* Setting the TEID to -1 to say that the TEID is not valid for this packet */
  6835. gtp_hdr->teid = -1;
  6836. col_set_str(pinfo->cinfo, COL_PROTOCOL, "GTP");
  6837. col_clear(pinfo->cinfo, COL_INFO);
  6838. /*
  6839. * Do we have a conversation for this connection?
  6840. */
  6841. conversation = find_or_create_conversation(pinfo);
  6842. /*
  6843. * Do we already know this conversation?
  6844. */
  6845. gtp_info = (gtp_conv_info_t *)conversation_get_proto_data(conversation, proto_gtp);
  6846. if (gtp_info == NULL) {
  6847. /* No. Attach that information to the conversation, and add
  6848. * it to the list of information structures.
  6849. */
  6850. gtp_info = (gtp_conv_info_t *)g_malloc(sizeof(gtp_conv_info_t));
  6851. /*Request/response matching tables*/
  6852. gtp_info->matched = g_hash_table_new(gtp_sn_hash, gtp_sn_equal_matched);
  6853. gtp_info->unmatched = g_hash_table_new(gtp_sn_hash, gtp_sn_equal_unmatched);
  6854. conversation_add_proto_data(conversation, proto_gtp, gtp_info);
  6855. gtp_info->next = gtp_info_items;
  6856. gtp_info_items = gtp_info;
  6857. }
  6858. pd_save = pinfo->private_data;
  6859. pinfo->private_data = gtp_info;
  6860. gtp_hdr->flags = tvb_get_guint8(tvb, offset);
  6861. if (!(gtp_hdr->flags & 0x10)){
  6862. gtp_prime = TRUE;
  6863. }else{
  6864. gtp_prime = FALSE;
  6865. }
  6866. switch ((gtp_hdr->flags >> 5) & 0x07) {
  6867. case 0:
  6868. gtp_version = 0;
  6869. break;
  6870. case 1:
  6871. gtp_version = 1;
  6872. break;
  6873. default:
  6874. gtp_version = 1;
  6875. break;
  6876. }
  6877. if (tree) {
  6878. proto_tree *flags_tree;
  6879. ti = proto_tree_add_item(tree, proto_gtp, tvb, 0, -1, ENC_NA);
  6880. gtp_tree = proto_item_add_subtree(ti, ett_gtp);
  6881. tf = proto_tree_add_uint(gtp_tree, hf_gtp_flags, tvb, offset, 1, gtp_hdr->flags);
  6882. flags_tree = proto_item_add_subtree(tf, ett_gtp_flags);
  6883. if(gtp_prime) {
  6884. /* Octet 8 7 6 5 4 3 2 1
  6885. * 1 Version | PT| Spare '1 1 1 '| ' 0/1 '
  6886. */
  6887. proto_tree_add_uint(flags_tree, hf_gtp_prime_flags_ver, tvb, offset, 1, gtp_hdr->flags);
  6888. proto_tree_add_uint(flags_tree, hf_gtp_flags_pt, tvb, offset, 1, gtp_hdr->flags);
  6889. proto_tree_add_uint(flags_tree, hf_gtp_flags_spare1, tvb, offset, 1, gtp_hdr->flags);
  6890. /* Bit 1 of octet 1 is not used in GTP' (except in v0), and it is marked '0'
  6891. * in the GTP' header. It is in use in GTP' v0 and distinguishes the used header-length.
  6892. * In the case of GTP' v0, this bit being marked one (1) indicates the usage of the 6
  6893. * octets header. If the bit is set to '0' (usually the case) the 20-octet header is used.
  6894. * For all other versions of GTP', this bit is not used and is set to '0'. However,
  6895. * this does not suggest the use of the 20-octet header, rather a shorter 6-octet header.
  6896. */
  6897. if(gtp_version == 0) {
  6898. proto_tree_add_item(flags_tree, hf_gtp_flags_hdr_length, tvb, offset, 1, ENC_BIG_ENDIAN);
  6899. }
  6900. } else {
  6901. proto_tree_add_uint(flags_tree, hf_gtp_flags_ver, tvb, offset, 1, gtp_hdr->flags);
  6902. proto_tree_add_uint(flags_tree, hf_gtp_flags_pt, tvb, offset, 1, gtp_hdr->flags);
  6903. if(gtp_version == 0) {
  6904. proto_tree_add_uint(flags_tree, hf_gtp_flags_spare1, tvb, offset, 1, gtp_hdr->flags);
  6905. proto_tree_add_boolean(flags_tree, hf_gtp_flags_snn, tvb, offset, 1, gtp_hdr->flags);
  6906. } else {
  6907. proto_tree_add_uint(flags_tree, hf_gtp_flags_spare2, tvb, offset, 1, gtp_hdr->flags);
  6908. proto_tree_add_boolean(flags_tree, hf_gtp_flags_e, tvb, offset, 1, gtp_hdr->flags);
  6909. proto_tree_add_boolean(flags_tree, hf_gtp_flags_s, tvb, offset, 1, gtp_hdr->flags);
  6910. proto_tree_add_boolean(flags_tree, hf_gtp_flags_pn, tvb, offset, 1, gtp_hdr->flags);
  6911. }
  6912. }
  6913. }
  6914. offset++;
  6915. gtp_hdr->message = tvb_get_guint8(tvb, offset);
  6916. /* Link direction is needed to properly dissect PCO */
  6917. switch(gtp_hdr->message){
  6918. case GTP_MSG_DELETE_PDP_REQ:
  6919. case GTP_MSG_UPDATE_PDP_REQ:
  6920. case GTP_MSG_CREATE_PDP_REQ:
  6921. case GTP_MSG_INIT_PDP_CONTEXT_ACT_REQ:
  6922. case GTP_MSG_PDU_NOTIFY_REQ:
  6923. case GTP_MSG_PDU_NOTIFY_REJ_REQ:
  6924. pinfo->link_dir = P2P_DIR_UL;
  6925. break;
  6926. case GTP_MSG_DELETE_PDP_RESP:
  6927. case GTP_MSG_UPDATE_PDP_RESP:
  6928. case GTP_MSG_CREATE_PDP_RESP:
  6929. case GTP_MSG_INIT_PDP_CONTEXT_ACT_RESP:
  6930. pinfo->link_dir = P2P_DIR_DL;
  6931. break;
  6932. default:
  6933. break;
  6934. }
  6935. col_add_str(pinfo->cinfo, COL_INFO, val_to_str_ext_const(gtp_hdr->message, &gtp_message_type_ext, "Unknown"));
  6936. if (tree) {
  6937. proto_tree_add_uint(gtp_tree, hf_gtp_message_type, tvb, offset, 1, gtp_hdr->message);
  6938. }
  6939. offset++;
  6940. gtp_hdr->length = tvb_get_ntohs(tvb, offset);
  6941. if (tree) {
  6942. proto_tree_add_uint(gtp_tree, hf_gtp_length, tvb, 2, 2, gtp_hdr->length);
  6943. }
  6944. offset += 2;
  6945. if (gtp_prime) {
  6946. seq_no = tvb_get_ntohs(tvb, offset);
  6947. proto_tree_add_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no);
  6948. offset += 2;
  6949. /* If GTP' version is 0 and bit 1 is 0 20 bytes header is used, dissect it */
  6950. if( (gtp_version == 0) && ((gtp_hdr->flags & 0x01) == 0) ) {
  6951. /* XXX - is this just like GTPv0? */
  6952. flow_label = tvb_get_ntohs(tvb, offset);
  6953. proto_tree_add_uint(gtp_tree, hf_gtp_flow_label, tvb, offset, 2, flow_label);
  6954. offset += 2;
  6955. pdu_no = tvb_get_guint8(tvb, offset);
  6956. proto_tree_add_uint(gtp_tree, hf_gtp_sndcp_number, tvb, offset, 1, pdu_no);
  6957. offset += 4;
  6958. tid_str = id_to_str(tvb, offset);
  6959. proto_tree_add_string(gtp_tree, hf_gtp_tid, tvb, offset, 8, tid_str);
  6960. offset += 8;
  6961. }
  6962. set_actual_length(tvb, offset + gtp_hdr->length);
  6963. } else {
  6964. switch (gtp_version) {
  6965. case 0:
  6966. seq_no = tvb_get_ntohs(tvb, offset);
  6967. proto_tree_add_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no);
  6968. offset += 2;
  6969. flow_label = tvb_get_ntohs(tvb, offset);
  6970. proto_tree_add_uint(gtp_tree, hf_gtp_flow_label, tvb, offset, 2, flow_label);
  6971. offset += 2;
  6972. pdu_no = tvb_get_guint8(tvb, offset);
  6973. proto_tree_add_uint(gtp_tree, hf_gtp_sndcp_number, tvb, offset, 1, pdu_no);
  6974. offset += 4;
  6975. tid_str = id_to_str(tvb, offset);
  6976. proto_tree_add_string(gtp_tree, hf_gtp_tid, tvb, offset, 8, tid_str);
  6977. offset += 8;
  6978. set_actual_length(tvb, offset + gtp_hdr->length);
  6979. break;
  6980. case 1:
  6981. gtp_hdr->teid = tvb_get_ntohl(tvb, offset);
  6982. proto_tree_add_item(gtp_tree, hf_gtp_teid, tvb, offset, 4, ENC_BIG_ENDIAN);
  6983. offset += 4;
  6984. set_actual_length(tvb, offset + gtp_hdr->length);
  6985. /* Are sequence number/N-PDU Number/extension header present?
  6986. See NOTE 5 of Figure 2 of 3GPP TS 29.060 version 4.3.0
  6987. Release 4 - the Sequence Number, N-PDU Number, and
  6988. Next Extension Header fields are present if any of
  6989. GTP_E_MASK, GTP_S_MASK, or GTP_PN_MASK are set. */
  6990. if (gtp_hdr->flags & (GTP_E_MASK|GTP_S_MASK|GTP_PN_MASK)) {
  6991. /* Those fields are only *interpreted* if the
  6992. particular flag for the field is set. */
  6993. if (gtp_hdr->flags & GTP_S_MASK) {
  6994. seq_no = tvb_get_ntohs(tvb, offset);
  6995. proto_tree_add_uint(gtp_tree, hf_gtp_seq_number, tvb, offset, 2, seq_no);
  6996. }
  6997. offset += 2;
  6998. if (gtp_hdr->flags & GTP_PN_MASK) {
  6999. pdu_no = tvb_get_guint8(tvb, offset);
  7000. proto_tree_add_uint(gtp_tree, hf_gtp_npdu_number, tvb, offset, 1, pdu_no);
  7001. }
  7002. offset++;
  7003. if (gtp_hdr->flags & GTP_E_MASK) {
  7004. next_hdr = tvb_get_guint8(tvb, offset);
  7005. proto_tree_add_uint(gtp_tree, hf_gtp_ext_hdr_next, tvb, offset, 1, next_hdr);
  7006. offset++;
  7007. while (next_hdr != 0) {
  7008. ext_hdr_length = tvb_get_guint8(tvb, offset);
  7009. tf = proto_tree_add_item(gtp_tree, hf_gtp_ext_hdr, tvb, offset, ext_hdr_length*4, ENC_NA);
  7010. ext_tree = proto_item_add_subtree(tf, ett_gtp_ext_hdr);
  7011. ext_hdr_len_item = proto_tree_add_item(ext_tree, hf_gtp_ext_hdr_length, tvb, offset,1, ENC_BIG_ENDIAN);
  7012. if (ext_hdr_length == 0) {
  7013. expert_add_info_format(pinfo, ext_hdr_len_item, PI_MALFORMED,
  7014. PI_ERROR,
  7015. "Extension header length is zero");
  7016. return tvb_length(tvb);
  7017. }
  7018. offset++;
  7019. switch (next_hdr) {
  7020. case GTP_EXT_HDR_PDCP_SN:
  7021. /* PDCP PDU
  7022. * 3GPP 29.281 v9.0.0, 5.2.2.2 PDCP PDU Number
  7023. *
  7024. * "This extension header is transmitted, for
  7025. * example in UTRAN, at SRNS relocation time,
  7026. * to provide the PDCP sequence number of not
  7027. * yet acknowledged N-PDUs. It is 4 octets long,
  7028. * and therefore the Length field has value 1.
  7029. *
  7030. * When used between two eNBs at the X2 interface
  7031. * in E-UTRAN, bits 5-8 of octet 2 are spare.
  7032. * The meaning of the spare bits shall be set
  7033. * to zero.
  7034. *
  7035. * Wireshark Note: TS 29.060 does not define bit
  7036. * 5-6 as spare, so no check is possible unless
  7037. * a preference is used.
  7038. */
  7039. /* First byte is length (should be 1) */
  7040. if (ext_hdr_length == 1) {
  7041. ext_hdr_pdcpsn = tvb_get_ntohs(tvb, offset);
  7042. if (ext_hdr_pdcpsn & 0x700) {
  7043. expert_add_info_format(pinfo, ext_tree, PI_PROTOCOL, PI_NOTE, "3GPP TS 29.281 v9.0.0: When used between two eNBs at the X2 interface in E-UTRAN, bits 5-8 of octet 2 are spare. The meaning of the spare bits shall be set to zero.");
  7044. }
  7045. proto_tree_add_item(ext_tree, hf_gtp_ext_hdr_pdcpsn, tvb, offset, 2, ENC_BIG_ENDIAN);
  7046. } else {
  7047. expert_add_info_format(pinfo, ext_tree, PI_PROTOCOL, PI_WARN, "The length field for the PDCP SN Extension header should be 1.");
  7048. }
  7049. break;
  7050. case GTP_EXT_HDR_UDP_PORT:
  7051. /* UDP Port
  7052. * 3GPP 29.281 v9.0.0, 5.2.2.1 UDP Port
  7053. * "This extension header may be transmitted in
  7054. * Error Indication messages to provide the UDP
  7055. * Source Port of the G-PDU that triggered the
  7056. * Error Indication. It is 4 octets long, and
  7057. * therefore the Length field has value 1"
  7058. */
  7059. if (ext_hdr_length == 1) {
  7060. /* UDP Port of source */
  7061. proto_tree_add_item(ext_tree, hf_gtp_ext_hdr_udp_port, tvb, offset, 2, ENC_BIG_ENDIAN);
  7062. } else {
  7063. /* Bad length */
  7064. expert_add_info_format(pinfo, ext_tree, PI_PROTOCOL, PI_WARN, "The length field for the UDP Port Extension header should be 1.");
  7065. }
  7066. break;
  7067. case GTP_EXT_HDR_SUSPEND_REQ:
  7068. /* Suspend Request */
  7069. break;
  7070. case GTP_EXT_HDR_SUSPEND_RESP:
  7071. /* Suspend Response */
  7072. break;
  7073. default:
  7074. break;
  7075. }
  7076. offset += ext_hdr_length*4 - 2;
  7077. next_hdr = tvb_get_guint8(tvb, offset);
  7078. proto_tree_add_uint(ext_tree, hf_gtp_ext_hdr_next, tvb, offset, 1, next_hdr);
  7079. offset++;
  7080. }
  7081. } else
  7082. offset++;
  7083. }
  7084. break;
  7085. default:
  7086. break;
  7087. }
  7088. }
  7089. if (gtp_hdr->message != GTP_MSG_TPDU) {
  7090. /* Dissect IEs */
  7091. mandatory = 0; /* check order of GTP fields against ETSI */
  7092. while (tvb_reported_length_remaining(tvb, offset) > 0) {
  7093. ext_hdr_val = tvb_get_guint8(tvb, offset);
  7094. if (g_gtp_etsi_order) {
  7095. checked_field = check_field_presence(gtp_hdr->message, ext_hdr_val, &mandatory);
  7096. switch (checked_field) {
  7097. case -2:
  7098. proto_tree_add_text(gtp_tree, tvb, 0, 0, "[WARNING] message not found");
  7099. break;
  7100. case -1:
  7101. proto_tree_add_text(gtp_tree, tvb, 0, 0, "[WARNING] field not present");
  7102. break;
  7103. case 0:
  7104. break;
  7105. default:
  7106. proto_tree_add_text(gtp_tree, tvb, offset, 1, "[WARNING] wrong next field, should be: %s",
  7107. val_to_str_ext_const(checked_field, &gtp_val_ext, "Unknown extension field"));
  7108. break;
  7109. }
  7110. }
  7111. i = -1;
  7112. while (gtpopt[++i].optcode)
  7113. if (gtpopt[i].optcode == ext_hdr_val)
  7114. break;
  7115. offset = offset + (*gtpopt[i].decode) (tvb, offset, pinfo, gtp_tree);
  7116. }
  7117. /*Use sequence number to track Req/Resp pairs*/
  7118. if (seq_no) {
  7119. gcrp = gtp_match_response(tvb, pinfo, gtp_tree, seq_no, gtp_hdr->message);
  7120. /*pass packet to tap for response time reporting*/
  7121. if (gcrp) {
  7122. tap_queue_packet(gtp_tap,pinfo,gcrp);
  7123. }
  7124. }
  7125. }
  7126. proto_item_set_end (ti, tvb, offset);
  7127. if ((gtp_hdr->message == GTP_MSG_TPDU) && dissect_tpdu_as == GTP_TPDU_AS_TPDU) {
  7128. if(tvb_reported_length_remaining(tvb, offset) > 0){
  7129. proto_tree_add_text(tree, tvb, offset, -1, "T-PDU Data %u bytes", tvb_reported_length_remaining(tvb, offset));
  7130. sub_proto = tvb_get_guint8(tvb, offset);
  7131. if ((sub_proto >= 0x45) && (sub_proto <= 0x4e)) {
  7132. /* this is most likely an IPv4 packet
  7133. * we can exclude 0x40 - 0x44 because the minimum header size is 20 octets
  7134. * 0x4f is excluded because PPP protocol type "IPv6 header compression"
  7135. * with protocol field compression is more likely than a plain IPv4 packet with 60 octet header size */
  7136. next_tvb = tvb_new_subset_remaining(tvb, offset);
  7137. call_dissector(ip_handle, next_tvb, pinfo, tree);
  7138. } else if ((sub_proto & 0xf0) == 0x60) {
  7139. /* this is most likely an IPv6 packet */
  7140. next_tvb = tvb_new_subset_remaining(tvb, offset);
  7141. call_dissector(ipv6_handle, next_tvb, pinfo, tree);
  7142. } else {
  7143. /* this seems to be a PPP packet */
  7144. if (sub_proto == 0xff) {
  7145. /* this might be an address field, even it shouldn't be here */
  7146. control_field = tvb_get_guint8(tvb, offset + 1);
  7147. if (control_field == 0x03)
  7148. /* now we are pretty sure that address and control field are mistakenly inserted -> ignore it for PPP dissection */
  7149. acfield_len = 2;
  7150. }
  7151. next_tvb = tvb_new_subset_remaining(tvb, offset + acfield_len);
  7152. call_dissector(ppp_handle, next_tvb, pinfo, tree);
  7153. }
  7154. }
  7155. col_prepend_fstr(pinfo->cinfo, COL_PROTOCOL, "GTP <");
  7156. col_append_str(pinfo->cinfo, COL_PROTOCOL, ">");
  7157. }
  7158. else if ((gtp_hdr->message == GTP_MSG_TPDU) && dissect_tpdu_as == GTP_TPDU_AS_SYNC) {
  7159. next_tvb = tvb_new_subset_remaining(tvb, offset + acfield_len);
  7160. call_dissector(sync_handle, next_tvb, pinfo, tree);
  7161. col_prepend_fstr(pinfo->cinfo, COL_PROTOCOL, "GTP <");
  7162. col_append_str(pinfo->cinfo, COL_PROTOCOL, ">");
  7163. }
  7164. pinfo->private_data = pd_save;
  7165. tap_queue_packet(gtpv1_tap,pinfo, gtp_hdr);
  7166. return tvb_length(tvb);
  7167. }
  7168. static int
  7169. dissect_gtpprim(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
  7170. void *private_data _U_)
  7171. {
  7172. return dissect_gtp_common(tvb, pinfo, tree);
  7173. }
  7174. static int
  7175. dissect_gtp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
  7176. void *private_data _U_)
  7177. {
  7178. guint8 version;
  7179. /*
  7180. * Do we have enough data to check the first byte?
  7181. */
  7182. if (!tvb_bytes_exist(tvb, 0, 1)) {
  7183. /* No. */
  7184. return 0;
  7185. }
  7186. /*
  7187. * If this is GTPv2-C call the gtpv2 dissector if present
  7188. * Should this be moved to after the conversation stuff to retain that functionality for GTPv2 ???
  7189. */
  7190. version = tvb_get_guint8(tvb,0)>>5;
  7191. if (version > 2) {
  7192. /* Unknown version - reject the packet */
  7193. return 0;
  7194. }
  7195. if (version == 2) {
  7196. /* GTPv2-C 3GPP TS 29.274 */
  7197. if (gtpv2_handle) {
  7198. call_dissector(gtpv2_handle, tvb, pinfo, tree);
  7199. return tvb_length(tvb);
  7200. }
  7201. }
  7202. return dissect_gtp_common(tvb, pinfo, tree);
  7203. }
  7204. static void
  7205. gtp_reinit(void)
  7206. {
  7207. gtp_conv_info_t *gtp_info;
  7208. /* Free up state attached to the gtp_info structures */
  7209. for (gtp_info = gtp_info_items; gtp_info != NULL; ) {
  7210. gtp_conv_info_t *next;
  7211. g_hash_table_destroy(gtp_info->matched);
  7212. gtp_info->matched=NULL;
  7213. g_hash_table_destroy(gtp_info->unmatched);
  7214. gtp_info->unmatched=NULL;
  7215. next = gtp_info->next;
  7216. g_free(gtp_info);
  7217. gtp_info = next;
  7218. }
  7219. gtp_info_items = NULL;
  7220. }
  7221. void
  7222. proto_register_gtp(void)
  7223. {
  7224. module_t *gtp_module;
  7225. guint i;
  7226. guint last_offset;
  7227. static hf_register_info hf_gtp[] = {
  7228. {&hf_gtp_ie_id,
  7229. { "IE Id", "gtp.ie_id",
  7230. FT_UINT8, BASE_DEC|BASE_EXT_STRING, &gtp_val_ext, 0x0,
  7231. NULL, HFILL}
  7232. },
  7233. {&hf_gtp_response_in,
  7234. { "Response In", "gtp.response_in",
  7235. FT_FRAMENUM, BASE_NONE, NULL, 0x0,
  7236. "The response to this GTP request is in this frame", HFILL}
  7237. },
  7238. {&hf_gtp_response_to,
  7239. { "Response To", "gtp.response_to",
  7240. FT_FRAMENUM, BASE_NONE, NULL, 0x0,
  7241. "This is a response to the GTP request in this frame", HFILL}
  7242. },
  7243. {&hf_gtp_time,
  7244. { "Time", "gtp.time",
  7245. FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
  7246. "The time between the Request and the Response", HFILL}
  7247. },
  7248. {&hf_gtp_apn,
  7249. { "APN", "gtp.apn",
  7250. FT_STRING, BASE_NONE, NULL, 0,
  7251. "Access Point Name", HFILL}
  7252. },
  7253. {&hf_gtp_cause,
  7254. { "Cause", "gtp.cause",
  7255. FT_UINT8, BASE_DEC|BASE_EXT_STRING, &cause_type_ext, 0,
  7256. "Cause of operation", HFILL}
  7257. },
  7258. {&hf_gtp_chrg_char,
  7259. { "Charging characteristics", "gtp.chrg_char",
  7260. FT_UINT16, BASE_DEC, NULL, 0,
  7261. NULL, HFILL}
  7262. },
  7263. {&hf_gtp_chrg_char_s,
  7264. { "Spare", "gtp.chrg_char_s",
  7265. FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_S,
  7266. NULL, HFILL}
  7267. },
  7268. {&hf_gtp_chrg_char_n,
  7269. { "Normal charging", "gtp.chrg_char_n",
  7270. FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_N,
  7271. NULL, HFILL}
  7272. },
  7273. {&hf_gtp_chrg_char_p,
  7274. { "Prepaid charging", "gtp.chrg_char_p",
  7275. FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_P,
  7276. NULL, HFILL}
  7277. },
  7278. {&hf_gtp_chrg_char_f,
  7279. { "Flat rate charging", "gtp.chrg_char_f",
  7280. FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_F,
  7281. NULL, HFILL}
  7282. },
  7283. {&hf_gtp_chrg_char_h,
  7284. { "Hot billing charging", "gtp.chrg_char_h",
  7285. FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_H,
  7286. NULL, HFILL}
  7287. },
  7288. {&hf_gtp_chrg_char_r,
  7289. { "Reserved", "gtp.chrg_char_r",
  7290. FT_UINT16, BASE_DEC, NULL, GTP_MASK_CHRG_CHAR_R,
  7291. NULL, HFILL}
  7292. },
  7293. {&hf_gtp_chrg_id,
  7294. { "Charging ID", "gtp.chrg_id",
  7295. FT_UINT32, BASE_HEX, NULL, 0,
  7296. NULL, HFILL}
  7297. },
  7298. {&hf_gtp_chrg_ipv4,
  7299. { "CG address IPv4", "gtp.chrg_ipv4",
  7300. FT_IPv4, BASE_NONE, NULL, 0,
  7301. "Charging Gateway address IPv4", HFILL}
  7302. },
  7303. {&hf_gtp_chrg_ipv6,
  7304. { "CG address IPv6", "gtp.chrg_ipv6",
  7305. FT_IPv6, BASE_NONE, NULL, 0,
  7306. "Charging Gateway address IPv6", HFILL}
  7307. },
  7308. {&hf_gtp_ext_flow_label,
  7309. { "Flow Label Data I", "gtp.ext_flow_label",
  7310. FT_UINT16, BASE_HEX, NULL, 0,
  7311. "Flow label data", HFILL}
  7312. },
  7313. {&hf_gtp_ext_id,
  7314. { "Extension identifier", "gtp.ext_id",
  7315. FT_UINT16, BASE_DEC|BASE_EXT_STRING, &sminmpec_values_ext, 0,
  7316. "Private Enterprise number", HFILL}
  7317. },
  7318. {&hf_gtp_ext_val,
  7319. { "Extension value", "gtp.ext_val",
  7320. FT_BYTES, BASE_NONE, NULL, 0,
  7321. NULL, HFILL}
  7322. },
  7323. {&hf_gtp_flags,
  7324. { "Flags", "gtp.flags",
  7325. FT_UINT8, BASE_HEX, NULL, 0,
  7326. "Ver/PT/Spare...", HFILL}
  7327. },
  7328. {&hf_gtp_ext_hdr,
  7329. { "Extension header", "gtp.ext_hdr",
  7330. FT_NONE, BASE_NONE, NULL, 0,
  7331. NULL, HFILL}
  7332. },
  7333. {&hf_gtp_ext_hdr_next,
  7334. { "Next extension header type", "gtp.ext_hdr.next",
  7335. FT_UINT8, BASE_HEX, VALS(next_extension_header_fieldvals), 0,
  7336. NULL, HFILL}
  7337. },
  7338. {&hf_gtp_ext_hdr_pdcpsn,
  7339. { "PDCP Sequence Number", "gtp.ext_hdr.pdcp_sn",
  7340. FT_UINT16, BASE_DEC, NULL, 0,
  7341. NULL, HFILL}
  7342. },
  7343. {&hf_gtp_ext_hdr_udp_port,
  7344. { "UDP Port", "gtp.ext_hdr.udp_port",
  7345. FT_UINT16, BASE_DEC, NULL, 0,
  7346. NULL, HFILL}
  7347. },
  7348. {&hf_gtp_ext_hdr_length,
  7349. { "Extension Header Length", "gtp.ext_hdr.length",
  7350. FT_UINT8, BASE_DEC, NULL, 0,
  7351. NULL, HFILL}
  7352. },
  7353. {&hf_gtp_flags_ver,
  7354. { "Version", "gtp.flags.version",
  7355. FT_UINT8, BASE_DEC, VALS(ver_types), GTP_VER_MASK,
  7356. "GTP Version", HFILL}
  7357. },
  7358. {&hf_gtp_prime_flags_ver,
  7359. { "Version", "gtp.prim.flags.version",
  7360. FT_UINT8, BASE_DEC,NULL, GTP_VER_MASK,
  7361. "GTP' Version", HFILL}
  7362. },
  7363. {&hf_gtp_flags_pt,
  7364. { "Protocol type", "gtp.flags.payload",
  7365. FT_UINT8, BASE_DEC, VALS(pt_types), GTP_PT_MASK,
  7366. NULL, HFILL}
  7367. },
  7368. {&hf_gtp_flags_spare1,
  7369. { "Reserved", "gtp.flags.reserved",
  7370. FT_UINT8, BASE_DEC, NULL, GTP_SPARE1_MASK,
  7371. "Reserved (shall be sent as '111' )", HFILL}
  7372. },
  7373. {&hf_gtp_flags_hdr_length,
  7374. { "Header length", "gtp.flags.hdr_length",
  7375. FT_BOOLEAN, 8, TFS(&gtp_hdr_length_vals), 0x01,
  7376. NULL, HFILL}
  7377. },
  7378. {&hf_gtp_flags_snn,
  7379. { "Is SNDCP N-PDU included?", "gtp.flags.snn",
  7380. FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_SNN_MASK,
  7381. "Is SNDCP N-PDU LLC Number included? (1 = yes, 0 = no)", HFILL}
  7382. },
  7383. {&hf_gtp_flags_spare2,
  7384. { "Reserved", "gtp.flags.reserved",
  7385. FT_UINT8, BASE_DEC, NULL, GTP_SPARE2_MASK,
  7386. "Reserved (shall be sent as '1' )", HFILL}
  7387. },
  7388. {&hf_gtp_flags_e,
  7389. { "Is Next Extension Header present?", "gtp.flags.e",
  7390. FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_E_MASK,
  7391. "Is Next Extension Header present? (1 = yes, 0 = no)", HFILL}
  7392. },
  7393. {&hf_gtp_flags_s,
  7394. { "Is Sequence Number present?", "gtp.flags.s",
  7395. FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_S_MASK,
  7396. "Is Sequence Number present? (1 = yes, 0 = no)", HFILL}
  7397. },
  7398. {&hf_gtp_flags_pn,
  7399. { "Is N-PDU number present?", "gtp.flags.pn",
  7400. FT_BOOLEAN, 8, TFS(&tfs_yes_no), GTP_PN_MASK,
  7401. "Is N-PDU number present? (1 = yes, 0 = no)", HFILL}
  7402. },
  7403. {&hf_gtp_flow_ii,
  7404. { "Flow Label Data II", "gtp.flow_ii",
  7405. FT_UINT16, BASE_DEC, NULL, 0,
  7406. "Downlink flow label data", HFILL}
  7407. },
  7408. {&hf_gtp_flow_label,
  7409. { "Flow label", "gtp.flow_label",
  7410. FT_UINT16, BASE_HEX, NULL, 0,
  7411. NULL, HFILL}
  7412. },
  7413. {&hf_gtp_flow_sig,
  7414. { "Flow label Signalling", "gtp.flow_sig",
  7415. FT_UINT16, BASE_HEX, NULL, 0,
  7416. NULL, HFILL}
  7417. },
  7418. {&hf_gtp_gsn_addr_len,
  7419. { "GSN Address Length", "gtp.gsn_addr_len",
  7420. FT_UINT8, BASE_DEC, NULL, GTP_EXT_GSN_ADDR_LEN_MASK,
  7421. NULL, HFILL}
  7422. },
  7423. {&hf_gtp_gsn_addr_type,
  7424. { "GSN Address Type", "gtp.gsn_addr_type",
  7425. FT_UINT8, BASE_DEC, VALS(gsn_addr_type), GTP_EXT_GSN_ADDR_TYPE_MASK,
  7426. NULL, HFILL}
  7427. },
  7428. {&hf_gtp_gsn_ipv4,
  7429. { "GSN address IPv4", "gtp.gsn_ipv4",
  7430. FT_IPv4, BASE_NONE, NULL, 0,
  7431. NULL, HFILL}
  7432. },
  7433. {&hf_gtp_gsn_ipv6,
  7434. { "GSN address IPv6", "gtp.gsn_ipv6",
  7435. FT_IPv6, BASE_NONE, NULL, 0,
  7436. NULL, HFILL}
  7437. },
  7438. {&hf_gtp_imsi,
  7439. { "IMSI", "gtp.imsi",
  7440. FT_STRING, BASE_NONE, NULL, 0,
  7441. "International Mobile Subscriber Identity number", HFILL}
  7442. },
  7443. {&hf_gtp_length,
  7444. { "Length", "gtp.length",
  7445. FT_UINT16, BASE_DEC, NULL, 0,
  7446. "Length (i.e. number of octets after TID or TEID)", HFILL}
  7447. },
  7448. {&hf_gtp_map_cause,
  7449. { "MAP cause", "gtp.map_cause",
  7450. FT_UINT8, BASE_DEC, VALS(gsm_old_GSMMAPLocalErrorcode_vals), 0,
  7451. NULL, HFILL}
  7452. },
  7453. {&hf_gtp_message_type,
  7454. { "Message Type", "gtp.message",
  7455. FT_UINT8, BASE_HEX|BASE_EXT_STRING, &gtp_message_type_ext, 0x0,
  7456. "GTP Message Type", HFILL}
  7457. },
  7458. {&hf_gtp_ms_reason,
  7459. { "MS not reachable reason", "gtp.ms_reason",
  7460. FT_UINT8, BASE_DEC, VALS(ms_not_reachable_type), 0,
  7461. NULL, HFILL}
  7462. },
  7463. {&hf_gtp_ms_valid,
  7464. { "MS validated", "gtp.ms_valid",
  7465. FT_BOOLEAN, BASE_NONE, NULL, 0x0,
  7466. NULL, HFILL}
  7467. },
  7468. {&hf_gtp_node_ipv4,
  7469. { "Node address IPv4", "gtp.node_ipv4",
  7470. FT_IPv4, BASE_NONE, NULL, 0,
  7471. "Recommended node address IPv4", HFILL}
  7472. },
  7473. {&hf_gtp_node_ipv6,
  7474. { "Node address IPv6", "gtp.node_ipv6",
  7475. FT_IPv6, BASE_NONE, NULL, 0,
  7476. "Recommended node address IPv6", HFILL}
  7477. },
  7478. {&hf_gtp_npdu_number,
  7479. { "N-PDU Number", "gtp.npdu_number",
  7480. FT_UINT8, BASE_HEX, NULL, 0,
  7481. NULL, HFILL}
  7482. },
  7483. {&hf_gtp_nsapi,
  7484. { "NSAPI", "gtp.nsapi",
  7485. FT_UINT8, BASE_DEC, NULL, 0x0f,
  7486. "Network layer Service Access Point Identifier", HFILL}
  7487. },
  7488. {&hf_gtp_qos_version,
  7489. { "Version", "gtp.qos_version",
  7490. FT_UINT8, BASE_HEX, NULL, 0,
  7491. "Version of the QoS Profile", HFILL}
  7492. },
  7493. {&hf_gtp_qos_spare1,
  7494. { "Spare", "gtp.qos_spare1",
  7495. FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE1_MASK,
  7496. "Spare (shall be sent as '00' )", HFILL}
  7497. },
  7498. {&hf_gtp_qos_delay,
  7499. { "QoS delay", "gtp.qos_delay",
  7500. FT_UINT8, BASE_DEC, VALS(qos_delay_type), GTP_EXT_QOS_DELAY_MASK,
  7501. "Quality of Service Delay Class", HFILL}
  7502. },
  7503. {&hf_gtp_qos_reliability,
  7504. { "QoS reliability", "gtp.qos_reliability",
  7505. FT_UINT8, BASE_DEC, VALS(qos_reliability_type), GTP_EXT_QOS_RELIABILITY_MASK,
  7506. "Quality of Service Reliability Class", HFILL}
  7507. },
  7508. {&hf_gtp_qos_peak,
  7509. { "QoS peak", "gtp.qos_peak",
  7510. FT_UINT8, BASE_DEC, VALS(qos_peak_type), GTP_EXT_QOS_PEAK_MASK,
  7511. "Quality of Service Peak Throughput", HFILL}
  7512. },
  7513. {&hf_gtp_qos_spare2,
  7514. { "Spare", "gtp.qos_spare2",
  7515. FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE2_MASK,
  7516. "Spare (shall be sent as 0)", HFILL}
  7517. },
  7518. {&hf_gtp_qos_precedence,
  7519. { "QoS precedence", "gtp.qos_precedence",
  7520. FT_UINT8, BASE_DEC, VALS(qos_precedence_type), GTP_EXT_QOS_PRECEDENCE_MASK,
  7521. "Quality of Service Precedence Class", HFILL}
  7522. },
  7523. {&hf_gtp_qos_spare3,
  7524. { "Spare", "gtp.qos_spare3",
  7525. FT_UINT8, BASE_DEC, NULL, GTP_EXT_QOS_SPARE3_MASK,
  7526. "Spare (shall be sent as '000' )", HFILL}
  7527. },
  7528. {&hf_gtp_qos_mean,
  7529. { "QoS mean", "gtp.qos_mean",
  7530. FT_UINT8, BASE_DEC|BASE_EXT_STRING, &qos_mean_type_ext, GTP_EXT_QOS_MEAN_MASK,
  7531. "Quality of Service Mean Throughput", HFILL}
  7532. },
  7533. {&hf_gtp_qos_al_ret_priority,
  7534. { "Allocation/Retention priority", "gtp.qos_al_ret_priority",
  7535. FT_UINT8, BASE_DEC, NULL, 0,
  7536. NULL, HFILL}
  7537. },
  7538. {&hf_gtp_qos_traf_class,
  7539. { "Traffic class", "gtp.qos_traf_class",
  7540. FT_UINT8, BASE_DEC, VALS(qos_traf_class), GTP_EXT_QOS_TRAF_CLASS_MASK,
  7541. NULL, HFILL}
  7542. },
  7543. {&hf_gtp_qos_del_order,
  7544. { "Delivery order", "gtp.qos_del_order",
  7545. FT_UINT8, BASE_DEC, VALS(qos_del_order), GTP_EXT_QOS_DEL_ORDER_MASK,
  7546. NULL, HFILL}
  7547. },
  7548. {&hf_gtp_qos_del_err_sdu,
  7549. { "Delivery of erroneous SDU", "gtp.qos_del_err_sdu",
  7550. FT_UINT8, BASE_DEC, VALS(qos_del_err_sdu), GTP_EXT_QOS_DEL_ERR_SDU_MASK,
  7551. NULL, HFILL}
  7552. },
  7553. {&hf_gtp_qos_max_sdu_size,
  7554. { "Maximum SDU size", "gtp.qos_max_sdu_size",
  7555. FT_UINT8, BASE_DEC, VALS(qos_max_sdu_size), 0,
  7556. NULL, HFILL}
  7557. },
  7558. {&hf_gtp_qos_max_ul,
  7559. { "Maximum bit rate for uplink", "gtp.qos_max_ul",
  7560. FT_UINT8, BASE_DEC, VALS(qos_max_ul), 0,
  7561. NULL, HFILL}
  7562. },
  7563. {&hf_gtp_qos_max_dl,
  7564. { "Maximum bit rate for downlink", "gtp.qos_max_dl",
  7565. FT_UINT8, BASE_DEC, VALS(qos_max_dl), 0,
  7566. NULL, HFILL}
  7567. },
  7568. {&hf_gtp_qos_res_ber,
  7569. { "Residual BER", "gtp.qos_res_ber",
  7570. FT_UINT8, BASE_DEC, VALS(qos_res_ber), GTP_EXT_QOS_RES_BER_MASK,
  7571. "Residual Bit Error Rate", HFILL}
  7572. },
  7573. {&hf_gtp_qos_sdu_err_ratio,
  7574. { "SDU Error ratio", "gtp.qos_sdu_err_ratio",
  7575. FT_UINT8, BASE_DEC, VALS(qos_sdu_err_ratio), GTP_EXT_QOS_SDU_ERR_RATIO_MASK,
  7576. NULL,
  7577. HFILL}
  7578. },
  7579. {&hf_gtp_qos_trans_delay,
  7580. { "Transfer delay", "gtp.qos_trans_delay",
  7581. FT_UINT8, BASE_DEC|BASE_EXT_STRING, &qos_trans_delay_ext, GTP_EXT_QOS_TRANS_DELAY_MASK,
  7582. NULL, HFILL}
  7583. },
  7584. {&hf_gtp_qos_traf_handl_prio,
  7585. { "Traffic handling priority", "gtp.qos_traf_handl_prio",
  7586. FT_UINT8, BASE_DEC, VALS(qos_traf_handl_prio), GTP_EXT_QOS_TRAF_HANDL_PRIORITY_MASK,
  7587. NULL, HFILL}
  7588. },
  7589. {&hf_gtp_qos_guar_ul,
  7590. { "Guaranteed bit rate for uplink", "gtp.qos_guar_ul",
  7591. FT_UINT8, BASE_DEC, VALS(qos_guar_ul), 0,
  7592. NULL, HFILL}
  7593. },
  7594. {&hf_gtp_qos_guar_dl,
  7595. { "Guaranteed bit rate for downlink", "gtp.qos_guar_dl",
  7596. FT_UINT8, BASE_DEC, VALS(qos_guar_dl), 0,
  7597. NULL, HFILL}
  7598. },
  7599. {&hf_gtp_qos_src_stat_desc,
  7600. { "Source Statistics Descriptor", "gtp.src_stat_desc",
  7601. FT_UINT8, BASE_DEC, VALS(src_stat_desc_vals), GTP_EXT_QOS_SRC_STAT_DESC_MASK,
  7602. NULL, HFILL}
  7603. },
  7604. {&hf_gtp_qos_sig_ind,
  7605. { "Signalling Indication", "gtp.sig_ind",
  7606. FT_BOOLEAN, 8, TFS(&gtp_sig_ind), GTP_EXT_QOS_SIG_IND_MASK,
  7607. NULL, HFILL}
  7608. },
  7609. { &hf_gtp_qos_arp_pci,
  7610. {"Pre-emption Capability (PCI)", "gtp.qos_arp_pci",
  7611. FT_BOOLEAN, 8, TFS(&tfs_disabled_enabled), 0x40,
  7612. NULL, HFILL}
  7613. },
  7614. { &hf_gtp_qos_arp_pl,
  7615. {"Priority Level", "gtp.qos_arp_pl",
  7616. FT_UINT8, BASE_DEC, NULL, 0x3c,
  7617. NULL, HFILL}
  7618. },
  7619. { &hf_gtp_qos_arp_pvi,
  7620. {"Pre-emption Vulnerability (PVI)", "gtp.qos_arp_pvi",
  7621. FT_BOOLEAN, 8, TFS(&tfs_disabled_enabled), 0x01,
  7622. NULL, HFILL}
  7623. },
  7624. {&hf_gtp_qos_qci,
  7625. {"QCI", "gtp.qos_qci",
  7626. FT_UINT8, BASE_DEC, NULL, 0x0,
  7627. NULL, HFILL}
  7628. },
  7629. {&hf_gtp_qos_ul_mbr,
  7630. {"Uplink Maximum Bit Rate", "gtp.qos_ul_mbr",
  7631. FT_UINT64, BASE_DEC, NULL, 0x0,
  7632. NULL, HFILL}
  7633. },
  7634. {&hf_gtp_qos_dl_mbr,
  7635. {"Downlink Maximum Bit Rate", "gtp.qos_dl_mbr",
  7636. FT_UINT64, BASE_DEC, NULL, 0x0,
  7637. NULL, HFILL}
  7638. },
  7639. {&hf_gtp_qos_ul_gbr,
  7640. {"Uplink Guaranteed Bit Rate", "gtp.qos_ul_gbr",
  7641. FT_UINT64, BASE_DEC, NULL, 0x0,
  7642. NULL, HFILL}
  7643. },
  7644. {&hf_gtp_qos_dl_gbr,
  7645. {"Downlink Guaranteed Bit Rate", "gtp.qos_dl_gbr",
  7646. FT_UINT64, BASE_DEC, NULL, 0x0,
  7647. NULL, HFILL}
  7648. },
  7649. {&hf_gtp_qos_ul_apn_ambr,
  7650. {"Uplink APN Aggregate Maximum Bit Rate", "gtp.qos_ul_apn_ambr",
  7651. FT_UINT32, BASE_DEC, NULL, 0x0,
  7652. NULL, HFILL}
  7653. },
  7654. {&hf_gtp_qos_dl_apn_ambr,
  7655. {"Downlink APN Aggregate Maximum Bit Rate", "gtp.qos_dl_apn_ambr",
  7656. FT_UINT32, BASE_DEC, NULL, 0x0,
  7657. NULL, HFILL}
  7658. },
  7659. {&hf_gtp_pkt_flow_id,
  7660. { "Packet Flow ID", "gtp.pkt_flow_id",
  7661. FT_UINT8, BASE_DEC, NULL, 0,
  7662. NULL, HFILL}
  7663. },
  7664. {&hf_gtp_ptmsi,
  7665. { "P-TMSI", "gtp.ptmsi",
  7666. FT_UINT32, BASE_HEX, NULL, 0,
  7667. "Packet-Temporary Mobile Subscriber Identity", HFILL}
  7668. },
  7669. {&hf_gtp_ptmsi_sig,
  7670. { "P-TMSI Signature", "gtp.ptmsi_sig",
  7671. FT_UINT24, BASE_HEX, NULL, 0,
  7672. NULL, HFILL}
  7673. },
  7674. {&hf_gtp_rab_gtpu_dn,
  7675. { "Downlink GTP-U seq number", "gtp.rab_gtp_dn",
  7676. FT_UINT16, BASE_DEC, NULL, 0,
  7677. "Downlink GTP-U sequence number", HFILL}
  7678. },
  7679. {&hf_gtp_rab_gtpu_up,
  7680. { "Uplink GTP-U seq number", "gtp.rab_gtp_up",
  7681. FT_UINT16, BASE_DEC, NULL, 0,
  7682. "Uplink GTP-U sequence number", HFILL}
  7683. },
  7684. {&hf_gtp_rab_pdu_dn,
  7685. { "Downlink next PDCP-PDU seq number", "gtp.rab_pdu_dn",
  7686. FT_UINT16, BASE_DEC, NULL, 0,
  7687. "Downlink next PDCP-PDU sequence number", HFILL}
  7688. },
  7689. {&hf_gtp_rab_pdu_up,
  7690. { "Uplink next PDCP-PDU seq number", "gtp.rab_pdu_up",
  7691. FT_UINT16, BASE_DEC, NULL, 0,
  7692. "Uplink next PDCP-PDU sequence number", HFILL}
  7693. },
  7694. {&hf_gtp_rai_rac,
  7695. { "RAC", "gtp.rac",
  7696. FT_UINT8, BASE_DEC, NULL, 0,
  7697. "Routing Area Code", HFILL}
  7698. },
  7699. {&hf_gtp_rai_lac,
  7700. { "LAC", "gtp.lac",
  7701. FT_UINT16, BASE_DEC, NULL, 0,
  7702. "Location Area Code", HFILL}
  7703. },
  7704. { &hf_gtp_tac,
  7705. {"TAC", "gtp.tac",
  7706. FT_UINT16, BASE_DEC, NULL, 0,
  7707. "Tracking Area Code", HFILL}
  7708. },
  7709. { &hf_gtp_eci,
  7710. {"ECI", "gtp.eci",
  7711. FT_UINT32, BASE_DEC, NULL, 0x0FFFFFFF,
  7712. "E-UTRAN Cell Identifier", HFILL}
  7713. },
  7714. {&hf_gtp_ranap_cause,
  7715. { "RANAP cause", "gtp.ranap_cause",
  7716. FT_UINT8, BASE_DEC|BASE_EXT_STRING, &ranap_cause_type_ext, 0,
  7717. NULL, HFILL}
  7718. },
  7719. {&hf_gtp_recovery,
  7720. { "Recovery", "gtp.recovery",
  7721. FT_UINT8, BASE_DEC, NULL, 0,
  7722. "Restart counter", HFILL}
  7723. },
  7724. {&hf_gtp_reorder,
  7725. { "Reordering required", "gtp.reorder",
  7726. FT_BOOLEAN, BASE_NONE, NULL, 0x0,
  7727. NULL, HFILL}
  7728. },
  7729. {&hf_gtp_rnc_ipv4,
  7730. { "RNC address IPv4", "gtp.rnc_ipv4",
  7731. FT_IPv4, BASE_NONE, NULL, 0,
  7732. "Radio Network Controller address IPv4", HFILL}
  7733. },
  7734. {&hf_gtp_rnc_ipv6,
  7735. { "RNC address IPv6", "gtp.rnc_ipv6",
  7736. FT_IPv6, BASE_NONE, NULL, 0,
  7737. "Radio Network Controller address IPv6", HFILL}
  7738. },
  7739. {&hf_gtp_rp,
  7740. { "Radio Priority", "gtp.rp",
  7741. FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_MASK,
  7742. "Radio Priority for uplink tx", HFILL}
  7743. },
  7744. {&hf_gtp_rp_nsapi,
  7745. { "NSAPI in Radio Priority", "gtp.rp_nsapi",
  7746. FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_NSAPI_MASK,
  7747. "Network layer Service Access Point Identifier in Radio Priority", HFILL}
  7748. },
  7749. {&hf_gtp_rp_sms,
  7750. { "Radio Priority SMS", "gtp.rp_sms",
  7751. FT_UINT8, BASE_DEC, NULL, 0,
  7752. "Radio Priority for MO SMS", HFILL}
  7753. },
  7754. {&hf_gtp_rp_spare,
  7755. { "Reserved", "gtp.rp_spare",
  7756. FT_UINT8, BASE_DEC, NULL, GTPv1_EXT_RP_SPARE_MASK,
  7757. "Spare bit", HFILL}
  7758. },
  7759. {&hf_gtp_sel_mode,
  7760. { "Selection mode", "gtp.sel_mode",
  7761. FT_UINT8, BASE_DEC, VALS(sel_mode_type), 0x03,
  7762. NULL, HFILL}
  7763. },
  7764. {&hf_gtp_seq_number,
  7765. { "Sequence number", "gtp.seq_number",
  7766. FT_UINT16, BASE_HEX, NULL, 0,
  7767. NULL, HFILL}
  7768. },
  7769. {&hf_gtp_sndcp_number,
  7770. { "SNDCP N-PDU LLC Number", "gtp.sndcp_number",
  7771. FT_UINT8, BASE_HEX, NULL, 0,
  7772. NULL, HFILL}
  7773. },
  7774. {&hf_gtp_tear_ind,
  7775. { "Teardown Indicator", "gtp.tear_ind",
  7776. FT_BOOLEAN, BASE_NONE, NULL, 0x0,
  7777. NULL, HFILL}
  7778. },
  7779. {&hf_gtp_teid,
  7780. { "TEID", "gtp.teid",
  7781. FT_UINT32, BASE_HEX, NULL, 0,
  7782. "Tunnel Endpoint Identifier", HFILL}
  7783. },
  7784. {&hf_gtp_teid_cp,
  7785. { "TEID Control Plane", "gtp.teid_cp",
  7786. FT_UINT32, BASE_HEX, NULL, 0,
  7787. "Tunnel Endpoint Identifier Control Plane", HFILL}
  7788. },
  7789. {&hf_gtp_ulink_teid_cp,
  7790. { "Uplink TEID Control Plane", "gtp.ulink_teid_cp",
  7791. FT_UINT32, BASE_HEX, NULL, 0,
  7792. "Uplink Tunnel Endpoint Identifier Control Plane", HFILL}
  7793. },
  7794. {&hf_gtp_teid_data,
  7795. { "TEID Data I", "gtp.teid_data",
  7796. FT_UINT32, BASE_HEX, NULL, 0,
  7797. "Tunnel Endpoint Identifier Data I", HFILL}
  7798. },
  7799. {&hf_gtp_ulink_teid_data,
  7800. { "Uplink TEID Data I", "gtp.ulink_teid_data",
  7801. FT_UINT32, BASE_HEX, NULL, 0,
  7802. "UplinkTunnel Endpoint Identifier Data I", HFILL}
  7803. },
  7804. {&hf_gtp_teid_ii,
  7805. { "TEID Data II", "gtp.teid_ii",
  7806. FT_UINT32, BASE_HEX, NULL, 0,
  7807. "Tunnel Endpoint Identifier Data II", HFILL}
  7808. },
  7809. {&hf_gtp_tft_code,
  7810. { "TFT operation code", "gtp.tft_code",
  7811. FT_UINT8, BASE_DEC, VALS(tft_code_type), GTPv1_TFT_CODE_MASK,
  7812. NULL, HFILL}
  7813. },
  7814. {&hf_gtp_tft_spare,
  7815. { "TFT spare bit", "gtp.tft_spare",
  7816. FT_UINT8, BASE_DEC, NULL, GTPv1_TFT_SPARE_MASK,
  7817. NULL, HFILL}
  7818. },
  7819. {&hf_gtp_tft_number,
  7820. { "Number of packet filters", "gtp.tft_number",
  7821. FT_UINT8, BASE_DEC, NULL, GTPv1_TFT_NUMBER_MASK,
  7822. NULL, HFILL}
  7823. },
  7824. {&hf_gtp_tft_eval,
  7825. { "Evaluation precedence", "gtp.tft_eval",
  7826. FT_UINT8, BASE_DEC, NULL, 0,
  7827. NULL, HFILL}
  7828. },
  7829. {&hf_gtp_tid,
  7830. { "TID", "gtp.tid",
  7831. FT_STRING, BASE_NONE, NULL, 0,
  7832. "Tunnel Identifier", HFILL}
  7833. },
  7834. {&hf_gtp_tlli,
  7835. { "TLLI", "gtp.tlli",
  7836. FT_UINT32, BASE_HEX, NULL, 0,
  7837. "Temporary Logical Link Identity", HFILL}
  7838. },
  7839. {&hf_gtp_tr_comm,
  7840. { "Packet transfer command", "gtp.tr_comm",
  7841. FT_UINT8, BASE_DEC, VALS(tr_comm_type), 0,
  7842. NULL, HFILL}
  7843. },
  7844. {&hf_gtp_trace_ref,
  7845. { "Trace reference", "gtp.trace_ref",
  7846. FT_UINT16, BASE_HEX, NULL, 0,
  7847. NULL, HFILL}
  7848. },
  7849. {&hf_gtp_trace_type,
  7850. { "Trace type", "gtp.trace_type",
  7851. FT_UINT16, BASE_HEX, NULL, 0,
  7852. NULL, HFILL}
  7853. },
  7854. {&hf_gtp_user_addr_pdp_org,
  7855. { "PDP type organization", "gtp.user_addr_pdp_org",
  7856. FT_UINT8, BASE_DEC, VALS(pdp_org_type), 0,
  7857. NULL, HFILL}
  7858. },
  7859. {&hf_gtp_user_addr_pdp_type,
  7860. { "PDP type number", "gtp.user_addr_pdp_type",
  7861. FT_UINT8, BASE_HEX, VALS(pdp_type), 0,
  7862. NULL, HFILL}
  7863. },
  7864. {&hf_gtp_user_ipv4,
  7865. { "End user address IPv4", "gtp.user_ipv4",
  7866. FT_IPv4, BASE_NONE, NULL, 0,
  7867. NULL, HFILL}
  7868. },
  7869. {&hf_gtp_user_ipv6,
  7870. { "End user address IPv6", "gtp.user_ipv6",
  7871. FT_IPv6, BASE_NONE, NULL, 0,
  7872. NULL, HFILL}
  7873. },
  7874. {&hf_gtp_security_mode,
  7875. { "Security Mode", "gtp.security_mode",
  7876. FT_UINT8, BASE_DEC, VALS(mm_sec_modep), 0xc0,
  7877. NULL, HFILL}
  7878. },
  7879. {&hf_gtp_no_of_vectors,
  7880. { "No of Vectors", "gtp.no_of_vectors",
  7881. FT_UINT8, BASE_DEC, NULL, 0x38,
  7882. NULL, HFILL}
  7883. },
  7884. {&hf_gtp_cipher_algorithm,
  7885. { "Cipher Algorithm", "gtp.cipher_algorithm",
  7886. FT_UINT8, BASE_DEC, VALS(gtp_cipher_algorithm), 0x07,
  7887. NULL, HFILL}
  7888. },
  7889. {&hf_gtp_cksn_ksi,
  7890. { "Ciphering Key Sequence Number (CKSN)/Key Set Identifier (KSI)", "gtp.cksn_ksi",
  7891. FT_UINT8, BASE_DEC, NULL, 0x07,
  7892. "CKSN/KSI", HFILL}
  7893. },
  7894. {&hf_gtp_cksn,
  7895. { "Ciphering Key Sequence Number (CKSN)", "gtp.cksn",
  7896. FT_UINT8, BASE_DEC, NULL, 0x07,
  7897. "CKSN", HFILL}
  7898. },
  7899. {&hf_gtp_ksi,
  7900. { "Key Set Identifier (KSI)", "gtp.ksi",
  7901. FT_UINT8, BASE_DEC, NULL, 0x07,
  7902. "KSI", HFILL}
  7903. },
  7904. {&hf_gtp_ext_length,
  7905. { "Length", "gtp.ext_length",
  7906. FT_UINT16, BASE_DEC, NULL, 0x0,
  7907. "IE Length", HFILL}
  7908. },
  7909. {&hf_gtp_utran_field,
  7910. { "UTRAN Transparent Field", "gtp.utran_field",
  7911. FT_BYTES, BASE_NONE, NULL, 0x0,
  7912. NULL, HFILL}
  7913. },
  7914. {&hf_gtp_ext_apn_res,
  7915. { "Restriction Type", "gtp.ext_apn_res",
  7916. FT_UINT8, BASE_DEC, NULL, 0x0,
  7917. NULL, HFILL}
  7918. },
  7919. {&hf_gtp_ext_rat_type,
  7920. { "RAT Type", "gtp.ext_rat_type",
  7921. FT_UINT8, BASE_DEC, VALS(gtp_ext_rat_type_vals), 0x0,
  7922. NULL, HFILL}
  7923. },
  7924. {&hf_gtp_ext_geo_loc_type,
  7925. { "Geographic Location Type", "gtp.ext_geo_loc_type",
  7926. FT_UINT8, BASE_DEC, NULL, 0x0,
  7927. NULL, HFILL}
  7928. },
  7929. {&hf_gtp_ext_sac,
  7930. { "SAC", "gtp.ext_sac",
  7931. FT_UINT16, BASE_HEX, NULL, 0x0,
  7932. NULL, HFILL}
  7933. },
  7934. {&hf_gtp_ext_imeisv,
  7935. { "IMEI(SV)", "gtp.ext_imeisv",
  7936. FT_STRING, BASE_NONE, NULL, 0x0,
  7937. NULL, HFILL}
  7938. },
  7939. { &hf_gtp_target_rnc_id,
  7940. { "targetRNC-ID", "gtp.targetRNC_ID",
  7941. FT_UINT16, BASE_HEX, NULL, 0x0fff,
  7942. NULL, HFILL }
  7943. },
  7944. { &hf_gtp_target_ext_rnc_id,
  7945. { "Extended RNC-ID", "gtp.target_ext_RNC_ID",
  7946. FT_UINT16, BASE_HEX, NULL, 0,
  7947. NULL, HFILL }
  7948. },
  7949. {&hf_gtp_bssgp_cause,
  7950. { "BSSGP Cause", "gtp.bssgp_cause",
  7951. FT_UINT8, BASE_DEC|BASE_EXT_STRING, &bssgp_cause_vals_ext, 0,
  7952. NULL, HFILL}
  7953. },
  7954. { &hf_gtp_bssgp_ra_discriminator,
  7955. { "Routing Address Discriminator", "gtp.bssgp.rad",
  7956. FT_UINT8, BASE_DEC, VALS(gtp_bssgp_ra_discriminator_vals), 0x0f,
  7957. NULL, HFILL }
  7958. },
  7959. {&hf_gtp_sapi,
  7960. { "PS Handover XID SAPI", "gtp.ps_handover_xid_sapi",
  7961. FT_UINT8, BASE_DEC, NULL, 0x0F,
  7962. "SAPI", HFILL}
  7963. },
  7964. {&hf_gtp_xid_par_len,
  7965. { "PS Handover XID parameter length", "gtp.ps_handover_xid_par_len",
  7966. FT_UINT8, BASE_DEC, NULL, 0xFF,
  7967. "XID parameter length", HFILL}
  7968. },
  7969. {&hf_gtp_earp_pvi,
  7970. { "PVI Pre-emption Vulnerability", "gtp.EARP_pre_emption_par_vulnerability",
  7971. FT_BOOLEAN, 8, TFS(&tfs_disabled_enabled), 0x01,
  7972. NULL, HFILL}
  7973. },
  7974. {&hf_gtp_earp_pl,
  7975. { "PL Priority Level", "gtp.EARP_priority_level",
  7976. FT_UINT8, BASE_DEC, NULL, 0x3C,
  7977. NULL, HFILL}
  7978. },
  7979. {&hf_gtp_earp_pci,
  7980. { "PCI Pre-emption Capability", "gtp.EARP_pre_emption_Capability",
  7981. FT_BOOLEAN, 8, TFS(&tfs_disabled_enabled), 0x40,
  7982. NULL, HFILL}
  7983. },
  7984. {&hf_gtp_cdr_app,
  7985. { "Application Identifier", "gtp.cdr_app",
  7986. FT_UINT8, BASE_DEC, NULL, 0xf0,
  7987. NULL, HFILL}
  7988. },
  7989. { &hf_gtp_cdr_rel,
  7990. { "Release Identifier", "gtp.cdr_rel",
  7991. FT_UINT8, BASE_DEC, NULL, 0x0f,
  7992. NULL, HFILL}
  7993. },
  7994. { &hf_gtp_cdr_ver,
  7995. { "Version Identifier", "gtp.cdr_ver",
  7996. FT_UINT8, BASE_DEC, NULL, 0x0,
  7997. NULL, HFILL}
  7998. },
  7999. {&hf_gtp_cmn_flg_ppc,
  8000. { "Prohibit Payload Compression", "gtp.cmn_flg.ppc",
  8001. FT_BOOLEAN, 8, NULL, 0x01,
  8002. NULL, HFILL}
  8003. },
  8004. {&hf_gtp_cmn_flg_mbs_srv_type,
  8005. { "MBMS Service Type", "gtp.cmn_flg.mbs_srv_type",
  8006. FT_BOOLEAN, 8, NULL, 0x02,
  8007. NULL, HFILL}
  8008. },
  8009. {&hf_gtp_cmn_flg_mbs_ran_pcd_rdy,
  8010. { "RAN Procedures Ready", "gtp.cmn_flg.mbs_ran_pcd_rdy",
  8011. FT_BOOLEAN, 8, NULL, 0x04,
  8012. NULL, HFILL}
  8013. },
  8014. {&hf_gtp_cmn_flg_mbs_cnt_inf,
  8015. { "MBMS Counting Information", "gtp.cmn_flg.mbs_cnt_inf",
  8016. FT_BOOLEAN, 8, NULL, 0x08,
  8017. NULL, HFILL}
  8018. },
  8019. {&hf_gtp_cmn_flg_no_qos_neg,
  8020. { "No QoS negotiation", "gtp.cmn_flg.no_qos_neg",
  8021. FT_BOOLEAN, 8, NULL, 0x10,
  8022. NULL, HFILL}
  8023. },
  8024. {&hf_gtp_cmn_flg_nrsn,
  8025. { "NRSN bit field", "gtp.cmn_flg.nrsn",
  8026. FT_BOOLEAN, 8, NULL, 0x20,
  8027. NULL, HFILL}
  8028. },
  8029. {&hf_gtp_cmn_flg_upgrd_qos_sup,
  8030. { "Upgrade QoS Supported", "gtp.cmn_flg.upgrd_qos_sup",
  8031. FT_BOOLEAN, 8, NULL, 0x40,
  8032. NULL, HFILL}
  8033. },
  8034. {&hf_gtp_cmn_flg_dual_addr_bearer_flg,
  8035. { "Dual Address Bearer Flag", "gtp.cmn_flg.dual_addr_bearer_flg",
  8036. FT_BOOLEAN, 8, NULL, 0x80,
  8037. NULL, HFILL}
  8038. },
  8039. {&hf_gtp_tmgi,
  8040. { "Temporary Mobile Group Identity (TMGI)", "gtp.tmgi",
  8041. FT_BYTES, BASE_NONE, NULL, 0x0,
  8042. NULL, HFILL}
  8043. },
  8044. {&hf_gtp_no_of_mbms_sa_codes,
  8045. { "Number of MBMS service area codes", "gtp.no_of_mbms_sa_codes",
  8046. FT_UINT8, BASE_DEC, NULL, 0x0,
  8047. "Number N of MBMS service area codes", HFILL}
  8048. },
  8049. {&hf_gtp_mbms_ses_dur_days,
  8050. { "Estimated session duration days", "gtp.mbms_ses_dur_days",
  8051. FT_UINT24, BASE_DEC, NULL, 0x00007F,
  8052. NULL, HFILL}
  8053. },
  8054. {&hf_gtp_mbms_ses_dur_s,
  8055. { "Estimated session duration seconds", "gtp.mbms_ses_dur_s",
  8056. FT_UINT24, BASE_DEC, NULL, 0xFFFF80,
  8057. NULL, HFILL}
  8058. },
  8059. {&hf_gtp_mbms_sa_code,
  8060. { "MBMS service area code", "gtp.mbms_sa_code",
  8061. FT_UINT16, BASE_DEC, NULL, 0x0,
  8062. NULL, HFILL}
  8063. },
  8064. {&hf_gtp_mbs_2g_3g_ind,
  8065. { "MBMS 2G/3G Indicator", "gtp.mbs_2g_3g_ind",
  8066. FT_UINT8, BASE_DEC, VALS(gtp_mbs_2g_3g_ind_vals), 0x0,
  8067. NULL, HFILL}
  8068. },
  8069. {&hf_gtp_time_2_dta_tr,
  8070. { "Time to MBMS Data Transfer", "gtp.time_2_dta_tr",
  8071. FT_UINT8, BASE_DEC, NULL, 0x0,
  8072. NULL, HFILL}
  8073. },
  8074. { &hf_gtp_ext_ei,
  8075. { "Error Indication (EI)", "gtp.ei",
  8076. FT_UINT8, BASE_DEC, NULL, 0x04,
  8077. NULL, HFILL}
  8078. },
  8079. {&hf_gtp_ext_gcsi,
  8080. { "GPRS-CSI (GCSI)", "gtp.gcsi",
  8081. FT_UINT8, BASE_DEC, NULL, 0x02,
  8082. NULL, HFILL}
  8083. },
  8084. { &hf_gtp_ext_dti,
  8085. { "Direct Tunnel Indicator (DTI)", "gtp.dti",
  8086. FT_UINT8, BASE_DEC, NULL, 0x01,
  8087. NULL, HFILL}
  8088. },
  8089. { &hf_gtp_ra_prio_lcs,
  8090. { "Radio Priority LCS", "gtp.raplcs",
  8091. FT_UINT8, BASE_DEC, NULL, 0x07,
  8092. NULL, HFILL}
  8093. },
  8094. { &hf_gtp_bcm,
  8095. { "Bearer Control Mode", "gtp.bcm",
  8096. FT_UINT8, BASE_DEC, VALS(gtp_pdp_bcm_type_vals), 0,
  8097. NULL, HFILL}
  8098. },
  8099. { &hf_gtp_fqdn,
  8100. { "FQDN", "gtp.fqdn",
  8101. FT_STRING, BASE_NONE, NULL, 0,
  8102. "Fully Qualified Domain Name", HFILL}
  8103. },
  8104. { &hf_gtp_rim_routing_addr,
  8105. { "RIM Routing Address value", "gtp.rim_routing_addr_val",
  8106. FT_BYTES, BASE_NONE, NULL, 0,
  8107. NULL, HFILL}
  8108. },
  8109. { &hf_gtp_mbms_flow_id,
  8110. { "MBMS Flow Identifier", "gtp.mbms_flow_id",
  8111. FT_BYTES, BASE_NONE, NULL, 0,
  8112. NULL, HFILL}
  8113. },
  8114. { &hf_gtp_mbms_dist_indic,
  8115. { "Distribution Indication", "gtp.mbms_dist_indic",
  8116. FT_UINT8, BASE_DEC, VALS(gtp_mbms_dist_indic_vals), 0x03,
  8117. NULL, HFILL}
  8118. },
  8119. { &hf_gtp_ext_apn_ambr_ul,
  8120. { "APN-AMBR for Uplink", "gtp.apn_ambr_ul",
  8121. FT_INT32, BASE_DEC, NULL, 0x0,
  8122. NULL, HFILL}
  8123. },
  8124. { &hf_gtp_ext_apn_ambr_dl,
  8125. { "APN-AMBR for Downlink", "gtp.apn_ambr_dl",
  8126. FT_INT32, BASE_DEC, NULL, 0x0,
  8127. NULL, HFILL}
  8128. },
  8129. { &hf_gtp_ext_sub_ue_ambr_ul,
  8130. { "Subscribed UE-AMBR for Uplink", "gtp.sub_ue_ambr_ul",
  8131. FT_INT32, BASE_DEC, NULL, 0x0,
  8132. NULL, HFILL}
  8133. },
  8134. { &hf_gtp_ext_sub_ue_ambr_dl,
  8135. { "Subscribed UE-AMBR for Downlink", "gtp.sub_ue_ambr_dl",
  8136. FT_INT32, BASE_DEC, NULL, 0x0,
  8137. NULL, HFILL}
  8138. },
  8139. { &hf_gtp_ext_auth_ue_ambr_ul,
  8140. { "Authorized UE-AMBR for Uplink", "gtp.auth_ue_ambr_ul",
  8141. FT_INT32, BASE_DEC, NULL, 0x0,
  8142. NULL, HFILL}
  8143. },
  8144. { &hf_gtp_ext_auth_ue_ambr_dl,
  8145. { "Authorized UE-AMBR for Downlink", "gtp.auth_ue_ambr_dl",
  8146. FT_INT32, BASE_DEC, NULL, 0x0,
  8147. NULL, HFILL}
  8148. },
  8149. { &hf_gtp_ext_auth_apn_ambr_ul,
  8150. { "Authorized APN-AMBR for Uplink", "gtp.auth_apn_ambr_ul",
  8151. FT_INT32, BASE_DEC, NULL, 0x0,
  8152. NULL, HFILL}
  8153. },
  8154. { &hf_gtp_ext_auth_apn_ambr_dl,
  8155. { "Authorized APN-AMBR for Downlink", "gtp.auth_apn_ambr_dl",
  8156. FT_INT32, BASE_DEC, NULL, 0x0,
  8157. NULL, HFILL}
  8158. },
  8159. { &hf_gtp_ext_ggsn_back_off_time_units,
  8160. { "Timer unit", "gtp.ggsn_back_off_time_units",
  8161. FT_UINT8, BASE_DEC, VALS(gtp_ggsn_back_off_time_units_vals), 0xe0,
  8162. NULL, HFILL}
  8163. },
  8164. { &hf_gtp_ext_ggsn_back_off_timer,
  8165. { "Timer value", "gtp.ggsn_back_off_timer",
  8166. FT_UINT8, BASE_DEC, NULL, 0x1f,
  8167. NULL, HFILL}
  8168. },
  8169. { &hf_gtp_higher_br_16mb_flg,
  8170. { "Higher bitrates than 16 Mbps flag", "gtp.higher_br_16mb_flg",
  8171. FT_UINT8, BASE_DEC, VALS(gtp_higher_br_16mb_flg_vals), 0x0,
  8172. NULL, HFILL}
  8173. },
  8174. { &hf_gtp_max_mbr_apn_ambr_ul,
  8175. { "Max MBR/APN-AMBR for uplink", "gtp.max_mbr_apn_ambr_ul",
  8176. FT_UINT32, BASE_DEC, NULL, 0x0,
  8177. NULL, HFILL}
  8178. },
  8179. { &hf_gtp_max_mbr_apn_ambr_dl,
  8180. { "Max MBR/APN-AMBR for downlink", "gtp.max_mbr_apn_ambr_dl",
  8181. FT_UINT32, BASE_DEC, NULL, 0x0,
  8182. NULL, HFILL}
  8183. },
  8184. };
  8185. /* Setup protocol subtree array */
  8186. #define GTP_NUM_INDIVIDUAL_ELEMS 27
  8187. static gint *ett_gtp_array[GTP_NUM_INDIVIDUAL_ELEMS + NUM_GTP_IES];
  8188. ett_gtp_array[0] = &ett_gtp;
  8189. ett_gtp_array[1] = &ett_gtp_flags;
  8190. ett_gtp_array[2] = &ett_gtp_ext;
  8191. ett_gtp_array[3] = &ett_gtp_cdr_dr;
  8192. ett_gtp_array[4] = &ett_gtp_qos;
  8193. ett_gtp_array[5] = &ett_gtp_qos_arp;
  8194. ett_gtp_array[6] = &ett_gtp_uli_rai;
  8195. ett_gtp_array[7] = &ett_gtp_flow_ii;
  8196. ett_gtp_array[8] = &ett_gtp_ext_hdr;
  8197. ett_gtp_array[9] = &ett_gtp_rp;
  8198. ett_gtp_array[10] = &ett_gtp_pkt_flow_id;
  8199. ett_gtp_array[11] = &ett_gtp_data_resp;
  8200. ett_gtp_array[12] = &ett_gtp_cdr_ver;
  8201. ett_gtp_array[13] = &ett_gtp_tmgi;
  8202. ett_gtp_array[14] = &ett_gtp_trip;
  8203. ett_gtp_array[15] = &ett_gtp_quint;
  8204. ett_gtp_array[16] = &ett_gtp_net_cap;
  8205. ett_gtp_array[17] = &ett_gtp_can_pack;
  8206. ett_gtp_array[18] = &ett_gtp_proto;
  8207. ett_gtp_array[19] = &ett_gtp_gsn_addr;
  8208. ett_gtp_array[20] = &ett_gtp_tft;
  8209. ett_gtp_array[21] = &ett_gtp_tft_pf;
  8210. ett_gtp_array[22] = &ett_gtp_tft_flags;
  8211. ett_gtp_array[23] = &ett_gtp_rab_setup;
  8212. ett_gtp_array[24] = &ett_gtp_hdr_list;
  8213. ett_gtp_array[25] = &ett_gtp_rel_pack;
  8214. ett_gtp_array[26] = &ett_gtp_node_addr;
  8215. last_offset = GTP_NUM_INDIVIDUAL_ELEMS;
  8216. for (i=0; i < NUM_GTP_IES; i++, last_offset++)
  8217. {
  8218. ett_gtp_ies[i] = -1;
  8219. ett_gtp_array[last_offset] = &ett_gtp_ies[i];
  8220. }
  8221. proto_gtp = proto_register_protocol("GPRS Tunneling Protocol", "GTP", "gtp");
  8222. proto_register_field_array(proto_gtp, hf_gtp, array_length(hf_gtp));
  8223. proto_register_subtree_array(ett_gtp_array, array_length(ett_gtp_array));
  8224. gtp_module = prefs_register_protocol(proto_gtp, proto_reg_handoff_gtp);
  8225. prefs_register_uint_preference(gtp_module, "v0_port", "GTPv0 and GTP' port", "GTPv0 and GTP' port (default 3386)", 10, &g_gtpv0_port);
  8226. prefs_register_uint_preference(gtp_module, "v1c_port", "GTPv1 or GTPv2 control plane (GTP-C, GTPv2-C) port", "GTPv1 and GTPv2 control plane port (default 2123)", 10,
  8227. &g_gtpv1c_port);
  8228. prefs_register_uint_preference(gtp_module, "v1u_port", "GTPv1 user plane (GTP-U) port", "GTPv1 user plane port (default 2152)", 10,
  8229. &g_gtpv1u_port);
  8230. prefs_register_enum_preference(gtp_module, "dissect_tpdu_as",
  8231. "Dissect T-PDU as",
  8232. "Dissect T-PDU as",
  8233. &dissect_tpdu_as,
  8234. gtp_decode_tpdu_as,
  8235. FALSE);
  8236. prefs_register_obsolete_preference(gtp_module, "v0_dissect_cdr_as");
  8237. prefs_register_obsolete_preference(gtp_module, "v0_check_etsi");
  8238. prefs_register_obsolete_preference(gtp_module, "v1_check_etsi");
  8239. prefs_register_bool_preference(gtp_module, "check_etsi", "Compare GTP order with ETSI", "GTP ETSI order", &g_gtp_etsi_order);
  8240. prefs_register_obsolete_preference(gtp_module, "ppp_reorder");
  8241. prefs_register_obsolete_preference(gtp_module, "dissect_tpdu");
  8242. /* This preference can be used to disable the dissection of GTP over TCP. Most of the Wireless operators uses GTP over UDP.
  8243. * The preference is set to TRUE by default forbackward compatibility
  8244. */
  8245. prefs_register_bool_preference(gtp_module, "dissect_gtp_over_tcp", "Dissect GTP over TCP", "Dissect GTP over TCP", &g_gtp_over_tcp);
  8246. new_register_dissector("gtp", dissect_gtp, proto_gtp);
  8247. new_register_dissector("gtpprim", dissect_gtpprim, proto_gtp);
  8248. gtp_priv_ext_dissector_table = register_dissector_table("gtp.priv_ext", "GTP PRIVATE EXT", FT_UINT16, BASE_DEC);
  8249. gtp_cdr_fmt_dissector_table = register_dissector_table("gtp.cdr_fmt", "GTP DATA RECORD TYPE", FT_UINT16, BASE_DEC);
  8250. register_init_routine(gtp_reinit);
  8251. gtp_tap = register_tap("gtp");
  8252. gtpv1_tap = register_tap("gtpv1");
  8253. }
  8254. /* TS 132 295 V9.0.0 (2010-02)
  8255. * 5.1.3 Port usage
  8256. * - The UDP Destination Port may be the server port number 3386 which has been reserved for GTP'.
  8257. * Alternatively another port can be used, which has been configured by O&M, except Port Number 2123
  8258. * which is used by GTPv2-C.
  8259. * :
  8260. * The TCP Destination Port may be the server port number 3386, which has been reserved for G-PDUs. Alternatively,
  8261. * another port may be used as configured by O&M. Extra implementation-specific destination ports are possible but
  8262. * all CGFs shall support the server port number.
  8263. */
  8264. void
  8265. proto_reg_handoff_gtp(void)
  8266. {
  8267. static gboolean Initialized = FALSE;
  8268. static dissector_handle_t gtp_handle, gtp_prim_handle;
  8269. static gboolean gtp_over_tcp;
  8270. static guint gtpv0_port;
  8271. static guint gtpv1c_port;
  8272. static guint gtpv1u_port;
  8273. if (!Initialized) {
  8274. gtp_handle = find_dissector("gtp");
  8275. gtp_prim_handle = find_dissector("gtpprim");
  8276. ppp_subdissector_table = find_dissector_table("ppp.protocol");
  8277. radius_register_avp_dissector(VENDOR_THE3GPP, 5, dissect_radius_qos_umts);
  8278. radius_register_avp_dissector(VENDOR_THE3GPP, 12, dissect_radius_selection_mode);
  8279. radius_register_avp_dissector(VENDOR_THE3GPP, 22, dissect_radius_user_loc);
  8280. ip_handle = find_dissector("ip");
  8281. ipv6_handle = find_dissector("ipv6");
  8282. ppp_handle = find_dissector("ppp");
  8283. sync_handle = find_dissector("sync");
  8284. data_handle = find_dissector("data");
  8285. gtpcdr_handle = find_dissector("gtpcdr");
  8286. sndcpxid_handle = find_dissector("sndcpxid");
  8287. gtpv2_handle = find_dissector("gtpv2");
  8288. bssgp_handle = find_dissector("bssgp");
  8289. bssap_pdu_type_table = find_dissector_table("bssap.pdu_type");
  8290. /* AVP Code: 5 3GPP-GPRS Negotiated QoS profile */
  8291. dissector_add_uint("diameter.3gpp", 5, new_create_dissector_handle(dissect_diameter_3gpp_qosprofile, proto_gtp));
  8292. /* AVP Code: 903 MBMS-Service-Area */
  8293. dissector_add_uint("diameter.3gpp", 903, new_create_dissector_handle(dissect_gtp_3gpp_mbms_service_area, proto_gtp));
  8294. /* AVP Code: 904 MBMS-Session-Duration */
  8295. dissector_add_uint("diameter.3gpp", 904, new_create_dissector_handle(dissect_gtp_mbms_ses_dur, proto_gtp));
  8296. /* AVP Code: 911 MBMS-Time-To-Data-Transfer */
  8297. dissector_add_uint("diameter.3gpp", 911, new_create_dissector_handle(dissect_gtp_mbms_time_to_data_tr, proto_gtp));
  8298. Initialized = TRUE;
  8299. } else {
  8300. dissector_delete_uint("udp.port", gtpv0_port, gtp_prim_handle);
  8301. dissector_delete_uint("udp.port", gtpv1c_port, gtp_handle);
  8302. dissector_delete_uint("udp.port", gtpv1u_port, gtp_handle);
  8303. if (gtp_over_tcp) {
  8304. dissector_delete_uint("tcp.port", gtpv0_port, gtp_prim_handle);
  8305. dissector_delete_uint("tcp.port", gtpv1c_port, gtp_handle);
  8306. dissector_delete_uint("tcp.port", gtpv1u_port, gtp_handle);
  8307. }
  8308. }
  8309. gtp_over_tcp = g_gtp_over_tcp;
  8310. gtpv0_port = g_gtpv0_port;
  8311. gtpv1c_port = g_gtpv1c_port;
  8312. gtpv1u_port = g_gtpv1u_port;
  8313. dissector_add_uint("udp.port", g_gtpv0_port, gtp_prim_handle);
  8314. dissector_add_uint("udp.port", g_gtpv1c_port, gtp_handle);
  8315. dissector_add_uint("udp.port", g_gtpv1u_port, gtp_handle);
  8316. if (g_gtp_over_tcp) {
  8317. dissector_add_uint("tcp.port", g_gtpv0_port, gtp_prim_handle);
  8318. dissector_add_uint("tcp.port", g_gtpv1c_port, gtp_handle);
  8319. dissector_add_uint("tcp.port", g_gtpv1u_port, gtp_handle);
  8320. }
  8321. }
  8322. /*
  8323. * Editor modelines - http://www.wireshark.org/tools/modelines.html
  8324. *
  8325. * Local variables:
  8326. * c-basic-offset: 4
  8327. * tab-width: 8
  8328. * indent-tabs-mode: nil
  8329. * End:
  8330. *
  8331. * vi: set shiftwidth=4 tabstop=8 expandtab:
  8332. * :indentSize=4:tabSize=8:noTabs=true:
  8333. */