diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:53 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:53 +0000 |
commit | a86c5f7cae7ec9a3398300555a0b644689d946a1 (patch) | |
tree | 39fe4b107c71174fd1e8a8ceb9a4d2aa14116248 /epan/dissectors/packet-atn-ulcs.c | |
parent | Releasing progress-linux version 4.2.6-1~progress7.99u1. (diff) | |
download | wireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.tar.xz wireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.zip |
Merging upstream version 4.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | epan/dissectors/packet-atn-ulcs.c | 416 |
1 files changed, 207 insertions, 209 deletions
diff --git a/epan/dissectors/packet-atn-ulcs.c b/epan/dissectors/packet-atn-ulcs.c index 00983b07..aa948c9d 100644 --- a/epan/dissectors/packet-atn-ulcs.c +++ b/epan/dissectors/packet-atn-ulcs.c @@ -1,7 +1,7 @@ /* Do not modify this file. Changes will be overwritten. */ /* Generated automatically by the ASN.1 to Wireshark dissector compiler */ /* packet-atn-ulcs.c */ -/* asn2wrs.py -u -L -p atn-ulcs -c ./atn-ulcs.cnf -s ./packet-atn-ulcs-template -D . -O ../.. atn-ulcs.asn */ +/* asn2wrs.py -u -q -L -p atn-ulcs -c ./atn-ulcs.cnf -s ./packet-atn-ulcs-template -D . -O ../.. atn-ulcs.asn */ /* packet-atn-ulcs.c * By Mathias Guettler <guettler@web.de> @@ -9,28 +9,26 @@ * * Routines for ATN upper layer * protocol packet disassembly - + * * ATN upper layers are embedded within OSI Layer 4 (COTP). * * ATN upper layers contain: * Session Layer (NUL protocol option) * Presentation Layer (NUL protocol option) * ATN upper Layer/Application (ACSE PDU or PDV-list PDU) - + * * ATN applications protocols (i.e. CM or CPDLC) are contained within * ACSE user-information or PDV presentation data. - + * * details see: - * http://en.wikipedia.org/wiki/CPDLC - * http://members.optusnet.com.au/~cjr/introduction.htm - + * https://en.wikipedia.org/wiki/CPDLC + * https://members.optusnet.com.au/~cjr/introduction.htm + * * standards: - * http://legacy.icao.int/anb/panels/acp/repository.cfm - - * note: - * We are dealing with ATN/ULCS aka ICAO Doc 9705 Ed2 here + * We are dealing with ATN/ULCS aka ICAO Doc 9705 Second Edition here * (don't think there is an ULCS equivalent for "FANS-1/A "). - + * https://www.icao.int/safety/acp/repository/_%20Doc9705_ed2_1999.pdf + * * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs @@ -43,10 +41,10 @@ why not using existing ses, pres and acse dissectors ? ATN upper layers are derived from OSI standards for session, presentation and application but the encoding differs - (it's PER instead of BER encoding to save bandwith). + (it's PER instead of BER encoding to save bandwidth). Session and presentation use the "null" encoding option, meaning that they are only present at connection establishment - and ommitted otherwise. + and omitted otherwise. Instead of adapting existing dissectors it seemed simpler and cleaner to implement everything the new atn-ulcs dissector. @@ -109,6 +107,7 @@ which ATN standard is supported ? #include <epan/packet.h> #include <epan/address.h> #include <epan/conversation.h> +#include <wsutil/array.h> #include <epan/osi-utils.h> #include "packet-ber.h" #include "packet-per.h" @@ -123,18 +122,18 @@ void proto_reg_handoff_atn_ulcs(void); static heur_dissector_list_t atn_ulcs_heur_subdissector_list; /* presentation subdissectors i.e. CM, CPDLC */ -static dissector_handle_t atn_cm_handle = NULL; -static dissector_handle_t atn_cpdlc_handle = NULL; +static dissector_handle_t atn_cm_handle; +static dissector_handle_t atn_cpdlc_handle; -static int proto_atn_ulcs = -1; -static guint32 ulcs_context_value = 0; +static int proto_atn_ulcs; +static uint32_t ulcs_context_value; static const char *object_identifier_id; -static wmem_tree_t *aarq_data_tree = NULL; -static wmem_tree_t *atn_conversation_tree = NULL; +static wmem_tree_t *aarq_data_tree; +static wmem_tree_t *atn_conversation_tree; -static proto_tree *root_tree = NULL; +static proto_tree *root_tree; /* forward declarations for functions generated from asn1 */ static int dissect_atn_ulcs_T_externalt_encoding_single_asn1_type( @@ -165,121 +164,121 @@ static int dissect_ACSE_apdu_PDU( proto_tree *tree _U_, void *data _U_); -guint32 dissect_per_object_descriptor_t( +uint32_t dissect_per_object_descriptor_t( tvbuff_t *tvb, - guint32 offset, + uint32_t offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, tvbuff_t **value_tvb); -static gint dissect_atn_ulcs( +static int dissect_atn_ulcs( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_); -static int hf_atn_ulcs_Fully_encoded_data_PDU = -1; /* Fully_encoded_data */ -static int hf_atn_ulcs_ACSE_apdu_PDU = -1; /* ACSE_apdu */ -static int hf_atn_ulcs_Fully_encoded_data_item = -1; /* PDV_list */ -static int hf_atn_ulcs_transfer_syntax_name = -1; /* Transfer_syntax_name */ -static int hf_atn_ulcs_presentation_context_identifier = -1; /* Presentation_context_identifier */ -static int hf_atn_ulcs_presentation_data_values = -1; /* T_presentation_data_values */ -static int hf_atn_ulcs_pdv_list_presentation_data_values_single_asn1_type = -1; /* T_pdv_list_presentation_data_values_single_asn1_type */ -static int hf_atn_ulcs_octet_aligned = -1; /* OCTET_STRING */ -static int hf_atn_ulcs_pdv_list_presentation_data_values_arbitrary = -1; /* T_pdv_list_presentation_data_values_arbitrary */ -static int hf_atn_ulcs_direct_reference = -1; /* OBJECT_IDENTIFIER */ -static int hf_atn_ulcs_indirect_reference = -1; /* INTEGER */ -static int hf_atn_ulcs_data_value_descriptor = -1; /* T_data_value_descriptor */ -static int hf_atn_ulcs_encoding = -1; /* T_encoding */ -static int hf_atn_ulcs_externalt_encoding_single_asn1_type = -1; /* T_externalt_encoding_single_asn1_type */ -static int hf_atn_ulcs_externalt_encoding_octet_aligned = -1; /* T_externalt_encoding_octet_aligned */ -static int hf_atn_ulcs_externalt_encoding_arbitrary = -1; /* T_externalt_encoding_arbitrary */ -static int hf_atn_ulcs_aarq = -1; /* AARQ_apdu */ -static int hf_atn_ulcs_aare = -1; /* AARE_apdu */ -static int hf_atn_ulcs_rlrq = -1; /* RLRQ_apdu */ -static int hf_atn_ulcs_rlre = -1; /* RLRE_apdu */ -static int hf_atn_ulcs_abrt = -1; /* ABRT_apdu */ -static int hf_atn_ulcs_aarq_apdu_protocol_version = -1; /* T_aarq_apdu_protocol_version */ -static int hf_atn_ulcs_application_context_name = -1; /* Application_context_name */ -static int hf_atn_ulcs_called_AP_title = -1; /* AP_title */ -static int hf_atn_ulcs_called_AE_qualifier = -1; /* AE_qualifier */ -static int hf_atn_ulcs_called_AP_invocation_identifier = -1; /* AP_invocation_identifier */ -static int hf_atn_ulcs_called_AE_invocation_identifier = -1; /* AE_invocation_identifier */ -static int hf_atn_ulcs_calling_AP_title = -1; /* AP_title */ -static int hf_atn_ulcs_calling_AE_qualifier = -1; /* AE_qualifier */ -static int hf_atn_ulcs_calling_AP_invocation_identifier = -1; /* AP_invocation_identifier */ -static int hf_atn_ulcs_calling_AE_invocation_identifier = -1; /* AE_invocation_identifier */ -static int hf_atn_ulcs_sender_acse_requirements = -1; /* ACSE_requirements */ -static int hf_atn_ulcs_mechanism_name = -1; /* Mechanism_name */ -static int hf_atn_ulcs_calling_authentication_value = -1; /* Authentication_value */ -static int hf_atn_ulcs_application_context_name_list = -1; /* Application_context_name_list */ -static int hf_atn_ulcs_implementation_information = -1; /* Implementation_data */ -static int hf_atn_ulcs_user_information = -1; /* Association_information */ -static int hf_atn_ulcs_aare_apdu_protocol_version = -1; /* T_aare_apdu_protocol_version */ -static int hf_atn_ulcs_result = -1; /* Associate_result */ -static int hf_atn_ulcs_result_source_diagnostic = -1; /* Associate_source_diagnostic */ -static int hf_atn_ulcs_responding_AP_title = -1; /* AP_title */ -static int hf_atn_ulcs_responding_AE_qualifier = -1; /* AE_qualifier */ -static int hf_atn_ulcs_responding_AP_invocation_identifier = -1; /* AP_invocation_identifier */ -static int hf_atn_ulcs_responding_AE_invocation_identifier = -1; /* AE_invocation_identifier */ -static int hf_atn_ulcs_responder_acse_requirements = -1; /* ACSE_requirements */ -static int hf_atn_ulcs_responding_authentication_value = -1; /* Authentication_value */ -static int hf_atn_ulcs_rlrq_apdu_request_reason = -1; /* Release_request_reason */ -static int hf_atn_ulcs_rlre_apdu_response_reason = -1; /* Release_response_reason */ -static int hf_atn_ulcs_abort_source = -1; /* ABRT_source */ -static int hf_atn_ulcs_abort_diagnostic = -1; /* ABRT_diagnostic */ -static int hf_atn_ulcs_Application_context_name_list_item = -1; /* Application_context_name */ -static int hf_atn_ulcs_ap_title_form2 = -1; /* AP_title_form2 */ -static int hf_atn_ulcs_ap_title_form1 = -1; /* AP_title_form1 */ -static int hf_atn_ulcs_ae_qualifier_form2 = -1; /* AE_qualifier_form2 */ -static int hf_atn_ulcs_ae_qualifier_form1 = -1; /* AE_qualifier_form1 */ -static int hf_atn_ulcs_acse_service_user = -1; /* T_acse_service_user */ -static int hf_atn_ulcs_acse_service_provider = -1; /* T_acse_service_provider */ -static int hf_atn_ulcs_Association_information_item = -1; /* EXTERNALt */ -static int hf_atn_ulcs_charstring = -1; /* OCTET_STRING */ -static int hf_atn_ulcs_bitstring = -1; /* BIT_STRING */ -static int hf_atn_ulcs_external = -1; /* EXTERNAL */ -static int hf_atn_ulcs_other = -1; /* T_other */ -static int hf_atn_ulcs_other_mechanism_name = -1; /* OBJECT_IDENTIFIER */ -static int hf_atn_ulcs_other_mechanism_value = -1; /* T_other_mechanism_value */ -static int hf_atn_ulcs_rdnSequence = -1; /* RDNSequence */ -static int hf_atn_ulcs_RDNSequence_item = -1; /* RelativeDistinguishedName */ -static int hf_atn_ulcs_RelativeDistinguishedName_item = -1; /* AttributeTypeAndValue */ -static int hf_atn_ulcs_null = -1; /* NULL */ +static int hf_atn_ulcs_Fully_encoded_data_PDU; /* Fully_encoded_data */ +static int hf_atn_ulcs_ACSE_apdu_PDU; /* ACSE_apdu */ +static int hf_atn_ulcs_Fully_encoded_data_item; /* PDV_list */ +static int hf_atn_ulcs_transfer_syntax_name; /* Transfer_syntax_name */ +static int hf_atn_ulcs_presentation_context_identifier; /* Presentation_context_identifier */ +static int hf_atn_ulcs_presentation_data_values; /* T_presentation_data_values */ +static int hf_atn_ulcs_pdv_list_presentation_data_values_single_asn1_type; /* T_pdv_list_presentation_data_values_single_asn1_type */ +static int hf_atn_ulcs_octet_aligned; /* OCTET_STRING */ +static int hf_atn_ulcs_pdv_list_presentation_data_values_arbitrary; /* T_pdv_list_presentation_data_values_arbitrary */ +static int hf_atn_ulcs_direct_reference; /* OBJECT_IDENTIFIER */ +static int hf_atn_ulcs_indirect_reference; /* INTEGER */ +static int hf_atn_ulcs_data_value_descriptor; /* T_data_value_descriptor */ +static int hf_atn_ulcs_encoding; /* T_encoding */ +static int hf_atn_ulcs_externalt_encoding_single_asn1_type; /* T_externalt_encoding_single_asn1_type */ +static int hf_atn_ulcs_externalt_encoding_octet_aligned; /* T_externalt_encoding_octet_aligned */ +static int hf_atn_ulcs_externalt_encoding_arbitrary; /* T_externalt_encoding_arbitrary */ +static int hf_atn_ulcs_aarq; /* AARQ_apdu */ +static int hf_atn_ulcs_aare; /* AARE_apdu */ +static int hf_atn_ulcs_rlrq; /* RLRQ_apdu */ +static int hf_atn_ulcs_rlre; /* RLRE_apdu */ +static int hf_atn_ulcs_abrt; /* ABRT_apdu */ +static int hf_atn_ulcs_aarq_apdu_protocol_version; /* T_aarq_apdu_protocol_version */ +static int hf_atn_ulcs_application_context_name; /* Application_context_name */ +static int hf_atn_ulcs_called_AP_title; /* AP_title */ +static int hf_atn_ulcs_called_AE_qualifier; /* AE_qualifier */ +static int hf_atn_ulcs_called_AP_invocation_identifier; /* AP_invocation_identifier */ +static int hf_atn_ulcs_called_AE_invocation_identifier; /* AE_invocation_identifier */ +static int hf_atn_ulcs_calling_AP_title; /* AP_title */ +static int hf_atn_ulcs_calling_AE_qualifier; /* AE_qualifier */ +static int hf_atn_ulcs_calling_AP_invocation_identifier; /* AP_invocation_identifier */ +static int hf_atn_ulcs_calling_AE_invocation_identifier; /* AE_invocation_identifier */ +static int hf_atn_ulcs_sender_acse_requirements; /* ACSE_requirements */ +static int hf_atn_ulcs_mechanism_name; /* Mechanism_name */ +static int hf_atn_ulcs_calling_authentication_value; /* Authentication_value */ +static int hf_atn_ulcs_application_context_name_list; /* Application_context_name_list */ +static int hf_atn_ulcs_implementation_information; /* Implementation_data */ +static int hf_atn_ulcs_user_information; /* Association_information */ +static int hf_atn_ulcs_aare_apdu_protocol_version; /* T_aare_apdu_protocol_version */ +static int hf_atn_ulcs_result; /* Associate_result */ +static int hf_atn_ulcs_result_source_diagnostic; /* Associate_source_diagnostic */ +static int hf_atn_ulcs_responding_AP_title; /* AP_title */ +static int hf_atn_ulcs_responding_AE_qualifier; /* AE_qualifier */ +static int hf_atn_ulcs_responding_AP_invocation_identifier; /* AP_invocation_identifier */ +static int hf_atn_ulcs_responding_AE_invocation_identifier; /* AE_invocation_identifier */ +static int hf_atn_ulcs_responder_acse_requirements; /* ACSE_requirements */ +static int hf_atn_ulcs_responding_authentication_value; /* Authentication_value */ +static int hf_atn_ulcs_rlrq_apdu_request_reason; /* Release_request_reason */ +static int hf_atn_ulcs_rlre_apdu_response_reason; /* Release_response_reason */ +static int hf_atn_ulcs_abort_source; /* ABRT_source */ +static int hf_atn_ulcs_abort_diagnostic; /* ABRT_diagnostic */ +static int hf_atn_ulcs_Application_context_name_list_item; /* Application_context_name */ +static int hf_atn_ulcs_ap_title_form2; /* AP_title_form2 */ +static int hf_atn_ulcs_ap_title_form1; /* AP_title_form1 */ +static int hf_atn_ulcs_ae_qualifier_form2; /* AE_qualifier_form2 */ +static int hf_atn_ulcs_ae_qualifier_form1; /* AE_qualifier_form1 */ +static int hf_atn_ulcs_acse_service_user; /* T_acse_service_user */ +static int hf_atn_ulcs_acse_service_provider; /* T_acse_service_provider */ +static int hf_atn_ulcs_Association_information_item; /* EXTERNALt */ +static int hf_atn_ulcs_charstring; /* OCTET_STRING */ +static int hf_atn_ulcs_bitstring; /* BIT_STRING */ +static int hf_atn_ulcs_external; /* EXTERNAL */ +static int hf_atn_ulcs_other; /* T_other */ +static int hf_atn_ulcs_other_mechanism_name; /* OBJECT_IDENTIFIER */ +static int hf_atn_ulcs_other_mechanism_value; /* T_other_mechanism_value */ +static int hf_atn_ulcs_rdnSequence; /* RDNSequence */ +static int hf_atn_ulcs_RDNSequence_item; /* RelativeDistinguishedName */ +static int hf_atn_ulcs_RelativeDistinguishedName_item; /* AttributeTypeAndValue */ +static int hf_atn_ulcs_null; /* NULL */ /* named bits */ -static int hf_atn_ulcs_T_aarq_apdu_protocol_version_version1 = -1; -static int hf_atn_ulcs_T_aare_apdu_protocol_version_version1 = -1; -static int hf_atn_ulcs_ACSE_requirements_authentication = -1; -static int hf_atn_ulcs_ACSE_requirements_application_context_negotiation = -1; - -static gint ett_atn_ulcs_Fully_encoded_data = -1; -static gint ett_atn_ulcs_PDV_list = -1; -static gint ett_atn_ulcs_T_presentation_data_values = -1; -static gint ett_atn_ulcs_EXTERNALt = -1; -static gint ett_atn_ulcs_T_encoding = -1; -static gint ett_atn_ulcs_ACSE_apdu = -1; -static gint ett_atn_ulcs_AARQ_apdu = -1; -static gint ett_atn_ulcs_T_aarq_apdu_protocol_version = -1; -static gint ett_atn_ulcs_AARE_apdu = -1; -static gint ett_atn_ulcs_T_aare_apdu_protocol_version = -1; -static gint ett_atn_ulcs_RLRQ_apdu = -1; -static gint ett_atn_ulcs_RLRE_apdu = -1; -static gint ett_atn_ulcs_ABRT_apdu = -1; -static gint ett_atn_ulcs_ACSE_requirements = -1; -static gint ett_atn_ulcs_Application_context_name_list = -1; -static gint ett_atn_ulcs_AP_title = -1; -static gint ett_atn_ulcs_AE_qualifier = -1; -static gint ett_atn_ulcs_Associate_source_diagnostic = -1; -static gint ett_atn_ulcs_Association_information = -1; -static gint ett_atn_ulcs_Authentication_value = -1; -static gint ett_atn_ulcs_T_other = -1; -static gint ett_atn_ulcs_Name = -1; -static gint ett_atn_ulcs_RDNSequence = -1; -static gint ett_atn_ulcs_RelativeDistinguishedName = -1; -static gint ett_atn_ulcs_AttributeTypeAndValue = -1; -static gint ett_atn_ulcs = -1; -static gint ett_atn_acse = -1; +static int hf_atn_ulcs_T_aarq_apdu_protocol_version_version1; +static int hf_atn_ulcs_T_aare_apdu_protocol_version_version1; +static int hf_atn_ulcs_ACSE_requirements_authentication; +static int hf_atn_ulcs_ACSE_requirements_application_context_negotiation; + +static int ett_atn_ulcs_Fully_encoded_data; +static int ett_atn_ulcs_PDV_list; +static int ett_atn_ulcs_T_presentation_data_values; +static int ett_atn_ulcs_EXTERNALt; +static int ett_atn_ulcs_T_encoding; +static int ett_atn_ulcs_ACSE_apdu; +static int ett_atn_ulcs_AARQ_apdu; +static int ett_atn_ulcs_T_aarq_apdu_protocol_version; +static int ett_atn_ulcs_AARE_apdu; +static int ett_atn_ulcs_T_aare_apdu_protocol_version; +static int ett_atn_ulcs_RLRQ_apdu; +static int ett_atn_ulcs_RLRE_apdu; +static int ett_atn_ulcs_ABRT_apdu; +static int ett_atn_ulcs_ACSE_requirements; +static int ett_atn_ulcs_Application_context_name_list; +static int ett_atn_ulcs_AP_title; +static int ett_atn_ulcs_AE_qualifier; +static int ett_atn_ulcs_Associate_source_diagnostic; +static int ett_atn_ulcs_Association_information; +static int ett_atn_ulcs_Authentication_value; +static int ett_atn_ulcs_T_other; +static int ett_atn_ulcs_Name; +static int ett_atn_ulcs_RDNSequence; +static int ett_atn_ulcs_RelativeDistinguishedName; +static int ett_atn_ulcs_AttributeTypeAndValue; +static int ett_atn_ulcs; +static int ett_atn_acse; @@ -311,7 +310,7 @@ dissect_atn_ulcs_Presentation_context_identifier(tvbuff_t *tvb _U_, int offset _ 1U, 127U, &ulcs_context_value, - TRUE); + true); return offset; @@ -331,7 +330,7 @@ dissect_atn_ulcs_T_pdv_list_presentation_data_values_single_asn1_type(tvbuff_t * static int dissect_atn_ulcs_OCTET_STRING(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index, - NO_BOUND, NO_BOUND, FALSE, NULL); + NO_BOUND, NO_BOUND, false, NULL); return offset; } @@ -356,14 +355,14 @@ dissect_atn_ulcs_T_pdv_list_presentation_data_values_arbitrary(tvbuff_t *tvb _U_ hf_index, NO_BOUND, NO_BOUND, - FALSE, + false, NULL, 0, &tvb_usr, NULL); if (tvb_usr) { - /* call appropiate dissector for bitstring data */ + /* call appropriate dissector for bitstring data */ switch(ulcs_context_value){ case 1: /* ACSE PDU*/ atn_ulcs_tree = proto_tree_add_subtree( @@ -481,7 +480,7 @@ static int dissect_atn_ulcs_Fully_encoded_data(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_per_constrained_sequence_of(tvb, offset, actx, tree, hf_index, ett_atn_ulcs_Fully_encoded_data, Fully_encoded_data_sequence_of, - 1, 1, TRUE); + 1, 1, true); return offset; } @@ -517,9 +516,9 @@ dissect_atn_ulcs_T_data_value_descriptor(tvbuff_t *tvb _U_, int offset _U_, asn1 hf_index, -1, -1, - FALSE, + false, &actx->external.data_value_descriptor); - actx->external.data_value_descr_present = TRUE; + actx->external.data_value_descr_present = true; return offset; @@ -543,7 +542,7 @@ static int dissect_atn_ulcs_T_externalt_encoding_octet_aligned(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index, - NO_BOUND, NO_BOUND, FALSE, NULL); + NO_BOUND, NO_BOUND, false, NULL); @@ -567,7 +566,7 @@ dissect_atn_ulcs_T_externalt_encoding_arbitrary(tvbuff_t *tvb _U_, int offset _U tree, hf_index, NO_BOUND, NO_BOUND, - FALSE, + false, NULL, 0, &tvb_usr, @@ -699,7 +698,7 @@ static int * const T_aarq_apdu_protocol_version_bits[] = { static int dissect_atn_ulcs_T_aarq_apdu_protocol_version(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index, - NO_BOUND, NO_BOUND, FALSE, T_aarq_apdu_protocol_version_bits, 1, NULL, NULL); + NO_BOUND, NO_BOUND, false, T_aarq_apdu_protocol_version_bits, 1, NULL, NULL); return offset; } @@ -758,7 +757,7 @@ dissect_atn_ulcs_RelativeDistinguishedName(tvbuff_t *tvb _U_, int offset _U_, as */ offset = dissect_per_constrained_set_of(tvb, offset, actx, tree, hf_index, ett_atn_ulcs_RelativeDistinguishedName, RelativeDistinguishedName_set_of, - 1, 1, FALSE); + 1, 1, false); return offset; @@ -784,7 +783,7 @@ dissect_atn_ulcs_RDNSequence(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx */ offset = dissect_per_constrained_sequence_of(tvb, offset, actx, tree, hf_index, ett_atn_ulcs_RDNSequence, RDNSequence_sequence_of, - 1, 1, FALSE); + 1, 1, false); return offset; @@ -847,7 +846,7 @@ static int dissect_atn_ulcs_AE_qualifier_form2(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { packet_info * pinfo = actx->pinfo; atn_conversation_t *atn_cv = NULL; - guint32 ae_qualifier = 0; + uint32_t ae_qualifier = 0; /* dissect ae-qualifier */ offset = dissect_per_integer( @@ -944,7 +943,7 @@ static int * const ACSE_requirements_bits[] = { static int dissect_atn_ulcs_ACSE_requirements(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index, - NO_BOUND, NO_BOUND, FALSE, ACSE_requirements_bits, 2, NULL, NULL); + NO_BOUND, NO_BOUND, false, ACSE_requirements_bits, 2, NULL, NULL); return offset; } @@ -980,7 +979,7 @@ dissect_atn_ulcs_Mechanism_name(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *a static int dissect_atn_ulcs_BIT_STRING(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index, - NO_BOUND, NO_BOUND, FALSE, NULL, 0, NULL, NULL); + NO_BOUND, NO_BOUND, false, NULL, 0, NULL, NULL); return offset; } @@ -1077,7 +1076,7 @@ dissect_atn_ulcs_Application_context_name_list(tvbuff_t *tvb _U_, int offset _U_ static int dissect_atn_ulcs_Implementation_data(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index, - NO_BOUND, NO_BOUND, FALSE, NULL); + NO_BOUND, NO_BOUND, false, NULL); return offset; } @@ -1091,7 +1090,7 @@ static int dissect_atn_ulcs_Association_information(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_per_constrained_sequence_of(tvb, offset, actx, tree, hf_index, ett_atn_ulcs_Association_information, Association_information_sequence_of, - 1, 1, TRUE); + 1, 1, true); return offset; } @@ -1122,7 +1121,7 @@ dissect_atn_ulcs_AARQ_apdu(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _ packet_info * pinfo = actx->pinfo; aarq_data_t *aarq_data = NULL; atn_conversation_t *atn_cv = NULL; - guint32 aircraft_24_bit_address = 0; + uint32_t aircraft_24_bit_address = 0; /* AARQ/DT: dstref present, srcref is always zero */ if((pinfo->clnp_dstref) && (!pinfo->clnp_srcref)){ @@ -1189,7 +1188,7 @@ dissect_atn_ulcs_AARQ_apdu(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _ /* alloc aarq data */ aarq_data = wmem_new(wmem_file_scope(), aarq_data_t); - aarq_data-> aarq_pending = FALSE; + aarq_data-> aarq_pending = false; /* insert aarq data */ wmem_tree_insert32(aarq_data_tree ,aircraft_24_bit_address,(void*)aarq_data); @@ -1198,13 +1197,13 @@ dissect_atn_ulcs_AARQ_apdu(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _ /* check for pending AARQ/AARE sequences */ /* if "aarq_data-> aarq_pending" is set this means that there is already one */ /* AARQ/AARE sequence pending (is unwise to overwrite AARE/AARQ) */ - if (aarq_data-> aarq_pending == FALSE ) { + if (aarq_data-> aarq_pending == false ) { /* init aarq data */ memset(aarq_data,0,sizeof(aarq_data_t)); aarq_data->cv = atn_cv; - aarq_data-> aarq_pending = TRUE; + aarq_data-> aarq_pending = true; } @@ -1220,7 +1219,7 @@ static int * const T_aare_apdu_protocol_version_bits[] = { static int dissect_atn_ulcs_T_aare_apdu_protocol_version(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index, - NO_BOUND, NO_BOUND, FALSE, T_aare_apdu_protocol_version_bits, 1, NULL, NULL); + NO_BOUND, NO_BOUND, false, T_aare_apdu_protocol_version_bits, 1, NULL, NULL); return offset; } @@ -1238,7 +1237,7 @@ static int dissect_atn_ulcs_Associate_result(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { /* extension present: last param set to true. asn2wrs didn't take notice of that */ offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, - 0U, 2U, NULL, TRUE); + 0U, 2U, NULL, true); return offset; } @@ -1267,7 +1266,7 @@ static const value_string atn_ulcs_T_acse_service_user_vals[] = { static int dissect_atn_ulcs_T_acse_service_user(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, - 0U, 14U, NULL, TRUE); + 0U, 14U, NULL, true); return offset; } @@ -1284,7 +1283,7 @@ static const value_string atn_ulcs_T_acse_service_provider_vals[] = { static int dissect_atn_ulcs_T_acse_service_provider(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, - 0U, 2U, NULL, TRUE); + 0U, 2U, NULL, true); return offset; } @@ -1333,7 +1332,7 @@ static const per_sequence_t AARE_apdu_sequence[] = { static int dissect_atn_ulcs_AARE_apdu(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { packet_info * pinfo = actx->pinfo; - guint32 aircraft_24_bit_address = 0 ; + uint32_t aircraft_24_bit_address = 0 ; atn_conversation_t *atn_cv = NULL; aarq_data_t *aarq_data = NULL; @@ -1411,7 +1410,7 @@ dissect_atn_ulcs_AARE_apdu(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _ /* clear aarq data */ memset(aarq_data,0,sizeof(aarq_data_t)); - aarq_data-> aarq_pending = FALSE; + aarq_data-> aarq_pending = false; offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index, ett_atn_ulcs_AARE_apdu, AARE_apdu_sequence); @@ -1435,7 +1434,7 @@ static int dissect_atn_ulcs_Release_request_reason(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { /* extension present: last param set to true. asn2wrs didn't take notice of that */ offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, - 0U, 30U, NULL, TRUE); + 0U, 30U, NULL, true); return offset; } @@ -1477,7 +1476,7 @@ dissect_atn_ulcs_Release_response_reason(tvbuff_t *tvb _U_, int offset _U_, asn1 0U, 30U, NULL, - TRUE); + true); return offset; @@ -1509,7 +1508,7 @@ static const value_string atn_ulcs_ABRT_source_vals[] = { static int dissect_atn_ulcs_ABRT_source(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, - 0U, 1U, NULL, TRUE); + 0U, 1U, NULL, true); return offset; } @@ -1530,7 +1529,7 @@ static uint32_t ABRT_diagnostic_value_map[6+0] = {1, 2, 3, 4, 5, 6}; static int dissect_atn_ulcs_ABRT_diagnostic(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_per_enumerated(tvb, offset, actx, tree, hf_index, - 6, NULL, TRUE, 0, ABRT_diagnostic_value_map); + 6, NULL, true, 0, ABRT_diagnostic_value_map); return offset; } @@ -1584,7 +1583,7 @@ dissect_atn_ulcs_ACSE_apdu(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _ static int dissect_Fully_encoded_data_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) { int offset = 0; asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, FALSE, pinfo); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, false, pinfo); offset = dissect_atn_ulcs_Fully_encoded_data(tvb, offset, &asn1_ctx, tree, hf_atn_ulcs_Fully_encoded_data_PDU); offset += 7; offset >>= 3; return offset; @@ -1592,7 +1591,7 @@ static int dissect_Fully_encoded_data_PDU(tvbuff_t *tvb _U_, packet_info *pinfo static int dissect_ACSE_apdu_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_) { int offset = 0; asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, FALSE, pinfo); + asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, false, pinfo); offset = dissect_atn_ulcs_ACSE_apdu(tvb, offset, &asn1_ctx, tree, hf_atn_ulcs_ACSE_apdu_PDU); offset += 7; offset >>= 3; return offset; @@ -1640,30 +1639,30 @@ static const per_choice_t External_encoding_choice[] = #define SES_PARAM_B2_MASK 0x02 #define SES_PARAM_B1_MASK 0x01 -static int hf_atn_ses_type = -1; -static int hf_atn_ses_param_ind = -1; -static int hf_atn_ses_param_b1 = -1; -static int hf_atn_ses_param_b2 = -1; +static int hf_atn_ses_type; +static int hf_atn_ses_param_ind; +static int hf_atn_ses_param_b1; +static int hf_atn_ses_param_b2; -static gint ett_atn_ses = -1; +static int ett_atn_ses; #define ATN_SES_PROTO "ICAO Doc9705 ULCS Session (ISO 8326/8327-1:1994)" -const value_string atn_ses_param_ind[] = +static const value_string atn_ses_param_ind[] = { {0, "No Parameter Indication "}, {1, "Parameter Indication "}, {0, NULL } }; -const value_string srf_b2[] = +static const value_string srf_b2[] = { {0, "Transport Connection is kept"}, {1, "Transport Connection is released" }, {0, NULL } }; -const value_string srf_b1[] = +static const value_string srf_b1[] = { {0, "Transport Connection is transient"}, {1, "Transport Connection is persistent"}, @@ -1677,7 +1676,7 @@ const value_string srf_b1[] = #define SES_ATN_SRF 0xe0 #define SES_ATN_SRFC 0xa0 -const value_string atn_ses_type[] = +static const value_string atn_ses_type[] = { { 0x1d, "Short Connect (SCN) SPDU" }, { 0x1f, "Short Connect Accept (SAC) SPDU" }, @@ -1690,15 +1689,15 @@ const value_string atn_ses_type[] = /* ATN Presentation layer */ #define ATN_PRES_PROTO "ICAO Doc9705 ULCS Presentation (ISO 8822/8823-1:1994)" -static int hf_atn_pres_err = -1; -static int hf_atn_pres_pdu_type = -1; -static gint ett_atn_pres = -1; +static int hf_atn_pres_err; +static int hf_atn_pres_pdu_type; +static int ett_atn_pres; #define ATN_SES_PRES_MASK 0xf803 #define PRES_CPR_ER_MASK 0x70 /* type determined by SPDU and PPDU */ -const value_string atn_pres_vals[] = +static const value_string atn_pres_vals[] = { { 0xe802, "Short Presentation Connect PPDU (CP) " }, { 0xf802, "Short Presentation Connect PPDU (CP) " }, @@ -1710,7 +1709,7 @@ const value_string atn_pres_vals[] = }; /* Short Presentation Connect Reject PPDU's 0yyy 00zz */ -const value_string atn_pres_err[] = +static const value_string atn_pres_err[] = { { 0x00, "Presentation-user" }, { 0x01, "Reason not specified (transient)"}, @@ -1746,9 +1745,9 @@ static int atn_ulcs_Externalt_encoding( } /* re-implementing external data: packet-per.c */ -static guint32 atn_per_external_type( +static uint32_t atn_per_external_type( tvbuff_t *tvb _U_, - guint32 offset, + uint32_t offset, asn1_ctx_t *actx, proto_tree *tree _U_, int hf_index _U_, @@ -1780,12 +1779,12 @@ static guint32 atn_per_external_type( /* determine 24-bit aircraft address(ARS) */ /* from 20-byte ATN NSAP. */ -guint32 get_aircraft_24_bit_address_from_nsap( +uint32_t get_aircraft_24_bit_address_from_nsap( packet_info *pinfo) { - const guint8* addr = NULL; - guint32 ars =0; - guint32 adr_prefix =0; + const uint8_t* addr = NULL; + uint32_t ars =0; + uint32_t adr_prefix =0; /* check NSAP address type*/ if( (pinfo->src.type != get_osi_address_type()) || @@ -1803,7 +1802,7 @@ guint32 get_aircraft_24_bit_address_from_nsap( /* from an aircraft it's downlink */ /* convert addr into 32-bit integer */ - addr = (const guint8 *)pinfo->src.data; + addr = (const uint8_t *)pinfo->src.data; adr_prefix = ((addr[0]<<24) | (addr[1]<<16) | @@ -1817,7 +1816,7 @@ guint32 get_aircraft_24_bit_address_from_nsap( if((adr_prefix == 0x470027c1) || (adr_prefix == 0x47002741)) { /* ICAO doc9507 Ed2 SV5 5.4.3.8.4.4 */ - /* states that the ARS subfield containes */ + /* states that the ARS subfield contains */ /* the 24-bitaddress of the aircraft */ ars = ((addr[8])<<16) | ((addr[9])<<8) | @@ -1829,7 +1828,7 @@ guint32 get_aircraft_24_bit_address_from_nsap( /* from an aircraft it's downlink */ /* convert addr into 32-bit integer */ - addr = (const guint8 *)pinfo->dst.data; + addr = (const uint8_t *)pinfo->dst.data; adr_prefix = ((addr[0]<<24) | (addr[1]<<16) | (addr[2]<<8) | @@ -1842,7 +1841,7 @@ guint32 get_aircraft_24_bit_address_from_nsap( if((adr_prefix == 0x470027c1) || (adr_prefix == 0x47002741)) { /* ICAO doc9507 Ed2 SV5 5.4.3.8.4.4 */ - /* states that the ARS subfield containes */ + /* states that the ARS subfield contains */ /* the 24-bitaddress of the aircraft */ ars = ((addr[8])<<16) | ((addr[9])<<8) | @@ -1852,12 +1851,12 @@ guint32 get_aircraft_24_bit_address_from_nsap( } /* determine whether a PDU is uplink or downlink */ -/* by checking for known aircraft address prefices*/ +/* by checking for known aircraft address prefixes*/ int check_heur_msg_type(packet_info *pinfo _U_) { int t = no_msg; - const guint8* addr = NULL; - guint32 adr_prefix =0; + const uint8_t* addr = NULL; + uint32_t adr_prefix =0; /* check NSAP address type*/ if( (pinfo->src.type != get_osi_address_type()) || (pinfo->dst.type != get_osi_address_type())) { @@ -1867,7 +1866,7 @@ int check_heur_msg_type(packet_info *pinfo _U_) if( (pinfo->src.len != 20) || (pinfo->dst.len != 20)) { return t; } - addr = (const guint8 *)pinfo->src.data; + addr = (const uint8_t *)pinfo->src.data; /* convert address to 32-bit integer */ adr_prefix = ((addr[0]<<24) | (addr[1]<<16) | (addr[2]<<8) | addr[3] ); @@ -1880,7 +1879,7 @@ int check_heur_msg_type(packet_info *pinfo _U_) t = dm; /* source is an aircraft: it's a downlink PDU */ } - addr = (const guint8 *)pinfo->dst.data; + addr = (const uint8_t *)pinfo->dst.data; /* convert address to 32-bit integer */ adr_prefix = ((addr[0]<<24) | (addr[1]<<16) | (addr[2]<<8) | addr[3] ); @@ -1909,12 +1908,12 @@ wmem_tree_t *get_atn_conversation_tree(void){ /* at transport layer (cotp) but this isn't working yet. */ atn_conversation_t * find_atn_conversation( address *address1, - guint16 clnp_ref1, + uint16_t clnp_ref1, address *address2 ) { atn_conversation_t *cv = NULL; - guint32 key = 0; - guint32 tmp = 0; + uint32_t key = 0; + uint32_t tmp = 0; tmp = add_address_to_hash( tmp, address1); key = (tmp << 16) | clnp_ref1 ; @@ -1934,13 +1933,13 @@ atn_conversation_t * find_atn_conversation( /* a conversation may be referenced from both endpoints */ atn_conversation_t * create_atn_conversation( address *address1, - guint16 clnp_ref1, + uint16_t clnp_ref1, address *address2, atn_conversation_t *conversation) { atn_conversation_t *cv = NULL; - guint32 key = 0; - guint32 tmp = 0; + uint32_t key = 0; + uint32_t tmp = 0; tmp = add_address_to_hash( tmp, address1); key = (tmp << 16) | clnp_ref1 ; @@ -1977,15 +1976,15 @@ dissect_atn_ulcs( int offset = 0; proto_item *ti = NULL; proto_tree *atn_ulcs_tree = NULL; - guint8 value_pres = 0; - guint8 value_ses = 0; - guint16 value_ses_pres = 0; + uint8_t value_pres = 0; + uint8_t value_ses = 0; + uint16_t value_ses_pres = 0; root_tree = tree; /* data pointer */ /* decode as PDV-list */ - if ( (int)(intptr_t) data == FALSE ) + if ( (int)(intptr_t) data == false ) { ti = proto_tree_add_item( tree, @@ -2009,7 +2008,7 @@ dissect_atn_ulcs( } /* decode as SPDU, PPDU and ACSE PDU */ - if ( (int)(intptr_t) data == TRUE ) + if ( (int)(intptr_t) data == true ) { /* get session and presentation PDU's */ value_ses_pres = tvb_get_ntohs(tvb, offset); @@ -2020,7 +2019,7 @@ dissect_atn_ulcs( ett_atn_ses, NULL, ATN_SES_PROTO ); /* get SPDU (1 octet) */ - value_ses = tvb_get_guint8(tvb, offset); + value_ses = tvb_get_uint8(tvb, offset); /* SPDU type/identifier */ proto_tree_add_item(atn_ulcs_tree, @@ -2071,7 +2070,7 @@ dissect_atn_ulcs( tree, tvb, offset, 0, ett_atn_pres, NULL, ATN_PRES_PROTO ); - value_pres = tvb_get_guint8(tvb, offset); + value_pres = tvb_get_uint8(tvb, offset); /* need session context to identify PPDU type */ /* note: */ @@ -2118,7 +2117,7 @@ dissect_atn_ulcs( return offset; } -static gboolean dissect_atn_ulcs_heur( +static bool dissect_atn_ulcs_heur( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, @@ -2127,7 +2126,7 @@ static gboolean dissect_atn_ulcs_heur( /* do we have enough data*/ /* at least session + presentation data or pdv-list */ if (tvb_captured_length(tvb) < 2){ - return FALSE; } + return false; } /* check for session/presentation/ACSE PDU's */ /* SPDU and PPDU are one octet each */ @@ -2159,8 +2158,8 @@ static gboolean dissect_atn_ulcs_heur( tvb, pinfo, tree, - (void*) TRUE); - return TRUE; + (void*) true); + return true; default: /* no SPDU */ break; } @@ -2177,13 +2176,12 @@ static gboolean dissect_atn_ulcs_heur( /* PDV-list PDU may contain */ /* application protocol data (CM, CPDLC) */ /* or an ACSE PDU */ - dissect_atn_ulcs(tvb, pinfo, tree, (void*) FALSE); - return TRUE; - break; + dissect_atn_ulcs(tvb, pinfo, tree, (void*) false); + return true; default: /* no or unsupported PDU */ break; } - return FALSE; + return false; } void proto_register_atn_ulcs (void) @@ -2531,7 +2529,7 @@ void proto_register_atn_ulcs (void) HFILL}}, }; - static gint *ett[] = { + static int *ett[] = { &ett_atn_ulcs_Fully_encoded_data, &ett_atn_ulcs_PDV_list, &ett_atn_ulcs_T_presentation_data_values, @@ -2583,7 +2581,7 @@ void proto_register_atn_ulcs (void) proto_atn_ulcs); /* initiate sub dissector list */ - atn_ulcs_heur_subdissector_list = register_heur_dissector_list("atn-ulcs", proto_atn_ulcs); + atn_ulcs_heur_subdissector_list = register_heur_dissector_list_with_description("atn-ulcs", "ATN-ULCS unhandled data", proto_atn_ulcs); /* init aare/aare data */ aarq_data_tree = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); |