From e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 10 Apr 2024 22:34:10 +0200 Subject: Adding upstream version 4.2.2. Signed-off-by: Daniel Baumann --- doc/plugins.example/hello.c | 58 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 doc/plugins.example/hello.c (limited to 'doc/plugins.example/hello.c') diff --git a/doc/plugins.example/hello.c b/doc/plugins.example/hello.c new file mode 100644 index 0000000..7a252c8 --- /dev/null +++ b/doc/plugins.example/hello.c @@ -0,0 +1,58 @@ +/* hello.c + * + * Wireshark - Network traffic analyzer + * By Gerald Combs + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#define WS_BUILD_DLL +#include +#include +#include + +#ifndef VERSION +#define VERSION "0.0.0" +#endif + +WS_DLL_PUBLIC_DEF const char plugin_version[] = VERSION; +WS_DLL_PUBLIC_DEF const int plugin_want_major = WIRESHARK_VERSION_MAJOR; +WS_DLL_PUBLIC_DEF const int plugin_want_minor = WIRESHARK_VERSION_MINOR; + +WS_DLL_PUBLIC void plugin_register(void); + + +static int proto_hello = -1; +static dissector_handle_t handle_hello; + +static int +dissect_hello(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_) +{ + proto_tree_add_protocol_format(tree, proto_hello, tvb, 0, -1, "This is Hello version %s, a Wireshark postdissector plugin prototype", plugin_version); + return tvb_captured_length(tvb); +} + +static void +proto_register_hello(void) +{ + proto_hello = proto_register_protocol("Wireshark Hello Plugin", "Hello WS", "hello_ws"); + handle_hello = create_dissector_handle(dissect_hello, proto_hello); + register_postdissector(handle_hello); +} + +static void +proto_reg_handoff_hello(void) +{ + /* empty */ +} + +void +plugin_register(void) +{ + static proto_plugin plug; + + plug.register_protoinfo = proto_register_hello; + plug.register_handoff = proto_reg_handoff_hello; /* or NULL */ + proto_register_plugin(&plug); +} -- cgit v1.2.3