Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
tap.h
1 /* tap.h
2  * packet tap interface 2002 Ronnie Sahlberg
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * SPDX-License-Identifier: GPL-2.0-or-later
9  */
10 
11 #ifndef __TAP_H__
12 #define __TAP_H__
13 
14 #include <epan/epan.h>
15 #include <epan/packet_info.h>
16 #include "ws_symbol_export.h"
17 #ifdef HAVE_PLUGINS
18 #include "wsutil/plugins.h"
19 #endif
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif /* __cplusplus */
24 
25 typedef void (*tap_reset_cb)(void *tapdata);
26 typedef gboolean (*tap_packet_cb)(void *tapdata, packet_info *pinfo, epan_dissect_t *edt, const void *data);
27 typedef void (*tap_draw_cb)(void *tapdata);
28 
32 #define TL_REQUIRES_NOTHING 0x00000000
33 #define TL_REQUIRES_PROTO_TREE 0x00000001
34 #define TL_REQUIRES_COLUMNS 0x00000002
35 #define TL_REQUIRES_ERROR_PACKETS 0x00000004
37 #define TL_IS_DISSECTOR_HELPER 0x00000008
40 #ifdef HAVE_PLUGINS
41 typedef struct {
42  void (*register_tap_listener)(void); /* routine to call to register tap listener */
43 } tap_plugin;
44 
46 WS_DLL_PUBLIC void tap_register_plugin(const tap_plugin *plug);
47 #endif
48 
49 /*
50  * For all tap plugins, call their register routines.
51  * Must be called after plugins_init(), and must be called only once in
52  * a program.
53  *
54  * XXX - should probably be handled by epan_init(), as the tap mechanism
55  * is part of libwireshark.
56  */
57 WS_DLL_PUBLIC void register_all_plugin_tap_listeners(void);
58 
59 extern void tap_init(void);
60 
73 WS_DLL_PUBLIC int register_tap(const char *name);
74 
75 /* Gets a GList of the tap names */
76 WS_DLL_PUBLIC GList* get_tap_names(void);
77 
81 WS_DLL_PUBLIC int find_tap_id(const char *name);
82 
103 WS_DLL_PUBLIC void tap_queue_packet(int tap_id, packet_info *pinfo, const void *tap_specific_data);
104 
106 WS_DLL_PUBLIC void tap_build_interesting(epan_dissect_t *edt);
107 
112 extern void tap_queue_init(epan_dissect_t *edt);
113 
118 extern void tap_push_tapped_queue(epan_dissect_t *edt);
119 
124 WS_DLL_PUBLIC void reset_tap_listeners(void);
125 
133 WS_DLL_PUBLIC void draw_tap_listeners(gboolean draw_all);
134 
209 WS_DLL_PUBLIC GString *register_tap_listener(const char *tapname, void *tapdata,
210  const char *fstring, guint flags, tap_reset_cb tap_reset,
211  tap_packet_cb tap_packet, tap_draw_cb tap_draw) G_GNUC_WARN_UNUSED_RESULT;
212 
214 WS_DLL_PUBLIC GString *set_tap_dfilter(void *tapdata, const char *fstring);
215 
217 WS_DLL_PUBLIC void tap_listeners_dfilter_recompile(void);
218 
220 WS_DLL_PUBLIC void remove_tap_listener(void *tapdata);
221 
226 WS_DLL_PUBLIC gboolean tap_listeners_require_dissection(void);
227 
229 WS_DLL_PUBLIC gboolean have_tap_listener(int tap_id);
230 
232 WS_DLL_PUBLIC gboolean have_filtering_tap_listeners(void);
233 
239 WS_DLL_PUBLIC guint union_of_tap_listener_flags(void);
240 
255 WS_DLL_PUBLIC const void *fetch_tapped_data(int tap_id, int idx);
256 
259 extern void tap_cleanup(void);
260 
261 #ifdef __cplusplus
262 }
263 #endif /* __cplusplus */
264 
265 #endif /* __TAP_H__ */
Definition: packet_info.h:44
Definition: epan_dissect.h:28