diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2005-11-16 22:53:33 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2005-11-16 22:53:33 +0000 |
commit | 3487cd6d59181fa5946877f9617d41f0a056e8fc (patch) | |
tree | 07079a045c4520789185638100d5b355b7d62be7 /asn1/disp | |
parent | 32b71d9b7e9148a393d74613df511b64f3855db6 (diff) |
from Graeme Lunt
4 new asn based protocols
X501
DISP
DAP
DSP
svn path=/trunk/; revision=16518
Diffstat (limited to 'asn1/disp')
-rwxr-xr-x | asn1/disp/Makefile | 17 | ||||
-rwxr-xr-x | asn1/disp/disp.asn | 404 | ||||
-rwxr-xr-x | asn1/disp/disp.cnf | 113 | ||||
-rwxr-xr-x | asn1/disp/packet-disp-template.c | 275 | ||||
-rwxr-xr-x | asn1/disp/packet-disp-template.h | 30 |
5 files changed, 839 insertions, 0 deletions
diff --git a/asn1/disp/Makefile b/asn1/disp/Makefile new file mode 100755 index 0000000000..81ce62641f --- /dev/null +++ b/asn1/disp/Makefile @@ -0,0 +1,17 @@ +# $Id: Makefile 13071 2005-01-16 10:19:21Z guy $ + +DISSECTOR_FILES=packet-disp.c packet-disp.h + +all: generate_dissector + +generate_dissector: $(DISSECTOR_FILES) + +$(DISSECTOR_FILES): ../../tools/asn2eth.py disp.asn packet-disp-template.c packet-disp-template.h disp.cnf + python ../../tools/asn2eth.py -X -b -e -p disp -c disp.cnf -s packet-disp-template disp.asn + +clean: + rm -f parsetab.py $(DISSECTOR_FILES) *~ + +copy_files: generate_dissector + cp $(DISSECTOR_FILES) ../../epan/dissectors + diff --git a/asn1/disp/disp.asn b/asn1/disp/disp.asn new file mode 100755 index 0000000000..fc6adb709b --- /dev/null +++ b/asn1/disp/disp.asn @@ -0,0 +1,404 @@ +-- Module DirectoryShadowAbstractService (X.525:02/2001) +DirectoryShadowAbstractService {joint-iso-itu-t ds(5) module(1) + directoryShadowAbstractService(15) 4} DEFINITIONS IMPLICIT TAGS ::= +BEGIN + +-- EXPORTS All +-- The types and values defined in this module are exported for use in the other ASN.1 modules contained +-- within the Directory Specifications, and for the use of other applications which will use them to access +-- directory services. Other applications may use them for their own purposes, but this will not constrain +-- extensions and modifications needed to maintain or improve the directory service. +IMPORTS + -- from ITU-T Rec. X.501 | ISO/IEC 9594-2 + directoryAbstractService, directoryOperationalBindingTypes, + informationFramework, disp, distributedOperations, + dsaOperationalAttributeTypes, enhancedSecurity, opBindingManagement + FROM UsefulDefinitions {joint-iso-itu-t ds(5) module(1) + usefulDefinitions(0) 4} + Attribute, AttributeType, CONTEXT, DistinguishedName, + RelativeDistinguishedName, SubtreeSpecification + FROM InformationFramework {joint-iso-itu-t ds(5) module(1) + informationFramework(1) 4} + OPERATIONAL-BINDING, OperationalBindingID + FROM OperationalBindingManagement {joint-iso-itu-t ds(5) module(1) + opBindingManagement(18) 4} + DSEType, SupplierAndConsumers + FROM DSAOperationalAttributeTypes {joint-iso-itu-t ds(5) module(1) + dsaOperationalAttributeTypes(22) 4} + OPTIONALLY-PROTECTED{}, OPTIONALLY-PROTECTED-SEQ{} + FROM EnhancedSecurity {joint-iso-itu-t ds(5) module(1) enhancedSecurity(28) + 4} + -- from ITU-T Rec. X.511 | ISO/IEC 9594-3 + CommonResultsSeq, ContextSelection, directoryBind, directoryUnbind, DirectoryBindArgument, DirectoryBindError, + EntryModification, SecurityParameters + FROM DirectoryAbstractService {joint-iso-itu-t ds(5) module(1) + directoryAbstractService(2) 4} + -- from ITU-T Rec. X.518 | ISO/IEC 9594-4 + AccessPoint + FROM DistributedOperations {joint-iso-itu-t ds(5) module(1) + distributedOperations(3) 4} + -- from ITU-T Rec. X.519 | ISO/IEC 9594-5 + id-op-binding-shadow + FROM DirectoryOperationalBindingTypes {joint-iso-itu-t ds(5) module(1) + directoryOperationalBindingTypes(25) 4} + id-errcode-shadowError, id-opcode-coordinateShadowUpdate, + id-opcode-requestShadowUpdate, id-opcode-updateShadow, + reliableShadowSupplierInitiatedAC, reliableShadowConsumerInitiatedAC, + shadowConsumerInitiatedAC, shadowSupplierInitiatedAC + FROM DirectoryInformationShadowProtocol {joint-iso-itu-t ds(5) module(1) + disp(16) 4} + EXTERNAL + FROM ACSE-1 {joint-iso-itu-t association-control(2) modules(0) acse1(1) version1(1)} + AlgorithmIdentifier, CertificationPath, ENCRYPTED{}, SIGNATURE{}, SIGNED{} + FROM AuthenticationFramework {joint-iso-itu-t ds(5) module(1) + authenticationFramework(7) 4} + -- from ITU-T Rec. X.880 | ISO/IEC 13712-1 + ERROR, OPERATION + FROM Remote-Operations-Information-Objects {joint-iso-itu-t + remote-operations(4) informationObjects(5) version1(0)}; + + +-- bind and unbind operations +dSAShadowBind OPERATION ::= directoryBind +DSAShadowBindArgument ::= DirectoryBindArgument +DSAShadowBindResult ::= DirectoryBindArgument +DSAShadowBindError ::= DirectoryBindError + +dSAShadowUnbind OPERATION ::= directoryUnbind + +-- shadow operational binding +--shadowOperationalBinding OPERATIONAL-BINDING ::= { +-- AGREEMENT ShadowingAgreementInfo +-- APPLICATION CONTEXTS +-- {{shadowSupplierInitiatedAC +-- APPLIES TO {All-operations-supplier-initiated}} | +-- {shadowConsumerInitiatedAC +-- APPLIES TO {All-operations-consumer-initiated}} | +-- {reliableShadowSupplierInitiatedAC +-- APPLIES TO {All-operations-supplier-initiated}} | +-- {reliableShadowConsumerInitiatedAC +-- APPLIES TO {All-operations-consumer-initiated}}} +-- ASYMMETRIC ROLE-A +-- { - - shadow supplier roleESTABLISHMENT-INITIATOR TRUE +-- ESTABLISHMENT-PARAMETER NULL +-- MODIFICATION-INITIATOR TRUE +-- TERMINATION-INITIATOR TRUE} +-- ROLE-B +-- { - - shadow consumer roleESTABLISHMENT-INITIATOR TRUE +-- ESTABLISHMENT-PARAMETER NULL +-- MODIFICATION-INITIATOR TRUE +-- MODIFICATION-PARAMETER ModificationParameter +-- TERMINATION-INITIATOR TRUE} +-- ID id-op-binding-shadow +--} + +-- types +ModificationParameter ::= SEQUENCE { + secondaryShadows SET OF SupplierAndConsumers +} + +AgreementID ::= OperationalBindingID + +ShadowingAgreementInfo ::= SEQUENCE { + shadowSubject UnitOfReplication, + updateMode UpdateMode -- DEFAULT supplierInitiated:onChange:TRUE--, + master AccessPoint OPTIONAL, + secondaryShadows [2] BOOLEAN DEFAULT FALSE +} + +UnitOfReplication ::= SEQUENCE { + area AreaSpecification, + attributes AttributeSelection, + knowledge Knowledge OPTIONAL, + subordinates BOOLEAN DEFAULT FALSE, + contextSelection ContextSelection OPTIONAL, + supplyContexts + [0] CHOICE {allContexts NULL, + selectedContexts SET --SIZE (1..MAX)-- OF --CONTEXT.&id-- OBJECT IDENTIFIER } OPTIONAL +} + +AreaSpecification ::= SEQUENCE { + contextPrefix DistinguishedName, + replicationArea SubtreeSpecification +} + +Knowledge ::= SEQUENCE { + knowledgeType ENUMERATED {master(0), shadow(1), both(2)}, + extendedKnowledge BOOLEAN DEFAULT FALSE +} + +AttributeSelection ::= SET OF ClassAttributeSelection + +ClassAttributeSelection ::= SEQUENCE { + class OBJECT IDENTIFIER OPTIONAL, + classAttributes ClassAttributes -- DEFAULT allAttributes:NULL +} + +ClassAttributes ::= CHOICE { + allAttributes NULL, + include [0] AttributeTypes, + exclude [1] AttributeTypes +} + +AttributeTypes ::= SET OF AttributeType + +UpdateMode ::= CHOICE { + supplierInitiated [0] SupplierUpdateMode, + consumerInitiated [1] ConsumerUpdateMode +} + +SupplierUpdateMode ::= CHOICE { + onChange BOOLEAN, + scheduled SchedulingParameters +} + +ConsumerUpdateMode ::= SchedulingParameters + +SchedulingParameters ::= SEQUENCE { + periodic PeriodicStrategy OPTIONAL, -- shall be present if othertimes is set to FALSE + othertimes BOOLEAN DEFAULT FALSE +} + +PeriodicStrategy ::= SEQUENCE { + beginTime Time OPTIONAL, + windowSize INTEGER, + updateInterval INTEGER +} + +Time ::= GeneralizedTime + +-- as per 34.2 b) and c) of CCITT Rec. X.208 and ISO/IEC 8824 +-- shadow operations, arguments, and results +--All-operations-consumer-initiated OPERATION ::= +-- {requestShadowUpdate | updateShadow} + +--All-operations-supplier-initiated OPERATION ::= +-- {coordinateShadowUpdate | updateShadow} + +--coordinateShadowUpdate OPERATION ::= { +-- ARGUMENT CoordinateShadowUpdateArgument +-- RESULT CoordinateShadowUpdateResult +-- ERRORS {shadowError} +-- CODE id-opcode-coordinateShadowUpdate +--} + +CoordinateShadowUpdateArgumentData ::= +-- OPTIONALLY-PROTECTED +-- {[0] -- SEQUENCE {agreementID AgreementID, + lastUpdate Time OPTIONAL, + updateStrategy + CHOICE {standard + ENUMERATED {noChanges(0), incremental(1), + total(2)}, + other EXTERNAL}, + securityParameters SecurityParameters OPTIONAL} --} + +-- expand OPTIONALLY-PROTECTED macro +CoordinateShadowUpdateArgument ::= CHOICE { + unsignedCoordinateShadowUpdateArgument [0] CoordinateShadowUpdateArgumentData, + signedCoordinateShadowUpdateArgument SEQUENCE { + coordinateShadowUpdateArgument [0] CoordinateShadowUpdateArgumentData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + + +CoordinateShadowUpdateResult ::= CHOICE { + null NULL, + information Information +-- OPTIONALLY-PROTECTED{ [0] SEQUENCE {agreementID AgreementID, +-- lastUpdate Time OPTIONAL, +-- COMPONENTS OF CommonResultsSeq +-- }} +} + +InformationData ::= SEQUENCE { + agreementID AgreementID, + lastUpdate Time OPTIONAL, +-- COMPONENTS OF CommonResultsSeq + securityParameters [30] SecurityParameters OPTIONAL, + performer [29] DistinguishedName OPTIONAL, + aliasDereferenced [28] BOOLEAN DEFAULT FALSE, + notification [27] SEQUENCE --SIZE (1..MAX)-- OF Attribute OPTIONAL + } + +-- expand OPTIONALLY-PROTECTED macro +Information ::= CHOICE { + unsignedInformation [0] InformationData, + signedInformation SEQUENCE { + information [0] InformationData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + + +--requestShadowUpdate OPERATION ::= { +-- ARGUMENT RequestShadowUpdateArgument +-- RESULT RequestShadowUpdateResult +-- ERRORS {shadowError} +-- CODE id-opcode-requestShadowUpdate +--} + +RequestShadowUpdateArgumentData ::= +-- OPTIONALLY-PROTECTED +-- { [0] -- SEQUENCE {agreementID AgreementID, + lastUpdate Time OPTIONAL, + requestedStrategy + CHOICE {standard ENUMERATED {incremental(1), total(2)}, + other EXTERNAL}, + securityParameters SecurityParameters OPTIONAL} --} + +-- expand OPTIONALLY-PROTECTED macro +RequestShadowUpdateArgument ::= CHOICE { + unsignedRequestShadowUpdateArgument [0] RequestShadowUpdateArgumentData, + signedRequestShadowUpdateArgument SEQUENCE { + requestShadowUpdateArgument [0] RequestShadowUpdateArgumentData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + + +RequestShadowUpdateResult ::= CHOICE { + null NULL, + information Information +-- OPTIONALLY-PROTECTED{[0] SEQUENCE {agreementID AgreementID, +-- lastUpdate Time OPTIONAL, +-- COMPONENTS OF CommonResultsSeq +-- }} +} + +--updateShadow OPERATION ::= { +-- ARGUMENT UpdateShadowArgument +-- RESULT UpdateShadowResult +-- ERRORS {shadowError} +-- CODE id-opcode-updateShadow +--} + +UpdateShadowArgumentData ::= +-- OPTIONALLY-PROTECTED +-- { [0] -- SEQUENCE {agreementID AgreementID, + updateTime Time, + updateWindow UpdateWindow OPTIONAL, + updatedInfo RefreshInformation, + securityParameters SecurityParameters OPTIONAL} --} + +-- expand OPTIONALLY-PROTECTED macro +UpdateShadowArgument ::= CHOICE { + unsignedUpdateShadowArgument [0] UpdateShadowArgumentData, + signedUpdateShadowArgument SEQUENCE { + updateShadowArgument [0] UpdateShadowArgumentData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + + +UpdateShadowResult ::= CHOICE { + null NULL, + information Information +-- OPTIONALLY-PROTECTED{ [0] SEQUENCE {agreementID AgreementID, +-- lastUpdate Time OPTIONAL, +-- COMPONENTS OF CommonResultsSeq +-- }} +} + +UpdateWindow ::= SEQUENCE {start Time, + stop Time +} + +RefreshInformation ::= CHOICE { + noRefresh NULL, + total [0] TotalRefresh, + incremental [1] IncrementalRefresh, + otherStrategy EXTERNAL +} + +TotalRefresh ::= SEQUENCE { + sDSE SDSEContent OPTIONAL, + subtree SET --SIZE (1..MAX)-- OF Subtree OPTIONAL +} + +SDSEContent ::= SEQUENCE { + sDSEType SDSEType, + subComplete [0] BOOLEAN DEFAULT FALSE, + attComplete [1] BOOLEAN OPTIONAL, + attributes SET OF Attribute, + attValIncomplete SET OF AttributeType DEFAULT {} +} + +SDSEType ::= DSEType + +Subtree ::= SEQUENCE { + rdn RelativeDistinguishedName, +-- COMPONENTS OF TotalRefresh + sDSE SDSEContent OPTIONAL, + subtree SET --SIZE (1..MAX)-- OF Subtree OPTIONAL +} + +IncrementalRefresh ::= SEQUENCE OF IncrementalStepRefresh + +IncrementalStepRefresh ::= SEQUENCE { + sDSEChanges + CHOICE {add [0] SDSEContent, + remove NULL, + modify [1] ContentChange} OPTIONAL, + subordinateUpdates SEQUENCE --SIZE (1..MAX)-- OF SubordinateChanges OPTIONAL +} + +ContentChange ::= SEQUENCE { + rename + CHOICE {newRDN RelativeDistinguishedName, + newDN DistinguishedName} OPTIONAL, + attributeChanges + CHOICE {replace [0] SET --SIZE (1..MAX)-- OF Attribute, + changes [1] SEQUENCE --SIZE (1..MAX)-- OF EntryModification + } OPTIONAL, + sDSEType SDSEType, + subComplete [2] BOOLEAN DEFAULT FALSE, + attComplete [3] BOOLEAN OPTIONAL, + attValIncomplete SET OF AttributeType DEFAULT {} +} + +SubordinateChanges ::= SEQUENCE { + subordinate RelativeDistinguishedName, + changes IncrementalStepRefresh +} + +-- errors and parameters +ShadowErrorData ::= -- ERROR ::= { +-- PARAMETER OPTIONALLY-PROTECTED-SEQ +-- { --SEQUENCE {problem ShadowProblem, + lastUpdate Time OPTIONAL, + updateWindow UpdateWindow OPTIONAL, +-- COMPONENTS OF CommonResultsSeq}} + securityParameters [30] SecurityParameters OPTIONAL, + performer [29] DistinguishedName OPTIONAL, + aliasDereferenced [28] BOOLEAN DEFAULT FALSE, + notification [27] SEQUENCE --SIZE (1..MAX)-- OF Attribute OPTIONAL +-- CODE id-errcode-shadowError +} + +-- OPTIONALLY-PROTECTED-SEQ macro expansion +ShadowError ::= CHOICE { + unsignedShadowError ShadowErrorData, + signedShadowError [0] SEQUENCE { + shadowError ShadowErrorData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + + +ShadowProblem ::= INTEGER { + invalidAgreementID(1), inactiveAgreement(2), invalidInformationReceived(3), + unsupportedStrategy(4), missedPrevious(5), fullUpdateRequired(6), + unwillingToPerform(7), unsuitableTiming(8), updateAlreadyReceived(9), + invalidSequencing(10), insufficientResources(11)} + +END -- DirectoryShadowAbstractService + +-- Generated by Asnp, the ASN.1 pretty-printer of France Telecom R&D + diff --git a/asn1/disp/disp.cnf b/asn1/disp/disp.cnf new file mode 100755 index 0000000000..a6436bc1bd --- /dev/null +++ b/asn1/disp/disp.cnf @@ -0,0 +1,113 @@ +#.TYPE_ATTR +Time TYPE = FT_STRING DISPLAY = BASE_NONE STRING = NULL BITMASK = 0 + +#.MODULE_IMPORT +InformationFramework x509if +AuthenticationFramework x509af +ACSE-1 acse +DirectoryAbstractService dap +DistributedOperations dsp +DSAOperationalAttributeTypes x501 +OperationalBindingManagement dap + +#.INCLUDE ../x501/x501-exp.cnf +#.INCLUDE ../x509if/x509if-exp.cnf +#.INCLUDE ../x509af/x509af-exp.cnf +#.INCLUDE ../dap/dap-exp.cnf +#.INCLUDE ../dsp/dsp-exp.cnf +#.INCLUDE ../acse/acse-exp.cnf + +#.TYPE_RENAME +CoordinateShadowUpdateArgumentData/updateStrategy/standard StandardUpdate + +#.FIELD_RENAME +UnitOfReplication/attributes replication-attributes +SubordinateChanges/changes subordinate-changes +ModificationParameter/secondaryShadows modifiedSecondaryShadows +CoordinateShadowUpdateArgumentData/updateStrategy/standard standardUpdate +Information/signedInformation/information information-data + +#.FN_PARS T_standard + VAL_PTR = &update + +#.FN_BODY T_standard + guint32 update; + + %(DEFAULT_BODY)s + + if (check_col(pinfo->cinfo, COL_INFO)) { + col_append_fstr(pinfo->cinfo, COL_INFO, " %%s", val_to_str(update, disp_T_standard_vals, "standard(%%d")); + } + +#.FN_PARS RefreshInformation + VAL_PTR = &update + +#.FN_BODY RefreshInformation + guint32 update; + + %(DEFAULT_BODY)s + + if (check_col(pinfo->cinfo, COL_INFO)) { + col_append_fstr(pinfo->cinfo, COL_INFO, " %%s", val_to_str(update, disp_RefreshInformation_vals, "unknown(%%d)")); + } + +#.FN_PARS StandardUpdate + VAL_PTR = &update + +#.FN_BODY StandardUpdate + guint32 update; + + %(DEFAULT_BODY)s + + if (check_col(pinfo->cinfo, COL_INFO)) { + col_append_fstr(pinfo->cinfo, COL_INFO, " %%s", val_to_str(update, disp_StandardUpdate_vals, "unknown(%%d)")); + } + +#.FN_PARS CoordinateShadowUpdateResult + VAL_PTR = &update + +#.FN_BODY CoordinateShadowUpdateResult + guint32 update; + + %(DEFAULT_BODY)s + + if (check_col(pinfo->cinfo, COL_INFO)) { + col_append_fstr(pinfo->cinfo, COL_INFO, " %%s", val_to_str(update, disp_CoordinateShadowUpdateResult_vals, "unknown(%%d)")); + } + +#.FN_PARS RequestShadowUpdateResult + VAL_PTR = &update + +#.FN_BODY RequestShadowUpdateResult + guint32 update; + + %(DEFAULT_BODY)s + + if (check_col(pinfo->cinfo, COL_INFO)) { + col_append_fstr(pinfo->cinfo, COL_INFO, " %%s", val_to_str(update, disp_RequestShadowUpdateResult_vals, "unknown(%%d)")); + } + +#.FN_PARS UpdateShadowResult + VAL_PTR = &update + +#.FN_BODY UpdateShadowResult + guint32 update; + + %(DEFAULT_BODY)s + + if (check_col(pinfo->cinfo, COL_INFO)) { + col_append_fstr(pinfo->cinfo, COL_INFO, " %%s", val_to_str(update, disp_UpdateShadowResult_vals, "unknown(%%d)")); + } + +#.FN_PARS ShadowProblem + VAL_PTR = &problem + +#.FN_BODY ShadowProblem + guint32 problem; + + %(DEFAULT_BODY)s + + if (check_col(pinfo->cinfo, COL_INFO)) { + col_append_fstr(pinfo->cinfo, COL_INFO, " %%s", val_to_str(problem, disp_ShadowProblem_vals, "ShadowProblem(%%d)")); + } + diff --git a/asn1/disp/packet-disp-template.c b/asn1/disp/packet-disp-template.c new file mode 100755 index 0000000000..1f64729c46 --- /dev/null +++ b/asn1/disp/packet-disp-template.c @@ -0,0 +1,275 @@ +/* packet-disp.c + * Routines for X.525 (X.500 Directory Shadow Asbtract Service) and X.519 DISP packet dissection + * Graeme Lunt 2005 + * + * $Id: packet-disp-template.c 14773 2005-06-26 10:59:15Z etxrab $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <glib.h> +#include <epan/packet.h> +#include <epan/prefs.h> +#include <epan/conversation.h> + +#include <stdio.h> +#include <string.h> + +#include "packet-ber.h" +#include "packet-acse.h" +#include "packet-ros.h" +#include "packet-rtse.h" + +#include "packet-x509if.h" +#include "packet-x509af.h" +#include "packet-x509sat.h" +#include "packet-crmf.h" + +#include "packet-x501.h" +#include "packet-dap.h" +#include "packet-dsp.h" +#include "packet-disp.h" +#include "packet-acse.h" + + +/* we don't have a separate dissector for X519 - + and most of DISP is defined in X525 */ +#define PNAME "X.519 Directory Information Shadowing Protocol" +#define PSNAME "DISP" +#define PFNAME "disp" + +static guint global_disp_tcp_port = 102; +static guint tcp_port = 0; +static dissector_handle_t tpkt_handle = NULL; +void prefs_register_disp(void); /* forwad declaration for use in preferences registration */ + + +/* Initialize the protocol and registered fields */ +int proto_disp = -1; + +static struct SESSION_DATA_STRUCTURE* session = NULL; + +#include "packet-disp-hf.c" + +/* Initialize the subtree pointers */ +static gint ett_disp = -1; +#include "packet-disp-ett.c" + +#include "packet-disp-fn.c" + +/* +* Dissect DISP PDUs inside a ROS PDUs +*/ +static void +dissect_disp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +{ + int offset = 0; + int old_offset; + proto_item *item=NULL; + proto_tree *tree=NULL; + int (*disp_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) = NULL; + char *disp_op_name; + + /* do we have operation information from the ROS dissector? */ + if( !pinfo->private_data ){ + 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) ); + } + + if(parent_tree){ + item = proto_tree_add_item(parent_tree, proto_disp, tvb, 0, -1, FALSE); + tree = proto_item_add_subtree(item, ett_disp); + } + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "DISP"); + if (check_col(pinfo->cinfo, COL_INFO)) + col_clear(pinfo->cinfo, COL_INFO); + + switch(session->ros_op & ROS_OP_MASK) { + case (ROS_OP_BIND | ROS_OP_ARGUMENT): /* BindInvoke */ + disp_dissector = dissect_disp_DSAShadowBindArgument; + disp_op_name = "Shadow-Bind-Argument"; + break; + case (ROS_OP_BIND | ROS_OP_RESULT): /* BindResult */ + disp_dissector = dissect_disp_DSAShadowBindResult; + disp_op_name = "Shadow-Bind-Result"; + break; + case (ROS_OP_BIND | ROS_OP_ERROR): /* BindError */ + disp_dissector = dissect_disp_DSAShadowBindError; + disp_op_name = "Shadow-Bind-Error"; + break; + case (ROS_OP_INVOKE | ROS_OP_ARGUMENT): /* Invoke Argument */ + switch(session->ros_op & ROS_OP_OPCODE_MASK) { + case 1: /* requestShadowUpdate */ + disp_dissector = dissect_disp_RequestShadowUpdateArgument; + disp_op_name = "Request-Shadow-Update-Argument"; + break; + case 2: /* updateShadow*/ + disp_dissector = dissect_disp_UpdateShadowArgument; + disp_op_name = "Update-Shadow-Argument"; + break; + case 3: /* coordinateShadowUpdate */ + disp_dissector = dissect_disp_CoordinateShadowUpdateArgument; + disp_op_name = "Coordinate-Shadow-Update-Argument"; + break; + default: + proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DISP opcode (%d)", + session->ros_op & ROS_OP_OPCODE_MASK); + break; + } + break; + case (ROS_OP_INVOKE | ROS_OP_RESULT): /* Return Result */ + switch(session->ros_op & ROS_OP_OPCODE_MASK) { + case 1: /* requestShadowUpdate */ + disp_dissector = dissect_disp_RequestShadowUpdateResult; + disp_op_name = "Request-Shadow-Result"; + break; + case 2: /* updateShadow */ + disp_dissector = dissect_disp_UpdateShadowResult; + disp_op_name = "Update-Shadow-Result"; + break; + case 3: /* coordinateShadowUpdate */ + disp_dissector = dissect_disp_CoordinateShadowUpdateResult; + disp_op_name = "Coordinate-Shadow-Update-Result"; + break; + default: + proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DISP opcode"); + break; + } + break; + case (ROS_OP_INVOKE | ROS_OP_ERROR): /* Return Error */ + switch(session->ros_op & ROS_OP_OPCODE_MASK) { + case 1: /* shadowError */ + disp_dissector = dissect_disp_ShadowError; + disp_op_name = "Shadow-Error"; + break; + default: + proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DISP errcode"); + break; + } + break; + default: + proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DISP PDU"); + return; + } + + if(disp_dissector) { + if (check_col(pinfo->cinfo, COL_INFO)) + col_add_str(pinfo->cinfo, COL_INFO, disp_op_name); + + while (tvb_reported_length_remaining(tvb, offset) > 0){ + old_offset=offset; + offset=(*disp_dissector)(FALSE, tvb, offset, pinfo , tree, -1); + if(offset == old_offset){ + proto_tree_add_text(tree, tvb, offset, -1,"Internal error, zero-byte DISP PDU"); + offset = tvb_length(tvb); + break; + } + } + } +} + + +/*--- proto_register_disp -------------------------------------------*/ +void proto_register_disp(void) { + + /* List of fields */ + static hf_register_info hf[] = + { +#include "packet-disp-hfarr.c" + }; + + /* List of subtrees */ + static gint *ett[] = { + &ett_disp, +#include "packet-disp-ettarr.c" + }; + module_t *disp_module; + + /* Register protocol */ + proto_disp = proto_register_protocol(PNAME, PSNAME, PFNAME); + register_dissector("disp", dissect_disp, proto_disp); + + /* Register fields and subtrees */ + proto_register_field_array(proto_disp, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + + /* Register our configuration options for DISP, particularly our port */ + + disp_module = prefs_register_protocol(proto_disp, prefs_register_disp); + + prefs_register_uint_preference(disp_module, "tcp.port", "DISP TCP Port", + "Set the port for DISP operations (if other" + " than the default of 102)", + 10, &global_disp_tcp_port); + +} + + +/*--- proto_reg_handoff_disp --- */ +void proto_reg_handoff_disp(void) { + dissector_handle_t handle = NULL; + + /* #include "packet-disp-dis-tab.c" */ + + /* APPLICATION CONTEXT */ + + register_ber_oid_name("2.5.3.4", "id-ac-shadow-consumer-initiated"); + register_ber_oid_name("2.5.3.5", "id-ac-shadow-supplier-initiated"); + register_ber_oid_name("2.5.3.6", "id-ac-reliable-shadow-consumer-initiated"); + register_ber_oid_name("2.5.3.7", "id-ac-reliable-shadow-supplier-initiated"); + + /* ABSTRACT SYNTAXES */ + + if((handle = find_dissector("disp"))) { + + register_ros_oid_dissector_handle("2.5.9.3", handle, 0, "id-as-directory-shadow", FALSE); + + register_rtse_oid_dissector_handle("2.5.9.5", handle, 0, "id-as-directory-reliable-shadow", FALSE); + register_rtse_oid_dissector_handle("2.5.9.6", handle, 0, "id-as-directory-reliable-binding", FALSE); + } + + tpkt_handle = find_dissector("tpkt"); + +} + + +void prefs_register_disp(void) { + + /* de-register the old port */ + /* port 102 is registered by TPKT - don't undo this! */ + if((tcp_port != 102) && tpkt_handle) + dissector_delete("tcp.port", tcp_port, tpkt_handle); + + /* Set our port number for future use */ + tcp_port = global_disp_tcp_port; + + if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) + dissector_add("tcp.port", global_disp_tcp_port, tpkt_handle); + +} diff --git a/asn1/disp/packet-disp-template.h b/asn1/disp/packet-disp-template.h new file mode 100755 index 0000000000..a12c17de33 --- /dev/null +++ b/asn1/disp/packet-disp-template.h @@ -0,0 +1,30 @@ +/* packet-disp.h + * Routines for X.525 (X.400 Message Transfer) packet dissection + * Graeme Lunt 2005 + * + * $Id: packet-disp-template.h 14773 2005-06-26 10:59:15Z etxrab $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef PACKET_DISP_H +#define PACKET_DISP_H + + +#endif /* PACKET_DISP_H */ |