2008-01-27 23:18:57 +00:00
|
|
|
/* packet-diameter_3gpp.c
|
|
|
|
* Routines for dissecting 3GPP OctetSting AVP:s
|
|
|
|
* Copyright 2008, Anders Broman <anders.broman[at]ericsson.com>
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
2010-01-19 17:40:52 +00:00
|
|
|
*
|
2008-01-27 23:18:57 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2010-01-19 17:40:52 +00:00
|
|
|
*
|
2008-01-27 23:18:57 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2010-01-19 17:40:52 +00:00
|
|
|
*
|
2008-01-27 23:18:57 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* This dissector registers a dissector table for 3GPP Vendor specific
|
|
|
|
* AVP:s which will be called from the Diameter dissector to dissect
|
|
|
|
* the content of AVP:s of the OctetString type(or similar).
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#include <epan/packet.h>
|
|
|
|
#include <epan/proto.h>
|
2009-01-15 20:55:24 +00:00
|
|
|
#include <epan/asn1.h>
|
2008-01-27 23:18:57 +00:00
|
|
|
|
2009-01-15 20:55:24 +00:00
|
|
|
#include "packet-gsm_map.h"
|
2008-08-04 16:11:17 +00:00
|
|
|
#include "packet-gsm_a_common.h"
|
2008-01-29 20:05:02 +00:00
|
|
|
#include "packet-e212.h"
|
2008-01-27 23:18:57 +00:00
|
|
|
|
|
|
|
/* Initialize the protocol and registered fields */
|
2010-01-19 17:40:52 +00:00
|
|
|
static int proto_diameter_3gpp = -1;
|
2008-01-27 23:18:57 +00:00
|
|
|
|
2009-01-15 20:55:24 +00:00
|
|
|
static int hf_diameter_3gpp_msisdn = -1;
|
2010-01-19 17:20:17 +00:00
|
|
|
static int hf_diameter_3gpp_user_data = -1;
|
2008-01-27 23:18:57 +00:00
|
|
|
static int hf_diameter_3gpp_ipaddr = -1;
|
|
|
|
static int hf_diameter_3gpp_mbms_required_qos_prio = -1;
|
2008-01-29 20:05:02 +00:00
|
|
|
static int hf_diameter_3gpp_tmgi = -1;
|
|
|
|
static int hf_diameter_mbms_service_id = -1;
|
|
|
|
|
2009-01-15 20:55:24 +00:00
|
|
|
static gint diameter_3gpp_msisdn_ett = -1;
|
2008-01-29 20:05:02 +00:00
|
|
|
static gint diameter_3gpp_tmgi_ett = -1;
|
2008-01-27 23:18:57 +00:00
|
|
|
/* Used for Diameter */
|
2008-01-29 20:05:02 +00:00
|
|
|
|
2010-01-19 17:20:17 +00:00
|
|
|
/* dissector handles */
|
|
|
|
static dissector_handle_t xml_handle;
|
|
|
|
|
|
|
|
/* AVP Code: 701 MSISDN */
|
2009-01-15 20:55:24 +00:00
|
|
|
static int
|
|
|
|
dissect_diameter_3gpp_msisdn(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
|
|
|
|
|
|
|
|
proto_item* item;
|
|
|
|
proto_tree *sub_tree;
|
|
|
|
int offset = 0;
|
|
|
|
|
|
|
|
item = proto_tree_add_item(tree, hf_diameter_3gpp_msisdn, tvb, offset, 6, FALSE);
|
|
|
|
sub_tree = proto_item_add_subtree(item,diameter_3gpp_msisdn_ett);
|
|
|
|
|
|
|
|
dissect_gsm_map_msisdn(tvb, pinfo, sub_tree);
|
|
|
|
|
|
|
|
return tvb_length(tvb);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-01-19 17:20:17 +00:00
|
|
|
/* AVP Code: 702 User-Data */
|
2010-01-19 17:40:52 +00:00
|
|
|
static int
|
2010-01-19 17:20:17 +00:00
|
|
|
dissect_diameter_3gpp_user_data(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
|
|
|
|
|
|
|
|
guint8 word[6];
|
|
|
|
int length = tvb_length(tvb);
|
|
|
|
|
2010-01-19 17:40:52 +00:00
|
|
|
/* If there is less than 38 characters this is not XML
|
2010-01-19 17:20:17 +00:00
|
|
|
* <?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
*/
|
|
|
|
if(length < 38)
|
|
|
|
return length;
|
|
|
|
|
|
|
|
tvb_get_nstringz0(tvb, 0, sizeof(word),word);
|
|
|
|
if (g_ascii_strncasecmp(word, "<?xml", 5) == 0){
|
|
|
|
call_dissector(xml_handle, tvb, pinfo, tree);
|
|
|
|
}
|
2009-01-15 20:55:24 +00:00
|
|
|
|
2010-01-19 17:20:17 +00:00
|
|
|
return length;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* AVP Code: 900 TMGI */
|
2008-01-29 20:33:43 +00:00
|
|
|
static int
|
2008-01-29 20:05:02 +00:00
|
|
|
dissect_diameter_3gpp_tmgi(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
|
|
|
|
|
|
|
|
proto_item* item;
|
|
|
|
proto_tree *sub_tree;
|
|
|
|
int offset = 0;
|
|
|
|
|
|
|
|
item = proto_tree_add_item(tree, hf_diameter_3gpp_tmgi, tvb, offset, 6, FALSE);
|
|
|
|
sub_tree = proto_item_add_subtree(item,diameter_3gpp_tmgi_ett);
|
|
|
|
|
|
|
|
/* MBMS Service ID consisting of three octets. MBMS Service ID consists of a 6-digit
|
2010-01-19 17:40:52 +00:00
|
|
|
* fixed-length hexadecimal number between 000000 and FFFFFF.
|
2008-01-29 20:05:02 +00:00
|
|
|
* MBMS Service ID uniquely identifies an MBMS bearer service within a PLMN.
|
|
|
|
*/
|
|
|
|
|
|
|
|
proto_tree_add_item(sub_tree, hf_diameter_mbms_service_id, tvb, offset, 3, FALSE);
|
|
|
|
offset = offset+3;
|
2009-11-27 22:57:50 +00:00
|
|
|
offset = dissect_e212_mcc_mnc(tvb, pinfo, sub_tree, offset);
|
2008-01-29 20:05:02 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-01-19 17:20:17 +00:00
|
|
|
/* AVP Code: 918 MBMS-BMSC-SSM-IP-Address */
|
2010-01-19 17:40:52 +00:00
|
|
|
static int
|
2008-01-27 23:18:57 +00:00
|
|
|
dissect_diameter_3gpp_ipaddr(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
|
|
|
|
|
|
|
|
int offset = 0;
|
|
|
|
|
2008-01-29 20:05:02 +00:00
|
|
|
proto_tree_add_item(tree, hf_diameter_3gpp_ipaddr, tvb, offset, 4, FALSE);
|
2008-01-27 23:33:09 +00:00
|
|
|
offset += 4;
|
2008-01-27 23:18:57 +00:00
|
|
|
|
2008-01-27 23:33:09 +00:00
|
|
|
return offset;
|
2008-01-27 23:18:57 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-01-19 17:20:17 +00:00
|
|
|
/* AVP Code: 913 MBMS-Required-QoS */
|
2010-01-19 17:40:52 +00:00
|
|
|
static int
|
2008-01-27 23:18:57 +00:00
|
|
|
dissect_diameter_3gpp_mbms_required_qos(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
|
|
|
|
|
|
|
|
int offset = 0;
|
|
|
|
guint length;
|
|
|
|
|
|
|
|
/* Octet
|
2010-01-19 17:40:52 +00:00
|
|
|
* 1 Allocation/Retention Priority as specified in 3GPP TS 23.107.
|
2008-01-27 23:18:57 +00:00
|
|
|
* This octet encodes each priority level defined in 3GPP TS 23.107
|
|
|
|
* as the binary value of the priority level. It specifies the relative
|
|
|
|
* importance of the actual MBMS bearer service compared to other MBMS
|
2010-01-19 17:40:52 +00:00
|
|
|
* and non-MBMS bearer services for allocation and retention of the
|
2008-01-27 23:18:57 +00:00
|
|
|
* MBMS bearer service.
|
|
|
|
* 2-N QoS Profile as specified by the Quality-of-Service information element,
|
|
|
|
* from octet 3 onwards, in 3GPP TS 24.008
|
|
|
|
*/
|
2008-01-29 20:05:02 +00:00
|
|
|
proto_tree_add_item(tree, hf_diameter_3gpp_mbms_required_qos_prio, tvb, offset, 1, FALSE);
|
2008-01-27 23:18:57 +00:00
|
|
|
offset++;
|
|
|
|
length = tvb_length(tvb) - 1;
|
|
|
|
de_sm_qos(tvb, tree, offset, length, NULL, 0);
|
|
|
|
return offset+length;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_diameter_3gpp(void)
|
|
|
|
{
|
|
|
|
|
2009-01-15 20:55:24 +00:00
|
|
|
/* AVP Code: 701 MSISDN */
|
|
|
|
dissector_add("diameter.3gpp", 701, new_create_dissector_handle(dissect_diameter_3gpp_msisdn, proto_diameter_3gpp));
|
|
|
|
|
2010-01-19 17:20:17 +00:00
|
|
|
/* AVP Code: 702 User-Data */
|
|
|
|
dissector_add("diameter.3gpp", 702, new_create_dissector_handle(dissect_diameter_3gpp_user_data, proto_diameter_3gpp));
|
|
|
|
|
2008-01-29 20:05:02 +00:00
|
|
|
/* AVP Code: 900 TMGI */
|
|
|
|
dissector_add("diameter.3gpp", 900, new_create_dissector_handle(dissect_diameter_3gpp_tmgi, proto_diameter_3gpp));
|
|
|
|
|
2008-01-27 23:18:57 +00:00
|
|
|
/* AVP Code: 918 MBMS-BMSC-SSM-IP-Address */
|
|
|
|
dissector_add("diameter.3gpp", 918, new_create_dissector_handle(dissect_diameter_3gpp_ipaddr, proto_diameter_3gpp));
|
|
|
|
|
|
|
|
/* AVP Code: 913 MBMS-Required-QoS */
|
|
|
|
dissector_add("diameter.3gpp", 913, new_create_dissector_handle(dissect_diameter_3gpp_mbms_required_qos, proto_diameter_3gpp));
|
|
|
|
|
2008-01-29 20:05:02 +00:00
|
|
|
|
2010-01-19 17:20:17 +00:00
|
|
|
xml_handle = find_dissector("xml");
|
2008-01-27 23:18:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_diameter_3gpp(void)
|
2010-01-19 17:40:52 +00:00
|
|
|
{
|
2008-01-27 23:18:57 +00:00
|
|
|
|
|
|
|
/* Setup list of header fields See Section 1.6.1 for details*/
|
|
|
|
static hf_register_info hf[] = {
|
2009-01-15 20:55:24 +00:00
|
|
|
{ &hf_diameter_3gpp_msisdn,
|
|
|
|
{ "MSISDN", "diameter.3gpp.msisdn",
|
2010-01-19 17:40:52 +00:00
|
|
|
FT_BYTES, BASE_NONE, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2009-01-15 20:55:24 +00:00
|
|
|
},
|
2010-01-19 17:20:17 +00:00
|
|
|
{ &hf_diameter_3gpp_user_data,
|
|
|
|
{ "User data", "diameter.3gpp.user_data",
|
2010-01-19 17:40:52 +00:00
|
|
|
FT_STRING, BASE_NONE, NULL, 0x0,
|
2010-01-19 17:20:17 +00:00
|
|
|
NULL, HFILL }
|
|
|
|
},
|
2008-01-27 23:18:57 +00:00
|
|
|
{ &hf_diameter_3gpp_ipaddr,
|
|
|
|
{ "IPv4 Address", "diameter.3gpp.ipaddr",
|
2010-01-19 17:40:52 +00:00
|
|
|
FT_IPv4, BASE_NONE, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-01-27 23:18:57 +00:00
|
|
|
},
|
|
|
|
{ &hf_diameter_3gpp_mbms_required_qos_prio,
|
|
|
|
{ "Allocation/Retention Priority", "diameter.3gpp.mbms_required_qos_prio",
|
2010-01-19 17:40:52 +00:00
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-01-27 23:18:57 +00:00
|
|
|
},
|
2008-01-29 20:05:02 +00:00
|
|
|
{ &hf_diameter_3gpp_tmgi,
|
|
|
|
{ "TMGI", "diameter.3gpp.tmgi",
|
2010-01-19 17:40:52 +00:00
|
|
|
FT_BYTES, BASE_NONE, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-01-29 20:05:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_diameter_mbms_service_id,
|
|
|
|
{ "MBMS Service ID", "diameter.3gpp.mbms_service_id",
|
2010-01-19 17:40:52 +00:00
|
|
|
FT_UINT24, BASE_HEX, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-01-29 20:05:02 +00:00
|
|
|
},
|
2008-01-27 23:18:57 +00:00
|
|
|
};
|
2008-01-29 20:05:02 +00:00
|
|
|
|
|
|
|
/* Setup protocol subtree array */
|
|
|
|
static gint *ett[] = {
|
2009-01-15 20:55:24 +00:00
|
|
|
&diameter_3gpp_msisdn_ett,
|
2008-01-29 20:05:02 +00:00
|
|
|
&diameter_3gpp_tmgi_ett,
|
|
|
|
};
|
|
|
|
|
2008-01-27 23:18:57 +00:00
|
|
|
/* Required function calls to register the header fields and subtrees used */
|
2008-04-14 06:43:42 +00:00
|
|
|
proto_diameter_3gpp = proto_register_protocol("Diameter 3GPP","Diameter3GPP", "diameter3gpp");
|
2008-01-27 23:18:57 +00:00
|
|
|
proto_register_field_array(proto_diameter_3gpp, hf, array_length(hf));
|
2008-01-29 20:05:02 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2008-01-27 23:18:57 +00:00
|
|
|
}
|