Add the files for an initial ISDN Supplimentary Services(ETSI) dissector.

svn path=/trunk/; revision=47706
This commit is contained in:
Anders Broman 2013-02-17 18:27:04 +00:00
parent 823493b927
commit 7a60d0d9eb
9 changed files with 945 additions and 0 deletions

View File

@ -0,0 +1,142 @@
--
-- $Id:$
--
-- EN 300 196-1 Ver. 1.3.2
--
Addressing-Data-Elements {itu-t identified-organization etsi(0) 196 addressing-data-elements(6)}
DEFINITIONS EXPLICIT TAGS ::=
BEGIN
EXPORTS PresentedAddressScreened, PresentedAddressUnscreened,
PresentedNumberScreened, PresentedNumberUnscreened,
Address, PartyNumber, PartySubaddress,
ScreeningIndicator, PresentationAllowedIndicator;
PresentedAddressScreened ::= CHOICE {
presentationAllowedAddress [0] IMPLICIT AddressScreened,
presentationRestricted [1] IMPLICIT NULL,
numberNotAvailableDueToInterworking [2] IMPLICIT NULL,
presentationRestrictedAddress [3] IMPLICIT AddressScreened }
PresentedAddressUnscreened ::= CHOICE {
presentationAllowedAddress [0] IMPLICIT Address,
presentationRestricted [1] IMPLICIT NULL,
numberNotAvailableDueToInterworking [2] IMPLICIT NULL,
presentationRestrictedAddress [3] IMPLICIT Address}
PresentedNumberScreened ::= CHOICE {
presentationAllowedNumber [0] IMPLICIT NumberScreened,
presentationRestricted [1] IMPLICIT NULL,
numberNotAvailableDueToInterworking [2] IMPLICIT NULL,
presentationRestrictedNumber [3] IMPLICIT NumberScreened}
PresentedNumberUnscreened ::= CHOICE {
presentationAllowedNumber [0] PartyNumber,
presentationRestricted [1] IMPLICIT NULL,
numberNotAvailableDueToInterworking [2] IMPLICIT NULL,
presentationRestrictedNumber [3] PartyNumber}
AddressScreened ::= SEQUENCE {
partyNumber PartyNumber,
screeningIndicator ScreeningIndicator,
partySubaddress PartySubaddress OPTIONAL}
NumberScreened ::= SEQUENCE {
partyNumber PartyNumber,
screeningIndicator ScreeningIndicator}
Address ::= SEQUENCE {
partyNumber PartyNumber,
partySubaddress PartySubaddress OPTIONAL}
PartyNumber ::= CHOICE {
unknownPartyNumber [0] IMPLICIT NumberDigits,
-- the numbering plan is the default numbering plan of the
-- network. It is recommended that this value is used.
publicPartyNumber [1] IMPLICIT PublicPartyNumber,
-- the numbering plan is according to
-- ITU-T Recommendation E.164.
nsapEncodedNumber [2] IMPLICIT NsapEncodedNumber,
-- ATM endsystem address encoded as an NSAP address.
dataPartyNumber [3] IMPLICIT NumberDigits,
-- not used, value reserved.
telexPartyNumber [4] IMPLICIT NumberDigits,
-- not used, value reserved.
privatePartyNumber [5] IMPLICIT PrivatePartyNumber,
nationalStandardPartyNumber [8] IMPLICIT NumberDigits}
-- not used, value reserved.
PublicPartyNumber ::= SEQUENCE {
publicTypeOfNumber PublicTypeOfNumber,
publicNumberDigits NumberDigits}
NsapEncodedNumber ::= OCTET STRING (SIZE(20))
PrivatePartyNumber ::= SEQUENCE {
privateTypeOfNumber PrivateTypeOfNumber,
privateNumberDigits NumberDigits}
NumberDigits ::= NumericString (SIZE(1..20))
PublicTypeOfNumber ::= ENUMERATED {
unknown (0),
-- if used number digits carry prefix indicating type of
-- number according to national recommendations
internationalNumber (1),
nationalNumber (2),
networkSpecificNumber (3),
-- not used, value reserved
subscriberNumber (4),
abbreviatedNumber (6)}
-- valid only for called party number at the outgoing
-- access, network substitutes appropriate number.
PrivateTypeOfNumber ::= ENUMERATED {
unknown (0),
level2RegionalNumber (1),
level1RegionalNumber (2),
pTNSpecificNumber (3),
localNumber (4),
abbreviatedNumber (6)}
PartySubaddress ::= CHOICE {
userSpecifiedSubaddress UserSpecifiedSubaddress,
-- not recommended
nSAPSubaddress NSAPSubaddress}
-- according to ITU-T Recommendation X.213
UserSpecifiedSubaddress ::= SEQUENCE {
subaddressInformation SubaddressInformation,
oddCountIndicator BOOLEAN OPTIONAL}
-- used when the coding of subaddress is BCD
NSAPSubaddress ::= OCTET STRING (SIZE(1..20))
-- specified according to ITU-T Recommendation X.213. Some
-- networks may limit the subaddress value to some other
-- length, e.g. 4 octets
SubaddressInformation ::= OCTET STRING (SIZE(1..20))
-- coded according to user requirements. Some networks may
-- limit the subaddress value to some other length,
-- e.g. 4 octets
ScreeningIndicator ::= ENUMERATED {
userProvidedNotScreened (0),
-- number was provided by a remote user terminal equipment,
-- and has been screened by a network that is not the
-- local public or local private network.
userProvidedVerifiedAndPassed (1),
-- number was provided by a remote user terminal equipment
-- (or by a remote private network), and has been screened
-- by the local public or local private network.
userProvidedVerifiedAndFailed (2),
-- not used, value reserved
networkProvided (3)}
-- number was provided by local public or local
-- private network
PresentationAllowedIndicator ::= BOOLEAN
END -- of Addressing-Data-Elements

View File

@ -0,0 +1,34 @@
--
-- $Id:$
--
-- EN 300 196-1 Ver. 1.3.2
--
Basic-Service-Elements {itu-t identified-organization etsi(0) 196 basic-service-elements(8)}
DEFINITIONS EXPLICIT TAGS ::=
BEGIN
EXPORTS BasicService;
BasicService ::= ENUMERATED {
allServices (0),
speech (1),
unrestrictedDigitalInformation (2),
audio3k1Hz (3),
unrestrictedDigitalInformationWithTonesAndAnnouncements (4),
multirate(5),
telephony3k1Hz (32),
teletex (33),
telefaxGroup4Class1 (34),
videotexSyntaxBased (35),
videotelephony (36),
telefaxGroup2-3 (37),
telephony7kHz (38),
euroFileTransfer (39),
fileTransferAndAccessManagement (40),
videoconference (41),
audioGraphicConference (42)
}
END -- of Basic-Service-Elements

View File

@ -0,0 +1,351 @@
--
-- $Id:$
--
-- ETSI EN 300 207-1 V3.1.1 (2001-06)
--
Diversion-Operations {etsi(0) xx(207) operations-and-errors(1)}
DEFINITIONS EXPLICIT TAGS ::=
BEGIN
EXPORTS ActivationDiversion,
DeactivationDiversion,
ActivationStatusNotificationDiv,
DeactivationStatusNotificationDiv,
InterrogationDiversion,
InterrogateServedUserNumbers,
DiversionInformation,
CallDeflection,
CallRerouteing,
DivertingLegInformation1,
DivertingLegInformation2,
DivertingLegInformation3,
InvalidDivertedToNr,
SpecialServiceNr,
DiversionToServedUserNr,
IncomingCallAccepted,
NumberOfDiversionsExceeded,
NotActivated,
RequestAlreadyAccepted,
invalidDivertedToNr,
specialServiceNr,
diversionToServedUserNr,
incomingCallAccepted,
numberOfDiversionsExceeded,
notActivated,
requestAlreadyAccepted,
ServedUserNr;
IMPORTS OPERATION, ERROR FROM Remote-Operations-Information-Objects
{joint-iso-itu-t (2) remote-operations (4) informationObjects(5) version1(0)}
notSubscribed,
notAvailable,
invalidServedUserNr,
basicServiceNotProvided,
supplementaryServiceInteractionNotAllowed,
resourceUnavailable
FROM General-Errors
{itu-t(0) identified-organization(4) etsi(0) 196 general-errors(2)}
PresentedAddressScreened,
PresentedNumberUnscreened,
Address,
PartyNumber,
PartySubaddress,
PresentationAllowedIndicator
FROM Addressing-Data-Elements
{itu-t(0) identified-organization(4) etsi(0) 196 addressing-data-elements(6)}
BasicService
FROM Basic-Service-Elements
{itu-t(0) identified-organization(4) etsi(0) 196 basic-service-elements(8)}
Q931InformationElement
FROM Embedded-Q931-Types
{itu-t(0) identified-organization(4) etsi(0) 196 embedded-q931-types(7)};
activationDiversion OPERATION ::= {
ARGUMENT ActivationDiversionArg
RETURN RESULT FALSE
ALWAYS RESPONDS FALSE
CODE local: 7}
ActivationDiversionArg ::= SEQUENCE {
procedure Procedure,
basicService BasicService,
forwardedToAddress Address,
servedUserNr ServedUserNr,
noReplyTimer NoReplyTimer OPTIONAL
}
-- ERRORS {
-- notSubscribed,
-- notAvailable,
-- invalidServedUserNr,
-- supplementaryServiceInteractionNotAllowed,
-- basicServiceNotProvided,
-- resourceUnavailable,
-- InvalidDivertedToNr,
-- SpecialServiceNr,
-- DiversionToServedUserNr,
-- InvalidNoReplyTimerValue}
-- End of ActivationDiversion operation definition
deactivationDiversion OPERATION ::= {
ARGUMENT DeactivationDiversionArg
RETURN RESULT FALSE
ALWAYS RESPONDS FALSE
CODE local: 8}
DeactivationDiversionArg ::= SEQUENCE {
procedure Procedure,
basicService BasicService,
servedUserNr ServedUserNr
}
-- ERRORS {
-- notSubscribed,
-- notAvailable,
-- invalidServedUserNr,
-- NotActivated}
--
-- End of DeactivationDiversion operation definition
activationStatusNotificationDiv OPERATION ::= {
ARGUMENT ActivationStatusNotificationDivArg
RETURN RESULT FALSE
ALWAYS RESPONDS FALSE
CODE local: 9}
ActivationStatusNotificationDivArg ::= SEQUENCE {
procedure Procedure,
basicService BasicService,
forwardedToAddresss Address,
servedUserNr ServedUserNr}
-- End of ActivationStatusNotificationDiv operation definition
deactivationStatusNotificationDiv OPERATION ::= {
ARGUMENT DeactivationStatusNotificationDivArg
RETURN RESULT FALSE
ALWAYS RESPONDS FALSE
CODE local: 10}
DeactivationStatusNotificationDivArg ::= SEQUENCE {
procedure Procedure,
basicService BasicService,
servedUserNr ServedUserNr}
-- End of DeactivationStatusNotificationDiv operation definition
interrogationDiversion OPERATION ::= {
ARGUMENT InterrogationDiversionArg
RESULT InterrogationDiversionRes
ERRORS {
notSubscribed |
notAvailable |
invalidServedUserNr}
CODE local: 11}
InterrogationDiversionArg ::= SEQUENCE {
procedure Procedure,
basicService BasicService DEFAULT allServices,
servedUserNr ServedUserNr}
InterrogationDiversionRes ::= IntResultList
-- End of InterrogationDiversion operation definition
interrogateServedUserNumbers OPERATION ::= {
RESULT InterrogateServedUserNumbersRes
ERRORS {
notSubscribed |
notAvailable}
CODE local: 17}
InterrogateServedUserNumbersRes ::= ServedUserNumberList
-- End of InterrogateServedUserNumbers operation definition
diversionInformation OPERATION ::= {
ARGUMENT DiversionInformationArg
RETURN RESULT FALSE
ALWAYS RESPONDS FALSE
CODE local: 12}
DiversionInformationArg ::= SEQUENCE {
diversionReason DiversionReason,
basicService BasicService,
servedUserSubaddress PartySubaddress OPTIONAL,
callingAddress [0] PresentedAddressScreened OPTIONAL,
originalCalledNr [1] PresentedNumberUnscreened OPTIONAL,
lastDivertingNr [2] PresentedNumberUnscreened OPTIONAL,
lastDivertingReason [3] DiversionReason OPTIONAL,
userInfo Q931InformationElement OPTIONAL}
-- The User-user information element, as specified in EN 300 286-1 [19] clause 7.3.3 , shall be
--embedded in the userInfo parameter.
-- End of DiversionInformation operation definition
callDeflection OPERATION ::= {
ARGUMENT CallDeflectionArg
RETURN RESULT FALSE
ERRORS {
notSubscribed |
notAvailable |
InvalidDivertedToNr |
SpecialServiceNr |
DiversionToServedUserNr |
IncomingCallAccepted |
NumberOfDiversionsExceeded |
supplementaryServiceInteractionNotAllowed |
RequestAlreadyAccepted}
CODE local: 13}
CallDeflectionArg ::= SEQUENCE {
deflectionAddress Address,
presentationAllowedDivertedToUser PresentationAllowedIndicator
OPTIONAL}
-- End of CallDeflection operation definition
callRerouteing OPERATION ::= {
ARGUMENT CallRerouteingArg
RETURN RESULT FALSE
ALWAYS RESPONDS FALSE
CODE local: 14}
CallRerouteingArg ::= SEQUENCE {
rerouteingReason DiversionReason,
calledAddress Address,
rerouteingCounter DiversionCounter,
q931InfoElement Q931InformationElement,
lastRerouteingNr [1] PresentedNumberUnscreened,
subscriptionOption [2] SubscriptionOption
DEFAULT noNotification,
callingPartySubaddress [3] PartySubaddress OPTIONAL}
-- The User-user information element (optional), High layer compatibility information element
-- (optional), Bearer capability information element and Low layer compatibility information
-- element (optional) as specified in EN 300 403-1 [11] clause 4.5 shall be embedded in the
-- q931InfoElement.
-- ERRORS {
-- notSubscribed,
-- notAvailable,
-- supplementaryServiceInteractionNotAllowed,
-- resourceUnavailable,
-- InvalidDivertedToNr,
-- SpecialServiceNr,
-- DiversionToServedUserNr,
-- NumberOfDiversionsExceeded}
-- End of CallRerouteing operation definition
divertingLegInformation1 OPERATION ::= {
ARGUMENT DivertingLegInformation1Arg
RETURN RESULT FALSE
ALWAYS RESPONDS FALSE
CODE local: 18}
DivertingLegInformation1Arg ::= SEQUENCE {
diversionReason DiversionReason,
subscriptionOption SubscriptionOption,
divertedToNumber PresentedNumberUnscreened OPTIONAL}
-- End of DivertingLegInformation1 operation definition
divertingLegInformation2 OPERATION ::= {
ARGUMENT DivertingLegInformation2Arg
RETURN RESULT FALSE
ALWAYS RESPONDS FALSE
CODE local: 15}
DivertingLegInformation2Arg ::= SEQUENCE {
diversionCounter DiversionCounter,
diversionReason DiversionReason,
divertingNr [1] PresentedNumberUnscreened OPTIONAL,
originalCalledNr [2] PresentedNumberUnscreened OPTIONAL}
-- End of DivertingLegInformation2 operation definition
divertingLegInformation3 OPERATION ::= {
ARGUMENT DivertingLegInformation3Arg
RETURN RESULT FALSE
ALWAYS RESPONDS FALSE
CODE local: 19}
DivertingLegInformation3Arg ::= PresentationAllowedIndicator
-- End of DivertingLegInformation3 operation definition
IntResultList ::= SET SIZE (0..29) OF IntResult
IntResult ::= SEQUENCE {servedUserNr ServedUserNr,
basicService BasicService,
procedure Procedure,
forwardedToAddress Address}
ServedUserNr ::= CHOICE {individualNumber PartyNumber,
allNumbers NULL}
DiversionCounter ::= INTEGER (1..5)
SubscriptionOption ::= ENUMERATED {noNotification (0),
notificationWithoutDivertedToNr (1),
notificationWithDivertedToNr (2)}
Procedure ::= ENUMERATED {cfu (0),
cfb (1),
cfnr (2)}
ServedUserNumberList ::= SET SIZE (0..99) OF PartyNumber
DiversionReason ::= ENUMERATED {unknown (0),
cfu (1),
cfb (2),
cfnr (3),
cdAlerting (4),
cdImmediate (5)}
NoReplyTimer ::= INTEGER (1..180)
InvalidDivertedToNr ::= ERROR
SpecialServiceNr ::= ERROR
DiversionToServedUserNr ::= ERROR
IncomingCallAccepted ::= ERROR
NumberOfDiversionsExceeded ::= ERROR
NotActivated ::= ERROR
RequestAlreadyAccepted ::= ERROR
InvalidNoReplyTimerValue ::= ERROR
--deactivationDiversion DeactivationDiversion ::= localValue 8
--activationStatusNotificationDiv ActivationStatusNotificationDiv ::= localValue 9
--deactivationStatusNotificationDiv DeactivationStatusNotificationDiv ::= localValue 10
--interrogationDiversion InterrogationDiversion ::= localValue 11
--interrogateServedUserNumbers InterrogateServedUserNumbers ::= localValue 17
--diversionInformation DiversionInformation ::= localValue 12
--callDeflection CallDeflection ::= localValue 13
--callRerouteing CallRerouteing ::= localValue 14
--divertingLegInformation1 DivertingLegInformation1 ::= localValue 18
--divertingLegInformation3 DivertingLegInformation3 ::= localValue 19
--divertingLegInformation2 DivertingLegInformation2 ::= localValue 15
--invalidDivertedToNr InvalidDivertedToNr ::= localValue 12
--specialServiceNr SpecialServiceNr ::= localValue 14
--diversionToServedUserNr DiversionToServedUserNr ::= localValue 15
--incomingCallAccepted IncomingCallAccepted ::= localValue 23
--numberOfDiversionsExceeded NumberOfDiversionsExceeded ::= localValue 24
--notActivated NotActivated ::= localValue 46
--requestAlreadyAccepted RequestAlreadyAccepted ::= localValue 48
END -- of Diversion-Operations

View File

@ -0,0 +1,11 @@
Embedded-Q931-Types {itu-t identified-organization etsi(0) 196 embedded-q931-types(7)}
DEFINITIONS EXPLICIT TAGS ::=
BEGIN
EXPORTS Q931InformationElement;
Q931InformationElement ::= [APPLICATION 0] IMPLICIT OCTET STRING
END -- of Embedded-Q931-Types

26
asn1/isdn-sup/Makefile.am Normal file
View File

@ -0,0 +1,26 @@
# $Id: Makefile.am 43536 2012-06-28 22:56:06Z darkjames $
#
#
# 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

View File

@ -0,0 +1,50 @@
# $Id: Makefile.common 43536 2012-06-28 22:56:06Z darkjames $
#
#
# 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 = isdn-sup
EXPORT_FILES = $(PROTOCOL_NAME)-exp.cnf
EXT_ASN_FILE_LIST =
ASN_FILE_LIST = \
Addressing-Data-Elements.asn \
Basic-Service-Elements.asn \
Embedded-Q931-Types.asn \
Diversion-Operations.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 = \
Makefile.nmake \
$(ASN_FILE_LIST) \
packet-$(PROTOCOL_NAME)-template.c \
$(PROTOCOL_NAME).cnf
SRC_FILES = \
$(EXTRA_DIST) \
$(EXT_ASN_FILE_LIST)
A2W_FLAGS= -b -k
EXTRA_CNF =

View File

@ -0,0 +1,33 @@
## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
#
# $Id: Makefile.nmake 43536 2012-06-28 22:56:06Z darkjames $
#
#
# 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
checkapi:
$(PERL) ../../tools/checkAPIs.pl -build \
$(PROTOCOL_NAME).cnf \
packet-$(PROTOCOL_NAME)-template.c

View File

@ -0,0 +1,50 @@
# isdn-sup.cnf
# isdn_sup conformation file
# 2013 Anders Broman
# $Id: qsig.cnf 36108 2011-03-01 13:01:26Z kukosa $
#.OPT
BER
GROUP_BY_PROT
-o isdn-sup
#.END
#.EXPORTS EXTERN VALS_WITH_TABLE
#.MODULE
Diversion-Operations isdn-sup
#.PDU_NEW
OPERATION.&ArgumentType
OPERATION.&ResultType
#ERROR.&ParameterType
#.END
#.TYPE_RENAME
#.END
#.FIELD_RENAME
#.END
#.TABLE10_BODY OPERATION
{ %(&operationCode)3s, "%(_name)s" },
#.END
#.TABLE11_BODY OPERATION
/* %(_name)-24s */ { %(&operationCode)3s, %(_argument_pdu)s, %(_result_pdu)s },
#.END
#.TABLE20_BODY ERROR
{ %(&errorCode)4s, "%(_name)s" },
#.END
#.TABLE21_BODY ERROR
/* %(_name)-24s */ { %(&errorCode)4s, %(_parameter_pdu)s },
#.END
#.TYPE_ATTR
#.END

View File

@ -0,0 +1,248 @@
/* packet-isdn-sup-template.c
* Routines for ETSI Integrated Services Digital Network (ISDN)
* supplementary services
* Copyright 2013, Anders Broman <anders.broman@ericsson.com>
*
* $Id: packet-camel-template.c 47097 2013-01-15 16:44:02Z morriss $
*
* 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.
* References: ETSI 300 374
*/
#include "config.h"
#include <glib.h>
#include <epan/packet.h>
#include "packet-ber.h"
#define PNAME "ISDN supplementary services"
#define PSNAME "ISDN_SUP"
#define PFNAME "isdn_sup"
/* Initialize the protocol and registered fields */
static int proto_isdn_sup = -1;
static int hf_isdn_sup_operation = -1;
/* Global variables */
/* ROSE context */
static rose_ctx_t isdn_sup_rose_ctx;
typedef struct _isdn_sup_op_t {
gint32 opcode;
new_dissector_t arg_pdu;
new_dissector_t res_pdu;
} isdn_sup_op_t;
static const value_string isdn_sup_str_operation[] = {
#include "packet-isdn-sup-table10.c"
{ 0, NULL}
};
#if 0
static const value_string isdn_sup_str_error[] = {
#include "packet-isdn-sup-table20.c"
{ 0, NULL}
};
#endif
static int hf_isdn_sup = -1;
#include "packet-isdn-sup-hf.c"
/* Initialize the subtree pointers */
static gint ett_isdn_sup = -1;
#include "packet-isdn-sup-ett.c"
/* Preference settings default */
/* Global variables */
#include "packet-isdn-sup-fn.c"
static const isdn_sup_op_t isdn_sup_op_tab[] = {
#include "packet-isdn-sup-table11.c"
};
#if 0
static const isdn_sup_err_t isdn_sup_err_tab[] = {
#include "packet-isdn-sup-table21.c"
};
#endif
static const isdn_sup_op_t *get_op(gint32 opcode) {
int i;
/* search from the end to get the last occurence if the operation is redefined in some newer specification */
for (i = array_length(isdn_sup_op_tab) - 1; i >= 0; i--)
if (isdn_sup_op_tab[i].opcode == opcode)
return &isdn_sup_op_tab[i];
return NULL;
}
/*--- dissect_isdn_sup_arg ------------------------------------------------------*/
static int
dissect_isdn_sup_arg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
int offset;
rose_ctx_t *rctx;
gint32 opcode = 0;
const isdn_sup_op_t *op_ptr;
proto_item *ti;
proto_tree *isdn_sup_tree;
offset = 0;
rctx = get_rose_ctx(pinfo->private_data);
DISSECTOR_ASSERT(rctx);
if (rctx->d.pdu != 1) /* invoke */
return offset;
if (rctx->d.code == 0) { /* local */
opcode = rctx->d.code_local;
} else {
return offset;
}
op_ptr = get_op(opcode);
if (!op_ptr)
return offset;
ti = proto_tree_add_item(tree, proto_isdn_sup, tvb, offset, tvb_length(tvb), ENC_NA);
isdn_sup_tree = proto_item_add_subtree(ti, ett_isdn_sup);
proto_tree_add_uint(isdn_sup_tree, hf_isdn_sup_operation, tvb, 0, 0, opcode);
if (op_ptr->arg_pdu)
offset = op_ptr->arg_pdu(tvb, pinfo, isdn_sup_tree, NULL);
else
if (tvb_length_remaining(tvb, offset) > 0) {
proto_tree_add_text(isdn_sup_tree, tvb, offset, -1, "UNSUPPORTED ARGUMENT TYPE (ETSI Sup)");
offset += tvb_length_remaining(tvb, offset);
}
return offset;
}
/*--- dissect_isdn_sup_res -------------------------------------------------------*/
static int
dissect_isdn_sup_res(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
gint offset;
rose_ctx_t *rctx;
//gint32 opcode, service;
//const qsig_op_t *op_ptr;
//const gchar *p;
//proto_item *ti, *ti_tmp;
//proto_tree *qsig_tree;
offset = 0;
rctx = get_rose_ctx(pinfo->private_data);
DISSECTOR_ASSERT(rctx);
//if (rctx->d.pdu != 2) /* returnResult */
// return offset;
//if (rctx->d.code != 0) /* local */
// return offset;
//opcode = rctx->d.code_local;
//op_ptr = get_op(opcode);
//if (!op_ptr)
// return offset;
//service = get_service(opcode);
//ti = proto_tree_add_item(tree, proto_qsig, tvb, offset, tvb_length(tvb), ENC_NA);
//qsig_tree = proto_item_add_subtree(ti, ett_qsig);
//proto_tree_add_uint(qsig_tree, hf_isdn_sup_operation, tvb, 0, 0, opcode);
//p = match_strval(opcode, VALS(qsig_str_operation));
//if (p) {
// proto_item_append_text(ti, ": %s", p);
// proto_item_append_text(rctx->d.code_item, " - %s", p);
// if (rctx->apdu_depth >= 0)
// proto_item_append_text(proto_item_get_parent_nth(proto_tree_get_parent(tree), rctx->apdu_depth), " %s", p);
//}
//ti_tmp = proto_tree_add_uint(qsig_tree, hf_qsig_service, tvb, 0, 0, service);
//p = match_strval(service, VALS(qsig_str_service_name));
//if (p) proto_item_append_text(ti_tmp, " - %s", p);
//if (op_ptr->res_pdu)
// offset = op_ptr->res_pdu(tvb, pinfo, qsig_tree, NULL);
//else
// if (tvb_length_remaining(tvb, offset) > 0) {
// proto_tree_add_text(qsig_tree, tvb, offset, -1, "UNSUPPORTED RESULT TYPE (QSIG)");
// offset += tvb_length_remaining(tvb, offset);
// }
return offset;
}
/*--- proto_reg_handoff_isdn_sup ---------------------------------------*/
void proto_reg_handoff_isdn_sup(void) {
int i;
dissector_handle_t q931_handle;
dissector_handle_t isdn_sup_arg_handle;
dissector_handle_t isdn_sup_res_handle;
q931_handle = find_dissector("q931");
isdn_sup_arg_handle = new_create_dissector_handle(dissect_isdn_sup_arg, proto_isdn_sup);
isdn_sup_res_handle = new_create_dissector_handle(dissect_isdn_sup_res, proto_isdn_sup);
for (i=0; i<(int)array_length(isdn_sup_op_tab); i++) {
dissector_add_uint("q932.ros.etsi.local.arg", isdn_sup_op_tab[i].opcode, isdn_sup_arg_handle);
dissector_add_uint("q932.ros.etsi.local.res", isdn_sup_op_tab[i].opcode, isdn_sup_res_handle);
}
}
void proto_register_isdn_sup(void) {
/* List of fields */
static hf_register_info hf[] = {
{ &hf_isdn_sup,
{ "isdn_sup", "isdn_sup.1",
FT_INT32, BASE_DEC, NULL, 0,
NULL, HFILL }
},
{ &hf_isdn_sup_operation,
{ "Operation", "isdn_sup.operation",
FT_UINT8, BASE_DEC, VALS(isdn_sup_str_operation), 0x0,
NULL, HFILL }
},
#include "packet-isdn-sup-hfarr.c"
};
/* List of subtrees */
static gint *ett[] = {
&ett_isdn_sup,
#include "packet-isdn-sup-ettarr.c"
};
/* Register fields and subtrees */
proto_register_field_array(proto_isdn_sup, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
/* Register protocol */
proto_isdn_sup = proto_register_protocol(PNAME, PSNAME, PFNAME);
}