diff options
Diffstat (limited to 'epan/dissectors/packet-iua.c')
-rw-r--r-- | epan/dissectors/packet-iua.c | 101 |
1 files changed, 50 insertions, 51 deletions
diff --git a/epan/dissectors/packet-iua.c b/epan/dissectors/packet-iua.c index c4f7d51cba..4ef24b3aa0 100644 --- a/epan/dissectors/packet-iua.c +++ b/epan/dissectors/packet-iua.c @@ -24,6 +24,7 @@ #include <epan/sctpppids.h> #include <epan/lapd_sapi.h> #include <wsutil/str_util.h> +#include <wsutil/ws_roundup.h> void proto_register_iua(void); void proto_reg_handoff_iua(void); @@ -36,44 +37,44 @@ static dissector_table_t lapd_gsm_sapi_dissector_table; static gboolean global_iua_gsm_sapis = TRUE; /* Initialize the protocol and registered fields */ -static int proto_iua = -1; -static int hf_int_interface_id = -1; -static int hf_text_interface_id = -1; -static int hf_info_string = -1; -static int hf_dlci_zero_bit = -1; -static int hf_dlci_spare_bit = -1; -static int hf_dlci_sapi = -1; -static int hf_dlci_gsm_sapi = -1; -static int hf_dlci_one_bit = -1; -static int hf_dlci_tei = -1; -static int hf_dlci_spare = -1; -static int hf_diag_info = -1; -static int hf_interface_range_start = -1; -static int hf_interface_range_end = -1; -static int hf_heartbeat_data = -1; -static int hf_asp_reason = -1; -static int hf_traffic_mode_type = -1; -static int hf_error_code = -1; -static int hf_error_code_ig = -1; -static int hf_status_type = -1; -static int hf_status_id = -1; -static int hf_release_reason = -1; -static int hf_tei_status = -1; -static int hf_asp_id = -1; -static int hf_parameter_tag = -1; -static int hf_parameter_tag_ig = -1; -static int hf_parameter_length = -1; -static int hf_parameter_value = -1; -static int hf_parameter_padding = -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 proto_iua; +static int hf_int_interface_id; +static int hf_text_interface_id; +static int hf_info_string; +static int hf_dlci_zero_bit; +static int hf_dlci_spare_bit; +static int hf_dlci_sapi; +static int hf_dlci_gsm_sapi; +static int hf_dlci_one_bit; +static int hf_dlci_tei; +static int hf_dlci_spare; +static int hf_diag_info; +static int hf_interface_range_start; +static int hf_interface_range_end; +static int hf_heartbeat_data; +static int hf_asp_reason; +static int hf_traffic_mode_type; +static int hf_error_code; +static int hf_error_code_ig; +static int hf_status_type; +static int hf_status_id; +static int hf_release_reason; +static int hf_tei_status; +static int hf_asp_id; +static int hf_parameter_tag; +static int hf_parameter_tag_ig; +static int hf_parameter_length; +static int hf_parameter_value; +static int hf_parameter_padding; +static int hf_version; +static int hf_reserved; +static int hf_message_class; +static int hf_message_type; +static int hf_message_length; /* Initialize the subtree pointers */ -static gint ett_iua = -1; -static gint ett_iua_parameter = -1; +static gint ett_iua; +static gint ett_iua_parameter; /* stores the current SAPI value */ static guint8 sapi_val; @@ -86,8 +87,6 @@ static dissector_handle_t q931_handle; static dissector_handle_t x25_handle; static dissector_handle_t iua_handle; -#define ADD_PADDING(x) ((((x) + 3) >> 2) << 2) - #define PARAMETER_TAG_LENGTH 2 #define PARAMETER_LENGTH_LENGTH 2 #define PARAMETER_HEADER_LENGTH (PARAMETER_TAG_LENGTH + PARAMETER_LENGTH_LENGTH) @@ -120,28 +119,28 @@ dissect_int_interface_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree * #define TEXT_INTERFACE_ID_OFFSET PARAMETER_VALUE_OFFSET static void -dissect_text_interface_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item) +dissect_text_interface_identifier_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, proto_item *parameter_item) { guint16 interface_id_length; interface_id_length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET) - PARAMETER_HEADER_LENGTH; - proto_tree_add_item(parameter_tree, hf_text_interface_id, parameter_tvb, TEXT_INTERFACE_ID_OFFSET, interface_id_length, ENC_ASCII|ENC_NA); - proto_item_append_text(parameter_item, " (%.*s)", interface_id_length, - tvb_format_text(wmem_packet_scope(), parameter_tvb, TEXT_INTERFACE_ID_OFFSET, interface_id_length)); + proto_tree_add_item(parameter_tree, hf_text_interface_id, parameter_tvb, TEXT_INTERFACE_ID_OFFSET, interface_id_length, ENC_ASCII); + proto_item_append_text(parameter_item, " (%s)", + tvb_format_text(pinfo->pool, parameter_tvb, TEXT_INTERFACE_ID_OFFSET, interface_id_length)); } #define INFO_STRING_OFFSET PARAMETER_VALUE_OFFSET static void -dissect_info_string_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item) +dissect_info_string_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, proto_item *parameter_item) { 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, - tvb_format_text(wmem_packet_scope(), parameter_tvb, INFO_STRING_OFFSET, 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(pinfo->pool, parameter_tvb, INFO_STRING_OFFSET, info_string_length)); } #define DLCI_SAPI_LENGTH 1 @@ -532,7 +531,7 @@ static const value_string parameter_tag_values[] = { { ERROR_CODE_PARAMETER_TAG, "Error code" }, { STATUS_TYPE_INDENTIFICATION_PARAMETER_TAG, "Status type/identification" }, { PROTOCOL_DATA_PARAMETER_TAG, "Protocol data" }, - { RELEASE_REASON_PARAMETER_TAG, "Reason" }, + { RELEASE_REASON_PARAMETER_TAG, "Release Reason" }, { TEI_STATUS_PARAMETER_TAG, "TEI status" }, { 0, NULL } }; @@ -548,7 +547,7 @@ static const value_string parameter_tag_ig_values[] = { { ERROR_CODE_PARAMETER_TAG, "Error code" }, { STATUS_TYPE_INDENTIFICATION_PARAMETER_TAG, "Status type/identification" }, { PROTOCOL_DATA_PARAMETER_TAG, "Protocol data" }, - { RELEASE_REASON_PARAMETER_TAG, "Reason" }, + { RELEASE_REASON_PARAMETER_TAG, "Release Reason" }, { TEI_STATUS_PARAMETER_TAG, "TEI status" }, { ASP_IDENTIFIER_PARAMETER_TAG, "ASP identifier"}, { 0, NULL } }; @@ -578,10 +577,10 @@ dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, dissect_int_interface_identifier_parameter(parameter_tvb, parameter_tree, parameter_item); break; case TEXT_INTERFACE_IDENTIFIER_PARAMETER_TAG: - dissect_text_interface_identifier_parameter(parameter_tvb, parameter_tree, parameter_item); + dissect_text_interface_identifier_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item); break; case INFO_PARAMETER_TAG: - dissect_info_string_parameter(parameter_tvb, parameter_tree, parameter_item); + dissect_info_string_parameter(parameter_tvb, pinfo, parameter_tree, parameter_item); break; case DLCI_PARAMETER_TAG: dissect_dlci_parameter(parameter_tvb, parameter_tree); @@ -643,7 +642,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 */ |