diff --git a/epan/dissectors/packet-acn.c b/epan/dissectors/packet-acn.c index 419068cd78..8904e45e76 100644 --- a/epan/dissectors/packet-acn.c +++ b/epan/dissectors/packet-acn.c @@ -4728,10 +4728,7 @@ static guint32 dissect_acn_blob(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *pdu_tree, int blob_offset, int end_offset) { /* Declarations for blobs*/ - guint8 version; - guint8 range; guint8 blob_type; - guint8 range_number; guint16 field_number = 1; proto_item *bi; proto_tree *blob_tree = NULL; @@ -4745,19 +4742,16 @@ dissect_acn_blob(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *pdu_tree, in blob_offset += 4; /* Add Blob version item to tree */ - version = tvb_get_guint8(tvb, blob_offset); - proto_tree_add_item(blob_tree, hf_acn_blob_version, tvb, blob_offset, 1, version); + proto_tree_add_item(blob_tree, hf_acn_blob_version, tvb, blob_offset, 1, ENC_BIG_ENDIAN); blob_offset += 1; /* Add Blob Start and End Range Info */ - range = tvb_get_guint8(tvb, blob_offset); - proto_tree_add_item(blob_tree, hf_acn_blob_range_type, tvb, blob_offset, 1, range); + proto_tree_add_item(blob_tree, hf_acn_blob_range_type, tvb, blob_offset, 1, ENC_BIG_ENDIAN); /* range_type = val_to_str(range, acn_blob_range_type_vals, "not valid (%d)"); */ blob_offset += 1; /* Add Blob Range Number */ - range_number = tvb_get_guint8(tvb, blob_offset); - proto_tree_add_item(blob_tree, hf_acn_blob_range_number, tvb, blob_offset, 1, range_number); + proto_tree_add_item(blob_tree, hf_acn_blob_range_number, tvb, blob_offset, 1, ENC_BIG_ENDIAN); blob_offset += 1; /* Add Blob Meta-Type */ @@ -4767,7 +4761,7 @@ dissect_acn_blob(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *pdu_tree, in blob_type = get_blob_type_from_fields(tvb, blob_offset + 1, end_offset); } - proto_tree_add_item(blob_tree, hf_acn_blob_type, tvb, blob_offset, 1, blob_type); + proto_tree_add_uint(blob_tree, hf_acn_blob_type, tvb, blob_offset, 1, blob_type); blob_name = val_to_str(blob_type, acn_blob_type_vals, "not valid (%d)"); proto_item_append_text(bi, ": %s", blob_name); diff --git a/epan/dissectors/packet-aim.c b/epan/dissectors/packet-aim.c index e976d7fea5..25768968dc 100644 --- a/epan/dissectors/packet-aim.c +++ b/epan/dissectors/packet-aim.c @@ -2292,8 +2292,7 @@ static const aim_tlv aim_motd_tlvs[] = { static int dissect_aim_generic_motd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *gen_tree) { int offset = 0; - proto_tree_add_item(gen_tree, hf_generic_motd_motdtype, tvb, offset, - 2, tvb_get_ntohs(tvb, offset)); + proto_tree_add_item(gen_tree, hf_generic_motd_motdtype, tvb, offset, 2, ENC_BIG_ENDIAN); offset+=2; return dissect_aim_tlv_sequence(tvb, pinfo, offset, gen_tree, aim_motd_tlvs); } diff --git a/epan/dissectors/packet-amp.c b/epan/dissectors/packet-amp.c index 7fa68a2177..7fcab0985d 100644 --- a/epan/dissectors/packet-amp.c +++ b/epan/dissectors/packet-amp.c @@ -600,7 +600,7 @@ dissect_amp_as_subtree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int //amp_control_sub_tree = proto_item_add_subtree(amp_message_tree, ett_amp); amp_control_tree = proto_tree_add_subtree(amp_message_tree, tvb, offset-1, -1, ett_amp_message, &_message, "Perform-Control"); - proto_tree_add_item(amp_control_tree, hf_amp_cbor_header, tvb, offset, 1, 0x00); + proto_tree_add_item(amp_control_tree, hf_amp_cbor_header, tvb, offset, 1, ENC_BIG_ENDIAN); break; case 0x03: // Table Set @@ -608,7 +608,7 @@ dissect_amp_as_subtree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int //amp_table_sub_tree = proto_item_add_subtree(amp_items_tree, ett_amp); amp_table_tree = proto_tree_add_subtree(amp_items_tree, tvb, offset, -1, ett_amp_message, &_message, "AMP Message: Table-Set"); - proto_tree_add_item(amp_table_tree, hf_amp_cbor_header, tvb, offset, 1, 0x00); + proto_tree_add_item(amp_table_tree, hf_amp_cbor_header, tvb, offset, 1, ENC_BIG_ENDIAN); break; default: break; diff --git a/epan/dissectors/packet-isi.c b/epan/dissectors/packet-isi.c index 00d0efd688..3f8298ef53 100644 --- a/epan/dissectors/packet-isi.c +++ b/epan/dissectors/packet-isi.c @@ -907,7 +907,7 @@ static int dissect_isi_sim(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitre next_tvb = tvb_new_subset_remaining(tvb, 0); proto_tree_add_item(tree, hf_isi_sim_imsi_byte_1, next_tvb, 4, 1, ENC_LITTLE_ENDIAN); dissect_e212_mcc_mnc(next_tvb, pinfo, tree, 4, FALSE ); - proto_tree_add_item(tree, hf_E212_msin, tvb, 2, 7, FALSE); + proto_tree_add_item(tree, hf_E212_msin, tvb, 2, 7, ENC_BIG_ENDIAN); */ @@ -1100,7 +1100,7 @@ static int dissect_isi_gss(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitre break; case 0x01: /* GSS_CS_SERVICE_RESP */ - /* proto_tree_add_item(tree, hf_isi_gss_service_type, tvb, 1, 1, FALSE); */ + /* proto_tree_add_item(tree, hf_isi_gss_service_type, tvb, 1, 1, ENC_NA); */ code = tvb_get_guint8(tvb, 1); switch(code) { /* case 0x9C: @@ -1359,7 +1359,7 @@ static int dissect_isi_ss(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree break; case 0x02: /* SS_SERVICE_FAILED_RESP */ - /* proto_tree_add_item(tree, hf_isi_ss_service_type, tvb, 1, 1, FALSE); */ + /* proto_tree_add_item(tree, hf_isi_ss_service_type, tvb, 1, 1, ENC_NA); */ code = tvb_get_guint8(tvb, 1); switch(code) { /* case 0x2F: @@ -1389,7 +1389,7 @@ static int dissect_isi_ss(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree break; case 0x05: /* SS_GSM_USSD_SEND_RESP */ - /* proto_tree_add_item(tree, hf_isi_ss_service_type, tvb, 1, 1, FALSE); */ + /* proto_tree_add_item(tree, hf_isi_ss_service_type, tvb, 1, 1, ENC_NA); */ code = tvb_get_guint8(tvb, 1); switch(code) { /* case 0x2F: @@ -1670,7 +1670,7 @@ static int dissect_isi_sms(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitre break; case 0x07: /* SMS_PP_ROUTING_RESP */ - /* proto_tree_add_item(tree, hf_isi_sms_service_type, tvb, 1, 1, FALSE); */ + /* proto_tree_add_item(tree, hf_isi_sms_service_type, tvb, 1, 1, ENC_NA); */ code = tvb_get_guint8(tvb, 1); switch(code) { /* case 0x2F: @@ -1686,10 +1686,10 @@ static int dissect_isi_sms(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitre proto_tree_add_item(tree, hf_isi_sms_routing_command, tvb, 1, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_isi_sms_routing_mode, tvb, 2, 1, ENC_BIG_ENDIAN); #if 0 - proto_tree_add_item(tree, hf_isi_sms_cb_subject_list_type, tvb, 3, 1, FALSE); - proto_tree_add_item(tree, hf_isi_sms_cb_subject_count, tvb, 4, 1, FALSE); - proto_tree_add_item(tree, hf_isi_sms_cb_language_count, tvb, 5, 1, FALSE); - proto_tree_add_item(tree, hf_isi_sms_cb_range, tvb, 6, 1, FALSE); + proto_tree_add_item(tree, hf_isi_sms_cb_subject_list_type, tvb, 3, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_isi_sms_cb_subject_count, tvb, 4, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_isi_sms_cb_language_count, tvb, 5, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_isi_sms_cb_range, tvb, 6, 1, ENC_BIG_ENDIAN); #endif code = tvb_get_guint8(tvb, 1); switch(code) { @@ -1707,8 +1707,8 @@ static int dissect_isi_sms(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitre case 0x0C: /* SMS_GSM_CB_ROUTING_RESP */ #if 0 - proto_tree_add_item(tree, hf_isi_sms_operation, tvb, 1, 1, FALSE); - proto_tree_add_item(tree, hf_isi_sms_service_code, tvb, 2, 1, FALSE); + proto_tree_add_item(tree, hf_isi_sms_operation, tvb, 1, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(tree, hf_isi_sms_service_code, tvb, 2, 1, ENC_BIG_ENDIAN); #endif code = tvb_get_guint8(tvb, 1); switch(code) { diff --git a/epan/dissectors/packet-ixveriwave.c b/epan/dissectors/packet-ixveriwave.c index 7843855a85..c235a45405 100644 --- a/epan/dissectors/packet-ixveriwave.c +++ b/epan/dissectors/packet-ixveriwave.c @@ -2260,14 +2260,15 @@ wlantap_dissect_octo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, tvbuff_t *next_tvb; guint length; gint8 dbm; - guint8 rate_mcs_index = 0, vw_plcp_info, vw_bssid; + guint8 rate_mcs_index = 0, vw_bssid; guint8 plcp_type; guint8 vht_ndp_flag, vht_mu_mimo_flg; float phyRate; proto_tree *vwict, *vw_infoC_tree = NULL; - guint16 vw_vcid, vw_seqnum, mpdu_length; - guint8 vht_user_pos; + guint16 vw_vcid, mpdu_length; + guint32 vw_seqnum; + guint32 vht_user_pos; guint8 plcp_default; proto_item *vwl1i; @@ -2500,10 +2501,9 @@ wlantap_dissect_octo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (plcp_type == PLCP_TYPE_VHT_MIXED) { // Extract SU/MU MIMO flag from RX L1 Info - vht_user_pos = tvb_get_guint8(tvb, offset); - + vht_user_pos = tvb_get_guint8(tvb, offset); vwict = proto_tree_add_item(vw_l1info_tree, - hf_radiotap_l1infoc, tvb, offset, 1, vht_user_pos); + hf_radiotap_l1infoc, tvb, offset, 1, ENC_NA); vw_infoC_tree = proto_item_add_subtree(vwict, ett_radiotap_infoc); vht_ndp_flag = (vht_user_pos & 0x80) >> 7; @@ -2528,14 +2528,14 @@ wlantap_dissect_octo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, mpdu_length = tvb_get_letohs(tvb, offset); if (cmd_type != 1) //Checking for Rx and Tx { - proto_tree_add_item(vw_l1info_tree, hf_ixveriwave_frame_length, tvb, offset, 2, mpdu_length); + proto_tree_add_item(vw_l1info_tree, hf_ixveriwave_frame_length, tvb, offset, 2, ENC_LITTLE_ENDIAN); } offset += 2; //RadioTapHeader New format for PLCP section - vw_plcp_info = tvb_get_guint8(tvb, offset); + //vw_plcp_info = tvb_get_guint8(tvb, offset); - vwplt = proto_tree_add_item(tap_tree, hf_radiotap_plcp_info, tvb, offset, 16, vw_plcp_info); + vwplt = proto_tree_add_item(tap_tree, hf_radiotap_plcp_info, tvb, offset, 16, ENC_NA); vw_plcpinfo_tree = proto_item_add_subtree(vwplt, ett_radiotap_plcp); switch (plcp_type) @@ -2832,9 +2832,8 @@ wlantap_dissect_octo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_item(vw_l2l4info_tree, hf_radiotap_flowvalid, tvb, offset, 1, ENC_NA); offset++; - vw_seqnum = tvb_get_guint8(tvb, offset); - proto_tree_add_item(vw_l2l4info_tree, hf_ixveriwave_vw_seqnum, - tvb, offset, 1, vw_seqnum); + proto_tree_add_item_ret_uint(vw_l2l4info_tree, hf_ixveriwave_vw_seqnum, + tvb, offset, 1, ENC_NA, &vw_seqnum); offset++; if (flowv == 1) { diff --git a/epan/dissectors/packet-nfs.c b/epan/dissectors/packet-nfs.c index a764bc3cc6..88de7613ab 100644 --- a/epan/dissectors/packet-nfs.c +++ b/epan/dissectors/packet-nfs.c @@ -9277,7 +9277,7 @@ dissect_nfs4_write_response(tvbuff_t *tvb, int offset, proto_tree *tree) subtree = proto_item_add_subtree(sub_fitem, ett_nfs4_callback_stateids_sub); for (i = 0; i < count; i++) { - ss_fitem = proto_tree_add_item(subtree, + ss_fitem = proto_tree_add_uint(subtree, hf_nfs4_callback_stateids_index, tvb, offset, 4, i); @@ -9310,7 +9310,7 @@ dissect_nfs4_source_servers(tvbuff_t *tvb, int offset, proto_tree *tree) subtree = proto_item_add_subtree(sub_fitem, ett_nfs4_source_servers_sub); for (i = 0; i < source_servers; i++) { - ss_fitem = proto_tree_add_item(subtree, + ss_fitem = proto_tree_add_uint(subtree, hf_nfs4_source_server_index, tvb, offset, 4, i); diff --git a/epan/dissectors/packet-oran.c b/epan/dissectors/packet-oran.c index aec8fd675c..a0c384045a 100644 --- a/epan/dissectors/packet-oran.c +++ b/epan/dissectors/packet-oran.c @@ -1913,7 +1913,7 @@ proto_register_oran(void) { "Data Direction", "oran_fh_cus.data_direction", FT_UINT8, BASE_DEC, VALS(data_direction_vals), 0x80, - "This parameter indicates the gNB data direction.", + "This parameter indicates the gNB data direction", HFILL } }, @@ -1924,7 +1924,7 @@ proto_register_oran(void) NULL, 0x70, "This parameter defines the payload protocol version valid for the " "following IEs in the application layer. In this version of the " - "specification payloadVersion=001b shall be used.", + "specification payloadVersion=001b shall be used", HFILL} }, @@ -1945,7 +1945,7 @@ proto_register_oran(void) "also a frequency offset (see freqOffset) applied before the " "PRACH filter. NOTE: Filter index is commanded from lls-CU to RU. " "Likewise, it is not mandatory to command special filters, and " - "filter index = 0000b is also allowed for PRACH.", + "filter index = 0000b is also allowed for PRACH", HFILL} }, @@ -1976,7 +1976,7 @@ proto_register_oran(void) "in one sub-frame are counted by this parameter, slotId running " "from 0 to Nslot-1. In this version of the specification the " "maximum Nslot=16, All other values of the 6 bits are reserved for " - "future use.", + "future use", HFILL} }, @@ -1995,7 +1995,7 @@ proto_register_oran(void) FT_UINT8, BASE_DEC, NULL, 0x3f, "This parameter identifies the first symbol number within slot, to " - "which the information of this message is applies.", + "which the information of this message is applies", HFILL} }, @@ -2015,7 +2015,7 @@ proto_register_oran(void) FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(section_types), 0x00, "This parameter determines the characteristics of U-plane data to " - "be transferred or received from a beam with one pattern id.", + "be transferred or received from a beam with one pattern id", HFILL} }, @@ -2530,8 +2530,8 @@ proto_register_oran(void) { "beamforming weight compression parameter", "oran_fh_cus.bfwCompParam", various, | BASE_RANGE_STRING, RVALS(bfw_comp_parms), 0x0, - "This parameter applies to the compression method specified by th" - "e associated sectionID's bfwCompMeth value.", + "This parameter applies to the compression method specified by the" + "associated sectionID's bfwCompMeth value", HFILL } }, #endif @@ -2601,7 +2601,7 @@ proto_register_oran(void) {"Pair", "oran_fh_cus.offStartPrb_numPrb", FT_STRING, BASE_NONE, NULL, 0x0, - "Pair of offStartPrb and numPrb.", + "Pair of offStartPrb and numPrb", HFILL} }, @@ -2609,14 +2609,14 @@ proto_register_oran(void) {"offStartPrb", "oran_fh_cus.offStartPrb", FT_UINT8, BASE_DEC, NULL, 0x0, - "Offset of PRB range start.", + "Offset of PRB range start", HFILL} }, {&hf_oran_num_prb, {"numPrb", "oran_fh_cus.numPrb", FT_UINT8, BASE_DEC, NULL, 0x0, - "Number of PRBs in PRB range.", + "Number of PRBs in PRB range", HFILL} }, @@ -2637,27 +2637,26 @@ proto_register_oran(void) "This parameter is the starting PRB of a user plane section. For " "one C-Plane message, there may be multiple U-Plane messages " "associated with it and requiring defining from which PRB the contained " - "IQ data are applicable.", + "IQ data are applicable", HFILL} }, /* Section 6.3.3.12 */ - {&hf_oran_numPrbu, + { &hf_oran_numPrbu, {"Number of PRBs per User Plane Section", "oran_fh_cus.numPrbu", FT_UINT8, BASE_DEC, NULL, 0x0, - "This parameter defines the PRBs where the user plane section is " - "valid.", + "This parameter defines the PRBs where the user plane section is valid", HFILL} }, /* Section 6.3.3.13 */ - {&hf_oran_udCompHdrMeth, + { &hf_oran_udCompHdrMeth, {"User Data Compression Method", "oran_fh_cus.udCompHdrMeth", FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(ud_comp_header_meth), 0x0f, "This parameter defines the compression method for " - "the user data in every section in the C-Plane message.", + "the user data in every section in the C-Plane message", HFILL} }, @@ -2667,7 +2666,7 @@ proto_register_oran(void) FT_UINT8, BASE_DEC | BASE_RANGE_STRING, RVALS(ud_comp_header_width), 0xf0, "This parameter defines the IQ bit width " - "for the user data in every section in the C-Plane message.", + "for the user data in every section in the C-Plane message", HFILL} }, @@ -2727,7 +2726,7 @@ proto_register_oran(void) "This parameter exponent applicable to the I & Q mantissas. " "NOTE : Exponent is used for all mantissa sample sizes(i.e. 6bit " "- 16bit). Likewise, a native \"uncompressed\" format is not supported " - "within this specification.", + "within this specification", HFILL } }, @@ -2752,8 +2751,7 @@ proto_register_oran(void) { "RefA", "oran_fh_cus.refa", FT_STRING, BASE_NONE, NULL, 0x0, - "This is a calculated field for the RefA ID, which provides a " - "reference in time.", + "This is a calculated field for the RefA ID, which provides a reference in time", HFILL } }, diff --git a/epan/dissectors/packet-pulse.c b/epan/dissectors/packet-pulse.c index 00f6b7a803..93a946d8ea 100644 --- a/epan/dissectors/packet-pulse.c +++ b/epan/dissectors/packet-pulse.c @@ -45,13 +45,13 @@ dissect_pulse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* guint32 magic; const char* magic_str; - guint little_endian; + guint endian; if (tvb_captured_length(tvb) < 4) return 0; /* Try to read MAGIC in both endians */ - little_endian = ENC_LITTLE_ENDIAN; + endian = ENC_LITTLE_ENDIAN; magic = tvb_get_letohl(tvb, 0); magic_str = try_val_to_str(magic, pulse_magic_type); if (magic_str == NULL) { @@ -60,7 +60,7 @@ dissect_pulse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* if (magic_str == NULL) { return 0; } - little_endian = ENC_BIG_ENDIAN; + endian = ENC_BIG_ENDIAN; } col_set_str(pinfo->cinfo, COL_PROTOCOL, "PULSE"); @@ -68,9 +68,9 @@ dissect_pulse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* if (parent_tree) { item = proto_tree_add_item(parent_tree, proto_pulse, tvb, 0, - -1, little_endian); + -1, endian); tree = proto_item_add_subtree(item, ett_pulse); - proto_tree_add_item(tree, hf_pulse_magic, tvb, 0, 4, little_endian); + proto_tree_add_item(tree, hf_pulse_magic, tvb, 0, 4, endian); } return 4; } diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c index 39b683b97e..1cc64da109 100644 --- a/epan/dissectors/packet-rtps.c +++ b/epan/dissectors/packet-rtps.c @@ -12098,9 +12098,8 @@ static void dissect_RTPS_DATA_BATCH(tvbuff_t *tvb, packet_info *pinfo, gint offs } /* octetsToSLEncapsulationId */ - octetsToSLEncapsulationId = tvb_get_guint32(tvb, offset, encoding); - proto_tree_add_item(tree, hf_rtps_data_batch_octets_to_sl_encap_id, tvb, - offset, 4, octetsToSLEncapsulationId); + proto_tree_add_item_ret_uint(tree, hf_rtps_data_batch_octets_to_sl_encap_id, tvb, + offset, 4, encoding, &octetsToSLEncapsulationId); offset += 4; sampleListOffset = offset + octetsToSLEncapsulationId; diff --git a/epan/dissectors/packet-scsi-osd.c b/epan/dissectors/packet-scsi-osd.c index 7b8c879ac8..4893431640 100644 --- a/epan/dissectors/packet-scsi-osd.c +++ b/epan/dissectors/packet-scsi-osd.c @@ -652,7 +652,7 @@ dissect_osd_offset(packet_info *pinfo, tvbuff_t *tvb, int offset, exponent = -(((~exponent)&7)+1); if (exponent <=- 6 && mantissa != 0xFFFFFFF) { proto_item *item; - item = proto_tree_add_item(tree, field, tvb, offset, 4, value); + item = proto_tree_add_uint(tree, field, tvb, offset, 4, value); expert_add_info(pinfo, item, &ei_osd2_invalid_offset); *raw_value_ptr = 0xFFFFFFFF; return; diff --git a/epan/dissectors/packet-tibia.c b/epan/dissectors/packet-tibia.c index f021ffc7d2..9105d07f1e 100644 --- a/epan/dissectors/packet-tibia.c +++ b/epan/dissectors/packet-tibia.c @@ -844,7 +844,7 @@ dissect_loginserv_packet(struct tibia_convo *convo, tvbuff_t *tvb, int offset, i proto_item *it = ptvcursor_add(ptvc, hf_tibia_worldlist_entry_id, 1, ENC_NA); ptvcursor_push_subtree(ptvc, it, ett_world); - ptvcursor_add(ptvc, hf_tibia_worldlist_entry_name, 2, convo->has.string_enc | ENC_LITTLE_ENDIAN); + ptvcursor_add(ptvc, hf_tibia_worldlist_entry_name, 2, ENC_LITTLE_ENDIAN | convo->has.string_enc); guint ipv4addr_len = tvb_get_letohs(tvb, ptvcursor_current_offset(ptvc)); char *ipv4addr_str = (char*)tvb_get_string_enc(pinfo->pool, tvb, ptvcursor_current_offset(ptvc) + 2, ipv4addr_len, ENC_LITTLE_ENDIAN | convo->has.string_enc); guint32 ipv4addr = ipv4tonl(ipv4addr_str); @@ -867,7 +867,7 @@ dissect_loginserv_packet(struct tibia_convo *convo, tvbuff_t *tvb, int offset, i while (char_count--) { proto_item *it = ptvcursor_add(ptvc, hf_tibia_worldlist_entry_id, 1, ENC_NA); ptvcursor_push_subtree(ptvc, it, ett_char); - ptvcursor_add(ptvc, hf_tibia_charlist_entry_name, 2, convo->has.string_enc | ENC_LITTLE_ENDIAN); + ptvcursor_add(ptvc, hf_tibia_charlist_entry_name, 2, ENC_LITTLE_ENDIAN | convo->has.string_enc); ptvcursor_pop_subtree(ptvc); @@ -881,7 +881,7 @@ dissect_loginserv_packet(struct tibia_convo *convo, tvbuff_t *tvb, int offset, i ptvcursor_add_with_subtree(ptvc, hf_tibia_charlist, SUBTREE_UNDEFINED_LENGTH, ENC_NA, ett_charlist); while (char_count--) { - proto_item *it = ptvcursor_add(ptvc, hf_tibia_charlist_entry_name, 2, convo->has.string_enc | ENC_LITTLE_ENDIAN); + proto_item *it = ptvcursor_add(ptvc, hf_tibia_charlist_entry_name, 2, ENC_LITTLE_ENDIAN | convo->has.string_enc); ptvcursor_push_subtree(ptvc, it, ett_char); ptvcursor_add(ptvc, hf_tibia_charlist_entry_world, 2, ENC_LITTLE_ENDIAN | convo->has.string_enc); @@ -1566,7 +1566,7 @@ dissect_tibia(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *fragmen proto_tree_add_item(infotree, hf_tibia_unknown, tvb_decrypted, offset, 4, ENC_NA); offset += 4; - proto_tree_add_item(infotree, hf_tibia_client_gpu, tvb_decrypted, offset, 9, convo->has.string_enc|ENC_NA); + proto_tree_add_item(infotree, hf_tibia_client_gpu, tvb_decrypted, offset, 9, ENC_NA | convo->has.string_enc); offset += 9; proto_tree_add_item(infotree, hf_tibia_client_vram, tvb_decrypted, offset, 2, ENC_LITTLE_ENDIAN); diff --git a/epan/dissectors/packet-tns.c b/epan/dissectors/packet-tns.c index 8a7bac1810..b965961e78 100644 --- a/epan/dissectors/packet-tns.c +++ b/epan/dissectors/packet-tns.c @@ -694,7 +694,7 @@ static void dissect_tns_data(tvbuff_t *tvb, int offset, packet_info *pinfo, prot proto_tree_add_item(data_tree, hf_tns_data_opi_version2_banner, tvb, offset, len, ENC_ASCII); offset += len + (skip == 1 ? 1 : 0); - proto_tree_add_item(data_tree, hf_tns_data_opi_version2_vsnum, tvb, offset, 4, skip == 1 ? ENC_BIG_ENDIAN : ENC_LITTLE_ENDIAN); + proto_tree_add_item(data_tree, hf_tns_data_opi_version2_vsnum, tvb, offset, 4, (skip == 1) ? ENC_BIG_ENDIAN : ENC_LITTLE_ENDIAN); offset += 4; } else if ( opi == OPI_OSESSKEY || opi == OPI_OAUTH ) diff --git a/epan/dissectors/packet-uftp.c b/epan/dissectors/packet-uftp.c index 86d1199965..5061d34fb5 100644 --- a/epan/dissectors/packet-uftp.c +++ b/epan/dissectors/packet-uftp.c @@ -814,7 +814,7 @@ static void dissect_uftp_keyinfo(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr offset += 1; proto_tree_add_item(keyinfo_tree, hf_uftp_keyinfo_groupmaster_len, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - proto_tree_add_item(keyinfo_tree, hf_uftp_keyinfo_tstamp, tvb, offset, 8, FALSE); + proto_tree_add_item(keyinfo_tree, hf_uftp_keyinfo_tstamp, tvb, offset, 8, ENC_NA); offset += 8; if (destcount > 0) { destlist = proto_tree_add_item(keyinfo_tree, hf_uftp_destlist, tvb, offset, destcount * DESTKEY_LEN, ENC_NA); @@ -1337,7 +1337,7 @@ static void dissect_uftp_encrypted(tvbuff_t *tvb, packet_info *pinfo _U_, proto_ ti = proto_tree_add_item(tree, hf_uftp_encrypted, tvb, offset, -1, ENC_NA); encrypted_tree = proto_item_add_subtree(ti, ett_uftp_encrypted); - proto_tree_add_item(encrypted_tree, hf_uftp_encrypted_tstamp, tvb, offset, 8, FALSE); + proto_tree_add_item(encrypted_tree, hf_uftp_encrypted_tstamp, tvb, offset, 8, ENC_NA); offset += 8; proto_tree_add_item(encrypted_tree, hf_uftp_encrypted_sig_len, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; diff --git a/epan/dissectors/packet-vsip.c b/epan/dissectors/packet-vsip.c index eea0d7a7da..695caff974 100644 --- a/epan/dissectors/packet-vsip.c +++ b/epan/dissectors/packet-vsip.c @@ -1611,12 +1611,11 @@ static guint32 vsip_ErrorVAResponse(proto_tree *tree, packet_info *pinfo, tvbuff static guint32 vsip_dissect_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { int soffset = offset; - guint16 version; + guint32 version; guint8 type; proto_item *ti; - version = tvb_get_ntohs(tvb, offset); - proto_tree_add_item(tree, hf_vsip_Version, tvb, offset, 2, version); + proto_tree_add_item_ret_uint(tree, hf_vsip_Version, tvb, offset, 2, ENC_BIG_ENDIAN, &version); offset += 2; type = tvb_get_guint8(tvb, offset); @@ -1632,7 +1631,7 @@ static guint32 vsip_dissect_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo, p proto_tree_add_item(tree, hf_vsip_PacketSize, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; } - else if(version == 256) + else if (version == 256) { proto_tree_add_item(tree, hf_vsip_PacketSize, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; diff --git a/epan/dissectors/packet-wassp.c b/epan/dissectors/packet-wassp.c index 6f456b60f9..d0eeaa6550 100644 --- a/epan/dissectors/packet-wassp.c +++ b/epan/dissectors/packet-wassp.c @@ -5622,7 +5622,7 @@ static int dissect_mu_netflow(proto_tree *tree, tvbuff_t *tvb, int offset) proto_tree_add_item(mu_netflow_header_tree, hf_wassp_mu_netflow_version, tvb, MU_NETFLOW_HDR_VERSION, 2, ENC_BIG_ENDIAN); proto_tree_add_item(mu_netflow_header_tree, hf_wassp_mu_netflow_length, tvb, MU_NETFLOW_HDR_LENGTH, 2, ENC_BIG_ENDIAN); proto_tree_add_item(mu_netflow_header_tree, hf_wassp_mu_netflow_flags, tvb, MU_NETFLOW_HDR_FLAG, 2, ENC_BIG_ENDIAN); - proto_tree_add_item(mu_netflow_header_tree, hf_wassp_mu_netflow_uptime, tvb, MU_NETFLOW_HDR_UPTIME, 4, FALSE); + proto_tree_add_item(mu_netflow_header_tree, hf_wassp_mu_netflow_uptime, tvb, MU_NETFLOW_HDR_UPTIME, 4, ENC_NA); offset += MU_NETFLOW_HEADER_TOTAL_LENGTH; netflowLen = tvb_get_ntohs(tvb, MU_NETFLOW_HDR_LENGTH); diff --git a/tools/check_typed_item_calls.py b/tools/check_typed_item_calls.py index bcd5a1a0d3..29d062fa08 100755 --- a/tools/check_typed_item_calls.py +++ b/tools/check_typed_item_calls.py @@ -62,7 +62,7 @@ common_hf_var_names = { 'hf_index', 'hf_item', 'hf_idx', 'hf_x', 'hf_id', 'hf_co 'hf_cause_value', 'hf_uuid', 'hf_endian', 'hf_ip', 'hf_port', 'hf_suff', 'hf_string', 'hf_uint', 'hf_tag', 'hf_type', 'hf_hdr', 'hf_field', 'hf_opcode', 'hf_size', - 'hf_entry' } + 'hf_entry', 'field' } # A check for a particular API function. class APICheck: @@ -179,13 +179,13 @@ class ProtoTreeAddItemCheck(APICheck): # proto_tree_add_item(proto_tree *tree, int hfindex, tvbuff_t *tvb, # const gint start, gint length, const guint encoding) self.fun_name = 'proto_tree_add_item' - self.p = re.compile('[^\n]*' + self.fun_name + '\([a-zA-Z0-9_]+,\s*([a-zA-Z0-9_]+),\s*[a-zA-Z0-9_]+,\s*[a-zA-Z0-9_]+,\s*([0-9]+),\s*([a-zA-Z0-9_]+)') + self.p = re.compile('[^\n]*' + self.fun_name + '\(\s*[a-zA-Z0-9_]+,\s*([a-zA-Z0-9_]+),\s*[a-zA-Z0-9_]+,\s*[a-zA-Z0-9_]+,\s*([0-9]+),\s*([a-zA-Z0-9_]+)') else: # proto_item * # ptvcursor_add(ptvcursor_t *ptvc, int hfindex, gint length, # const guint encoding) self.fun_name = 'ptvcursor_add' - self.p = re.compile('[^\n]*' + self.fun_name + '\([a-zA-Z0-9_]+,\s*([a-zA-Z0-9_]+),\s*([a-zA-Z_0-9]+),\s*([a-zA-Z0-9_]+)') + self.p = re.compile('[^\n]*' + self.fun_name + '\([a-zA-Z0-9_]+,\s*([a-zA-Z0-9_]+),\s*([a-zA-Z_0-9]+),\s*([a-zA-Z0-9_\-\>]+)') self.lengths = {} @@ -230,7 +230,19 @@ class ProtoTreeAddItemCheck(APICheck): to_check += (lines[line_number-1+i] + '\n') m = self.p.search(to_check) if m: - self.calls.append(Call(m.group(1), line_number=line_number, length=m.group(2))) + enc = m.group(3) + hf_name = m.group(1) + if not enc.startswith('ENC_'): + if not enc in { 'encoding', 'enc', 'client_is_le', 'cigi_byte_order', 'endian', 'endianess', 'machine_encoding', 'byte_order', 'bLittleEndian', + 'p_mq_parm', 'iEnc', 'strid_enc', 'iCod', 'nl_data', 'argp', 'gquic_info', 'writer_encoding', + 'tds_get_int2_encoding', 'tds_get_int4_encoding', + 'DREP_ENC_INTEGER' }: + global warnings_found + + print('Warning:', self.file + ':' + str(line_number), + self.fun_name + ' called for "' + hf_name + '"', 'check last/enc param:', enc, '?') + warnings_found += 1 + self.calls.append(Call(hf_name, line_number=line_number, length=m.group(2))) def check_against_items(self, items_defined, items_declared, items_declared_extern, check_missing_items=False): # For now, only complaining if length if call is longer than the item type implies. @@ -696,8 +708,9 @@ def find_items(filename, check_mask=False, mask_exact_width=False, check_label=F contents = f.read() # Remove comments so as not to trip up RE. contents = removeComments(contents) + # N.B. re extends all the way to HFILL to avoid greedy matching - matches = re.finditer( r'.*\{\s*\&(hf_[a-z_A-Z0-9]*)\s*,\s*{\s*\"(.*)\"\s*,\s*\"([a-zA-Z0-9_\-\.]+)\"\s*,\s*([a-zA-Z0-9_]*)\s*,\s*(.*)\s*,\s*([\&A-Za-z0-9x\_<\|\s\(\)]*)\s*,\s*([a-zA-Z0-9x_]*)\s*,\s*.*\s*,\s*HFILL', contents) + matches = re.finditer( r'.*\{\s*\&(hf_[a-z_A-Z0-9]*)\s*,\s*{\s*\"(.*?)\"\s*,\s*\"(.*?)\"\s*,\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*,\s*([a-zA-Z0-9\W\s_]*?)\s*,\s*HFILL', contents) for m in matches: # Store this item. hf = m.group(1) @@ -707,7 +720,6 @@ def find_items(filename, check_mask=False, mask_exact_width=False, check_label=F check_label=check_label, mask_exact_width=mask_exact_width, check_consecutive=(not is_generated and check_consecutive)) - #print('item is', hf, items[hf]) return items