1 /* packet-diameter_3gpp.c
2 * Routines for dissecting 3GPP OctetSting AVP:s
3 * Copyright 2008, Anders Broman <anders.broman[at]ericsson.com>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 /* This dissector registers a dissector table for 3GPP Vendor specific
27 * AVP:s which will be called from the Diameter dissector to dissect
28 * the content of AVP:s of the OctetString type(or similar).
41 #include <epan/packet.h>
42 #include <epan/proto.h>
43 #include <epan/asn1.h>
45 #include "packet-gsm_map.h"
46 #include "packet-gsm_a_common.h"
47 #include "packet-e212.h"
49 /* Initialize the protocol and registered fields */
50 static int proto_diameter_3gpp = -1;
52 static int hf_diameter_3gpp_msisdn = -1;
53 static int hf_diameter_3gpp_ipaddr = -1;
54 static int hf_diameter_3gpp_mbms_required_qos_prio = -1;
55 static int hf_diameter_3gpp_tmgi = -1;
56 static int hf_diameter_mbms_service_id = -1;
58 static gint diameter_3gpp_msisdn_ett = -1;
59 static gint diameter_3gpp_tmgi_ett = -1;
60 /* Used for Diameter */
63 dissect_diameter_3gpp_msisdn(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
69 item = proto_tree_add_item(tree, hf_diameter_3gpp_msisdn, tvb, offset, 6, FALSE);
70 sub_tree = proto_item_add_subtree(item,diameter_3gpp_msisdn_ett);
72 dissect_gsm_map_msisdn(tvb, pinfo, sub_tree);
74 return tvb_length(tvb);
80 dissect_diameter_3gpp_tmgi(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
86 item = proto_tree_add_item(tree, hf_diameter_3gpp_tmgi, tvb, offset, 6, FALSE);
87 sub_tree = proto_item_add_subtree(item,diameter_3gpp_tmgi_ett);
89 /* MBMS Service ID consisting of three octets. MBMS Service ID consists of a 6-digit
90 * fixed-length hexadecimal number between 000000 and FFFFFF.
91 * MBMS Service ID uniquely identifies an MBMS bearer service within a PLMN.
94 proto_tree_add_item(sub_tree, hf_diameter_mbms_service_id, tvb, offset, 3, FALSE);
96 offset = dissect_e212_mcc_mnc(tvb, pinfo, sub_tree, offset);
103 dissect_diameter_3gpp_ipaddr(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
107 proto_tree_add_item(tree, hf_diameter_3gpp_ipaddr, tvb, offset, 4, FALSE);
115 dissect_diameter_3gpp_mbms_required_qos(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
121 * 1 Allocation/Retention Priority as specified in 3GPP TS 23.107.
122 * This octet encodes each priority level defined in 3GPP TS 23.107
123 * as the binary value of the priority level. It specifies the relative
124 * importance of the actual MBMS bearer service compared to other MBMS
125 * and non-MBMS bearer services for allocation and retention of the
126 * MBMS bearer service.
127 * 2-N QoS Profile as specified by the Quality-of-Service information element,
128 * from octet 3 onwards, in 3GPP TS 24.008
130 proto_tree_add_item(tree, hf_diameter_3gpp_mbms_required_qos_prio, tvb, offset, 1, FALSE);
132 length = tvb_length(tvb) - 1;
133 de_sm_qos(tvb, tree, offset, length, NULL, 0);
134 return offset+length;
139 proto_reg_handoff_diameter_3gpp(void)
142 /* AVP Code: 701 MSISDN */
143 dissector_add("diameter.3gpp", 701, new_create_dissector_handle(dissect_diameter_3gpp_msisdn, proto_diameter_3gpp));
145 /* AVP Code: 900 TMGI */
146 dissector_add("diameter.3gpp", 900, new_create_dissector_handle(dissect_diameter_3gpp_tmgi, proto_diameter_3gpp));
148 /* AVP Code: 918 MBMS-BMSC-SSM-IP-Address */
149 dissector_add("diameter.3gpp", 918, new_create_dissector_handle(dissect_diameter_3gpp_ipaddr, proto_diameter_3gpp));
151 /* AVP Code: 913 MBMS-Required-QoS */
152 dissector_add("diameter.3gpp", 913, new_create_dissector_handle(dissect_diameter_3gpp_mbms_required_qos, proto_diameter_3gpp));
158 proto_register_diameter_3gpp(void)
161 /* Setup list of header fields See Section 1.6.1 for details*/
162 static hf_register_info hf[] = {
163 { &hf_diameter_3gpp_msisdn,
164 { "MSISDN", "diameter.3gpp.msisdn",
165 FT_BYTES, BASE_NONE, NULL, 0x0,
168 { &hf_diameter_3gpp_ipaddr,
169 { "IPv4 Address", "diameter.3gpp.ipaddr",
170 FT_IPv4, BASE_NONE, NULL, 0x0,
173 { &hf_diameter_3gpp_mbms_required_qos_prio,
174 { "Allocation/Retention Priority", "diameter.3gpp.mbms_required_qos_prio",
175 FT_UINT8, BASE_DEC, NULL, 0x0,
178 { &hf_diameter_3gpp_tmgi,
179 { "TMGI", "diameter.3gpp.tmgi",
180 FT_BYTES, BASE_NONE, NULL, 0x0,
183 { &hf_diameter_mbms_service_id,
184 { "MBMS Service ID", "diameter.3gpp.mbms_service_id",
185 FT_UINT24, BASE_HEX, NULL, 0x0,
190 /* Setup protocol subtree array */
191 static gint *ett[] = {
192 &diameter_3gpp_msisdn_ett,
193 &diameter_3gpp_tmgi_ett,
196 /* Required function calls to register the header fields and subtrees used */
197 proto_diameter_3gpp = proto_register_protocol("Diameter 3GPP","Diameter3GPP", "diameter3gpp");
198 proto_register_field_array(proto_diameter_3gpp, hf, array_length(hf));
199 proto_register_subtree_array(ett, array_length(ett));