epan/dissectors/pidl/ C99 drsuapi
[wireshark-sm.git] / epan / dissectors / asn1 / gdt / packet-gdt-template.c
blobf2f3fd243fc8cefb5085b89c481f46ee203f1c1f
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
13 # include "config.h"
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"
23 #define PSNAME "GDT"
24 #define PFNAME "gdt"
26 /* Initialize the protocol and registered fields */
27 static int proto_gdt;
28 static dissector_handle_t gdt_handle;
30 #include "packet-gdt-hf.c"
32 /* Initialize the subtree pointers */
33 static int ett_gdt;
34 #include "packet-gdt-ett.c"
36 #include "packet-gdt-fn.c"
38 static int dissect_gdt(tvbuff_t *tvb,
39 packet_info *pinfo,
40 proto_tree *tree,
41 void *data _U_) {
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 */
49 if (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) {
59 /* List of fields */
60 static hf_register_info hf[] = {
61 #include "packet-gdt-hfarr.c"
64 /* List of subtrees */
65 static int *ett[] = {
66 &ett_gdt,
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;
85 if (!initialized) {
86 dissector_add_for_decode_as("sctp.ppi", gdt_handle);
87 dissector_add_uint("sctp.ppi", GDT_PROTOCOL_ID, gdt_handle);
88 initialized = true;