diff options
author | Michael Mann <mmann78@netscape.net> | 2013-11-05 18:47:26 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2013-11-05 18:47:26 +0000 |
commit | b6b78d69dbae80ea0a0efc39400e3e88d5f9e337 (patch) | |
tree | 3b236e73ee8f1d83c07ecc5ab7a67af8bb19cc85 | |
parent | 389423aaaac460f5b0fcbaf37b4f3d5cd7941c5b (diff) |
In an effort to reduce the use of pinfo->private_data (and some true global variables), I converted the ASN.1 dissectors that use pinfo->private_data to exchange a SESSION_DATA_STRUCTURE to instead only exchange it in the context of ASN.1. This meant converting dissectors to the "new" style to pass the SESSION_DATA_STRUCTURE as well as providing a pointer to it in asn1_ctx_t.private_data. Yes, it's still "private data", but it's not used by all dissectors like pinfo->private data is.
svn path=/trunk/; revision=53090
31 files changed, 649 insertions, 635 deletions
diff --git a/asn1/acse/acse.cnf b/asn1/acse/acse.cnf index b3d815032d..ec0d8c0063 100644 --- a/asn1/acse/acse.cnf +++ b/asn1/acse/acse.cnf @@ -46,7 +46,7 @@ PDV-list/presentation-data-values/octet-aligned pDVList_octet_aligned FN_VARIANT = _str VAL_PTR = &object_identifier_id #.FN_BODY Authentication-value-other/other-mechanism-value - 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, actx->private_data); #.FN_BODY PDV-list/presentation-data-values/simple-ASN1-type /*XXX not implemented yet */ @@ -69,6 +69,8 @@ PDV-list/presentation-data-values/octet-aligned pDVList_octet_aligned #.FN_BODY EXTERNALt/_untag/indirect-reference char *oid; + struct SESSION_DATA_STRUCTURE* session = actx->private_data; + offset = dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_acse_indirect_reference, &indir_ref); @@ -85,10 +87,10 @@ PDV-list/presentation-data-values/octet-aligned pDVList_octet_aligned FN_VARIANT = _str VAL_PTR = &object_identifier_id #.FN_BODY EXTERNALt/_untag/encoding/single-ASN1-type - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, top_tree ? top_tree : tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, top_tree ? top_tree : tree, actx->private_data); #.FN_BODY EXTERNALt/_untag/encoding/octet-aligned - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, top_tree ? top_tree : tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, top_tree ? top_tree : tree, actx->private_data); #.FN_BODY AARQ-apdu col_append_str(actx->pinfo->cinfo, COL_INFO, "A-Associate-Request"); diff --git a/asn1/acse/packet-acse-template.c b/asn1/acse/packet-acse-template.c index 0684dfb865..d8b1a46119 100644 --- a/asn1/acse/packet-acse-template.c +++ b/asn1/acse/packet-acse-template.c @@ -76,8 +76,6 @@ static gint ett_acse = -1; static expert_field ei_acse_dissector_not_available = EI_INIT; -static struct SESSION_DATA_STRUCTURE* session = NULL; - static const char *object_identifier_id; /* indirect_reference, used to pick up the signalling so we know what kind of data is transferred in SES_DATA_TRANSFER_PDUs */ @@ -156,13 +154,14 @@ find_oid_by_ctx_id(packet_info *pinfo _U_, guint32 idx) /* * Dissect ACSE PDUs inside a PPDU. */ -static void -dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { int offset = 0; - proto_item *item=NULL; - proto_tree *tree=NULL; + proto_item *item; + proto_tree *tree; char *oid; + struct SESSION_DATA_STRUCTURE* session; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); @@ -173,24 +172,26 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_tree_add_text(parent_tree, tvb, offset, tvb_reported_length_remaining(tvb,offset), "User data"); - return; /* no, it isn't a ACSE PDU */ + return 0; /* no, it isn't a ACSE PDU */ } /* do we have spdu type from the session dissector? */ - if( !pinfo->private_data ){ + if( data == NULL){ if(parent_tree){ REPORT_DISSECTOR_BUG("Can't get SPDU type from session dissector."); } - return ; - } else { - session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) ); - if(session->spdu_type == 0 ) { - if(parent_tree){ - REPORT_DISSECTOR_BUG( - wmem_strdup_printf(wmem_packet_scope(), "Wrong spdu type %x from session dissector.",session->spdu_type)); - return ; - } + return 0; + } + + session = ( (struct SESSION_DATA_STRUCTURE*)data); + if(session->spdu_type == 0 ) { + if(parent_tree){ + REPORT_DISSECTOR_BUG( + wmem_strdup_printf(wmem_packet_scope(), "Wrong spdu type %x from session dissector.",session->spdu_type)); + return 0; } } + + asn1_ctx.private_data = session; /* save parent_tree so subdissectors can create new top nodes */ top_tree=parent_tree; @@ -220,33 +221,29 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) tvb, offset, -1); } top_tree = NULL; - return; + return 0; default: top_tree = NULL; - return; + return 0; } if(session->spdu_type == CLSES_UNIT_DATA) { /* create display subtree for the connectionless protocol */ - if(parent_tree) - { - item = proto_tree_add_item(parent_tree, proto_clacse, tvb, 0, -1, ENC_NA); - tree = proto_item_add_subtree(item, ett_acse); - } + item = proto_tree_add_item(parent_tree, proto_clacse, tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_acse); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "CL-ACSE"); - col_clear(pinfo->cinfo, COL_INFO); + col_clear(pinfo->cinfo, COL_INFO); } else { /* create display subtree for the protocol */ - if(parent_tree) - { - item = proto_tree_add_item(parent_tree, proto_acse, tvb, 0, -1, ENC_NA); - tree = proto_item_add_subtree(item, ett_acse); - } + item = proto_tree_add_item(parent_tree, proto_acse, tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_acse); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "ACSE"); - col_clear(pinfo->cinfo, COL_INFO); + col_clear(pinfo->cinfo, COL_INFO); } /* we can't make any additional checking here */ @@ -260,7 +257,8 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) } } -top_tree = NULL; + top_tree = NULL; + return tvb_length(tvb); } /*--- proto_register_acse ----------------------------------------------*/ @@ -285,7 +283,7 @@ void proto_register_acse(void) { /* Register protocol */ proto_acse = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("acse", dissect_acse, proto_acse); + new_register_dissector("acse", dissect_acse, proto_acse); /* Register connectionless protocol */ proto_clacse = proto_register_protocol(CLPNAME, CLPSNAME, CLPFNAME); @@ -302,9 +300,10 @@ void proto_register_acse(void) { /*--- proto_reg_handoff_acse -------------------------------------------*/ void proto_reg_handoff_acse(void) { /*#include "packet-acse-dis-tab.c"*/ + dissector_handle_t acse_handle = find_dissector("acse"); oid_add_from_string("id-aCSE","2.2.3.1.1"); - register_ber_oid_dissector(ACSE_APDU_OID, dissect_acse, proto_acse, "id-as-acse"); + register_ber_oid_dissector_handle(ACSE_APDU_OID, acse_handle, proto_acse, "id-as-acse"); } diff --git a/asn1/cmip/cmip.cnf b/asn1/cmip/cmip.cnf index d13697c12b..bca82d5202 100644 --- a/asn1/cmip/cmip.cnf +++ b/asn1/cmip/cmip.cnf @@ -272,7 +272,7 @@ RejectProblem #.FN_BODY Attribute/value if(attributeform==ATTRIBUTE_GLOBAL_FORM){ - offset=call_ber_oid_callback(attribute_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(attribute_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); } else if (dissector_try_uint(attribute_id_dissector_table, attribute_local_id, tvb, actx->pinfo, tree)) { offset=tvb_length (tvb); } else { @@ -283,7 +283,7 @@ RejectProblem FN_VARIANT = _str VAL_PTR = &attributevalueassertion_id #.FN_BODY AttributeValueAssertion/value - offset=call_ber_oid_callback(attributevalueassertion_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(attributevalueassertion_id, tvb, offset, actx->pinfo, tree, actx->private_data); #.FN_BODY Invoke/argument switch(opcode){ @@ -438,16 +438,16 @@ RejectProblem FN_VARIANT = _str HF_INDEX = hf_cmip_actionType_OID VAL_PTR = &object_identifier_id #.FN_BODY ActionInfo/actionInfoArg - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); #.FN_PARS EventTypeId/globalForm FN_VARIANT = _str HF_INDEX = hf_cmip_eventType_OID VAL_PTR = &object_identifier_id #.FN_BODY EventReportArgument/eventInfo - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); #.FN_BODY EventReply/eventReplyInfo - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); #.FN_BODY SetArgument/modificationList/_item/attributeValue if(attributeform==ATTRIBUTE_GLOBAL_FORM){ @@ -462,39 +462,39 @@ RejectProblem FN_VARIANT = _str HF_INDEX = hf_cmip_errorId_OID VAL_PTR = &object_identifier_id #.FN_BODY SpecificErrorInfo/errorInfo - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); #.FN_BODY AttributeError/attributeValue - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); #.FN_BODY InvalidArgumentValue/eventValue/eventInfo - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); #.FN_BODY ActionReply/actionReplyInfo - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); # X.721 #.FN_PARS ManagementExtension/identifier FN_VARIANT = _str VAL_PTR = &object_identifier_id #.FN_BODY ManagementExtension/information - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); #.FN_BODY AttributeValueChangeDefinition/_item/oldAttributeValue - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); #.FN_BODY AttributeValueChangeDefinition/_item/newAttributeValue - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); #.FN_PARS ServiceUser/identifier FN_VARIANT = _str VAL_PTR = &object_identifier_id #.FN_BODY ServiceUser/details - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); #.FN_PARS SupportedFeatures/_item/featureIdentifier FN_VARIANT = _str VAL_PTR = &object_identifier_id #.FN_BODY SupportedFeatures/_item/featureInfo - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); #.END diff --git a/asn1/cmip/packet-cmip-template.c b/asn1/cmip/packet-cmip-template.c index a37ae95e5d..32be20c9e3 100644 --- a/asn1/cmip/packet-cmip-template.c +++ b/asn1/cmip/packet-cmip-template.c @@ -97,35 +97,35 @@ static const char *objectclass_identifier_id; /* XXX this one should be broken out later and moved into the conformance file */ -static void -dissect_cmip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_cmip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { - static struct SESSION_DATA_STRUCTURE* session; - proto_item *item = NULL; - proto_tree *tree = NULL; + struct SESSION_DATA_STRUCTURE* session; + proto_item *item; + proto_tree *tree; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - session = (struct SESSION_DATA_STRUCTURE*)pinfo->private_data; + session = (struct SESSION_DATA_STRUCTURE*)data; /* do we have spdu type from the session dissector? */ if( !session ){ - proto_tree_add_text(tree, tvb, 0, -1, + proto_tree_add_text(parent_tree, tvb, 0, -1, "Internal error:can't get spdu type from session dissector."); - return; - } else { - if(session->spdu_type == 0 ) { - proto_tree_add_text(tree, tvb, 0, -1, - "Internal error:wrong spdu type %x from session dissector.",session->spdu_type); - return; - } + return 0; } - if(parent_tree){ - item = proto_tree_add_item(parent_tree, proto_cmip, tvb, 0, -1, ENC_NA); - tree = proto_item_add_subtree(item, ett_cmip); + if(session->spdu_type == 0 ) { + proto_tree_add_text(parent_tree, tvb, 0, -1, + "Internal error:wrong spdu type %x from session dissector.",session->spdu_type); + return 0; } + asn1_ctx.private_data = session; + + item = proto_tree_add_item(parent_tree, proto_cmip, tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_cmip); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "CMIP"); col_clear(pinfo->cinfo, COL_INFO); switch(session->spdu_type){ @@ -145,6 +145,8 @@ dissect_cmip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) default: ; } + + return tvb_length(tvb); } /*--- proto_register_cmip ----------------------------------------------*/ @@ -196,6 +198,7 @@ void proto_register_cmip(void) { /* Register protocol */ proto_cmip = proto_register_protocol(PNAME, PSNAME, PFNAME); + new_register_dissector("cmip", dissect_cmip, proto_cmip); /* Register fields and subtrees */ proto_register_field_array(proto_cmip, hf, array_length(hf)); @@ -210,8 +213,10 @@ void proto_register_cmip(void) { /*--- proto_reg_handoff_cmip -------------------------------------------*/ void proto_reg_handoff_cmip(void) { - register_ber_oid_dissector("2.9.0.0.2", dissect_cmip, proto_cmip, "cmip"); - register_ber_oid_dissector("2.9.1.1.4", dissect_cmip, proto_cmip, "joint-iso-itu-t(2) ms(9) cmip(1) cmip-pci(1) abstractSyntax(4)"); + dissector_handle_t cmip_handle = find_dissector("cmip"); + + register_ber_oid_dissector_handle("2.9.0.0.2", cmip_handle, proto_cmip, "cmip"); + register_ber_oid_dissector_handle("2.9.1.1.4", cmip_handle, proto_cmip, "joint-iso-itu-t(2) ms(9) cmip(1) cmip-pci(1) abstractSyntax(4)"); oid_add_from_string("2.9.3.2.3.1","managedObjectClass(3) alarmRecord(1)"); oid_add_from_string("2.9.3.2.3.2","managedObjectClass(3) attributeValueChangeRecord(2)"); diff --git a/asn1/disp/packet-disp-template.c b/asn1/disp/packet-disp-template.c index 961cf9dcf7..ef4e2f0570 100644 --- a/asn1/disp/packet-disp-template.c +++ b/asn1/disp/packet-disp-template.c @@ -61,8 +61,6 @@ static void prefs_register_disp(void); /* forward declaration for use in prefere /* Initialize the protocol and registered fields */ static int proto_disp = -1; -static struct SESSION_DATA_STRUCTURE* session = NULL; - #include "packet-disp-hf.c" /* Initialize the subtree pointers */ @@ -74,13 +72,14 @@ static gint ett_disp = -1; /* * Dissect DISP PDUs inside a ROS PDUs */ -static void -dissect_disp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_disp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { int offset = 0; int old_offset; - proto_item *item=NULL; - proto_tree *tree=NULL; + proto_item *item; + proto_tree *tree; + struct SESSION_DATA_STRUCTURE* session; int (*disp_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL; const char *disp_op_name; asn1_ctx_t asn1_ctx; @@ -88,20 +87,21 @@ dissect_disp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); /* do we have operation information from the ROS dissector? */ - if( !pinfo->private_data ){ + if( data == NULL ){ if(parent_tree){ proto_tree_add_text(parent_tree, tvb, offset, -1, "Internal error: can't get operation information from ROS dissector."); } - return ; - } else { - session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) ); + return 0; } - if(parent_tree){ - item = proto_tree_add_item(parent_tree, proto_disp, tvb, 0, -1, ENC_NA); - tree = proto_item_add_subtree(item, ett_disp); - } + session = ((struct SESSION_DATA_STRUCTURE*)data); + + asn1_ctx.private_data = session; + + item = proto_tree_add_item(parent_tree, proto_disp, tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_disp); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "DISP"); col_clear(pinfo->cinfo, COL_INFO); @@ -172,7 +172,7 @@ dissect_disp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) break; default: proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DISP PDU"); - return; + return tvb_length(tvb); } if(disp_dissector) { @@ -187,6 +187,8 @@ dissect_disp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) } } } + + return tvb_length(tvb); } @@ -208,7 +210,7 @@ void proto_register_disp(void) { /* Register protocol */ proto_disp = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("disp", dissect_disp, proto_disp); + new_register_dissector("disp", dissect_disp, proto_disp); /* Register fields and subtrees */ proto_register_field_array(proto_disp, hf, array_length(hf)); diff --git a/asn1/dop/dop.cnf b/asn1/dop/dop.cnf index bb6f148ae5..d1f90318ea 100644 --- a/asn1/dop/dop.cnf +++ b/asn1/dop/dop.cnf @@ -107,67 +107,67 @@ OpBindingErrorParam/bindingType BindingType #.FN_BODY EstablishOperationalBindingArgumentData/initiator/symmetric - offset = call_dop_oid_callback("establish.symmetric", tvb, offset, actx->pinfo, tree, "symmetric"); + offset = call_dop_oid_callback("establish.symmetric", tvb, offset, actx->pinfo, tree, "symmetric", actx->private_data); #.FN_BODY EstablishOperationalBindingArgumentData/initiator/roleA-initiates - offset = call_dop_oid_callback("establish.rolea", tvb, offset, actx->pinfo, tree, "roleA"); + offset = call_dop_oid_callback("establish.rolea", tvb, offset, actx->pinfo, tree, "roleA", actx->private_data); #.FN_BODY EstablishOperationalBindingArgumentData/initiator/roleB-initiates - offset = call_dop_oid_callback("establish.roleb", tvb, offset, actx->pinfo, tree, "roleB"); + offset = call_dop_oid_callback("establish.roleb", tvb, offset, actx->pinfo, tree, "roleB", actx->private_data); #.FN_BODY ModifyOperationalBindingArgumentData/initiator/symmetric - offset = call_dop_oid_callback("modify.symmetric", tvb, offset, actx->pinfo, tree, "symmetric"); + offset = call_dop_oid_callback("modify.symmetric", tvb, offset, actx->pinfo, tree, "symmetric", actx->private_data); #.FN_BODY ModifyOperationalBindingArgumentData/initiator/roleA-initiates - offset = call_dop_oid_callback("modify.rolea", tvb, offset, actx->pinfo, tree, "roleA"); + offset = call_dop_oid_callback("modify.rolea", tvb, offset, actx->pinfo, tree, "roleA", actx->private_data); #.FN_BODY ModifyOperationalBindingArgumentData/initiator/roleB-initiates - offset = call_dop_oid_callback("modify.roleb", tvb, offset, actx->pinfo, tree, "roleB"); + offset = call_dop_oid_callback("modify.roleb", tvb, offset, actx->pinfo, tree, "roleB", actx->private_data); #.FN_BODY TerminateOperationalBindingArgumentData/initiator/symmetric - offset = call_dop_oid_callback("terminate.symmetric", tvb, offset, actx->pinfo, tree, "symmetric"); + offset = call_dop_oid_callback("terminate.symmetric", tvb, offset, actx->pinfo, tree, "symmetric", actx->private_data); #.FN_BODY TerminateOperationalBindingArgumentData/initiator/roleA-initiates - offset = call_dop_oid_callback("terminate.rolea", tvb, offset, actx->pinfo, tree, "roleA"); + offset = call_dop_oid_callback("terminate.rolea", tvb, offset, actx->pinfo, tree, "roleA", actx->private_data); #.FN_BODY TerminateOperationalBindingArgumentData/initiator/roleB-initiates - offset = call_dop_oid_callback("terminate.roleb", tvb, offset, actx->pinfo, tree, "roleB"); + offset = call_dop_oid_callback("terminate.roleb", tvb, offset, actx->pinfo, tree, "roleB", actx->private_data); #.FN_BODY EstablishOperationalBindingArgumentData/agreement - offset = call_dop_oid_callback("agreement", tvb, offset, actx->pinfo, tree, NULL); + offset = call_dop_oid_callback("agreement", tvb, offset, actx->pinfo, tree, NULL, actx->private_data); #.FN_BODY EstablishOperationalBindingResult/initiator/symmetric - offset = call_dop_oid_callback("establish.symmetric", tvb, offset, actx->pinfo, tree, "symmetric"); + offset = call_dop_oid_callback("establish.symmetric", tvb, offset, actx->pinfo, tree, "symmetric", actx->private_data); #.FN_BODY EstablishOperationalBindingResult/initiator/roleA-replies - offset = call_dop_oid_callback("establish.rolea", tvb, offset, actx->pinfo, tree, "roleA"); + offset = call_dop_oid_callback("establish.rolea", tvb, offset, actx->pinfo, tree, "roleA", actx->private_data); #.FN_BODY EstablishOperationalBindingResult/initiator/roleB-replies - offset = call_dop_oid_callback("establish.roleb", tvb, offset, actx->pinfo, tree, "roleB"); + offset = call_dop_oid_callback("establish.roleb", tvb, offset, actx->pinfo, tree, "roleB", actx->private_data); #.FN_BODY OpBindingErrorParam/agreementProposal - offset = call_dop_oid_callback("agreement", tvb, offset, actx->pinfo, tree, NULL); + offset = call_dop_oid_callback("agreement", tvb, offset, actx->pinfo, tree, NULL, actx->private_data); #.FN_BODY ModifyOperationalBindingResultData/newAgreement - offset = call_dop_oid_callback("agreement", tvb, offset, actx->pinfo, tree, NULL); + offset = call_dop_oid_callback("agreement", tvb, offset, actx->pinfo, tree, NULL, actx->private_data); #.FN_BODY ModifyOperationalBindingArgumentData/newAgreement - offset = call_dop_oid_callback("agreement", tvb, offset, actx->pinfo, tree, NULL); + offset = call_dop_oid_callback("agreement", tvb, offset, actx->pinfo, tree, NULL, actx->private_data); #.FN_BODY OperationalBindingID/identifier VAL_PTR = &value diff --git a/asn1/dop/packet-dop-template.c b/asn1/dop/packet-dop-template.c index e8033d785a..28c3f138c7 100644 --- a/asn1/dop/packet-dop-template.c +++ b/asn1/dop/packet-dop-template.c @@ -58,10 +58,9 @@ static void prefs_register_dop(void); /* forward declaration for use in preferen /* Initialize the protocol and registered fields */ static int proto_dop = -1; -static struct SESSION_DATA_STRUCTURE* session = NULL; static const char *binding_type = NULL; /* binding_type */ -static int call_dop_oid_callback(const char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char *col_info); +static int call_dop_oid_callback(const char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char *col_info, void* data); #include "packet-dop-hf.c" @@ -86,7 +85,7 @@ static void append_oid(packet_info *pinfo, const char *oid) #include "packet-dop-fn.c" static int -call_dop_oid_callback(const char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char *col_info) +call_dop_oid_callback(const char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char *col_info, void* data) { char* binding_param; @@ -94,7 +93,7 @@ call_dop_oid_callback(const char *base_string, tvbuff_t *tvb, int offset, packet col_append_fstr(pinfo->cinfo, COL_INFO, " %s", col_info); - if (dissector_try_string(dop_dissector_table, binding_param, tvb, pinfo, tree, NULL)) { + if (dissector_try_string(dop_dissector_table, binding_param, tvb, pinfo, tree, data)) { offset = tvb_reported_length (tvb); } else { proto_item *item=NULL; @@ -115,13 +114,14 @@ call_dop_oid_callback(const char *base_string, tvbuff_t *tvb, int offset, packet /* * Dissect DOP PDUs inside a ROS PDUs */ -static void -dissect_dop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_dop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { int offset = 0; int old_offset; - proto_item *item=NULL; - proto_tree *tree=NULL; + proto_item *item; + proto_tree *tree; + struct SESSION_DATA_STRUCTURE* session; int (*dop_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL; const char *dop_op_name; asn1_ctx_t asn1_ctx; @@ -129,23 +129,24 @@ dissect_dop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); /* do we have operation information from the ROS dissector? */ - if( !pinfo->private_data ){ + if( data == NULL ){ if(parent_tree){ proto_tree_add_text(parent_tree, tvb, offset, -1, "Internal error: can't get operation information from ROS dissector."); } - return ; - } else { - session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) ); + return 0; } - if(parent_tree){ - item = proto_tree_add_item(parent_tree, proto_dop, tvb, 0, -1, ENC_NA); - tree = proto_item_add_subtree(item, ett_dop); - } + session = ( (struct SESSION_DATA_STRUCTURE*)data ); + + item = proto_tree_add_item(parent_tree, proto_dop, tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_dop); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "DOP"); col_clear(pinfo->cinfo, COL_INFO); + asn1_ctx.private_data = session; + switch(session->ros_op & ROS_OP_MASK) { case (ROS_OP_BIND | ROS_OP_ARGUMENT): /* BindInvoke */ dop_dissector = dissect_dop_DSAOperationalManagementBindArgument; @@ -213,7 +214,7 @@ dissect_dop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) break; default: proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DOP PDU"); - return; + return tvb_length(tvb); } if(dop_dissector) { @@ -228,6 +229,8 @@ dissect_dop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) } } } + + return tvb_length(tvb); } @@ -258,7 +261,7 @@ void proto_register_dop(void) { /* Register protocol */ proto_dop = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("dop", dissect_dop, proto_dop); + new_register_dissector("dop", dissect_dop, proto_dop); dop_dissector_table = register_dissector_table("dop.oid", "DOP OID Dissectors", FT_STRING, BASE_NONE); diff --git a/asn1/dsp/packet-dsp-template.c b/asn1/dsp/packet-dsp-template.c index 946119212c..4a9870ea30 100644 --- a/asn1/dsp/packet-dsp-template.c +++ b/asn1/dsp/packet-dsp-template.c @@ -55,8 +55,6 @@ static void prefs_register_dsp(void); /* forward declaration for use in preferen /* Initialize the protocol and registered fields */ static int proto_dsp = -1; -static struct SESSION_DATA_STRUCTURE* session = NULL; - #include "packet-dsp-hf.c" /* Initialize the subtree pointers */ @@ -68,13 +66,14 @@ static gint ett_dsp = -1; /* * Dissect X518 PDUs inside a ROS PDUs */ -static void -dissect_dsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_dsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { int offset = 0; int old_offset; - proto_item *item=NULL; - proto_tree *tree=NULL; + proto_item *item; + proto_tree *tree; + struct SESSION_DATA_STRUCTURE* session; int (*dsp_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL; const char *dsp_op_name; asn1_ctx_t asn1_ctx; @@ -82,23 +81,24 @@ dissect_dsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); /* do we have operation information from the ROS dissector? */ - if( !pinfo->private_data ){ + if( data == NULL ){ if(parent_tree){ proto_tree_add_text(parent_tree, tvb, offset, -1, "Internal error: can't get operation information from ROS dissector."); } - return ; - } else { - session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) ); + return 0; } - if(parent_tree){ - item = proto_tree_add_item(parent_tree, proto_dsp, tvb, 0, -1, ENC_NA); - tree = proto_item_add_subtree(item, ett_dsp); - } + session = ( (struct SESSION_DATA_STRUCTURE*)data); + + item = proto_tree_add_item(parent_tree, proto_dsp, tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_dsp); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "DAP"); col_clear(pinfo->cinfo, COL_INFO); + asn1_ctx.private_data = session; + switch(session->ros_op & ROS_OP_MASK) { case (ROS_OP_BIND | ROS_OP_ARGUMENT): /* BindInvoke */ dsp_dissector = dissect_dsp_DSASystemBindArgument; @@ -244,7 +244,7 @@ dissect_dsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) break; default: proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DSP PDU"); - return; + return tvb_length(tvb); } if(dsp_dissector) { @@ -259,6 +259,8 @@ dissect_dsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) } } } + + return tvb_length(tvb); } @@ -281,7 +283,7 @@ void proto_register_dsp(void) { /* Register protocol */ proto_dsp = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("dsp", dissect_dsp, proto_dsp); + new_register_dissector("dsp", dissect_dsp, proto_dsp); /* Register fields and subtrees */ proto_register_field_array(proto_dsp, hf, array_length(hf)); diff --git a/asn1/idmp/idmp.cnf b/asn1/idmp/idmp.cnf index 0b74ec29ac..a98458204a 100644 --- a/asn1/idmp/idmp.cnf +++ b/asn1/idmp/idmp.cnf @@ -28,8 +28,9 @@ IDM-PDU/result idm_result IdmResult/invokeID idm_invokeID #.FN_BODY IdmBind/argument + struct SESSION_DATA_STRUCTURE *session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; - return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_BIND | ROS_OP_ARGUMENT), top_tree); + return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_BIND | ROS_OP_ARGUMENT), top_tree, session); #.END @@ -37,8 +38,9 @@ IdmResult/invokeID idm_invokeID #.FN_BODY IdmBindResult/result + struct SESSION_DATA_STRUCTURE *session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; - return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_BIND | ROS_OP_RESULT), top_tree); + return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_BIND | ROS_OP_RESULT), top_tree, session); #.END @@ -47,23 +49,25 @@ IdmResult/invokeID idm_invokeID #.END #.FN_BODY IdmBindError/error + struct SESSION_DATA_STRUCTURE *session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; - return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_BIND| ROS_OP_ERROR), top_tree); + return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_BIND| ROS_OP_ERROR), top_tree, session); #.END #.FN_PARS Code/local VAL_PTR = &opcode #.FN_BODY Request/argument + struct SESSION_DATA_STRUCTURE *session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; - return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_INVOKE | ROS_OP_ARGUMENT | opcode), top_tree); + return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_INVOKE | ROS_OP_ARGUMENT | opcode), top_tree, session); #.END #.FN_BODY IdmResult/result + struct SESSION_DATA_STRUCTURE *session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; - return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_INVOKE | ROS_OP_RESULT | opcode), top_tree); - + return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_INVOKE | ROS_OP_RESULT | opcode), top_tree, session); #.END diff --git a/asn1/idmp/packet-idmp-template.c b/asn1/idmp/packet-idmp-template.c index d50de532df..075bd6d929 100644 --- a/asn1/idmp/packet-idmp-template.c +++ b/asn1/idmp/packet-idmp-template.c @@ -108,11 +108,9 @@ static const fragment_items idmp_frag_items = { }; -static int call_idmp_oid_callback(tvbuff_t *tvb, int offset, packet_info *pinfo, int op, proto_tree *tree _U_) +static int call_idmp_oid_callback(tvbuff_t *tvb, int offset, packet_info *pinfo, int op, proto_tree *tree, struct SESSION_DATA_STRUCTURE *session) { - struct SESSION_DATA_STRUCTURE *session; - - if((session = (struct SESSION_DATA_STRUCTURE*)pinfo->private_data) != NULL) { + if(session != NULL) { if((!saved_protocolID) && (op == (ROS_OP_BIND | ROS_OP_RESULT))) { /* save for subsequent operations - should be into session data */ @@ -121,7 +119,7 @@ static int call_idmp_oid_callback(tvbuff_t *tvb, int offset, packet_info *pinfo, /* mimic ROS! */ session->ros_op = op; - offset = call_ros_oid_callback(saved_protocolID ? saved_protocolID : protocolID, tvb, offset, pinfo, top_tree); + offset = call_ros_oid_callback(saved_protocolID ? saved_protocolID : protocolID, tvb, offset, pinfo, tree, session); } return offset; @@ -148,10 +146,9 @@ static void dissect_idmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_t { int offset = 0; - proto_item *item = NULL; - proto_tree *tree = NULL; + proto_item *item; + proto_tree *tree; asn1_ctx_t asn1_ctx; - void *save_private_data; struct SESSION_DATA_STRUCTURE session; gboolean idmp_final; guint32 idmp_length; @@ -171,10 +168,8 @@ static void dissect_idmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_t /* save parent_tree so subdissectors can create new top nodes */ top_tree=parent_tree; - if(parent_tree){ - item = proto_tree_add_item(parent_tree, proto_idmp, tvb, 0, -1, ENC_NA); - tree = proto_item_add_subtree(item, ett_idmp); - } + item = proto_tree_add_item(parent_tree, proto_idmp, tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_idmp); col_set_str(pinfo->cinfo, COL_PROTOCOL, "IDMP"); @@ -186,6 +181,8 @@ static void dissect_idmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_t proto_tree_add_item(tree, hf_idmp_length, tvb, offset, 4, ENC_BIG_ENDIAN); idmp_length = tvb_get_ntohl(tvb, offset); offset += 4; + asn1_ctx.private_data = &session; + if(idmp_reassemble) { pinfo->fragmented = !idmp_final; @@ -228,12 +225,8 @@ static void dissect_idmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_t } /* not reassembling - just dissect */ if(idmp_final) { - save_private_data = pinfo->private_data; - pinfo->private_data = &session; - + asn1_ctx.private_data = &session; dissect_idmp_IDM_PDU(FALSE, tvb, offset, &asn1_ctx, tree, hf_idmp_PDU); - - pinfo->private_data = save_private_data; } } diff --git a/asn1/p1/p1.cnf b/asn1/p1/p1.cnf index 6e24dc8ba2..f58377ca1e 100644 --- a/asn1/p1/p1.cnf +++ b/asn1/p1/p1.cnf @@ -549,7 +549,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token" expert_add_info(actx->pinfo, item, &ei_p1_unknown_standard_extension); } } else if (actx->external.direct_ref_present) { - offset = call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, NULL); + offset = call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, actx->private_data); name = oid_resolved_from_string(actx->external.direct_reference); proto_item_append_text(tree, " (%%s)", name ? name : actx->external.direct_reference); } @@ -562,7 +562,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token" const char *name; if (actx->external.direct_reference) { - offset = call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, NULL); + offset = call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, actx->private_data); name = oid_resolved_from_string(actx->external.direct_reference); proto_item_append_text(tree, " (%%s)", name ? name : actx->external.direct_reference); } else { @@ -673,7 +673,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token" if (next_tvb) { if (ctx && ctx->content_type_id) { - (void) call_ber_oid_callback(ctx->content_type_id, next_tvb, 0, actx->pinfo, actx->subtree.top_tree ? actx->subtree.top_tree : tree, NULL); + (void) call_ber_oid_callback(ctx->content_type_id, next_tvb, 0, actx->pinfo, actx->subtree.top_tree ? actx->subtree.top_tree : tree, actx->private_data); } else if (ctx && ctx->report_unknown_content_type) { proto_item *item = NULL; proto_tree *next_tree = NULL; @@ -1153,7 +1153,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token" #.FN_BODY TokenTypeData if(actx->external.direct_reference) - call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, NULL); + call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, actx->private_data); #.FN_PARS Credentials VAL_PTR = &credentials diff --git a/asn1/p1/packet-p1-template.c b/asn1/p1/packet-p1-template.c index 107d7fd85f..bd73ccdabb 100644 --- a/asn1/p1/packet-p1-template.c +++ b/asn1/p1/packet-p1-template.c @@ -221,13 +221,13 @@ dissect_p1_mts_apdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) /* * Dissect P1 PDUs inside a PPDU. */ -static void -dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { int offset = 0; int old_offset; - proto_item *item=NULL; - proto_tree *tree=NULL; + proto_item *item; + proto_tree *tree; struct SESSION_DATA_STRUCTURE* session; int (*p1_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_, proto_tree *tree, int hf_index _U_) = NULL; const char *p1_op_name; @@ -239,20 +239,21 @@ dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) p1_initialize_content_globals (&asn1_ctx, parent_tree, TRUE); /* do we have operation information from the ROS dissector? */ - if( !pinfo->private_data ){ + if( data == NULL ){ if(parent_tree){ proto_tree_add_text(parent_tree, tvb, offset, -1, "Internal error: can't get operation information from ROS dissector."); } - return; + return 0; } - session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) ); + session = ( (struct SESSION_DATA_STRUCTURE*)data ); + + asn1_ctx.private_data = session; + + item = proto_tree_add_item(parent_tree, proto_p1, tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_p1); - if(parent_tree){ - item = proto_tree_add_item(parent_tree, proto_p1, tvb, 0, -1, ENC_NA); - tree = proto_item_add_subtree(item, ett_p1); - } col_set_str(pinfo->cinfo, COL_PROTOCOL, "P1"); col_clear(pinfo->cinfo, COL_INFO); @@ -279,7 +280,7 @@ dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) break; default: proto_tree_add_text(tree, tvb, offset, -1,"Unsupported P1 PDU"); - return; + return tvb_length(tvb); } col_set_str(pinfo->cinfo, COL_INFO, p1_op_name); @@ -293,6 +294,7 @@ dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) } } p1_initialize_content_globals (&asn1_ctx, NULL, FALSE); + return tvb_length(tvb); } @@ -348,7 +350,7 @@ void proto_register_p1(void) { /* Register protocol */ proto_p1 = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("p1", dissect_p1, proto_p1); + new_register_dissector("p1", dissect_p1, proto_p1); proto_p3 = proto_register_protocol("X.411 Message Access Service", "P3", "p3"); diff --git a/asn1/pres/packet-pres-template.c b/asn1/pres/packet-pres-template.c index de4c08463b..3da29d1b73 100644 --- a/asn1/pres/packet-pres-template.c +++ b/asn1/pres/packet-pres-template.c @@ -58,10 +58,6 @@ static int proto_pres = -1; /* Initialize the connectionles protocol */ static int proto_clpres = -1; - -/* type of session envelop */ -static struct SESSION_DATA_STRUCTURE* session = NULL; - /* pointers for acse dissector */ proto_tree *global_tree = NULL; packet_info *global_pinfo = NULL; @@ -230,37 +226,36 @@ pres_free_cb(void *r) * Dissect an PPDU. */ static int -dissect_ppdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) +dissect_ppdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, struct SESSION_DATA_STRUCTURE* local_session) { proto_item *ti; - proto_tree *pres_tree = NULL; + proto_tree *pres_tree; + struct SESSION_DATA_STRUCTURE* session; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); /* do we have spdu type from the session dissector? */ - if( !pinfo->private_data ){ - if(tree){ - proto_tree_add_text(tree, tvb, offset, -1, + if( local_session == NULL ){ + proto_tree_add_text(tree, tvb, offset, -1, "Internal error:can't get spdu type from session dissector."); - return 0; - } - }else{ - session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) ); - if(session->spdu_type == 0 ){ - if(tree){ - proto_tree_add_text(tree, tvb, offset, -1, - "Internal error:wrong spdu type %x from session dissector.",session->spdu_type); - return 0; - } - } + return 0; } + + session = local_session; + if(session->spdu_type == 0 ){ + proto_tree_add_text(tree, tvb, offset, -1, + "Internal error:wrong spdu type %x from session dissector.",session->spdu_type); + return 0; + } + /* set up type of PPDU */ col_add_str(pinfo->cinfo, COL_INFO, val_to_str(session->spdu_type, ses_vals, "Unknown PPDU type (0x%02x)")); - if (tree){ - ti = proto_tree_add_item(tree, proto_pres, tvb, offset, -1, ENC_NA); - pres_tree = proto_item_add_subtree(ti, ett_pres); - } + + asn1_ctx.private_data = session; + + ti = proto_tree_add_item(tree, proto_pres, tvb, offset, -1, ENC_NA); + pres_tree = proto_item_add_subtree(ti, ett_pres); switch(session->spdu_type){ case SES_CONNECTION_REQUEST: @@ -296,12 +291,13 @@ dissect_ppdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) return offset; } -static void -dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { int offset = 0, old_offset; + struct SESSION_DATA_STRUCTURE* session; - session = ((struct SESSION_DATA_STRUCTURE*)(pinfo->private_data)); + session = ((struct SESSION_DATA_STRUCTURE*)data); /* first, try to check length */ /* do we have at least 4 bytes */ @@ -309,7 +305,7 @@ dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) if (session && session->spdu_type != SES_MAJOR_SYNC_POINT) { proto_tree_add_text(parent_tree, tvb, offset, tvb_reported_length_remaining(tvb,offset),"User data"); - return; /* no, it isn't a presentation PDU */ + return 0; /* no, it isn't a presentation PDU */ } } @@ -335,7 +331,7 @@ dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) /* dissect the packet */ dissect_UD_type_PDU(tvb, pinfo, clpres_tree); - return; + return tvb_length(tvb); } /* we can't make any additional checking here */ @@ -348,22 +344,24 @@ dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) /* This is a reassembly initiated in packet-ses */ char *oid = find_oid_by_pres_ctx_id (pinfo, session->pres_ctx_id); if (oid) { - call_ber_oid_callback (oid, tvb, offset, pinfo, parent_tree, NULL); + call_ber_oid_callback (oid, tvb, offset, pinfo, parent_tree, session); } else { proto_tree_add_text(parent_tree, tvb, offset, tvb_reported_length_remaining(tvb,offset),"User data"); } - return; - } + return tvb_length(tvb); + } while (tvb_reported_length_remaining(tvb, offset) > 0){ old_offset = offset; - offset = dissect_ppdu(tvb, offset, pinfo, parent_tree); + offset = dissect_ppdu(tvb, offset, pinfo, parent_tree, session); if(offset <= old_offset){ proto_tree_add_text(parent_tree, tvb, offset, -1,"Invalid offset"); THROW(ReportedBoundsError); } } + + return tvb_length(tvb); } @@ -432,7 +430,7 @@ void proto_register_pres(void) { /* Register protocol */ proto_pres = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("pres", dissect_pres, proto_pres); + new_register_dissector("pres", dissect_pres, proto_pres); /* Register connectionless protocol (just for the description) */ proto_clpres = proto_register_protocol(CLPNAME, CLPSNAME, CLPFNAME); diff --git a/asn1/pres/pres.cnf b/asn1/pres/pres.cnf index 414b3b958d..194d2d9c8d 100644 --- a/asn1/pres/pres.cnf +++ b/asn1/pres/pres.cnf @@ -41,7 +41,7 @@ CPR-PPDU/normal-mode-parameters/provider-reason cPR_PPDU__provider-reason oid=find_oid_by_pres_ctx_id(actx->pinfo, presentation_context_identifier); if(oid){ next_tvb = tvb_new_subset_remaining(tvb, offset); - call_ber_oid_callback(oid, next_tvb, offset, actx->pinfo, global_tree, NULL); + call_ber_oid_callback(oid, next_tvb, offset, actx->pinfo, global_tree, actx->private_data); } else { proto_tree_add_expert(tree, actx->pinfo, &ei_pres_dissector_not_available, tvb, offset, -1); @@ -55,7 +55,7 @@ CPR-PPDU/normal-mode-parameters/provider-reason cPR_PPDU__provider-reason oid=find_oid_by_pres_ctx_id(actx->pinfo, presentation_context_identifier); if(oid){ dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, &next_tvb); - call_ber_oid_callback(oid, next_tvb, offset, actx->pinfo, global_tree, NULL); + call_ber_oid_callback(oid, next_tvb, offset, actx->pinfo, global_tree, actx->private_data); } else { proto_tree_add_expert(tree, actx->pinfo, &ei_pres_dissector_not_available, tvb, offset, -1); @@ -72,6 +72,7 @@ CPR-PPDU/normal-mode-parameters/provider-reason cPR_PPDU__provider-reason #.FN_BODY Presentation-context-identifier const char *name; char *oid; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; %(DEFAULT_BODY)s diff --git a/asn1/ros/packet-ros-template.c b/asn1/ros/packet-ros-template.c index 4cbf770875..dd3929a602 100644 --- a/asn1/ros/packet-ros-template.c +++ b/asn1/ros/packet-ros-template.c @@ -135,7 +135,7 @@ static new_dissector_t ros_lookup_err_dissector(gint32 errcode, const ros_err_t } -static gboolean ros_try_string(const char *oid, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static gboolean ros_try_string(const char *oid, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, struct SESSION_DATA_STRUCTURE* session) { ros_info_t *rinfo; gint32 opcode_lcl = 0; @@ -145,9 +145,6 @@ static gboolean ros_try_string(const char *oid, tvbuff_t *tvb, packet_info *pinf const value_string *lookup; proto_item *item=NULL; proto_tree *ros_tree=NULL; - struct SESSION_DATA_STRUCTURE* session = NULL; - - session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) ); if((session != NULL) && ((rinfo = (ros_info_t*)g_hash_table_lookup(protocol_table, oid)) != NULL)) { @@ -207,14 +204,14 @@ static gboolean ros_try_string(const char *oid, tvbuff_t *tvb, packet_info *pinf } int -call_ros_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) +call_ros_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, struct SESSION_DATA_STRUCTURE* session) { tvbuff_t *next_tvb; next_tvb = tvb_new_subset_remaining(tvb, offset); - if(!ros_try_string(oid, next_tvb, pinfo, tree) && - !dissector_try_string(ros_oid_dissector_table, oid, next_tvb, pinfo, tree, NULL)){ + if(!ros_try_string(oid, next_tvb, pinfo, tree, session) && + !dissector_try_string(ros_oid_dissector_table, oid, next_tvb, pinfo, tree, session)){ proto_item *item=proto_tree_add_text(tree, next_tvb, 0, tvb_length_remaining(tvb, offset), "ROS: Dissector for OID:%s not implemented. Contact Wireshark developers if you want this supported", oid); proto_tree *next_tree=proto_item_add_subtree(item, ett_ros_unknown); @@ -374,13 +371,13 @@ ros_match_call_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui /* * Dissect ROS PDUs inside a PPDU. */ -static void -dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { int offset = 0; int old_offset; - proto_item *item=NULL; - proto_tree *tree=NULL; + proto_item *item; + proto_tree *tree; proto_tree *next_tree=NULL; conversation_t *conversation; ros_conv_info_t *ros_info = NULL; @@ -396,9 +393,10 @@ dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_tree_add_text(parent_tree, tvb, offset, -1, "Internal error:can't get application context from ACSE dissector."); } - return ; + return 0; } + asn1_ctx.private_data = data; conversation = find_or_create_conversation(pinfo); /* @@ -417,14 +415,13 @@ dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) ros_info->next = ros_info_items; ros_info_items = ros_info; - } + } /* pinfo->private_data = ros_info; */ - if(parent_tree){ - item = proto_tree_add_item(parent_tree, proto_ros, tvb, 0, -1, ENC_NA); - tree = proto_item_add_subtree(item, ett_ros); - } + item = proto_tree_add_item(parent_tree, proto_ros, tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_ros); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "ROS"); col_clear(pinfo->cinfo, COL_INFO); @@ -443,6 +440,8 @@ dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) break; } } + + return tvb_length(tvb); } static void @@ -506,7 +505,7 @@ void proto_register_ros(void) { /* Register protocol */ proto_ros = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("ros", dissect_ros, proto_ros); + new_register_dissector("ros", dissect_ros, proto_ros); /* Register fields and subtrees */ proto_register_field_array(proto_ros, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/asn1/ros/packet-ros-template.h b/asn1/ros/packet-ros-template.h index f3ca3c04d1..90ffb724d9 100644 --- a/asn1/ros/packet-ros-template.h +++ b/asn1/ros/packet-ros-template.h @@ -75,6 +75,6 @@ typedef struct _ros_info_t { void register_ros_oid_dissector_handle(const char *oid, dissector_handle_t dissector, int proto _U_, const char *name, gboolean uses_rtse); void register_ros_protocol_info(const char *oid, const ros_info_t *rinfo, int proto _U_, const char *name, gboolean uses_rtse); -int call_ros_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree); +int call_ros_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, struct SESSION_DATA_STRUCTURE* session); #endif /* PACKET_ROS_H */ diff --git a/asn1/ros/ros.cnf b/asn1/ros/ros.cnf index 6f7ebfda9c..1aeec52b3c 100644 --- a/asn1/ros/ros.cnf +++ b/asn1/ros/ros.cnf @@ -30,7 +30,7 @@ Reject/problem/returnResult rejectResult #.FN_BODY Invoke/argument char *oid; - struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->pinfo->private_data; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->private_data; /* not sure what the length should be - -1 for now */ proto_tree_add_text(tree, tvb, offset,-1, "invoke argument"); @@ -42,12 +42,12 @@ Reject/problem/returnResult rejectResult session->ros_op = (ROS_OP_INVOKE | ROS_OP_ARGUMENT); /* now add the opcode */ session->ros_op |= opcode; - offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree); + offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree, session); } #.FN_BODY ReturnResult/result/result char *oid; - struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->pinfo->private_data; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->private_data; /* not sure what the length should be - -1 for now */ proto_tree_add_text(tree, tvb, offset,-1, "return result"); @@ -59,12 +59,12 @@ Reject/problem/returnResult rejectResult session->ros_op = (ROS_OP_INVOKE | ROS_OP_RESULT); /* now add the opcode */ session->ros_op |= opcode; - offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree); + offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree, session); } #.FN_BODY ReturnError/parameter char *oid; - struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->pinfo->private_data; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->private_data; /* not sure what the length should be - -1 for now */ proto_tree_add_text(tree, tvb, offset,-1, "return result"); @@ -76,12 +76,12 @@ Reject/problem/returnResult rejectResult session->ros_op = (ROS_OP_INVOKE | ROS_OP_ERROR); /* now add the opcode (really the error code) */ session->ros_op |= opcode; - offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree); + offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree, session); } #.FN_BODY ROS/bind-invoke char *oid; - struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->pinfo->private_data; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->private_data; /* not sure what the length should be - -1 for now */ proto_tree_add_text(tree, tvb, offset,-1, "bind-invoke"); @@ -89,12 +89,12 @@ Reject/problem/returnResult rejectResult if(session && session->pres_ctx_id && (oid = find_oid_by_pres_ctx_id(actx->pinfo, session->pres_ctx_id))) { /* this should be ROS! */ session->ros_op = (ROS_OP_BIND | ROS_OP_ARGUMENT); - offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree); + offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree, session); } #.FN_BODY ROS/bind-result char *oid; - struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->pinfo->private_data; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->private_data; /* not sure what the length should be - -1 for now */ proto_tree_add_text(tree, tvb, offset,-1, "bind-result"); @@ -102,12 +102,12 @@ Reject/problem/returnResult rejectResult if(session && session->pres_ctx_id && (oid = find_oid_by_pres_ctx_id(actx->pinfo, session->pres_ctx_id))) { /* this should be ROS! */ session->ros_op = (ROS_OP_BIND | ROS_OP_RESULT); - offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree); + offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree, session); } #.FN_BODY ROS/bind-error char *oid; - struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->pinfo->private_data; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->private_data; /* not sure what the length should be - -1 for now */ proto_tree_add_text(tree, tvb, offset,-1, "bind-error"); @@ -115,13 +115,13 @@ Reject/problem/returnResult rejectResult if(session && session->pres_ctx_id && (oid = find_oid_by_pres_ctx_id(actx->pinfo, session->pres_ctx_id))) { /* this should be ROS! */ session->ros_op = (ROS_OP_BIND | ROS_OP_ERROR); - offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree); + offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree, session); } #.FN_BODY ROS/unbind-invoke char *oid; - struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->pinfo->private_data; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->private_data; /* not sure what the length should be - -1 for now */ proto_tree_add_text(tree, tvb, offset,-1, "unbind-invoke"); @@ -129,13 +129,13 @@ Reject/problem/returnResult rejectResult if(session && session->pres_ctx_id && (oid = find_oid_by_pres_ctx_id(actx->pinfo, session->pres_ctx_id))) { /* this should be ROS! */ session->ros_op = (ROS_OP_UNBIND | ROS_OP_ARGUMENT); - offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree); + offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree, session); } #.FN_BODY ROS/unbind-result char *oid; - struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->pinfo->private_data; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->private_data; /* not sure what the length should be - -1 for now */ proto_tree_add_text(tree, tvb, offset,-1, "unbind-result"); @@ -143,12 +143,12 @@ Reject/problem/returnResult rejectResult if(session && session->pres_ctx_id && (oid = find_oid_by_pres_ctx_id(actx->pinfo, session->pres_ctx_id))) { /* this should be ROS! */ session->ros_op = (ROS_OP_UNBIND | ROS_OP_RESULT); - offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree); + offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree, session); } #.FN_BODY ROS/unbind-error char *oid; - struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->pinfo->private_data; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->private_data; /* not sure what the length should be - -1 for now */ proto_tree_add_text(tree, tvb, offset,-1, "unbind-error"); @@ -156,7 +156,7 @@ Reject/problem/returnResult rejectResult if(session && session->pres_ctx_id && (oid = find_oid_by_pres_ctx_id(actx->pinfo, session->pres_ctx_id))) { /* this should be ROS! */ session->ros_op = (ROS_OP_UNBIND | ROS_OP_ERROR); - offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree); + offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree, session); } #.FN_BODY ROS/reject diff --git a/asn1/rtse/packet-rtse-template.c b/asn1/rtse/packet-rtse-template.c index 10a306ff4a..6ddd05d159 100644 --- a/asn1/rtse/packet-rtse-template.c +++ b/asn1/rtse/packet-rtse-template.c @@ -46,8 +46,6 @@ /* Initialize the protocol and registered fields */ static int proto_rtse = -1; -static struct SESSION_DATA_STRUCTURE* session = NULL; - static gboolean open_request=FALSE; static guint32 app_proto=0; @@ -142,12 +140,12 @@ register_rtse_oid_dissector_handle(const char *oid, dissector_handle_t dissector } static int -call_rtse_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) +call_rtse_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, void* data) { tvbuff_t *next_tvb; next_tvb = tvb_new_subset_remaining(tvb, offset); - if(!dissector_try_string(rtse_oid_dissector_table, oid, next_tvb, pinfo, tree, NULL)){ + if(!dissector_try_string(rtse_oid_dissector_table, oid, next_tvb, pinfo, tree, data)){ proto_item *item=proto_tree_add_text(tree, next_tvb, 0, tvb_length_remaining(tvb, offset), "RTSE: Dissector for OID:%s not implemented. Contact Wireshark developers if you want this supported", oid); proto_tree *next_tree=proto_item_add_subtree(item, ett_rtse_unknown); @@ -170,14 +168,14 @@ call_rtse_external_type_callback(gboolean implicit_tag _U_, tvbuff_t *tvb, int o { const char *oid = NULL; - if (actx->external.indirect_ref_present) { + if (actx->external.indirect_ref_present) { oid = (const char *)find_oid_by_pres_ctx_id(actx->pinfo, actx->external.indirect_reference); } else if (actx->external.direct_ref_present) { - oid = actx->external.direct_reference; + oid = actx->external.direct_reference; } if (oid) - offset = call_rtse_oid_callback(oid, tvb, offset, actx->pinfo, top_tree ? top_tree : tree); + offset = call_rtse_oid_callback(oid, tvb, offset, actx->pinfo, top_tree ? top_tree : tree, actx->private_data); return offset; } @@ -187,13 +185,13 @@ call_rtse_external_type_callback(gboolean implicit_tag _U_, tvbuff_t *tvb, int o /* * Dissect RTSE PDUs inside a PPDU. */ -static void -dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { int offset = 0; int old_offset; - proto_item *item=NULL; - proto_tree *tree=NULL; + proto_item *item; + proto_tree *tree; proto_tree *next_tree=NULL; tvbuff_t *next_tvb = NULL; tvbuff_t *data_tvb = NULL; @@ -201,6 +199,7 @@ dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) guint32 fragment_length; guint32 rtse_id = 0; gboolean data_handled = FALSE; + struct SESSION_DATA_STRUCTURE* session; conversation_t *conversation = NULL; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); @@ -209,19 +208,20 @@ dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) top_tree=parent_tree; /* do we have application context from the acse dissector? */ - if( !pinfo->private_data ){ + if( data == NULL ){ if(parent_tree){ proto_tree_add_text(parent_tree, tvb, offset, -1, "Internal error:can't get application context from ACSE dissector."); } - return ; - } else { - session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) ); - + return 0; } + session = ( (struct SESSION_DATA_STRUCTURE*)data); + + asn1_ctx.private_data = session; + col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTSE"); - col_clear(pinfo->cinfo, COL_INFO); + col_clear(pinfo->cinfo, COL_INFO); if (rtse_reassemble && ((session->spdu_type == SES_DATA_TRANSFER) || @@ -241,10 +241,10 @@ dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) next_tvb = process_reassembled_data (tvb, offset, pinfo, "Reassembled RTSE", frag_msg, &rtse_frag_items, NULL, parent_tree); } - if(parent_tree){ - item = proto_tree_add_item(parent_tree, proto_rtse, next_tvb ? next_tvb : tvb, 0, -1, ENC_NA); - tree = proto_item_add_subtree(item, ett_rtse); - } + + item = proto_tree_add_item(parent_tree, proto_rtse, next_tvb ? next_tvb : tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_rtse); + if (rtse_reassemble && session->spdu_type == SES_DATA_TRANSFER) { /* strip off the OCTET STRING encoding - including any CONSTRUCTED OCTET STRING */ dissect_ber_octet_string(FALSE, &asn1_ctx, tree, tvb, offset, hf_rtse_segment_data, &data_tvb); @@ -298,6 +298,7 @@ dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) } top_tree = NULL; + return tvb_length(tvb); } static void rtse_reassemble_init (void) @@ -371,7 +372,7 @@ void proto_register_rtse(void) { /* Register protocol */ proto_rtse = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("rtse", dissect_rtse, proto_rtse); + new_register_dissector("rtse", dissect_rtse, proto_rtse); /* Register fields and subtrees */ proto_register_field_array(proto_rtse, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/asn1/rtse/rtse.cnf b/asn1/rtse/rtse.cnf index f37206ebd5..b20927dda9 100644 --- a/asn1/rtse/rtse.cnf +++ b/asn1/rtse/rtse.cnf @@ -6,6 +6,7 @@ RTORJapdu RTABapdu #.FN_BODY RTORJapdu/userDataRJ + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; const char *oid = NULL; switch(app_proto) { @@ -25,32 +26,35 @@ RTABapdu oid = "applicationProtocol.12"; if(oid) { - if((session = (struct SESSION_DATA_STRUCTURE*)(actx->pinfo->private_data)) != NULL) + if(session != NULL) session->ros_op = (ROS_OP_BIND | ROS_OP_ERROR); - offset = call_rtse_oid_callback(oid, tvb, offset, actx->pinfo, top_tree ? top_tree : tree); + offset = call_rtse_oid_callback(oid, tvb, offset, actx->pinfo, top_tree ? top_tree : tree, session); } #.FN_BODY RTABapdu/userdataAB /*XXX not implemented yet */ #.FN_BODY RTORQapdu + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; - if((session = (struct SESSION_DATA_STRUCTURE*)(actx->pinfo->private_data)) != NULL) + if(session != NULL) session->ros_op = (ROS_OP_BIND | ROS_OP_ARGUMENT); open_request=TRUE; %(DEFAULT_BODY)s open_request=FALSE; #.FN_BODY RTOACapdu + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; - if((session = (struct SESSION_DATA_STRUCTURE*)(actx->pinfo->private_data)) != NULL) + if(session != NULL) session->ros_op = (ROS_OP_BIND | ROS_OP_RESULT); %(DEFAULT_BODY)s #.FN_BODY ConnectionData/open + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; const char *oid = NULL; switch(app_proto) { @@ -71,13 +75,14 @@ RTABapdu if(oid) { - offset = call_rtse_oid_callback(oid, tvb, offset, actx->pinfo, top_tree ? top_tree : tree); + offset = call_rtse_oid_callback(oid, tvb, offset, actx->pinfo, top_tree ? top_tree : tree, session); } /* else XXX: need to flag we can't find the presentation context */ #.FN_BODY RTTRapdu tvbuff_t *next_tvb = NULL; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_index, &next_tvb); diff --git a/epan/dissectors/packet-acse.c b/epan/dissectors/packet-acse.c index 409942f0cf..9c0c93e53d 100644 --- a/epan/dissectors/packet-acse.c +++ b/epan/dissectors/packet-acse.c @@ -237,8 +237,6 @@ static gint ett_acse_Authentication_value = -1; static expert_field ei_acse_dissector_not_available = EI_INIT; -static struct SESSION_DATA_STRUCTURE* session = NULL; - static const char *object_identifier_id; /* indirect_reference, used to pick up the signalling so we know what kind of data is transferred in SES_DATA_TRANSFER_PDUs */ @@ -329,6 +327,8 @@ static int dissect_acse_T_indirect_reference(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 71 "../../asn1/acse/acse.cnf" char *oid; + struct SESSION_DATA_STRUCTURE* session = actx->private_data; + offset = dissect_ber_integer(FALSE, actx, tree, tvb, offset, hf_acse_indirect_reference, &indir_ref); @@ -361,8 +361,8 @@ dissect_acse_ObjectDescriptor(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int static int dissect_acse_T_single_ASN1_type(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 88 "../../asn1/acse/acse.cnf" - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, top_tree ? top_tree : tree, NULL); +#line 90 "../../asn1/acse/acse.cnf" + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, top_tree ? top_tree : tree, actx->private_data); @@ -373,8 +373,8 @@ dissect_acse_T_single_ASN1_type(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in static int dissect_acse_T_octet_aligned(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 91 "../../asn1/acse/acse.cnf" - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, top_tree ? top_tree : tree, NULL); +#line 93 "../../asn1/acse/acse.cnf" + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, top_tree ? top_tree : tree, actx->private_data); @@ -680,7 +680,7 @@ dissect_acse_T_other_mechanism_name(gboolean implicit_tag _U_, tvbuff_t *tvb _U_ static int dissect_acse_T_other_mechanism_value(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 49 "../../asn1/acse/acse.cnf" - 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, actx->private_data); @@ -959,7 +959,7 @@ dissect_acse_AARQ_apdu_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse static int dissect_acse_AARQ_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 94 "../../asn1/acse/acse.cnf" +#line 96 "../../asn1/acse/acse.cnf" col_append_str(actx->pinfo->cinfo, COL_INFO, "A-Associate-Request"); offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset, @@ -1191,7 +1191,7 @@ dissect_acse_AARE_apdu_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse static int dissect_acse_AARE_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 99 "../../asn1/acse/acse.cnf" +#line 101 "../../asn1/acse/acse.cnf" col_append_str(actx->pinfo->cinfo, COL_INFO, "A-Associate-Response"); offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset, @@ -1214,7 +1214,7 @@ static const value_string acse_Release_request_reason_vals[] = { static int dissect_acse_Release_request_reason(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 112 "../../asn1/acse/acse.cnf" +#line 114 "../../asn1/acse/acse.cnf" int reason = -1; offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, @@ -1250,7 +1250,7 @@ dissect_acse_RLRQ_apdu_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse static int dissect_acse_RLRQ_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 104 "../../asn1/acse/acse.cnf" +#line 106 "../../asn1/acse/acse.cnf" col_append_str(actx->pinfo->cinfo, COL_INFO, "Release-Request"); offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset, @@ -1273,7 +1273,7 @@ static const value_string acse_Release_response_reason_vals[] = { static int dissect_acse_Release_response_reason(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 128 "../../asn1/acse/acse.cnf" +#line 130 "../../asn1/acse/acse.cnf" int reason = -1; offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, @@ -1309,7 +1309,7 @@ dissect_acse_RLRE_apdu_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse static int dissect_acse_RLRE_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 120 "../../asn1/acse/acse.cnf" +#line 122 "../../asn1/acse/acse.cnf" col_append_str(actx->pinfo->cinfo, COL_INFO, "Release-Response"); offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset, @@ -1331,7 +1331,7 @@ static const value_string acse_ABRT_source_vals[] = { static int dissect_acse_ABRT_source(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 141 "../../asn1/acse/acse.cnf" +#line 143 "../../asn1/acse/acse.cnf" int source = -1; offset = dissect_ber_constrained_integer(implicit_tag, actx, tree, tvb, offset, @@ -1388,7 +1388,7 @@ dissect_acse_ABRT_apdu_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse static int dissect_acse_ABRT_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 136 "../../asn1/acse/acse.cnf" +#line 138 "../../asn1/acse/acse.cnf" col_append_str(actx->pinfo->cinfo, COL_INFO, "Abort"); offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset, @@ -1690,19 +1690,20 @@ dissect_acse_AE_title(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _ /*--- End of included file: packet-acse-fn.c ---*/ -#line 154 "../../asn1/acse/packet-acse-template.c" +#line 152 "../../asn1/acse/packet-acse-template.c" /* * Dissect ACSE PDUs inside a PPDU. */ -static void -dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { int offset = 0; - proto_item *item=NULL; - proto_tree *tree=NULL; + proto_item *item; + proto_tree *tree; char *oid; + struct SESSION_DATA_STRUCTURE* session; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); @@ -1713,24 +1714,26 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_tree_add_text(parent_tree, tvb, offset, tvb_reported_length_remaining(tvb,offset), "User data"); - return; /* no, it isn't a ACSE PDU */ + return 0; /* no, it isn't a ACSE PDU */ } /* do we have spdu type from the session dissector? */ - if( !pinfo->private_data ){ + if( data == NULL){ if(parent_tree){ REPORT_DISSECTOR_BUG("Can't get SPDU type from session dissector."); } - return ; - } else { - session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) ); - if(session->spdu_type == 0 ) { - if(parent_tree){ - REPORT_DISSECTOR_BUG( - wmem_strdup_printf(wmem_packet_scope(), "Wrong spdu type %x from session dissector.",session->spdu_type)); - return ; - } + return 0; + } + + session = ( (struct SESSION_DATA_STRUCTURE*)data); + if(session->spdu_type == 0 ) { + if(parent_tree){ + REPORT_DISSECTOR_BUG( + wmem_strdup_printf(wmem_packet_scope(), "Wrong spdu type %x from session dissector.",session->spdu_type)); + return 0; } } + + asn1_ctx.private_data = session; /* save parent_tree so subdissectors can create new top nodes */ top_tree=parent_tree; @@ -1760,33 +1763,29 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) tvb, offset, -1); } top_tree = NULL; - return; + return 0; default: top_tree = NULL; - return; + return 0; } if(session->spdu_type == CLSES_UNIT_DATA) { /* create display subtree for the connectionless protocol */ - if(parent_tree) - { - item = proto_tree_add_item(parent_tree, proto_clacse, tvb, 0, -1, ENC_NA); - tree = proto_item_add_subtree(item, ett_acse); - } + item = proto_tree_add_item(parent_tree, proto_clacse, tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_acse); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "CL-ACSE"); - col_clear(pinfo->cinfo, COL_INFO); + col_clear(pinfo->cinfo, COL_INFO); } else { /* create display subtree for the protocol */ - if(parent_tree) - { - item = proto_tree_add_item(parent_tree, proto_acse, tvb, 0, -1, ENC_NA); - tree = proto_item_add_subtree(item, ett_acse); - } + item = proto_tree_add_item(parent_tree, proto_acse, tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_acse); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "ACSE"); - col_clear(pinfo->cinfo, COL_INFO); + col_clear(pinfo->cinfo, COL_INFO); } /* we can't make any additional checking here */ @@ -1800,7 +1799,8 @@ dissect_acse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) } } -top_tree = NULL; + top_tree = NULL; + return tvb_length(tvb); } /*--- proto_register_acse ----------------------------------------------*/ @@ -2241,7 +2241,7 @@ void proto_register_acse(void) { NULL, HFILL }}, /*--- End of included file: packet-acse-hfarr.c ---*/ -#line 272 "../../asn1/acse/packet-acse-template.c" +#line 270 "../../asn1/acse/packet-acse-template.c" }; /* List of subtrees */ @@ -2287,7 +2287,7 @@ void proto_register_acse(void) { &ett_acse_Authentication_value, /*--- End of included file: packet-acse-ettarr.c ---*/ -#line 278 "../../asn1/acse/packet-acse-template.c" +#line 276 "../../asn1/acse/packet-acse-template.c" }; static ei_register_info ei[] = { @@ -2298,7 +2298,7 @@ void proto_register_acse(void) { /* Register protocol */ proto_acse = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("acse", dissect_acse, proto_acse); + new_register_dissector("acse", dissect_acse, proto_acse); /* Register connectionless protocol */ proto_clacse = proto_register_protocol(CLPNAME, CLPSNAME, CLPFNAME); @@ -2315,9 +2315,10 @@ void proto_register_acse(void) { /*--- proto_reg_handoff_acse -------------------------------------------*/ void proto_reg_handoff_acse(void) { /*#include "packet-acse-dis-tab.c"*/ + dissector_handle_t acse_handle = find_dissector("acse"); oid_add_from_string("id-aCSE","2.2.3.1.1"); - register_ber_oid_dissector(ACSE_APDU_OID, dissect_acse, proto_acse, "id-as-acse"); + register_ber_oid_dissector_handle(ACSE_APDU_OID, acse_handle, proto_acse, "id-as-acse"); } diff --git a/epan/dissectors/packet-cmip.c b/epan/dissectors/packet-cmip.c index da583788a2..9ae07f4761 100644 --- a/epan/dissectors/packet-cmip.c +++ b/epan/dissectors/packet-cmip.c @@ -792,7 +792,7 @@ dissect_cmip_T_id(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, static int dissect_cmip_T_attributeValueAssertionvalue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 286 "../../asn1/cmip/cmip.cnf" - offset=call_ber_oid_callback(attributevalueassertion_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(attributevalueassertion_id, tvb, offset, actx->pinfo, tree, actx->private_data); @@ -956,7 +956,7 @@ static int dissect_cmip_AttributeValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 274 "../../asn1/cmip/cmip.cnf" if(attributeform==ATTRIBUTE_GLOBAL_FORM){ - offset=call_ber_oid_callback(attribute_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(attribute_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); } else if (dissector_try_uint(attribute_id_dissector_table, attribute_local_id, tvb, actx->pinfo, tree)) { offset=tvb_length (tvb); } else { @@ -1129,7 +1129,7 @@ dissect_cmip_ActionTypeId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs static int dissect_cmip_T_actionInfoArg(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 441 "../../asn1/cmip/cmip.cnf" - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); @@ -1286,7 +1286,7 @@ dissect_cmip_NoSuchArgument(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of static int dissect_cmip_T_eventInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 471 "../../asn1/cmip/cmip.cnf" - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); @@ -1391,7 +1391,7 @@ dissect_cmip_ActionError(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse static int dissect_cmip_T_actionReplyInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 474 "../../asn1/cmip/cmip.cnf" - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); @@ -1473,7 +1473,7 @@ dissect_cmip_ModifyOperator(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of static int dissect_cmip_T_attributeValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 468 "../../asn1/cmip/cmip.cnf" - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); @@ -1701,7 +1701,7 @@ dissect_cmip_DeleteResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs static int dissect_cmip_T_eventReplyInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 450 "../../asn1/cmip/cmip.cnf" - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); @@ -1728,7 +1728,7 @@ dissect_cmip_EventReply(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset static int dissect_cmip_EventReportArgumentEventInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 447 "../../asn1/cmip/cmip.cnf" - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); @@ -1995,7 +1995,7 @@ dissect_cmip_T_errorId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset static int dissect_cmip_T_errorInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 465 "../../asn1/cmip/cmip.cnf" - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); @@ -2348,7 +2348,7 @@ dissect_cmip_BOOLEAN(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U static int dissect_cmip_T_information(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 481 "../../asn1/cmip/cmip.cnf" - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); @@ -2445,7 +2445,7 @@ dissect_cmip_AttributeList(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off static int dissect_cmip_T_oldAttributeValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 484 "../../asn1/cmip/cmip.cnf" - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); @@ -2457,7 +2457,7 @@ dissect_cmip_T_oldAttributeValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, i static int dissect_cmip_T_newAttributeValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 487 "../../asn1/cmip/cmip.cnf" - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); @@ -3233,7 +3233,7 @@ dissect_cmip_T_serviceUseridentifier(gboolean implicit_tag _U_, tvbuff_t *tvb _U static int dissect_cmip_T_details(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 492 "../../asn1/cmip/cmip.cnf" - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); @@ -3356,7 +3356,7 @@ dissect_cmip_T_featureIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, i static int dissect_cmip_T_featureInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 497 "../../asn1/cmip/cmip.cnf" - offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, NULL); + offset=call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree, actx->private_data); @@ -4387,35 +4387,35 @@ static void dissect_WeekMask_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, prot /* XXX this one should be broken out later and moved into the conformance file */ -static void -dissect_cmip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_cmip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { - static struct SESSION_DATA_STRUCTURE* session; - proto_item *item = NULL; - proto_tree *tree = NULL; + struct SESSION_DATA_STRUCTURE* session; + proto_item *item; + proto_tree *tree; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - session = (struct SESSION_DATA_STRUCTURE*)pinfo->private_data; + session = (struct SESSION_DATA_STRUCTURE*)data; /* do we have spdu type from the session dissector? */ if( !session ){ - proto_tree_add_text(tree, tvb, 0, -1, + proto_tree_add_text(parent_tree, tvb, 0, -1, "Internal error:can't get spdu type from session dissector."); - return; - } else { - if(session->spdu_type == 0 ) { - proto_tree_add_text(tree, tvb, 0, -1, - "Internal error:wrong spdu type %x from session dissector.",session->spdu_type); - return; - } + return 0; } - if(parent_tree){ - item = proto_tree_add_item(parent_tree, proto_cmip, tvb, 0, -1, ENC_NA); - tree = proto_item_add_subtree(item, ett_cmip); + if(session->spdu_type == 0 ) { + proto_tree_add_text(parent_tree, tvb, 0, -1, + "Internal error:wrong spdu type %x from session dissector.",session->spdu_type); + return 0; } + asn1_ctx.private_data = session; + + item = proto_tree_add_item(parent_tree, proto_cmip, tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_cmip); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "CMIP"); col_clear(pinfo->cinfo, COL_INFO); switch(session->spdu_type){ @@ -4435,6 +4435,8 @@ dissect_cmip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) default: ; } + + return tvb_length(tvb); } /*--- proto_register_cmip ----------------------------------------------*/ @@ -5580,7 +5582,7 @@ void proto_register_cmip(void) { NULL, HFILL }}, /*--- End of included file: packet-cmip-hfarr.c ---*/ -#line 189 "../../asn1/cmip/packet-cmip-template.c" +#line 191 "../../asn1/cmip/packet-cmip-template.c" }; /* List of subtrees */ @@ -5712,11 +5714,12 @@ void proto_register_cmip(void) { &ett_cmip_T_modificationList_item, /*--- End of included file: packet-cmip-ettarr.c ---*/ -#line 195 "../../asn1/cmip/packet-cmip-template.c" +#line 197 "../../asn1/cmip/packet-cmip-template.c" }; /* Register protocol */ proto_cmip = proto_register_protocol(PNAME, PSNAME, PFNAME); + new_register_dissector("cmip", dissect_cmip, proto_cmip); /* Register fields and subtrees */ proto_register_field_array(proto_cmip, hf, array_length(hf)); @@ -5797,7 +5800,7 @@ void proto_register_cmip(void) { /*--- End of included file: packet-cmip-dis-tab.c ---*/ -#line 204 "../../asn1/cmip/packet-cmip-template.c" +#line 207 "../../asn1/cmip/packet-cmip-template.c" oid_add_from_string("discriminatorId(1)","2.9.3.2.7.1"); attribute_id_dissector_table = register_dissector_table("cmip.attribute_id", "CMIP Attribute Id", FT_UINT32, BASE_DEC); @@ -5807,8 +5810,10 @@ void proto_register_cmip(void) { /*--- proto_reg_handoff_cmip -------------------------------------------*/ void proto_reg_handoff_cmip(void) { - register_ber_oid_dissector("2.9.0.0.2", dissect_cmip, proto_cmip, "cmip"); - register_ber_oid_dissector("2.9.1.1.4", dissect_cmip, proto_cmip, "joint-iso-itu-t(2) ms(9) cmip(1) cmip-pci(1) abstractSyntax(4)"); + dissector_handle_t cmip_handle = find_dissector("cmip"); + + register_ber_oid_dissector_handle("2.9.0.0.2", cmip_handle, proto_cmip, "cmip"); + register_ber_oid_dissector_handle("2.9.1.1.4", cmip_handle, proto_cmip, "joint-iso-itu-t(2) ms(9) cmip(1) cmip-pci(1) abstractSyntax(4)"); oid_add_from_string("2.9.3.2.3.1","managedObjectClass(3) alarmRecord(1)"); oid_add_from_string("2.9.3.2.3.2","managedObjectClass(3) attributeValueChangeRecord(2)"); diff --git a/epan/dissectors/packet-disp.c b/epan/dissectors/packet-disp.c index cf50ace710..d7c16da442 100644 --- a/epan/dissectors/packet-disp.c +++ b/epan/dissectors/packet-disp.c @@ -1501,8 +1501,8 @@ static void dissect_ShadowingAgreementInfo_PDU(tvbuff_t *tvb _U_, packet_info *p /* * Dissect DISP PDUs inside a ROS PDUs */ -static void -dissect_disp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_disp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { int offset = 0; int old_offset; @@ -1515,14 +1515,14 @@ dissect_disp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); /* do we have operation information from the ROS dissector? */ - if( !pinfo->private_data ){ + if( data == NULL ){ if(parent_tree){ proto_tree_add_text(parent_tree, tvb, offset, -1, "Internal error: can't get operation information from ROS dissector."); } - return ; + return 0; } else { - session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) ); + session = ((struct SESSION_DATA_STRUCTURE*)data); } if(parent_tree){ @@ -1599,7 +1599,7 @@ dissect_disp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) break; default: proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DISP PDU"); - return; + return tvb_length(tvb); } if(disp_dissector) { @@ -1614,6 +1614,8 @@ dissect_disp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) } } } + + return tvb_length(tvb); } @@ -2056,7 +2058,7 @@ void proto_register_disp(void) { "ShadowErrorData", HFILL }}, /*--- End of included file: packet-disp-hfarr.c ---*/ -#line 200 "../../asn1/disp/packet-disp-template.c" +#line 202 "../../asn1/disp/packet-disp-template.c" }; /* List of subtrees */ @@ -2121,13 +2123,13 @@ void proto_register_disp(void) { &ett_disp_T_signedShadowError, /*--- End of included file: packet-disp-ettarr.c ---*/ -#line 206 "../../asn1/disp/packet-disp-template.c" +#line 208 "../../asn1/disp/packet-disp-template.c" }; module_t *disp_module; /* Register protocol */ proto_disp = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("disp", dissect_disp, proto_disp); + new_register_dissector("disp", dissect_disp, proto_disp); /* Register fields and subtrees */ proto_register_field_array(proto_disp, hf, array_length(hf)); @@ -2160,7 +2162,7 @@ void proto_reg_handoff_disp(void) { /*--- End of included file: packet-disp-dis-tab.c ---*/ -#line 234 "../../asn1/disp/packet-disp-template.c" +#line 236 "../../asn1/disp/packet-disp-template.c" /* APPLICATION CONTEXT */ diff --git a/epan/dissectors/packet-dop.c b/epan/dissectors/packet-dop.c index 90d11e3470..c6306bc27f 100644 --- a/epan/dissectors/packet-dop.c +++ b/epan/dissectors/packet-dop.c @@ -66,10 +66,9 @@ static void prefs_register_dop(void); /* forward declaration for use in preferen /* Initialize the protocol and registered fields */ static int proto_dop = -1; -static struct SESSION_DATA_STRUCTURE* session = NULL; static const char *binding_type = NULL; /* binding_type */ -static int call_dop_oid_callback(const char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char *col_info); +static int call_dop_oid_callback(const char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char *col_info, void* data); /*--- Included file: packet-dop-hf.c ---*/ @@ -267,7 +266,7 @@ static int hf_dop_GrantsAndDenials_grantInvoke = -1; static int hf_dop_GrantsAndDenials_denyInvoke = -1; /*--- End of included file: packet-dop-hf.c ---*/ -#line 67 "../../asn1/dop/packet-dop-template.c" +#line 66 "../../asn1/dop/packet-dop-template.c" /* Initialize the subtree pointers */ static gint ett_dop = -1; @@ -344,7 +343,7 @@ static gint ett_dop_T_basicLevels = -1; static gint ett_dop_GrantsAndDenials = -1; /*--- End of included file: packet-dop-ett.c ---*/ -#line 72 "../../asn1/dop/packet-dop-template.c" +#line 71 "../../asn1/dop/packet-dop-template.c" static expert_field ei_dop_unknown_binding_parameter = EI_INIT; @@ -590,7 +589,7 @@ static int dissect_dop_EstablishSymmetric(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 109 "../../asn1/dop/dop.cnf" - offset = call_dop_oid_callback("establish.symmetric", tvb, offset, actx->pinfo, tree, "symmetric"); + offset = call_dop_oid_callback("establish.symmetric", tvb, offset, actx->pinfo, tree, "symmetric", actx->private_data); @@ -603,7 +602,7 @@ static int dissect_dop_EstablishRoleAInitiates(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 113 "../../asn1/dop/dop.cnf" - offset = call_dop_oid_callback("establish.rolea", tvb, offset, actx->pinfo, tree, "roleA"); + offset = call_dop_oid_callback("establish.rolea", tvb, offset, actx->pinfo, tree, "roleA", actx->private_data); @@ -616,7 +615,7 @@ static int dissect_dop_EstablishRoleBInitiates(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 117 "../../asn1/dop/dop.cnf" - offset = call_dop_oid_callback("establish.roleb", tvb, offset, actx->pinfo, tree, "roleB"); + offset = call_dop_oid_callback("establish.roleb", tvb, offset, actx->pinfo, tree, "roleB", actx->private_data); @@ -653,7 +652,7 @@ static int dissect_dop_T_agreement(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 145 "../../asn1/dop/dop.cnf" - offset = call_dop_oid_callback("agreement", tvb, offset, actx->pinfo, tree, NULL); + offset = call_dop_oid_callback("agreement", tvb, offset, actx->pinfo, tree, NULL, actx->private_data); @@ -843,7 +842,7 @@ static int dissect_dop_T_symmetric(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 149 "../../asn1/dop/dop.cnf" - offset = call_dop_oid_callback("establish.symmetric", tvb, offset, actx->pinfo, tree, "symmetric"); + offset = call_dop_oid_callback("establish.symmetric", tvb, offset, actx->pinfo, tree, "symmetric", actx->private_data); @@ -856,7 +855,7 @@ static int dissect_dop_T_roleA_replies(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 153 "../../asn1/dop/dop.cnf" - offset = call_dop_oid_callback("establish.rolea", tvb, offset, actx->pinfo, tree, "roleA"); + offset = call_dop_oid_callback("establish.rolea", tvb, offset, actx->pinfo, tree, "roleA", actx->private_data); @@ -869,7 +868,7 @@ static int dissect_dop_T_roleB_replies(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 157 "../../asn1/dop/dop.cnf" - offset = call_dop_oid_callback("establish.roleb", tvb, offset, actx->pinfo, tree, "roleB"); + offset = call_dop_oid_callback("establish.roleb", tvb, offset, actx->pinfo, tree, "roleB", actx->private_data); @@ -940,7 +939,7 @@ static int dissect_dop_ModifySymmetric(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 121 "../../asn1/dop/dop.cnf" - offset = call_dop_oid_callback("modify.symmetric", tvb, offset, actx->pinfo, tree, "symmetric"); + offset = call_dop_oid_callback("modify.symmetric", tvb, offset, actx->pinfo, tree, "symmetric", actx->private_data); @@ -953,7 +952,7 @@ static int dissect_dop_ModifyRoleAInitiates(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 125 "../../asn1/dop/dop.cnf" - offset = call_dop_oid_callback("modify.rolea", tvb, offset, actx->pinfo, tree, "roleA"); + offset = call_dop_oid_callback("modify.rolea", tvb, offset, actx->pinfo, tree, "roleA", actx->private_data); @@ -966,7 +965,7 @@ static int dissect_dop_ModifyRoleBInitiates(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 129 "../../asn1/dop/dop.cnf" - offset = call_dop_oid_callback("modify.roleb", tvb, offset, actx->pinfo, tree, "roleB"); + offset = call_dop_oid_callback("modify.roleb", tvb, offset, actx->pinfo, tree, "roleB", actx->private_data); @@ -1003,7 +1002,7 @@ static int dissect_dop_ArgumentNewAgreement(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 169 "../../asn1/dop/dop.cnf" - offset = call_dop_oid_callback("agreement", tvb, offset, actx->pinfo, tree, NULL); + offset = call_dop_oid_callback("agreement", tvb, offset, actx->pinfo, tree, NULL, actx->private_data); @@ -1076,7 +1075,7 @@ static int dissect_dop_ResultNewAgreement(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 165 "../../asn1/dop/dop.cnf" - offset = call_dop_oid_callback("agreement", tvb, offset, actx->pinfo, tree, NULL); + offset = call_dop_oid_callback("agreement", tvb, offset, actx->pinfo, tree, NULL, actx->private_data); @@ -1148,7 +1147,7 @@ static int dissect_dop_TerminateSymmetric(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 133 "../../asn1/dop/dop.cnf" - offset = call_dop_oid_callback("terminate.symmetric", tvb, offset, actx->pinfo, tree, "symmetric"); + offset = call_dop_oid_callback("terminate.symmetric", tvb, offset, actx->pinfo, tree, "symmetric", actx->private_data); @@ -1161,7 +1160,7 @@ static int dissect_dop_TerminateRoleAInitiates(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 137 "../../asn1/dop/dop.cnf" - offset = call_dop_oid_callback("terminate.rolea", tvb, offset, actx->pinfo, tree, "roleA"); + offset = call_dop_oid_callback("terminate.rolea", tvb, offset, actx->pinfo, tree, "roleA", actx->private_data); @@ -1174,7 +1173,7 @@ static int dissect_dop_TerminateRoleBInitiates(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 141 "../../asn1/dop/dop.cnf" - offset = call_dop_oid_callback("terminate.roleb", tvb, offset, actx->pinfo, tree, "roleB"); + offset = call_dop_oid_callback("terminate.roleb", tvb, offset, actx->pinfo, tree, "roleB", actx->private_data); @@ -1350,7 +1349,7 @@ static int dissect_dop_T_agreementProposal(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 161 "../../asn1/dop/dop.cnf" - offset = call_dop_oid_callback("agreement", tvb, offset, actx->pinfo, tree, NULL); + offset = call_dop_oid_callback("agreement", tvb, offset, actx->pinfo, tree, NULL, actx->private_data); @@ -2045,10 +2044,10 @@ static void dissect_ACIItem_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto /*--- End of included file: packet-dop-fn.c ---*/ -#line 87 "../../asn1/dop/packet-dop-template.c" +#line 86 "../../asn1/dop/packet-dop-template.c" static int -call_dop_oid_callback(const char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char *col_info) +call_dop_oid_callback(const char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char *col_info, void* data) { char* binding_param; @@ -2056,7 +2055,7 @@ call_dop_oid_callback(const char *base_string, tvbuff_t *tvb, int offset, packet col_append_fstr(pinfo->cinfo, COL_INFO, " %s", col_info); - if (dissector_try_string(dop_dissector_table, binding_param, tvb, pinfo, tree, NULL)) { + if (dissector_try_string(dop_dissector_table, binding_param, tvb, pinfo, tree, data)) { offset = tvb_reported_length (tvb); } else { proto_item *item=NULL; @@ -2077,13 +2076,14 @@ call_dop_oid_callback(const char *base_string, tvbuff_t *tvb, int offset, packet /* * Dissect DOP PDUs inside a ROS PDUs */ -static void -dissect_dop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_dop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { int offset = 0; int old_offset; - proto_item *item=NULL; - proto_tree *tree=NULL; + proto_item *item; + proto_tree *tree; + struct SESSION_DATA_STRUCTURE* session; int (*dop_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL; const char *dop_op_name; asn1_ctx_t asn1_ctx; @@ -2091,23 +2091,24 @@ dissect_dop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); /* do we have operation information from the ROS dissector? */ - if( !pinfo->private_data ){ + if( data == NULL ){ if(parent_tree){ proto_tree_add_text(parent_tree, tvb, offset, -1, "Internal error: can't get operation information from ROS dissector."); } - return ; - } else { - session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) ); + return 0; } - if(parent_tree){ - item = proto_tree_add_item(parent_tree, proto_dop, tvb, 0, -1, ENC_NA); - tree = proto_item_add_subtree(item, ett_dop); - } + session = ( (struct SESSION_DATA_STRUCTURE*)data ); + + item = proto_tree_add_item(parent_tree, proto_dop, tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_dop); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "DOP"); col_clear(pinfo->cinfo, COL_INFO); + asn1_ctx.private_data = session; + switch(session->ros_op & ROS_OP_MASK) { case (ROS_OP_BIND | ROS_OP_ARGUMENT): /* BindInvoke */ dop_dissector = dissect_dop_DSAOperationalManagementBindArgument; @@ -2175,7 +2176,7 @@ dissect_dop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) break; default: proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DOP PDU"); - return; + return tvb_length(tvb); } if(dop_dissector) { @@ -2190,6 +2191,8 @@ dissect_dop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) } } } + + return tvb_length(tvb); } @@ -2965,7 +2968,7 @@ void proto_register_dop(void) { NULL, HFILL }}, /*--- End of included file: packet-dop-hfarr.c ---*/ -#line 242 "../../asn1/dop/packet-dop-template.c" +#line 245 "../../asn1/dop/packet-dop-template.c" }; /* List of subtrees */ @@ -3044,7 +3047,7 @@ void proto_register_dop(void) { &ett_dop_GrantsAndDenials, /*--- End of included file: packet-dop-ettarr.c ---*/ -#line 249 "../../asn1/dop/packet-dop-template.c" +#line 252 "../../asn1/dop/packet-dop-template.c" }; static ei_register_info ei[] = { @@ -3057,7 +3060,7 @@ void proto_register_dop(void) { /* Register protocol */ proto_dop = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("dop", dissect_dop, proto_dop); + new_register_dissector("dop", dissect_dop, proto_dop); dop_dissector_table = register_dissector_table("dop.oid", "DOP OID Dissectors", FT_STRING, BASE_NONE); @@ -3107,7 +3110,7 @@ void proto_reg_handoff_dop(void) { /*--- End of included file: packet-dop-dis-tab.c ---*/ -#line 289 "../../asn1/dop/packet-dop-template.c" +#line 292 "../../asn1/dop/packet-dop-template.c" /* APPLICATION CONTEXT */ oid_add_from_string("id-ac-directory-operational-binding-management","2.5.3.3"); diff --git a/epan/dissectors/packet-dsp.c b/epan/dissectors/packet-dsp.c index 139ae1f9d8..6f80571473 100644 --- a/epan/dissectors/packet-dsp.c +++ b/epan/dissectors/packet-dsp.c @@ -63,8 +63,6 @@ static void prefs_register_dsp(void); /* forward declaration for use in preferen /* Initialize the protocol and registered fields */ static int proto_dsp = -1; -static struct SESSION_DATA_STRUCTURE* session = NULL; - /*--- Included file: packet-dsp-hf.c ---*/ #line 1 "../../asn1/dsp/packet-dsp-hf.c" @@ -207,7 +205,7 @@ static int hf_dsp_signed = -1; /* BOOLEAN */ static int hf_dsp_other = -1; /* EXTERNAL */ /*--- End of included file: packet-dsp-hf.c ---*/ -#line 61 "../../asn1/dsp/packet-dsp-template.c" +#line 59 "../../asn1/dsp/packet-dsp-template.c" /* Initialize the subtree pointers */ static gint ett_dsp = -1; @@ -287,7 +285,7 @@ static gint ett_dsp_AuthenticationLevel = -1; static gint ett_dsp_T_basicLevels = -1; /*--- End of included file: packet-dsp-ett.c ---*/ -#line 65 "../../asn1/dsp/packet-dsp-template.c" +#line 63 "../../asn1/dsp/packet-dsp-template.c" /*--- Included file: packet-dsp-fn.c ---*/ @@ -1785,18 +1783,19 @@ static void dissect_DitBridgeKnowledge_PDU(tvbuff_t *tvb _U_, packet_info *pinfo /*--- End of included file: packet-dsp-fn.c ---*/ -#line 67 "../../asn1/dsp/packet-dsp-template.c" +#line 65 "../../asn1/dsp/packet-dsp-template.c" /* * Dissect X518 PDUs inside a ROS PDUs */ -static void -dissect_dsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_dsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { int offset = 0; int old_offset; - proto_item *item=NULL; - proto_tree *tree=NULL; + proto_item *item; + proto_tree *tree; + struct SESSION_DATA_STRUCTURE* session; int (*dsp_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL; const char *dsp_op_name; asn1_ctx_t asn1_ctx; @@ -1804,23 +1803,24 @@ dissect_dsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); /* do we have operation information from the ROS dissector? */ - if( !pinfo->private_data ){ + if( data == NULL ){ if(parent_tree){ proto_tree_add_text(parent_tree, tvb, offset, -1, "Internal error: can't get operation information from ROS dissector."); } - return ; - } else { - session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) ); + return 0; } - if(parent_tree){ - item = proto_tree_add_item(parent_tree, proto_dsp, tvb, 0, -1, ENC_NA); - tree = proto_item_add_subtree(item, ett_dsp); - } + session = ( (struct SESSION_DATA_STRUCTURE*)data); + + item = proto_tree_add_item(parent_tree, proto_dsp, tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_dsp); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "DAP"); col_clear(pinfo->cinfo, COL_INFO); + asn1_ctx.private_data = session; + switch(session->ros_op & ROS_OP_MASK) { case (ROS_OP_BIND | ROS_OP_ARGUMENT): /* BindInvoke */ dsp_dissector = dissect_dsp_DSASystemBindArgument; @@ -1966,7 +1966,7 @@ dissect_dsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) break; default: proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DSP PDU"); - return; + return tvb_length(tvb); } if(dsp_dissector) { @@ -1981,6 +1981,8 @@ dissect_dsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) } } } + + return tvb_length(tvb); } @@ -2543,7 +2545,7 @@ void proto_register_dsp(void) { "EXTERNAL", HFILL }}, /*--- End of included file: packet-dsp-hfarr.c ---*/ -#line 272 "../../asn1/dsp/packet-dsp-template.c" +#line 274 "../../asn1/dsp/packet-dsp-template.c" }; /* List of subtrees */ @@ -2625,14 +2627,14 @@ void proto_register_dsp(void) { &ett_dsp_T_basicLevels, /*--- End of included file: packet-dsp-ettarr.c ---*/ -#line 278 "../../asn1/dsp/packet-dsp-template.c" +#line 280 "../../asn1/dsp/packet-dsp-template.c" }; module_t *dsp_module; /* Register protocol */ proto_dsp = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("dsp", dissect_dsp, proto_dsp); + new_register_dissector("dsp", dissect_dsp, proto_dsp); /* Register fields and subtrees */ proto_register_field_array(proto_dsp, hf, array_length(hf)); @@ -2666,7 +2668,7 @@ void proto_reg_handoff_dsp(void) { /*--- End of included file: packet-dsp-dis-tab.c ---*/ -#line 308 "../../asn1/dsp/packet-dsp-template.c" +#line 310 "../../asn1/dsp/packet-dsp-template.c" /* APPLICATION CONTEXT */ diff --git a/epan/dissectors/packet-idmp.c b/epan/dissectors/packet-idmp.c index 5635599c21..6ab14f31e1 100644 --- a/epan/dissectors/packet-idmp.c +++ b/epan/dissectors/packet-idmp.c @@ -116,11 +116,9 @@ static const fragment_items idmp_frag_items = { }; -static int call_idmp_oid_callback(tvbuff_t *tvb, int offset, packet_info *pinfo, int op, proto_tree *tree _U_) +static int call_idmp_oid_callback(tvbuff_t *tvb, int offset, packet_info *pinfo, int op, proto_tree *tree, struct SESSION_DATA_STRUCTURE *session) { - struct SESSION_DATA_STRUCTURE *session; - - if((session = (struct SESSION_DATA_STRUCTURE*)pinfo->private_data) != NULL) { + if(session != NULL) { if((!saved_protocolID) && (op == (ROS_OP_BIND | ROS_OP_RESULT))) { /* save for subsequent operations - should be into session data */ @@ -129,7 +127,7 @@ static int call_idmp_oid_callback(tvbuff_t *tvb, int offset, packet_info *pinfo, /* mimic ROS! */ session->ros_op = op; - offset = call_ros_oid_callback(saved_protocolID ? saved_protocolID : protocolID, tvb, offset, pinfo, top_tree); + offset = call_ros_oid_callback(saved_protocolID ? saved_protocolID : protocolID, tvb, offset, pinfo, tree, session); } return offset; @@ -173,7 +171,7 @@ static int hf_idmp_present = -1; /* INTEGER */ static int hf_idmp_absent = -1; /* NULL */ /*--- End of included file: packet-idmp-hf.c ---*/ -#line 132 "../../asn1/idmp/packet-idmp-template.c" +#line 130 "../../asn1/idmp/packet-idmp-template.c" /* Initialize the subtree pointers */ static gint ett_idmp = -1; @@ -192,7 +190,7 @@ static gint ett_idmp_Code = -1; static gint ett_idmp_InvokeId = -1; /*--- End of included file: packet-idmp-ett.c ---*/ -#line 136 "../../asn1/idmp/packet-idmp-template.c" +#line 134 "../../asn1/idmp/packet-idmp-template.c" /*--- Included file: packet-idmp-fn.c ---*/ @@ -210,8 +208,9 @@ dissect_idmp_OBJECT_IDENTIFIER(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int static int dissect_idmp_Bind_argument(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { + struct SESSION_DATA_STRUCTURE *session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; - return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_BIND | ROS_OP_ARGUMENT), top_tree); + return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_BIND | ROS_OP_ARGUMENT), top_tree, session); return offset; @@ -238,8 +237,9 @@ dissect_idmp_IdmBind(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U static int dissect_idmp_Bind_result(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { + struct SESSION_DATA_STRUCTURE *session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; - return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_BIND | ROS_OP_RESULT), top_tree); + return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_BIND | ROS_OP_RESULT), top_tree, session); return offset; @@ -290,8 +290,9 @@ dissect_idmp_T_aETitleError(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of static int dissect_idmp_Bind_error(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { + struct SESSION_DATA_STRUCTURE *session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; - return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_BIND| ROS_OP_ERROR), top_tree); + return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_BIND| ROS_OP_ERROR), top_tree, session); return offset; @@ -361,8 +362,9 @@ dissect_idmp_Code(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, static int dissect_idmp_T_argument(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { + struct SESSION_DATA_STRUCTURE *session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; - return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_INVOKE | ROS_OP_ARGUMENT | opcode), top_tree); + return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_INVOKE | ROS_OP_ARGUMENT | opcode), top_tree, session); return offset; @@ -419,9 +421,9 @@ dissect_idmp_InvokeId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _ static int dissect_idmp_T_result(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { + struct SESSION_DATA_STRUCTURE *session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; - return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_INVOKE | ROS_OP_RESULT | opcode), top_tree); - + return call_idmp_oid_callback(tvb, offset, actx->pinfo, (ROS_OP_INVOKE | ROS_OP_RESULT | opcode), top_tree, session); return offset; @@ -616,7 +618,7 @@ dissect_idmp_IDM_PDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U /*--- End of included file: packet-idmp-fn.c ---*/ -#line 138 "../../asn1/idmp/packet-idmp-template.c" +#line 136 "../../asn1/idmp/packet-idmp-template.c" void register_idmp_protocol_info(const char *oid, const ros_info_t *rinfo, int proto _U_, const char *name) @@ -630,10 +632,9 @@ static void dissect_idmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_t { int offset = 0; - proto_item *item = NULL; - proto_tree *tree = NULL; + proto_item *item; + proto_tree *tree; asn1_ctx_t asn1_ctx; - void *save_private_data; struct SESSION_DATA_STRUCTURE session; gboolean idmp_final; guint32 idmp_length; @@ -653,10 +654,8 @@ static void dissect_idmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_t /* save parent_tree so subdissectors can create new top nodes */ top_tree=parent_tree; - if(parent_tree){ - item = proto_tree_add_item(parent_tree, proto_idmp, tvb, 0, -1, ENC_NA); - tree = proto_item_add_subtree(item, ett_idmp); - } + item = proto_tree_add_item(parent_tree, proto_idmp, tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_idmp); col_set_str(pinfo->cinfo, COL_PROTOCOL, "IDMP"); @@ -668,6 +667,8 @@ static void dissect_idmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_t proto_tree_add_item(tree, hf_idmp_length, tvb, offset, 4, ENC_BIG_ENDIAN); idmp_length = tvb_get_ntohl(tvb, offset); offset += 4; + asn1_ctx.private_data = &session; + if(idmp_reassemble) { pinfo->fragmented = !idmp_final; @@ -710,12 +711,8 @@ static void dissect_idmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_t } /* not reassembling - just dissect */ if(idmp_final) { - save_private_data = pinfo->private_data; - pinfo->private_data = &session; - + asn1_ctx.private_data = &session; dissect_idmp_IDM_PDU(FALSE, tvb, offset, &asn1_ctx, tree, hf_idmp_PDU); - - pinfo->private_data = save_private_data; } } @@ -932,7 +929,7 @@ void proto_register_idmp(void) NULL, HFILL }}, /*--- End of included file: packet-idmp-hfarr.c ---*/ -#line 321 "../../asn1/idmp/packet-idmp-template.c" +#line 314 "../../asn1/idmp/packet-idmp-template.c" }; /* List of subtrees */ @@ -955,7 +952,7 @@ void proto_register_idmp(void) &ett_idmp_InvokeId, /*--- End of included file: packet-idmp-ettarr.c ---*/ -#line 329 "../../asn1/idmp/packet-idmp-template.c" +#line 322 "../../asn1/idmp/packet-idmp-template.c" }; module_t *idmp_module; diff --git a/epan/dissectors/packet-p1.c b/epan/dissectors/packet-p1.c index 9c79298224..58b7d64aab 100644 --- a/epan/dissectors/packet-p1.c +++ b/epan/dissectors/packet-p1.c @@ -1052,7 +1052,7 @@ dissect_p1_TokenTypeData(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse #line 1154 "../../asn1/p1/p1.cnf" if(actx->external.direct_reference) - call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, NULL); + call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, actx->private_data); @@ -1243,7 +1243,7 @@ dissect_p1_SecurityCategoryValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, i const char *name; if (actx->external.direct_reference) { - offset = call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, NULL); + offset = call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, actx->private_data); name = oid_resolved_from_string(actx->external.direct_reference); proto_item_append_text(tree, " (%s)", name ? name : actx->external.direct_reference); } else { @@ -3060,7 +3060,7 @@ dissect_p1_ExtensionValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs expert_add_info(actx->pinfo, item, &ei_p1_unknown_standard_extension); } } else if (actx->external.direct_ref_present) { - offset = call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, NULL); + offset = call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, actx->private_data); name = oid_resolved_from_string(actx->external.direct_reference); proto_item_append_text(tree, " (%s)", name ? name : actx->external.direct_reference); } @@ -3235,7 +3235,7 @@ dissect_p1_Content(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, if (next_tvb) { if (ctx && ctx->content_type_id) { - (void) call_ber_oid_callback(ctx->content_type_id, next_tvb, 0, actx->pinfo, actx->subtree.top_tree ? actx->subtree.top_tree : tree, NULL); + (void) call_ber_oid_callback(ctx->content_type_id, next_tvb, 0, actx->pinfo, actx->subtree.top_tree ? actx->subtree.top_tree : tree, actx->private_data); } else if (ctx && ctx->report_unknown_content_type) { proto_item *item = NULL; proto_tree *next_tree = NULL; @@ -8342,13 +8342,13 @@ dissect_p1_mts_apdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) /* * Dissect P1 PDUs inside a PPDU. */ -static void -dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { int offset = 0; int old_offset; - proto_item *item=NULL; - proto_tree *tree=NULL; + proto_item *item; + proto_tree *tree; struct SESSION_DATA_STRUCTURE* session; int (*p1_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_, proto_tree *tree, int hf_index _U_) = NULL; const char *p1_op_name; @@ -8360,20 +8360,21 @@ dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) p1_initialize_content_globals (&asn1_ctx, parent_tree, TRUE); /* do we have operation information from the ROS dissector? */ - if( !pinfo->private_data ){ + if( data == NULL ){ if(parent_tree){ proto_tree_add_text(parent_tree, tvb, offset, -1, "Internal error: can't get operation information from ROS dissector."); } - return; + return 0; } - session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) ); + session = ( (struct SESSION_DATA_STRUCTURE*)data ); + + asn1_ctx.private_data = session; + + item = proto_tree_add_item(parent_tree, proto_p1, tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_p1); - if(parent_tree){ - item = proto_tree_add_item(parent_tree, proto_p1, tvb, 0, -1, ENC_NA); - tree = proto_item_add_subtree(item, ett_p1); - } col_set_str(pinfo->cinfo, COL_PROTOCOL, "P1"); col_clear(pinfo->cinfo, COL_INFO); @@ -8400,7 +8401,7 @@ dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) break; default: proto_tree_add_text(tree, tvb, offset, -1,"Unsupported P1 PDU"); - return; + return tvb_length(tvb); } col_set_str(pinfo->cinfo, COL_INFO, p1_op_name); @@ -8414,6 +8415,7 @@ dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) } } p1_initialize_content_globals (&asn1_ctx, NULL, FALSE); + return tvb_length(tvb); } @@ -10702,7 +10704,7 @@ void proto_register_p1(void) { NULL, HFILL }}, /*--- End of included file: packet-p1-hfarr.c ---*/ -#line 324 "../../asn1/p1/packet-p1-template.c" +#line 326 "../../asn1/p1/packet-p1-template.c" }; /* List of subtrees */ @@ -10901,7 +10903,7 @@ void proto_register_p1(void) { &ett_p1_SEQUENCE_SIZE_1_ub_recipients_OF_PerRecipientProbeSubmissionFields, /*--- End of included file: packet-p1-ettarr.c ---*/ -#line 337 "../../asn1/p1/packet-p1-template.c" +#line 339 "../../asn1/p1/packet-p1-template.c" }; static ei_register_info ei[] = { @@ -10916,7 +10918,7 @@ void proto_register_p1(void) { /* Register protocol */ proto_p1 = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("p1", dissect_p1, proto_p1); + new_register_dissector("p1", dissect_p1, proto_p1); proto_p3 = proto_register_protocol("X.411 Message Access Service", "P3", "p3"); @@ -11104,7 +11106,7 @@ void proto_reg_handoff_p1(void) { /*--- End of included file: packet-p1-dis-tab.c ---*/ -#line 383 "../../asn1/p1/packet-p1-template.c" +#line 385 "../../asn1/p1/packet-p1-template.c" /* APPLICATION CONTEXT */ diff --git a/epan/dissectors/packet-pres.c b/epan/dissectors/packet-pres.c index 45a043f736..09c456e750 100644 --- a/epan/dissectors/packet-pres.c +++ b/epan/dissectors/packet-pres.c @@ -66,10 +66,6 @@ static int proto_pres = -1; /* Initialize the connectionles protocol */ static int proto_clpres = -1; - -/* type of session envelop */ -static struct SESSION_DATA_STRUCTURE* session = NULL; - /* pointers for acse dissector */ proto_tree *global_tree = NULL; packet_info *global_pinfo = NULL; @@ -182,7 +178,7 @@ static int hf_pres_User_session_requirements_symmetric_synchronize = -1; static int hf_pres_User_session_requirements_data_separation = -1; /*--- End of included file: packet-pres-hf.c ---*/ -#line 95 "../../asn1/pres/packet-pres-template.c" +#line 91 "../../asn1/pres/packet-pres-template.c" /* Initialize the subtree pointers */ static gint ett_pres = -1; @@ -228,7 +224,7 @@ static gint ett_pres_User_session_requirements = -1; static gint ett_pres_UD_type = -1; /*--- End of included file: packet-pres-ett.c ---*/ -#line 100 "../../asn1/pres/packet-pres-template.c" +#line 96 "../../asn1/pres/packet-pres-template.c" static expert_field ei_pres_dissector_not_available = EI_INIT; @@ -438,6 +434,7 @@ dissect_pres_Presentation_context_identifier(gboolean implicit_tag _U_, tvbuff_t #line 73 "../../asn1/pres/pres.cnf" const char *name; char *oid; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, &presentation_context_identifier); @@ -498,13 +495,13 @@ static const ber_sequence_t Context_list_item_sequence[] = { static int dissect_pres_Context_list_item(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 98 "../../asn1/pres/pres.cnf" +#line 99 "../../asn1/pres/pres.cnf" abstract_syntax_name_oid=NULL; offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset, Context_list_item_sequence, hf_index, ett_pres_Context_list_item); -#line 101 "../../asn1/pres/pres.cnf" +#line 102 "../../asn1/pres/pres.cnf" register_ctx_id_and_oid(actx->pinfo, presentation_context_identifier, abstract_syntax_name_oid); return offset; @@ -642,7 +639,7 @@ dissect_pres_T_single_ASN1_type(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in oid=find_oid_by_pres_ctx_id(actx->pinfo, presentation_context_identifier); if(oid){ next_tvb = tvb_new_subset_remaining(tvb, offset); - call_ber_oid_callback(oid, next_tvb, offset, actx->pinfo, global_tree, NULL); + call_ber_oid_callback(oid, next_tvb, offset, actx->pinfo, global_tree, actx->private_data); } else { proto_tree_add_expert(tree, actx->pinfo, &ei_pres_dissector_not_available, tvb, offset, -1); @@ -665,7 +662,7 @@ dissect_pres_T_octet_aligned(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o oid=find_oid_by_pres_ctx_id(actx->pinfo, presentation_context_identifier); if(oid){ dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, &next_tvb); - call_ber_oid_callback(oid, next_tvb, offset, actx->pinfo, global_tree, NULL); + call_ber_oid_callback(oid, next_tvb, offset, actx->pinfo, global_tree, actx->private_data); } else { proto_tree_add_expert(tree, actx->pinfo, &ei_pres_dissector_not_available, tvb, offset, -1); @@ -1086,7 +1083,7 @@ static const value_string pres_Abort_reason_vals[] = { static int dissect_pres_Abort_reason(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 91 "../../asn1/pres/pres.cnf" +#line 92 "../../asn1/pres/pres.cnf" guint32 reason; offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, @@ -1359,44 +1356,43 @@ static void dissect_UD_type_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto /*--- End of included file: packet-pres-fn.c ---*/ -#line 227 "../../asn1/pres/packet-pres-template.c" +#line 223 "../../asn1/pres/packet-pres-template.c" /* * Dissect an PPDU. */ static int -dissect_ppdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) +dissect_ppdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, struct SESSION_DATA_STRUCTURE* local_session) { proto_item *ti; - proto_tree *pres_tree = NULL; + proto_tree *pres_tree; + struct SESSION_DATA_STRUCTURE* session; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); /* do we have spdu type from the session dissector? */ - if( !pinfo->private_data ){ - if(tree){ - proto_tree_add_text(tree, tvb, offset, -1, + if( local_session == NULL ){ + proto_tree_add_text(tree, tvb, offset, -1, "Internal error:can't get spdu type from session dissector."); - return 0; - } - }else{ - session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) ); - if(session->spdu_type == 0 ){ - if(tree){ - proto_tree_add_text(tree, tvb, offset, -1, - "Internal error:wrong spdu type %x from session dissector.",session->spdu_type); - return 0; - } - } + return 0; } + + session = local_session; + if(session->spdu_type == 0 ){ + proto_tree_add_text(tree, tvb, offset, -1, + "Internal error:wrong spdu type %x from session dissector.",session->spdu_type); + return 0; + } + /* set up type of PPDU */ col_add_str(pinfo->cinfo, COL_INFO, val_to_str(session->spdu_type, ses_vals, "Unknown PPDU type (0x%02x)")); - if (tree){ - ti = proto_tree_add_item(tree, proto_pres, tvb, offset, -1, ENC_NA); - pres_tree = proto_item_add_subtree(ti, ett_pres); - } + + asn1_ctx.private_data = session; + + ti = proto_tree_add_item(tree, proto_pres, tvb, offset, -1, ENC_NA); + pres_tree = proto_item_add_subtree(ti, ett_pres); switch(session->spdu_type){ case SES_CONNECTION_REQUEST: @@ -1432,12 +1428,13 @@ dissect_ppdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) return offset; } -static void -dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { int offset = 0, old_offset; + struct SESSION_DATA_STRUCTURE* session; - session = ((struct SESSION_DATA_STRUCTURE*)(pinfo->private_data)); + session = ((struct SESSION_DATA_STRUCTURE*)data); /* first, try to check length */ /* do we have at least 4 bytes */ @@ -1445,7 +1442,7 @@ dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) if (session && session->spdu_type != SES_MAJOR_SYNC_POINT) { proto_tree_add_text(parent_tree, tvb, offset, tvb_reported_length_remaining(tvb,offset),"User data"); - return; /* no, it isn't a presentation PDU */ + return 0; /* no, it isn't a presentation PDU */ } } @@ -1471,7 +1468,7 @@ dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) /* dissect the packet */ dissect_UD_type_PDU(tvb, pinfo, clpres_tree); - return; + return tvb_length(tvb); } /* we can't make any additional checking here */ @@ -1484,22 +1481,24 @@ dissect_pres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) /* This is a reassembly initiated in packet-ses */ char *oid = find_oid_by_pres_ctx_id (pinfo, session->pres_ctx_id); if (oid) { - call_ber_oid_callback (oid, tvb, offset, pinfo, parent_tree, NULL); + call_ber_oid_callback (oid, tvb, offset, pinfo, parent_tree, session); } else { proto_tree_add_text(parent_tree, tvb, offset, tvb_reported_length_remaining(tvb,offset),"User data"); } - return; - } + return tvb_length(tvb); + } while (tvb_reported_length_remaining(tvb, offset) > 0){ old_offset = offset; - offset = dissect_ppdu(tvb, offset, pinfo, parent_tree); + offset = dissect_ppdu(tvb, offset, pinfo, parent_tree, session); if(offset <= old_offset){ proto_tree_add_text(parent_tree, tvb, offset, -1,"Invalid offset"); THROW(ReportedBoundsError); } } + + return tvb_length(tvb); } @@ -1843,7 +1842,7 @@ void proto_register_pres(void) { NULL, HFILL }}, /*--- End of included file: packet-pres-hfarr.c ---*/ -#line 398 "../../asn1/pres/packet-pres-template.c" +#line 396 "../../asn1/pres/packet-pres-template.c" }; /* List of subtrees */ @@ -1890,7 +1889,7 @@ void proto_register_pres(void) { &ett_pres_UD_type, /*--- End of included file: packet-pres-ettarr.c ---*/ -#line 404 "../../asn1/pres/packet-pres-template.c" +#line 402 "../../asn1/pres/packet-pres-template.c" }; static ei_register_info ei[] = { @@ -1922,7 +1921,7 @@ void proto_register_pres(void) { /* Register protocol */ proto_pres = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("pres", dissect_pres, proto_pres); + new_register_dissector("pres", dissect_pres, proto_pres); /* Register connectionless protocol (just for the description) */ proto_clpres = proto_register_protocol(CLPNAME, CLPSNAME, CLPFNAME); diff --git a/epan/dissectors/packet-ros.c b/epan/dissectors/packet-ros.c index 9df79fcc4b..4d5236d661 100644 --- a/epan/dissectors/packet-ros.c +++ b/epan/dissectors/packet-ros.c @@ -189,7 +189,7 @@ static new_dissector_t ros_lookup_err_dissector(gint32 errcode, const ros_err_t } -static gboolean ros_try_string(const char *oid, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static gboolean ros_try_string(const char *oid, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, struct SESSION_DATA_STRUCTURE* session) { ros_info_t *rinfo; gint32 opcode_lcl = 0; @@ -199,9 +199,6 @@ static gboolean ros_try_string(const char *oid, tvbuff_t *tvb, packet_info *pinf const value_string *lookup; proto_item *item=NULL; proto_tree *ros_tree=NULL; - struct SESSION_DATA_STRUCTURE* session = NULL; - - session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) ); if((session != NULL) && ((rinfo = (ros_info_t*)g_hash_table_lookup(protocol_table, oid)) != NULL)) { @@ -261,14 +258,14 @@ static gboolean ros_try_string(const char *oid, tvbuff_t *tvb, packet_info *pinf } int -call_ros_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) +call_ros_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, struct SESSION_DATA_STRUCTURE* session) { tvbuff_t *next_tvb; next_tvb = tvb_new_subset_remaining(tvb, offset); - if(!ros_try_string(oid, next_tvb, pinfo, tree) && - !dissector_try_string(ros_oid_dissector_table, oid, next_tvb, pinfo, tree, NULL)){ + if(!ros_try_string(oid, next_tvb, pinfo, tree, session) && + !dissector_try_string(ros_oid_dissector_table, oid, next_tvb, pinfo, tree, session)){ proto_item *item=proto_tree_add_text(tree, next_tvb, 0, tvb_length_remaining(tvb, offset), "ROS: Dissector for OID:%s not implemented. Contact Wireshark developers if you want this supported", oid); proto_tree *next_tree=proto_item_add_subtree(item, ett_ros_unknown); @@ -493,7 +490,7 @@ static int dissect_ros_T_argument(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 32 "../../asn1/ros/ros.cnf" char *oid; - struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->pinfo->private_data; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->private_data; /* not sure what the length should be - -1 for now */ proto_tree_add_text(tree, tvb, offset,-1, "invoke argument"); @@ -505,7 +502,7 @@ dissect_ros_T_argument(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset session->ros_op = (ROS_OP_INVOKE | ROS_OP_ARGUMENT); /* now add the opcode */ session->ros_op |= opcode; - offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree); + offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree, session); } @@ -536,7 +533,7 @@ static int dissect_ros_OperationResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 49 "../../asn1/ros/ros.cnf" char *oid; - struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->pinfo->private_data; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->private_data; /* not sure what the length should be - -1 for now */ proto_tree_add_text(tree, tvb, offset,-1, "return result"); @@ -548,7 +545,7 @@ dissect_ros_OperationResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of session->ros_op = (ROS_OP_INVOKE | ROS_OP_RESULT); /* now add the opcode */ session->ros_op |= opcode; - offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree); + offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree, session); } @@ -602,7 +599,7 @@ static int dissect_ros_T_parameter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 66 "../../asn1/ros/ros.cnf" char *oid; - struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->pinfo->private_data; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->private_data; /* not sure what the length should be - -1 for now */ proto_tree_add_text(tree, tvb, offset,-1, "return result"); @@ -614,7 +611,7 @@ dissect_ros_T_parameter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset session->ros_op = (ROS_OP_INVOKE | ROS_OP_ERROR); /* now add the opcode (really the error code) */ session->ros_op |= opcode; - offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree); + offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree, session); } @@ -806,7 +803,7 @@ static int dissect_ros_T_bind_invoke(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 83 "../../asn1/ros/ros.cnf" char *oid; - struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->pinfo->private_data; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->private_data; /* not sure what the length should be - -1 for now */ proto_tree_add_text(tree, tvb, offset,-1, "bind-invoke"); @@ -814,7 +811,7 @@ dissect_ros_T_bind_invoke(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs if(session && session->pres_ctx_id && (oid = find_oid_by_pres_ctx_id(actx->pinfo, session->pres_ctx_id))) { /* this should be ROS! */ session->ros_op = (ROS_OP_BIND | ROS_OP_ARGUMENT); - offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree); + offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree, session); } @@ -828,7 +825,7 @@ static int dissect_ros_T_bind_result(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 96 "../../asn1/ros/ros.cnf" char *oid; - struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->pinfo->private_data; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->private_data; /* not sure what the length should be - -1 for now */ proto_tree_add_text(tree, tvb, offset,-1, "bind-result"); @@ -836,7 +833,7 @@ dissect_ros_T_bind_result(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs if(session && session->pres_ctx_id && (oid = find_oid_by_pres_ctx_id(actx->pinfo, session->pres_ctx_id))) { /* this should be ROS! */ session->ros_op = (ROS_OP_BIND | ROS_OP_RESULT); - offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree); + offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree, session); } @@ -850,7 +847,7 @@ static int dissect_ros_T_bind_error(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 109 "../../asn1/ros/ros.cnf" char *oid; - struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->pinfo->private_data; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->private_data; /* not sure what the length should be - -1 for now */ proto_tree_add_text(tree, tvb, offset,-1, "bind-error"); @@ -858,7 +855,7 @@ dissect_ros_T_bind_error(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse if(session && session->pres_ctx_id && (oid = find_oid_by_pres_ctx_id(actx->pinfo, session->pres_ctx_id))) { /* this should be ROS! */ session->ros_op = (ROS_OP_BIND | ROS_OP_ERROR); - offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree); + offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree, session); } @@ -873,7 +870,7 @@ static int dissect_ros_T_unbind_invoke(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 123 "../../asn1/ros/ros.cnf" char *oid; - struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->pinfo->private_data; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->private_data; /* not sure what the length should be - -1 for now */ proto_tree_add_text(tree, tvb, offset,-1, "unbind-invoke"); @@ -881,7 +878,7 @@ dissect_ros_T_unbind_invoke(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of if(session && session->pres_ctx_id && (oid = find_oid_by_pres_ctx_id(actx->pinfo, session->pres_ctx_id))) { /* this should be ROS! */ session->ros_op = (ROS_OP_UNBIND | ROS_OP_ARGUMENT); - offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree); + offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree, session); } @@ -896,7 +893,7 @@ static int dissect_ros_T_unbind_result(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 137 "../../asn1/ros/ros.cnf" char *oid; - struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->pinfo->private_data; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->private_data; /* not sure what the length should be - -1 for now */ proto_tree_add_text(tree, tvb, offset,-1, "unbind-result"); @@ -904,7 +901,7 @@ dissect_ros_T_unbind_result(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of if(session && session->pres_ctx_id && (oid = find_oid_by_pres_ctx_id(actx->pinfo, session->pres_ctx_id))) { /* this should be ROS! */ session->ros_op = (ROS_OP_UNBIND | ROS_OP_RESULT); - offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree); + offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree, session); } @@ -918,7 +915,7 @@ static int dissect_ros_T_unbind_error(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 150 "../../asn1/ros/ros.cnf" char *oid; - struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->pinfo->private_data; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE *)actx->private_data; /* not sure what the length should be - -1 for now */ proto_tree_add_text(tree, tvb, offset,-1, "unbind-error"); @@ -926,7 +923,7 @@ dissect_ros_T_unbind_error(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off if(session && session->pres_ctx_id && (oid = find_oid_by_pres_ctx_id(actx->pinfo, session->pres_ctx_id))) { /* this should be ROS! */ session->ros_op = (ROS_OP_UNBIND | ROS_OP_ERROR); - offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree); + offset = call_ros_oid_callback(oid, tvb, offset, actx->pinfo, top_tree, session); } @@ -1005,18 +1002,18 @@ dissect_ros_Code(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, a /*--- End of included file: packet-ros-fn.c ---*/ -#line 373 "../../asn1/ros/packet-ros-template.c" +#line 370 "../../asn1/ros/packet-ros-template.c" /* * Dissect ROS PDUs inside a PPDU. */ -static void -dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { int offset = 0; int old_offset; - proto_item *item=NULL; - proto_tree *tree=NULL; + proto_item *item; + proto_tree *tree; proto_tree *next_tree=NULL; conversation_t *conversation; ros_conv_info_t *ros_info = NULL; @@ -1032,9 +1029,10 @@ dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_tree_add_text(parent_tree, tvb, offset, -1, "Internal error:can't get application context from ACSE dissector."); } - return ; + return 0; } + asn1_ctx.private_data = data; conversation = find_or_create_conversation(pinfo); /* @@ -1053,14 +1051,13 @@ dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) ros_info->next = ros_info_items; ros_info_items = ros_info; - } + } /* pinfo->private_data = ros_info; */ - if(parent_tree){ - item = proto_tree_add_item(parent_tree, proto_ros, tvb, 0, -1, ENC_NA); - tree = proto_item_add_subtree(item, ett_ros); - } + item = proto_tree_add_item(parent_tree, proto_ros, tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_ros); + col_set_str(pinfo->cinfo, COL_PROTOCOL, "ROS"); col_clear(pinfo->cinfo, COL_INFO); @@ -1079,6 +1076,8 @@ dissect_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) break; } } + + return tvb_length(tvb); } static void @@ -1236,7 +1235,7 @@ void proto_register_ros(void) { "OBJECT_IDENTIFIER", HFILL }}, /*--- End of included file: packet-ros-hfarr.c ---*/ -#line 491 "../../asn1/ros/packet-ros-template.c" +#line 490 "../../asn1/ros/packet-ros-template.c" }; /* List of subtrees */ @@ -1257,7 +1256,7 @@ void proto_register_ros(void) { &ett_ros_Code, /*--- End of included file: packet-ros-ettarr.c ---*/ -#line 498 "../../asn1/ros/packet-ros-template.c" +#line 497 "../../asn1/ros/packet-ros-template.c" }; static ei_register_info ei[] = { @@ -1269,7 +1268,7 @@ void proto_register_ros(void) { /* Register protocol */ proto_ros = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("ros", dissect_ros, proto_ros); + new_register_dissector("ros", dissect_ros, proto_ros); /* Register fields and subtrees */ proto_register_field_array(proto_ros, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-ros.h b/epan/dissectors/packet-ros.h index c440048729..dcb5026abe 100644 --- a/epan/dissectors/packet-ros.h +++ b/epan/dissectors/packet-ros.h @@ -94,6 +94,6 @@ typedef struct _ros_info_t { void register_ros_oid_dissector_handle(const char *oid, dissector_handle_t dissector, int proto _U_, const char *name, gboolean uses_rtse); void register_ros_protocol_info(const char *oid, const ros_info_t *rinfo, int proto _U_, const char *name, gboolean uses_rtse); -int call_ros_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree); +int call_ros_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, struct SESSION_DATA_STRUCTURE* session); #endif /* PACKET_ROS_H */ diff --git a/epan/dissectors/packet-rtse.c b/epan/dissectors/packet-rtse.c index 6d18f353bf..bebc552832 100644 --- a/epan/dissectors/packet-rtse.c +++ b/epan/dissectors/packet-rtse.c @@ -54,8 +54,6 @@ /* Initialize the protocol and registered fields */ static int proto_rtse = -1; -static struct SESSION_DATA_STRUCTURE* session = NULL; - static gboolean open_request=FALSE; static guint32 app_proto=0; @@ -93,7 +91,7 @@ static int hf_rtse_t61String = -1; /* T_t61String */ static int hf_rtse_octetString = -1; /* T_octetString */ /*--- End of included file: packet-rtse-hf.c ---*/ -#line 60 "../../asn1/rtse/packet-rtse-template.c" +#line 58 "../../asn1/rtse/packet-rtse-template.c" /* Initialize the subtree pointers */ static gint ett_rtse = -1; @@ -110,7 +108,7 @@ static gint ett_rtse_SessionConnectionIdentifier = -1; static gint ett_rtse_CallingSSuserReference = -1; /*--- End of included file: packet-rtse-ett.c ---*/ -#line 64 "../../asn1/rtse/packet-rtse-template.c" +#line 62 "../../asn1/rtse/packet-rtse-template.c" static expert_field ei_rtse_dissector_oid_not_implemented = EI_INIT; static expert_field ei_rtse_unknown_rtse_pdu = EI_INIT; @@ -192,12 +190,12 @@ register_rtse_oid_dissector_handle(const char *oid, dissector_handle_t dissector } static int -call_rtse_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) +call_rtse_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, void* data) { tvbuff_t *next_tvb; next_tvb = tvb_new_subset_remaining(tvb, offset); - if(!dissector_try_string(rtse_oid_dissector_table, oid, next_tvb, pinfo, tree, NULL)){ + if(!dissector_try_string(rtse_oid_dissector_table, oid, next_tvb, pinfo, tree, data)){ proto_item *item=proto_tree_add_text(tree, next_tvb, 0, tvb_length_remaining(tvb, offset), "RTSE: Dissector for OID:%s not implemented. Contact Wireshark developers if you want this supported", oid); proto_tree *next_tree=proto_item_add_subtree(item, ett_rtse_unknown); @@ -220,14 +218,14 @@ call_rtse_external_type_callback(gboolean implicit_tag _U_, tvbuff_t *tvb, int o { const char *oid = NULL; - if (actx->external.indirect_ref_present) { + if (actx->external.indirect_ref_present) { oid = (const char *)find_oid_by_pres_ctx_id(actx->pinfo, actx->external.indirect_reference); } else if (actx->external.direct_ref_present) { - oid = actx->external.direct_reference; + oid = actx->external.direct_reference; } if (oid) - offset = call_rtse_oid_callback(oid, tvb, offset, actx->pinfo, top_tree ? top_tree : tree); + offset = call_rtse_oid_callback(oid, tvb, offset, actx->pinfo, top_tree ? top_tree : tree, actx->private_data); return offset; } @@ -265,8 +263,9 @@ dissect_rtse_T_dialogueMode(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of static int dissect_rtse_T_open(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 53 "../../asn1/rtse/rtse.cnf" +#line 56 "../../asn1/rtse/rtse.cnf" + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; const char *oid = NULL; switch(app_proto) { @@ -287,7 +286,7 @@ dissect_rtse_T_open(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_ if(oid) { - offset = call_rtse_oid_callback(oid, tvb, offset, actx->pinfo, top_tree ? top_tree : tree); + offset = call_rtse_oid_callback(oid, tvb, offset, actx->pinfo, top_tree ? top_tree : tree, session); } /* else XXX: need to flag we can't find the presentation context */ @@ -301,7 +300,7 @@ dissect_rtse_T_open(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_ static int dissect_rtse_T_t61String(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 108 "../../asn1/rtse/rtse.cnf" +#line 113 "../../asn1/rtse/rtse.cnf" tvbuff_t *string = NULL; offset = dissect_ber_restricted_string(implicit_tag, BER_UNI_TAG_TeletexString, actx, tree, tvb, offset, hf_index, @@ -319,7 +318,7 @@ dissect_rtse_T_t61String(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse static int dissect_rtse_T_octetString(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 124 "../../asn1/rtse/rtse.cnf" +#line 129 "../../asn1/rtse/rtse.cnf" tvbuff_t *string = NULL; offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, &string); @@ -358,7 +357,7 @@ dissect_rtse_CallingSSuserReference(gboolean implicit_tag _U_, tvbuff_t *tvb _U_ static int dissect_rtse_CommonReference(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 116 "../../asn1/rtse/rtse.cnf" +#line 121 "../../asn1/rtse/rtse.cnf" tvbuff_t *string = NULL; offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index); @@ -391,7 +390,7 @@ static const ber_sequence_t SessionConnectionIdentifier_sequence[] = { static int dissect_rtse_SessionConnectionIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 101 "../../asn1/rtse/rtse.cnf" +#line 106 "../../asn1/rtse/rtse.cnf" if(open_request) col_append_str(actx->pinfo->cinfo, COL_INFO, "Recover"); offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset, @@ -435,7 +434,7 @@ static const value_string rtse_T_applicationProtocol_vals[] = { static int dissect_rtse_T_applicationProtocol(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 97 "../../asn1/rtse/rtse.cnf" +#line 102 "../../asn1/rtse/rtse.cnf" offset = dissect_ber_integer(TRUE, actx, tree, tvb, offset, hf_index, &app_proto); @@ -456,9 +455,10 @@ static const ber_sequence_t RTORQapdu_set[] = { int dissect_rtse_RTORQapdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 38 "../../asn1/rtse/rtse.cnf" +#line 39 "../../asn1/rtse/rtse.cnf" + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; - if((session = (struct SESSION_DATA_STRUCTURE*)(actx->pinfo->private_data)) != NULL) + if(session != NULL) session->ros_op = (ROS_OP_BIND | ROS_OP_ARGUMENT); open_request=TRUE; offset = dissect_ber_set(implicit_tag, actx, tree, tvb, offset, @@ -481,9 +481,10 @@ static const ber_sequence_t RTOACapdu_set[] = { int dissect_rtse_RTOACapdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 46 "../../asn1/rtse/rtse.cnf" +#line 48 "../../asn1/rtse/rtse.cnf" + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; - if((session = (struct SESSION_DATA_STRUCTURE*)(actx->pinfo->private_data)) != NULL) + if(session != NULL) session->ros_op = (ROS_OP_BIND | ROS_OP_RESULT); offset = dissect_ber_set(implicit_tag, actx, tree, tvb, offset, @@ -507,7 +508,7 @@ static const value_string rtse_RefuseReason_vals[] = { static int dissect_rtse_RefuseReason(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 148 "../../asn1/rtse/rtse.cnf" +#line 153 "../../asn1/rtse/rtse.cnf" int reason = -1; offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, @@ -527,6 +528,7 @@ dissect_rtse_RefuseReason(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs static int dissect_rtse_T_userDataRJ(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 9 "../../asn1/rtse/rtse.cnf" + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; const char *oid = NULL; switch(app_proto) { @@ -546,10 +548,10 @@ dissect_rtse_T_userDataRJ(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs oid = "applicationProtocol.12"; if(oid) { - if((session = (struct SESSION_DATA_STRUCTURE*)(actx->pinfo->private_data)) != NULL) + if(session != NULL) session->ros_op = (ROS_OP_BIND | ROS_OP_ERROR); - offset = call_rtse_oid_callback(oid, tvb, offset, actx->pinfo, top_tree ? top_tree : tree); + offset = call_rtse_oid_callback(oid, tvb, offset, actx->pinfo, top_tree ? top_tree : tree, session); } @@ -566,7 +568,7 @@ static const ber_sequence_t RTORJapdu_set[] = { int dissect_rtse_RTORJapdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 140 "../../asn1/rtse/rtse.cnf" +#line 145 "../../asn1/rtse/rtse.cnf" col_append_str(actx->pinfo->cinfo, COL_INFO, "Refuse"); offset = dissect_ber_set(implicit_tag, actx, tree, tvb, offset, @@ -582,7 +584,7 @@ dissect_rtse_RTORJapdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset static int dissect_rtse_RTTPapdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 130 "../../asn1/rtse/rtse.cnf" +#line 135 "../../asn1/rtse/rtse.cnf" int priority = -1; col_append_str(actx->pinfo->cinfo, COL_INFO, "Turn-Please"); @@ -603,8 +605,9 @@ dissect_rtse_RTTPapdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _ static int dissect_rtse_RTTRapdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 80 "../../asn1/rtse/rtse.cnf" +#line 84 "../../asn1/rtse/rtse.cnf" tvbuff_t *next_tvb = NULL; + struct SESSION_DATA_STRUCTURE* session = (struct SESSION_DATA_STRUCTURE*)actx->private_data; offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_index, &next_tvb); @@ -641,7 +644,7 @@ static const value_string rtse_AbortReason_vals[] = { static int dissect_rtse_AbortReason(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 164 "../../asn1/rtse/rtse.cnf" +#line 169 "../../asn1/rtse/rtse.cnf" int reason = -1; offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index, @@ -671,7 +674,7 @@ dissect_rtse_BIT_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset static int dissect_rtse_T_userdataAB(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 35 "../../asn1/rtse/rtse.cnf" +#line 36 "../../asn1/rtse/rtse.cnf" /*XXX not implemented yet */ @@ -689,7 +692,7 @@ static const ber_sequence_t RTABapdu_set[] = { int dissect_rtse_RTABapdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 156 "../../asn1/rtse/rtse.cnf" +#line 161 "../../asn1/rtse/rtse.cnf" col_append_str(actx->pinfo->cinfo, COL_INFO, "Abort"); offset = dissect_ber_set(implicit_tag, actx, tree, tvb, offset, @@ -733,18 +736,18 @@ dissect_rtse_RTSE_apdus(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset /*--- End of included file: packet-rtse-fn.c ---*/ -#line 186 "../../asn1/rtse/packet-rtse-template.c" +#line 184 "../../asn1/rtse/packet-rtse-template.c" /* * Dissect RTSE PDUs inside a PPDU. */ -static void -dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +static int +dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data) { int offset = 0; int old_offset; - proto_item *item=NULL; - proto_tree *tree=NULL; + proto_item *item; + proto_tree *tree; proto_tree *next_tree=NULL; tvbuff_t *next_tvb = NULL; tvbuff_t *data_tvb = NULL; @@ -752,6 +755,7 @@ dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) guint32 fragment_length; guint32 rtse_id = 0; gboolean data_handled = FALSE; + struct SESSION_DATA_STRUCTURE* session; conversation_t *conversation = NULL; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); @@ -760,19 +764,20 @@ dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) top_tree=parent_tree; /* do we have application context from the acse dissector? */ - if( !pinfo->private_data ){ + if( data == NULL ){ if(parent_tree){ proto_tree_add_text(parent_tree, tvb, offset, -1, "Internal error:can't get application context from ACSE dissector."); } - return ; - } else { - session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) ); - + return 0; } + session = ( (struct SESSION_DATA_STRUCTURE*)data); + + asn1_ctx.private_data = session; + col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTSE"); - col_clear(pinfo->cinfo, COL_INFO); + col_clear(pinfo->cinfo, COL_INFO); if (rtse_reassemble && ((session->spdu_type == SES_DATA_TRANSFER) || @@ -792,10 +797,10 @@ dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) next_tvb = process_reassembled_data (tvb, offset, pinfo, "Reassembled RTSE", frag_msg, &rtse_frag_items, NULL, parent_tree); } - if(parent_tree){ - item = proto_tree_add_item(parent_tree, proto_rtse, next_tvb ? next_tvb : tvb, 0, -1, ENC_NA); - tree = proto_item_add_subtree(item, ett_rtse); - } + + item = proto_tree_add_item(parent_tree, proto_rtse, next_tvb ? next_tvb : tvb, 0, -1, ENC_NA); + tree = proto_item_add_subtree(item, ett_rtse); + if (rtse_reassemble && session->spdu_type == SES_DATA_TRANSFER) { /* strip off the OCTET STRING encoding - including any CONSTRUCTED OCTET STRING */ dissect_ber_octet_string(FALSE, &asn1_ctx, tree, tvb, offset, hf_rtse_segment_data, &data_tvb); @@ -849,6 +854,7 @@ dissect_rtse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) } top_tree = NULL; + return tvb_length(tvb); } static void rtse_reassemble_init (void) @@ -1001,7 +1007,7 @@ void proto_register_rtse(void) { NULL, HFILL }}, /*--- End of included file: packet-rtse-hfarr.c ---*/ -#line 353 "../../asn1/rtse/packet-rtse-template.c" +#line 354 "../../asn1/rtse/packet-rtse-template.c" }; /* List of subtrees */ @@ -1023,7 +1029,7 @@ void proto_register_rtse(void) { &ett_rtse_CallingSSuserReference, /*--- End of included file: packet-rtse-ettarr.c ---*/ -#line 362 "../../asn1/rtse/packet-rtse-template.c" +#line 363 "../../asn1/rtse/packet-rtse-template.c" }; static ei_register_info ei[] = { @@ -1036,7 +1042,7 @@ void proto_register_rtse(void) { /* Register protocol */ proto_rtse = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("rtse", dissect_rtse, proto_rtse); + new_register_dissector("rtse", dissect_rtse, proto_rtse); /* Register fields and subtrees */ proto_register_field_array(proto_rtse, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); diff --git a/epan/dissectors/packet-ses.c b/epan/dissectors/packet-ses.c index fac7941d42..9b05806200 100644 --- a/epan/dissectors/packet-ses.c +++ b/epan/dissectors/packet-ses.c @@ -322,8 +322,6 @@ call_pres_dissector(tvbuff_t *tvb, int offset, guint16 param_len, proto_tree *param_tree, struct SESSION_DATA_STRUCTURE *session) { - void *saved_private_data; - /* do we have OSI presentation packet dissector ? */ if(!pres_handle) { @@ -340,20 +338,8 @@ call_pres_dissector(tvbuff_t *tvb, int offset, guint16 param_len, tvbuff_t *next_tvb; next_tvb = tvb_new_subset(tvb, offset, param_len, param_len); - /* save type of session pdu. We'll need it in the presentation dissector */ - saved_private_data = pinfo->private_data; - pinfo->private_data = session; - TRY - { - call_dissector(pres_handle, next_tvb, pinfo, tree); - } - CATCH_ALL - { - show_exception(tvb, pinfo, tree, EXCEPT_CODE, GET_MESSAGE); - } - ENDTRY; - /* Restore private_data even if there was an exception */ - pinfo->private_data = saved_private_data; + /* Pass the session pdu to the presentation dissector */ + call_dissector_with_data(pres_handle, next_tvb, pinfo, tree, session); } } @@ -1031,7 +1017,6 @@ dissect_spdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int len_len; guint16 parameters_len; tvbuff_t *next_tvb = NULL; - void *save_private_data; guint32 *pres_ctx_id = NULL; guint8 enclosure_item_flags = BEGINNING_SPDU|END_SPDU; struct SESSION_DATA_STRUCTURE session; @@ -1163,11 +1148,8 @@ dissect_spdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, if (!pres_handle) { call_dissector(data_handle, next_tvb, pinfo, tree); } else { - /* save type of session pdu. We'll need it in the presentation dissector */ - save_private_data = pinfo->private_data; - pinfo->private_data = &session; - call_dissector(pres_handle, next_tvb, pinfo, tree); - pinfo->private_data = save_private_data; + /* Pass the session pdu to the presentation dissector */ + call_dissector_with_data(pres_handle, next_tvb, pinfo, tree, &session); } /* |