2017-09-23 21:50:28 +00:00
|
|
|
/* hello.c
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-07 11:26:45 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2017-09-23 21:50:28 +00:00
|
|
|
*/
|
|
|
|
|
2018-11-23 20:39:50 +00:00
|
|
|
#define WS_BUILD_DLL
|
2021-10-16 09:33:34 +00:00
|
|
|
#include <wireshark.h>
|
2017-09-23 21:50:28 +00:00
|
|
|
#include <epan/packet.h>
|
2017-09-30 23:56:03 +00:00
|
|
|
#include <epan/proto.h>
|
2017-09-23 21:50:28 +00:00
|
|
|
|
|
|
|
#ifndef VERSION
|
|
|
|
#define VERSION "0.0.0"
|
|
|
|
#endif
|
|
|
|
|
2018-11-23 20:39:50 +00:00
|
|
|
WS_DLL_PUBLIC_DEF const gchar 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;
|
2017-09-23 21:50:28 +00:00
|
|
|
|
2018-11-23 20:39:50 +00:00
|
|
|
WS_DLL_PUBLIC void plugin_register(void);
|
2017-09-23 21:50:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
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_)
|
|
|
|
{
|
2017-09-29 18:49:51 +00:00
|
|
|
proto_tree_add_protocol_format(tree, proto_hello, tvb, 0, -1, "This is Hello version %s, a Wireshark postdissector plugin prototype", plugin_version);
|
2017-09-23 21:50:28 +00:00
|
|
|
return tvb_captured_length(tvb);
|
|
|
|
}
|
|
|
|
|
2017-09-30 23:56:03 +00:00
|
|
|
static void
|
|
|
|
proto_register_hello(void)
|
2017-09-23 21:50:28 +00:00
|
|
|
{
|
2017-09-30 23:56:03 +00:00
|
|
|
proto_hello = proto_register_protocol("Wireshark Hello Plugin", "Hello WS", "hello_ws");
|
2017-09-23 21:50:28 +00:00
|
|
|
handle_hello = create_dissector_handle(dissect_hello, proto_hello);
|
|
|
|
register_postdissector(handle_hello);
|
|
|
|
}
|
|
|
|
|
2017-09-30 23:56:03 +00:00
|
|
|
static void
|
|
|
|
proto_reg_handoff_hello(void)
|
2017-09-23 21:50:28 +00:00
|
|
|
{
|
|
|
|
/* empty */
|
|
|
|
}
|
2017-09-30 23:56:03 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|