Wireshark 2.9.0-477-g68ec514b The Wireshark network protocol analyzer

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

conversation_table.h
Go to the documentation of this file.
1 /* conversation_table.h
2 * GUI independent helper routines common to all conversations taps.
3 * Refactored original conversations_table by Ronnie Sahlberg
4 *
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
8 *
9 * SPDX-License-Identifier: GPL-2.0-or-later
10 */
11
12 #ifndef __CONVERSATION_TABLE_H__
13 #define __CONVERSATION_TABLE_H__
14
15 #include "conv_id.h"
16 #include "tap.h"
17 #include "conversation.h"
18 #include "wmem/wmem.h"
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif /* __cplusplus */
23
28 typedef enum {
29 CONV_FT_SRC_ADDRESS,
30 CONV_FT_DST_ADDRESS,
31 CONV_FT_ANY_ADDRESS,
32 CONV_FT_SRC_PORT,
33 CONV_FT_DST_PORT,
34 CONV_FT_ANY_PORT
35 } conv_filter_type_e;
36
37 /* Filter direction */
38 typedef enum {
39 CONV_DIR_A_TO_FROM_B,
40 CONV_DIR_A_TO_B,
41 CONV_DIR_A_FROM_B,
42 CONV_DIR_A_TO_FROM_ANY,
43 CONV_DIR_A_TO_ANY,
44 CONV_DIR_A_FROM_ANY,
45 CONV_DIR_ANY_TO_FROM_B,
46 CONV_DIR_ANY_TO_B,
47 CONV_DIR_ANY_FROM_B
48 } conv_direction_e;
49
53 typedef struct _conversation_hash_t {
54 GHashTable *hashtable;
55 GArray *conv_array;
56 void *user_data;
57 } conv_hash_t;
58
60 typedef struct _conversation_key_t {
61 address addr1;
62 address addr2;
63 guint32 port1;
64 guint32 port2;
65 conv_id_t conv_id;
66 } conv_key_t;
67
68 typedef struct {
69 address myaddress;
70 guint32 port;
71 } host_key_t;
72
73 struct _conversation_item_t;
74 typedef const char* (*conv_get_filter_type)(struct _conversation_item_t* item, conv_filter_type_e filter);
75
76 typedef struct _ct_dissector_info {
77 conv_get_filter_type get_filter_type;
78 } ct_dissector_info_t;
79
80 struct _hostlist_talker_t;
81 typedef const char* (*host_get_filter_type)(struct _hostlist_talker_t* item, conv_filter_type_e filter_type);
82
83 typedef struct _hostlist_dissector_info {
84 host_get_filter_type get_filter_type;
85 } hostlist_dissector_info_t;
86
87 #define CONV_FILTER_INVALID "INVALID"
88
89
90 struct register_ct;
91 typedef void (*conv_gui_init_cb)(struct register_ct* ct, const char *filter);
92
93 typedef void (*host_gui_init_cb)(struct register_ct* host, const char *filter);
94
96 typedef struct register_ct register_ct_t;
97
99 typedef struct _conversation_item_t {
100 ct_dissector_info_t *dissector_info;
101 address src_address;
102 address dst_address;
103 endpoint_type etype;
104 guint32 src_port;
105 guint32 dst_port;
106 conv_id_t conv_id;
108 guint64 rx_frames;
109 guint64 tx_frames;
110 guint64 rx_bytes;
111 guint64 tx_bytes;
113 nstime_t start_time;
114 nstime_t stop_time;
115 nstime_t start_abs_time;
117 gboolean modified;
118 } conv_item_t;
119
121 typedef struct _hostlist_talker_t {
122 hostlist_dissector_info_t *dissector_info;
123 address myaddress;
124 endpoint_type etype;
125 guint32 port;
127 guint64 rx_frames;
128 guint64 tx_frames;
129 guint64 rx_bytes;
130 guint64 tx_bytes;
132 gboolean modified;
134 } hostlist_talker_t;
135
136 #define HOSTLIST_TAP_PREFIX "endpoints"
137
145 WS_DLL_PUBLIC void register_conversation_table(const int proto_id, gboolean hide_ports, tap_packet_cb conv_packet_func, tap_packet_cb hostlist_func);
146
152 WS_DLL_PUBLIC gboolean get_conversation_hide_ports(register_ct_t* ct);
153
159 WS_DLL_PUBLIC int get_conversation_proto_id(register_ct_t* ct);
160
166 WS_DLL_PUBLIC tap_packet_cb get_conversation_packet_func(register_ct_t* ct);
167
173 WS_DLL_PUBLIC tap_packet_cb get_hostlist_packet_func(register_ct_t* ct);
174
180 WS_DLL_PUBLIC register_ct_t* get_conversation_by_proto_id(int proto_id);
181
188 WS_DLL_PUBLIC void conversation_table_set_gui_info(conv_gui_init_cb init_cb);
189
196 WS_DLL_PUBLIC void hostlist_table_set_gui_info(host_gui_init_cb init_cb);
197
203 WS_DLL_PUBLIC void conversation_table_iterate_tables(wmem_foreach_func func, void* user_data);
204
207 WS_DLL_PUBLIC guint conversation_table_get_num(void);
208
213 WS_DLL_PUBLIC void reset_conversation_table_data(conv_hash_t *ch);
214
219 WS_DLL_PUBLIC void reset_hostlist_table_data(conv_hash_t *ch);
220
226 WS_DLL_PUBLIC void dissector_conversation_init(const char *opt_arg, void* userdata);
227
233 WS_DLL_PUBLIC void dissector_hostlist_init(const char *opt_arg, void* userdata);
234
242 WS_DLL_PUBLIC char *get_conversation_address(wmem_allocator_t *allocator, address *addr, gboolean resolve_names);
243
252 WS_DLL_PUBLIC char *get_conversation_port(wmem_allocator_t *allocator, guint32 port, endpoint_type etype, gboolean resolve_names);
253
260 WS_DLL_PUBLIC char *get_conversation_filter(conv_item_t *conv_item, conv_direction_e direction);
261
268 WS_DLL_PUBLIC char *get_hostlist_filter(hostlist_talker_t *host);
269
284 WS_DLL_PUBLIC void add_conversation_table_data(conv_hash_t *ch, const address *src, const address *dst,
285 guint32 src_port, guint32 dst_port, int num_frames, int num_bytes, nstime_t *ts, nstime_t *abs_ts,
286 ct_dissector_info_t *ct_info, endpoint_type etype);
287
305 WS_DLL_PUBLIC void
306 add_conversation_table_data_with_conv_id(conv_hash_t *ch, const address *src, const address *dst, guint32 src_port,
307 guint32 dst_port, conv_id_t conv_id, int num_frames, int num_bytes,
308 nstime_t *ts, nstime_t *abs_ts, ct_dissector_info_t *ct_info, endpoint_type etype);
309
321 WS_DLL_PUBLIC void add_hostlist_table_data(conv_hash_t *ch, const address *addr,
322 guint32 port, gboolean sender, int num_frames, int num_bytes, hostlist_dissector_info_t *host_info, endpoint_type etype);
323
324 #ifdef __cplusplus
325 }
326 #endif /* __cplusplus */
327
328 #endif /* __CONVERSATION_TABLE_H__ */
329
330 /*
331 * Editor modelines
332 *
333 * Local Variables:
334 * c-basic-offset: 4
335 * tab-width: 8
336 * indent-tabs-mode: nil
337 * End:
338 *
339 * ex: set shiftwidth=4 tabstop=8 expandtab:
340 * :indentSize=4:tabSize=8:noTabs=true:
341 */
_conversation_item_t::conv_id
conv_id_t conv_id
Definition: conversation_table.h:106
reset_conversation_table_data
WS_DLL_PUBLIC void reset_conversation_table_data(conv_hash_t *ch)
Definition: conversation_table.c:248
_conversation_hash_t
Definition: conversation_table.h:53
_conversation_item_t::tx_frames
guint64 tx_frames
Definition: conversation_table.h:109
hostlist_talker_t
struct _hostlist_talker_t hostlist_talker_t
_conversation_item_t::src_port
guint32 src_port
Definition: conversation_table.h:104
add_conversation_table_data_with_conv_id
WS_DLL_PUBLIC void add_conversation_table_data_with_conv_id(conv_hash_t *ch, const address *src, const address *dst, guint32 src_port, guint32 dst_port, conv_id_t conv_id, int num_frames, int num_bytes, nstime_t *ts, nstime_t *abs_ts, ct_dissector_info_t *ct_info, endpoint_type etype)
Definition: conversation_table.c:569
host_key_t
Definition: conversation_table.h:68
_conversation_hash_t::conv_array
GArray * conv_array
Definition: conversation_table.h:55
get_hostlist_packet_func
WS_DLL_PUBLIC tap_packet_cb get_hostlist_packet_func(register_ct_t *ct)
Definition: conversation_table.c:51
_hostlist_talker_t::dissector_info
hostlist_dissector_info_t * dissector_info
Definition: conversation_table.h:122
conversation.h
_hostlist_talker_t::etype
endpoint_type etype
Definition: conversation_table.h:124
register_ct
Definition: conversation_table.c:24
wmem_foreach_func
gboolean(* wmem_foreach_func)(const void *key, void *value, void *userdata)
Definition: wmem_tree.h:213
add_conversation_table_data
WS_DLL_PUBLIC void add_conversation_table_data(conv_hash_t *ch, const address *src, const address *dst, guint32 src_port, guint32 dst_port, int num_frames, int num_bytes, nstime_t *ts, nstime_t *abs_ts, ct_dissector_info_t *ct_info, endpoint_type etype)
Definition: conversation_table.c:562
_hostlist_talker_t::rx_frames
guint64 rx_frames
Definition: conversation_table.h:127
_conversation_item_t::etype
endpoint_type etype
Definition: conversation_table.h:103
_hostlist_talker_t::modified
gboolean modified
Definition: conversation_table.h:132
_conversation_item_t::dissector_info
ct_dissector_info_t * dissector_info
Definition: conversation_table.h:100
_conversation_item_t::stop_time
nstime_t stop_time
Definition: conversation_table.h:114
_ct_dissector_info
Definition: conversation_table.h:76
add_hostlist_table_data
WS_DLL_PUBLIC void add_hostlist_table_data(conv_hash_t *ch, const address *addr, guint32 port, gboolean sender, int num_frames, int num_bytes, hostlist_dissector_info_t *host_info, endpoint_type etype)
Definition: conversation_table.c:732
get_conversation_by_proto_id
WS_DLL_PUBLIC register_ct_t * get_conversation_by_proto_id(int proto_id)
Definition: conversation_table.c:103
_hostlist_talker_t::tx_bytes
guint64 tx_bytes
Definition: conversation_table.h:130
_conversation_hash_t::user_data
void * user_data
Definition: conversation_table.h:56
get_conversation_hide_ports
WS_DLL_PUBLIC gboolean get_conversation_hide_ports(register_ct_t *ct)
Definition: conversation_table.c:33
nstime_t
Definition: nstime.h:27
get_conversation_proto_id
WS_DLL_PUBLIC int get_conversation_proto_id(register_ct_t *ct)
Definition: conversation_table.c:38
conv_item_t
struct _conversation_item_t conv_item_t
conv_key_t
struct _conversation_key_t conv_key_t
_conversation_item_t::dst_address
address dst_address
Definition: conversation_table.h:102
dissector_conversation_init
WS_DLL_PUBLIC void dissector_conversation_init(const char *opt_arg, void *userdata)
Definition: conversation_table.c:59
conversation_table_get_num
WS_DLL_PUBLIC guint conversation_table_get_num(void)
Definition: conversation_table.c:184
_conversation_item_t::dst_port
guint32 dst_port
Definition: conversation_table.h:105
get_conversation_filter
WS_DLL_PUBLIC char * get_conversation_filter(conv_item_t *conv_item, conv_direction_e direction)
Definition: conversation_table.c:371
conversation_table_iterate_tables
WS_DLL_PUBLIC void conversation_table_iterate_tables(wmem_foreach_func func, void *user_data)
Definition: conversation_table.c:179
register_conversation_table
WS_DLL_PUBLIC void register_conversation_table(const int proto_id, gboolean hide_ports, tap_packet_cb conv_packet_func, tap_packet_cb hostlist_func)
Definition: conversation_table.c:109
_hostlist_talker_t::port
guint32 port
Definition: conversation_table.h:125
get_conversation_address
WS_DLL_PUBLIC char * get_conversation_address(wmem_allocator_t *allocator, address *addr, gboolean resolve_names)
Definition: conversation_table.c:297
_hostlist_talker_t::myaddress
address myaddress
Definition: conversation_table.h:123
_conversation_item_t::rx_frames
guint64 rx_frames
Definition: conversation_table.h:108
_conversation_item_t::src_address
address src_address
Definition: conversation_table.h:101
_wmem_allocator_t
Definition: wmem_allocator.h:26
reset_hostlist_table_data
WS_DLL_PUBLIC void reset_hostlist_table_data(conv_hash_t *ch)
Definition: conversation_table.c:273
_conversation_item_t::rx_bytes
guint64 rx_bytes
Definition: conversation_table.h:110
dissector_hostlist_init
WS_DLL_PUBLIC void dissector_hostlist_init(const char *opt_arg, void *userdata)
Definition: conversation_table.c:78
_conversation_hash_t::hashtable
GHashTable * hashtable
Definition: conversation_table.h:54
_hostlist_talker_t
Definition: conversation_table.h:121
_conversation_item_t::tx_bytes
guint64 tx_bytes
Definition: conversation_table.h:111
_conversation_item_t::modified
gboolean modified
Definition: conversation_table.h:117
_hostlist_talker_t::rx_bytes
guint64 rx_bytes
Definition: conversation_table.h:129
get_conversation_packet_func
WS_DLL_PUBLIC tap_packet_cb get_conversation_packet_func(register_ct_t *ct)
Definition: conversation_table.c:46
_hostlist_dissector_info
Definition: conversation_table.h:83
conversation_table_set_gui_info
WS_DLL_PUBLIC void conversation_table_set_gui_info(conv_gui_init_cb init_cb)
Definition: conversation_table.c:150
_hostlist_talker_t::tx_frames
guint64 tx_frames
Definition: conversation_table.h:128
hostlist_table_set_gui_info
WS_DLL_PUBLIC void hostlist_table_set_gui_info(host_gui_init_cb init_cb)
Definition: conversation_table.c:174
get_conversation_port
WS_DLL_PUBLIC char * get_conversation_port(wmem_allocator_t *allocator, guint32 port, endpoint_type etype, gboolean resolve_names)
Definition: conversation_table.c:306
conv_hash_t
struct _conversation_hash_t conv_hash_t
_conversation_item_t::start_abs_time
nstime_t start_abs_time
Definition: conversation_table.h:115
_conversation_item_t
Definition: conversation_table.h:99
_conversation_item_t::start_time
nstime_t start_time
Definition: conversation_table.h:113
_conversation_key_t
Definition: conversation_table.h:60
get_hostlist_filter
WS_DLL_PUBLIC char * get_hostlist_filter(hostlist_talker_t *host)
Definition: conversation_table.c:529
_address
Definition: address.h:47