From 3487cd6d59181fa5946877f9617d41f0a056e8fc Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Wed, 16 Nov 2005 22:53:33 +0000 Subject: from Graeme Lunt 4 new asn based protocols X501 DISP DAP DSP svn path=/trunk/; revision=16518 --- asn1/dsp/Makefile | 17 ++ asn1/dsp/dsp-exp.cnf | 14 ++ asn1/dsp/dsp.asn | 480 +++++++++++++++++++++++++++++++++++++++++ asn1/dsp/dsp.cnf | 40 ++++ asn1/dsp/packet-dsp-template.c | 345 +++++++++++++++++++++++++++++ asn1/dsp/packet-dsp-template.h | 31 +++ 6 files changed, 927 insertions(+) create mode 100755 asn1/dsp/Makefile create mode 100755 asn1/dsp/dsp-exp.cnf create mode 100755 asn1/dsp/dsp.asn create mode 100755 asn1/dsp/dsp.cnf create mode 100755 asn1/dsp/packet-dsp-template.c create mode 100755 asn1/dsp/packet-dsp-template.h (limited to 'asn1/dsp') diff --git a/asn1/dsp/Makefile b/asn1/dsp/Makefile new file mode 100755 index 0000000000..339a64b1cd --- /dev/null +++ b/asn1/dsp/Makefile @@ -0,0 +1,17 @@ +# $Id: Makefile 13071 2005-01-16 10:19:21Z guy $ + +DISSECTOR_FILES=packet-dsp.c packet-dsp.h + +all: generate_dissector + +generate_dissector: $(DISSECTOR_FILES) + +$(DISSECTOR_FILES): ../../tools/asn2eth.py dsp.asn packet-dsp-template.c packet-dsp-template.h dsp.cnf ../x411/x411-exp.cnf + python ../../tools/asn2eth.py -X -b -e -p dsp -c dsp.cnf -s packet-dsp-template dsp.asn + +clean: + rm -f parsetab.py $(DISSECTOR_FILES) *~ + +copy_files: generate_dissector + cp $(DISSECTOR_FILES) ../../epan/dissectors + diff --git a/asn1/dsp/dsp-exp.cnf b/asn1/dsp/dsp-exp.cnf new file mode 100755 index 0000000000..a6ddea438a --- /dev/null +++ b/asn1/dsp/dsp-exp.cnf @@ -0,0 +1,14 @@ +#.IMPORT_TAG +OperationProgress BER_CLASS_UNI BER_UNI_TAG_SET +ReferenceType BER_CLASS_UNI BER_UNI_TAG_ENUMERATED +AccessPoint BER_CLASS_UNI BER_UNI_TAG_SET +ContinuationReference BER_CLASS_UNI BER_UNI_TAG_SET +#.END + +#.TYPE_ATTR +OperationProgress TYPE = FT_NONE DISPLAY = BASE_NONE STRINGS = NULL BITMASK = 0 +ReferenceType TYPE = FT_UINT32 DISPLAY = BASE_DEC STRINGS = VALS(dsp_ReferenceType_vals) BITMASK = 0 +AccessPoint TYPE = FT_NONE DISPLAY = BASE_NONE STRINGS = NULL BITMASK = 0 +ContinuationReference TYPE = FT_NONE DISPLAY = BASE_NONE STRINGS = NULL BITMASK = 0 +#.END + diff --git a/asn1/dsp/dsp.asn b/asn1/dsp/dsp.asn new file mode 100755 index 0000000000..3f72c1514c --- /dev/null +++ b/asn1/dsp/dsp.asn @@ -0,0 +1,480 @@ +-- Module DistributedOperations (X.518:02/2001) +DistributedOperations {joint-iso-itu-t ds(5) module(1) distributedOperations(3) + 4} DEFINITIONS ::= +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 + basicAccessControl, dap, directoryAbstractService, enhancedSecurity, + informationFramework, selectedAttributeTypes, serviceAdministration + FROM UsefulDefinitions {joint-iso-itu-t ds(5) module(1) + usefulDefinitions(0) 4} + DistinguishedName, Name, RDNSequence, Attribute + FROM InformationFramework {joint-iso-itu-t ds(5) module(1) + informationFramework(1) 4} + MRMapping, SearchRuleId + FROM ServiceAdministration {joint-iso-itu-t ds(5) module(1) + serviceAdministration(33) 4} +-- AuthenticationLevel +-- FROM BasicAccessControl {joint-iso-itu-t ds(5) module(1) +-- basicAccessControl(24) 4} + OPTIONALLY-PROTECTED{} + FROM EnhancedSecurity {joint-iso-itu-t ds(5) module(1) enhancedSecurity(28) + 4} + -- from ITU-T Rec. X.511 | ISO/IEC 9594-3 + abandon, addEntry, CommonResults, compare, directoryBind, directoryUnbind, + list, modifyDN, modifyEntry, read, referral, removeEntry, search, + SecurityParameters, + AbandonArgument, AbandonResult, AddEntryArgument, AddEntryResult, + CompareArgument, CompareResult, ListArgument, ListResult, + ModifyDNArgument, ModifyDNResult, ModifyEntryArgument, ModifyEntryResult, + ReadArgument, ReadResult, RemoveEntryArgument, RemoveEntryResult, + SearchArgument, SearchResult, + DirectoryBindArgument, DirectoryBindResult, DirectoryBindError + FROM DirectoryAbstractService {joint-iso-itu-t ds(5) module(1) + directoryAbstractService(2) 4} + -- from ITU-T Rec. X.519 | ISO/IEC 9594-5 + id-errcode-dsaReferral + FROM DirectoryAccessProtocol {joint-iso-itu-t ds(5) module(1) dap(11) 4} + -- from ITU-T Rec. X.520 | ISO/IEC 9594-6 + PresentationAddress, ProtocolInformation, UniqueIdentifier + FROM SelectedAttributeTypes {joint-iso-itu-t ds(5) module(1) + selectedAttributeTypes(5) 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)}--; + EXTERNAL + FROM ACSE-1 {joint-iso-itu-t association-control(2) modules(0) acse1(1) version1(1)} + AlgorithmIdentifier + FROM AuthenticationFramework {joint-iso-itu-t ds(5) module(1) + authenticationFramework(7) 4}; + + + +-- parameterized type for deriving chained operations +--chained{OPERATION:operation} OPERATION ::= { +-- ARGUMENT OPTIONALLY-PROTECTED +-- {SET {chainedArgument ChainingArguments, +-- argument [0] operation.&ArgumentType}} +-- RESULT OPTIONALLY-PROTECTED +-- {SET {chainedResult ChainingResults, +-- result [0] operation.&ResultType}} +-- ERRORS +-- {operation.&Errors EXCEPT referral | dsaReferral} +-- CODE operation.&operationCode +--} + +-- bind and unbind operations +--dSABind OPERATION ::= directoryBind +DSASystemBindArgument ::= DirectoryBindArgument +DSASystemBindResult ::= DirectoryBindArgument +DSASystemBindError ::= DirectoryBindError + + +--dSAUnbind OPERATION ::= directoryUnbind + +-- chained operations +--chainedRead OPERATION ::= chained{read} + +-- expand chained{} macro +ChainedReadArgumentData ::= SET { + chainedArgument ChainingArguments, + readArgument [0] ReadArgument +} + +ChainedReadArgument ::= CHOICE { + unsignedChainedReadArgument ChainedReadArgumentData, + signedChainedReadArgument SEQUENCE { + chainedReadArgument ChainedReadArgumentData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +ChainedReadResultData ::= SET { + chainedResults ChainingResults, + readResult [0] ReadResult +} + +ChainedReadResult ::= CHOICE { + unsignedChainedReadResult ChainedReadResultData, + signedChainedReadResult SEQUENCE { + chainedReadResult ChainedReadResultData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +--chainedCompare OPERATION ::= chained{compare} + +-- expand chained{} macro +ChainedCompareArgumentData ::= SET { + chainedArgument ChainingArguments, + compareArgument [0] CompareArgument +} + +ChainedCompareArgument ::= CHOICE { + unsignedChainedCompareArgument ChainedCompareArgumentData, + signedChainedCompareArgument SEQUENCE { + chainedCompareArgument ChainedCompareArgumentData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +ChainedCompareResultData ::= SET { + chainedResults ChainingResults, + compareResult [0] CompareResult +} + +ChainedCompareResult ::= CHOICE { + unsignedChainedCompareResult ChainedCompareResultData, + signedChainedCompareResult SEQUENCE { + chainedCompareResult ChainedCompareResultData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +--chainedAbandon OPERATION ::= abandon + +ChainedAbandonArgument ::= AbandonArgument +ChainedAbandonResult ::= AbandonResult + +--chainedList OPERATION ::= chained{list} + +-- expand chained{} macro +ChainedListArgumentData ::= SET { + chainedArgument ChainingArguments, + listArgument [0] ListArgument +} + +ChainedListArgument ::= CHOICE { + unsignedChainedListArgument ChainedListArgumentData, + signedChainedListArgument SEQUENCE { + chainedListArgument ChainedListArgumentData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +ChainedListResultData ::= SET { + chainedResults ChainingResults, + listResult [0] ListResult +} + +ChainedListResult ::= CHOICE { + unsignedChainedListResult ChainedListResultData, + signedChainedListResult SEQUENCE { + chainedListResult ChainedListResultData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +--chainedSearch OPERATION ::= chained{search} + +-- expand chained{} macro +ChainedSearchArgumentData ::= SET { + chainedArgument ChainingArguments, + searchArgument [0] SearchArgument +} + +ChainedSearchArgument ::= CHOICE { + unsignedChainedSearchArgument ChainedSearchArgumentData, + signedChainedSearchArgument SEQUENCE { + chainedSearchArgument ChainedSearchArgumentData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +ChainedSearchResultData ::= SET { + chainedResults ChainingResults, + searchResult [0] SearchResult +} + +ChainedSearchResult ::= CHOICE { + unsignedChainedSearchResult ChainedSearchResultData, + signedChainedSearchResult SEQUENCE { + chainedSearchResult ChainedSearchResultData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +--chainedAddEntry OPERATION ::= chained{addEntry} + +-- expand chained{} macro +ChainedAddEntryArgumentData ::= SET { + chainedArgument ChainingArguments, + addEntryArgument [0] AddEntryArgument +} + +ChainedAddEntryArgument ::= CHOICE { + unsignedChainedAddEntryArgument ChainedAddEntryArgumentData, + signedChainedAddEntryArgument SEQUENCE { + chainedAddEntryArgument ChainedAddEntryArgumentData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +ChainedAddEntryResultData ::= SET { + chainedResults ChainingResults, + addEntryResult [0] AddEntryResult +} + +ChainedAddEntryResult ::= CHOICE { + unsignedChainedAddEntryResult ChainedAddEntryResultData, + signedChainedAddEntryResult SEQUENCE { + chainedAddEntryResult ChainedAddEntryResultData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +--chainedRemoveEntry OPERATION ::= chained{removeEntry} + +-- expand chained{} macro + +ChainedRemoveEntryArgumentData ::= SET { + chainedArgument ChainingArguments, + removeEntryArgument [0] RemoveEntryArgument +} + +ChainedRemoveEntryArgument ::= CHOICE { + unsignedChainedRemoveEntryArgument ChainedRemoveEntryArgumentData, + signedChainedRemoveEntryArgument SEQUENCE { + chainedRemoveEntryArgument ChainedRemoveEntryArgumentData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +ChainedRemoveEntryResultData ::= SET { + chainedResults ChainingResults, + removeEntryResult [0] RemoveEntryResult +} + +ChainedRemoveEntryResult ::= CHOICE { + unsignedChainedRemoveEntryResult ChainedRemoveEntryResultData, + signedChainedRemoveEntryResult SEQUENCE { + chainedRemoveEntryResult ChainedRemoveEntryResultData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +--chainedModifyEntry OPERATION ::= chained{modifyEntry} + +-- expand chained{} macro + +ChainedModifyEntryArgumentData ::= SET { + chainedArgument ChainingArguments, + modifyEntryArgument [0] ModifyEntryArgument +} + +ChainedModifyEntryArgument ::= CHOICE { + unsignedChainedModifyEntryArgument ChainedModifyEntryArgumentData, + signedChainedModifyEntryArgument SEQUENCE { + chainedModifyEntryArgument ChainedModifyEntryArgumentData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +ChainedModifyEntryResultData ::= SET { + chainedResults ChainingResults, + modifyEntryResult [0] ModifyEntryResult +} + +ChainedModifyEntryResult ::= CHOICE { + unsignedChainedModifyEntryResult ChainedModifyEntryResultData, + signedChainedModifyEntryResult SEQUENCE { + chainedModifyEntryResult ChainedModifyEntryResultData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +--chainedModifyDN OPERATION ::= chained{modifyDN} + +-- expand chained{} macro + +ChainedModifyDNArgumentData ::= SET { + chainedArgument ChainingArguments, + modifyDNArgument [0] ModifyDNArgument +} + +ChainedModifyDNArgument ::= CHOICE { + unsignedChainedModifyDNArgument ChainedModifyDNArgumentData, + signedChainedModifyDNArgument SEQUENCE { + chainedModifyDNArgument ChainedModifyDNArgumentData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +ChainedModifyDNResultData ::= SET { + chainedResults ChainingResults, + modifyDNResult [0] ModifyDNResult +} + +ChainedModifyDNResult ::= CHOICE { + unsignedChainedModifyDNResult ChainedModifyDNResultData, + signedChainedModifyDNResult SEQUENCE { + chainedModifyDNResult ChainedModifyDNResultData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + +-- errors and parameters +DSAReferralData -- ERROR-- ::= -- { +-- PARAMETER OPTIONALLY-PROTECTED +-- {--SET {reference [0] ContinuationReference, + contextPrefix [1] DistinguishedName OPTIONAL, +-- COMPONENTS OF CommonResults}} + 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-dsaReferral +} + +-- expand OPTIONALLY-PROTECTED macro +DSAReferral ::= CHOICE { + unsignedDSAReferral DSAReferralData, + signedDSAReferral SEQUENCE { + dsaReferral DSAReferralData, + algorithmIdentifier AlgorithmIdentifier, + encrypted BIT STRING + } +} + + +-- common arguments and results +ChainingArguments ::= SET { + originator [0] DistinguishedName OPTIONAL, + targetObject [1] DistinguishedName OPTIONAL, + operationProgress + [2] OperationProgress DEFAULT {nameResolutionPhase notStarted}, + traceInformation [3] TraceInformation, + aliasDereferenced [4] BOOLEAN DEFAULT FALSE, + aliasedRDNs [5] INTEGER OPTIONAL, + -- only present in 1988 systems + returnCrossRefs [6] BOOLEAN DEFAULT FALSE, + referenceType [7] ReferenceType DEFAULT superior, + info [8] DomainInfo OPTIONAL, + timeLimit [9] Time OPTIONAL, + securityParameters [10] SecurityParameters DEFAULT {}, + entryOnly [11] BOOLEAN DEFAULT FALSE, + uniqueIdentifier [12] UniqueIdentifier OPTIONAL, + authenticationLevel [13] AuthenticationLevel OPTIONAL, + exclusions [14] Exclusions OPTIONAL, + excludeShadows [15] BOOLEAN DEFAULT FALSE, + nameResolveOnMaster [16] BOOLEAN DEFAULT FALSE, + operationIdentifier [17] INTEGER OPTIONAL, + searchRuleId [18] SearchRuleId OPTIONAL, + chainedRelaxation [19] MRMapping OPTIONAL, + relatedEntry [20] INTEGER OPTIONAL +} + +Time ::= CHOICE {utcTime UTCTime, + generalizedTime GeneralizedTime +} + +DomainInfo ::= --ABSTRACT-SYNTAX.&Type-- OBJECT IDENTIFIER + +ChainingResults ::= SET { + info [0] DomainInfo OPTIONAL, + crossReferences [1] SEQUENCE --SIZE (1..MAX)-- OF CrossReference OPTIONAL, + securityParameters [2] SecurityParameters DEFAULT {}, + alreadySearched [3] Exclusions OPTIONAL +} + +CrossReference ::= SET { + contextPrefix [0] DistinguishedName, + accessPoint [1] AccessPointInformation +} + +OperationProgress ::= SET { + nameResolutionPhase + [0] ENUMERATED {notStarted(1), proceeding(2), completed(3)}, + nextRDNToBeResolved [1] INTEGER OPTIONAL +} + +TraceInformation ::= SEQUENCE OF TraceItem + +TraceItem ::= SET { + dsa [0] Name, + targetObject [1] Name OPTIONAL, + operationProgress [2] OperationProgress +} + +ReferenceType ::= ENUMERATED { + superior(1), subordinate(2), cross(3), nonSpecificSubordinate(4), + supplier(5), master(6), immediateSuperior(7), self(8)} + +AccessPoint ::= SET { + ae-title [0] Name, + address [1] PresentationAddress, + protocolInformation [2] SET --SIZE (1..MAX)-- OF ProtocolInformation OPTIONAL +} + +MasterOrShadowAccessPoint ::= SET { +-- COMPONENTS OF AccessPoint, + ae-title [0] Name, + address [1] PresentationAddress, + protocolInformation [2] SET --SIZE (1..MAX)-- OF ProtocolInformation OPTIONAL, + category [3] ENUMERATED {master(0), shadow(1)} DEFAULT master, + chainingRequired [5] BOOLEAN DEFAULT FALSE +} + +MasterAndShadowAccessPoints ::= SET --SIZE (1..MAX)-- OF MasterOrShadowAccessPoint + +AccessPointInformation ::= SET { +-- COMPONENTS OF MasterOrShadowAccessPoint, + ae-title [0] Name, + address [1] PresentationAddress, + protocolInformation [2] SET --SIZE (1..MAX)-- OF ProtocolInformation OPTIONAL, + category [3] ENUMERATED {master(0), shadow(1)} DEFAULT master, + chainingRequired [5] BOOLEAN DEFAULT FALSE, + additionalPoints [4] MasterAndShadowAccessPoints OPTIONAL +} + +Exclusions ::= SET --SIZE (1..MAX)-- OF RDNSequence + +ContinuationReference ::= SET { + targetObject [0] Name, + aliasedRDNs [1] INTEGER OPTIONAL, -- only present in 1988 systems + operationProgress [2] OperationProgress, + rdnsResolved [3] INTEGER OPTIONAL, + referenceType [4] ReferenceType, + accessPoints [5] SET OF AccessPointInformation, + entryOnly [6] BOOLEAN DEFAULT FALSE, + exclusions [7] Exclusions OPTIONAL, + returnToDUA [8] BOOLEAN DEFAULT FALSE, + nameResolveOnMaster [9] BOOLEAN DEFAULT FALSE +} + +AuthenticationLevel ::= CHOICE { + basicLevels SEQUENCE { + level ENUMERATED { none(0), simple(1), strong (2) }, + localQualifier INTEGER OPTIONAL, + signed BOOLEAN DEFAULT FALSE + }, + other EXTERNAL +} + +END -- DistributedOperations + +-- Generated by Asnp, the ASN.1 pretty-printer of France Telecom R&D + diff --git a/asn1/dsp/dsp.cnf b/asn1/dsp/dsp.cnf new file mode 100755 index 0000000000..085b07ba59 --- /dev/null +++ b/asn1/dsp/dsp.cnf @@ -0,0 +1,40 @@ +#.MODULE_IMPORT +DirectoryAbstractService dap +DirectoryAccessProtocol dap +ACSE-1 acse +InformationFramework x509if +ServiceAdministration x509if +AuthenticationFramework x509af + +SelectedAttributeTypes x509sat + +#.INCLUDE ../dap/dap-exp.cnf +#.INCLUDE ../x509if/x509if-exp.cnf +#.INCLUDE ../x509af/x509af-exp.cnf +#.INCLUDE ../x509sat/x509sat-exp.cnf +#.INCLUDE ../acse/acse-exp.cnf + +#.EXPORTS +OperationProgress +ReferenceType +ContinuationReference +AccessPoint + +#.TYPE_RENAME + +MasterOrShadowAccessPoint/category APCategory + +#.FIELD_RENAME +MasterOrShadowAccessPoint/category access-point-category + +ChainingArguments/targetObject targetObjectDN + +#.PDU +AccessPoint +MasterAndShadowAccessPoints + +#.REGISTER +AccessPoint B "2.5.12.1" "id-doa-myAccessPoint" +AccessPoint B "2.5.12.2" "id-doa-superiorKnowledge" +MasterAndShadowAccessPoints B "2.5.12.3" "id-doa-specificKnowledge" +MasterAndShadowAccessPoints B "2.5.12.4" "id-doa-nonSpecificKnowledge" diff --git a/asn1/dsp/packet-dsp-template.c b/asn1/dsp/packet-dsp-template.c new file mode 100755 index 0000000000..de1d933140 --- /dev/null +++ b/asn1/dsp/packet-dsp-template.c @@ -0,0 +1,345 @@ +/* packet-dsp.c + * Routines for X.518 (X.500 Distributed Operations) packet dissection + * Graeme Lunt 2005 + * + * $Id: packet-dsp-template.c 14773 2005-06-26 10:59:15Z etxrab $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs + * 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 +#include +#include +#include + +#include +#include + +#include "packet-ber.h" +#include "packet-acse.h" +#include "packet-ros.h" + +#include "packet-x509if.h" +#include "packet-x509af.h" +#include "packet-x509sat.h" + +#include "packet-dap.h" +#include "packet-dsp.h" + + +#define PNAME "X.519 Directory System Protocol" +#define PSNAME "DSP" +#define PFNAME "dsp" + +static guint global_dsp_tcp_port = 102; +static guint tcp_port = 0; +static dissector_handle_t tpkt_handle = NULL; +void prefs_register_dsp(void); /* forwad declaration for use in preferences registration */ + + +/* Initialize the protocol and registered fields */ +int proto_dsp = -1; + +static struct SESSION_DATA_STRUCTURE* session = NULL; + +#include "packet-dsp-hf.c" + +/* Initialize the subtree pointers */ +static gint ett_dsp = -1; +#include "packet-dsp-ett.c" + +#include "packet-dsp-fn.c" + +/* +* Dissect X518 PDUs inside a ROS PDUs +*/ +static void +dissect_dsp(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 (*dsp_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) = NULL; + char *dsp_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_dsp, tvb, 0, -1, FALSE); + tree = proto_item_add_subtree(item, ett_dsp); + } + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "DAP"); + 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 */ + dsp_dissector = dissect_dsp_DSASystemBindArgument; + dsp_op_name = "System-Bind-Argument"; + break; + case (ROS_OP_BIND | ROS_OP_RESULT): /* BindResult */ + dsp_dissector = dissect_dsp_DSASystemBindResult; + dsp_op_name = "System-Bind-Result"; + break; + case (ROS_OP_BIND | ROS_OP_ERROR): /* BindError */ + dsp_dissector = dissect_dsp_DSASystemBindError; + dsp_op_name = "System-Bind-Error"; + break; + case (ROS_OP_INVOKE | ROS_OP_ARGUMENT): /* Invoke Argument */ + switch(session->ros_op & ROS_OP_OPCODE_MASK) { + case 1: /* read */ + dsp_dissector = dissect_dsp_ChainedReadArgument; + dsp_op_name = "Chained-Read-Argument"; + break; + case 2: /* compare */ + dsp_dissector = dissect_dsp_ChainedCompareArgument; + dsp_op_name = "Chained-Compare-Argument"; + break; + case 3: /* abandon */ + dsp_dissector = dissect_dsp_ChainedAbandonArgument; + dsp_op_name = "Chained-Abandon-Argument"; + break; + case 4: /* list */ + dsp_dissector = dissect_dsp_ChainedListArgument; + dsp_op_name = "Chained-List-Argument"; + break; + case 5: /* search */ + dsp_dissector = dissect_dsp_ChainedSearchArgument; + dsp_op_name = "Chained-Search-Argument"; + break; + case 6: /* addEntry */ + dsp_dissector = dissect_dsp_ChainedAddEntryArgument; + dsp_op_name = "Chained-Add-Entry-Argument"; + break; + case 7: /* removeEntry */ + dsp_dissector = dissect_dsp_ChainedRemoveEntryArgument; + dsp_op_name = "Chained-Remove-Entry-Argument"; + break; + case 8: /* modifyEntry */ + dsp_dissector = dissect_dsp_ChainedModifyEntryArgument; + dsp_op_name = "ChainedModify-Entry-Argument"; + break; + case 9: /* modifyDN */ + dsp_dissector = dissect_dsp_ChainedModifyDNArgument; + dsp_op_name = "ChainedModify-DN-Argument"; + break; + default: + proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DSP 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: /* read */ + dsp_dissector = dissect_dsp_ChainedReadResult; + dsp_op_name = "Chained-Read-Result"; + break; + case 2: /* compare */ + dsp_dissector = dissect_dsp_ChainedCompareResult; + dsp_op_name = "Chained-Compare-Result"; + break; + case 3: /* abandon */ + dsp_dissector = dissect_dsp_ChainedAbandonResult; + dsp_op_name = "Chained-Abandon-Result"; + break; + case 4: /* list */ + dsp_dissector = dissect_dsp_ChainedListResult; + dsp_op_name = "Chained-List-Result"; + break; + case 5: /* search */ + dsp_dissector = dissect_dsp_ChainedSearchResult; + dsp_op_name = "Chained-Search-Result"; + break; + case 6: /* addEntry */ + dsp_dissector = dissect_dsp_ChainedAddEntryResult; + dsp_op_name = "Chained-Add-Entry-Result"; + break; + case 7: /* removeEntry */ + dsp_dissector = dissect_dsp_ChainedRemoveEntryResult; + dsp_op_name = "Chained-Remove-Entry-Result"; + break; + case 8: /* modifyEntry */ + dsp_dissector = dissect_dsp_ChainedModifyEntryResult; + dsp_op_name = "Chained-Modify-Entry-Result"; + break; + case 9: /* modifyDN */ + dsp_dissector = dissect_dsp_ChainedModifyDNResult; + dsp_op_name = "ChainedModify-DN-Result"; + break; + default: + proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DSP opcode"); + break; + } + break; + case (ROS_OP_INVOKE | ROS_OP_ERROR): /* Return Error */ + switch(session->ros_op & ROS_OP_OPCODE_MASK) { + case 1: /* attributeError */ + dsp_dissector = dissect_dap_AttributeError; + dsp_op_name = "Attribute-Error"; + break; + case 2: /* nameError */ + dsp_dissector = dissect_dap_NameError; + dsp_op_name = "Name-Error"; + break; + case 3: /* serviceError */ + dsp_dissector = dissect_dap_ServiceError; + dsp_op_name = "Service-Error"; + break; + case 4: /* referral */ + dsp_dissector = dissect_dap_Referral; + dsp_op_name = "Referral"; + break; + case 5: /* abandoned */ + dsp_dissector = dissect_dap_Abandoned; + dsp_op_name = "Abandoned"; + break; + case 6: /* securityError */ + dsp_dissector = dissect_dap_SecurityError; + dsp_op_name = "Security-Error"; + break; + case 7: /* abandonFailed */ + dsp_dissector = dissect_dap_AbandonFailedError; + dsp_op_name = "Abandon-Failed-Error"; + break; + case 8: /* updateError */ + dsp_dissector = dissect_dap_UpdateError; + dsp_op_name = "Update-Error"; + break; + case 9: /* DSAReferral */ + dsp_dissector = dissect_dsp_DSAReferral; + dsp_op_name = "DSA-Referral"; + break; + default: + proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DSP errcode"); + break; + } + break; + default: + proto_tree_add_text(tree, tvb, offset, -1,"Unsupported DSP PDU"); + return; + } + + if(dsp_dissector) { + if (check_col(pinfo->cinfo, COL_INFO)) + col_add_str(pinfo->cinfo, COL_INFO, dsp_op_name); + + while (tvb_reported_length_remaining(tvb, offset) > 0){ + old_offset=offset; + offset=(*dsp_dissector)(FALSE, tvb, offset, pinfo , tree, -1); + if(offset == old_offset){ + proto_tree_add_text(tree, tvb, offset, -1,"Internal error, zero-byte DSP PDU"); + offset = tvb_length(tvb); + break; + } + } + } +} + + +/*--- proto_register_dsp -------------------------------------------*/ +void proto_register_dsp(void) { + + /* List of fields */ + static hf_register_info hf[] = + { +#include "packet-dsp-hfarr.c" + }; + + /* List of subtrees */ + static gint *ett[] = { + &ett_dsp, +#include "packet-dsp-ettarr.c" + }; + module_t *dsp_module; + + /* Register protocol */ + proto_dsp = proto_register_protocol(PNAME, PSNAME, PFNAME); + + /* initially disable the protocol */ + proto_set_decoding(proto_dsp, FALSE); + + register_dissector("dsp", dissect_dsp, proto_dsp); + + /* Register fields and subtrees */ + proto_register_field_array(proto_dsp, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + + /* Register our configuration options for DSP, particularly our port */ + + dsp_module = prefs_register_protocol(proto_dsp, prefs_register_dsp); + + prefs_register_uint_preference(dsp_module, "tcp.port", "DSP TCP Port", + "Set the port for DSP operations (if other" + " than the default of 102)", + 10, &global_dsp_tcp_port); + + +} + + +/*--- proto_reg_handoff_dsp --- */ +void proto_reg_handoff_dsp(void) { + dissector_handle_t handle = NULL; + +#include "packet-dsp-dis-tab.c" + + /* APPLICATION CONTEXT */ + + register_ber_oid_name("2.5.3.2", "id-ac-directory-system"); + + /* ABSTRACT SYNTAXES */ + + /* Register DSP with ROS (with no use of RTSE) */ + if((handle = find_dissector("dsp"))) { + register_ros_oid_dissector_handle("2.5.9.2", handle, 0, "id-as-directory-system", FALSE); + } + + +} + +void prefs_register_dsp(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_dsp_tcp_port; + + if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle) + dissector_add("tcp.port", global_dsp_tcp_port, tpkt_handle); + +} diff --git a/asn1/dsp/packet-dsp-template.h b/asn1/dsp/packet-dsp-template.h new file mode 100755 index 0000000000..5cd42558fb --- /dev/null +++ b/asn1/dsp/packet-dsp-template.h @@ -0,0 +1,31 @@ +/* packet-dsp.h + * Routines for X.511 (X.500 Directory Access Protocol) packet dissection + * Graeme Lunt 2005 + * + * $Id: packet-dsp-template.h 14773 2005-06-26 10:59:15Z etxrab $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs + * 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_DSP_H +#define PACKET_DSP_H + +#include "packet-dsp-exp.h" + +#endif /* PACKET_DSP_H */ -- cgit v1.2.1