diff options
author | AndersBroman <anders.broman@ericsson.com> | 2014-08-19 14:24:13 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2014-08-19 12:27:29 +0000 |
commit | 1cdef1d98aac306932dc599d427a3e1191d48a44 (patch) | |
tree | ad618708ac4a6dbefa1f66e38100adb656bab44e /asn1 | |
parent | fc43a8c933dca46dd591523dac1eed4f5c2adcbb (diff) | |
download | wireshark-1cdef1d98aac306932dc599d427a3e1191d48a44.tar.gz wireshark-1cdef1d98aac306932dc599d427a3e1191d48a44.tar.bz2 wireshark-1cdef1d98aac306932dc599d427a3e1191d48a44.zip |
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 'asn1')
-rw-r--r-- | asn1/gsm_map/gsm_map.cnf | 31 | ||||
-rw-r--r-- | asn1/gsm_map/packet-gsm_map-template.c | 26 |
2 files changed, 26 insertions, 31 deletions
diff --git a/asn1/gsm_map/gsm_map.cnf b/asn1/gsm_map/gsm_map.cnf index 5824c7bb48..f4fb63751a 100644 --- a/asn1/gsm_map/gsm_map.cnf +++ b/asn1/gsm_map/gsm_map.cnf @@ -234,7 +234,7 @@ MAP-DialoguePDU B "0.4.0.0.1.1.1.1" "map-DialogueAS" offset=call_ber_oid_callback(obj_id, tvb, offset, actx->pinfo, ext_tree, NULL); }else{ call_dissector(data_handle, tvb, actx->pinfo, ext_tree); - offset = tvb_length_remaining(tvb,offset); + offset = tvb_reported_length_remaining(tvb,offset); } #.FN_PARS AccessNetworkProtocolId @@ -254,6 +254,21 @@ MAP-DialoguePDU B "0.4.0.0.1.1.1.1" "map-DialogueAS" subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_isdn_address_string); dissect_gsm_map_msisdn(parameter_tvb, actx->pinfo , subtree); +#.FN_BODY IMSI VAL_PTR = ¶meter_tvb + tvbuff_t *parameter_tvb; + + offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, ¶meter_tvb); + + if (!parameter_tvb) + return offset; + if(tvb_reported_length(parameter_tvb)==0) + return offset; + + /* Hide the octet string dfault printout */ + PROTO_ITEM_SET_HIDDEN(actx->created_item); + dissect_e212_imsi(parameter_tvb, actx->pinfo, tree, 0, tvb_reported_length(parameter_tvb), FALSE); + + #.FN_BODY TBCD-STRING VAL_PTR = ¶meter_tvb tvbuff_t *parameter_tvb; const char *digit_str; @@ -262,7 +277,7 @@ MAP-DialoguePDU B "0.4.0.0.1.1.1.1" "map-DialogueAS" if (!parameter_tvb) return offset; - if(tvb_length(parameter_tvb)==0) + if(tvb_reported_length(parameter_tvb)==0) return offset; digit_str = unpack_digits(parameter_tvb, 0); @@ -532,7 +547,7 @@ actx->pinfo->p2p_dir = P2P_DIR_RECV; if (!parameter_tvb) return offset; - length = tvb_ensure_length_remaining(parameter_tvb,0); + length = tvb_ensure_captured_length_remaining(parameter_tvb,0); switch(sms_encoding){ case SMS_ENCODING_7BIT: case SMS_ENCODING_7BIT_LANG: @@ -622,10 +637,10 @@ actx->pinfo->p2p_dir = P2P_DIR_RECV; octet = tvb_get_guint8(parameter_tvb,0); switch(octet){ case 0x04: /* IPv4 */ - proto_tree_add_item(subtree, hf_gsm_map_GSNAddress_IPv4, parameter_tvb, 1, tvb_length_remaining(parameter_tvb, 1), ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_gsm_map_GSNAddress_IPv4, parameter_tvb, 1, tvb_reported_length_remaining(parameter_tvb, 1), ENC_BIG_ENDIAN); break; case 0x50: /* IPv4 */ - proto_tree_add_item(subtree, hf_gsm_map_GSNAddress_IPv4, parameter_tvb, 1, tvb_length_remaining(parameter_tvb, 1), ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_gsm_map_GSNAddress_IPv4, parameter_tvb, 1, tvb_reported_length_remaining(parameter_tvb, 1), ENC_BIG_ENDIAN); break; default: break; @@ -665,7 +680,7 @@ actx->pinfo->p2p_dir = P2P_DIR_RECV; return offset; subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_RadioResourceInformation); - be_chan_type(parameter_tvb, subtree, actx->pinfo, 0, tvb_length_remaining(tvb,0), NULL, 0); + be_chan_type(parameter_tvb, subtree, actx->pinfo, 0, tvb_reported_length_remaining(tvb,0), NULL, 0); #.FN_BODY RANAP-ServiceHandover VAL_PTR = ¶meter_tvb tvbuff_t *parameter_tvb; @@ -872,7 +887,7 @@ if (!actx->value_ptr) return offset; subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_GlobalCellId); - be_cell_id_aux(parameter_tvb, subtree, actx->pinfo, 0, tvb_length_remaining(tvb,0), NULL, 0, 0); + be_cell_id_aux(parameter_tvb, subtree, actx->pinfo, 0, tvb_reported_length_remaining(tvb,0), NULL, 0, 0); #.FN_BODY Ext-GeographicalInformation VAL_PTR = ¶meter_tvb tvbuff_t *parameter_tvb; @@ -906,7 +921,7 @@ if (!actx->value_ptr) if (!parameter_tvb) return offset; - length = tvb_length(parameter_tvb); + length = tvb_reported_length(parameter_tvb); name_len = tvb_get_guint8(parameter_tvb, 0); apn_str = tvb_get_string_enc(wmem_packet_scope(), parameter_tvb, 1, length - 1, ENC_ASCII|ENC_NA); if (name_len < length-1) { diff --git a/asn1/gsm_map/packet-gsm_map-template.c b/asn1/gsm_map/packet-gsm_map-template.c index 601e20691e..520d6c0833 100644 --- a/asn1/gsm_map/packet-gsm_map-template.c +++ b/asn1/gsm_map/packet-gsm_map-template.c @@ -85,9 +85,7 @@ static int hf_gsm_map_currentPassword = -1; static int hf_gsm_map_extension = -1; static int hf_gsm_map_nature_of_number = -1; static int hf_gsm_map_number_plan = -1; -static int hf_gsm_map_isdn_address_digits = -1; static int hf_gsm_map_address_digits = -1; -static int hf_gsm_map_servicecentreaddress_digits = -1; static int hf_gsm_map_TBCD_digits = -1; static int hf_gsm_map_Ss_Status_unused = -1; static int hf_gsm_map_Ss_Status_q_bit = -1; @@ -116,11 +114,9 @@ static int hf_gsm_map_qos_transfer_delay = -1; static int hf_gsm_map_guaranteed_max_brate_ulink = -1; static int hf_gsm_map_guaranteed_max_brate_dlink = -1; static int hf_gsm_map_GSNAddress_IPv4 = -1; -static int hf_gsm_map_GSNAddress_IPv6 = -1; static int hf_gsm_map_ranap_service_Handover = -1; static int hf_gsm_map_IntegrityProtectionInformation = -1; static int hf_gsm_map_EncryptionInformation = -1; -static int hf_gsm_map_PlmnContainer_PDU = -1; static int hf_gsm_map_ss_SS_UserData = -1; static int hf_gsm_map_cbs_coding_grp = -1; static int hf_gsm_map_cbs_coding_grp0_lang = -1; @@ -1372,7 +1368,7 @@ static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ proto_tree_add_expert_format(tree, actx->pinfo, &ei_gsm_map_unknown_invokeData, tvb, offset, -1, "Unknown invokeData %d", opcode); } - offset+= tvb_length_remaining(tvb,offset); + offset+= tvb_reported_length_remaining(tvb,offset); break; } return offset; @@ -1682,7 +1678,7 @@ static int dissect_returnResultData(proto_tree *tree, tvbuff_t *tvb, int offset, proto_tree_add_expert_format(tree, actx->pinfo, &ei_gsm_map_unknown_invokeData, tvb, offset, -1, "Unknown returnResultData %d", opcode); } - offset+= tvb_length_remaining(tvb,offset); + offset+= tvb_reported_length_remaining(tvb,offset); break; } return offset; @@ -1845,7 +1841,7 @@ static int dissect_returnErrorData(proto_tree *tree, tvbuff_t *tvb, int offset, proto_tree_add_expert_format(tree, actx->pinfo, &ei_gsm_map_unknown_invokeData, tvb, offset, -1, "Unknown returnErrorData %d", opcode); } - offset+= tvb_length_remaining(tvb,offset); + offset+= tvb_reported_length_remaining(tvb,offset); break; } return offset; @@ -2622,18 +2618,10 @@ void proto_register_gsm_map(void) { { "Number plan", "gsm_map.number_plan", FT_UINT8, BASE_HEX|BASE_EXT_STRING, &gsm_map_number_plan_values_ext, 0x0f, NULL, HFILL }}, - { &hf_gsm_map_isdn_address_digits, - { "ISDN Address digits", "gsm_map.isdn.address.digits", - FT_STRING, BASE_NONE, NULL, 0, - NULL, HFILL }}, { &hf_gsm_map_address_digits, { "Address digits", "gsm_map.address.digits", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, - { &hf_gsm_map_servicecentreaddress_digits, - { "ServiceCentreAddress digits", "gsm_map.servicecentreaddress_digits", - FT_STRING, BASE_NONE, NULL, 0, - NULL, HFILL }}, { &hf_gsm_map_TBCD_digits, { "TBCD digits", "gsm_map.tbcd_digits", FT_STRING, BASE_NONE, NULL, 0, @@ -2743,10 +2731,6 @@ void proto_register_gsm_map(void) { { "GSN-Address IPv4", "gsm_map.gsnaddress_ipv4", FT_IPv4, BASE_NONE, NULL, 0, "IPAddress IPv4", HFILL }}, - { &hf_gsm_map_GSNAddress_IPv6, - { "GSN Address IPv6", "gsm_map.gsnaddress_ipv6", - FT_IPv4, BASE_NONE, NULL, 0, - "IPAddress IPv6", HFILL }}, { &hf_gsm_map_ranap_service_Handover, { "service-Handover", "gsm_map.ranap.service_Handover", FT_UINT32, BASE_DEC, VALS(ranap_Service_Handover_vals), 0, @@ -2759,10 +2743,6 @@ void proto_register_gsm_map(void) { { "EncryptionInformation", "gsm_map.ranap.EncryptionInformation", FT_NONE, BASE_NONE, NULL, 0, "gsm_map.ranap.EncryptionInformation", HFILL }}, - { &hf_gsm_map_PlmnContainer_PDU, - { "PlmnContainer", "gsm_map.PlmnContainer", - FT_NONE, BASE_NONE, NULL, 0, - "gsm_map.PlmnContainer", HFILL }}, { &hf_gsm_map_ss_SS_UserData, { "SS-UserData", "gsm_ss.SS_UserData", FT_STRING, BASE_NONE, NULL, 0, |