diff options
Diffstat (limited to 'epan/dissectors/asn1/h450-ros')
-rw-r--r-- | epan/dissectors/asn1/h450-ros/CMakeLists.txt | 47 | ||||
-rw-r--r-- | epan/dissectors/asn1/h450-ros/Remote-Operations-Apdus.asn | 150 | ||||
-rw-r--r-- | epan/dissectors/asn1/h450-ros/h450-ros.cnf | 108 | ||||
-rw-r--r-- | epan/dissectors/asn1/h450-ros/packet-h450-ros-template.c | 103 | ||||
-rw-r--r-- | epan/dissectors/asn1/h450-ros/packet-h450-ros-template.h | 18 |
5 files changed, 426 insertions, 0 deletions
diff --git a/epan/dissectors/asn1/h450-ros/CMakeLists.txt b/epan/dissectors/asn1/h450-ros/CMakeLists.txt new file mode 100644 index 00000000..fe0c67df --- /dev/null +++ b/epan/dissectors/asn1/h450-ros/CMakeLists.txt @@ -0,0 +1,47 @@ +# CMakeLists.txt +# +# Wireshark - Network traffic analyzer +# By Gerald Combs <gerald@wireshark.org> +# Copyright 1998 Gerald Combs +# +# SPDX-License-Identifier: GPL-2.0-or-later +# + +set( PROTOCOL_NAME h450-ros ) + +set( PROTO_OPT -p h450.ros ) + +set( EXPORT_FILES + ${PROTOCOL_NAME}-exp.cnf +) + +set( EXT_ASN_FILE_LIST + ../ros/Remote-Operations-Information-Objects.asn +) + +set( ASN_FILE_LIST + Remote-Operations-Apdus.asn +) + +set( EXTRA_DIST + ${ASN_FILE_LIST} + packet-${PROTOCOL_NAME}-template.c + packet-${PROTOCOL_NAME}-template.h + ${PROTOCOL_NAME}.cnf +) + +set( SRC_FILES + ${EXTRA_DIST} + ${EXT_ASN_FILE_LIST} +) + +set( A2W_FLAGS ) + +set( EXTRA_CNF + ../ros/ros-inv.cnf + ../ros/ros-res.cnf + ../ros/ros-err.cnf + ../ros/ros-rej.cnf +) + +ASN2WRS() diff --git a/epan/dissectors/asn1/h450-ros/Remote-Operations-Apdus.asn b/epan/dissectors/asn1/h450-ros/Remote-Operations-Apdus.asn new file mode 100644 index 00000000..b69ff2b6 --- /dev/null +++ b/epan/dissectors/asn1/h450-ros/Remote-Operations-Apdus.asn @@ -0,0 +1,150 @@ +-- Remote-Operations-Apdus.asn +-- +-- Taken from ITU ASN.1 database +-- http://www.itu.int/ITU-T/asn1/database/itu-t/h/h450.1/1998/Remote-Operations-Apdus.asn +-- + +-- Module Remote-Operations-Apdus (H.450.1:02/1998) +Remote-Operations-Apdus {itu-t recommendation h 450 1 version1(0) + remote-operations-apdus(11)} DEFINITIONS AUTOMATIC TAGS ::= +BEGIN + +-- exports everything +IMPORTS + OPERATION, ERROR + FROM Remote-Operations-Information-Objects {joint-iso-itu-t + remote-operations(4) informationObjects(5) version1(0)}; + +ROS{InvokeId:InvokeIdSet, OPERATION:Invokable, OPERATION:Returnable} ::= + CHOICE { + invoke [1] Invoke{{InvokeIdSet}, {Invokable}}, + returnResult [2] ReturnResult{{Returnable}}, + returnError [3] ReturnError{{Errors {{Returnable}}}}, + reject [4] Reject +} +(CONSTRAINED BY { -- must conform to the above definition --} ! + RejectProblem:general-unrecognizedPDU) + +Invoke{InvokeId:InvokeIdSet, OPERATION:Operations} ::= SEQUENCE { + invokeId + InvokeId(InvokeIdSet) + (CONSTRAINED BY {-- must be unambiguous -- } ! + RejectProblem:invoke-duplicateInvocation), + linkedId + InvokeId + (CONSTRAINED BY {-- must identify an outstanding operation -- } ! + RejectProblem:invoke-unrecognizedLinkedId) + (CONSTRAINED BY {-- which has one or more linked operations-- } ! + RejectProblem:invoke-linkedResponseUnexpected) OPTIONAL, + opcode + OPERATION.&operationCode + ({Operations} !RejectProblem:invoke-unrecognizedOperation), + argument + OPERATION.&ArgumentType + ({Operations}{@opcode} !RejectProblem:invoke-mistypedArgument) OPTIONAL +} +(CONSTRAINED BY { -- must conform to the above definition --} ! + RejectProblem:general-mistypedPDU) + +--( +-- WITH COMPONENTS +-- { +-- ..., +-- linkedId ABSENT +-- } +-- WITH COMPONENTS { +-- ..., +-- linkedId PRESENT, +-- opcode (CONSTRAINED BY { +-- must be in the &Linked field of the associated operation +-- } ! RejectProblem : invoke-unexpectedLinkedOperation) +-- } +--) +ReturnResult{OPERATION:Operations} ::= SEQUENCE { + invokeId + InvokeId + (CONSTRAINED BY {-- must be that for an outstanding operation -- } ! + RejectProblem:returnResult-unrecognizedInvocation) + (CONSTRAINED BY {-- which returns a result -- } ! + RejectProblem:returnResult-resultResponseUnexpected), + result + SEQUENCE {opcode + OPERATION.&operationCode({Operations}) + (CONSTRAINED BY {-- identified by invokeId -- } ! + RejectProblem:returnResult-unrecognizedInvocation), + result + OPERATION.&ResultType + ({Operations}{@.opcode} ! + RejectProblem:returnResult-mistypedResult)} OPTIONAL +} +(CONSTRAINED BY { -- must conform to the above definition --} ! + RejectProblem:general-mistypedPDU) + +ReturnError{ERROR:Errors} ::= SEQUENCE { + invokeId + InvokeId + (CONSTRAINED BY {-- must be that for an outstanding operation -- } ! + RejectProblem:returnError-unrecognizedInvocation) + (CONSTRAINED BY {-- which returns an error -- } ! + RejectProblem:returnError-errorResponseUnexpected), + errcode + ERROR.&errorCode({Errors} !RejectProblem:returnError-unrecognizedError) + (CONSTRAINED BY {--must be in the &Errors field of the associated operation -- + } !RejectProblem:returnError-unexpectedError), + parameter + ERROR.&ParameterType + ({Errors}{@errcode} !RejectProblem:returnError-mistypedParameter) + OPTIONAL +} +(CONSTRAINED BY { -- must conform to the above definition --} ! + RejectProblem:general-mistypedPDU) + +Reject ::= SEQUENCE { + invokeId InvokeId, + problem + CHOICE {general GeneralProblem, + invoke InvokeProblem, + returnResult ReturnResultProblem, + returnError ReturnErrorProblem} +} +(CONSTRAINED BY { -- must conform to the above definition --} ! + RejectProblem:general-mistypedPDU) + +GeneralProblem ::= INTEGER { + unrecognizedComponent(0), mistypedComponent(1), badlyStructuredComponent(2) +} + +InvokeProblem ::= INTEGER { + duplicateInvocation(0), unrecognizedOperation(1), mistypedArgument(2), + resourceLimitation(3), releaseInProgress(4), unrecognizedLinkedId(5), + linkedResponseUnexpected(6), unexpectedLinkedOperation(7)} + +ReturnResultProblem ::= INTEGER { + unrecognizedInvocation(0), resultResponseUnexpected(1), mistypedResult(2) +} + +ReturnErrorProblem ::= INTEGER { + unrecognizedInvocation(0), errorResponseUnexpected(1), unrecognizedError(2), + unexpectedError(3), mistypedParameter(4)} + +RejectProblem ::= INTEGER { + general-unrecognizedPDU(0), general-mistypedPDU(1), + general-badlyStructuredPDU(2), invoke-duplicateInvocation(10), + invoke-unrecognizedOperation(11), invoke-mistypedArgument(12), + invoke-resourceLimitation(13), invoke-releaseInProgress(14), + invoke-unrecognizedLinkedId(15), invoke-linkedResponseUnexpected(16), + invoke-unexpectedLinkedOperation(17), + returnResult-unrecognizedInvocation(20), + returnResult-resultResponseUnexpected(21), returnResult-mistypedResult(22), + returnError-unrecognizedInvocation(30), + returnError-errorResponseUnexpected(31), returnError-unrecognizedError(32), + returnError-unexpectedError(33), returnError-mistypedParameter(34)} + +InvokeId ::= INTEGER + +Errors{OPERATION:Operations} ERROR ::= {Operations.&Errors} + +END -- end of Remote-Operations-Apdus definitions + +-- Generated by Asnp, the ASN.1 pretty-printer of France Telecom R&D + diff --git a/epan/dissectors/asn1/h450-ros/h450-ros.cnf b/epan/dissectors/asn1/h450-ros/h450-ros.cnf new file mode 100644 index 00000000..cbb65776 --- /dev/null +++ b/epan/dissectors/asn1/h450-ros/h450-ros.cnf @@ -0,0 +1,108 @@ +#.EXPORTS + +ROS + +#.OMIT_ASSIGNMENT + +Priority +RejectProblem + +#.TYPE_RENAME + +Invoke/argument InvokeArgument +ReturnResult/result/result ResultArgument + +#.FIELD_RENAME + +Invoke/invokeId invokeIdConstrained + +Reject/problem/invoke invokeProblem +Reject/problem/returnError returnErrorProblem +Reject/problem/returnResult returnResultProblem + +ReturnResult/result/result resultArgument + +#--- ROS --- + +#.FN_HDR ROS + DISSECTOR_ASSERT(actx->rose_ctx); + rose_ctx_clean_data(actx->rose_ctx); +#.END + +#--- Code --- + +#.FN_PARS +Code VAL_PTR = &%(ACTX)s->rose_ctx->d.code +Code/local VAL_PTR = &%(ACTX)s->rose_ctx->d.code_local +Code/global FN_VARIANT = _str VAL_PTR = &%(ACTX)s->rose_ctx->d.code_global +#.FN_FTR Code + actx->rose_ctx->d.code_item = actx->created_item; +#.END + +#--- Problem --- + +#.FN_PARS +GeneralProblem VAL_PTR = &problem_val +InvokeProblem VAL_PTR = &problem_val +ReturnResultProblem VAL_PTR = &problem_val +ReturnErrorProblem VAL_PTR = &problem_val +#.FN_FTR GeneralProblem + (void) g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(h450_ros_GeneralProblem_vals), ""), 64); + problem_str[64-1] = '\0'; +#.FN_FTR InvokeProblem + (void) g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(h450_ros_InvokeProblem_vals), ""), 64); + problem_str[64-1] = '\0'; +#.FN_FTR ReturnResultProblem + (void) g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(h450_ros_ReturnResultProblem_vals), ""), 64); + problem_str[64-1] = '\0'; +#.FN_FTR ReturnErrorProblem + (void) g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(h450_ros_ReturnErrorProblem_vals), ""), 64); + problem_str[64-1] = '\0'; +#.END + +#--- INVOKE --- + +# body is implemented manually as asn2wrs is not able to handle subtype constraint event passed through parameter +#.FN_BODY Invoke/invokeId + offset = dissect_per_constrained_integer(%(TVB)s, %(OFFSET)s, %(ACTX)s, %(TREE)s, %(HF_INDEX)s, + 0U, 65535U, %(VAL_PTR)s, TRUE); +#.END + +#.FIELD_ATTR +Invoke/argument TYPE = FT_BYTES DISPLAY = BASE_NONE + +#.FN_PARS Invoke/argument +FN_VARIANT = _pdu_new +TYPE_REF_FN = argument_cb +#.END + +#.INCLUDE ../ros/ros-inv.cnf + +#--- RETURN RESULT --- + +#.FIELD_ATTR +ReturnResult/result/result TYPE = FT_BYTES DISPLAY = BASE_NONE + +#.FN_PARS ReturnResult/result/result +FN_VARIANT = _pdu_new +TYPE_REF_FN = result_cb + +#.END + +#.INCLUDE ../ros/ros-res.cnf + +#--- RETURN ERROR --- + +#.FIELD_ATTR +ReturnError/parameter TYPE = FT_BYTES DISPLAY = BASE_NONE + +#.FN_PARS ReturnError/parameter +FN_VARIANT = _pdu_new +TYPE_REF_FN = error_cb +#.END + +#.INCLUDE ../ros/ros-err.cnf + +#--- REJECT --- + +#.INCLUDE ../ros/ros-rej.cnf diff --git a/epan/dissectors/asn1/h450-ros/packet-h450-ros-template.c b/epan/dissectors/asn1/h450-ros/packet-h450-ros-template.c new file mode 100644 index 00000000..df2a53db --- /dev/null +++ b/epan/dissectors/asn1/h450-ros/packet-h450-ros-template.c @@ -0,0 +1,103 @@ +/* packet-h450-ros.c + * Routines for H.450 packet dissection + * 2007 Tomas Kukosa + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "config.h" + +#include <epan/packet.h> +#include <epan/strutil.h> +#include <epan/asn1.h> +#include <epan/expert.h> + +#include "packet-per.h" +#include "packet-h450-ros.h" + +#define PNAME "H.450 Remote Operations Apdus" +#define PSNAME "H450.ROS" +#define PFNAME "h450.ros" + +void proto_register_h450_ros(void); +void proto_reg_handoff_h450_ros(void); + +/* Initialize the protocol and registered fields */ +static int proto_h450_ros = -1; +#include "packet-h450-ros-hf.c" + +/* Initialize the subtree pointers */ +#include "packet-h450-ros-ett.c" + +static expert_field ei_ros_undecoded = EI_INIT; + +/* Preferences */ + +/* Subdissectors */ +static dissector_handle_t data_handle = NULL; + +/* Global variables */ +static gint32 problem_val; +static gchar problem_str[64]; +static tvbuff_t *arg_next_tvb, *res_next_tvb, *err_next_tvb; + +static int +argument_cb(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) { + arg_next_tvb = tvb; + return tvb_captured_length(tvb); +} + +static int +result_cb(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) { + res_next_tvb = tvb; + return tvb_captured_length(tvb); +} + +static int +error_cb(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) { + err_next_tvb = tvb; + return tvb_captured_length(tvb); +} + +#include "packet-h450-ros-fn.c" + +/*--- proto_register_h450_ros -----------------------------------------------*/ +void proto_register_h450_ros(void) { + + /* List of fields */ + static hf_register_info hf[] = { +#include "packet-h450-ros-hfarr.c" + }; + + /* List of subtrees */ + static gint *ett[] = { +#include "packet-h450-ros-ettarr.c" + }; + + static ei_register_info ei[] = { + { &ei_ros_undecoded, { "h450.ros.undecoded", PI_UNDECODED, PI_WARN, "Undecoded", EXPFILL }}, + }; + + expert_module_t* expert_h450_ros; + + /* Register protocol and dissector */ + proto_h450_ros = proto_register_protocol(PNAME, PSNAME, PFNAME); + proto_set_cant_toggle(proto_h450_ros); + + /* Register fields and subtrees */ + proto_register_field_array(proto_h450_ros, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + expert_h450_ros = expert_register_protocol(proto_h450_ros); + expert_register_field_array(expert_h450_ros, ei, array_length(ei)); +} + +/*--- proto_reg_handoff_h450_ros --------------------------------------------*/ +void proto_reg_handoff_h450_ros(void) { + data_handle = find_dissector("data"); +} + +/*---------------------------------------------------------------------------*/ diff --git a/epan/dissectors/asn1/h450-ros/packet-h450-ros-template.h b/epan/dissectors/asn1/h450-ros/packet-h450-ros-template.h new file mode 100644 index 00000000..4e7eada7 --- /dev/null +++ b/epan/dissectors/asn1/h450-ros/packet-h450-ros-template.h @@ -0,0 +1,18 @@ +/* packet-h450-ros.h + * Routines for H.450 packet dissection + * 2007 Tomas Kukosa + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef PACKET_H450_ROS_H +#define PACKET_H450_ROS_H + +#include "packet-h450-ros-exp.h" + +#endif /* PACKET_H450_ROS_H */ + |