diff options
author | AndersBroman <anders.broman@ericsson.com> | 2015-01-09 16:39:47 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2015-01-12 08:42:55 +0000 |
commit | 2619eddee8414015c5cc5e9c034b3dc345e8e2cf (patch) | |
tree | 304c28cf6d6ed0244a82b8ea3a2484335494dc52 /epan | |
parent | e974a6f571f1a3af9e2c801cdff907b13c5cb7ac (diff) |
[E212] Make it possible to use different filters for MCC and MNC in LAI
RAI and SAI.
Change-Id: I2abcc868899b8752f66347b3a0fe190670c3ce3f
Reviewed-on: https://code.wireshark.org/review/6447
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-bssgp.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-e212.c | 64 | ||||
-rw-r--r-- | epan/dissectors/packet-e212.h | 9 | ||||
-rw-r--r-- | epan/dissectors/packet-gsm_a_bssmap.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-gtpv2.c | 22 | ||||
-rw-r--r-- | epan/dissectors/packet-ieee80211.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-mip6.c | 2 |
7 files changed, 82 insertions, 21 deletions
diff --git a/epan/dissectors/packet-bssgp.c b/epan/dissectors/packet-bssgp.c index 3925295435..ae36acc08a 100644 --- a/epan/dissectors/packet-bssgp.c +++ b/epan/dissectors/packet-bssgp.c @@ -3331,7 +3331,7 @@ de_bssgp_unconfim_send_state_var(tvbuff_t *tvb, proto_tree *tree, packet_info *p static guint16 de_bssgp_selected_plmn_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) { - proto_tree_add_string(tree, hf_bssgp_selected_plmn_id, tvb, offset, 3, dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, offset, TRUE)); + proto_tree_add_string(tree, hf_bssgp_selected_plmn_id, tvb, offset, 3, dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, offset, E212_NONE, TRUE)); return 3; } diff --git a/epan/dissectors/packet-e212.c b/epan/dissectors/packet-e212.c index 5d91096418..1062f31ca3 100644 --- a/epan/dissectors/packet-e212.c +++ b/epan/dissectors/packet-e212.c @@ -2549,7 +2549,13 @@ 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_mcc_lai = -1; +static int hf_E212_mcc_sai = -1; +static int hf_E212_mcc_rai = -1; static int hf_E212_mnc = -1; +static int hf_E212_mnc_lai = -1; +static int hf_E212_mnc_sai = -1; +static int hf_E212_mnc_rai = -1; static int ett_e212_imsi = -1; @@ -2614,7 +2620,7 @@ static expert_field ei_E212_mnc_non_decimal = EI_INIT; * Return MCC MNC in a packet scope allocated string that can be used in labels. */ gchar * -dissect_e212_mcc_mnc_wmem_packet_str(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, gboolean little_endian) +dissect_e212_mcc_mnc_wmem_packet_str(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, e212_number_type_t number_type, gboolean little_endian) { int start_offset, mcc_mnc; @@ -2624,7 +2630,25 @@ dissect_e212_mcc_mnc_wmem_packet_str(tvbuff_t *tvb, packet_info *pinfo, proto_tr proto_item *item; gchar *mcc_mnc_str; gboolean long_mnc = FALSE; - + int hf_E212_mcc_id, hf_E212_mnc_id; + + switch(number_type){ + case E212_LAI: + hf_E212_mcc_id = hf_E212_mcc_lai; + hf_E212_mnc_id = hf_E212_mnc_lai; + break; + case E212_RAI: + hf_E212_mcc_id = hf_E212_mcc_rai; + hf_E212_mnc_id = hf_E212_mnc_rai; + break; + case E212_SAI: + hf_E212_mcc_id = hf_E212_mcc_sai; + hf_E212_mnc_id = hf_E212_mnc_sai; + break; + default: + hf_E212_mcc_id = hf_E212_mcc; + hf_E212_mnc_id = hf_E212_mnc; + } start_offset = offset; /* MCC + MNC */ mcc_mnc = tvb_get_ntoh24(tvb,offset); @@ -2651,12 +2675,12 @@ dissect_e212_mcc_mnc_wmem_packet_str(tvbuff_t *tvb, packet_info *pinfo, proto_tr else mnc = 100 * mnc3 + mnc; } - item = proto_tree_add_uint(tree, hf_E212_mcc , tvb, start_offset, 2, mcc ); + item = proto_tree_add_uint(tree, hf_E212_mcc_id , tvb, start_offset, 2, mcc ); if (((mcc1 > 9) || (mcc2 > 9) || (mcc3 > 9)) && (mcc_mnc != 0xffffff)) expert_add_info(pinfo, item, &ei_E212_mcc_non_decimal); if (long_mnc) { - item = proto_tree_add_uint_format_value(tree, hf_E212_mnc , tvb, start_offset + 1, 2, mnc, + item = proto_tree_add_uint_format_value(tree, hf_E212_mnc_id , tvb, start_offset + 1, 2, mnc, "%s (%03u)", val_to_str_ext_const(mcc * 1000 + mnc, &mcc_mnc_codes_ext, "Unknown"), mnc); @@ -2692,7 +2716,7 @@ dissect_e212_mcc_mnc_wmem_packet_str(tvbuff_t *tvb, packet_info *pinfo, proto_tr int dissect_e212_mcc_mnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, gboolean little_endian) { - dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, offset, little_endian); + dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, offset, E212_NONE, little_endian); return offset +3; } @@ -2986,11 +3010,41 @@ proto_register_e212(void) FT_UINT16, BASE_DEC|BASE_EXT_STRING, &E212_codes_ext, 0x0, "Mobile Country Code MCC", HFILL } }, + { &hf_E212_mcc_lai, + { "Mobile Country Code (MCC)","e212.lai.mcc", + FT_UINT16, BASE_DEC|BASE_EXT_STRING, &E212_codes_ext, 0x0, + "Mobile Country Code MCC", HFILL } + }, + { &hf_E212_mcc_rai, + { "Mobile Country Code (MCC)","e212.rai.mcc", + FT_UINT16, BASE_DEC|BASE_EXT_STRING, &E212_codes_ext, 0x0, + "Mobile Country Code MCC", HFILL } + }, + { &hf_E212_mcc_sai, + { "Mobile Country Code (MCC)","e212.sai.mcc", + FT_UINT16, BASE_DEC|BASE_EXT_STRING, &E212_codes_ext, 0x0, + "Mobile Country Code MCC", HFILL } + }, { &hf_E212_mnc, { "Mobile Network Code (MNC)","e212.mnc", FT_UINT16, BASE_DEC, NULL, 0x0, "Mobile network code", HFILL } }, + { &hf_E212_mnc_lai, + { "Mobile Network Code (MNC)","e212.lai.mnc", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Mobile network code", HFILL } + }, + { &hf_E212_mnc_rai, + { "Mobile Network Code (MNC)","e212.rai.mnc", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Mobile network code", HFILL } + }, + { &hf_E212_mnc_sai, + { "Mobile Network Code (MNC)","e212.sai.mnc", + FT_UINT16, BASE_DEC, NULL, 0x0, + "Mobile network code", HFILL } + }, #if 0 { &hf_E212_msin, { "Mobile Subscriber Identification Number (MSIN)", "e212.msin", diff --git a/epan/dissectors/packet-e212.h b/epan/dissectors/packet-e212.h index c8e5110150..a1424f6e6b 100644 --- a/epan/dissectors/packet-e212.h +++ b/epan/dissectors/packet-e212.h @@ -29,7 +29,14 @@ extern value_string_ext E212_codes_ext; -gchar* dissect_e212_mcc_mnc_wmem_packet_str(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, gboolean little_endian); +typedef enum { + E212_NONE, + E212_LAI, + E212_RAI, + E212_SAI +} e212_number_type_t; + +gchar* dissect_e212_mcc_mnc_wmem_packet_str(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, e212_number_type_t number_type, gboolean little_endian); WS_DLL_PUBLIC int dissect_e212_mcc_mnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, gboolean little_endian); diff --git a/epan/dissectors/packet-gsm_a_bssmap.c b/epan/dissectors/packet-gsm_a_bssmap.c index d5f3c18f32..3cfa464b0b 100644 --- a/epan/dissectors/packet-gsm_a_bssmap.c +++ b/epan/dissectors/packet-gsm_a_bssmap.c @@ -4361,7 +4361,7 @@ static guint16 be_selected_plmn_id(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_) { - proto_tree_add_string(tree, hf_gsm_a_bssmap_selected_plmn_id, tvb, offset, 3, dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, offset, TRUE)); + proto_tree_add_string(tree, hf_gsm_a_bssmap_selected_plmn_id, tvb, offset, 3, dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, offset, E212_NONE, TRUE)); return 3; } diff --git a/epan/dissectors/packet-gtpv2.c b/epan/dissectors/packet-gtpv2.c index cdd1638b41..f8f2fa7376 100644 --- a/epan/dissectors/packet-gtpv2.c +++ b/epan/dissectors/packet-gtpv2.c @@ -1946,7 +1946,7 @@ dissect_gtpv2_serv_net(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, prot { gchar *mcc_mnc_str; - mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, 0, TRUE); + mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, 0, E212_NONE, TRUE); proto_item_append_text(item, "%s", mcc_mnc_str); } @@ -1996,7 +1996,7 @@ dissect_gtpv2_tai(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offs gchar *mcc_mnc_str; guint16 tac; - mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, *offset, TRUE); + mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, *offset, E212_NONE, TRUE); *offset += 3; tac = tvb_get_ntohs(tvb, *offset); proto_tree_add_item(tree, hf_gtpv2_tai_tac, tvb, *offset, 2, ENC_BIG_ENDIAN); @@ -2018,7 +2018,7 @@ dissect_gtpv2_ecgi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *off guint8 spare; guint32 ECGI; - mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, *offset, TRUE); + mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, *offset, E212_NONE, TRUE); *offset += 3; /* The bits 8 through 5, of octet e+3 (Fig 8.21.5-1 in TS 29.274 V8.2.0) are spare * and hence they would not make any difference to the hex string following it, @@ -2051,7 +2051,7 @@ dissect_gtpv2_rai(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offs gchar *mcc_mnc_str; guint16 lac, rac; - mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, *offset, TRUE); + mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, *offset, E212_RAI, TRUE); *offset += 3; lac = tvb_get_ntohs(tvb, *offset); proto_tree_add_item(tree, hf_gtpv2_rai_lac, tvb, *offset, 2, ENC_BIG_ENDIAN); @@ -2074,7 +2074,7 @@ dissect_gtpv2_sai_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in gchar *mcc_mnc_str; guint16 lac, sac; - mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, *offset, TRUE); + mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, *offset, E212_SAI, TRUE); *offset += 3; lac = tvb_get_ntohs(tvb, *offset); proto_tree_add_item(tree, hf_gtpv2_sai_lac, tvb, *offset, 2, ENC_BIG_ENDIAN); @@ -2097,7 +2097,7 @@ dissect_gtpv2_cgi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offs gchar *mcc_mnc_str; guint16 lac, ci; - mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, *offset, TRUE); + mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, *offset, E212_NONE, TRUE); *offset += 3; lac = tvb_get_ntohs(tvb, *offset); proto_tree_add_item(tree, hf_gtpv2_uli_cgi_lac, tvb, *offset, 2, ENC_BIG_ENDIAN); @@ -2191,7 +2191,7 @@ decode_gtpv2_uli(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item proto_item_append_text(item, "LAI "); part_tree = proto_tree_add_subtree(tree, tvb, offset, 5, ett_gtpv2_uli_field, NULL, "LAI (Location Area Identifier)"); - mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, part_tree, offset, TRUE); + mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, part_tree, offset, E212_LAI, TRUE); offset += 3; /* The Location Area Code (LAC) consists of 2 octets. Bit 8 of Octet f+3 is the most significant bit @@ -3927,7 +3927,7 @@ dissect_gtpv2_trace_reference(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre guint32 trace_id; gchar *mcc_mnc_str; - mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, 0, TRUE); + mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, 0, E212_NONE, TRUE); offset += 3; trace_id = tvb_get_ntohs(tvb, offset); @@ -4188,7 +4188,7 @@ dissect_gtpv2_sel_plmn_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, p { gchar *mcc_mnc_str; - mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, 0, FALSE); + mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, 0, E212_NONE, FALSE); proto_item_append_text(item, "%s", mcc_mnc_str); } @@ -4212,7 +4212,7 @@ dissect_gtpv2_macro_enodeb_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre gchar *mcc_mnc_str; guint32 macro_enodeb_id; - mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, *offset, TRUE); + mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, *offset, E212_NONE, TRUE); *offset += 3; /* The Macro eNodeB ID consists of 20 bits. * Bit 4 of Octet 4 is the most significant bit and bit 1 of Octet 6 is the least significant bit. @@ -4235,7 +4235,7 @@ dissect_gtpv2_home_enodeb_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree gchar *mcc_mnc_str; guint32 home_enodeb_id; - mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, *offset, TRUE); + mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, *offset, E212_NONE, TRUE); *offset += 3; /* Octet 10 to 12 Home eNodeB ID diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c index 2ad71623a7..bb2304401d 100644 --- a/epan/dissectors/packet-ieee80211.c +++ b/epan/dissectors/packet-ieee80211.c @@ -6489,7 +6489,7 @@ dissect_3gpp_cellular_network_info(proto_tree *tree, tvbuff_t *tvb, packet_info while (num > 0) { if (tvb_reported_length_remaining(tvb, offset) < 3) break; - dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, offset, FALSE); + dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, offset, E212_NONE, FALSE); num--; offset += 3; } diff --git a/epan/dissectors/packet-mip6.c b/epan/dissectors/packet-mip6.c index 6fe5727dad..e87fe077c7 100644 --- a/epan/dissectors/packet-mip6.c +++ b/epan/dissectors/packet-mip6.c @@ -1838,7 +1838,7 @@ dissect_mip6_opt_vsm_3gpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v break; /* 13, Serving Network */ case 13: - mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, offset, TRUE); + mcc_mnc_str = dissect_e212_mcc_mnc_wmem_packet_str(tvb, pinfo, tree, offset, E212_NONE, TRUE); proto_item_append_text(hdr_item," %s", mcc_mnc_str); break; /* 14, APN Restriction */ |