epan/dissectors/pidl/drsuapi/drsuapi.cnf init/free_ndr_pointer_list
[wireshark-sm.git] / doc / plugins.example / hello.c
blob5a9ccd81696b9cf0ffbbf593c9f939f7d057ed47
1 /* hello.c
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
10 #define WS_BUILD_DLL
11 #include <wireshark.h>
12 #include <wsutil/plugins.h>
13 #include <epan/packet.h>
14 #include <epan/proto.h>
16 #ifndef VERSION
17 #define VERSION "0.0.0"
18 #endif
20 WS_DLL_PUBLIC_DEF const char plugin_version[] = VERSION;
21 WS_DLL_PUBLIC_DEF const int plugin_want_major = WIRESHARK_VERSION_MAJOR;
22 WS_DLL_PUBLIC_DEF const int plugin_want_minor = WIRESHARK_VERSION_MINOR;
24 WS_DLL_PUBLIC void plugin_register(void);
25 WS_DLL_PUBLIC uint32_t plugin_describe(void);
27 static int proto_hello;
28 static dissector_handle_t handle_hello;
30 static int
31 dissect_hello(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
33 proto_tree_add_protocol_format(tree, proto_hello, tvb, 0, -1, "This is Hello version %s, a Wireshark postdissector plugin prototype", plugin_version);
34 return tvb_captured_length(tvb);
37 static void
38 proto_register_hello(void)
40 proto_hello = proto_register_protocol("Wireshark Hello Plugin", "Hello WS", "hello_ws");
41 handle_hello = create_dissector_handle(dissect_hello, proto_hello);
42 register_postdissector(handle_hello);
45 static void
46 proto_reg_handoff_hello(void)
48 /* empty */
51 void
52 plugin_register(void)
54 static proto_plugin plug;
56 plug.register_protoinfo = proto_register_hello;
57 plug.register_handoff = proto_reg_handoff_hello; /* or NULL */
58 proto_register_plugin(&plug);
61 uint32_t
62 plugin_describe(void)
64 return WS_PLUGIN_DESC_DISSECTOR;