epan/dissectors/pidl/ C99 drsuapi
[wireshark-sm.git] / epan / dissectors / asn1 / cdt / packet-cdt-template.c
blob4ae9c331f0d5672b0d0c709e5d1c3f21eb10179f
1 /* packet-cdt.c
3 * Routines for Compressed Data Type packet dissection.
5 * Copyright 2005, Stig Bjorlykke <stig@bjorlykke.org>, Thales Norway AS
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * SPDX-License-Identifier: GPL-2.0-or-later
13 * Ref: STANAG 4406 Annex E
16 #include "config.h"
18 #include <epan/packet.h>
19 #include <epan/oids.h>
20 #include <epan/expert.h>
21 #include <epan/asn1.h>
22 #include <wsutil/array.h>
23 #include "packet-ber.h"
24 #include "packet-p1.h"
26 #include "packet-cdt.h"
28 #define CDT_UNDEFINED 0
29 #define CDT_EXTERNAL 1
30 #define CDT_P1 2
31 #define CDT_P3 3
32 #define CDT_P7 4
34 #define PNAME "Compressed Data Type"
35 #define PSNAME "CDT"
36 #define PFNAME "cdt"
38 void proto_register_cdt(void);
39 void proto_reg_handoff_cdt(void);
41 static proto_tree *top_tree;
42 static proto_item *cdt_item;
44 static uint32_t content_type;
46 /* Initialize the protocol and registered fields */
47 static int proto_cdt;
48 #include "packet-cdt-hf.c"
50 /* Initialize the subtree pointers */
51 #include "packet-cdt-ett.c"
53 static expert_field ei_cdt_unable_compress_content;
54 static expert_field ei_cdt_unable_uncompress_content;
56 #include "packet-cdt-fn.c"
59 /*--- proto_register_cdt -------------------------------------------*/
62 ** Dissect Compressed Data Type
64 void dissect_cdt (tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
66 proto_tree *tree = NULL;
68 /* save parent_tree so subdissectors can create new top nodes */
69 top_tree = parent_tree;
71 if (parent_tree) {
72 cdt_item = proto_tree_add_item (parent_tree, proto_cdt, tvb, 0, -1, ENC_NA);
73 tree = proto_item_add_subtree (cdt_item, ett_cdt_CompressedData);
74 } else {
75 cdt_item = NULL;
78 col_set_str (pinfo->cinfo, COL_PROTOCOL, "CDT");
79 col_clear (pinfo->cinfo, COL_INFO);
81 dissect_CompressedData_PDU (tvb, pinfo, tree, NULL);
84 void proto_register_cdt (void) {
86 /* List of fields */
87 static hf_register_info hf[] = {
88 #include "packet-cdt-hfarr.c"
91 /* List of subtrees */
92 static int *ett[] = {
93 #include "packet-cdt-ettarr.c"
96 static ei_register_info ei[] = {
97 { &ei_cdt_unable_compress_content, { "cdt.unable_compress_content", PI_UNDECODED, PI_ERROR, "Unable to get compressed content", EXPFILL }},
98 { &ei_cdt_unable_uncompress_content, { "cdt.unable_uncompress_content", PI_UNDECODED, PI_ERROR, "Unable to get uncompressed content", EXPFILL }},
101 expert_module_t* expert_cdt;
103 /* Register protocol */
104 proto_cdt = proto_register_protocol (PNAME, PSNAME, PFNAME);
106 /* Register fields and subtrees */
107 proto_register_field_array (proto_cdt, hf, array_length(hf));
108 proto_register_subtree_array (ett, array_length(ett));
109 expert_cdt = expert_register_protocol(proto_cdt);
110 expert_register_field_array(expert_cdt, ei, array_length(ei));
114 /*--- proto_reg_handoff_cdt ---------------------------------------*/
115 void proto_reg_handoff_cdt (void) {
116 #include "packet-cdt-dis-tab.c"