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>
This commit is contained in:
Vadim Yanitskiy 2019-12-20 10:45:55 +09:00 committed by Anders Broman
parent 5b08742905
commit caf8e70dfe
1 changed files with 15 additions and 22 deletions

View File

@ -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;