aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss.ws@gmail.com>2014-08-22 15:14:00 -0400
committerJeff Morriss <jeff.morriss.ws@gmail.com>2014-08-22 19:17:25 +0000
commit2d74838e473a3e3414addb73c892efa470c4c0f1 (patch)
tree7fdbd8eb8228c3c37f01c1f4a655f793a065220b /epan/dissectors
parent923ba9d3120be0ee994d595bc1cae0f15963e2e1 (diff)
Decode the 3GPP MSISDN AVP using the E.164 routines.
Rename dissect_e164_utf8_number() to dissect_e164_msisdn() and give it an 'encoding' argument. Change-Id: I49cf5d2b24b44a0e69427ceae331f378024391c5 Reviewed-on: https://code.wireshark.org/review/3796 Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-diameter.c2
-rw-r--r--epan/dissectors/packet-diameter_3gpp.c30
-rw-r--r--epan/dissectors/packet-e164.c19
-rw-r--r--epan/dissectors/packet-e164.h2
4 files changed, 20 insertions, 33 deletions
diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c
index c55f8f0868..c3ee92b65a 100644
--- a/epan/dissectors/packet-diameter.c
+++ b/epan/dissectors/packet-diameter.c
@@ -517,7 +517,7 @@ dissect_diameter_subscription_id_data(tvbuff_t *tvb, packet_info *pinfo, proto_t
return str_len;
case SUBSCRIPTION_ID_TYPE_E164:
str_len = tvb_reported_length(tvb);
- dissect_e164_utf8_number(tvb, tree, 0, str_len);
+ dissect_e164_msisdn(tvb, tree, 0, str_len, E164_ENC_UTF8);
return str_len;
break;
}
diff --git a/epan/dissectors/packet-diameter_3gpp.c b/epan/dissectors/packet-diameter_3gpp.c
index b3971a4c8a..710889a4c6 100644
--- a/epan/dissectors/packet-diameter_3gpp.c
+++ b/epan/dissectors/packet-diameter_3gpp.c
@@ -34,7 +34,6 @@
#include <epan/asn1.h>
#include "packet-diameter.h"
-#include "packet-gsm_map.h"
#include "packet-gsm_a_common.h"
#include "packet-e164.h"
#include "packet-e212.h"
@@ -49,7 +48,6 @@ static int proto_diameter_3gpp = -1;
static int hf_diameter_3gpp_timezone = -1;
static int hf_diameter_3gpp_timezone_adjustment = -1;
static int hf_diameter_3gpp_visited_nw_id = -1;
-static int hf_diameter_3gpp_msisdn = -1;
static int hf_diameter_3gpp_path = -1;
static int hf_diameter_3gpp_contact = -1;
/* static int hf_diameter_3gpp_user_data = -1; */
@@ -58,7 +56,6 @@ static int hf_diameter_3gpp_mbms_required_qos_prio = -1;
static int hf_diameter_3gpp_tmgi = -1;
static int hf_diameter_3gpp_service_ind = -1;
static int hf_diameter_mbms_service_id = -1;
-static int hf_diameter_address_digits = -1;
static int hf_diameter_3gpp_spare_bits = -1;
static int hf_diameter_3gpp_uar_flags_flags = -1;
static int hf_diameter_3gpp_uar_flags_flags_bit0 = -1;
@@ -168,8 +165,8 @@ static int hf_diameter_3gpp_idr_flags_bit6 = -1;
static int hf_diameter_3gpp_ipv6addr = -1;
static int hf_diameter_3gpp_mbms_abs_time_ofmbms_data_tfer = -1;
static int hf_diameter_3gpp_udp_port = -1;
+
static gint diameter_3gpp_path_ett = -1;
-static gint diameter_3gpp_msisdn_ett = -1;
static gint diameter_3gpp_feature_list_ett = -1;
static gint diameter_3gpp_uar_flags_ett = -1;
static gint diameter_3gpp_tmgi_ett = -1;
@@ -528,22 +525,12 @@ dissect_diameter_3gpp_contact(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree
static int
dissect_diameter_3gpp_msisdn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
{
- proto_item *item;
- proto_tree *sub_tree;
int offset = 0;
- const char *digit_str;
int length = tvb_reported_length(tvb);
- item = proto_tree_add_item(tree, hf_diameter_3gpp_msisdn, tvb, offset, length, ENC_NA);
- sub_tree = proto_item_add_subtree(item,diameter_3gpp_msisdn_ett);
-
- dissect_e164_cc(tvb, sub_tree, offset, E164_ENC_BCD);
-
- digit_str = unpack_digits(tvb, 1);
- proto_tree_add_string(sub_tree, hf_diameter_address_digits, tvb, 1, -1, digit_str);
-
- return tvb_reported_length(tvb);
+ dissect_e164_msisdn(tvb, tree, offset, length, E164_ENC_BCD);
+ return length;
}
/* AVP Code: 702 User-Data
@@ -1125,11 +1112,6 @@ proto_register_diameter_3gpp(void)
FT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
- { &hf_diameter_3gpp_msisdn,
- { "MSISDN", "diameter.3gpp.msisdn",
- FT_BYTES, BASE_NONE, NULL, 0x0,
- NULL, HFILL }
- },
#if 0
{ &hf_diameter_3gpp_user_data,
{ "User data", "diameter.3gpp.user_data",
@@ -1162,11 +1144,6 @@ proto_register_diameter_3gpp(void)
FT_UINT24, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
- { &hf_diameter_address_digits,
- { "Address digits", "diameter.3gpp.address_digits",
- FT_STRING, BASE_NONE, NULL, 0x0,
- NULL, HFILL }
- },
{ &hf_diameter_3gpp_spare_bits,
{ "Spare bit(s)", "diameter.3gpp.spare_bits",
FT_UINT32, BASE_HEX, NULL, 0x0,
@@ -1721,7 +1698,6 @@ proto_register_diameter_3gpp(void)
/* Setup protocol subtree array */
static gint *ett[] = {
&diameter_3gpp_path_ett,
- &diameter_3gpp_msisdn_ett,
&diameter_3gpp_uar_flags_ett,
&diameter_3gpp_feature_list_ett,
&diameter_3gpp_tmgi_ett,
diff --git a/epan/dissectors/packet-e164.c b/epan/dissectors/packet-e164.c
index 155408430f..9f90e648ab 100644
--- a/epan/dissectors/packet-e164.c
+++ b/epan/dissectors/packet-e164.c
@@ -684,18 +684,29 @@ dissect_e164_cc(tvbuff_t *tvb, proto_tree *tree, int offset, e164_encoding_t enc
}
const gchar *
-dissect_e164_utf8_number(tvbuff_t *tvb, proto_tree *tree, int offset, int length)
+dissect_e164_msisdn(tvbuff_t *tvb, proto_tree *tree, int offset, int length, e164_encoding_t encoding)
{
proto_item *pi;
proto_tree *subtree;
- gchar *msisdn_str;
+ const gchar *msisdn_str;
+
+ switch (encoding) {
+ case E164_ENC_UTF8:
+ msisdn_str = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, length, ENC_UTF_8);
+ break;
+ case E164_ENC_BCD:
+ msisdn_str = tvb_bcd_dig_to_wmem_packet_str(tvb, offset, length, NULL, FALSE);
+ break;
+ case E164_ENC_BINARY:
+ default:
+ DISSECTOR_ASSERT_NOT_REACHED();
+ }
- msisdn_str = tvb_get_string_enc(wmem_packet_scope(), tvb, offset, length, ENC_UTF_8);
pi = proto_tree_add_string(tree, hf_E164_number, tvb, offset, length, msisdn_str);
subtree = proto_item_add_subtree(pi, ett_e164_msisdn);
- dissect_e164_cc(tvb, subtree, offset, E164_ENC_UTF8);
+ dissect_e164_cc(tvb, subtree, offset, encoding);
return msisdn_str;
}
diff --git a/epan/dissectors/packet-e164.h b/epan/dissectors/packet-e164.h
index 92b915cfc0..a4d4977335 100644
--- a/epan/dissectors/packet-e164.h
+++ b/epan/dissectors/packet-e164.h
@@ -51,5 +51,5 @@ typedef enum {
extern void dissect_e164_number(tvbuff_t *tvb, proto_tree *tree, int offset, int length, e164_info_t e164_info);
WS_DLL_PUBLIC void dissect_e164_cc(tvbuff_t *tvb, proto_tree *tree, int offset, e164_encoding_t encoding);
-WS_DLL_PUBLIC const gchar * dissect_e164_utf8_number(tvbuff_t *tvb, proto_tree *tree, int offset, int length);
+WS_DLL_PUBLIC const gchar * dissect_e164_msisdn(tvbuff_t *tvb, proto_tree *tree, int offset, int length, e164_encoding_t encoding);
#endif