diff options
Diffstat (limited to 'epan/dissectors/packet-m2ua.c')
-rw-r--r-- | epan/dissectors/packet-m2ua.c | 97 |
1 files changed, 46 insertions, 51 deletions
diff --git a/epan/dissectors/packet-m2ua.c b/epan/dissectors/packet-m2ua.c index 56bc9a8f6d..f2224677aa 100644 --- a/epan/dissectors/packet-m2ua.c +++ b/epan/dissectors/packet-m2ua.c @@ -22,6 +22,7 @@ #include <epan/sctpppids.h> #include <wsutil/str_util.h> +#include <wsutil/ws_roundup.h> void proto_register_m2ua(void); void proto_reg_handoff_m2ua(void); @@ -29,48 +30,48 @@ void proto_reg_handoff_m2ua(void); #define SCTP_PORT_M2UA 2904 /* Initialize the protocol and registered fields */ -static int proto_m2ua = -1; -static int hf_version = -1; -static int hf_reserved = -1; -static int hf_message_class = -1; -static int hf_message_type = -1; -static int hf_message_length = -1; -static int hf_parameter_tag = -1; -static int hf_parameter_length = -1; -static int hf_parameter_value = -1; -static int hf_parameter_padding = -1; -static int hf_interface_id_int = -1; -static int hf_interface_id_text = -1; -static int hf_info_string = -1; -static int hf_diagnostic_information = -1; -static int hf_interface_id_start = -1; -static int hf_interface_id_stop = -1; -static int hf_heartbeat_data = -1; -static int hf_traffic_mode_type = -1; -static int hf_error_code = -1; -static int hf_status_type = -1; -static int hf_status_ident = -1; -static int hf_asp_id = -1; -static int hf_correlation_id = -1; -static int hf_data_2_li = -1; -static int hf_state = -1; -static int hf_event = -1; -static int hf_congestion_status = -1; -static int hf_discard_status = -1; -static int hf_action = -1; -static int hf_sequence_number = -1; -static int hf_retrieval_result = -1; -static int hf_local_lk_id = -1; -static int hf_sdt_reserved = -1; -static int hf_sdt_id = -1; -static int hf_sdl_reserved = -1; -static int hf_sdl_id = -1; -static int hf_registration_status = -1; -static int hf_deregistration_status = -1; +static int proto_m2ua; +static int hf_version; +static int hf_reserved; +static int hf_message_class; +static int hf_message_type; +static int hf_message_length; +static int hf_parameter_tag; +static int hf_parameter_length; +static int hf_parameter_value; +static int hf_parameter_padding; +static int hf_interface_id_int; +static int hf_interface_id_text; +static int hf_info_string; +static int hf_diagnostic_information; +static int hf_interface_id_start; +static int hf_interface_id_stop; +static int hf_heartbeat_data; +static int hf_traffic_mode_type; +static int hf_error_code; +static int hf_status_type; +static int hf_status_ident; +static int hf_asp_id; +static int hf_correlation_id; +static int hf_data_2_li; +static int hf_state; +static int hf_event; +static int hf_congestion_status; +static int hf_discard_status; +static int hf_action; +static int hf_sequence_number; +static int hf_retrieval_result; +static int hf_local_lk_id; +static int hf_sdt_reserved; +static int hf_sdt_id; +static int hf_sdl_reserved; +static int hf_sdl_id; +static int hf_registration_status; +static int hf_deregistration_status; /* Initialize the subtree pointers */ -static gint ett_m2ua = -1; -static gint ett_m2ua_parameter = -1; +static gint ett_m2ua; +static gint ett_m2ua_parameter; static dissector_handle_t mtp3_handle; static dissector_handle_t m2ua_handle; @@ -78,8 +79,6 @@ static dissector_handle_t m2ua_handle; static void dissect_parameters(tvbuff_t *, packet_info *, proto_tree *, proto_tree *); -#define ADD_PADDING(x) ((((x) + 3) >> 2) << 2) - #define VERSION_LENGTH 1 #define RESERVED_LENGTH 1 #define MESSAGE_CLASS_LENGTH 1 @@ -275,8 +274,8 @@ dissect_interface_identifier_text_parameter(tvbuff_t *parameter_tvb, proto_tree interface_id_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH; - proto_tree_add_item(parameter_tree, hf_interface_id_text, parameter_tvb, TEXT_INTERFACE_ID_OFFSET, interface_id_length, ENC_ASCII|ENC_NA); - proto_item_append_text(parameter_item, " (%.*s)", interface_id_length, + proto_tree_add_item(parameter_tree, hf_interface_id_text, parameter_tvb, TEXT_INTERFACE_ID_OFFSET, interface_id_length, ENC_ASCII); + proto_item_append_text(parameter_item, " (%s)", tvb_format_text(wmem_packet_scope(), parameter_tvb, TEXT_INTERFACE_ID_OFFSET, interface_id_length)); } @@ -288,8 +287,8 @@ dissect_info_string_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tre guint16 info_string_length; info_string_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH; - proto_tree_add_item(parameter_tree, hf_info_string, parameter_tvb, INFO_STRING_OFFSET, info_string_length, ENC_ASCII|ENC_NA); - proto_item_append_text(parameter_item, " (%.*s)", info_string_length, + proto_tree_add_item(parameter_tree, hf_info_string, parameter_tvb, INFO_STRING_OFFSET, info_string_length, ENC_ASCII); + proto_item_append_text(parameter_item, " (%s)", tvb_format_text(wmem_packet_scope(), parameter_tvb, INFO_STRING_OFFSET, info_string_length)); } @@ -885,10 +884,6 @@ dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, if ((protocol_data_1_global == PROTOCOL_DATA_1_DRAFT_7) && (tag == PROTOCOL_DATA_1_DRAFT_7)) { - proto_item *hidden_item; - hidden_item = proto_tree_add_uint(parameter_tree, hf_parameter_tag, parameter_tvb, PARAMETER_TAG_OFFSET, PARAMETER_TAG_LENGTH, tag); - proto_item_set_hidden(hidden_item); - /* add tag and length to the m2ua tree */ proto_tree_add_uint_format_value(parameter_tree, hf_parameter_tag, parameter_tvb, PARAMETER_TAG_OFFSET, PARAMETER_TAG_LENGTH, tag, "Protocol data 1 (0x000e)"); @@ -1007,7 +1002,7 @@ dissect_parameters(tvbuff_t *parameters_tvb, packet_info *pinfo, proto_tree *tre offset = 0; while((remaining_length = tvb_reported_length_remaining(parameters_tvb, offset))) { length = tvb_get_ntohs(parameters_tvb, offset + PARAMETER_LENGTH_OFFSET); - total_length = ADD_PADDING(length); + total_length = WS_ROUNDUP_4(length); if (remaining_length >= length) total_length = MIN(total_length, remaining_length); /* create a tvb for the parameter including the padding bytes */ |