aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/goose
diff options
context:
space:
mode:
authorĐorđije Manojlović <djordjije.manojlovic@omicronenergy.com>2020-12-28 10:14:01 +0100
committerAndersBroman <a.broman58@gmail.com>2020-12-28 13:37:33 +0000
commit1c2b499e0bcf4cce73cf0c24eea8ae3bc290af75 (patch)
treefddb26bc30c77f2640a450bbbd97baf71ec2a172 /epan/dissectors/asn1/goose
parent93f6aa2c696520cc57b269cce5f0fe58de286a52 (diff)
Improve R-GOOSE protocol tree
This enables filtering R-GOOSE packets on protocol level, too.
Diffstat (limited to 'epan/dissectors/asn1/goose')
-rw-r--r--epan/dissectors/asn1/goose/packet-goose-template.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/epan/dissectors/asn1/goose/packet-goose-template.c b/epan/dissectors/asn1/goose/packet-goose-template.c
index 2de7828e06..197972c51e 100644
--- a/epan/dissectors/asn1/goose/packet-goose-template.c
+++ b/epan/dissectors/asn1/goose/packet-goose-template.c
@@ -2,6 +2,9 @@
* Routines for IEC 61850 GOOSE packet dissection
* Martin Lutz 2008
*
+ * Routines for IEC 61850 R-GOOSE packet dissection
+ * Đorđije Manojlović 2020
+ *
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
@@ -19,15 +22,20 @@
#include "packet-ber.h"
#include "packet-acse.h"
-#define PNAME "GOOSE"
-#define PSNAME "GOOSE"
-#define PFNAME "goose"
+#define GOOSE_PNAME "GOOSE"
+#define GOOSE_PSNAME "GOOSE"
+#define GOOSE_PFNAME "goose"
+
+#define R_GOOSE_PNAME "R-GOOSE"
+#define R_GOOSE_PSNAME "R-GOOSE"
+#define R_GOOSE_PFNAME "r-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 proto_r_goose = -1;
static int hf_goose_session_header = -1;
static int hf_goose_spdu_id = -1;
@@ -65,6 +73,7 @@ static expert_field ei_goose_zero_pdu = EI_INIT;
#include "packet-goose-hf.c"
/* Initialize the subtree pointers */
+static int ett_r_goose = -1;
static int ett_session_header = -1;
static int ett_security_info = -1;
static int ett_session_user_info = -1;
@@ -123,7 +132,7 @@ dissect_goose(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
asn1_ctx_t asn1_ctx;
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
- col_set_str(pinfo->cinfo, COL_PROTOCOL, PNAME);
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, GOOSE_PNAME);
col_clear(pinfo->cinfo, COL_INFO);
item = proto_tree_add_item(parent_tree, proto_goose, tvb, 0, -1, ENC_NA);
@@ -170,15 +179,18 @@ dissect_rgoose(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
guint32 init_v_length, payload_tag, padding_length, length;
guint32 payload_length, apdu_offset = 0, apdu_length;
proto_item *item = NULL;
- proto_tree *tree = NULL, *sess_user_info_tree = NULL;
+ proto_tree *tree = NULL, *r_goose_tree = NULL, *sess_user_info_tree = NULL;
asn1_ctx_t asn1_ctx;
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "R-GOOSE");
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, R_GOOSE_PNAME);
col_clear(pinfo->cinfo, COL_INFO);
+ item = proto_tree_add_item(parent_tree, proto_r_goose, tvb, 0, -1, ENC_NA);
+ r_goose_tree = proto_item_add_subtree(item, ett_r_goose);
+
/* Session header subtree */
- item = proto_tree_add_item(parent_tree, hf_goose_session_header, tvb, 0,
+ item = proto_tree_add_item(r_goose_tree, hf_goose_session_header, tvb, 0,
-1, ENC_NA);
tree = proto_item_add_subtree(item, ett_session_header);
@@ -236,7 +248,7 @@ dissect_rgoose(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree,
offset += init_v_length;
/* Session user information subtree */
- item = proto_tree_add_item(parent_tree, hf_goose_session_user_info, tvb,
+ item = proto_tree_add_item(r_goose_tree, hf_goose_session_user_info, tvb,
offset, -1, ENC_NA);
sess_user_info_tree = proto_item_add_subtree(item, ett_payload);
@@ -495,6 +507,7 @@ void proto_register_goose(void) {
/* List of subtrees */
static gint *ett[] = {
+ &ett_r_goose,
&ett_session_header,
&ett_security_info,
&ett_session_user_info,
@@ -516,7 +529,9 @@ void proto_register_goose(void) {
expert_module_t* expert_goose;
/* Register protocol */
- proto_goose = proto_register_protocol(PNAME, PSNAME, PFNAME);
+ proto_goose = proto_register_protocol(GOOSE_PNAME, GOOSE_PSNAME, GOOSE_PFNAME);
+ proto_r_goose = proto_register_protocol(R_GOOSE_PNAME, R_GOOSE_PSNAME, R_GOOSE_PFNAME);
+
goose_handle = register_dissector("goose", dissect_goose, proto_goose);
/* Register fields and subtrees */