diff options
Diffstat (limited to 'epan/dissectors/asn1/q932-ros')
-rw-r--r-- | epan/dissectors/asn1/q932-ros/CMakeLists.txt | 55 | ||||
-rw-r--r-- | epan/dissectors/asn1/q932-ros/Facility-Information-Element-Components.asn | 163 | ||||
-rw-r--r-- | epan/dissectors/asn1/q932-ros/Makefile.am | 23 | ||||
-rw-r--r-- | epan/dissectors/asn1/q932-ros/Makefile.common | 49 | ||||
-rw-r--r-- | epan/dissectors/asn1/q932-ros/Makefile.nmake | 26 | ||||
-rw-r--r-- | epan/dissectors/asn1/q932-ros/packet-q932-ros-template.c | 111 | ||||
-rw-r--r-- | epan/dissectors/asn1/q932-ros/q932-ros.cnf | 120 |
7 files changed, 547 insertions, 0 deletions
diff --git a/epan/dissectors/asn1/q932-ros/CMakeLists.txt b/epan/dissectors/asn1/q932-ros/CMakeLists.txt new file mode 100644 index 0000000000..e72611c588 --- /dev/null +++ b/epan/dissectors/asn1/q932-ros/CMakeLists.txt @@ -0,0 +1,55 @@ +# CMakeLists.txt +# +# Wireshark - Network traffic analyzer +# By Gerald Combs <gerald@wireshark.org> +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +set( PROTOCOL_NAME q932-ros ) + +set( PROTO_OPT -p q932.ros ) + +set( EXT_ASN_FILE_LIST + ../ros/Remote-Operations-Information-Objects.asn +) + +set( ASN_FILE_LIST + Facility-Information-Element-Components.asn +) + +set( EXTRA_DIST + ${ASN_FILE_LIST} + packet-${PROTOCOL_NAME}-template.c + ${PROTOCOL_NAME}.cnf +) + +set( SRC_FILES + ${EXTRA_DIST} + ${EXT_ASN_FILE_LIST} +) + +set( A2W_FLAGS -b ) + +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/q932-ros/Facility-Information-Element-Components.asn b/epan/dissectors/asn1/q932-ros/Facility-Information-Element-Components.asn new file mode 100644 index 0000000000..71c1adcda2 --- /dev/null +++ b/epan/dissectors/asn1/q932-ros/Facility-Information-Element-Components.asn @@ -0,0 +1,163 @@ +-- Facility-Information-Element-Components.asn +-- +-- Taken from ITU ASN.1 database +-- http://www.itu.int/ITU-T/asn1/database/itu-t/q/q932/1998-Amd1/Facility-Information-Element-Components.asn +-- + +-- Module Facility-Information-Element-Components (Q.932:05/1998) +Facility-Information-Element-Components {itu-t recommendation q 932 + facility-information-element-component(3)} DEFINITIONS IMPLICIT 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 + CHOICE {present [0] IMPLICIT present < InvokeId, + absent [1] IMPLICIT NULL + } + (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} ! + 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 [0] GeneralProblem, + invoke [1] InvokeProblem, + returnResult [2] ReturnResultProblem, + returnError [3] 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 ::= CHOICE {present INTEGER, + absent NULL +} + +noInvokeId InvokeId ::= absent:NULL + +NoInvokeId InvokeId ::= {noInvokeId} + +Errors{OPERATION:Operations} ERROR ::= {Operations.&Errors} + +-- the Range of the Invoke-Id's must be restricted to -32768..32767 +Components{OPERATION:Invokable, OPERATION:Returnable} ::= CHOICE { + gfpROS ROS{{GFPInvokeIDSet}, {Invokable}, {Returnable}} +} + +GFPInvokeIDSet ::= InvokeId(WITH COMPONENTS { + present (-32768..32767) + }) + +END -- end of generic ROS PDU definitions + +-- Generated by Asnp, the ASN.1 pretty-printer of France Telecom R&D + diff --git a/epan/dissectors/asn1/q932-ros/Makefile.am b/epan/dissectors/asn1/q932-ros/Makefile.am new file mode 100644 index 0000000000..72d28e600b --- /dev/null +++ b/epan/dissectors/asn1/q932-ros/Makefile.am @@ -0,0 +1,23 @@ +# Wireshark - Network traffic analyzer +# By Gerald Combs <gerald@wireshark.org> +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + +include ../Makefile.preinc +include Makefile.common +include ../Makefile.inc + diff --git a/epan/dissectors/asn1/q932-ros/Makefile.common b/epan/dissectors/asn1/q932-ros/Makefile.common new file mode 100644 index 0000000000..32dcd69451 --- /dev/null +++ b/epan/dissectors/asn1/q932-ros/Makefile.common @@ -0,0 +1,49 @@ +# Wireshark - Network traffic analyzer +# By Gerald Combs <gerald@wireshark.org> +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + +PROTOCOL_NAME=q932-ros + +PROTO_OPT = -p q932.ros + +EXT_ASN_FILE_LIST = \ + ../ros/Remote-Operations-Information-Objects.asn + +ASN_FILE_LIST = \ + Facility-Information-Element-Components.asn + +# The packet-$(PROTOCOL_NAME)-template.h and $(PROTOCOL_NAME).asn +# files do not exist for all protocols: Please add/remove as required. +EXTRA_DIST = \ + $(EXTRA_DIST_COMMON) \ + $(ASN_FILE_LIST) \ + packet-$(PROTOCOL_NAME)-template.c \ + $(PROTOCOL_NAME).cnf + +SRC_FILES = \ + $(EXTRA_DIST) \ + $(EXT_ASN_FILE_LIST) + +A2W_FLAGS= -b + +EXTRA_CNF = \ + $(builddir)/../ros/ros-inv.cnf \ + $(builddir)/../ros/ros-res.cnf \ + $(builddir)/../ros/ros-err.cnf \ + $(builddir)/../ros/ros-rej.cnf + diff --git a/epan/dissectors/asn1/q932-ros/Makefile.nmake b/epan/dissectors/asn1/q932-ros/Makefile.nmake new file mode 100644 index 0000000000..d296638ddd --- /dev/null +++ b/epan/dissectors/asn1/q932-ros/Makefile.nmake @@ -0,0 +1,26 @@ +## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake +# +# Wireshark - Network traffic analyzer +# By Gerald Combs <gerald@wireshark.org> +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + +include ../../../../config.nmake +include ../Makefile.preinc.nmake +include Makefile.common +include ../Makefile.inc.nmake + diff --git a/epan/dissectors/asn1/q932-ros/packet-q932-ros-template.c b/epan/dissectors/asn1/q932-ros/packet-q932-ros-template.c new file mode 100644 index 0000000000..e7b905edc9 --- /dev/null +++ b/epan/dissectors/asn1/q932-ros/packet-q932-ros-template.c @@ -0,0 +1,111 @@ +/* packet-q932-ros.c + * Routines for Q.932 packet dissection + * 2007 Tomas Kukosa + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "config.h" + +#include <epan/packet.h> +#include <epan/strutil.h> +#include <epan/asn1.h> +#include <epan/expert.h> + +#include "packet-ber.h" + +#define PNAME "Q.932 Operations Service Element" +#define PSNAME "Q932.ROS" +#define PFNAME "q932.ros" + +void proto_register_q932_ros(void); +void proto_reg_handoff_q932_ros(void); + +/* Initialize the protocol and registered fields */ +static int proto_q932_ros = -1; +#include "packet-q932-ros-hf.c" + +/* Initialize the subtree pointers */ +#include "packet-q932-ros-ett.c" + +static expert_field ei_ros_undecoded = EI_INIT; + +/* Preferences */ + +/* Subdissectors */ +static dissector_handle_t data_handle = NULL; + +/* Global variables */ +static rose_ctx_t *rose_ctx_tmp; + +static guint32 problem_val; +static gchar problem_str[64]; +static tvbuff_t *arg_next_tvb, *res_next_tvb, *err_next_tvb; + + +#include "packet-q932-ros-fn.c" + +/*--- dissect_q932_ros -----------------------------------------------------*/ +static int dissect_q932_ros(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { + /* Reject the packet if data is NULL */ + if (data == NULL) + return 0; + rose_ctx_tmp = get_rose_ctx(data); + DISSECTOR_ASSERT(rose_ctx_tmp); + return dissect_ROS_PDU(tvb, pinfo, tree, NULL); +} + +/*--- proto_register_q932_ros -----------------------------------------------*/ +void proto_register_q932_ros(void) { + + /* List of fields */ + static hf_register_info hf[] = { +#include "packet-q932-ros-hfarr.c" + }; + + /* List of subtrees */ + static gint *ett[] = { +#include "packet-q932-ros-ettarr.c" + }; + + static ei_register_info ei[] = { + { &ei_ros_undecoded, { "q932.ros.undecoded", PI_UNDECODED, PI_WARN, "Undecoded", EXPFILL }}, + }; + + expert_module_t* expert_q932_ros; + + /* Register protocol and dissector */ + proto_q932_ros = proto_register_protocol(PNAME, PSNAME, PFNAME); + proto_set_cant_toggle(proto_q932_ros); + + /* Register fields and subtrees */ + proto_register_field_array(proto_q932_ros, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + expert_q932_ros = expert_register_protocol(proto_q932_ros); + expert_register_field_array(expert_q932_ros, ei, array_length(ei)); + + register_dissector(PFNAME, dissect_q932_ros, proto_q932_ros); +} + +/*--- proto_reg_handoff_q932_ros --------------------------------------------*/ +void proto_reg_handoff_q932_ros(void) { + data_handle = find_dissector("data"); +} + +/*---------------------------------------------------------------------------*/ diff --git a/epan/dissectors/asn1/q932-ros/q932-ros.cnf b/epan/dissectors/asn1/q932-ros/q932-ros.cnf new file mode 100644 index 0000000000..bafcbe953e --- /dev/null +++ b/epan/dissectors/asn1/q932-ros/q932-ros.cnf @@ -0,0 +1,120 @@ +#.PDU + +ROS + +#.OMIT_ASSIGNMENT + +Priority +RejectProblem +Components +GFPInvokeIDSet + +#.TYPE_RENAME + +Invoke/argument InvokeArgument +ReturnResult/result/result ResultArgument + +#.FIELD_RENAME + +Invoke/linkedId/present linkedIdPresent + +Reject/problem/invoke invokeProblem +Reject/problem/returnError returnErrorProblem +Reject/problem/returnResult returnResultProblem + +ReturnResult/result/result resultArgument + +#--- ROS --- + +#.FN_HDR ROS + /* will be moved to ROS_PDU when PDU function can be alternated from conformance file */ + actx->rose_ctx = rose_ctx_tmp; + 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 + g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(q932_ros_GeneralProblem_vals), ""), 64); +#.FN_FTR InvokeProblem + g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(q932_ros_InvokeProblem_vals), ""), 64); +#.FN_FTR ReturnResultProblem + g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(q932_ros_ReturnResultProblem_vals), ""), 64); +#.FN_FTR ReturnErrorProblem + g_strlcpy(problem_str, val_to_str_const(problem_val, VALS(q932_ros_ReturnErrorProblem_vals), ""), 64); +#.END + +#--- INVOKE --- + +#.FIELD_ATTR +Invoke/argument TYPE = FT_BYTES DISPLAY = BASE_NONE + +#.FN_BODY Invoke/argument + gint len; + + len = tvb_reported_length_remaining(tvb, offset); + if (len) + proto_tree_add_item(tree, hf_index, tvb, offset, len, ENC_NA); + arg_next_tvb = tvb_new_subset_remaining(tvb, offset); + + offset += tvb_reported_length_remaining(tvb, offset); +#.END + +#.INCLUDE ../ros/ros-inv.cnf + +#--- RETURN RESULT --- + +#.FIELD_ATTR +ReturnResult/result/result TYPE = FT_BYTES DISPLAY = BASE_NONE + +#.FN_BODY ReturnResult/result/result + gint len; + + len = tvb_reported_length_remaining(tvb, offset); + if (len) + proto_tree_add_item(tree, hf_index, tvb, offset, len, ENC_NA); + res_next_tvb = tvb_new_subset_remaining(tvb, offset); + + offset += tvb_reported_length_remaining(tvb, offset); + +#.END + +#.INCLUDE ../ros/ros-res.cnf + +#--- RETURN ERROR --- + +#.FIELD_ATTR +ReturnError/parameter TYPE = FT_BYTES DISPLAY = BASE_NONE + +#.FN_BODY ReturnError/parameter + + gint len; + + len = tvb_reported_length_remaining(tvb, offset); + if (len) + proto_tree_add_item(tree, hf_index, tvb, offset, len, ENC_NA); + err_next_tvb = tvb_new_subset_remaining(tvb, offset); + + offset += tvb_reported_length_remaining(tvb, offset); +#.END + +#.INCLUDE ../ros/ros-err.cnf + +#--- REJECT --- + +#.INCLUDE ../ros/ros-rej.cnf |