diff options
author | Graeme Lunt <graeme.lunt@smhs.co.uk> | 2007-12-03 19:32:28 +0000 |
---|---|---|
committer | Graeme Lunt <graeme.lunt@smhs.co.uk> | 2007-12-03 19:32:28 +0000 |
commit | a58643173d6406fe05e39f370c7ca6232027996f (patch) | |
tree | 1617fc538a7e9b84740bb3f83a91a2f33ed0f6d0 /asn1 | |
parent | 5d8693069d80e1c3d45c2b9484b39878d3df2d61 (diff) |
Revised P7 dissector to use #.TABLE directive to generate tables for the ROS dissector from
the [ABSTRACT] OPERATIONS definitions in the ASN.1 file.
svn path=/trunk/; revision=23707
Diffstat (limited to 'asn1')
-rw-r--r-- | asn1/p7/MSAbstractService.asn | 113 | ||||
-rw-r--r-- | asn1/p7/Makefile.common | 2 | ||||
-rw-r--r-- | asn1/p7/p7.cnf | 197 | ||||
-rw-r--r-- | asn1/p7/packet-p7-template.c | 280 |
4 files changed, 155 insertions, 437 deletions
diff --git a/asn1/p7/MSAbstractService.asn b/asn1/p7/MSAbstractService.asn index 3f7d6e1586..7a78d1ee3e 100644 --- a/asn1/p7/MSAbstractService.asn +++ b/asn1/p7/MSAbstractService.asn @@ -33,6 +33,8 @@ IMPORTS FROM MTSAbstractService {joint-iso-itu-t mhs(6) mts(3) modules(0) mts-abstract-service(1) version-1999(1)} -- MTS abstract-service 1988 ports + OPERATION, ERROR +FROM Remote-Operations-Information-Objects administration-88 --== FROM MTSAbstractService88 {joint-iso-itu-t mhs(6) mts(3) modules(0) @@ -255,11 +257,12 @@ MessageGroupName ::= SEQUENCE SIZE (1..ub-group-depth) OF GroupNamePart GroupNamePart ::= GeneralString(SIZE (1..ub-group-part-length)) -- MS-bind abstract-operation ---ms-bind ABSTRACT-OPERATION ::= { --- ARGUMENT MSBindArgument --- RESULT MSBindResult --- ERRORS {ms-bind-error} ---} +ms-bind -- ABSTRACT- -- OPERATION ::= { + ARGUMENT MSBindArgument + RESULT MSBindResult + ERRORS {ms-bind-error} + CODE op-ros-bind -- WS: internal operation code +} MSBindArgument ::= SET { initiator-name ORAddressAndOrDirectoryName, @@ -334,9 +337,8 @@ AutoActionErrorIndication ::= CHOICE { auto-action-log-entry [1] SequenceNumber } ---ms-bind-error ABSTRACT-ERROR ::= { --- PARAMETER -MSBindError ::= +ms-bind-error -- ABSTRACT- -- ERROR ::= { + PARAMETER CHOICE {unqualified-error BindProblem, -- 1994 extension qualified-error @@ -347,7 +349,8 @@ MSBindError ::= bind-extension-errors [2] SET SIZE (1..ub-extensions) OF OBJECT IDENTIFIER OPTIONAL}} ---} + CODE err-ros-bind -- WS: internal error code +} BindProblem ::= ENUMERATED { authentication-error(0), unacceptable-security-context(1), @@ -495,7 +498,7 @@ CommonSubmissionResults ::= SET { } -- Retrieval Port abstract-operations -summarize ABSTRACT-OPERATION ::= { +summarize -- ABSTRACT- -- OPERATION ::= { ARGUMENT SummarizeArgument RESULT SummarizeResult ERRORS @@ -544,7 +547,7 @@ Summary ::= SET { } -- -list ABSTRACT-OPERATION ::= { +list -- ABSTRACT- -- OPERATION ::= { ARGUMENT ListArgument RESULT ListResult ERRORS @@ -572,7 +575,7 @@ ListResult ::= SET { } -- -fetch ABSTRACT-OPERATION ::= { +fetch -- ABSTRACT- -- OPERATION ::= { ARGUMENT FetchArgument RESULT FetchResult ERRORS @@ -605,7 +608,7 @@ FetchResult ::= SET { } -- -delete ABSTRACT-OPERATION ::= { +delete -- ABSTRACT- -- OPERATION ::= { ARGUMENT DeleteArgument RESULT DeleteResult ERRORS @@ -637,7 +640,7 @@ DeleteResult ::= CHOICE { } -- -register-MS ABSTRACT-OPERATION ::= { +register-MS -- ABSTRACT- -- OPERATION ::= { ARGUMENT Register-MSArgument RESULT Register-MSResult ERRORS @@ -763,7 +766,7 @@ Register-MSResult ::= CHOICE { } -- -alert ABSTRACT-OPERATION ::= { +alert -- ABSTRACT- -- OPERATION ::= { ARGUMENT AlertArgument RESULT AlertResult ERRORS {security-error} @@ -779,7 +782,7 @@ AlertArgument ::= SET { AlertResult ::= NULL -- -modify ABSTRACT-OPERATION ::= { +modify -- ABSTRACT- -- OPERATION ::= { ARGUMENT ModifyArgument RESULT ModifyResult ERRORS @@ -830,7 +833,7 @@ ModifyResult ::= SET { } -- MS-submission Port abstract-operations -ms-message-submission ABSTRACT-OPERATION ::= { +ms-message-submission -- ABSTRACT- -- OPERATION ::= { ARGUMENT MSMessageSubmissionArgument RESULT MSMessageSubmissionResult ERRORS @@ -877,7 +880,7 @@ MSMessageSubmissionResult ::= CHOICE { } -- -ms-probe-submission ABSTRACT-OPERATION ::= { +ms-probe-submission -- ABSTRACT- -- OPERATION ::= { ARGUMENT MSProbeSubmissionArgument RESULT MSProbeSubmissionResult ERRORS @@ -928,9 +931,8 @@ ms-cancel-deferred-delivery ABSTRACT-OPERATION ::= cancel-deferred-delivery ms-submission-control ABSTRACT-OPERATION ::= submission-control -- Abstract-errors ---attribute-error ABSTRACT-ERROR ::= { --- PARAMETER -AttributeErrorParameter ::= +attribute-error -- ABSTRACT- -- ERROR ::= { + PARAMETER SET {problems [0] SET SIZE (1..ub-per-entry) OF SET {problem [0] AttributeProblem, @@ -938,8 +940,8 @@ AttributeErrorParameter ::= value [2] X413ATTRIBUTE.&Type({AttributeTable}{@.type}) OPTIONAL}} --- CODE err-attribute-error ---} + CODE err-attribute-error +} AttributeProblem ::= INTEGER { invalid-attribute-value(0), unavailable-attribute-type(1), @@ -950,16 +952,15 @@ AttributeProblem ::= INTEGER { }(0..ub-error-reasons) -- ---auto-action-request-error ABSTRACT-ERROR ::= { --- PARAMETER -AutoActionRequestErrorParameter ::= +auto-action-request-error -- ABSTRACT- -- ERROR ::= { + PARAMETER SET {problems [0] SET SIZE (1..ub-auto-registrations) OF SET {problem [0] AutoActionRequestProblem, type [1] AUTO-ACTION.&id({AutoActionTable}) }} --- CODE err-auto-action-request-error ---} + CODE err-auto-action-request-error +} AutoActionRequestProblem ::= INTEGER { unavailable-auto-action-type(0), @@ -968,9 +969,8 @@ AutoActionRequestProblem ::= INTEGER { not-willing-to-perform(2)}(0..ub-error-reasons) -- ---delete-error ABSTRACT-ERROR ::= { --- PARAMETER -DeleteErrorParameter ::= +delete-error -- ABSTRACT- -- ERROR ::= { + PARAMETER SET {problems [0] SET SIZE (1..ub-messages) OF SET {problem [0] DeleteProblem, @@ -978,8 +978,8 @@ DeleteErrorParameter ::= -- 1994 extension entries-deleted [1] SET SIZE (1..ub-messages) OF SequenceNumber OPTIONAL} --- CODE err-delete-error ---} + CODE err-delete-error +} DeleteProblem ::= INTEGER { child-entry-specified(0), @@ -989,9 +989,8 @@ DeleteProblem ::= INTEGER { }(0..ub-error-reasons) -- ---fetch-restriction-error ABSTRACT-ERROR ::= { --- PARAMETER -FetchRestrictionErrorParameter ::= +fetch-restriction-error -- ABSTRACT- -- ERROR ::= { + PARAMETER SET {problems [0] SET SIZE (1..ub-default-registrations) OF SET {problem [3] FetchRestrictionProblem, @@ -999,42 +998,41 @@ FetchRestrictionErrorParameter ::= CHOICE {content-type [0] OBJECT IDENTIFIER, eit [1] MS-EITs, attribute-length [2] INTEGER}}} --- CODE err-fetch-restriction-error ---} + CODE err-fetch-restriction-error +} FetchRestrictionProblem ::= INTEGER { content-type-problem(1), eit-problem(2), maximum-length-problem(3) }(0..ub-error-reasons) -- -invalid-parameters-error ABSTRACT-ERROR ::= { +invalid-parameters-error -- ABSTRACT- -- ERROR ::= { PARAMETER NULL CODE err-invalid-parameters-error } -- ---range-error ABSTRACT-ERROR ::= { --- PARAMETER -- RangeErrorParameter ::= SET {problem [0] RangeProblem} --- CODE err-range-error ---} +range-error -- ABSTRACT- -- ERROR ::= { + PARAMETER SET {problem [0] RangeProblem} + CODE err-range-error +} RangeProblem ::= INTEGER {reversed(0)}(0..ub-error-reasons) -- ---sequence-number-error ABSTRACT-ERROR ::= { --- PARAMETER -SequenceNumberErrorParameter ::= +sequence-number-error -- ABSTRACT- -- ERROR ::= { + PARAMETER SET {problems [1] SET SIZE (1..ub-messages) OF SET {problem [0] SequenceNumberProblem, sequence-number [1] SequenceNumber}} --- CODE err-sequence-number-error ---} + CODE err-sequence-number-error +} SequenceNumberProblem ::= INTEGER {no-such-entry(0)}(0..ub-error-reasons) -- -service-error ABSTRACT-ERROR ::= { +service-error -- ABSTRACT- -- ERROR ::= { PARAMETER ServiceErrorParameter CODE err-service-error } @@ -1050,7 +1048,7 @@ ServiceProblem ::= INTEGER {busy(0), unavailable(1), unwilling-to-perform(2) }(0..ub-error-reasons) -- -message-group-error ABSTRACT-ERROR ::= { +message-group-error -- ABSTRACT- -- ERROR ::= { PARAMETER MessageGroupErrorParameter CODE err-message-group-error } @@ -1066,7 +1064,7 @@ MessageGroupProblem ::= INTEGER { group-depth-exceeded(6)}(0..ub-error-reasons) -- -ms-extension-error ABSTRACT-ERROR ::= { +ms-extension-error -- ABSTRACT- -- ERROR ::= { PARAMETER MSExtensionErrorParameter CODE err-ms-extension-error } @@ -1077,13 +1075,12 @@ MSExtensionErrorParameter ::= CHOICE { } -- ---register-ms-error ABSTRACT-ERROR ::= { --- PARAMETER -RegisterMSErrorParameter ::= +register-ms-error -- ABSTRACT- -- ERROR ::= { + PARAMETER SET {problem [0] RegistrationProblem, registration-type [1] RegistrationTypes} --- CODE err-register-ms-error ---} + CODE err-register-ms-error +} RegistrationProblem ::= ENUMERATED { registration-not-supported(0), registration-improperly-specified(1), @@ -1091,7 +1088,7 @@ RegistrationProblem ::= ENUMERATED { } -- -modify-error ABSTRACT-ERROR ::= { +modify-error -- ABSTRACT- -- ERROR ::= { PARAMETER ModifyErrorParameter CODE err-modify-error } @@ -1110,7 +1107,7 @@ ModifyProblem ::= INTEGER { modify-restriction-problem(4)}(0..ub-error-reasons) -- -entry-class-error ABSTRACT-ERROR ::= { +entry-class-error -- ABSTRACT- -- ERROR ::= { PARAMETER EntryClassErrorParameter CODE err-entry-class-error } diff --git a/asn1/p7/Makefile.common b/asn1/p7/Makefile.common index 99668de5d0..79b2d4665a 100644 --- a/asn1/p7/Makefile.common +++ b/asn1/p7/Makefile.common @@ -49,7 +49,7 @@ SRC_FILES = \ $(EXTRA_DIST) \ $(EXT_ASN_FILE_LIST) -A2W_FLAGS= -b -e -X -T +A2W_FLAGS= -b -e -X -T -L EXTRA_CNF= \ ../x411/x411-exp.cnf \ diff --git a/asn1/p7/p7.cnf b/asn1/p7/p7.cnf index 713eee78d1..630cedbef0 100644 --- a/asn1/p7/p7.cnf +++ b/asn1/p7/p7.cnf @@ -76,28 +76,48 @@ MTSAbstractService x411 #.END #.TYPE_RENAME + +PAR-fetch-restriction-error/problems FetchRestrictionProblems +PAR-sequence-number-error/problems SequenceNumberProblems +PAR-attribute-error/problems AttributeProblems +PAR-auto-action-request-error/problems AutoActionRequestProblems +PAR-delete-error/problems DeleteProblems + +PAR-fetch-restriction-error/problems/_item FetchRestrictionProblemItem +PAR-sequence-number-error/problems/_item SequenceNumberProblemItem +PAR-attribute-error/problems/_item AttributeProblemItem +PAR-auto-action-request-error/problems/_item AutoActionRequestProblemItem +PAR-delete-error/problems/_item DeleteProblemItem + Attribute/attribute-values AttributeValues OrderedAttribute/attribute-values OrderedAttributeValues Attribute/attribute-values/_item AttributeItem OrderedAttribute/attribute-values/_item OrderedAttributeItem -AttributeErrorParameter/problems AttributeErrorProblems -DeleteErrorParameter/problems DeleteErrorProblems -FetchRestrictionErrorParameter/problems FetchRestrictionErrorProblems -SequenceNumberErrorParameter/problems SequenceNumberErrorProblems - -AttributeErrorParameter/problems/_item AttributeErrorProblem -DeleteErrorParameter/problems/_item DeleteErrorProblem -FetchRestrictionErrorParameter/problems/_item FetchRestrictionErrorProblem -SequenceNumberErrorParameter/problems/_item SequenceNumberErrorProblem - Summary/present/_item/value SummaryPresentItemValue OrderedAttribute/attribute-values/_item/value OrderedAttributeValue -AttributeErrorParameter/problems/_item/value AttributeErrorProblemValue - #.FIELD_RENAME + +PAR-sequence-number-error/problems/_item/problem sequence-number-problem +PAR-register-ms-error/problem register-ms-problem +PAR-delete-error/problems/_item/problem delete-problem +PAR-auto-action-request-error/problems/_item/problem auto-action-request-problem +PAR-attribute-error/problems/_item/problem attribute-problem + +PAR-sequence-number-error/problems sequence-number-problems +PAR-fetch-restriction-error/problems fetch-restriction-problems +PAR-attribute-error/problems attribute-problems +PAR-auto-action-request-error/problems auto-action-request-problems +PAR-delete-error/problems delete-problems + +PAR-fetch-restriction-error/problems/_item fetch-restriction-problem-item +PAR-sequence-number-error/problems/_item sequence-number-problem-item +PAR-attribute-error/problems/_item attribute-problem-item +PAR-auto-action-request-error/problems/_item auto-action-request-problem-item +PAR-delete-error/problems/_item delete-problem-item + OrderedAttribute/attribute-values ordered-attribute-values OrderedAttribute/attribute-values/_item ordered-attribute-values-item OrderedAttribute/attribute-values/_item/position ordered-position @@ -123,123 +143,68 @@ Filter/item filter-item Summary/present summary-present -AttributeErrorParameter/problems attribute-error-problems -AutoActionRequestErrorParameter/problems auto-action-request-error-problems -DeleteErrorParameter/problems delete-error-problems -SequenceNumberErrorParameter/problems sequence-number-error-problems -FetchRestrictionErrorParameter/problems fetch-restriction-error-problems - -DeleteErrorParameter/problems/_item delete-error-problem-item -AttributeErrorParameter/problems/_item attribute-error-problem-item -AutoActionRequestErrorParameter/problems/_item auto-action-request-error-problem-item -SequenceNumberErrorParameter/problems/_item sequence-number-error-problem-item -FetchRestrictionErrorParameter/problems/_item fetch-restriction-error-problem-item - +PAR-fetch-restriction-error/problems/_item/problem fetch-restriction-problem +PAR-range-error/problem range-problem EntryClassErrorParameter/problem entry-class-problem -FetchRestrictionErrorParameter/problems/_item/problem fetch-restriction-problem -RegisterMSErrorParameter/problem registration-problem -AttributeErrorParameter/problems/_item/problem attribute-problem -SequenceNumberErrorParameter/problems/_item/problem sequence-number-problem -RangeErrorParameter/problem range-problem -DeleteErrorParameter/problems/_item/problem delete-problem MessageGroupErrorParameter/problem message-group-problem ServiceErrorParameter/problem service-problem ModifyErrorParameter/problem modify-problem -AutoActionRequestErrorParameter/problems/_item/problem auto-action-request-problem - -AutoActionRequestErrorParameter/problems/_item/type auto-action-type - -AttributeErrorParameter/problems/_item/value problem-value OrderedAttribute/attribute-values/_item/value ordered-attribute-value -FetchRestrictionErrorParameter/problems/_item/restriction/content-type extended-content-type - -#.PDU -MSBindArgument -MSBindResult -MSBindError -MSMessageSubmissionArgument -MSMessageSubmissionResult -MSProbeSubmissionArgument -MSProbeSubmissionResult -SummarizeArgument -SummarizeResult -ListArgument -ListResult -FetchArgument -FetchResult -DeleteArgument -DeleteResult -Register-MSArgument -Register-MSResult -ModifyArgument -ModifyResult -AlertArgument -AlertResult -AttributeErrorParameter -AutoActionRequestErrorParameter -DeleteErrorParameter -EntryClassErrorParameter -FetchRestrictionErrorParameter -MessageGroupErrorParameter -ModifyErrorParameter -MSExtensionErrorParameter -RangeErrorParameter -RegisterMSErrorParameter -SequenceNumberErrorParameter -ServiceErrorParameter +PAR-fetch-restriction-error/problems/_item/restriction/content-type extended-content-type +PAR-auto-action-request-error/problems/_item/type auto-action-type +PAR-attribute-error/problems/_item/value attr-value # This table creates the value_sting to name P7 operation codes and errors # in file packet-p7-table.c which is included in the template file # -#TABLE_HDR -#/* P7 ABSTRACT-OPERATIONS */ -#const value_string p7_opr_code_strings[] = { -#TABLE_BODY ABSTRACT-OPERATION -# { %(&operationCode)s, "%(_ident)s" }, -#TABLE_FTR -# { 0, NULL } -#; -#END - -#TABLE_HDR -#/* P7 ERRORS */ -#static const value_string p7_err_code_string_vals[] = { -#TABLE_BODY ABSTRACT-ERROR -# { %(&errorCode)s, "%(_ident)s" }, -#TABLE_FTR -# { 0, NULL } -#}; -#END +#.TABLE_HDR +/* P7 ABSTRACT-OPERATIONS */ +const value_string p7_opr_code_string_vals[] = { +#.TABLE_BODY OPERATION + { %(&operationCode)s, "%(_ident)s" }, +#.TABLE_FTR + { 0, NULL } +}; +#.END + +#.TABLE_HDR +/* P7 ERRORS */ +static const value_string p7_err_code_string_vals[] = { +#.TABLE_BODY ERROR + { %(&errorCode)s, "%(_ident)s" }, +#.TABLE_FTR + { 0, NULL } +}; +#.END # Create a table of opcode and corresponding args and res -#TABLE11_HDR -#typedef struct _ros_op_t { -# gint32 opcode; -# new_dissector_t arg_pdu; -# new_dissector_t res_pdu; -#} ros_op_t; - -#static const ros_op_t p7_op_tab[] = { -#TABLE11_BODY ABSTRACT-OPERATION -# /* %(_name)-31s */ { %(&operationCode)-40s, %(_argument_pdu)-45s, %(_result_pdu)s }, -#TABLE11_FTR -#}; -#END -#TABLE21_HDR -#typedef struct _ros_err_t { -# gint32 errcode; -# new_dissector_t err_pdu; -#} ros_err_t; - -#static const ros_err_t p7_err_tab[] = { -#TABLE21_BODY ABSTRACT-ERROR -# /* %(_name)-24s */ { %(&errorCode)4s, %(_parameter_pdu)s }, -#TABLE21_FTR -#}; -#END +#.TABLE11_HDR +static const ros_opr_t p7_opr_tab[] = { +#.TABLE11_BODY OPERATION + /* %(_name)s */ + { %(&operationCode)-25s, %(_argument_pdu)s, %(_result_pdu)s }, +#.TABLE11_FTR + { 0, (new_dissector_t)(-1), (new_dissector_t)(-1) }, +}; +#.END +#.TABLE21_HDR +static const ros_err_t p7_err_tab[] = { +#.TABLE21_BODY ERROR + /* %(_name)s*/ + { %(&errorCode)s, %(_parameter_pdu)s }, +#.TABLE21_FTR + { 0, (new_dissector_t)(-1) }, +}; +#.END + +#.PDU_NEW +ERROR.&ParameterType +OPERATION.&ArgumentType +OPERATION.&ResultType +#.END #.REGISTER # MSGeneralAttributeTypes @@ -384,7 +349,7 @@ StorageTime B "2.6.4.3.74" "id-att-storage-time" if(object_identifier_id) call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree); -#.FN_BODY AttributeErrorParameter/problems/_item/value +#.FN_BODY PAR-attribute-error/problems/_item/value if(object_identifier_id) call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree); diff --git a/asn1/p7/packet-p7-template.c b/asn1/p7/packet-p7-template.c index 2e565e255a..e68c0b6921 100644 --- a/asn1/p7/packet-p7-template.c +++ b/asn1/p7/packet-p7-template.c @@ -71,262 +71,22 @@ static gint ett_p7 = -1; #include "packet-p7-val.h" +#include "packet-p7-table.c" /* operation and error codes */ + #include "packet-p7-fn.c" -/* -* Dissect P7 PDUs inside a ROS PDUs -*/ -static void -dissect_p7(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 (*p7_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL; - char *p7_op_name; - int hf_p7_index = -1; - asn1_ctx_t asn1_ctx; - - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - - /* 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_p7, tvb, 0, -1, FALSE); - tree = proto_item_add_subtree(item, ett_p7); - } - if (check_col(pinfo->cinfo, COL_PROTOCOL)) - col_set_str(pinfo->cinfo, COL_PROTOCOL, "P7"); - 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 */ - p7_dissector = dissect_p7_MSBindArgument; - p7_op_name = "MS-Bind-Argument"; - hf_p7_index = hf_p7_MSBindArgument_PDU; - break; - case (ROS_OP_BIND | ROS_OP_RESULT): /* BindResult */ - p7_dissector = dissect_p7_MSBindResult; - p7_op_name = "MS-Bind-Result"; - hf_p7_index = hf_p7_MSBindResult_PDU; - break; - case (ROS_OP_BIND | ROS_OP_ERROR): /* BindError */ - p7_dissector = dissect_p7_MSBindError; - p7_op_name = "MS-Bind-Error"; - hf_p7_index = hf_p7_MSBindError_PDU; - break; - case (ROS_OP_INVOKE | ROS_OP_ARGUMENT): /* Invoke Argument */ - switch(session->ros_op & ROS_OP_OPCODE_MASK) { - case op_ms_message_submission: /* msMessageSubmission */ - p7_dissector = dissect_p7_MSMessageSubmissionArgument; - p7_op_name = "MS-Message-Submission-Argument"; - hf_p7_index = hf_p7_MSMessageSubmissionArgument_PDU; - break; - case op_ms_probe_submission: /* msProbeSubmission */ - p7_dissector = dissect_p7_MSProbeSubmissionArgument; - p7_op_name = "MS-Probe-Submission-Argument"; - hf_p7_index = hf_p7_MSProbeSubmissionArgument_PDU; - break; - case op_summarize: /* summarize */ - p7_dissector = dissect_p7_SummarizeArgument; - p7_op_name = "Summarize-Argument"; - hf_p7_index = hf_p7_SummarizeArgument_PDU; - break; - case op_list: /* list */ - p7_dissector = dissect_p7_ListArgument; - p7_op_name = "List-Argument"; - hf_p7_index = hf_p7_ListArgument_PDU; - break; - case op_fetch: /* fetch */ - p7_dissector = dissect_p7_FetchArgument; - p7_op_name = "Fetch-Argument"; - hf_p7_index = hf_p7_FetchArgument_PDU; - break; - case op_delete: /* delete */ - p7_dissector = dissect_p7_DeleteArgument; - p7_op_name = "Delete-Argument"; - hf_p7_index = hf_p7_DeleteArgument_PDU; - break; - case op_register_ms: /* register-ms */ - p7_dissector = dissect_p7_Register_MSArgument; - p7_op_name = "RegisterMS-Argument"; - hf_p7_index = hf_p7_Register_MSArgument_PDU; - break; - case op_alert: /* alert */ - p7_dissector = dissect_p7_AlertArgument; - p7_op_name = "Alert-Argument"; - hf_p7_index = hf_p7_AlertArgument_PDU; - break; - case op_modify: /* modify */ - p7_dissector = dissect_p7_ModifyArgument; - p7_op_name = "Modify-Argument"; - hf_p7_index = hf_p7_ModifyArgument_PDU; - break; - default: - proto_tree_add_text(tree, tvb, offset, -1,"Unsupported P7 argument 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 op_ms_message_submission: /* msMessageSubmission */ - p7_dissector = dissect_p7_MSMessageSubmissionResult; - p7_op_name = "MS-Message-Submission-Result"; - hf_p7_index = hf_p7_MSMessageSubmissionResult_PDU; - break; - case op_ms_probe_submission: /* msProbeSubmission */ - p7_dissector = dissect_p7_MSProbeSubmissionResult; - p7_op_name = "MS-Probe-Submission-Result"; - hf_p7_index = hf_p7_MSProbeSubmissionResult_PDU; - break; - case op_summarize: /* summarize */ - p7_dissector = dissect_p7_SummarizeResult; - p7_op_name = "Summarize-Result"; - hf_p7_index = hf_p7_SummarizeResult_PDU; - break; - case op_list: /* list */ - p7_dissector = dissect_p7_ListResult; - p7_op_name = "List-Result"; - hf_p7_index = hf_p7_ListResult_PDU; - break; - case op_fetch: /* fetch */ - p7_dissector = dissect_p7_FetchResult; - p7_op_name = "Fetch-Result"; - hf_p7_index = hf_p7_FetchResult_PDU; - break; - case op_delete: /* delete */ - p7_dissector = dissect_p7_DeleteResult; - p7_op_name = "Delete-Result"; - break; - case op_register_ms: /* register-ms */ - p7_dissector = dissect_p7_Register_MSResult; - p7_op_name = "RegisterMS-Result"; - hf_p7_index = hf_p7_Register_MSResult_PDU; - break; - case op_alert: /* alert */ - p7_dissector = dissect_p7_AlertResult; - p7_op_name = "Alert-Result"; - hf_p7_index = hf_p7_AlertResult_PDU; - break; - case op_modify: /* modify */ - p7_dissector = dissect_p7_ModifyResult; - p7_op_name = "Modify-Result"; - hf_p7_index = hf_p7_ModifyResult_PDU; - break; - default: - proto_tree_add_text(tree, tvb, offset, -1,"Unsupported P7 result opcode (%d)", - session->ros_op & ROS_OP_OPCODE_MASK); - break; - } - break; - case (ROS_OP_INVOKE | ROS_OP_ERROR): /* Return Error */ - switch(session->ros_op & ROS_OP_OPCODE_MASK) { - case err_attribute_error: /* attributeError */ - p7_dissector = dissect_p7_AttributeErrorParameter; - p7_op_name = "Attribute-Error"; - hf_p7_index = hf_p7_AttributeErrorParameter_PDU; - break; - case err_auto_action_request_error: /* autoActionRequestError */ - p7_dissector = dissect_p7_AutoActionRequestErrorParameter; - p7_op_name = "Auto-Action-Request-Error"; - hf_p7_index = hf_p7_AutoActionRequestErrorParameter_PDU; - break; - case err_delete_error: /* deleteError */ - p7_dissector = dissect_p7_DeleteErrorParameter; - p7_op_name = "Delete-Error"; - hf_p7_index = hf_p7_DeleteErrorParameter_PDU; - break; - case err_fetch_restriction_error: /* fetchRestrictionError */ - p7_dissector = dissect_p7_FetchRestrictionErrorParameter; - p7_op_name = "Fetch-Restriction-Error"; - hf_p7_index = hf_p7_FetchRestrictionErrorParameter_PDU; - break; - case err_range_error: /* rangeError */ - p7_dissector = dissect_p7_RangeErrorParameter; - p7_op_name = "Range-Error"; - hf_p7_index = hf_p7_RangeErrorParameter_PDU; - break; - case err_security_error: /* securityError */ - p7_dissector = dissect_x411_SecurityProblem; - p7_op_name = "Security-Error"; - break; - case err_service_error: /* serviceError*/ - p7_dissector = dissect_p7_ServiceErrorParameter; - p7_op_name = "Service-Error"; - hf_p7_index = hf_p7_ServiceErrorParameter_PDU; - break; - case err_sequence_number_error: /* sequenceNumberError */ - p7_dissector = dissect_p7_SequenceNumberErrorParameter; - p7_op_name = "Sequence-Number-Error"; - hf_p7_index = hf_p7_SequenceNumberErrorParameter_PDU; - break; - case err_invalid_parameters_error: /* invalidParametersError */ - p7_dissector = NULL; - p7_op_name = "Invalid-Parameters-Error"; - break; - case err_message_group_error: /* messageGroupError */ - p7_dissector = dissect_p7_MessageGroupErrorParameter; - p7_op_name = "Message-Group-Error"; - hf_p7_index = hf_p7_MessageGroupErrorParameter_PDU; - break; - case err_ms_extension_error: /* msExtensioError */ - p7_dissector = dissect_p7_MSExtensionErrorParameter; - p7_op_name = "MS-Extension-Error"; - hf_p7_index = hf_p7_MSExtensionErrorParameter_PDU; - break; - case err_register_ms_error: /* registerMSError */ - p7_dissector = dissect_p7_RegisterMSErrorParameter; - p7_op_name = "Register-MS-Error"; - hf_p7_index = hf_p7_RegisterMSErrorParameter_PDU; - break; - case err_modify_error: /* modifyError */ - p7_dissector = dissect_p7_ModifyErrorParameter; - p7_op_name = "Modify-Error"; - hf_p7_index = hf_p7_ModifyErrorParameter_PDU; - break; - case err_entry_class_error: /* entryClassError */ - p7_dissector = dissect_p7_EntryClassErrorParameter; - p7_op_name = "Entry-Class-Error"; - hf_p7_index = hf_p7_EntryClassErrorParameter_PDU; - break; - default: - proto_tree_add_text(tree, tvb, offset, -1,"Unsupported P7 error opcode (%d)", - session->ros_op & ROS_OP_OPCODE_MASK); - break; - } - break; - default: - proto_tree_add_text(tree, tvb, offset, -1,"Unsupported P7 PDU"); - return; - } - - if(p7_dissector) { - if (check_col(pinfo->cinfo, COL_INFO)) - col_set_str(pinfo->cinfo, COL_INFO, p7_op_name); - - while (tvb_reported_length_remaining(tvb, offset) > 0){ - old_offset=offset; - offset=(*p7_dissector)(FALSE, tvb, offset, &asn1_ctx, tree, hf_p7_index); - if(offset == old_offset){ - proto_tree_add_text(tree, tvb, offset, -1,"Internal error, zero-byte P7 PDU"); - offset = tvb_length(tvb); - break; - } - } - } -} +#include "packet-p7-table11.c" /* operation argument/result dissectors */ +#include "packet-p7-table21.c" /* error dissector */ + +static const ros_info_t p7_ros_info = { + "P7", + &proto_p7, + &ett_p7, + p7_opr_code_string_vals, + p7_opr_tab, + p7_err_code_string_vals, + p7_err_tab +}; /*--- proto_register_p7 -------------------------------------------*/ @@ -347,7 +107,6 @@ void proto_register_p7(void) { /* Register protocol */ proto_p7 = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("p7", dissect_p7, proto_p7); /* Register fields and subtrees */ proto_register_field_array(proto_p7, hf, array_length(hf)); @@ -367,7 +126,6 @@ void proto_register_p7(void) { /*--- proto_reg_handoff_p7 --- */ void proto_reg_handoff_p7(void) { - dissector_handle_t handle = NULL; /* #include "packet-p7-dis-tab.c" */ @@ -377,13 +135,11 @@ void proto_reg_handoff_p7(void) { oid_add_from_string("id-ac-ms-reliable-access","2.6.0.1.12"); /* ABSTRACT SYNTAXES */ - + /* Register P7 with ROS (with no use of RTSE) */ - if((handle = find_dissector("p7"))) { - register_ros_oid_dissector_handle("2.6.0.2.9", handle, 0, "id-as-ms", FALSE); - register_ros_oid_dissector_handle("2.6.0.2.5", handle, 0, "id-as-mrse", FALSE); - register_ros_oid_dissector_handle("2.6.0.2.1", handle, 0, "id-as-msse", FALSE); - } + register_ros_protocol_info("2.6.0.2.9", &p7_ros_info, 0, "id-as-ms", FALSE); + register_ros_protocol_info("2.6.0.2.5", &p7_ros_info, 0, "id-as-mrse", FALSE); + register_ros_protocol_info("2.6.0.2.1", &p7_ros_info, 0, "id-as-msse", FALSE); /* remember the tpkt handler for change in preferences */ tpkt_handle = find_dissector("tpkt"); |