1 /* packet-gdt-template.c
3 * Copyright 2022, Damir Franusic <damir.franusic@gmail.com>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
15 #include <epan/packet.h>
16 #include <epan/sctpppids.h>
17 #include <wsutil/array.h>
19 #include "packet-ber.h"
20 #include "packet-gdt.h"
22 #define PNAME "Generic Data Transfer Protocol"
26 /* Initialize the protocol and registered fields */
28 static dissector_handle_t gdt_handle
;
30 #include "packet-gdt-hf.c"
32 /* Initialize the subtree pointers */
34 #include "packet-gdt-ett.c"
36 #include "packet-gdt-fn.c"
38 static int dissect_gdt(tvbuff_t
*tvb
,
42 proto_item
*gdt_item
= NULL
;
43 proto_tree
*gdt_tree
= NULL
;
45 /* make entry in the Protocol column on summary display */
46 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, PNAME
);
48 /* create the gdt protocol tree */
50 gdt_item
= proto_tree_add_item(tree
, proto_gdt
, tvb
, 0, -1, ENC_NA
);
51 gdt_tree
= proto_item_add_subtree(gdt_item
, ett_gdt
);
52 dissect_GDTMessage_PDU(tvb
, pinfo
, gdt_tree
, 0);
54 return tvb_captured_length(tvb
);
57 /*--- proto_register_gdt ----------------------------------------------*/
58 void proto_register_gdt(void) {
60 static hf_register_info hf
[] = {
61 #include "packet-gdt-hfarr.c"
64 /* List of subtrees */
67 #include "packet-gdt-ettarr.c"
70 /* Register protocol */
71 proto_gdt
= proto_register_protocol(PNAME
, PSNAME
, PFNAME
);
73 /* Register fields and subtrees */
74 proto_register_field_array(proto_gdt
, hf
, array_length(hf
));
75 proto_register_subtree_array(ett
, array_length(ett
));
77 /* Register dissector */
78 gdt_handle
= register_dissector("gdt", dissect_gdt
, proto_gdt
);
81 /*--- proto_reg_handoff_gdt -------------------------------------------*/
82 void proto_reg_handoff_gdt(void) {
83 static bool initialized
= false;
86 dissector_add_for_decode_as("sctp.ppi", gdt_handle
);
87 dissector_add_uint("sctp.ppi", GDT_PROTOCOL_ID
, gdt_handle
);