diff options
author | Bill Meier <wmeier@newsguy.com> | 2015-08-09 12:20:54 -0400 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2015-08-09 16:30:05 +0000 |
commit | c5af152628f84cfddfa3d872d8be5b58d9a0ae03 (patch) | |
tree | bc0337c7da51eb15f30951497138e1bdebdad32d /epan/dissectors/packet-atn-cpdlc.c | |
parent | dbf314a4ab3e005bc9650d69f47fb44aa446fb58 (diff) | |
download | wireshark-c5af152628f84cfddfa3d872d8be5b58d9a0ae03.tar.gz wireshark-c5af152628f84cfddfa3d872d8be5b58d9a0ae03.tar.bz2 wireshark-c5af152628f84cfddfa3d872d8be5b58d9a0ae03.zip |
Trivial: Convert 'tabs' indentation to '4 space' indentation
Change-Id: If71dd8a04050ce11e37ad88ee862419313c06639
Reviewed-on: https://code.wireshark.org/review/9946
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Diffstat (limited to 'epan/dissectors/packet-atn-cpdlc.c')
-rw-r--r-- | epan/dissectors/packet-atn-cpdlc.c | 560 |
1 files changed, 277 insertions, 283 deletions
diff --git a/epan/dissectors/packet-atn-cpdlc.c b/epan/dissectors/packet-atn-cpdlc.c index a66aa3c55c..9faf8e50af 100644 --- a/epan/dissectors/packet-atn-cpdlc.c +++ b/epan/dissectors/packet-atn-cpdlc.c @@ -6,11 +6,6 @@ /* Input file: packet-atn-cpdlc-template.c */ #line 1 "../../asn1/atn-cpdlc/packet-atn-cpdlc-template.c" -/* c-basic-offset: 2; tab-width: 2; indent-tabs-mode: t - * vi: set shiftwidth=2 tabstop=2 noexpandtab: - * :indentSize=2:tabSize=2:noTabs=false: - */ - /* packet-atn-cpdlc-template.c * By Mathias Guettler <guettler@web.de> * Copyright 2013 @@ -50,9 +45,9 @@ /* developper comments: - Which CPDLC messages are supported ? - Protected Mode CPDLC (AeQualifier 22) and Plain Old CPDLC (AeQualifier 2) - The dissector has been tested with ICAO doc9705 Edition2 compliant traffic. + Which CPDLC messages are supported ? + Protected Mode CPDLC (AeQualifier 22) and Plain Old CPDLC (AeQualifier 2) + The dissector has been tested with ICAO doc9705 Edition2 compliant traffic. */ #include "config.h" @@ -73,25 +68,25 @@ static const char *object_identifier_id; /* forward declarations */ static int dissect_GroundPDUs_PDU( - tvbuff_t *tvb _U_, - packet_info *pinfo _U_, - proto_tree *tree _U_, - void *data _U_); + tvbuff_t *tvb _U_, + packet_info *pinfo _U_, + proto_tree *tree _U_, + void *data _U_); static int dissect_AircraftPDUs_PDU( - tvbuff_t *tvb _U_, - packet_info *pinfo _U_, - proto_tree *tree _U_, - void *data _U_); + tvbuff_t *tvb _U_, + packet_info *pinfo _U_, + proto_tree *tree _U_, + void *data _U_); static int dissect_ProtectedGroundPDUs_PDU( - tvbuff_t *tvb _U_, - packet_info *pinfo _U_, - proto_tree *tree _U_, - void *data _U_); + tvbuff_t *tvb _U_, + packet_info *pinfo _U_, + proto_tree *tree _U_, + void *data _U_); static int dissect_ProtectedAircraftPDUs_PDU( - tvbuff_t *tvb _U_, - packet_info *pinfo _U_, - proto_tree *tree _U_, - void *data _U_); + tvbuff_t *tvb _U_, + packet_info *pinfo _U_, + proto_tree *tree _U_, + void *data _U_); /*--- Included file: packet-atn-cpdlc-hf.c ---*/ @@ -699,7 +694,7 @@ static int hf_atn_cpdlc_windSpeedEnglish = -1; /* WindSpeedEnglish */ static int hf_atn_cpdlc_windSpeedMetric = -1; /* WindSpeedMetric */ /*--- End of included file: packet-atn-cpdlc-hf.c ---*/ -#line 89 "../../asn1/atn-cpdlc/packet-atn-cpdlc-template.c" +#line 84 "../../asn1/atn-cpdlc/packet-atn-cpdlc-template.c" /*--- Included file: packet-atn-cpdlc-ett.c ---*/ @@ -848,7 +843,7 @@ static gint ett_atn_cpdlc_Winds = -1; static gint ett_atn_cpdlc_WindSpeed = -1; /*--- End of included file: packet-atn-cpdlc-ett.c ---*/ -#line 91 "../../asn1/atn-cpdlc/packet-atn-cpdlc-template.c" +#line 86 "../../asn1/atn-cpdlc/packet-atn-cpdlc-template.c" static gint ett_atn_cpdlc = -1; @@ -1186,7 +1181,7 @@ dissect_atn_cpdlc_Level(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, static int dissect_atn_cpdlc_Fix(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,1, 5, FALSE, ia5alpha , 127, NULL); + offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,1, 5, FALSE, ia5alpha , 127, NULL); return offset; } @@ -1467,7 +1462,7 @@ dissect_atn_cpdlc_FixName(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U static int dissect_atn_cpdlc_NavaidName(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,1, 4, FALSE, ia5alpha , 127, NULL); + offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,1, 4, FALSE, ia5alpha , 127, NULL); return offset; } @@ -1491,7 +1486,7 @@ dissect_atn_cpdlc_Navaid(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_ static int dissect_atn_cpdlc_Airport(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,4, 4, FALSE, ia5alpha , 127, NULL); + offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,4, 4, FALSE, ia5alpha , 127, NULL); return offset; } @@ -2116,7 +2111,7 @@ dissect_atn_cpdlc_TimeDistanceSpecifiedDirection(tvbuff_t *tvb _U_, int offset _ static int dissect_atn_cpdlc_AircraftFlightIdentification(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,2, 8, FALSE, ia5alpha , 127, NULL); + offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,2, 8, FALSE, ia5alpha , 127, NULL); return offset; } @@ -2154,7 +2149,7 @@ dissect_atn_cpdlc_PlaceBearingPlaceBearing(tvbuff_t *tvb _U_, int offset _U_, as static int dissect_atn_cpdlc_ATSRouteDesignator(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,2, 7, FALSE, ia5alpha , 127, NULL); + offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,2, 7, FALSE, ia5alpha , 127, NULL); return offset; } @@ -2208,7 +2203,7 @@ dissect_atn_cpdlc_ProcedureType(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *a static int dissect_atn_cpdlc_Procedure(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,1, 20, FALSE, ia5alpha , 127, NULL); + offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,1, 20, FALSE, ia5alpha , 127, NULL); return offset; } @@ -2217,7 +2212,7 @@ dissect_atn_cpdlc_Procedure(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx static int dissect_atn_cpdlc_ProcedureTransition(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,1, 5, FALSE, ia5alpha , 127, NULL); + offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,1, 5, FALSE, ia5alpha , 127, NULL); return offset; } @@ -2344,7 +2339,7 @@ dissect_atn_cpdlc_Code(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, static int dissect_atn_cpdlc_FacilityDesignation(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,4, 8, FALSE, ia5alpha , 127, NULL); + offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,4, 8, FALSE, ia5alpha , 127, NULL); return offset; } @@ -2353,7 +2348,7 @@ dissect_atn_cpdlc_FacilityDesignation(tvbuff_t *tvb _U_, int offset _U_, asn1_ct static int dissect_atn_cpdlc_FacilityName(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,3, 18, FALSE, ia5alpha , 127, NULL); + offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,3, 18, FALSE, ia5alpha , 127, NULL); return offset; } @@ -2594,7 +2589,7 @@ dissect_atn_cpdlc_RevisionNumber(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t * static int dissect_atn_cpdlc_ATISCode(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,1, 1, FALSE, ia5alpha , 127, NULL); + offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,1, 1, FALSE, ia5alpha , 127, NULL); return offset; } @@ -3050,7 +3045,7 @@ dissect_atn_cpdlc_TrafficType(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *act static int dissect_atn_cpdlc_FreeText(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,1, 256, FALSE, ia5alpha , 127, NULL); + offset = dissect_per_restricted_character_string(tvb, offset, actx, tree, hf_index,1, 256, FALSE, ia5alpha , 127, NULL); return offset; } @@ -5110,9 +5105,9 @@ dissect_atn_cpdlc_PMCPDLCProviderAbortReason(tvbuff_t *tvb _U_, int offset _U_, static int dissect_atn_cpdlc_AlgorithmIdentifier(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - proto_tree *top_tree=NULL; + proto_tree *top_tree=NULL; - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, top_tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, top_tree, NULL); return offset; @@ -5122,22 +5117,22 @@ dissect_atn_cpdlc_AlgorithmIdentifier(tvbuff_t *tvb _U_, int offset _U_, asn1_ct static int dissect_atn_cpdlc_CPDLCMessage(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - tvbuff_t *tvb_usr = NULL; + tvbuff_t *tvb_usr = NULL; - offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index, NO_BOUND, NO_BOUND, FALSE, &tvb_usr, NULL); + offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index, NO_BOUND, NO_BOUND, FALSE, &tvb_usr, NULL); - if (tvb_usr) { - switch(check_heur_msg_type(actx->pinfo)){ - case dm: - dissect_atn_cpdlc_ATCDownlinkMessage(tvb_new_subset_remaining(tvb_usr, 0), 0, actx, tree, hf_index); - break; - case um: - dissect_atn_cpdlc_ATCUplinkMessage(tvb_new_subset_remaining(tvb_usr, 0), 0, actx , tree, hf_index); - break; - default: - break; - } - } + if (tvb_usr) { + switch(check_heur_msg_type(actx->pinfo)){ + case dm: + dissect_atn_cpdlc_ATCDownlinkMessage(tvb_new_subset_remaining(tvb_usr, 0), 0, actx, tree, hf_index); + break; + case um: + dissect_atn_cpdlc_ATCUplinkMessage(tvb_new_subset_remaining(tvb_usr, 0), 0, actx , tree, hf_index); + break; + default: + break; + } + } return offset; @@ -5299,7 +5294,7 @@ static int dissect_ProtectedAircraftPDUs_PDU(tvbuff_t *tvb _U_, packet_info *pin /*--- End of included file: packet-atn-cpdlc-fn.c ---*/ -#line 94 "../../asn1/atn-cpdlc/packet-atn-cpdlc-template.c" +#line 89 "../../asn1/atn-cpdlc/packet-atn-cpdlc-template.c" /* Wireshark ID of CPDLC protocol */ static int proto_atn_cpdlc = -1; @@ -5307,206 +5302,206 @@ static int proto_atn_cpdlc = -1; static int dissect_atn_cpdlc( - tvbuff_t *tvb, - packet_info *pinfo, - proto_tree *tree, - void *data _U_) + tvbuff_t *tvb, + packet_info *pinfo, + proto_tree *tree, + void *data _U_) { - /* note: */ - /* there are two co-existing applications of CPDLC: */ - /* "plain old" (ae-qualifier 2) and */ - /* "protected mode" (ae-qualifier 22) CPDLC. */ - /* "protected mode" was introduced to cope with a */ - /* safety issue in which a message would sent to the wrong aircraft. */ - - /* note:*/ - /* The protection is an additional checksum and covers the message content, */ - /* the 24-bit address of the aircraft, the current flight id and */ - /* the current ground facility so that an aircraft would be able to reject */ - /* messages which are unexpected (i.e. messages to another flight or */ - /* messages from the wrong center). */ - - /*note:*/ - /* although "plain old" CPDLC is more or less deprecated */ - /* many aircraft cannot perform */ - /* "protected mode" for this largely depends on */ - /* upgraded avionics packages */ - - /*note:*/ - /* The use of CPDLC is *optional* as the pilot */ - /* may always use a voice radio channel to talk to the controller.*/ - - proto_tree *atn_cpdlc_tree = NULL; - atn_conversation_t *atn_cv = NULL; - - /* note: */ - /* we need the ae qualifier stored within the conversation */ - /* to decode "plain old cpdlc" or */ - /* "protected mode cpdlc correctly " */ - - /* DT: dstref present, srcref is always zero */ - if((pinfo->clnp_dstref) && (!pinfo->clnp_srcref)){ - atn_cv = find_atn_conversation( - &pinfo->dst, - pinfo->clnp_dstref, - &pinfo->src ); - } - /* CR: srcref present, dstref is always zero */ - if((!pinfo->clnp_dstref) && (pinfo->clnp_srcref)){ - atn_cv = find_atn_conversation( - &pinfo->src, - pinfo->clnp_srcref, - &pinfo->dst ); - } - /* CC: srcref and dstref present, always use src/srcref & dst */ - if((pinfo->clnp_dstref) && (pinfo->clnp_srcref)){ - atn_cv = find_atn_conversation( - &pinfo->src, - pinfo->clnp_srcref, - &pinfo->dst ); - } - - if(!atn_cv){ /* atn conversation not found */ - return 0; } - - atn_cpdlc_tree = proto_tree_add_subtree( - tree, tvb, 0, -1, ett_atn_cpdlc, NULL, - ATN_CPDLC_PROTO ); - - switch(atn_cv->ae_qualifier){ - case pmcpdlc: - if( check_heur_msg_type(pinfo) == um ) { - /* uplink PDU's = Ground PDU's */ - dissect_ProtectedGroundPDUs_PDU( - tvb, - pinfo, - atn_cpdlc_tree, NULL); - }else { /* downlink PDU's = Aircraft PDU's */ - dissect_ProtectedAircraftPDUs_PDU( - tvb, - pinfo, - atn_cpdlc_tree, NULL); - } - break; - case cpdlc: - if( check_heur_msg_type(pinfo) == um ) { - /* uplink PDU's = Ground PDU's */ - dissect_GroundPDUs_PDU( - tvb, - pinfo, - atn_cpdlc_tree, NULL); - }else { /* downlink PDU's = Aircraft PDU's */ - dissect_AircraftPDUs_PDU( - tvb, - pinfo, - atn_cpdlc_tree, NULL); - } - break; - default: - break; - } - return tvb_reported_length_remaining(tvb, 0); + /* note: */ + /* there are two co-existing applications of CPDLC: */ + /* "plain old" (ae-qualifier 2) and */ + /* "protected mode" (ae-qualifier 22) CPDLC. */ + /* "protected mode" was introduced to cope with a */ + /* safety issue in which a message would sent to the wrong aircraft. */ + + /* note:*/ + /* The protection is an additional checksum and covers the message content, */ + /* the 24-bit address of the aircraft, the current flight id and */ + /* the current ground facility so that an aircraft would be able to reject */ + /* messages which are unexpected (i.e. messages to another flight or */ + /* messages from the wrong center). */ + + /*note:*/ + /* although "plain old" CPDLC is more or less deprecated */ + /* many aircraft cannot perform */ + /* "protected mode" for this largely depends on */ + /* upgraded avionics packages */ + + /*note:*/ + /* The use of CPDLC is *optional* as the pilot */ + /* may always use a voice radio channel to talk to the controller.*/ + + proto_tree *atn_cpdlc_tree = NULL; + atn_conversation_t *atn_cv = NULL; + + /* note: */ + /* we need the ae qualifier stored within the conversation */ + /* to decode "plain old cpdlc" or */ + /* "protected mode cpdlc correctly " */ + + /* DT: dstref present, srcref is always zero */ + if((pinfo->clnp_dstref) && (!pinfo->clnp_srcref)){ + atn_cv = find_atn_conversation( + &pinfo->dst, + pinfo->clnp_dstref, + &pinfo->src ); + } + /* CR: srcref present, dstref is always zero */ + if((!pinfo->clnp_dstref) && (pinfo->clnp_srcref)){ + atn_cv = find_atn_conversation( + &pinfo->src, + pinfo->clnp_srcref, + &pinfo->dst ); + } + /* CC: srcref and dstref present, always use src/srcref & dst */ + if((pinfo->clnp_dstref) && (pinfo->clnp_srcref)){ + atn_cv = find_atn_conversation( + &pinfo->src, + pinfo->clnp_srcref, + &pinfo->dst ); + } + + if(!atn_cv){ /* atn conversation not found */ + return 0; } + + atn_cpdlc_tree = proto_tree_add_subtree( + tree, tvb, 0, -1, ett_atn_cpdlc, NULL, + ATN_CPDLC_PROTO ); + + switch(atn_cv->ae_qualifier){ + case pmcpdlc: + if( check_heur_msg_type(pinfo) == um ) { + /* uplink PDU's = Ground PDU's */ + dissect_ProtectedGroundPDUs_PDU( + tvb, + pinfo, + atn_cpdlc_tree, NULL); + }else { /* downlink PDU's = Aircraft PDU's */ + dissect_ProtectedAircraftPDUs_PDU( + tvb, + pinfo, + atn_cpdlc_tree, NULL); + } + break; + case cpdlc: + if( check_heur_msg_type(pinfo) == um ) { + /* uplink PDU's = Ground PDU's */ + dissect_GroundPDUs_PDU( + tvb, + pinfo, + atn_cpdlc_tree, NULL); + }else { /* downlink PDU's = Aircraft PDU's */ + dissect_AircraftPDUs_PDU( + tvb, + pinfo, + atn_cpdlc_tree, NULL); + } + break; + default: + break; + } + return tvb_reported_length_remaining(tvb, 0); } static gboolean dissect_atn_cpdlc_heur( - tvbuff_t *tvb, - packet_info *pinfo, - proto_tree *tree, - void *data _U_) + tvbuff_t *tvb, + packet_info *pinfo, + proto_tree *tree, + void *data _U_) { - atn_conversation_t *atn_cv = NULL; - volatile gboolean is_atn_cpdlc = FALSE; - volatile gboolean is_pm = FALSE; - int type; - - type = check_heur_msg_type(pinfo); - - switch(type){ - case um: - TRY { - dissect_ProtectedGroundPDUs_PDU(tvb, pinfo, NULL, NULL); - is_atn_cpdlc = TRUE; - is_pm = TRUE;} - CATCH_ALL{ - is_atn_cpdlc = FALSE; - is_pm = FALSE;} - ENDTRY; - if (is_atn_cpdlc) { - break; - } - TRY { - dissect_GroundPDUs_PDU(tvb, pinfo, NULL, NULL); - is_pm = FALSE; - is_atn_cpdlc = TRUE;} - CATCH_ALL{ - is_atn_cpdlc = FALSE; - is_pm = FALSE;} - ENDTRY; - break; - case dm: - TRY { - dissect_ProtectedAircraftPDUs_PDU(tvb, pinfo, NULL, NULL); - is_atn_cpdlc = TRUE; - is_pm = TRUE;} - CATCH_ALL { - is_atn_cpdlc = FALSE; - is_pm = FALSE; } - ENDTRY; - if (is_atn_cpdlc) { - break; - } - TRY{ - dissect_AircraftPDUs_PDU(tvb, pinfo, NULL, NULL); - is_atn_cpdlc = TRUE; - is_pm = FALSE;} - CATCH_ALL{ - is_atn_cpdlc = FALSE; - is_pm = FALSE;} - ENDTRY; - break; - default: - break; - } - - if(is_atn_cpdlc){ - /* note: */ - /* all subsequent PDU's belonging to this conversation */ - /* are considered CPDLC */ - /* if the first CPDLC PDU has been decoded succesfully */ - /* (This is done in "atn-ulcs" by using "call_dissector_with_data()") */ - - /* DT: dstref present, srcref is always zero */ - if((pinfo->clnp_dstref) && (!pinfo->clnp_srcref)){ - atn_cv = find_atn_conversation(&pinfo->dst, - pinfo->clnp_dstref, - &pinfo->src ); - } - /* CR: srcref present, dstref is always zero */ - if((!pinfo->clnp_dstref) && (pinfo->clnp_srcref)){ - atn_cv = find_atn_conversation(&pinfo->src, - pinfo->clnp_srcref, - &pinfo->dst ); - } - /* CC: srcref and dstref present, always use src/srcref & dst */ - if((pinfo->clnp_dstref) && (pinfo->clnp_srcref)){ - atn_cv = find_atn_conversation(&pinfo->src, - pinfo->clnp_srcref, - &pinfo->dst ); - } - - if(atn_cv){ /* atn conversation found */ - if(is_pm == TRUE) { - atn_cv->ae_qualifier = pmcpdlc; } - else { - atn_cv->ae_qualifier = cpdlc; } - dissect_atn_cpdlc(tvb, pinfo, tree, NULL); - } - }else { /* there should *always* be an atn conversation */ - is_atn_cpdlc = FALSE; - } - - return is_atn_cpdlc; + atn_conversation_t *atn_cv = NULL; + volatile gboolean is_atn_cpdlc = FALSE; + volatile gboolean is_pm = FALSE; + int type; + + type = check_heur_msg_type(pinfo); + + switch(type){ + case um: + TRY { + dissect_ProtectedGroundPDUs_PDU(tvb, pinfo, NULL, NULL); + is_atn_cpdlc = TRUE; + is_pm = TRUE;} + CATCH_ALL{ + is_atn_cpdlc = FALSE; + is_pm = FALSE;} + ENDTRY; + if (is_atn_cpdlc) { + break; + } + TRY { + dissect_GroundPDUs_PDU(tvb, pinfo, NULL, NULL); + is_pm = FALSE; + is_atn_cpdlc = TRUE;} + CATCH_ALL{ + is_atn_cpdlc = FALSE; + is_pm = FALSE;} + ENDTRY; + break; + case dm: + TRY { + dissect_ProtectedAircraftPDUs_PDU(tvb, pinfo, NULL, NULL); + is_atn_cpdlc = TRUE; + is_pm = TRUE;} + CATCH_ALL { + is_atn_cpdlc = FALSE; + is_pm = FALSE; } + ENDTRY; + if (is_atn_cpdlc) { + break; + } + TRY{ + dissect_AircraftPDUs_PDU(tvb, pinfo, NULL, NULL); + is_atn_cpdlc = TRUE; + is_pm = FALSE;} + CATCH_ALL{ + is_atn_cpdlc = FALSE; + is_pm = FALSE;} + ENDTRY; + break; + default: + break; + } + + if(is_atn_cpdlc){ + /* note: */ + /* all subsequent PDU's belonging to this conversation */ + /* are considered CPDLC */ + /* if the first CPDLC PDU has been decoded succesfully */ + /* (This is done in "atn-ulcs" by using "call_dissector_with_data()") */ + + /* DT: dstref present, srcref is always zero */ + if((pinfo->clnp_dstref) && (!pinfo->clnp_srcref)){ + atn_cv = find_atn_conversation(&pinfo->dst, + pinfo->clnp_dstref, + &pinfo->src ); + } + /* CR: srcref present, dstref is always zero */ + if((!pinfo->clnp_dstref) && (pinfo->clnp_srcref)){ + atn_cv = find_atn_conversation(&pinfo->src, + pinfo->clnp_srcref, + &pinfo->dst ); + } + /* CC: srcref and dstref present, always use src/srcref & dst */ + if((pinfo->clnp_dstref) && (pinfo->clnp_srcref)){ + atn_cv = find_atn_conversation(&pinfo->src, + pinfo->clnp_srcref, + &pinfo->dst ); + } + + if(atn_cv){ /* atn conversation found */ + if(is_pm == TRUE) { + atn_cv->ae_qualifier = pmcpdlc; } + else { + atn_cv->ae_qualifier = cpdlc; } + dissect_atn_cpdlc(tvb, pinfo, tree, NULL); + } + }else { /* there should *always* be an atn conversation */ + is_atn_cpdlc = FALSE; + } + + return is_atn_cpdlc; } @@ -7923,10 +7918,10 @@ void proto_register_atn_cpdlc (void) NULL, HFILL }}, /*--- End of included file: packet-atn-cpdlc-hfarr.c ---*/ -#line 309 "../../asn1/atn-cpdlc/packet-atn-cpdlc-template.c" - }; +#line 304 "../../asn1/atn-cpdlc/packet-atn-cpdlc-template.c" + }; - static gint *ett[] = { + static gint *ett[] = { /*--- Included file: packet-atn-cpdlc-ettarr.c ---*/ #line 1 "../../asn1/atn-cpdlc/packet-atn-cpdlc-ettarr.c" @@ -8074,52 +8069,51 @@ void proto_register_atn_cpdlc (void) &ett_atn_cpdlc_WindSpeed, /*--- End of included file: packet-atn-cpdlc-ettarr.c ---*/ -#line 313 "../../asn1/atn-cpdlc/packet-atn-cpdlc-template.c" - &ett_atn_cpdlc - }; +#line 308 "../../asn1/atn-cpdlc/packet-atn-cpdlc-template.c" + &ett_atn_cpdlc + }; - /* register CPDLC */ - proto_atn_cpdlc = proto_register_protocol( - ATN_CPDLC_PROTO , - "ATN-CPDLC", - "atn-cpdlc"); + /* register CPDLC */ + proto_atn_cpdlc = proto_register_protocol( + ATN_CPDLC_PROTO , + "ATN-CPDLC", + "atn-cpdlc"); - proto_register_field_array( - proto_atn_cpdlc, - hf_atn_cpdlc, - array_length(hf_atn_cpdlc)); + proto_register_field_array( + proto_atn_cpdlc, + hf_atn_cpdlc, + array_length(hf_atn_cpdlc)); - proto_register_subtree_array( - ett, - array_length(ett)); + proto_register_subtree_array( + ett, + array_length(ett)); - new_register_dissector( - "atn-cpdlc", - dissect_atn_cpdlc, - proto_atn_cpdlc); + new_register_dissector( + "atn-cpdlc", + dissect_atn_cpdlc, + proto_atn_cpdlc); } void proto_reg_handoff_atn_cpdlc(void) { - /* add session dissector to atn dissector list dissector list*/ - heur_dissector_add( - "atn-ulcs", - dissect_atn_cpdlc_heur, - "ATN-CPDLC over ATN-ULCS", - "atn-cpdlc-ulcs", - proto_atn_cpdlc, HEURISTIC_ENABLE); + /* add session dissector to atn dissector list dissector list*/ + heur_dissector_add( + "atn-ulcs", + dissect_atn_cpdlc_heur, + "ATN-CPDLC over ATN-ULCS", + "atn-cpdlc-ulcs", + proto_atn_cpdlc, HEURISTIC_ENABLE); } - /* * Editor modelines - http://www.wireshark.org/tools/modelines.html * * Local variables: - * c-basic-offset: 2 - * tab-width: 2 - * indent-tabs-mode: t + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil * End: * - * vi: set shiftwidth=2 tabstop=2 noexpandtab: - * :indentSize=2:tabSize=2:noTabs=false: + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: */ |