diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2016-03-09 03:17:51 +0000 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2016-03-13 21:30:24 +0000 |
commit | 54a520d4a1151c68d0b4e5f09a8d82466fa499f3 (patch) | |
tree | 7aacae160382098ce651ac862a5dfd5de4beff94 /asn1/goose | |
parent | c1f3c935bdd33090c87f0d2f84842ce9729b747a (diff) | |
download | wireshark-54a520d4a1151c68d0b4e5f09a8d82466fa499f3.tar.gz |
Move /asn1 to /epan/dissectors
Change-Id: I1208fe3c2ba428995526f561e8f792b8d871e9a9
Reviewed-on: https://code.wireshark.org/review/14388
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: João Valverde <j@v6e.pt>
Diffstat (limited to 'asn1/goose')
-rw-r--r-- | asn1/goose/CMakeLists.txt | 47 | ||||
-rw-r--r-- | asn1/goose/Makefile.am | 23 | ||||
-rw-r--r-- | asn1/goose/Makefile.common | 42 | ||||
-rw-r--r-- | asn1/goose/Makefile.nmake | 26 | ||||
-rw-r--r-- | asn1/goose/goose.asn | 143 | ||||
-rw-r--r-- | asn1/goose/goose.cnf | 70 | ||||
-rw-r--r-- | asn1/goose/packet-goose-template.c | 160 |
7 files changed, 0 insertions, 511 deletions
diff --git a/asn1/goose/CMakeLists.txt b/asn1/goose/CMakeLists.txt deleted file mode 100644 index aa06dc2155..0000000000 --- a/asn1/goose/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -# 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 goose ) - -set( PROTO_OPT ) - -set( EXT_ASN_FILE_LIST -) - -set( ASN_FILE_LIST - ${PROTOCOL_NAME}.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 ) - -ASN2WRS() - diff --git a/asn1/goose/Makefile.am b/asn1/goose/Makefile.am deleted file mode 100644 index 72d28e600b..0000000000 --- a/asn1/goose/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -# 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/asn1/goose/Makefile.common b/asn1/goose/Makefile.common deleted file mode 100644 index b9946fa1ae..0000000000 --- a/asn1/goose/Makefile.common +++ /dev/null @@ -1,42 +0,0 @@ -# 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=goose - -EXT_ASN_FILE_LIST = - -ASN_FILE_LIST = \ - $(PROTOCOL_NAME).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= - diff --git a/asn1/goose/Makefile.nmake b/asn1/goose/Makefile.nmake deleted file mode 100644 index fc70f2382f..0000000000 --- a/asn1/goose/Makefile.nmake +++ /dev/null @@ -1,26 +0,0 @@ -## 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/asn1/goose/goose.asn b/asn1/goose/goose.asn deleted file mode 100644 index 3ed831f8c1..0000000000 --- a/asn1/goose/goose.asn +++ /dev/null @@ -1,143 +0,0 @@ -IEC61850 DEFINITIONS ::= BEGIN - -GOOSEpdu ::= CHOICE { - gseMngtPdu [APPLICATION 0] IMPLICIT GSEMngtPdu, - goosePdu [APPLICATION 1] IMPLICIT IECGoosePdu, - ... -} - -GSEMngtPdu ::= SEQUENCE { - stateID [0] IMPLICIT INTEGER, --- security [3] ANY OPTIONAL, - -- reserved for future definition - requestResp RequestResponse --- CHOICE { --- requests [1] IMPLICIT GSEMngtRequests, --- responses [2] IMPLICIT GSEMngtResponses --- } -} - -RequestResponse ::= CHOICE { - requests [1] IMPLICIT GSEMngtRequests, - responses [2] IMPLICIT GSEMngtResponses -} - -GSEMngtRequests ::= CHOICE { - getGoReference [1] IMPLICIT GetReferenceRequestPdu, - getGOOSEElementNumber [2] IMPLICIT GetElementRequestPdu, - getGsReference [3] IMPLICIT GetReferenceRequestPdu, - getGSSEDataOffset [4] IMPLICIT GetElementRequestPdu, - ... -} - -GSEMngtResponses ::= CHOICE { - gseMngtNotSupported [0] IMPLICIT NULL, - getGoReference [1] IMPLICIT GSEMngtResponsePdu, - getGOOSEElementNumber [2] IMPLICIT GSEMngtResponsePdu, - getGsReference [3] IMPLICIT GSEMngtResponsePdu, - getGSSEDataOffset [4] IMPLICIT GSEMngtResponsePdu, - ... -} - -GetReferenceRequestPdu ::= SEQUENCE { - ident [0] IMPLICIT VisibleString, -- size shall support up to 65 octets - offset [1] IMPLICIT SEQUENCE OF INTEGER, - ... -} - -GetElementRequestPdu ::= SEQUENCE { - ident [0] IMPLICIT VisibleString, -- size shall support up to 65 octets - references [1] IMPLICIT SEQUENCE OF VisibleString, - ... -} - -GSEMngtResponsePdu ::= SEQUENCE { - ident [0] IMPLICIT VisibleString, -- echos the value of the request - confRev [1] IMPLICIT INTEGER OPTIONAL, - posNeg PositiveNegative, --- CHOICE { --- responsePositive [2] IMPLICIT SEQUENCE { --- datSet [0] IMPLICIT VisibleString OPTIONAL, --- result [1] IMPLICIT SEQUENCE OF RequestResults --- }, --- responseNegative [3] IMPLICIT GlbErrors --- }, - ... -} - -PositiveNegative ::= CHOICE { - responsePositive [2] IMPLICIT SEQUENCE { - datSet [0] IMPLICIT VisibleString OPTIONAL, - result [1] IMPLICIT SEQUENCE OF RequestResults - }, - responseNegative [3] IMPLICIT GlbErrors -} - -RequestResults::= CHOICE { - offset [0] IMPLICIT INTEGER, - reference [1] IMPLICIT IA5String, - error [2] IMPLICIT ErrorReason -} - -GlbErrors ::= INTEGER { - other(0), - unknownControlBlock(1), - responseTooLarge(2), - controlBlockConfigurationError(3) --, --- ... -} - -ErrorReason ::= INTEGER { - other (0), - notFound (1) --, --- ... -} - -IECGoosePdu ::= SEQUENCE { - gocbRef [0] IMPLICIT VisibleString, - timeAllowedtoLive [1] IMPLICIT INTEGER, - datSet [2] IMPLICIT VisibleString, - goID [3] IMPLICIT VisibleString OPTIONAL, - t [4] IMPLICIT UtcTime, - stNum [5] IMPLICIT INTEGER, - sqNum [6] IMPLICIT INTEGER, - test [7] IMPLICIT BOOLEAN DEFAULT FALSE, - confRev [8] IMPLICIT INTEGER, - ndsCom [9] IMPLICIT BOOLEAN DEFAULT FALSE, - numDatSetEntries [10] IMPLICIT INTEGER, - allData [11] IMPLICIT SEQUENCE OF Data --, --- security [12] ANY OPTIONAL - -- reserved for digital signature -} - -UtcTime ::= OCTET STRING -- format and size defined in 8.1.3.6. - -TimeOfDay ::= OCTET STRING -- (SIZE (4 | 6)) -FloatingPoint ::= OCTET STRING - - -Data ::= CHOICE - { - -- context tag 0 is reserved for AccessResult - array [1] IMPLICIT SEQUENCE OF Data, - structure [2] IMPLICIT SEQUENCE OF Data, - boolean [3] IMPLICIT BOOLEAN, - bit-string [4] IMPLICIT BIT STRING, - integer [5] IMPLICIT INTEGER, - unsigned [6] IMPLICIT INTEGER, - floating-point [7] IMPLICIT FloatingPoint, - real [8] IMPLICIT REAL, - octet-string [9] IMPLICIT OCTET STRING, - visible-string [10] IMPLICIT VisibleString, - binary-time [12] IMPLICIT TimeOfDay, - bcd [13] IMPLICIT INTEGER, - booleanArray [14] IMPLICIT BIT STRING, - objId [15] IMPLICIT OBJECT IDENTIFIER, - ..., - mMSString [16] IMPLICIT MMSString, - utc-time [17] IMPLICIT UtcTime -- added by IEC61850 8.1 G3 - } - -MMSString ::= UTF8String - -END diff --git a/asn1/goose/goose.cnf b/asn1/goose/goose.cnf deleted file mode 100644 index 3331736ca2..0000000000 --- a/asn1/goose/goose.cnf +++ /dev/null @@ -1,70 +0,0 @@ -# goose.cnf -# goose conformation file - -#.MODULE_IMPORT - -#.EXPORTS - -#.PDU - -#.NO_EMIT ONLY_VALS -GOOSEpdu - -#.TYPE_RENAME - - -#.FN_BODY UtcTime - - guint32 len; - guint32 seconds; - guint32 fraction; - guint32 nanoseconds; - nstime_t ts; - gchar * ptime; - - len = tvb_reported_length_remaining(tvb, offset); - - if(len != 8) - { - proto_tree_add_expert(tree, actx->pinfo, &ei_goose_mal_utctime, tvb, offset, len); - if(hf_index >= 0) - { - proto_tree_add_string(tree, hf_index, tvb, offset, len, "????"); - } - return offset; - } - - seconds = tvb_get_ntohl(tvb, offset); - fraction = tvb_get_ntoh24(tvb, offset+4) * 0x100; /* Only 3 bytes are recommended */ - nanoseconds = (guint32)( ((guint64)fraction * G_GUINT64_CONSTANT(1000000000)) / G_GUINT64_CONSTANT(0x100000000) ) ; - - ts.secs = seconds; - ts.nsecs = nanoseconds; - - ptime = abs_time_to_str(wmem_packet_scope(), &ts, ABSOLUTE_TIME_UTC, TRUE); - - if(hf_index >= 0) - { - proto_tree_add_string(tree, hf_index, tvb, offset, len, ptime); - } - - return offset; - - - -#.TYPE_ATTR -UtcTime TYPE = FT_STRING DISPLAY = BASE_NONE - - -#.FIELD_RENAME -GetReferenceRequestPdu/offset getReferenceRequestPDU_offset -GSEMngtResponses/getGsReference gseMngtResponses_GetGSReference -GSEMngtResponses/getGoReference gseMngtResponses_GetGOReference -GSEMngtResponses/getGSSEDataOffset gseMngtResponses_GetGSSEDataOffset -GSEMngtResponses/getGOOSEElementNumber gseMngtResponses_GetGOOSEElementNumber - -#.FIELD_ATTR -IECGoosePdu/stNum TYPE = FT_UINT32 DISPLAY = BASE_DEC -IECGoosePdu/sqNum TYPE = FT_UINT32 DISPLAY = BASE_DEC - -#.END diff --git a/asn1/goose/packet-goose-template.c b/asn1/goose/packet-goose-template.c deleted file mode 100644 index b396a6f617..0000000000 --- a/asn1/goose/packet-goose-template.c +++ /dev/null @@ -1,160 +0,0 @@ -/* packet-goose.c - * Routines for IEC 61850 GOOSE packet dissection - * Martin Lutz 2008 - * - * 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/asn1.h> -#include <epan/etypes.h> -#include <epan/expert.h> - -#include "packet-ber.h" -#include "packet-acse.h" - -#define PNAME "GOOSE" -#define PSNAME "GOOSE" -#define PFNAME "goose" - -void proto_register_goose(void); -void proto_reg_handoff_goose(void); - -/* Initialize the protocol and registered fields */ -static int proto_goose = -1; -static int hf_goose_appid = -1; -static int hf_goose_length = -1; -static int hf_goose_reserve1 = -1; -static int hf_goose_reserve2 = -1; - -static expert_field ei_goose_mal_utctime = EI_INIT; -static expert_field ei_goose_zero_pdu = EI_INIT; - -#include "packet-goose-hf.c" - -/* Initialize the subtree pointers */ -static int ett_goose = -1; - -#include "packet-goose-ett.c" - -#include "packet-goose-fn.c" - -/* -* Dissect GOOSE PDUs inside a PPDU. -*/ -static int -dissect_goose(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* data _U_) -{ - int offset = 0; - int old_offset; - guint16 length; - proto_item *item = NULL; - proto_tree *tree = NULL; - asn1_ctx_t asn1_ctx; - asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); - - col_set_str(pinfo->cinfo, COL_PROTOCOL, PNAME); - col_clear(pinfo->cinfo, COL_INFO); - - item = proto_tree_add_item(parent_tree, proto_goose, tvb, 0, -1, ENC_NA); - tree = proto_item_add_subtree(item, ett_goose); - - - /* APPID */ - proto_tree_add_item(tree, hf_goose_appid, tvb, offset, 2, ENC_BIG_ENDIAN); - - /* Length */ - length = tvb_get_ntohs(tvb, offset + 2); - proto_tree_add_item(tree, hf_goose_length, tvb, offset + 2, 2, ENC_BIG_ENDIAN); - - /* Reserved 1 */ - proto_tree_add_item(tree, hf_goose_reserve1, tvb, offset + 4, 2, ENC_BIG_ENDIAN); - - /* Reserved 2 */ - proto_tree_add_item(tree, hf_goose_reserve2, tvb, offset + 6, 2, ENC_BIG_ENDIAN); - - offset = 8; - while (offset < length){ - old_offset = offset; - offset = dissect_goose_GOOSEpdu(FALSE, tvb, offset, &asn1_ctx , tree, -1); - if (offset == old_offset) { - proto_tree_add_expert(tree, pinfo, &ei_goose_zero_pdu, tvb, offset, -1); - break; - } - } - - return tvb_captured_length(tvb); -} - - -/*--- proto_register_goose -------------------------------------------*/ -void proto_register_goose(void) { - - /* List of fields */ - static hf_register_info hf[] = - { - { &hf_goose_appid, - { "APPID", "goose.appid", FT_UINT16, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }}, - - { &hf_goose_length, - { "Length", "goose.length", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, - - { &hf_goose_reserve1, - { "Reserved 1", "goose.reserve1", FT_UINT16, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }}, - - { &hf_goose_reserve2, - { "Reserved 2", "goose.reserve2", FT_UINT16, BASE_HEX_DEC, NULL, 0x0, NULL, HFILL }}, - -#include "packet-goose-hfarr.c" - }; - - /* List of subtrees */ - static gint *ett[] = { - &ett_goose, -#include "packet-goose-ettarr.c" - }; - - static ei_register_info ei[] = { - { &ei_goose_mal_utctime, { "goose.malformed.utctime", PI_MALFORMED, PI_WARN, "BER Error: malformed UTCTime encoding", EXPFILL }}, - { &ei_goose_zero_pdu, { "goose.zero_pdu", PI_PROTOCOL, PI_ERROR, "Internal error, zero-byte GOOSE PDU", EXPFILL }}, - }; - - expert_module_t* expert_goose; - - /* Register protocol */ - proto_goose = proto_register_protocol(PNAME, PSNAME, PFNAME); - register_dissector("goose", dissect_goose, proto_goose); - - /* Register fields and subtrees */ - proto_register_field_array(proto_goose, hf, array_length(hf)); - proto_register_subtree_array(ett, array_length(ett)); - expert_goose = expert_register_protocol(proto_goose); - expert_register_field_array(expert_goose, ei, array_length(ei)); -} - -/*--- proto_reg_handoff_goose --- */ -void proto_reg_handoff_goose(void) { - - dissector_handle_t goose_handle; - goose_handle = find_dissector("goose"); - - dissector_add_uint("ethertype", ETHERTYPE_IEC61850_GOOSE, goose_handle); -} |