diff options
author | Vadim Yanitskiy <axilirator@gmail.com> | 2019-12-20 10:45:55 +0900 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2019-12-20 05:24:07 +0000 |
commit | caf8e70dfe722e6c2e1e0ae2a1e489eb4d626f31 (patch) | |
tree | f81aa0d858a89fdce57ef5cd0ff1c5743ed05434 /epan/dissectors/packet-gsm_abis_oml.c | |
parent | 5b08742905a2fe8e97f365202d78b17d3128569a (diff) |
GSM A-bis/OML: use more proto_tree_add_item() in dissect_oml_attrs()
In dissect_oml_attrs(), all pairs of:
- val16 = tvb_get_ntohs(...);
- proto_tree_add_uint(..., val16);
can be replaced by generic proto_tree_add_item(..., ENC_BIG_ENDIAN).
Change-Id: Id5a77b056d8e6bfafb1074d5e5ded853f64f168d
Reviewed-on: https://code.wireshark.org/review/35514
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-gsm_abis_oml.c')
-rw-r--r-- | epan/dissectors/packet-gsm_abis_oml.c | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/epan/dissectors/packet-gsm_abis_oml.c b/epan/dissectors/packet-gsm_abis_oml.c index a03f16e460..790deaec73 100644 --- a/epan/dissectors/packet-gsm_abis_oml.c +++ b/epan/dissectors/packet-gsm_abis_oml.c @@ -1514,7 +1514,6 @@ dissect_oml_attrs(tvbuff_t *tvb, int base_offs, packet_info *pinfo, while (tvb_reported_length_remaining(tvb, offset) > 0) { guint i; guint8 tag, val8; - guint16 val16; unsigned int len, len_len, hlen; const struct tlv_def *tdef; proto_item *ti; @@ -1592,9 +1591,9 @@ dissect_oml_attrs(tvbuff_t *tvb, int base_offs, packet_info *pinfo, break; case NM_ATT_ARFCN_LIST: for (i = 0; i < len; i += 2) { - val16 = tvb_get_ntohs(tvb, offset + i); - proto_tree_add_uint(att_tree, hf_attr_arfcn, - tvb, offset + i, 2, val16); + proto_tree_add_item(att_tree, hf_attr_arfcn, + tvb, offset + i, 2, + ENC_BIG_ENDIAN); } break; case NM_ATT_AVAIL_STATUS: @@ -1681,9 +1680,8 @@ dissect_oml_attrs(tvbuff_t *tvb, int base_offs, packet_info *pinfo, offset, len, ENC_NA); break; case NM_ATT_IPACC_DST_IP_PORT: - val16 = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(att_tree, hf_attr_ipa_rsl_port, tvb, - offset, len, val16); + proto_tree_add_item(att_tree, hf_attr_ipa_rsl_port, tvb, + offset, len, ENC_BIG_ENDIAN); break; case NM_ATT_IPACC_LOCATION: proto_tree_add_item(att_tree, hf_attr_ipa_location_name, @@ -1721,29 +1719,24 @@ dissect_oml_attrs(tvbuff_t *tvb, int base_offs, packet_info *pinfo, tvb, offset, 1, ENC_LITTLE_ENDIAN); break; case NM_ATT_IPACC_NSEI: - val16 = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(att_tree, hf_attr_ipa_nsei, - tvb, offset, 2, val16); + proto_tree_add_item(att_tree, hf_attr_ipa_nsei, + tvb, offset, 2, ENC_BIG_ENDIAN); break; case NM_ATT_IPACC_NSVCI: - val16 = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(att_tree, hf_attr_ipa_nsvci, - tvb, offset, 2, val16); + proto_tree_add_item(att_tree, hf_attr_ipa_nsvci, + tvb, offset, 2, ENC_BIG_ENDIAN); break; case NM_ATT_IPACC_BVCI: - val16 = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(att_tree, hf_attr_ipa_bvci, - tvb, offset, 2, val16); + proto_tree_add_item(att_tree, hf_attr_ipa_bvci, + tvb, offset, 2, ENC_BIG_ENDIAN); break; case NM_ATT_IPACC_NS_LINK_CFG: - val16 = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(att_tree, hf_attr_ipa_nsl_sport, - tvb, offset, 2, val16); + proto_tree_add_item(att_tree, hf_attr_ipa_nsl_sport, + tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item(att_tree, hf_attr_ipa_nsl_daddr, tvb, offset+2, 4, ENC_NA); - val16 = tvb_get_ntohs(tvb, offset+6); - proto_tree_add_uint(att_tree, hf_attr_ipa_nsl_dport, - tvb, offset+6, 2, val16); + proto_tree_add_item(att_tree, hf_attr_ipa_nsl_dport, + tvb, offset+6, 2, ENC_BIG_ENDIAN); break; } offset += len; |