diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:26 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:26 +0000 |
commit | c4e8a3222648fcf22ca207f1815ebbf7cd144eeb (patch) | |
tree | 93d5c6aa93d9987680dd1adad5685e2ad698f223 /epan/dissectors/packet-q931.c | |
parent | Adding upstream version 4.2.6. (diff) | |
download | wireshark-c4e8a3222648fcf22ca207f1815ebbf7cd144eeb.tar.xz wireshark-c4e8a3222648fcf22ca207f1815ebbf7cd144eeb.zip |
Adding upstream version 4.4.0.upstream/4.4.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'epan/dissectors/packet-q931.c')
-rw-r--r-- | epan/dissectors/packet-q931.c | 669 |
1 files changed, 335 insertions, 334 deletions
diff --git a/epan/dissectors/packet-q931.c b/epan/dissectors/packet-q931.c index 877394db..bb50a5be 100644 --- a/epan/dissectors/packet-q931.c +++ b/epan/dissectors/packet-q931.c @@ -14,6 +14,8 @@ #include "config.h" #include <epan/packet.h> +#include <epan/tfs.h> +#include <epan/unit_strings.h> #include <epan/tap.h> #include <epan/nlpid.h> #include "packet-q931.h" @@ -42,184 +44,184 @@ void proto_register_q931(void); void proto_reg_handoff_q931(void); static void reset_q931_packet_info(q931_packet_info *pi); -static int q931_tap = -1; +static int q931_tap; static dissector_handle_t q931_handle; static dissector_handle_t q931_over_ip_handle; -static int proto_q931 = -1; -static int hf_q931_discriminator = -1; -static int hf_q931_coding_standard = -1; -static int hf_q931_interpretation = -1; -static int hf_q931_pres_meth_prot_prof = -1; -static int hf_q931_high_layer_characteristics = -1; -static int hf_q931_extended_high_layer_characteristics = -1; -static int hf_q931_extended_audiovisual_characteristics = -1; -static int hf_q931_information_transfer_capability = -1; -static int hf_q931_transfer_mode = -1; -static int hf_q931_information_transfer_rate = -1; -static int hf_q931_layer_ident = -1; -static int hf_q931_uil1 = -1; -static int hf_q931_call_ref_len = -1; -static int hf_q931_call_ref_flag = -1; -static int hf_q931_call_ref = -1; -static int hf_q931_message_type = -1; -static int hf_q931_maintenance_message_type = -1; -static int hf_q931_segment_type = -1; -static int hf_q931_cause_location = -1; -static int hf_q931_cause_value = -1; -static int hf_q931_number_type = -1; -static int hf_q931_numbering_plan = -1; -static int hf_q931_extension_ind = -1; -static int hf_q931_extension_ind_preference = -1; -static int hf_q931_extension_ind_new_status = -1; -static int hf_q931_calling_party_number = -1; -static int hf_q931_called_party_number = -1; -static int hf_q931_connected_number = -1; -static int hf_q931_redirecting_number = -1; -static int hf_q931_screening_ind = -1; -static int hf_q931_presentation_ind = -1; - -/* fields for Channel Indentification IE */ -static int hf_q931_channel_interface_explicit = -1; -static int hf_q931_channel_interface_type = -1; -static int hf_q931_channel_exclusive = -1; -static int hf_q931_channel_dchan = -1; -static int hf_q931_channel_selection_bri = -1; -static int hf_q931_channel_selection_pri = -1; -static int hf_q931_channel_map = -1; -static int hf_q931_channel_element_type = -1; -static int hf_q931_channel_number = -1; - - -static int hf_q931_segments = -1; -static int hf_q931_segment = -1; -static int hf_q931_segment_overlap = -1; -static int hf_q931_segment_overlap_conflict = -1; -static int hf_q931_segment_multiple_tails = -1; -static int hf_q931_segment_too_long_segment = -1; -static int hf_q931_segment_error = -1; -static int hf_q931_segment_count = -1; -static int hf_q931_reassembled_in = -1; -static int hf_q931_reassembled_length = -1; +static int proto_q931; +static int hf_q931_discriminator; +static int hf_q931_coding_standard; +static int hf_q931_interpretation; +static int hf_q931_pres_meth_prot_prof; +static int hf_q931_high_layer_characteristics; +static int hf_q931_extended_high_layer_characteristics; +static int hf_q931_extended_audiovisual_characteristics; +static int hf_q931_information_transfer_capability; +static int hf_q931_transfer_mode; +static int hf_q931_information_transfer_rate; +static int hf_q931_layer_ident; +static int hf_q931_uil1; +static int hf_q931_call_ref_len; +static int hf_q931_call_ref_flag; +static int hf_q931_call_ref; +static int hf_q931_message_type; +static int hf_q931_maintenance_message_type; +static int hf_q931_segment_type; +static int hf_q931_cause_location; +static int hf_q931_cause_value; +static int hf_q931_number_type; +static int hf_q931_numbering_plan; +static int hf_q931_extension_ind; +static int hf_q931_extension_ind_preference; +static int hf_q931_extension_ind_new_status; +static int hf_q931_calling_party_number; +static int hf_q931_called_party_number; +static int hf_q931_connected_number; +static int hf_q931_redirecting_number; +static int hf_q931_screening_ind; +static int hf_q931_presentation_ind; + +/* fields for Channel Identification IE */ +static int hf_q931_channel_interface_explicit; +static int hf_q931_channel_interface_type; +static int hf_q931_channel_exclusive; +static int hf_q931_channel_dchan; +static int hf_q931_channel_selection_bri; +static int hf_q931_channel_selection_pri; +static int hf_q931_channel_map; +static int hf_q931_channel_element_type; +static int hf_q931_channel_number; + + +static int hf_q931_segments; +static int hf_q931_segment; +static int hf_q931_segment_overlap; +static int hf_q931_segment_overlap_conflict; +static int hf_q931_segment_multiple_tails; +static int hf_q931_segment_too_long_segment; +static int hf_q931_segment_error; +static int hf_q931_segment_count; +static int hf_q931_reassembled_in; +static int hf_q931_reassembled_length; /* Generated from convert_proto_tree_add_text.pl */ -static int hf_q931_user_information_bytes = -1; -static int hf_q931_restart_indicator = -1; -static int hf_q931_call_state_data = -1; -static int hf_q931_first_segment = -1; -static int hf_q931_packet_size_backward_value = -1; -static int hf_q931_packet_size_forward_value = -1; -static int hf_q931_information_rate_minimum_outgoing = -1; -static int hf_q931_bearer_capability_data = -1; -static int hf_q931_uil2_info = -1; -static int hf_q931_netid_facility_specification = -1; -static int hf_q931_bearer_capability_stop_bits = -1; -static int hf_q931_netid_length = -1; -static int hf_q931_channel_data = -1; -static int hf_q931_call_state = -1; -static int hf_q931_party_subaddr_type = -1; -static int hf_q931_uil3 = -1; -static int hf_q931_user_information_str = -1; -static int hf_q931_bearer_capability_user_rate = -1; -static int hf_q931_channel_slot_map = -1; -static int hf_q931_bearer_capability_modem_type = -1; -static int hf_q931_cause_data = -1; -static int hf_q931_cause_recommendation = -1; -static int hf_q931_bearer_capability_parity = -1; -static int hf_q931_cause_call_rejection_reason = -1; -static int hf_q931_party_category = -1; -static int hf_q931_progress_indicator_location = -1; -static int hf_q931_bearer_capability_packet_window_size = -1; -static int hf_q931_extension_reason = -1; -static int hf_q931_information_rate_minimum_incoming = -1; -static int hf_q931_user_protocol_discriminator = -1; -static int hf_q931_uil2 = -1; -static int hf_q931_progress_indicator_description = -1; -static int hf_q931_bearer_capability_mode = -1; -static int hf_q931_not_first_segment = -1; -static int hf_q931_fast_select = -1; -static int hf_q931_netid_plan = -1; -static int hf_q931_cause_call_message_type = -1; -static int hf_q931_reverse_charging_ind = -1; -static int hf_q931_high_layer_compat_data = -1; -static int hf_q931_progress_indicator_data = -1; -static int hf_q931_pl_window_size_forward_value = -1; -static int hf_q931_cause_call_rec_timer = -1; -static int hf_q931_bearer_capability_window_size = -1; -static int hf_q931_cause_call_user_specific_diagnostic = -1; -static int hf_q931_channel_interface_id = -1; -static int hf_q931_uil3_additional = -1; -static int hf_q931_party_subaddr = -1; -static int hf_q931_bearer_capability_rate_multiplier = -1; -static int hf_q931_bearer_capability_data_bits = -1; -static int hf_q931_cug_index_code = -1; -static int hf_q931_bearer_capability_default_packet_size = -1; -static int hf_q931_notification_description = -1; -static int hf_q931_information_rate_outgoing = -1; -static int hf_q931_user_information_len = -1; -static int hf_q931_pl_window_size_backward_value = -1; -static int hf_q931_repeat_indicator = -1; -static int hf_q931_cause_call_diagnostic = -1; -static int hf_q931_netid = -1; -static int hf_q931_cause_call_condition = -1; -static int hf_q931_signal = -1; -static int hf_q931_congestion_level = -1; -static int hf_q931_bearer_capability_intermediate_rate = -1; -static int hf_q931_netid_type = -1; -static int hf_q931_information_rate_incoming = -1; -static int hf_q931_party_subaddr_odd_even_indicator = -1; -static int hf_q931_cug_indication = -1; -static int hf_q931_multiple_frame_establishment = -1; -static int hf_q931_message_originator = -1; -static int hf_q931_out_band_negotiation = -1; -static int hf_q931_negotiation_is_done = -1; -static int hf_q931_layer_1 = -1; -static int hf_q931_accept_data_flow_control = -1; -static int hf_q931_mode_of_operation = -1; -static int hf_q931_extension_condition_type = -1; -static int hf_q931_pl_binary_confirmation = -1; -static int hf_q931_pl_request = -1; -static int hf_q931_pl_modulus = -1; -static int hf_q931_network_service = -1; -static int hf_q931_extension_condition = -1; -static int hf_q931_rate_adaption_header = -1; -static int hf_q931_send_data_net_independent_clock = -1; -static int hf_q931_bearer_capability_duplex = -1; -static int hf_q931_accept_data_net_independent_clock = -1; -static int hf_q931_send_data_flow_control = -1; -static int hf_q931_data = -1; -static int hf_q931_layer_1_in_band_negotiation = -1; -static int hf_q931_information_element = -1; -static int hf_q931_information_element_len = -1; -static int hf_q931_date_time = -1; -static int hf_q931_more_data = -1; -static int hf_q931_sending_complete = -1; -static int hf_q931_message_segment = -1; -static int hf_q931_missing_info_element = -1; -static int hf_q931_insufficient_info_element = -1; -static int hf_q931_cumulative_transit_delay = -1; -static int hf_q931_requested_end_to_end_transit_delay = -1; -static int hf_q931_maximum_end_to_end_transit_delay = -1; -static int hf_q931_transit_delay = -1; -static int hf_q931_display_information = -1; -static int hf_q931_keypad_facility = -1; -static int hf_q931_avaya_display = -1; -static int hf_q931_locking_codeset = -1; -static int hf_q931_protocol_negotiation = -1; - - -static gint ett_q931 = -1; +static int hf_q931_user_information_bytes; +static int hf_q931_restart_indicator; +static int hf_q931_call_state_data; +static int hf_q931_first_segment; +static int hf_q931_packet_size_backward_value; +static int hf_q931_packet_size_forward_value; +static int hf_q931_information_rate_minimum_outgoing; +static int hf_q931_bearer_capability_data; +static int hf_q931_uil2_info; +static int hf_q931_netid_facility_specification; +static int hf_q931_bearer_capability_stop_bits; +static int hf_q931_netid_length; +static int hf_q931_channel_data; +static int hf_q931_call_state; +static int hf_q931_party_subaddr_type; +static int hf_q931_uil3; +static int hf_q931_user_information_str; +static int hf_q931_bearer_capability_user_rate; +static int hf_q931_channel_slot_map; +static int hf_q931_bearer_capability_modem_type; +static int hf_q931_cause_data; +static int hf_q931_cause_recommendation; +static int hf_q931_bearer_capability_parity; +static int hf_q931_cause_call_rejection_reason; +static int hf_q931_party_category; +static int hf_q931_progress_indicator_location; +static int hf_q931_bearer_capability_packet_window_size; +static int hf_q931_extension_reason; +static int hf_q931_information_rate_minimum_incoming; +static int hf_q931_user_protocol_discriminator; +static int hf_q931_uil2; +static int hf_q931_progress_indicator_description; +static int hf_q931_bearer_capability_mode; +static int hf_q931_not_first_segment; +static int hf_q931_fast_select; +static int hf_q931_netid_plan; +static int hf_q931_cause_call_message_type; +static int hf_q931_reverse_charging_ind; +static int hf_q931_high_layer_compat_data; +static int hf_q931_progress_indicator_data; +static int hf_q931_pl_window_size_forward_value; +static int hf_q931_cause_call_rec_timer; +static int hf_q931_bearer_capability_window_size; +static int hf_q931_cause_call_user_specific_diagnostic; +static int hf_q931_channel_interface_id; +static int hf_q931_uil3_additional; +static int hf_q931_party_subaddr; +static int hf_q931_bearer_capability_rate_multiplier; +static int hf_q931_bearer_capability_data_bits; +static int hf_q931_cug_index_code; +static int hf_q931_bearer_capability_default_packet_size; +static int hf_q931_notification_description; +static int hf_q931_information_rate_outgoing; +static int hf_q931_user_information_len; +static int hf_q931_pl_window_size_backward_value; +static int hf_q931_repeat_indicator; +static int hf_q931_cause_call_diagnostic; +static int hf_q931_netid; +static int hf_q931_cause_call_condition; +static int hf_q931_signal; +static int hf_q931_congestion_level; +static int hf_q931_bearer_capability_intermediate_rate; +static int hf_q931_netid_type; +static int hf_q931_information_rate_incoming; +static int hf_q931_party_subaddr_odd_even_indicator; +static int hf_q931_cug_indication; +static int hf_q931_multiple_frame_establishment; +static int hf_q931_message_originator; +static int hf_q931_out_band_negotiation; +static int hf_q931_negotiation_is_done; +static int hf_q931_layer_1; +static int hf_q931_accept_data_flow_control; +static int hf_q931_mode_of_operation; +static int hf_q931_extension_condition_type; +static int hf_q931_pl_binary_confirmation; +static int hf_q931_pl_request; +static int hf_q931_pl_modulus; +static int hf_q931_network_service; +static int hf_q931_extension_condition; +static int hf_q931_rate_adaption_header; +static int hf_q931_send_data_net_independent_clock; +static int hf_q931_bearer_capability_duplex; +static int hf_q931_accept_data_net_independent_clock; +static int hf_q931_send_data_flow_control; +static int hf_q931_data; +static int hf_q931_layer_1_in_band_negotiation; +static int hf_q931_information_element; +static int hf_q931_information_element_len; +static int hf_q931_date_time; +static int hf_q931_more_data; +static int hf_q931_sending_complete; +static int hf_q931_message_segment; +static int hf_q931_missing_info_element; +static int hf_q931_insufficient_info_element; +static int hf_q931_cumulative_transit_delay; +static int hf_q931_requested_end_to_end_transit_delay; +static int hf_q931_maximum_end_to_end_transit_delay; +static int hf_q931_transit_delay; +static int hf_q931_display_information; +static int hf_q931_keypad_facility; +static int hf_q931_avaya_display; +static int hf_q931_locking_codeset; +static int hf_q931_protocol_negotiation; + + +static int ett_q931; #define NUM_IE 256 -static gint ett_q931_ie[NUM_IE]; +static int ett_q931_ie[NUM_IE]; -static gint ett_q931_segments = -1; -static gint ett_q931_segment = -1; +static int ett_q931_segments; +static int ett_q931_segment; -static expert_field ei_q931_invalid_length = EI_INIT; -static expert_field ei_q931_date_time = EI_INIT; -static expert_field ei_q931_information_element = EI_INIT; -static expert_field ei_q931_incomplete_ie = EI_INIT; +static expert_field ei_q931_invalid_length; +static expert_field ei_q931_date_time; +static expert_field ei_q931_information_element; +static expert_field ei_q931_incomplete_ie; static const fragment_items q931_frag_items = { &ett_q931_segment, @@ -244,14 +246,14 @@ static const fragment_items q931_frag_items = { static reassembly_table q931_reassembly_table; /* Preferences */ -static gboolean q931_reassembly = TRUE; -static gboolean g931_iso_iec_cause = FALSE; +static bool q931_reassembly = true; +static bool g931_iso_iec_cause; static dissector_table_t codeset_dissector_table; static dissector_table_t ie_dissector_table; /* desegmentation of Q.931 over TPKT over TCP */ -static gboolean q931_desegment = TRUE; +static bool q931_desegment = true; /* Subdissectors */ static dissector_handle_t h225_handle; @@ -262,7 +264,7 @@ static heur_dissector_list_t q931_user_heur_subdissector_list; static void dissect_q931_IEs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tree, - proto_tree *q931_tree, gboolean is_over_ip, int offset, int initial_codeset, + proto_tree *q931_tree, bool is_over_ip, int offset, int initial_codeset, q931_packet_info *q931_pi); const value_string q931_message_type_vals[] = { @@ -605,7 +607,7 @@ static void dissect_q931_segmented_message_ie(tvbuff_t *tvb, packet_info *pinfo, int offset, int len, proto_tree *tree, proto_item* item) { - guint8 octet; + uint8_t octet; if (len != 2) { expert_add_info_format(pinfo, item, &ei_q931_invalid_length, @@ -613,7 +615,7 @@ dissect_q931_segmented_message_ie(tvbuff_t *tvb, packet_info *pinfo, int offset, return; } - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); if (octet & 0x80) { proto_tree_add_item(tree, hf_q931_first_segment, tvb, offset, 1, ENC_NA); } else { @@ -722,16 +724,16 @@ static const value_string q931_l1_intermediate_rate_vals[] = { }; static const value_string q931_l1_stop_bits_vals[] = { - { 0x20, "1" }, - { 0x40, "1.5" }, - { 0x60, "2" }, + { 0x01, "1" }, + { 0x02, "1.5" }, + { 0x03, "2" }, { 0, NULL } }; static const value_string q931_l1_data_bits_vals[] = { - { 0x08, "5" }, - { 0x10, "7" }, - { 0x18, "8" }, + { 0x1, "5" }, + { 0x2, "7" }, + { 0x3, "8" }, { 0, NULL } }; @@ -766,8 +768,8 @@ static const value_string q931_uil2_vals[] = { static value_string_ext q931_uil2_vals_ext = VALUE_STRING_EXT_INIT(q931_uil2_vals); static const value_string q931_mode_vals[] = { - { 0x20, "Normal mode" }, - { 0x40, "Extended mode" }, + { 0x1, "Normal mode" }, + { 0x2, "Extended mode" }, { 0, NULL } }; @@ -792,7 +794,7 @@ static const value_string q931_uil3_vals[] = { static void dissect_q931_protocol_discriminator(tvbuff_t *tvb, int offset, proto_tree *tree) { - unsigned int discriminator = tvb_get_guint8(tvb, offset); + unsigned int discriminator = tvb_get_uint8(tvb, offset); if (discriminator == NLPID_DMS) { proto_tree_add_uint_format_value(tree, hf_q931_discriminator, @@ -862,16 +864,16 @@ void dissect_q931_bearer_capability_ie(tvbuff_t *tvb, int offset, int len, proto_tree *tree) { - guint8 octet; - guint8 coding_standard; - guint8 it_rate; - guint8 uil2_protocol; - guint8 uil3_protocol; - guint8 add_l3_info; + uint8_t octet; + uint8_t coding_standard; + uint8_t it_rate; + uint8_t uil2_protocol; + uint8_t uil3_protocol; + uint8_t add_l3_info; if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); coding_standard = octet & 0x60; if (coding_standard != Q931_ITU_STANDARDIZED_CODING) { /* @@ -902,7 +904,7 @@ dissect_q931_bearer_capability_ie(tvbuff_t *tvb, int offset, int len, if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); proto_tree_add_boolean(tree, hf_q931_extension_ind, tvb, offset, 1, octet); proto_tree_add_uint(tree, hf_q931_transfer_mode, tvb, offset, 1, octet); proto_tree_add_uint(tree, hf_q931_information_transfer_rate, tvb, offset, 1, octet); @@ -920,7 +922,7 @@ dissect_q931_bearer_capability_ie(tvbuff_t *tvb, int offset, int len, if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); if ((octet & 0x60) == 0x20) { /* * Layer 1 information. @@ -935,7 +937,7 @@ dissect_q931_bearer_capability_ie(tvbuff_t *tvb, int offset, int len, goto l1_done; if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); proto_tree_add_item(tree, hf_q931_layer_1, tvb, offset, 1, ENC_NA); proto_tree_add_item(tree, hf_q931_layer_1_in_band_negotiation, tvb, offset, 1, ENC_NA); proto_tree_add_item(tree, hf_q931_bearer_capability_user_rate, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -946,7 +948,7 @@ dissect_q931_bearer_capability_ie(tvbuff_t *tvb, int offset, int len, goto l1_done; if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); proto_tree_add_item(tree, hf_q931_bearer_capability_intermediate_rate, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_q931_send_data_net_independent_clock, tvb, offset, 1, ENC_NA); proto_tree_add_item(tree, hf_q931_accept_data_net_independent_clock, tvb, offset, 1, ENC_NA); @@ -959,7 +961,7 @@ dissect_q931_bearer_capability_ie(tvbuff_t *tvb, int offset, int len, goto l1_done; if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); proto_tree_add_item(tree, hf_q931_rate_adaption_header, tvb, offset, 1, ENC_NA); proto_tree_add_item(tree, hf_q931_multiple_frame_establishment, tvb, offset, 1, ENC_NA); proto_tree_add_item(tree, hf_q931_mode_of_operation, tvb, offset, 1, ENC_NA); @@ -973,7 +975,7 @@ dissect_q931_bearer_capability_ie(tvbuff_t *tvb, int offset, int len, goto l1_done; if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); proto_tree_add_item(tree, hf_q931_bearer_capability_stop_bits, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_q931_bearer_capability_data_bits, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_q931_bearer_capability_parity, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -990,7 +992,7 @@ l1_done: if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); if ((octet & 0x60) == 0x40) { /* * Layer 2 information. @@ -1009,7 +1011,7 @@ l1_done: goto l2_done; if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); if (uil2_protocol == Q931_UIL2_USER_SPEC) { proto_tree_add_item(tree, hf_q931_uil2_info, tvb, offset, 1, ENC_BIG_ENDIAN); } else { @@ -1022,7 +1024,7 @@ l1_done: goto l2_done; if (len == 0) return; - octet = tvb_get_guint8(tvb, offset) & 0x7F; + octet = tvb_get_uint8(tvb, offset) & 0x7F; proto_tree_add_uint_format_value(tree, hf_q931_bearer_capability_window_size, tvb, offset, 1, octet, "octet & 0x7F%u k", octet); offset += 1; @@ -1033,7 +1035,7 @@ l2_done: if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); if ((octet & 0x60) == 0x60) { /* * Layer 3 information. @@ -1053,7 +1055,7 @@ l2_done: goto l3_done; if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); switch (uil3_protocol) { case Q931_UIL3_X25_PL: @@ -1067,7 +1069,7 @@ l2_done: goto l3_done; if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); proto_tree_add_item(tree, hf_q931_bearer_capability_default_packet_size, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; len -= 1; @@ -1093,7 +1095,7 @@ l2_done: goto l3_done; if (len < 2) return; - octet = tvb_get_guint8(tvb, offset + 1); + octet = tvb_get_uint8(tvb, offset + 1); add_l3_info |= (octet & 0x0F); proto_tree_add_uint(tree, hf_q931_uil3_additional, tvb, offset, 2, add_l3_info); /*offset += 2;*/ @@ -1270,7 +1272,7 @@ static const value_string q931_rejection_reason_vals[] = { { 0x00, NULL } }; -static const gchar *get_message_name(guint8 prot_discr, guint8 message_type) { +static const char *get_message_name(uint8_t prot_discr, uint8_t message_type) { if (prot_discr == NLPID_DMS) return val_to_str(message_type, dms_message_type_vals, "Unknown (0x%02X)"); else @@ -1281,16 +1283,16 @@ static const true_false_string tfs_abnormal_normal = { "Abnormal", "Normal" }; static void dissect_q931_cause_ie_with_info(tvbuff_t *tvb, int offset, int len, - proto_tree *tree, int hf_cause_value, guint8 *cause_value, const value_string *ie_vals, + proto_tree *tree, int hf_cause_value, uint8_t *cause_value, const value_string *ie_vals, q931_packet_info *q931_pi) { - guint8 octet; - guint8 coding_standard; - guint8 rejection_reason; + uint8_t octet; + uint8_t coding_standard; + uint8_t rejection_reason; if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); coding_standard = octet & 0x60; if (coding_standard != Q931_ITU_STANDARDIZED_CODING && !g931_iso_iec_cause && coding_standard != Q931_ISO_IEC_STANDARDIZED_CODING) { @@ -1311,7 +1313,7 @@ dissect_q931_cause_ie_with_info(tvbuff_t *tvb, int offset, int len, if (!(octet & Q931_IE_VL_EXTENSION)) { if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); proto_tree_add_item(tree, hf_q931_cause_recommendation, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_boolean(tree, hf_q931_extension_ind, tvb, offset, 1, octet); offset += 1; @@ -1320,7 +1322,7 @@ dissect_q931_cause_ie_with_info(tvbuff_t *tvb, int offset, int len, if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); *cause_value = octet & 0x7F; /* add cause value to packet info for use in tap */ @@ -1361,13 +1363,13 @@ dissect_q931_cause_ie_with_info(tvbuff_t *tvb, int offset, int len, case Q931_REJ_IE_MISSING: proto_tree_add_uint_format_value(tree, hf_q931_missing_info_element, tvb, offset, 1, - tvb_get_guint8(tvb, offset), "%s", val_to_str(tvb_get_guint8(tvb, offset), ie_vals, + tvb_get_uint8(tvb, offset), "%s", val_to_str(tvb_get_uint8(tvb, offset), ie_vals, "Unknown (0x%02X)")); break; case Q931_REJ_IE_INSUFFICIENT: proto_tree_add_uint_format_value(tree, hf_q931_insufficient_info_element, tvb, offset, 1, - tvb_get_guint8(tvb, offset), "%s", val_to_str(tvb_get_guint8(tvb, offset), ie_vals, + tvb_get_uint8(tvb, offset), "%s", val_to_str(tvb_get_uint8(tvb, offset), ie_vals, "Unknown (0x%02X)")); break; @@ -1384,7 +1386,7 @@ dissect_q931_cause_ie_with_info(tvbuff_t *tvb, int offset, int len, case Q931_CAUSE_INVALID_IE_CONTENTS: do { proto_tree_add_uint_format_value(tree, hf_q931_information_element, tvb, offset, 1, - tvb_get_guint8(tvb, offset), "%s", val_to_str(tvb_get_guint8(tvb, offset), ie_vals, + tvb_get_uint8(tvb, offset), "%s", val_to_str(tvb_get_uint8(tvb, offset), ie_vals, "Unknown (0x%02X)")); offset += 1; len -= 1; @@ -1409,7 +1411,7 @@ dissect_q931_cause_ie_with_info(tvbuff_t *tvb, int offset, int len, void dissect_q931_cause_ie(tvbuff_t *tvb, int offset, int len, - proto_tree *tree, int hf_cause_value, guint8 *cause_value, const value_string *ie_vals) + proto_tree *tree, int hf_cause_value, uint8_t *cause_value, const value_string *ie_vals) { /* External dissectors have no use for "q931_packet_info". */ dissect_q931_cause_ie_with_info(tvb, offset, len, tree, hf_cause_value, cause_value, ie_vals, NULL); @@ -1473,12 +1475,12 @@ static void dissect_q931_call_state_ie(tvbuff_t *tvb, int offset, int len, proto_tree *tree) { - guint8 octet; - guint8 coding_standard; + uint8_t octet; + uint8_t coding_standard; if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); coding_standard = octet & 0x60; proto_tree_add_uint(tree, hf_q931_coding_standard, tvb, offset, 1, octet); if (coding_standard != Q931_ITU_STANDARDIZED_CODING) { @@ -1527,12 +1529,12 @@ static void dissect_q931_channel_identification_ie(tvbuff_t *tvb, int offset, int len, proto_tree *tree) { - guint8 octet; - guint8 coding_standard; + uint8_t octet; + uint8_t coding_standard; if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); proto_tree_add_item(tree, hf_q931_extension_ind, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_q931_channel_interface_explicit, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -1549,14 +1551,14 @@ dissect_q931_channel_identification_ie(tvbuff_t *tvb, int offset, int len, len -= 1; if (octet & Q931_INTERFACE_IDENTIFIED) { - guint8 octet2; - guint32 identifier_val = 0; + uint8_t octet2; + uint32_t identifier_val = 0; int identifier_offset = offset; int identifier_len = 0; do { if (len == 0) break; - octet2 = tvb_get_guint8(tvb, offset); + octet2 = tvb_get_uint8(tvb, offset); offset += 1; len -= 1; identifier_len++; @@ -1573,7 +1575,7 @@ dissect_q931_channel_identification_ie(tvbuff_t *tvb, int offset, int len, if (octet & Q931_NOT_BASIC_CHANNEL) { if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); coding_standard = octet & 0x60; proto_tree_add_item(tree, hf_q931_extension_ind, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_uint(tree, hf_q931_coding_standard, tvb, offset, 1, octet); @@ -1599,11 +1601,11 @@ dissect_q931_channel_identification_ie(tvbuff_t *tvb, int offset, int len, len -= 1; } } else { - guint8 octet2; + uint8_t octet2; do { if (len == 0) break; - octet2 = tvb_get_guint8(tvb, offset); + octet2 = tvb_get_uint8(tvb, offset); proto_tree_add_item(tree, hf_q931_extension_ind, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree,hf_q931_channel_number,tvb,offset,1,ENC_BIG_ENDIAN); @@ -1633,12 +1635,12 @@ void dissect_q931_progress_indicator_ie(tvbuff_t *tvb, int offset, int len, proto_tree *tree) { - guint8 octet; - guint8 coding_standard; + uint8_t octet; + uint8_t coding_standard; if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); coding_standard = octet & 0x60; proto_tree_add_uint(tree, hf_q931_coding_standard, tvb, offset, 1, octet); if (coding_standard != Q931_ITU_STANDARDIZED_CODING) { @@ -1664,9 +1666,9 @@ dissect_q931_progress_indicator_ie(tvbuff_t *tvb, int offset, int len, * information element. */ static const value_string q931_netid_type_vals[] = { - { 0x00, "User specified" }, - { 0x20, "National network identification" }, - { 0x30, "International network identification" }, + { 0x0, "User specified" }, + { 0x2, "National network identification" }, + { 0x3, "International network identification" }, { 0, NULL } }; @@ -1681,12 +1683,12 @@ static void dissect_q931_ns_facilities_ie(tvbuff_t *tvb, int offset, int len, proto_tree *tree) { - guint8 octet; + uint8_t octet; int netid_len; if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); netid_len = octet & 0x7F; proto_tree_add_item(tree, hf_q931_netid_length, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; @@ -1753,12 +1755,12 @@ dissect_q931_date_time_ie(tvbuff_t *tvb, packet_info* pinfo, int offset, int len * 1-origin? Q.931 doesn't say.... */ proto_tree_add_bytes_format_value(tree, hf_q931_date_time, tvb, offset, 6, NULL, "%02u-%02u-%02u %02u:%02u:%02u", - tvb_get_guint8(tvb, offset + 0), tvb_get_guint8(tvb, offset + 1), tvb_get_guint8(tvb, offset + 2), - tvb_get_guint8(tvb, offset + 3), tvb_get_guint8(tvb, offset + 4), tvb_get_guint8(tvb, offset + 5)); + tvb_get_uint8(tvb, offset + 0), tvb_get_uint8(tvb, offset + 1), tvb_get_uint8(tvb, offset + 2), + tvb_get_uint8(tvb, offset + 3), tvb_get_uint8(tvb, offset + 4), tvb_get_uint8(tvb, offset + 5)); } else if (len == 5) { proto_tree_add_bytes_format_value(tree, hf_q931_date_time, tvb, offset, 5, NULL, "%02u-%02u-%02u %02u:%02u:00", - tvb_get_guint8(tvb, offset + 0), tvb_get_guint8(tvb, offset + 1), tvb_get_guint8(tvb, offset + 2), - tvb_get_guint8(tvb, offset + 3), tvb_get_guint8(tvb, offset + 4)); + tvb_get_uint8(tvb, offset + 0), tvb_get_uint8(tvb, offset + 1), tvb_get_uint8(tvb, offset + 2), + tvb_get_uint8(tvb, offset + 3), tvb_get_uint8(tvb, offset + 4)); } else { proto_tree_add_expert_format(tree, pinfo, &ei_q931_date_time, tvb, offset, len, "Date/time: length is %d, should be 5 or 6", len); } @@ -1839,16 +1841,16 @@ dissect_q931_information_rate_ie(tvbuff_t *tvb, packet_info *pinfo, int offset, } static int -dissect_q931_guint16_value(tvbuff_t *tvb, packet_info *pinfo, int offset, int len, +dissect_q931_uint16_value(tvbuff_t *tvb, packet_info *pinfo, int offset, int len, proto_tree *tree, proto_item* item, int hf_value) { - guint8 octet; - guint16 value; + uint8_t octet; + uint16_t value; int value_len; value_len = 0; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); if (octet & Q931_IE_VL_EXTENSION) { /* * Only one octet long - error. @@ -1866,7 +1868,7 @@ dissect_q931_guint16_value(tvbuff_t *tvb, packet_info *pinfo, int offset, int le */ goto past_end; } - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); if (octet & Q931_IE_VL_EXTENSION) { /* * Only two octets long - error. @@ -1884,7 +1886,7 @@ dissect_q931_guint16_value(tvbuff_t *tvb, packet_info *pinfo, int offset, int le */ goto past_end; } - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); if (!(octet & Q931_IE_VL_EXTENSION)) { /* * More than three octets long - error. @@ -1921,7 +1923,7 @@ dissect_q931_e2e_transit_delay_ie(tvbuff_t *tvb, packet_info *pinfo, int offset, if (len == 0) return; - value_len = dissect_q931_guint16_value(tvb, pinfo, offset, len, tree, item, hf_q931_cumulative_transit_delay); + value_len = dissect_q931_uint16_value(tvb, pinfo, offset, len, tree, item, hf_q931_cumulative_transit_delay); if (value_len < 0) return; /* error */ offset += value_len; @@ -1929,7 +1931,7 @@ dissect_q931_e2e_transit_delay_ie(tvbuff_t *tvb, packet_info *pinfo, int offset, if (len == 0) return; - value_len = dissect_q931_guint16_value(tvb, pinfo, offset, len, tree, item, hf_q931_requested_end_to_end_transit_delay); + value_len = dissect_q931_uint16_value(tvb, pinfo, offset, len, tree, item, hf_q931_requested_end_to_end_transit_delay); if (value_len < 0) return; /* error */ offset += value_len; @@ -1937,7 +1939,7 @@ dissect_q931_e2e_transit_delay_ie(tvbuff_t *tvb, packet_info *pinfo, int offset, if (len == 0) return; - dissect_q931_guint16_value(tvb, pinfo, offset, len, tree, item, hf_q931_maximum_end_to_end_transit_delay); + dissect_q931_uint16_value(tvb, pinfo, offset, len, tree, item, hf_q931_maximum_end_to_end_transit_delay); } /* @@ -1949,17 +1951,17 @@ dissect_q931_td_selection_and_int_ie(tvbuff_t *tvb, packet_info *pinfo, int offs { if (len == 0) return; - dissect_q931_guint16_value(tvb, pinfo, offset, len, tree, item, hf_q931_transit_delay); + dissect_q931_uint16_value(tvb, pinfo, offset, len, tree, item, hf_q931_transit_delay); } /* * Dissect a Packet layer binary parameters information element. */ static const value_string q931_fast_selected_vals[] = { - { 0x00, "Fast select not requested" }, - { 0x08, "Fast select not requested" }, - { 0x10, "Fast select requested with no restriction of response" }, - { 0x18, "Fast select requested with restrictions of response" }, + { 0x0, "Fast select not requested" }, + { 0x1, "Fast select not requested" }, + { 0x2, "Fast select requested with no restriction of response" }, + { 0x3, "Fast select requested with restrictions of response" }, { 0x00, NULL } }; @@ -2114,12 +2116,12 @@ static void dissect_q931_number_ie(packet_info *pinfo, tvbuff_t *tvb, int offset, int len, proto_tree *tree, int hfindex, e164_info_t e164_info, q931_packet_info *q931_pi) { - guint8 octet; - gint number_plan; + uint8_t octet; + int number_plan; if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); number_plan = octet & 0x0f; e164_info.nature_of_address = ( octet & 0x70 ) >> 4; proto_tree_add_uint(tree, hf_q931_numbering_plan, tvb, offset, 1, octet); @@ -2132,7 +2134,7 @@ dissect_q931_number_ie(packet_info *pinfo, tvbuff_t *tvb, int offset, int len, if (!(octet & Q931_IE_VL_EXTENSION)) { if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); proto_tree_add_uint(tree, hf_q931_screening_ind, tvb, offset, 1, octet); proto_tree_add_uint(tree, hf_q931_presentation_ind, tvb, offset, 1, octet); proto_tree_add_boolean(tree, hf_q931_extension_ind, tvb, offset, 1, octet); @@ -2176,14 +2178,14 @@ dissect_q931_number_ie(packet_info *pinfo, tvbuff_t *tvb, int offset, int len, * Dissect a party subaddress information element. */ static const value_string q931_subaddress_type_vals[] = { - { 0x00, "X.213/ISO 8348 Add.2 NSAP" }, - { 0x20, "User-specified" }, + { 0x0, "X.213/ISO 8348 Add.2 NSAP" }, + { 0x2, "User-specified" }, { 0, NULL } }; static const value_string q931_odd_even_indicator_vals[] = { - { 0x00, "Even number of address signals" }, - { 0x08, "Odd number of address signals" }, + { 0x0, "Even number of address signals" }, + { 0x1, "Odd number of address signals" }, { 0, NULL } }; @@ -2304,14 +2306,14 @@ void dissect_q931_high_layer_compat_ie(tvbuff_t *tvb, int offset, int len, proto_tree *tree) { - guint8 octet; - guint8 coding_standard; - guint8 pres_method; - guint8 characteristics; + uint8_t octet; + uint8_t coding_standard; + uint8_t pres_method; + uint8_t characteristics; if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); coding_standard = octet & 0x60; pres_method = octet & 0x03; @@ -2333,7 +2335,7 @@ dissect_q931_high_layer_compat_ie(tvbuff_t *tvb, int offset, int len, if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); characteristics = octet & 0x7F; proto_tree_add_item(tree, hf_q931_extension_ind, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -2345,7 +2347,7 @@ dissect_q931_high_layer_compat_ie(tvbuff_t *tvb, int offset, int len, if (!(octet & Q931_IE_VL_EXTENSION)) { if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); if ((characteristics == Q931_AUDIOVISUAL) || (characteristics == 0x61) || (characteristics == 0x62) || (characteristics == 0x68)) { proto_tree_add_item(tree, hf_q931_extension_ind, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -2384,13 +2386,13 @@ void dissect_q931_user_user_ie(tvbuff_t *tvb, packet_info *pinfo, int offset, int len, proto_tree *tree) { - guint8 octet; + uint8_t octet; tvbuff_t *next_tvb = NULL; heur_dtbl_entry_t *hdtbl_entry; if (len == 0) return; - octet = tvb_get_guint8(tvb, offset); + octet = tvb_get_uint8(tvb, offset); proto_tree_add_item(tree, hf_q931_user_protocol_discriminator, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; len -= 1; @@ -2445,32 +2447,32 @@ dissect_q931_party_category_ie(tvbuff_t *tvb, int offset, int len, * Dissect information elements consisting of ASCII^H^H^H^H^HIA5 text. */ static void -dissect_q931_ia5_ie(tvbuff_t *tvb, int offset, int len, proto_tree *tree, +dissect_q931_ia5_ie(tvbuff_t *tvb, int offset, int len, packet_info *pinfo, proto_tree *tree, int hf_value) { if (len != 0) { proto_tree_add_item(tree, hf_value, tvb, offset, len, ENC_ASCII|ENC_NA); - proto_item_append_text(proto_tree_get_parent(tree), " '%s'", tvb_format_text(wmem_packet_scope(), tvb, offset, len)); + proto_item_append_text(proto_tree_get_parent(tree), " '%s'", tvb_format_text(pinfo->pool, tvb, offset, len)); } } static void dissect_q931_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, - gboolean is_over_ip) + bool is_over_ip) { int offset = 0; proto_tree *q931_tree = NULL; proto_tree *ie_tree = NULL; proto_item *ti; - guint8 prot_discr; - guint8 call_ref_len; - guint8 call_ref[16]; - guint32 call_ref_val; - guint8 message_type, segmented_message_type; - guint8 info_element; - guint16 info_element_len; - gboolean first_frag, more_frags; - guint32 frag_len; + uint8_t prot_discr; + uint8_t call_ref_len; + uint8_t call_ref[16]; + uint32_t call_ref_val; + uint8_t message_type, segmented_message_type; + uint8_t info_element; + uint16_t info_element_len; + bool first_frag, more_frags; + uint32_t frag_len; fragment_head *fd_head; tvbuff_t *next_tvb = NULL; q931_packet_info *q931_pi = NULL; @@ -2482,7 +2484,7 @@ dissect_q931_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, col_set_str(pinfo->cinfo, COL_PROTOCOL, "Q.931"); - prot_discr = tvb_get_guint8(tvb, offset); + prot_discr = tvb_get_uint8(tvb, offset); ti = proto_tree_add_item(tree, proto_q931, tvb, offset, -1, ENC_NA); if (tree) { q931_tree = proto_item_add_subtree(ti, ett_q931); @@ -2490,13 +2492,13 @@ dissect_q931_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dissect_q931_protocol_discriminator(tvb, offset, q931_tree); } offset += 1; - call_ref_len = tvb_get_guint8(tvb, offset) & 0xF; /* XXX - do as a bit field? */ + call_ref_len = tvb_get_uint8(tvb, offset) & 0xF; /* XXX - do as a bit field? */ if (q931_tree != NULL) proto_tree_add_uint(q931_tree, hf_q931_call_ref_len, tvb, offset, 1, call_ref_len); offset += 1; switch (call_ref_len) { case 0: call_ref_val = 0; break; - case 1: call_ref_val = tvb_get_guint8(tvb, offset); break; + case 1: call_ref_val = tvb_get_uint8(tvb, offset); break; case 2: call_ref_val = tvb_get_ntohs(tvb, offset); break; case 3: call_ref_val = tvb_get_ntoh24(tvb, offset); break; default: call_ref_val = tvb_get_ntohl(tvb, offset); @@ -2513,11 +2515,11 @@ dissect_q931_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { /* info for the tap */ call_ref[0] &= 0x7F; } - /* XXX - Should crv be something besides a guint32? */ + /* XXX - Should crv be something besides a uint32_t? */ memcpy(&(q931_pi->crv), call_ref, call_ref_len > sizeof(q931_pi->crv) ? sizeof(q931_pi->crv) : call_ref_len ); offset += call_ref_len; } - message_type = tvb_get_guint8(tvb, offset); + message_type = tvb_get_uint8(tvb, offset); q931_pi->message_type = message_type; col_add_str(pinfo->cinfo, COL_INFO, get_message_name(prot_discr, message_type)); @@ -2536,8 +2538,8 @@ dissect_q931_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dissect_q931_IEs(tvb, pinfo, tree, q931_tree, is_over_ip, offset, 0, q931_pi); return; } - info_element = tvb_get_guint8(tvb, offset); - info_element_len = tvb_get_guint8(tvb, offset + 1); + info_element = tvb_get_uint8(tvb, offset); + info_element_len = tvb_get_uint8(tvb, offset + 1); if ((info_element != Q931_IE_SEGMENTED_MESSAGE) || (info_element_len < 2)) { dissect_q931_IEs(tvb, pinfo, tree, q931_tree, is_over_ip, offset, 0, q931_pi); return; @@ -2549,9 +2551,9 @@ dissect_q931_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, "%s", val_to_str(info_element, q931_info_element_vals[0], "Unknown (0x%02X)")); proto_tree_add_item(ie_tree, hf_q931_information_element_len, tvb, offset + 1, 1, ENC_NA); dissect_q931_segmented_message_ie(tvb, pinfo, offset + 2, info_element_len, ie_tree, ti); - first_frag = (tvb_get_guint8(tvb, offset + 2) & 0x80) != 0; - more_frags = (tvb_get_guint8(tvb, offset + 2) & 0x7F) != 0; - segmented_message_type = tvb_get_guint8(tvb, offset + 3); + first_frag = (tvb_get_uint8(tvb, offset + 2) & 0x80) != 0; + more_frags = (tvb_get_uint8(tvb, offset + 2) & 0x7F) != 0; + segmented_message_type = tvb_get_uint8(tvb, offset + 3); col_append_fstr(pinfo->cinfo, COL_INFO, " of %s", val_to_str_ext(segmented_message_type, &q931_message_type_vals_ext, "Unknown message type (0x%02X)")); @@ -2601,16 +2603,16 @@ static const value_string q931_codeset_vals[] = { static void dissect_q931_IEs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tree, - proto_tree *q931_tree, gboolean is_over_ip, int offset, int initial_codeset, + proto_tree *q931_tree, bool is_over_ip, int offset, int initial_codeset, q931_packet_info *q931_pi) { proto_item *ti; proto_tree *ie_tree = NULL; - guint8 info_element; - guint8 dummy; - guint16 info_element_len; + uint8_t info_element; + uint8_t dummy; + uint16_t info_element_len; int codeset, locked_codeset; - gboolean non_locking_shift, first_segment; + bool non_locking_shift, first_segment; tvbuff_t *h225_tvb, *next_tvb; e164_info_t e164_info; e164_info.e164_number_type = NONE; @@ -2619,9 +2621,9 @@ dissect_q931_IEs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tree, e164_info.E164_number_length = NONE; codeset = locked_codeset = initial_codeset; - first_segment = FALSE; + first_segment = false; while (tvb_reported_length_remaining(tvb, offset) > 0) { - info_element = tvb_get_guint8(tvb, offset); + info_element = tvb_get_uint8(tvb, offset); /* Check for the codeset shift */ if ((info_element & Q931_IE_SO_MASK) && @@ -2710,8 +2712,8 @@ dissect_q931_IEs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tree, * IE with ASN.1 encoding of the user information. */ if (is_over_ip && tvb_bytes_exist(tvb, offset, 4) && - codeset == 0 && tvb_get_guint8(tvb, offset) == Q931_IE_USER_USER && - tvb_get_guint8(tvb, offset + 3) == Q931_PROTOCOL_DISCRIMINATOR_ASN1) { + codeset == 0 && tvb_get_uint8(tvb, offset) == Q931_IE_USER_USER && + tvb_get_uint8(tvb, offset + 3) == Q931_PROTOCOL_DISCRIMINATOR_ASN1) { info_element_len = tvb_get_ntohs(tvb, offset + 1); if (q931_tree != NULL) { ie_tree = proto_tree_add_subtree(q931_tree, tvb, offset, @@ -2758,7 +2760,7 @@ dissect_q931_IEs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tree, } offset += 1 + 2 + info_element_len; } else { - info_element_len = tvb_get_guint8(tvb, offset + 1); + info_element_len = tvb_get_uint8(tvb, offset + 1); if (first_segment && (tvb_reported_length_remaining(tvb, offset + 2) < info_element_len)) { /* incomplete IE at the end of the 1st segment */ proto_tree_add_expert(q931_tree, pinfo, &ei_q931_incomplete_ie, tvb, offset, -1); @@ -2789,10 +2791,10 @@ dissect_q931_IEs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tree, if (((codeset << 8) | info_element) == (CS0 | Q931_IE_SEGMENTED_MESSAGE)) { dissect_q931_segmented_message_ie(tvb, pinfo, offset + 2, info_element_len, ie_tree, ti); col_append_fstr(pinfo->cinfo, COL_INFO, " of %s", - val_to_str_ext(tvb_get_guint8(tvb, offset + 3), &q931_message_type_vals_ext, "Unknown message type (0x%02X)")); + val_to_str_ext(tvb_get_uint8(tvb, offset + 3), &q931_message_type_vals_ext, "Unknown message type (0x%02X)")); - if (tvb_get_guint8(tvb, offset + 2) & 0x80) { /* the 1st segment */ - first_segment = TRUE; + if (tvb_get_uint8(tvb, offset + 2) & 0x80) { /* the 1st segment */ + first_segment = true; } else { /* not the 1st segment */ proto_tree_add_item(q931_tree, hf_q931_message_segment, tvb, offset + 4, -1, ENC_NA); info_element_len += tvb_reported_length_remaining(tvb, offset + 4); @@ -2875,7 +2877,7 @@ dissect_q931_IEs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tree, case CS0 | Q931_IE_DISPLAY: if (q931_tree != NULL) { - dissect_q931_ia5_ie(tvb, offset + 2, info_element_len, ie_tree, hf_q931_display_information); + dissect_q931_ia5_ie(tvb, offset + 2, info_element_len, pinfo, ie_tree, hf_q931_display_information); } break; @@ -2887,7 +2889,7 @@ dissect_q931_IEs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tree, case CS0 | Q931_IE_KEYPAD_FACILITY: if (q931_tree != NULL) { - dissect_q931_ia5_ie(tvb, offset + 2, info_element_len, ie_tree, hf_q931_keypad_facility); + dissect_q931_ia5_ie(tvb, offset + 2, info_element_len, pinfo, ie_tree, hf_q931_keypad_facility); } break; @@ -3031,7 +3033,7 @@ dissect_q931_IEs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tree, case CS6 | Q931_IE_DISPLAY: if (q931_tree != NULL) { - dissect_q931_ia5_ie(tvb, offset + 2, info_element_len, ie_tree, hf_q931_avaya_display); + dissect_q931_ia5_ie(tvb, offset + 2, info_element_len, pinfo, ie_tree, hf_q931_avaya_display); } break; @@ -3055,7 +3057,7 @@ dissect_q931_IEs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tree, /* * Q.931-over-TPKT-over-TCP. */ -static gboolean +static bool dissect_q931_tpkt_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { int lv_tpkt_len; @@ -3074,7 +3076,7 @@ dissect_q931_tpkt_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void /* * It's not a TPKT packet; reject it. */ - return FALSE; + return false; } /* @@ -3090,7 +3092,7 @@ dissect_q931_tpkt_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void */ dissect_tpkt_encap(tvb, pinfo, tree, q931_desegment, q931_tpkt_pdu_handle); - return TRUE; + return true; } /* @@ -3107,12 +3109,12 @@ dissect_q931_tpkt_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * to "is_tpkt()"). */ if (!tvb_bytes_exist(tvb, 4, 3)) - return FALSE; + return false; /* Check the protocol discriminator */ - if ((tvb_get_guint8(tvb, 4) != NLPID_Q_931) && (tvb_get_guint8(tvb, 4) != 0x03)) { + if ((tvb_get_uint8(tvb, 4) != NLPID_Q_931) && (tvb_get_uint8(tvb, 4) != 0x03)) { /* Doesn't look like Q.931 inside TPKT */ - return FALSE; + return false; } /* @@ -3122,7 +3124,7 @@ dissect_q931_tpkt_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void dissect_tpkt_encap(tvb, pinfo, tree, q931_desegment, q931_tpkt_pdu_handle); - return TRUE; + return true; } static int @@ -3135,43 +3137,43 @@ dissect_q931_tpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dat static int dissect_q931_tpkt_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - dissect_q931_pdu(tvb, pinfo, tree, TRUE); + dissect_q931_pdu(tvb, pinfo, tree, true); return tvb_captured_length(tvb); } static int dissect_q931(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - dissect_q931_pdu(tvb, pinfo, tree, FALSE); + dissect_q931_pdu(tvb, pinfo, tree, false); return tvb_captured_length(tvb); } static int dissect_q931_over_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - dissect_q931_pdu(tvb, pinfo, tree, TRUE); + dissect_q931_pdu(tvb, pinfo, tree, true); return tvb_captured_length(tvb); } static int dissect_q931_ie_cs0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - dissect_q931_IEs(tvb, pinfo, NULL, tree, FALSE, 0, 0, NULL); + dissect_q931_IEs(tvb, pinfo, NULL, tree, false, 0, 0, NULL); return tvb_captured_length(tvb); } static int dissect_q931_ie_cs7(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) { - dissect_q931_IEs(tvb, pinfo, NULL, tree, FALSE, 0, 7, NULL); + dissect_q931_IEs(tvb, pinfo, NULL, tree, false, 0, 7, NULL); return tvb_captured_length(tvb); } void proto_register_q931(void) { - guint i; - guint last_offset; + unsigned i; + unsigned last_offset; static hf_register_info hf[] = { { &hf_q931_discriminator, @@ -3386,12 +3388,12 @@ proto_register_q931(void) /* Generated from convert_proto_tree_add_text.pl */ { &hf_q931_first_segment, { "First segment", "q931.segment.first", - FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_segment_remaining, 0x7F, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, UNS(&units_segment_remaining), 0x7F, NULL, HFILL } }, { &hf_q931_not_first_segment, { "Not first segment", "q931.segment.not_first", - FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_segment_remaining, 0x7F, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, UNS(&units_segment_remaining), 0x7F, NULL, HFILL } }, { &hf_q931_bearer_capability_data, @@ -3461,7 +3463,7 @@ proto_register_q931(void) }, { &hf_q931_bearer_capability_default_packet_size, { "Default packet size", "q931.bearer_capability.default_packet_size", - FT_UINT8, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0F, + FT_UINT8, BASE_DEC|BASE_UNIT_STRING, UNS(&units_octet_octets), 0x0F, NULL, HFILL } }, { &hf_q931_bearer_capability_packet_window_size, @@ -3686,7 +3688,7 @@ proto_register_q931(void) }, { &hf_q931_user_information_len, { "User information", "q931.user.len", - FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_octet_octets, 0x0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_octet_octets), 0x0, NULL, HFILL } }, { &hf_q931_user_information_str, @@ -3856,22 +3858,22 @@ proto_register_q931(void) }, { &hf_q931_cumulative_transit_delay, { "Cumulative transit delay", "q931.cumulative_transit_delay", - FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x0, NULL, HFILL } }, { &hf_q931_requested_end_to_end_transit_delay, { "Requested end-to-end transit delay", "q931.requested_end_to_end_transit_delay", - FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x0, NULL, HFILL } }, { &hf_q931_maximum_end_to_end_transit_delay, { "Maximum end-to-end transit delay", "q931.maximum_end_to_end_transit_delay", - FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x0, NULL, HFILL } }, { &hf_q931_transit_delay, { "Transit delay", "q931.transit_delay", - FT_UINT16, BASE_DEC|BASE_UNIT_STRING, &units_milliseconds, 0x0, + FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliseconds), 0x0, NULL, HFILL } }, { &hf_q931_display_information, @@ -3902,7 +3904,7 @@ proto_register_q931(void) }; #define NUM_INDIVIDUAL_ELEMS 3 - static gint *ett[NUM_INDIVIDUAL_ELEMS + NUM_IE]; + static int *ett[NUM_INDIVIDUAL_ELEMS + NUM_IE]; static ei_register_info ei[] = { { &ei_q931_invalid_length, { "q931.invalid_length", PI_MALFORMED, PI_ERROR, "Invalid length", EXPFILL }}, @@ -3922,7 +3924,6 @@ proto_register_q931(void) for (i=0; i < NUM_IE; i++, last_offset++) { - ett_q931_ie[i] = -1; ett[last_offset] = &ett_q931_ie[i]; } @@ -3946,7 +3947,7 @@ proto_register_q931(void) /* subdissector code */ codeset_dissector_table = register_dissector_table("q931.codeset", "Q.931 Codeset", proto_q931, FT_UINT8, BASE_HEX); ie_dissector_table = register_dissector_table("q931.ie", "Q.931 IE", proto_q931, FT_UINT16, BASE_HEX); - q931_user_heur_subdissector_list = register_heur_dissector_list("q931_user", proto_q931); + q931_user_heur_subdissector_list = register_heur_dissector_list_with_description("q931_user", "Q.931 IE User payload", proto_q931); q931_module = prefs_register_protocol(proto_q931, NULL); prefs_register_bool_preference(q931_module, "desegment_h323_messages", |