diff --git a/epan/dissectors/asn1/ldap/packet-ldap-template.c b/epan/dissectors/asn1/ldap/packet-ldap-template.c index a3765fbbe3..544cf07fa5 100644 --- a/epan/dissectors/asn1/ldap/packet-ldap-template.c +++ b/epan/dissectors/asn1/ldap/packet-ldap-template.c @@ -1486,7 +1486,7 @@ static int dissect_NetLogon_PDU(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre proto_tree_add_string(tree, hf_mscldap_hostname, tvb, old_offset, offset-old_offset, str); /* DC IP Address */ - proto_tree_add_ipv4(tree, hf_mscldap_netlogon_ipaddress, tvb, offset, 4, tvb_get_ntohl(tvb,offset)); + proto_tree_add_item(tree, hf_mscldap_netlogon_ipaddress, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; /* Flags */ @@ -1570,7 +1570,7 @@ static int dissect_NetLogon_PDU(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre /* add IP address and desect the sockaddr_in structure */ old_offset = offset + 4; - item = proto_tree_add_ipv4(tree, hf_mscldap_netlogon_ipaddress, tvb, old_offset, 4, tvb_get_ipv4(tvb,old_offset)); + item = proto_tree_add_item(tree, hf_mscldap_netlogon_ipaddress, tvb, old_offset, 4, ENC_BIG_ENDIAN); if (tree){ proto_tree *subtree; @@ -1586,7 +1586,7 @@ static int dissect_NetLogon_PDU(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre offset +=2; /* get IP address */ - proto_tree_add_ipv4(subtree, hf_mscldap_netlogon_ipaddress_ipv4, tvb, offset, 4, tvb_get_ipv4(tvb,offset)); + proto_tree_add_item(subtree, hf_mscldap_netlogon_ipaddress_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN); offset +=4; /* skip the 8 bytes of zeros in the sockaddr structure */ diff --git a/epan/dissectors/packet-6lowpan.c b/epan/dissectors/packet-6lowpan.c index 89c0eafcff..01d997eb08 100644 --- a/epan/dissectors/packet-6lowpan.c +++ b/epan/dissectors/packet-6lowpan.c @@ -1938,7 +1938,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi length = (guint8)sizeof(struct ip6_frag); ext_len = length - ext_hlen; - proto_tree_add_uint(nhc_tree, hf_6lowpan_nhc_ext_reserved, tvb, offset, 1, tvb_get_guint8(tvb, offset)); + proto_tree_add_item(nhc_tree, hf_6lowpan_nhc_ext_reserved, tvb, offset, 1, ENC_NA); } else { /* Get and display the extension header length. */ diff --git a/epan/dissectors/packet-aim.c b/epan/dissectors/packet-aim.c index d709b3201c..ac2014b2aa 100644 --- a/epan/dissectors/packet-aim.c +++ b/epan/dissectors/packet-aim.c @@ -2313,7 +2313,7 @@ static int dissect_aim_generic_rateinfoack(tvbuff_t *tvb, packet_info *pinfo _U_ { int offset = 0; while(tvb_reported_length_remaining(tvb, offset) > 0) { - proto_tree_add_uint(gen_tree, hf_generic_rateinfoack_group, tvb, offset, 2, tvb_get_ntohs(tvb, offset)); + proto_tree_add_item(gen_tree, hf_generic_rateinfoack_group, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2; } return offset; @@ -2322,7 +2322,7 @@ static int dissect_aim_generic_rateinfoack(tvbuff_t *tvb, packet_info *pinfo _U_ static int dissect_aim_generic_ratechange(tvbuff_t *tvb, packet_info *pinfo, proto_tree *gen_tree) { int offset = 0; - proto_tree_add_uint(gen_tree, hf_generic_ratechange_msg, tvb, offset, 2, tvb_get_ntohs(tvb, offset)); + proto_tree_add_item(gen_tree, hf_generic_ratechange_msg, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2; offset = dissect_rate_class(tvb, pinfo, offset, gen_tree); return offset; diff --git a/epan/dissectors/packet-aodv.c b/epan/dissectors/packet-aodv.c index e204e741dd..0476773c09 100644 --- a/epan/dissectors/packet-aodv.c +++ b/epan/dissectors/packet-aodv.c @@ -169,8 +169,8 @@ again: switch (type) { case AODV_EXT_INT: - proto_tree_add_uint(ext_tree, hf_aodv_ext_interval, - tvb, offset, 4, tvb_get_ntohl(tvb, offset)); + proto_tree_add_item(ext_tree, hf_aodv_ext_interval, + tvb, offset, 4, ENC_BIG_ENDIAN); break; case AODV_EXT_NTP: proto_tree_add_item(ext_tree, hf_aodv_ext_timestamp, diff --git a/epan/dissectors/packet-ax4000.c b/epan/dissectors/packet-ax4000.c index 8b2f35c72e..017b5b3df0 100644 --- a/epan/dissectors/packet-ax4000.c +++ b/epan/dissectors/packet-ax4000.c @@ -49,48 +49,29 @@ dissect_ax4000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _ proto_item *ti; proto_tree *ax4000_tree; - guint8 ax_port; - guint8 ax_chassis; - guint16 ax_index; - guint32 ax_seq; - guint32 ax_timestamp; + guint32 ax_port, ax_chassis, ax_index, ax_seq, ax_timestamp; /* Make entries in Protocol column and Info column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "AX4000"); col_clear(pinfo->cinfo, COL_INFO); - ax_port = tvb_get_guint8(tvb, 0); - ax_chassis = tvb_get_guint8(tvb, 1); - ax_index = tvb_get_ntohs(tvb, 2) & 0x0FFF; - ax_timestamp = tvb_get_letohl(tvb, 6); - ax_seq = tvb_get_letohl(tvb, 10); + /* create display subtree for the protocol */ + ti = proto_tree_add_item(tree, proto_ax4000, tvb, 0, -1, ENC_NA); + + ax4000_tree = proto_item_add_subtree(ti, ett_ax4000); + + proto_tree_add_item_ret_uint(ax4000_tree, hf_ax4000_port, tvb, 0, 1, ENC_LITTLE_ENDIAN, &ax_port); + proto_tree_add_item_ret_uint(ax4000_tree, hf_ax4000_chassis, tvb, 1, 1, ENC_LITTLE_ENDIAN, &ax_chassis); + proto_tree_add_item(ax4000_tree, hf_ax4000_fill, tvb, 2, 1, ENC_BIG_ENDIAN); + proto_tree_add_item_ret_uint(ax4000_tree, hf_ax4000_index, tvb, 2, 2, ENC_BIG_ENDIAN, &ax_index); + proto_tree_add_item_ret_uint(ax4000_tree, hf_ax4000_timestamp, tvb, 6, 4, ENC_LITTLE_ENDIAN, &ax_timestamp); + proto_tree_add_item_ret_uint(ax4000_tree, hf_ax4000_seq, tvb, 10, 4, ENC_LITTLE_ENDIAN, &ax_seq); + proto_tree_add_item(ax4000_tree, hf_ax4000_crc, tvb, 14, 2, ENC_LITTLE_ENDIAN); col_append_fstr(pinfo->cinfo, COL_INFO, "Chss:%u Prt:%u Idx:%u Seq:0x%08x TS:%.6f[msec]", ax_chassis, ax_port, ax_index, ax_seq, ax_timestamp*1e-5); - if (tree) { - /* create display subtree for the protocol */ - ti = proto_tree_add_item(tree, proto_ax4000, tvb, 0, -1, ENC_NA); - - ax4000_tree = proto_item_add_subtree(ti, ett_ax4000); - - proto_tree_add_uint(ax4000_tree, - hf_ax4000_port, tvb, 0, 1, ax_port); - proto_tree_add_uint(ax4000_tree, - hf_ax4000_chassis, tvb, 1, 1, ax_chassis); - proto_tree_add_item(ax4000_tree, - hf_ax4000_fill, tvb, 2, 1, ENC_BIG_ENDIAN); - proto_tree_add_uint(ax4000_tree, - hf_ax4000_index, tvb, 2, 2, ax_index); - proto_tree_add_uint(ax4000_tree, - hf_ax4000_timestamp, tvb, 6, 4, ax_timestamp); - proto_tree_add_uint(ax4000_tree, - hf_ax4000_seq, tvb, 10, 4, ax_seq); - proto_tree_add_uint(ax4000_tree, - hf_ax4000_crc, tvb, 14, 2, tvb_get_letohs(tvb, 14)); - } - return tvb_captured_length(tvb); } diff --git a/epan/dissectors/packet-bacnet.c b/epan/dissectors/packet-bacnet.c index 869cef0288..6228ca3a26 100644 --- a/epan/dissectors/packet-bacnet.c +++ b/epan/dissectors/packet-bacnet.c @@ -267,8 +267,7 @@ dissect_bacnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _ } if (bacnet_control & BAC_CONTROL_SRC) { /* SNET, SLEN, SADR */ /* SNET */ - proto_tree_add_uint(bacnet_tree, hf_bacnet_snet, - tvb, offset, 2, tvb_get_ntohs(tvb, offset)); + proto_tree_add_item(bacnet_tree, hf_bacnet_snet, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; bacnet_slen = tvb_get_guint8(tvb, offset); if( bacnet_slen == 0) { /* SLEN = 0 invalid */ diff --git a/epan/dissectors/packet-btle.c b/epan/dissectors/packet-btle.c index 3e35d6d45f..1dc359b799 100644 --- a/epan/dissectors/packet-btle.c +++ b/epan/dissectors/packet-btle.c @@ -47,7 +47,8 @@ static int hf_access_address = -1; static int hf_crc = -1; static int hf_master_bd_addr = -1; static int hf_slave_bd_addr = -1; -static int hf_length = -1; +static int hf_length_1f = -1; +static int hf_length_3f = -1; static int hf_advertising_header = -1; static int hf_advertising_header_pdu_type = -1; static int hf_advertising_header_rfu_1 = -1; @@ -381,8 +382,7 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) proto_item *sub_item; proto_tree *sub_tree; gint offset = 0; - guint32 access_address; - guint8 length; + guint32 access_address, length; tvbuff_t *next_tvb; guint8 *dst_bd_addr; guint8 *src_bd_addr; @@ -515,9 +515,8 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) proto_tree_add_item(advertising_header_tree, hf_advertising_header_rfu_2, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(advertising_header_tree, hf_advertising_header_length, tvb, offset, 1, ENC_LITTLE_ENDIAN); - item = proto_tree_add_uint(btle_tree, hf_length, tvb, offset, 1, tvb_get_guint8(tvb, offset) & 0x3F); + item = proto_tree_add_item_ret_uint(btle_tree, hf_length_3f, tvb, offset, 1, ENC_LITTLE_ENDIAN, &length); PROTO_ITEM_SET_HIDDEN(item); - length = tvb_get_guint8(tvb, offset) & 0x3f; offset += 1; switch (pdu_type) { @@ -863,9 +862,8 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) proto_tree_add_item(data_header_tree, hf_data_header_rfu, tvb, offset, 1, ENC_LITTLE_ENDIAN); proto_tree_add_item(data_header_tree, hf_data_header_length, tvb, offset, 1, ENC_LITTLE_ENDIAN); - item = proto_tree_add_uint(btle_tree, hf_length, tvb, offset, 1, tvb_get_guint8(tvb, offset) & 0x1F); + item = proto_tree_add_item_ret_uint(btle_tree, hf_length_1f, tvb, offset, 1, ENC_LITTLE_ENDIAN, &length); PROTO_ITEM_SET_HIDDEN(item); - length = tvb_get_guint8(tvb, offset) & 0x1f; offset += 1; switch (llid) { @@ -938,7 +936,7 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) break; case 0x02: /* Start of an L2CAP message or a complete L2CAP message with no fragmentation */ if (length > 0) { - gint le_frame_len = tvb_get_letohs(tvb, offset); + guint le_frame_len = tvb_get_letohs(tvb, offset); if (le_frame_len > length) { /* TODO: Try reassemble cases 0x01 and 0x02 */ pinfo->fragmented = TRUE; @@ -1236,9 +1234,14 @@ proto_register_btle(void) FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL } }, - { &hf_length, + { &hf_length_1f, { "Length", "btle.length", - FT_UINT8, BASE_DEC, NULL, 0x0, + FT_UINT8, BASE_DEC, NULL, 0x1F, + NULL, HFILL } + }, + { &hf_length_3f, + { "Length", "btle.length", + FT_UINT8, BASE_DEC, NULL, 0x3F, NULL, HFILL } }, { &hf_advertising_header, diff --git a/epan/dissectors/packet-cigi.c b/epan/dissectors/packet-cigi.c index 6e64c8195a..11a1217af3 100644 --- a/epan/dissectors/packet-cigi.c +++ b/epan/dissectors/packet-cigi.c @@ -142,9 +142,6 @@ static gint cigi3_3_add_symbol_clone(tvbuff_t*, proto_tree*, gint); static gint cigi3_3_add_symbol_control(tvbuff_t*, proto_tree*, gint); static gint cigi3_3_add_short_symbol_control(tvbuff_t*, proto_tree*, gint); - -static gfloat tvb_get_fixed_point(tvbuff_t*, int, gint); - /* CIGI Handle */ static dissector_handle_t cigi_handle; @@ -2432,6 +2429,16 @@ static gint cigi_minor_version = 0; /* The byte order of cigi to use; our default is big-endian */ static gint cigi_byte_order = ENC_BIG_ENDIAN; +/* + * Extract a 16-bit fixed-point value and convert it to a float. + */ +static gfloat +cigi_get_fixed_point(tvbuff_t *tvb, int offset, const guint encoding) +{ + gint16 fixed = tvb_get_guint16(tvb, offset, encoding); + return fixed / 128.0F; +} + /* * Check whether this looks like a CIGI packet or not. */ @@ -3758,16 +3765,16 @@ cigi2_add_special_effect_definition(tvbuff_t *tvb, proto_tree *tree, gint offset proto_tree_add_item(tree, hf_cigi2_special_effect_definition_blue, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; - proto_tree_add_float(tree, hf_cigi2_special_effect_definition_x_scale, tvb, offset, 2, tvb_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); + proto_tree_add_float(tree, hf_cigi2_special_effect_definition_x_scale, tvb, offset, 2, cigi_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); offset += 2; - proto_tree_add_float(tree, hf_cigi2_special_effect_definition_y_scale, tvb, offset, 2, tvb_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); + proto_tree_add_float(tree, hf_cigi2_special_effect_definition_y_scale, tvb, offset, 2, cigi_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); offset += 2; - proto_tree_add_float(tree, hf_cigi2_special_effect_definition_z_scale, tvb, offset, 2, tvb_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); + proto_tree_add_float(tree, hf_cigi2_special_effect_definition_z_scale, tvb, offset, 2, cigi_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); offset += 2; - proto_tree_add_float(tree, hf_cigi2_special_effect_definition_time_scale, tvb, offset, 2, tvb_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); + proto_tree_add_float(tree, hf_cigi2_special_effect_definition_time_scale, tvb, offset, 2, cigi_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); offset += 2; proto_tree_add_item(tree, hf_cigi2_special_effect_definition_spare, tvb, offset, 2, ENC_BIG_ENDIAN); @@ -3845,22 +3852,22 @@ cigi2_add_collision_detection_segment_definition(tvbuff_t *tvb, proto_tree *tree proto_tree_add_item(tree, hf_cigi2_collision_detection_segment_definition_collision_mask, tvb, offset, 4, ENC_NA); offset += 4; - proto_tree_add_float(tree, hf_cigi2_collision_detection_segment_definition_x_start, tvb, offset, 2, tvb_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); + proto_tree_add_float(tree, hf_cigi2_collision_detection_segment_definition_x_start, tvb, offset, 2, cigi_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); offset += 2; - proto_tree_add_float(tree, hf_cigi2_collision_detection_segment_definition_y_start, tvb, offset, 2, tvb_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); + proto_tree_add_float(tree, hf_cigi2_collision_detection_segment_definition_y_start, tvb, offset, 2, cigi_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); offset += 2; - proto_tree_add_float(tree, hf_cigi2_collision_detection_segment_definition_z_start, tvb, offset, 2, tvb_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); + proto_tree_add_float(tree, hf_cigi2_collision_detection_segment_definition_z_start, tvb, offset, 2, cigi_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); offset += 2; - proto_tree_add_float(tree, hf_cigi2_collision_detection_segment_definition_x_end, tvb, offset, 2, tvb_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); + proto_tree_add_float(tree, hf_cigi2_collision_detection_segment_definition_x_end, tvb, offset, 2, cigi_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); offset += 2; - proto_tree_add_float(tree, hf_cigi2_collision_detection_segment_definition_y_end, tvb, offset, 2, tvb_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); + proto_tree_add_float(tree, hf_cigi2_collision_detection_segment_definition_y_end, tvb, offset, 2, cigi_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); offset += 2; - proto_tree_add_float(tree, hf_cigi2_collision_detection_segment_definition_z_end, tvb, offset, 2, tvb_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); + proto_tree_add_float(tree, hf_cigi2_collision_detection_segment_definition_z_end, tvb, offset, 2, cigi_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); offset += 2; return offset; @@ -3877,22 +3884,22 @@ cigi2_add_collision_detection_volume_definition(tvbuff_t *tvb, proto_tree *tree, proto_tree_add_item(tree, hf_cigi2_collision_detection_volume_definition_volume_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 4; - proto_tree_add_float(tree, hf_cigi2_collision_detection_volume_definition_x_offset, tvb, offset, 2, tvb_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); + proto_tree_add_float(tree, hf_cigi2_collision_detection_volume_definition_x_offset, tvb, offset, 2, cigi_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); offset += 2; - proto_tree_add_float(tree, hf_cigi2_collision_detection_volume_definition_y_offset, tvb, offset, 2, tvb_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); + proto_tree_add_float(tree, hf_cigi2_collision_detection_volume_definition_y_offset, tvb, offset, 2, cigi_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); offset += 2; - proto_tree_add_float(tree, hf_cigi2_collision_detection_volume_definition_z_offset, tvb, offset, 2, tvb_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); + proto_tree_add_float(tree, hf_cigi2_collision_detection_volume_definition_z_offset, tvb, offset, 2, cigi_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); offset += 2; - proto_tree_add_float(tree, hf_cigi2_collision_detection_volume_definition_height, tvb, offset, 2, tvb_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); + proto_tree_add_float(tree, hf_cigi2_collision_detection_volume_definition_height, tvb, offset, 2, cigi_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); offset += 2; - proto_tree_add_float(tree, hf_cigi2_collision_detection_volume_definition_width, tvb, offset, 2, tvb_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); + proto_tree_add_float(tree, hf_cigi2_collision_detection_volume_definition_width, tvb, offset, 2, cigi_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); offset += 2; - proto_tree_add_float(tree, hf_cigi2_collision_detection_volume_definition_depth, tvb, offset, 2, tvb_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); + proto_tree_add_float(tree, hf_cigi2_collision_detection_volume_definition_depth, tvb, offset, 2, cigi_get_fixed_point(tvb, offset, ENC_BIG_ENDIAN)); offset += 2; return offset; @@ -6402,21 +6409,6 @@ cigi3_add_image_generator_message(tvbuff_t *tvb, proto_tree *tree, gint offset) return offset; } -/* - * Extract a 16-bit fixed-point value and convert it to a float. - */ -static gfloat -tvb_get_fixed_point(tvbuff_t *tvb, int offset, gint rep) -{ - gint16 fixed; - - if (rep & ENC_LITTLE_ENDIAN) - fixed = tvb_get_letohs(tvb, offset); - else - fixed = tvb_get_ntohs(tvb, offset); - return fixed / 128.0F; -} - /* Register the protocol with Wireshark */ void proto_register_cigi(void) diff --git a/epan/dissectors/packet-dtpt.c b/epan/dissectors/packet-dtpt.c index 0d45350f96..e0ab8eb40b 100644 --- a/epan/dissectors/packet-dtpt.c +++ b/epan/dissectors/packet-dtpt.c @@ -454,38 +454,36 @@ dissect_dtpt_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dtpt_queryset_tree = proto_tree_add_subtree(dtpt_tree, tvb, 4, 60, ett_dtpt_queryset, NULL, "QuerySet raw"); - if (dtpt_queryset_tree) { - proto_tree_add_uint(dtpt_queryset_tree, hf_dtpt_queryset_size, - tvb, offset+4+0, 4, queryset_size); - proto_tree_add_uint(dtpt_queryset_tree, hf_dtpt_queryset_service_instance_name_pointer, - tvb, offset+4+4, 4, tvb_get_letohl(tvb, offset+4+ 4)); - proto_tree_add_uint(dtpt_queryset_tree, hf_dtpt_queryset_service_class_id_pointer, - tvb, offset+4+8, 4, tvb_get_letohl(tvb, offset+4+ 8)); - proto_tree_add_uint(dtpt_queryset_tree, hf_dtpt_queryset_version, - tvb, offset+4+12, 4, tvb_get_letohl(tvb, offset+4+12)); - proto_tree_add_uint(dtpt_queryset_tree, hf_dtpt_queryset_comment_pointer, - tvb, offset+4+16, 4, tvb_get_letohl(tvb, offset+4+16)); - proto_tree_add_uint(dtpt_queryset_tree, hf_dtpt_queryset_namespace, - tvb, offset+4+20, 4, tvb_get_letohl(tvb, offset+4+20)); - proto_tree_add_uint(dtpt_queryset_tree, hf_dtpt_queryset_provider_id_pointer, - tvb, offset+4+24, 4, tvb_get_letohl(tvb, offset+4+24)); - proto_tree_add_uint(dtpt_queryset_tree, hf_dtpt_queryset_context_pointer, - tvb, offset+4+28, 4, tvb_get_letohl(tvb, offset+4+28)); - proto_tree_add_uint(dtpt_queryset_tree, hf_dtpt_queryset_protocols_number, - tvb, offset+4+32, 4, tvb_get_letohl(tvb, offset+4+32)); - proto_tree_add_uint(dtpt_queryset_tree, hf_dtpt_queryset_protocols_pointer, - tvb, offset+4+36, 4, tvb_get_letohl(tvb, offset+4+36)); - proto_tree_add_uint(dtpt_queryset_tree, hf_dtpt_queryset_query_string_pointer, - tvb, offset+4+40, 4, tvb_get_letohl(tvb, offset+4+40)); - proto_tree_add_uint(dtpt_queryset_tree, hf_dtpt_queryset_cs_addrs_number, - tvb, offset+4+44, 4, tvb_get_letohl(tvb, offset+4+44)); - proto_tree_add_uint(dtpt_queryset_tree, hf_dtpt_queryset_cs_addrs_pointer, - tvb, offset+4+48, 4, tvb_get_letohl(tvb, offset+4+48)); - proto_tree_add_uint(dtpt_queryset_tree, hf_dtpt_queryset_output_flags, - tvb, offset+4+52, 4, tvb_get_letohl(tvb, offset+4+52)); - proto_tree_add_uint(dtpt_queryset_tree, hf_dtpt_queryset_blob_pointer, - tvb, offset+4+56, 4, tvb_get_letohl(tvb, offset+4+56)); - } + proto_tree_add_item(dtpt_queryset_tree, hf_dtpt_queryset_size, + tvb, offset+4+0, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(dtpt_queryset_tree, hf_dtpt_queryset_service_instance_name_pointer, + tvb, offset+4+4, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(dtpt_queryset_tree, hf_dtpt_queryset_service_class_id_pointer, + tvb, offset+4+8, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(dtpt_queryset_tree, hf_dtpt_queryset_version, + tvb, offset+4+12, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(dtpt_queryset_tree, hf_dtpt_queryset_comment_pointer, + tvb, offset+4+16, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(dtpt_queryset_tree, hf_dtpt_queryset_namespace, + tvb, offset+4+20, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(dtpt_queryset_tree, hf_dtpt_queryset_provider_id_pointer, + tvb, offset+4+24, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(dtpt_queryset_tree, hf_dtpt_queryset_context_pointer, + tvb, offset+4+28, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(dtpt_queryset_tree, hf_dtpt_queryset_protocols_number, + tvb, offset+4+32, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(dtpt_queryset_tree, hf_dtpt_queryset_protocols_pointer, + tvb, offset+4+36, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(dtpt_queryset_tree, hf_dtpt_queryset_query_string_pointer, + tvb, offset+4+40, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(dtpt_queryset_tree, hf_dtpt_queryset_cs_addrs_number, + tvb, offset+4+44, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(dtpt_queryset_tree, hf_dtpt_queryset_cs_addrs_pointer, + tvb, offset+4+48, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(dtpt_queryset_tree, hf_dtpt_queryset_output_flags, + tvb, offset+4+52, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(dtpt_queryset_tree, hf_dtpt_queryset_blob_pointer, + tvb, offset+4+56, 4, ENC_LITTLE_ENDIAN); } offset += 4; @@ -520,12 +518,10 @@ dissect_dtpt_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dtpt_protocol_tree = proto_tree_add_subtree_format(dtpt_protocols_tree, tvb, offset+4+4+i*8, 8, ett_dtpt_protocol, NULL, "Protocol[%d]", i+1); - if (dtpt_protocol_tree) { - proto_tree_add_uint(dtpt_protocol_tree, hf_dtpt_protocol_family, - tvb, offset+4+4+i*8, 4, tvb_get_letohl(tvb, offset+4+4+i*8)); - proto_tree_add_uint(dtpt_protocol_tree, hf_dtpt_protocol_protocol, - tvb, offset+4+4+i*8+4, 4, tvb_get_letohl(tvb, offset+4+4+i*8+4)); - } + proto_tree_add_item(dtpt_protocol_tree, hf_dtpt_protocol_family, + tvb, offset+4+4+i*8, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(dtpt_protocol_tree, hf_dtpt_protocol_protocol, + tvb, offset+4+4+i*8+4, 4, ENC_LITTLE_ENDIAN); } } } @@ -566,20 +562,18 @@ dissect_dtpt_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dtpt_addr1_tree = proto_tree_add_subtree_format(dtpt_addrs_tree, tvb, offset, 24, ett_dtpt_cs_addr1, NULL, "Address[%u] Part 1", i+1); - if (dtpt_addr1_tree) { - proto_tree_add_uint(dtpt_addr1_tree, hf_dtpt_cs_addr_local_pointer, - tvb, offset+ 0, 4, tvb_get_letohl(tvb, offset+ 0)); - proto_tree_add_uint(dtpt_addr1_tree, hf_dtpt_cs_addr_local_length, - tvb, offset+ 4, 4, tvb_get_letohl(tvb, offset+ 4)); - proto_tree_add_uint(dtpt_addr1_tree, hf_dtpt_cs_addr_remote_pointer, - tvb, offset+ 8, 4, tvb_get_letohl(tvb, offset+ 8)); - proto_tree_add_uint(dtpt_addr1_tree, hf_dtpt_cs_addr_remote_length, - tvb, offset+12, 4, tvb_get_letohl(tvb, offset+12)); - proto_tree_add_uint(dtpt_addr1_tree, hf_dtpt_cs_addr_socket_type, - tvb, offset+16, 4, tvb_get_letohl(tvb, offset+16)); - proto_tree_add_uint(dtpt_addr1_tree, hf_dtpt_cs_addr_protocol, - tvb, offset+20, 4, tvb_get_letohl(tvb, offset+20)); - } + proto_tree_add_item(dtpt_addr1_tree, hf_dtpt_cs_addr_local_pointer, + tvb, offset+ 0, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(dtpt_addr1_tree, hf_dtpt_cs_addr_local_length, + tvb, offset+ 4, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(dtpt_addr1_tree, hf_dtpt_cs_addr_remote_pointer, + tvb, offset+ 8, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(dtpt_addr1_tree, hf_dtpt_cs_addr_remote_length, + tvb, offset+12, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(dtpt_addr1_tree, hf_dtpt_cs_addr_socket_type, + tvb, offset+16, 4, ENC_LITTLE_ENDIAN); + proto_tree_add_item(dtpt_addr1_tree, hf_dtpt_cs_addr_protocol, + tvb, offset+20, 4, ENC_LITTLE_ENDIAN); dtpt_addr2_tree = proto_tree_add_subtree_format(dtpt_addrs_tree, tvb, offset2, -1, ett_dtpt_cs_addr2, &dtpt_addr2_item, "Address[%u] Part 2", i+1); @@ -616,8 +610,8 @@ dissect_dtpt_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (dtpt_blobraw_tree) { proto_tree_add_uint(dtpt_blobraw_tree, hf_dtpt_blob_size, tvb, offset+4+0, 4, blob_size); - proto_tree_add_uint(dtpt_blobraw_tree, hf_dtpt_blob_data_pointer, - tvb, offset+4+4, 4, tvb_get_letohl(tvb,offset+4+4)); + proto_tree_add_item(dtpt_blobraw_tree, hf_dtpt_blob_data_pointer, + tvb, offset+4+4, 4, ENC_LITTLE_ENDIAN); } } } diff --git a/epan/dissectors/packet-ieee80211-radiotap.c b/epan/dissectors/packet-ieee80211-radiotap.c index a8193e7122..5db0075e90 100644 --- a/epan/dissectors/packet-ieee80211-radiotap.c +++ b/epan/dissectors/packet-ieee80211-radiotap.c @@ -1216,13 +1216,9 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u break; case IEEE80211_RADIOTAP_LOCK_QUALITY: - if (tree) { - proto_tree_add_uint(radiotap_tree, + proto_tree_add_item(radiotap_tree, hf_radiotap_quality, tvb, - offset, 2, - tvb_get_letohs(tvb, - offset)); - } + offset, 2, ENC_LITTLE_ENDIAN); break; case IEEE80211_RADIOTAP_TX_ATTENUATION: @@ -1238,22 +1234,15 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* u break; case IEEE80211_RADIOTAP_DBM_TX_POWER: - if (tree) { - proto_tree_add_int(radiotap_tree, + proto_tree_add_item(radiotap_tree, hf_radiotap_txpower, tvb, - offset, 1, - tvb_get_guint8(tvb, offset)); - } + offset, 1, ENC_NA); break; case IEEE80211_RADIOTAP_ANTENNA: - if (tree) { - proto_tree_add_uint(radiotap_tree, + proto_tree_add_item(radiotap_tree, hf_radiotap_antenna, tvb, - offset, 1, - tvb_get_guint8(tvb, - offset)); - } + offset, 1, ENC_NA); break; case IEEE80211_RADIOTAP_DB_ANTSIGNAL: diff --git a/epan/dissectors/packet-igap.c b/epan/dissectors/packet-igap.c index 22afe9a6ff..adda62fc73 100644 --- a/epan/dissectors/packet-igap.c +++ b/epan/dissectors/packet-igap.c @@ -165,16 +165,14 @@ dissect_igap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d proto_tree_add_item(tree, hf_maddr, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; - proto_tree_add_uint(tree, hf_version, tvb, offset, 1, - tvb_get_guint8(tvb, offset)); + proto_tree_add_item(tree, hf_version, tvb, offset, 1, ENC_NA); offset += 1; subtype = tvb_get_guint8(tvb, offset); proto_tree_add_uint(tree, hf_subtype, tvb, offset, 1, subtype); offset += 2; - proto_tree_add_uint(tree, hf_challengeid, tvb, offset, 1, - tvb_get_guint8(tvb, offset)); + proto_tree_add_item(tree, hf_challengeid, tvb, offset, 1, ENC_NA); offset += 1; asize = tvb_get_guint8(tvb, offset); diff --git a/epan/dissectors/packet-iscsi.c b/epan/dissectors/packet-iscsi.c index 5498a283c7..be86f81119 100644 --- a/epan/dissectors/packet-iscsi.c +++ b/epan/dissectors/packet-iscsi.c @@ -954,7 +954,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off if(iscsi_protocol_version > ISCSI_PROTOCOL_DRAFT09) { proto_tree_add_item(ti, hf_iscsi_TotalAHSLength, tvb, offset + 4, 1, ENC_BIG_ENDIAN); } - proto_tree_add_uint(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, tvb_get_ntoh24(tvb, offset + 5)); + proto_tree_add_item(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, ENC_BIG_ENDIAN); dissect_scsi_lun(ti, tvb, offset + 8); proto_tree_add_item(ti, hf_iscsi_InitiatorTaskTag, tvb, offset + 16, 4, ENC_BIG_ENDIAN); proto_tree_add_item(ti, hf_iscsi_TargetTransferTag, tvb, offset + 20, 4, ENC_BIG_ENDIAN); @@ -967,7 +967,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off if(iscsi_protocol_version > ISCSI_PROTOCOL_DRAFT09) { proto_tree_add_item(ti, hf_iscsi_TotalAHSLength, tvb, offset + 4, 1, ENC_BIG_ENDIAN); } - proto_tree_add_uint(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, tvb_get_ntoh24(tvb, offset + 5)); + proto_tree_add_item(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, ENC_BIG_ENDIAN); dissect_scsi_lun(ti, tvb, offset + 8); proto_tree_add_item(ti, hf_iscsi_InitiatorTaskTag, tvb, offset + 16, 4, ENC_BIG_ENDIAN); proto_tree_add_item(ti, hf_iscsi_TargetTransferTag, tvb, offset + 20, 4, ENC_BIG_ENDIAN); @@ -1002,7 +1002,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off proto_tree_add_item(ti, hf_iscsi_SCSICommand_CRN, tvb, offset + 3, 1, ENC_BIG_ENDIAN); } proto_tree_add_item(ti, hf_iscsi_TotalAHSLength, tvb, offset + 4, 1, ENC_BIG_ENDIAN); - proto_tree_add_uint(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, tvb_get_ntoh24(tvb, offset + 5)); + proto_tree_add_item(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, ENC_BIG_ENDIAN); dissect_scsi_lun(ti, tvb, offset + 8); proto_tree_add_item(ti, hf_iscsi_InitiatorTaskTag, tvb, offset + 16, 4, ENC_BIG_ENDIAN); proto_tree_add_item(ti, hf_iscsi_ExpectedDataTransferLength, tvb, offset + 20, 4, ENC_BIG_ENDIAN); @@ -1074,7 +1074,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off if(iscsi_protocol_version > ISCSI_PROTOCOL_DRAFT09) { proto_tree_add_item(ti, hf_iscsi_TotalAHSLength, tvb, offset + 4, 1, ENC_BIG_ENDIAN); } - proto_tree_add_uint(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, tvb_get_ntoh24(tvb, offset + 5)); + proto_tree_add_item(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, ENC_BIG_ENDIAN); proto_tree_add_item(ti, hf_iscsi_InitiatorTaskTag, tvb, offset + 16, 4, ENC_BIG_ENDIAN); if(iscsi_protocol_version <= ISCSI_PROTOCOL_DRAFT09) { proto_tree_add_item(ti, hf_iscsi_SCSIResponse_ResidualCount, tvb, offset + 20, 4, ENC_BIG_ENDIAN); @@ -1099,7 +1099,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off proto_tree_add_item(ti, hf_iscsi_TaskManagementFunction_Function, tvb, offset + 1, 1, ENC_BIG_ENDIAN); if(iscsi_protocol_version > ISCSI_PROTOCOL_DRAFT09) { proto_tree_add_item(ti, hf_iscsi_TotalAHSLength, tvb, offset + 4, 1, ENC_BIG_ENDIAN); - proto_tree_add_uint(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, tvb_get_ntoh24(tvb, offset + 5)); + proto_tree_add_item(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, ENC_BIG_ENDIAN); } dissect_scsi_lun(ti, tvb, offset + 8); proto_tree_add_item(ti, hf_iscsi_InitiatorTaskTag, tvb, offset + 16, 4, ENC_BIG_ENDIAN); @@ -1113,7 +1113,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off proto_tree_add_item(ti, hf_iscsi_TaskManagementFunction_Response, tvb, offset + 2, 1, ENC_BIG_ENDIAN); if(iscsi_protocol_version <= ISCSI_PROTOCOL_DRAFT09) { proto_tree_add_item(ti, hf_iscsi_TotalAHSLength, tvb, offset + 4, 1, ENC_BIG_ENDIAN); - proto_tree_add_uint(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, tvb_get_ntoh24(tvb, offset + 5)); + proto_tree_add_item(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, ENC_BIG_ENDIAN); } proto_tree_add_item(ti, hf_iscsi_InitiatorTaskTag, tvb, offset + 16, 4, ENC_BIG_ENDIAN); if(iscsi_protocol_version < ISCSI_PROTOCOL_DRAFT12) { @@ -1156,7 +1156,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off if(iscsi_protocol_version > ISCSI_PROTOCOL_DRAFT09) { proto_tree_add_item(ti, hf_iscsi_TotalAHSLength, tvb, offset + 4, 1, ENC_BIG_ENDIAN); } - proto_tree_add_uint(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, tvb_get_ntoh24(tvb, offset + 5)); + proto_tree_add_item(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, ENC_BIG_ENDIAN); if(iscsi_protocol_version == ISCSI_PROTOCOL_DRAFT08) { proto_tree_add_item(ti, hf_iscsi_CID, tvb, offset + 8, 2, ENC_BIG_ENDIAN); proto_tree_add_item(ti, hf_iscsi_ISID8, tvb, offset + 12, 2, ENC_BIG_ENDIAN); @@ -1225,7 +1225,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off if(iscsi_protocol_version > ISCSI_PROTOCOL_DRAFT09) { proto_tree_add_item(ti, hf_iscsi_TotalAHSLength, tvb, offset + 4, 1, ENC_BIG_ENDIAN); } - proto_tree_add_uint(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, tvb_get_ntoh24(tvb, offset + 5)); + proto_tree_add_item(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, ENC_BIG_ENDIAN); if(iscsi_protocol_version == ISCSI_PROTOCOL_DRAFT08) { proto_tree_add_item(ti, hf_iscsi_ISID8, tvb, offset + 12, 2, ENC_BIG_ENDIAN); } @@ -1277,7 +1277,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off if(iscsi_protocol_version > ISCSI_PROTOCOL_DRAFT09) { proto_tree_add_item(ti, hf_iscsi_TotalAHSLength, tvb, offset + 4, 1, ENC_BIG_ENDIAN); } - proto_tree_add_uint(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, tvb_get_ntoh24(tvb, offset + 5)); + proto_tree_add_item(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, ENC_BIG_ENDIAN); if(iscsi_protocol_version > ISCSI_PROTOCOL_DRAFT09) { dissect_scsi_lun(ti, tvb, offset + 8); } @@ -1302,7 +1302,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off if(iscsi_protocol_version > ISCSI_PROTOCOL_DRAFT09) { proto_tree_add_item(ti, hf_iscsi_TotalAHSLength, tvb, offset + 4, 1, ENC_BIG_ENDIAN); } - proto_tree_add_uint(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, tvb_get_ntoh24(tvb, offset + 5)); + proto_tree_add_item(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, ENC_BIG_ENDIAN); if(iscsi_protocol_version > ISCSI_PROTOCOL_DRAFT09) { dissect_scsi_lun(ti, tvb, offset + 8); } @@ -1325,7 +1325,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off if(iscsi_protocol_version > ISCSI_PROTOCOL_DRAFT09) { proto_tree_add_item(ti, hf_iscsi_TotalAHSLength, tvb, offset + 4, 1, ENC_BIG_ENDIAN); } - proto_tree_add_uint(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, tvb_get_ntoh24(tvb, offset + 5)); + proto_tree_add_item(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, ENC_BIG_ENDIAN); dissect_scsi_lun(ti, tvb, offset + 8); proto_tree_add_item(ti, hf_iscsi_InitiatorTaskTag, tvb, offset + 16, 4, ENC_BIG_ENDIAN); proto_tree_add_item(ti, hf_iscsi_TargetTransferTag, tvb, offset + 20, 4, ENC_BIG_ENDIAN); @@ -1383,7 +1383,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off if(iscsi_protocol_version > ISCSI_PROTOCOL_DRAFT09) { proto_tree_add_item(ti, hf_iscsi_TotalAHSLength, tvb, offset + 4, 1, ENC_BIG_ENDIAN); } - proto_tree_add_uint(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, tvb_get_ntoh24(tvb, offset + 5)); + proto_tree_add_item(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, ENC_BIG_ENDIAN); cdata->itlq.data_length=tvb_get_ntoh24(tvb, offset + 5); if(iscsi_protocol_version > ISCSI_PROTOCOL_DRAFT09) { if (A_bit) { @@ -1420,7 +1420,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off } if(iscsi_protocol_version > ISCSI_PROTOCOL_DRAFT09) { proto_tree_add_item(ti, hf_iscsi_TotalAHSLength, tvb, offset + 4, 1, ENC_BIG_ENDIAN); - proto_tree_add_uint(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, tvb_get_ntoh24(tvb, offset + 5)); + proto_tree_add_item(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, ENC_BIG_ENDIAN); } if(iscsi_protocol_version == ISCSI_PROTOCOL_DRAFT08) { proto_tree_add_item(ti, hf_iscsi_CID, tvb, offset + 8, 2, ENC_BIG_ENDIAN); @@ -1441,7 +1441,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off proto_tree_add_item(ti, hf_iscsi_Logout_Response, tvb, offset + 2, 1, ENC_BIG_ENDIAN); if(iscsi_protocol_version > ISCSI_PROTOCOL_DRAFT09) { proto_tree_add_item(ti, hf_iscsi_TotalAHSLength, tvb, offset + 4, 1, ENC_BIG_ENDIAN); - proto_tree_add_uint(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, tvb_get_ntoh24(tvb, offset + 5)); + proto_tree_add_item(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, ENC_BIG_ENDIAN); } proto_tree_add_item(ti, hf_iscsi_InitiatorTaskTag, tvb, offset + 16, 4, ENC_BIG_ENDIAN); proto_tree_add_item(ti, hf_iscsi_StatSN, tvb, offset + 24, 4, ENC_BIG_ENDIAN); @@ -1463,7 +1463,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off } if(iscsi_protocol_version > ISCSI_PROTOCOL_DRAFT09) { proto_tree_add_item(ti, hf_iscsi_TotalAHSLength, tvb, offset + 4, 1, ENC_BIG_ENDIAN); - proto_tree_add_uint(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, tvb_get_ntoh24(tvb, offset + 5)); + proto_tree_add_item(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, ENC_BIG_ENDIAN); dissect_scsi_lun(ti, tvb, offset + 8); } proto_tree_add_item(ti, hf_iscsi_InitiatorTaskTag, tvb, offset + 16, 4, ENC_BIG_ENDIAN); @@ -1484,7 +1484,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off /* R2T */ if(iscsi_protocol_version > ISCSI_PROTOCOL_DRAFT09) { proto_tree_add_item(ti, hf_iscsi_TotalAHSLength, tvb, offset + 4, 1, ENC_BIG_ENDIAN); - proto_tree_add_uint(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, tvb_get_ntoh24(tvb, offset + 5)); + proto_tree_add_item(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, ENC_BIG_ENDIAN); dissect_scsi_lun(ti, tvb, offset + 8); } proto_tree_add_item(ti, hf_iscsi_InitiatorTaskTag, tvb, offset + 16, 4, ENC_BIG_ENDIAN); @@ -1504,7 +1504,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off proto_tree_add_item(ti, hf_iscsi_TotalAHSLength, tvb, offset + 4, 1, ENC_BIG_ENDIAN); } dsl=tvb_get_ntoh24(tvb, offset+5); - proto_tree_add_uint(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, tvb_get_ntoh24(tvb, offset + 5)); + proto_tree_add_item(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, ENC_BIG_ENDIAN); dissect_scsi_lun(ti, tvb, offset + 8); proto_tree_add_item(ti, hf_iscsi_StatSN, tvb, offset + 24, 4, ENC_BIG_ENDIAN); proto_tree_add_item(ti, hf_iscsi_ExpCmdSN, tvb, offset + 28, 4, ENC_BIG_ENDIAN); @@ -1554,7 +1554,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off if(iscsi_protocol_version > ISCSI_PROTOCOL_DRAFT09) { proto_tree_add_item(ti, hf_iscsi_TotalAHSLength, tvb, offset + 4, 1, ENC_BIG_ENDIAN); } - proto_tree_add_uint(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, tvb_get_ntoh24(tvb, offset + 5)); + proto_tree_add_item(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, ENC_BIG_ENDIAN); proto_tree_add_item(ti, hf_iscsi_StatSN, tvb, offset + 24, 4, ENC_BIG_ENDIAN); proto_tree_add_item(ti, hf_iscsi_ExpCmdSN, tvb, offset + 28, 4, ENC_BIG_ENDIAN); proto_tree_add_item(ti, hf_iscsi_MaxCmdSN, tvb, offset + 32, 4, ENC_BIG_ENDIAN); @@ -1577,7 +1577,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off if(iscsi_protocol_version > ISCSI_PROTOCOL_DRAFT09) { proto_tree_add_item(ti, hf_iscsi_TotalAHSLength, tvb, offset + 4, 1, ENC_BIG_ENDIAN); } - proto_tree_add_uint(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, tvb_get_ntoh24(tvb, offset + 5)); + proto_tree_add_item(ti, hf_iscsi_DataSegmentLength, tvb, offset + 5, 3, ENC_BIG_ENDIAN); offset = handleHeaderDigest(iscsi_session, ti, tvb, offset, 48); offset = handleDataSegment(iscsi_session, ti, tvb, offset, data_segment_len, end_offset, hf_iscsi_vendor_specific_data); } diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c index f20301d4ba..6756af34d6 100644 --- a/epan/dissectors/packet-ldap.c +++ b/epan/dissectors/packet-ldap.c @@ -4404,7 +4404,7 @@ static int dissect_NetLogon_PDU(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre proto_tree_add_string(tree, hf_mscldap_hostname, tvb, old_offset, offset-old_offset, str); /* DC IP Address */ - proto_tree_add_ipv4(tree, hf_mscldap_netlogon_ipaddress, tvb, offset, 4, tvb_get_ntohl(tvb,offset)); + proto_tree_add_item(tree, hf_mscldap_netlogon_ipaddress, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; /* Flags */ @@ -4488,7 +4488,7 @@ static int dissect_NetLogon_PDU(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre /* add IP address and desect the sockaddr_in structure */ old_offset = offset + 4; - item = proto_tree_add_ipv4(tree, hf_mscldap_netlogon_ipaddress, tvb, old_offset, 4, tvb_get_ipv4(tvb,old_offset)); + item = proto_tree_add_item(tree, hf_mscldap_netlogon_ipaddress, tvb, old_offset, 4, ENC_BIG_ENDIAN); if (tree){ proto_tree *subtree; @@ -4504,7 +4504,7 @@ static int dissect_NetLogon_PDU(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre offset +=2; /* get IP address */ - proto_tree_add_ipv4(subtree, hf_mscldap_netlogon_ipaddress_ipv4, tvb, offset, 4, tvb_get_ipv4(tvb,offset)); + proto_tree_add_item(subtree, hf_mscldap_netlogon_ipaddress_ipv4, tvb, offset, 4, ENC_BIG_ENDIAN); offset +=4; /* skip the 8 bytes of zeros in the sockaddr structure */ diff --git a/epan/dissectors/packet-lmi.c b/epan/dissectors/packet-lmi.c index 9d5cf26798..64f343589d 100644 --- a/epan/dissectors/packet-lmi.c +++ b/epan/dissectors/packet-lmi.c @@ -109,27 +109,27 @@ static const value_string pvc_status_act_str[] = { static void dissect_lmi_report_type(tvbuff_t *tvb, int offset, proto_tree *tree) { - proto_tree_add_uint(tree, hf_lmi_rcd_type, tvb, offset, 1, tvb_get_guint8( tvb, offset)); + proto_tree_add_item(tree, hf_lmi_rcd_type, tvb, offset, 1, ENC_NA); } static void dissect_lmi_link_int(tvbuff_t *tvb, int offset, proto_tree *tree) { - proto_tree_add_uint(tree, hf_lmi_send_seq, tvb, offset, 1, tvb_get_guint8( tvb, offset)); + proto_tree_add_item(tree, hf_lmi_send_seq, tvb, offset, 1, ENC_NA); ++offset; - proto_tree_add_uint(tree, hf_lmi_recv_seq, tvb, offset, 1, tvb_get_guint8( tvb, offset)); + proto_tree_add_item(tree, hf_lmi_recv_seq, tvb, offset, 1, ENC_NA); } static void dissect_lmi_pvc_status(tvbuff_t *tvb, int offset, proto_tree *tree) { - proto_tree_add_uint(tree, hf_lmi_dlci_high, tvb, offset, 1, tvb_get_guint8( tvb, offset)); + proto_tree_add_item(tree, hf_lmi_dlci_high, tvb, offset, 1, ENC_NA); ++offset; - proto_tree_add_uint(tree, hf_lmi_dlci_low, tvb, offset, 1, tvb_get_guint8( tvb, offset)); + proto_tree_add_item(tree, hf_lmi_dlci_low, tvb, offset, 1, ENC_NA); ++offset; - proto_tree_add_uint(tree, hf_lmi_new, tvb, offset, 1, tvb_get_guint8( tvb, offset)); - proto_tree_add_uint(tree, hf_lmi_act, tvb, offset, 1, tvb_get_guint8( tvb, offset)); + proto_tree_add_item(tree, hf_lmi_new, tvb, offset, 1, ENC_NA); + proto_tree_add_item(tree, hf_lmi_act, tvb, offset, 1, ENC_NA); } static int diff --git a/epan/dissectors/packet-lmp.c b/epan/dissectors/packet-lmp.c index 1d3aee5b4d..41ec51fda3 100644 --- a/epan/dissectors/packet-lmp.c +++ b/epan/dissectors/packet-lmp.c @@ -826,15 +826,15 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) case 1: l = LMPF_VAL_LOCAL_CCID; proto_item_append_text(ti, ": %d", tvb_get_ntohl(tvb, offset2)); - proto_tree_add_uint(lmp_object_tree, hf_lmp_filter[l], tvb, - offset2, 4, tvb_get_ntohl(tvb, offset2)); + proto_tree_add_item(lmp_object_tree, hf_lmp_filter[l], tvb, + offset2, 4, ENC_BIG_ENDIAN); break; case 2: l = LMPF_VAL_REMOTE_CCID; proto_item_append_text(ti, ": %d", tvb_get_ntohl(tvb, offset2)); - proto_tree_add_uint(lmp_object_tree, hf_lmp_filter[l], tvb, - offset2, 4, tvb_get_ntohl(tvb, offset2)); + proto_tree_add_item(lmp_object_tree, hf_lmp_filter[l], tvb, + offset2, 4, ENC_BIG_ENDIAN); break; default: proto_tree_add_item(lmp_object_tree, hf_lmp_data, tvb, offset2, mylen, ENC_NA); @@ -948,15 +948,15 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) l = LMPF_VAL_MESSAGE_ID; proto_item_append_text(ti, ": %d", tvb_get_ntohl(tvb, offset2)); - proto_tree_add_uint(lmp_object_tree, hf_lmp_filter[l], tvb, - offset2, 4, tvb_get_ntohl(tvb, offset2)); + proto_tree_add_item(lmp_object_tree, hf_lmp_filter[l], tvb, + offset2, 4, ENC_BIG_ENDIAN); break; case 2: l = LMPF_VAL_MESSAGE_ID_ACK; proto_item_append_text(ti, ": %d", tvb_get_ntohl(tvb, offset2)); - proto_tree_add_uint(lmp_object_tree, hf_lmp_filter[l], tvb, - offset2, 4, tvb_get_ntohl(tvb, offset2)); + proto_tree_add_item(lmp_object_tree, hf_lmp_filter[l], tvb, + offset2, 4, ENC_BIG_ENDIAN); break; default: @@ -973,13 +973,12 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) proto_item_append_text(ti, ": HelloInterval: %d, HelloDeadInterval: %d", tvb_get_ntohs(tvb, offset2), tvb_get_ntohs(tvb, offset2+2)); - proto_tree_add_uint(lmp_object_tree, + proto_tree_add_item(lmp_object_tree, hf_lmp_filter[LMPF_VAL_CONFIG_HELLO], - tvb, offset2, 2, tvb_get_ntohs(tvb, offset2)); - proto_tree_add_uint(lmp_object_tree, + tvb, offset2, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(lmp_object_tree, hf_lmp_filter[LMPF_VAL_CONFIG_HELLO_DEAD], - tvb, offset2+2, 2, - tvb_get_ntohs(tvb, offset2+2)); + tvb, offset2+2, 2, ENC_BIG_ENDIAN); break; default: @@ -996,14 +995,12 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) proto_item_append_text(ti, ": TxSeq %d, RxSeq: %d", tvb_get_ntohl(tvb, offset2), tvb_get_ntohl(tvb, offset2+4)); - proto_tree_add_uint(lmp_object_tree, + proto_tree_add_item(lmp_object_tree, hf_lmp_filter[LMPF_VAL_HELLO_TXSEQ], - tvb, offset2, 4, - tvb_get_ntohl(tvb, offset2)); - proto_tree_add_uint(lmp_object_tree, + tvb, offset2, 4, ENC_BIG_ENDIAN); + proto_tree_add_item(lmp_object_tree, hf_lmp_filter[LMPF_VAL_HELLO_RXSEQ], - tvb, offset2+4, 4, - tvb_get_ntohl(tvb, offset2+4)); + tvb, offset2+4, 4, ENC_BIG_ENDIAN); break; default: @@ -1071,10 +1068,10 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) case 1: proto_item_append_text(ti, ": %d", tvb_get_ntohl(tvb, offset2)); - proto_tree_add_uint(lmp_object_tree, + proto_tree_add_item(lmp_object_tree, hf_lmp_filter[LMPF_VAL_VERIFY_ID], tvb, offset2, 4, - tvb_get_ntohl(tvb, offset2)); + ENC_BIG_ENDIAN); break; default: proto_tree_add_item(lmp_object_tree, hf_lmp_data, tvb, offset2, mylen, ENC_NA); @@ -1620,15 +1617,13 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) tvb_get_ntohs(tvb, offset2+4), tvb_get_ntohs(tvb, offset2+6)); - proto_tree_add_uint(lmp_object_tree, + proto_tree_add_item(lmp_object_tree, hf_lmp_filter[LMPF_VAL_SERVICE_CONFIG_CPSA_MIN_NCC], - tvb, offset2+4, 2, - tvb_get_ntohs(tvb, offset2+4)); + tvb, offset2+4, 2, ENC_BIG_ENDIAN); - proto_tree_add_uint(lmp_object_tree, + proto_tree_add_item(lmp_object_tree, hf_lmp_filter[LMPF_VAL_SERVICE_CONFIG_CPSA_MAX_NCC], - tvb, offset2+6, 2, - tvb_get_ntohs(tvb, offset2+6)); + tvb, offset2+6, 2, ENC_BIG_ENDIAN); /* Min and Max NVC */ proto_item_append_text(ti, ": Minimum NVC: %d, Maximum NVC: %d", diff --git a/epan/dissectors/packet-msnip.c b/epan/dissectors/packet-msnip.c index 21553942fd..3dcd8b5285 100644 --- a/epan/dissectors/packet-msnip.c +++ b/epan/dissectors/packet-msnip.c @@ -142,11 +142,11 @@ dissect_msnip_is(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset += 2; /* 16 bit holdtime */ - proto_tree_add_uint(parent_tree, hf_holdtime16, tvb, offset, 2, tvb_get_ntohs(tvb, offset)); + proto_tree_add_item(parent_tree, hf_holdtime16, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; /* Generation ID */ - proto_tree_add_uint(parent_tree, hf_genid, tvb, offset, 2, tvb_get_ntohs(tvb, offset)); + proto_tree_add_item(parent_tree, hf_genid, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; return offset; diff --git a/epan/dissectors/packet-netflow.c b/epan/dissectors/packet-netflow.c index b6c8f9221f..c40c9334fb 100644 --- a/epan/dissectors/packet-netflow.c +++ b/epan/dissectors/packet-netflow.c @@ -6902,8 +6902,8 @@ dissect_v9_v10_pdu_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pdutree, tvb, offset, length, ENC_BIG_ENDIAN); break; case ((VENDOR_NETSCALER << 16) | 203): - ti = proto_tree_add_ipv4(pdutree, hf_pie_netscaler_icaclientip, - tvb, offset, 4, tvb_get_ipv4(tvb, offset)); + ti = proto_tree_add_item(pdutree, hf_pie_netscaler_icaclientip, + tvb, offset, 4, ENC_BIG_ENDIAN); break; case ((VENDOR_NETSCALER << 16) | 204): ti = proto_tree_add_item(pdutree, hf_pie_netscaler_icaclienthostname, @@ -7192,16 +7192,16 @@ dissect_v9_v10_pdu_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pdutree, tvb, offset, length, ENC_UTF_8|ENC_NA); break; case ((VENDOR_BARRACUDA << 16) | 8): - ti = proto_tree_add_ipv4(pdutree, hf_pie_barracuda_bindipv4address, - tvb, offset, 4, tvb_get_ipv4(tvb, offset)); + ti = proto_tree_add_item(pdutree, hf_pie_barracuda_bindipv4address, + tvb, offset, 4, ENC_BIG_ENDIAN); break; case ((VENDOR_BARRACUDA << 16) | 9): ti = proto_tree_add_item(pdutree, hf_pie_barracuda_bindtransportport, tvb, offset, length, ENC_BIG_ENDIAN); break; case ((VENDOR_BARRACUDA << 16) | 10): - ti = proto_tree_add_ipv4(pdutree, hf_pie_barracuda_connipv4address, - tvb, offset, 4, tvb_get_ipv4(tvb, offset)); + ti = proto_tree_add_item(pdutree, hf_pie_barracuda_connipv4address, + tvb, offset, 4, ENC_BIG_ENDIAN); break; case ((VENDOR_BARRACUDA << 16) | 11): ti = proto_tree_add_item(pdutree, hf_pie_barracuda_conntransportport, diff --git a/epan/dissectors/packet-noe.c b/epan/dissectors/packet-noe.c index c4e71d8d72..124ef54067 100644 --- a/epan/dissectors/packet-noe.c +++ b/epan/dissectors/packet-noe.c @@ -983,15 +983,13 @@ static void decode_tlv(proto_tree *tree, { property_length = tvb_get_ntohs(tvb, offset); property_length &= 0x7fff; - proto_tree_add_uint(property_tree, hf_noe_psize, tvb, offset, 2, - tvb_get_guint8(tvb, offset) * 256 + tvb_get_guint8(tvb, offset+1)); + proto_tree_add_item(property_tree, hf_noe_psize, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; length -= 2; } else { - proto_tree_add_uint(property_tree, hf_noe_psize, tvb, offset, 1, - tvb_get_guint8(tvb, offset)); + proto_tree_add_item(property_tree, hf_noe_psize, tvb, offset, 1, ENC_NA); offset += 1; length -= 1; } diff --git a/epan/dissectors/packet-pktc.c b/epan/dissectors/packet-pktc.c index e98f771adc..7eac96469d 100644 --- a/epan/dissectors/packet-pktc.c +++ b/epan/dissectors/packet-pktc.c @@ -495,11 +495,11 @@ dissect_pktc_mtafqdn_krbsafeuserdata(packet_info *pinfo, tvbuff_t *tvb, proto_tr val_to_str(msgtype, pktc_mtafqdn_msgtype_vals, "MsgType %u")); /* enterprise */ - proto_tree_add_uint(tree, hf_pktc_mtafqdn_enterprise, tvb, offset, 4, tvb_get_ntohl(tvb, offset)); + proto_tree_add_item(tree, hf_pktc_mtafqdn_enterprise, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4; /* protocol version */ - proto_tree_add_uint(tree, hf_pktc_mtafqdn_version, tvb, offset, 1, tvb_get_guint8(tvb, offset)); + proto_tree_add_item(tree, hf_pktc_mtafqdn_version, tvb, offset, 1, ENC_NA); offset+=1; switch(msgtype) { diff --git a/epan/dissectors/packet-q2931.c b/epan/dissectors/packet-q2931.c index aa289e888b..3cad03053d 100644 --- a/epan/dissectors/packet-q2931.c +++ b/epan/dissectors/packet-q2931.c @@ -1870,9 +1870,9 @@ static int dissect_q2931(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { int offset = 0; - proto_tree *q2931_tree = NULL; + proto_tree *q2931_tree; proto_item *ti; - guint8 call_ref_len; + guint32 call_ref_len; guint8 call_ref[16]; guint8 message_type; guint8 message_type_ext; @@ -1896,17 +1896,13 @@ dissect_q2931(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U col_set_str(pinfo->cinfo, COL_PROTOCOL, "Q.2931"); - if (tree) { - ti = proto_tree_add_item(tree, proto_q2931, tvb, offset, -1, - ENC_NA); - q2931_tree = proto_item_add_subtree(ti, ett_q2931); + ti = proto_tree_add_item(tree, proto_q2931, tvb, offset, -1, ENC_NA); + q2931_tree = proto_item_add_subtree(ti, ett_q2931); - proto_tree_add_uint(q2931_tree, hf_q2931_discriminator, tvb, offset, 1, tvb_get_guint8(tvb, offset)); - } + proto_tree_add_item(q2931_tree, hf_q2931_discriminator, tvb, offset, 1, ENC_NA); offset += 1; - call_ref_len = tvb_get_guint8(tvb, offset) & 0xF; /* XXX - do as a bit field? */ - if (q2931_tree != NULL) - proto_tree_add_uint(q2931_tree, hf_q2931_call_ref_len, tvb, offset, 1, call_ref_len); + + proto_tree_add_item_ret_uint(q2931_tree, hf_q2931_call_ref_len, tvb, offset, 1, ENC_NA, &call_ref_len); offset += 1; if (call_ref_len != 0) { tvb_memcpy(tvb, call_ref, offset, call_ref_len); @@ -1992,7 +1988,7 @@ proto_register_q2931(void) { &hf_q2931_call_ref_len, { "Call reference value length", "q2931.call_ref_len", - FT_UINT8, BASE_DEC, NULL, 0x0, + FT_UINT8, BASE_DEC, NULL, 0x0F, NULL, HFILL } }, diff --git a/epan/dissectors/packet-rfid-felica.c b/epan/dissectors/packet-rfid-felica.c index 5e72a7b683..cdbc550e47 100644 --- a/epan/dissectors/packet-rfid-felica.c +++ b/epan/dissectors/packet-rfid-felica.c @@ -296,8 +296,8 @@ static int dissect_felica(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v /* Iterate through the block list, and update the tree */ for (rwe_pos = 0; rwe_pos < tvb_get_guint8(tvb, 12); rwe_pos++) { - proto_tree_add_uint(felica_tree, hf_felica_block_nbr, tvb, - 13 + 2 * rwe_pos, 2, tvb_get_guint8(tvb, 14 + 2 * rwe_pos)); + proto_tree_add_item(felica_tree, hf_felica_block_nbr, tvb, + 13 + 2 * rwe_pos, 2, ENC_NA); } } break; diff --git a/epan/dissectors/packet-rip.c b/epan/dissectors/packet-rip.c index f52a74852b..28c4d5aea0 100644 --- a/epan/dissectors/packet-rip.c +++ b/epan/dissectors/packet-rip.c @@ -201,8 +201,8 @@ dissect_rip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) proto_tree_add_uint(rip_tree, &hfi_rip_command, tvb, 0, 1, command); proto_tree_add_uint(rip_tree, &hfi_rip_version, tvb, 1, 1, version); if (version == RIPv2 && pref_display_routing_domain == TRUE) - proto_tree_add_uint(rip_tree, &hfi_rip_routing_domain, tvb, 2, 2, - tvb_get_ntohs(tvb, 2)); + proto_tree_add_item(rip_tree, &hfi_rip_routing_domain, tvb, 2, 2, + ENC_BIG_ENDIAN); /* skip header */ offset = RIP_HEADER_LENGTH; diff --git a/epan/dissectors/packet-rmi.c b/epan/dissectors/packet-rmi.c index 7f6f745170..6ad2266151 100644 --- a/epan/dissectors/packet-rmi.c +++ b/epan/dissectors/packet-rmi.c @@ -170,8 +170,8 @@ dissect_rmi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) switch(rmitype) { case RMI_OUTPUTSTREAM: /* XXX - uint, or string? */ - proto_tree_add_uint(rmi_tree, hf_rmi_magic, - tvb, offset, 4, tvb_get_ntohl(tvb,0)); + proto_tree_add_item(rmi_tree, hf_rmi_magic, + tvb, offset, 4, ENC_BIG_ENDIAN); proto_tree_add_item(rmi_tree, hf_rmi_version, tvb, offset + 4, 2, ENC_BIG_ENDIAN); proto_tree_add_item(rmi_tree, hf_rmi_protocol, diff --git a/epan/dissectors/packet-rtp.c b/epan/dissectors/packet-rtp.c index 7b5c6eaf7d..bfde45d2f0 100644 --- a/epan/dissectors/packet-rtp.c +++ b/epan/dissectors/packet-rtp.c @@ -2306,7 +2306,7 @@ dissect_rtp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ hdrext_offset = offset; for ( i = 0; i < hdr_extension_len; i++ ) { - proto_tree_add_uint( rtp_hext_tree, hf_rtp_hdr_ext, tvb, hdrext_offset, 4, tvb_get_ntohl( tvb, hdrext_offset ) ); + proto_tree_add_item( rtp_hext_tree, hf_rtp_hdr_ext, tvb, hdrext_offset, 4, ENC_BIG_ENDIAN ); hdrext_offset += 4; } } diff --git a/epan/dissectors/packet-srvloc.c b/epan/dissectors/packet-srvloc.c index db22a2c64e..963fe976e2 100644 --- a/epan/dissectors/packet-srvloc.c +++ b/epan/dissectors/packet-srvloc.c @@ -1046,15 +1046,12 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ NULL }; - length = tvb_get_ntoh24(tvb, offset + 2); - proto_tree_add_uint(srvloc_tree, hf_srvloc_pktlen, tvb, offset + 2, 3, length); + proto_tree_add_item_ret_uint(srvloc_tree, hf_srvloc_pktlen, tvb, offset + 2, 3, ENC_BIG_ENDIAN, &length); proto_tree_add_bitmask(srvloc_tree, tvb, offset + 5, hf_srvloc_flags_v2, ett_srvloc_flags, v2_flags, ENC_BIG_ENDIAN); - next_ext_off = tvb_get_ntoh24(tvb, offset + 7); - proto_tree_add_uint(srvloc_tree, hf_srvloc_nextextoff, tvb, offset + 7, 3, - next_ext_off); - proto_tree_add_uint(srvloc_tree, hf_srvloc_xid, tvb, offset + 10, 2, - tvb_get_ntohs(tvb, offset + 10)); + proto_tree_add_item_ret_uint(srvloc_tree, hf_srvloc_nextextoff, tvb, offset + 7, 3, + ENC_BIG_ENDIAN, &next_ext_off); + proto_tree_add_item(srvloc_tree, hf_srvloc_xid, tvb, offset + 10, 2, ENC_BIG_ENDIAN); col_append_fstr(pinfo->cinfo, COL_INFO, ", V2 XID - %u", tvb_get_ntohs(tvb, offset + 10)); lang_tag_len = tvb_get_ntohs(tvb, offset + 12); proto_tree_add_uint(srvloc_tree, hf_srvloc_langtaglen, tvb, offset + 12, 2, lang_tag_len); diff --git a/epan/dissectors/packet-trmac.c b/epan/dissectors/packet-trmac.c index 6f2653c504..c225578edf 100644 --- a/epan/dissectors/packet-trmac.c +++ b/epan/dissectors/packet-trmac.c @@ -476,43 +476,43 @@ sv_text(tvbuff_t *tvb, int svoff, packet_info *pinfo, proto_tree *tree) static int dissect_trmac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - proto_tree *mac_tree = NULL; + proto_tree *mac_tree; proto_item *ti; - int mv_length, sv_offset, sv_additional; - guint8 mv_val; + int sv_additional; + guint32 mv_val, mv_length, sv_offset; + + if (tvb_captured_length(tvb) < 3) + return 0; col_set_str(pinfo->cinfo, COL_PROTOCOL, "TR MAC"); col_clear(pinfo->cinfo, COL_INFO); - mv_val = tvb_get_guint8(tvb, 3); + ti = proto_tree_add_item(tree, proto_trmac, tvb, 0, -1, ENC_NA); + mac_tree = proto_item_add_subtree(ti, ett_tr_mac); + + proto_tree_add_item_ret_uint(mac_tree, hf_trmac_mv, tvb, 3, 1, ENC_NA, &mv_val); + proto_tree_add_item_ret_uint(mac_tree, hf_trmac_length, tvb, 0, 2, ENC_BIG_ENDIAN, &mv_length); + proto_item_set_len(ti, mv_length); + proto_tree_add_item(mac_tree, hf_trmac_srcclass, tvb, 2, 1, ENC_NA); + proto_tree_add_item(mac_tree, hf_trmac_dstclass, tvb, 2, 1, ENC_NA); /* Interpret the major vector */ col_add_str(pinfo->cinfo, COL_INFO, val_to_str_ext(mv_val, &major_vector_vs_ext, "Unknown Major Vector: %u")); - if (tree) { - mv_length = tvb_get_ntohs(tvb, 0); - ti = proto_tree_add_item(tree, proto_trmac, tvb, 0, mv_length, ENC_NA); - mac_tree = proto_item_add_subtree(ti, ett_tr_mac); + /* interpret the subvectors */ + sv_offset = 4; + while (sv_offset < mv_length) { + sv_additional = sv_text(tvb, sv_offset, pinfo, mac_tree); - proto_tree_add_uint(mac_tree, hf_trmac_mv, tvb, 3, 1, mv_val); - proto_tree_add_uint(mac_tree, hf_trmac_length, tvb, 0, 2, mv_length); - proto_tree_add_uint(mac_tree, hf_trmac_srcclass, tvb, 2, 1, tvb_get_guint8(tvb, 2) & 0x0f); - proto_tree_add_uint(mac_tree, hf_trmac_dstclass, tvb, 2, 1, tvb_get_guint8(tvb, 2) >> 4 ); - - /* interpret the subvectors */ - sv_offset = 4; - while (sv_offset < mv_length) { - sv_additional = sv_text(tvb, sv_offset, pinfo, mac_tree); - - /* if this is a bad packet, we could get a 0-length added here, - * looping forever */ - if (sv_additional > 0) - sv_offset += sv_additional; - else - break; - } + /* if this is a bad packet, we could get a 0-length added here, + * looping forever */ + if (sv_additional > 0) + sv_offset += sv_additional; + else + break; } + return tvb_captured_length(tvb); } @@ -529,11 +529,11 @@ proto_register_trmac(void) NULL, HFILL }}, { &hf_trmac_srcclass, - { "Source Class", "trmac.srcclass", FT_UINT8, BASE_HEX, VALS(classes_vs), 0x0, + { "Source Class", "trmac.srcclass", FT_UINT8, BASE_HEX, VALS(classes_vs), 0x0F, NULL, HFILL }}, { &hf_trmac_dstclass, - { "Destination Class", "trmac.dstclass", FT_UINT8, BASE_HEX, VALS(classes_vs), 0x0, + { "Destination Class", "trmac.dstclass", FT_UINT8, BASE_HEX, VALS(classes_vs), 0xF0, NULL, HFILL }}, { &hf_trmac_sv_len, diff --git a/epan/dissectors/packet-wcp.c b/epan/dissectors/packet-wcp.c index 45335fa9a8..1548cde061 100644 --- a/epan/dissectors/packet-wcp.c +++ b/epan/dissectors/packet-wcp.c @@ -337,8 +337,7 @@ static int dissect_wcp( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi proto_tree_add_item(wcp_tree, hf_wcp_cmd, tvb, 0, 1, ENC_NA); if ( cmd == 0xf){ - proto_tree_add_uint(wcp_tree, hf_wcp_ext_cmd, tvb, 1, 1, - tvb_get_guint8( tvb, 0)); + proto_tree_add_item(wcp_tree, hf_wcp_ext_cmd, tvb, 1, 1, ENC_NA); switch (ext_cmd){ case CONNECT_REQ: dissect_wcp_con_req( tvb, 1, wcp_tree); diff --git a/epan/dissectors/packet-x25.c b/epan/dissectors/packet-x25.c index 4baac06e74..b30ac71670 100644 --- a/epan/dissectors/packet-x25.c +++ b/epan/dissectors/packet-x25.c @@ -1831,12 +1831,10 @@ dissect_x25_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, localoffset, 1, pkt_type); proto_tree_add_uint(x25_tree, hf_x25_type_data, tvb, localoffset, 1, pkt_type); - proto_tree_add_uint(x25_tree, hf_x25_p_s_mod128, tvb, - localoffset+1, 1, - tvb_get_guint8(tvb, localoffset+1)); - proto_tree_add_boolean(x25_tree, hf_x25_mbit_mod128, tvb, - localoffset+1, 1, - tvb_get_guint8(tvb, localoffset+1)); + proto_tree_add_item(x25_tree, hf_x25_p_s_mod128, tvb, + localoffset+1, 1, ENC_NA); + proto_tree_add_item(x25_tree, hf_x25_mbit_mod128, tvb, + localoffset+1, 1, ENC_NA); } } if (modulo == 8) {