aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-e212.c
diff options
context:
space:
mode:
authorAndersBroman <anders.broman@ericsson.com>2014-08-19 14:24:13 +0200
committerAnders Broman <a.broman58@gmail.com>2014-08-19 12:27:29 +0000
commit1cdef1d98aac306932dc599d427a3e1191d48a44 (patch)
treead618708ac4a6dbefa1f66e38100adb656bab44e /epan/dissectors/packet-e212.c
parentfc43a8c933dca46dd591523dac1eed4f5c2adcbb (diff)
Implement a common function to dissect IMSI and use it GSM MAP as a start.
- remove soft deprecated APIs and unused hf. Change-Id: Id00c3dd35f3fc65f543bc29df6d35515c45fe7e1 Reviewed-on: https://code.wireshark.org/review/3715 Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-e212.c')
-rw-r--r--epan/dissectors/packet-e212.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/epan/dissectors/packet-e212.c b/epan/dissectors/packet-e212.c
index 782ff155bf..06a8d9c120 100644
--- a/epan/dissectors/packet-e212.c
+++ b/epan/dissectors/packet-e212.c
@@ -2532,9 +2532,12 @@ static value_string_ext mcc_mnc_codes_ext = VALUE_STRING_EXT_INIT(mcc_mnc_codes)
static int proto_e212 = -1;
+static int hf_E212_imsi = -1;
static int hf_E212_mcc = -1;
static int hf_E212_mnc = -1;
+static int ett_e212_imsi = -1;
+
static expert_field ei_E212_mcc_non_decimal = EI_INIT;
static expert_field ei_E212_mnc_non_decimal = EI_INIT;
@@ -2780,6 +2783,26 @@ dissect_e212_mcc_mnc_in_address(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
return 5;
}
+const gchar *
+dissect_e212_imsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int length, gboolean skip_first)
+{
+ proto_item *item;
+ proto_tree *subtree;
+ const gchar *imsi_str;
+
+ /* Fetch the BCD encoded digits from tvb indicated half byte, formating the digits according to
+ * a default digit set of 0-9 returning "?" for overdecadic digits a pointer to the wmem
+ * allocated string will be returned.
+ */
+ imsi_str = tvb_bcd_dig_to_wmem_packet_str( tvb, offset, length, NULL, skip_first);
+ item = proto_tree_add_string(tree, hf_E212_imsi, tvb, offset, length, imsi_str);
+
+ subtree = proto_item_add_subtree(item, ett_e212_imsi);
+
+ dissect_e212_mcc_mnc_in_address(tvb, pinfo, subtree, 0);
+
+ return imsi_str;
+}
/*
* Register the protocol with Wireshark.
*
@@ -2794,6 +2817,11 @@ proto_register_e212(void)
/* Setup list of header fields See Section 1.6.1 for details */
static hf_register_info hf[] = {
+ { &hf_E212_imsi,
+ { "IMSI","e212.mcc",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ "International mobile subscriber identity(IMSI)", HFILL }
+ },
{ &hf_E212_mcc,
{ "Mobile Country Code (MCC)","e212.mcc",
FT_UINT16, BASE_DEC|BASE_EXT_STRING, &E212_codes_ext, 0x0,
@@ -2812,6 +2840,11 @@ proto_register_e212(void)
#endif
};
+
+ static gint *ett_e212_array[] = {
+ &ett_e212_imsi,
+ };
+
static ei_register_info ei[] = {
{ &ei_E212_mcc_non_decimal, { "e212.mcc.non_decimal", PI_MALFORMED, PI_WARN, "MCC contains non-decimal digits", EXPFILL }},
{ &ei_E212_mnc_non_decimal, { "e212.mnc.non_decimal", PI_MALFORMED, PI_WARN, "MNC contains non-decimal digits", EXPFILL }},
@@ -2832,6 +2865,7 @@ proto_register_e212(void)
* the header fields and subtrees used.
*/
proto_register_field_array(proto_e212, hf, array_length(hf));
+ proto_register_subtree_array(ett_e212_array, array_length(ett_e212_array));
expert_e212 = expert_register_protocol(proto_e212);
expert_register_field_array(expert_e212, ei, array_length(ei));