From 5a3ff9906cf446fce4baba794528cc9c8e9f07ff Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Wed, 22 Jun 2005 08:15:18 +0000 Subject: [PATCH] remove a dissector table we no longer use from ACSE and also from the CMIP and FTAM dissectors that tried to register against it. Implement a workaround for the asn2eth bug (can not yet handle tagged assignments) to the conformance file and remove the warnings from the template file. Since workaround is implemented in conformance file, make make copy_files install the dissector instead of printing a warning message. svn path=/trunk/; revision=14725 --- asn1/acse/Makefile | 4 +-- asn1/acse/acse.asn | 5 +++- asn1/acse/acse.cnf | 15 ++++++++++ asn1/acse/packet-acse-template.c | 27 +++--------------- asn1/cmip/packet-cmip-template.c | 6 ---- epan/dissectors/packet-acse.c | 49 ++++++++++++++------------------ epan/dissectors/packet-cmip.c | 5 ---- epan/dissectors/packet-ftam.c | 7 ----- 8 files changed, 46 insertions(+), 72 deletions(-) diff --git a/asn1/acse/Makefile b/asn1/acse/Makefile index af24ddd4d7..7321e4595b 100644 --- a/asn1/acse/Makefile +++ b/asn1/acse/Makefile @@ -13,7 +13,5 @@ clean: rm -f parsetab.py $(DISSECTOR_FILES) copy_files: generate_dissector -# cp $(DISSECTOR_FILES) ../../epan/dissectors - echo "Dont use this dissector yet, there are two bugs in it you will" - echo "have to fix manually first. See packet-acse.c comment at top " + cp $(DISSECTOR_FILES) ../../epan/dissectors diff --git a/asn1/acse/acse.asn b/asn1/acse/acse.asn index ab2cbe6388..eea7559e94 100644 --- a/asn1/acse/acse.asn +++ b/asn1/acse/acse.asn @@ -18,7 +18,10 @@ IMPORTS -- ITU-T Rec. X.501 | ISO/IEC 9594-2. - +-- Workaround for bug in ASN2ETH in the .cnf file +-- to handle the lack of support for tagged assignments. +-- remove that workaround once asn2eth learns how to handle +-- tagged assignments. EXTERNAL ::= [UNIVERSAL 8] IMPLICIT SEQUENCE { direct-reference OBJECT IDENTIFIER OPTIONAL, diff --git a/asn1/acse/acse.cnf b/asn1/acse/acse.cnf index 8ed7c9d569..a6ce2a9283 100644 --- a/asn1/acse/acse.cnf +++ b/asn1/acse/acse.cnf @@ -23,6 +23,21 @@ AARQ-apdu/aSO-context-name AARQ_aSO_context_name AARE-apdu/aSO-context-name AARE_aSO_context_name ACRQ-apdu/aSO-context-name ACRQ_aSO_context_name +#.FN_BODY EXTERNAL + gint8 class; + gboolean pc, ind_field; + gint32 tag; + gint32 len1; + + /* XXX asn2eth can not yet handle tagged assignment so for the + * time being just remove this tag manually inside the EXTERNAL + * dissector. + */ + offset = get_ber_identifier(tvb, offset, &class, &pc, &tag); + offset = get_ber_length(tree, tvb, offset, &len1, &ind_field); + offset = dissect_ber_sequence(TRUE, pinfo, tree, tvb, offset, + EXTERNAL_sequence, hf_index, ett_acse_EXTERNAL); + #.FN_BODY Authentication-value-other/other-mechanism-name offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset, hf_index, object_identifier_id); diff --git a/asn1/acse/packet-acse-template.c b/asn1/acse/packet-acse-template.c index 8c2e38496c..f558a82e4f 100644 --- a/asn1/acse/packet-acse-template.c +++ b/asn1/acse/packet-acse-template.c @@ -1,25 +1,9 @@ /*XXX - there is a bug in the generated code - static const ber_sequence_t Association_data_sequence_of[1] = { - { BER_CLASS_UNI, 8, BER_FLAGS_NOOWNTAG, dissect_Association_data_item }, - }; - must be changed into - static const ber_sequence_t Association_data_sequence_of[1] = { - { BER_CLASS_UNI, 8, NULL, dissect_Association_data_item }, - }; + There is a bug in asn2eth that it can not yet handle tagged assignments such + as EXTERNAL ::= [UNIVERSAL 8] IMPLICIT SEQUENCE { - and - static int dissect_Association_data_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { - int ret; - ret=dissect_acse_EXTERNAL(FALSE, tvb, offset, pinfo, tree, hf_acse_Association_data_item); - return ret; - } - must be changed into - static int dissect_Association_data_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { - int ret; - ret=dissect_acse_EXTERNAL(TRUE, tvb, offset, pinfo, tree, hf_acse_Association_data_item); - return ret; - } + This bug is workedaround by some .cnf magic but this should be cleaned up + once asn2eth learns how to deal with tagged assignments */ /* packet-acse.c @@ -299,9 +283,6 @@ void proto_register_acse(void) { proto_register_field_array(proto_acse, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); -/*XXX remove later just to keep the other dissectors happy */ -register_dissector_table("acse.application_context", "Application context OID", FT_STRING, BASE_NONE); - register_init_routine(acse_init); } diff --git a/asn1/cmip/packet-cmip-template.c b/asn1/cmip/packet-cmip-template.c index 088c003a46..afe58aaece 100644 --- a/asn1/cmip/packet-cmip-template.c +++ b/asn1/cmip/packet-cmip-template.c @@ -177,12 +177,6 @@ void proto_register_cmip(void) { /*--- proto_reg_handoff_cmip -------------------------------------------*/ void proto_reg_handoff_cmip(void) { - dissector_handle_t cmip_handle; - - /*XXX this to be removed later and shoved into the conformance file */ - /*XXX remove this later when ACSE is converted to ASN2ETH */ - cmip_handle = create_dissector_handle(dissect_cmip,proto_cmip); - dissector_add_string("acse.application_context", "2.9.0.0.2", cmip_handle); register_ber_oid_dissector("2.9.0.0.2", dissect_cmip, proto_cmip, "cmip"); } diff --git a/epan/dissectors/packet-acse.c b/epan/dissectors/packet-acse.c index f0c569e2fa..9cb93c829f 100644 --- a/epan/dissectors/packet-acse.c +++ b/epan/dissectors/packet-acse.c @@ -6,33 +6,19 @@ /* Input file: packet-acse-template.c */ /*XXX - there is a bug in the generated code - static const ber_sequence_t Association_data_sequence_of[1] = { - { BER_CLASS_UNI, 8, BER_FLAGS_NOOWNTAG, dissect_Association_data_item }, - }; - must be changed into - static const ber_sequence_t Association_data_sequence_of[1] = { - { BER_CLASS_UNI, 8, NULL, dissect_Association_data_item }, - }; + There is a bug in asn2eth that it can not yet handle tagged assignments such + as EXTERNAL ::= [UNIVERSAL 8] IMPLICIT SEQUENCE { - and - static int dissect_Association_data_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { - int ret; - ret=dissect_acse_EXTERNAL(FALSE, tvb, offset, pinfo, tree, hf_acse_Association_data_item); - return ret; - } - must be changed into - static int dissect_Association_data_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { - int ret; - ret=dissect_acse_EXTERNAL(TRUE, tvb, offset, pinfo, tree, hf_acse_Association_data_item); - return ret; - } + This bug is workedaround by some .cnf magic but this should be cleaned up + once asn2eth learns how to deal with tagged assignments */ /* packet-acse.c * Routines for ACSE packet dissection * Ronnie Sahlberg 2005 - * dissect_acse() from original handwritten dissector by Sid + * dissect_acse() based original handwritten dissector by Sid + * Yuriy Sidelnikov + * * * $Id$ * @@ -455,13 +441,25 @@ static const ber_sequence_t EXTERNAL_sequence[] = { static int dissect_acse_EXTERNAL(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { - offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset, + gint8 class; + gboolean pc, ind_field; + gint32 tag; + gint32 len1; + + /* XXX asn2eth can not yet handle tagged assignment so for the + * time being just remove this tag manually inside the EXTERNAL + * dissector. + */ + offset = get_ber_identifier(tvb, offset, &class, &pc, &tag); + offset = get_ber_length(tree, tvb, offset, &len1, &ind_field); + offset = dissect_ber_sequence(TRUE, pinfo, tree, tvb, offset, EXTERNAL_sequence, hf_index, ett_acse_EXTERNAL); + return offset; } static int dissect_Association_data_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { - return dissect_acse_EXTERNAL(TRUE, tvb, offset, pinfo, tree, hf_acse_Association_data_item); + return dissect_acse_EXTERNAL(FALSE, tvb, offset, pinfo, tree, hf_acse_Association_data_item); } static int dissect_external_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { return dissect_acse_EXTERNAL(TRUE, tvb, offset, pinfo, tree, hf_acse_external); @@ -1065,7 +1063,7 @@ static int dissect_calling_asoi_tag_impl(packet_info *pinfo, proto_tree *tree, t } static const ber_sequence_t Association_data_sequence_of[1] = { - { BER_CLASS_UNI, 8, NULL, dissect_Association_data_item }, + { BER_CLASS_UNI, 8, BER_FLAGS_NOOWNTAG, dissect_Association_data_item }, }; static int @@ -2387,9 +2385,6 @@ void proto_register_acse(void) { proto_register_field_array(proto_acse, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); -/*XXX remove later just to keep the other dissectors happy */ -register_dissector_table("acse.application_context", "Application context OID", FT_STRING, BASE_NONE); - register_init_routine(acse_init); } diff --git a/epan/dissectors/packet-cmip.c b/epan/dissectors/packet-cmip.c index 234d219e23..82af0bb4ac 100644 --- a/epan/dissectors/packet-cmip.c +++ b/epan/dissectors/packet-cmip.c @@ -3153,11 +3153,6 @@ void proto_register_cmip(void) { /*--- proto_reg_handoff_cmip -------------------------------------------*/ void proto_reg_handoff_cmip(void) { - dissector_handle_t cmip_handle; - - /*XXX this to be removed later and shoved into the conformance file */ - cmip_handle = create_dissector_handle(dissect_cmip,proto_cmip); - dissector_add_string("acse.application_context", "2.9.0.0.2", cmip_handle); register_ber_oid_dissector("2.9.0.0.2", dissect_cmip, proto_cmip, "cmip"); } diff --git a/epan/dissectors/packet-ftam.c b/epan/dissectors/packet-ftam.c index 8b6953aba1..02a4bc6109 100644 --- a/epan/dissectors/packet-ftam.c +++ b/epan/dissectors/packet-ftam.c @@ -3810,15 +3810,8 @@ proto_register_ftam(void) void proto_reg_handoff_ftam(void) { - dissector_handle_t ftam_handle; - /* find data dissector */ data_handle = find_dissector("data"); - ftam_handle = create_dissector_handle(dissect_ftam,proto_ftam); - /* Register in acse oid table */ - /* remove this when ACSE is replaced later */ - dissector_add_string("acse.application_context", "1.0.8571.1.1", ftam_handle); - register_ber_oid_dissector("1.0.8571.1.1", dissect_ftam, proto_ftam, "ftam"); }