Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
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 <[email protected]>
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 <epan/wmem_scopes.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif /* __cplusplus */
23
28typedef 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 */
38typedef 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
53typedef struct _conversation_hash_t {
54 GHashTable *hashtable;
55 GArray *conv_array;
56 void *user_data;
57 unsigned flags;
59
61typedef struct _conversation_key_t {
62 address addr1;
63 address addr2;
64 uint32_t port1;
65 uint32_t port2;
66 conv_id_t conv_id;
68
69typedef struct {
70 address myaddress;
71 uint32_t port;
73
74/*
75 * For backwards source compatibility.
76 * Yes, G_DEPRECATED_FOR() has to be at the beginning, so that this
77 * works with MSVC.
78 */
79G_DEPRECATED_FOR(endpoint_key_t)
81
83typedef const char* (*conv_get_filter_type)(struct _conversation_item_t* item, conv_filter_type_e filter);
84
85typedef struct _ct_dissector_info {
86 conv_get_filter_type get_filter_type;
88
89struct _endpoint_item_t;
90typedef const char* (*endpoint_get_filter_type)(struct _endpoint_item_t* item, conv_filter_type_e filter_type);
91
92typedef struct _et_dissector_info {
93 endpoint_get_filter_type get_filter_type;
95
96/* For backwards source compatibiity */
97G_DEPRECATED_FOR(et_dissector_info_t)
99
100#define CONV_FILTER_INVALID "INVALID"
101
102
103struct register_ct;
104typedef void (*conv_gui_init_cb)(struct register_ct* ct, const char *filter);
105
106typedef void (*endpoint_gui_init_cb)(struct register_ct* ct, const char *filter);
107
114
119
148
170
171/* For backwards source compatibility */
172G_DEPRECATED_FOR(endpoint_item_t)
174
175#define ENDPOINT_TAP_PREFIX "endpoints"
176
184WS_DLL_PUBLIC void register_conversation_table(const int proto_id, bool hide_ports, tap_packet_cb conv_packet_func, tap_packet_cb endpoint_packet_func);
185
191WS_DLL_PUBLIC bool get_conversation_hide_ports(register_ct_t* ct);
192
198WS_DLL_PUBLIC int get_conversation_proto_id(register_ct_t* ct);
199
205WS_DLL_PUBLIC tap_packet_cb get_conversation_packet_func(register_ct_t* ct);
206
212WS_DLL_PUBLIC tap_packet_cb get_endpoint_packet_func(register_ct_t* ct);
213
214/* For backwards source and binary compatibility */
215G_DEPRECATED_FOR(get_endpoint_packet_func)
216WS_DLL_PUBLIC tap_packet_cb get_hostlist_packet_func(register_ct_t* ct);
217
218
224WS_DLL_PUBLIC register_ct_t* get_conversation_by_proto_id(int proto_id);
225
232WS_DLL_PUBLIC void conversation_table_set_gui_info(conv_gui_init_cb init_cb);
233
240WS_DLL_PUBLIC void endpoint_table_set_gui_info(endpoint_gui_init_cb init_cb);
241
242/* For backwards source and binary compatibility */
243G_DEPRECATED_FOR(endpoint_table_set_gui_info)
244WS_DLL_PUBLIC void hostlist_table_set_gui_info(endpoint_gui_init_cb init_cb);
245
251WS_DLL_PUBLIC void conversation_table_iterate_tables(wmem_foreach_func func, void* user_data);
252
255WS_DLL_PUBLIC unsigned conversation_table_get_num(void);
256
261WS_DLL_PUBLIC void reset_conversation_table_data(conv_hash_t *ch);
262
267WS_DLL_PUBLIC void reset_endpoint_table_data(conv_hash_t *ch);
268
269/* For backwards source and binary compatibility */
270G_DEPRECATED_FOR(reset_endpoint_table_data)
271WS_DLL_PUBLIC void reset_hostlist_table_data(conv_hash_t *ch);
272
278WS_DLL_PUBLIC void dissector_conversation_init(const char *opt_arg, void* userdata);
279
285WS_DLL_PUBLIC void dissector_endpoint_init(const char *opt_arg, void* userdata);
286
287/* For backwards source and binary compatibility */
288G_DEPRECATED_FOR(dissector_endpoint_init)
289WS_DLL_PUBLIC void dissector_hostlist_init(const char *opt_arg, void* userdata);
290
298WS_DLL_PUBLIC char *get_conversation_address(wmem_allocator_t *allocator, address *addr, bool resolve_names);
299
310WS_DLL_PUBLIC char *get_conversation_port(wmem_allocator_t *allocator, uint32_t port, conversation_type ctype, bool resolve_names);
311
322WS_DLL_PUBLIC char *get_endpoint_port(wmem_allocator_t *allocator, endpoint_item_t *item, bool resolve_names);
323
330WS_DLL_PUBLIC char *get_conversation_filter(conv_item_t *conv_item, conv_direction_e direction);
331
338WS_DLL_PUBLIC char *get_endpoint_filter(endpoint_item_t *endpoint_item);
339
340/* For backwards source and binary compatibility */
341G_DEPRECATED_FOR(get_endpoint_filter)
342WS_DLL_PUBLIC char *get_hostlist_filter(endpoint_item_t *endpoint_item);
343
358WS_DLL_PUBLIC void add_conversation_table_data(conv_hash_t *ch, const address *src, const address *dst,
359 uint32_t src_port, uint32_t dst_port, int num_frames, int num_bytes, nstime_t *ts, nstime_t *abs_ts,
360 ct_dissector_info_t *ct_info, conversation_type ctype);
361
379WS_DLL_PUBLIC conv_item_t *
380add_conversation_table_data_with_conv_id(conv_hash_t *ch, const address *src, const address *dst, uint32_t src_port,
381 uint32_t dst_port, conv_id_t conv_id, int num_frames, int num_bytes,
382 nstime_t *ts, nstime_t *abs_ts, ct_dissector_info_t *ct_info,
383 conversation_type ctype);
384
389WS_DLL_PUBLIC void
390add_conversation_table_data_extended(conv_hash_t *ch, const address *src, const address *dst, uint32_t src_port,
391 uint32_t dst_port, conv_id_t conv_id, int num_frames, int num_bytes,
392 nstime_t *ts, nstime_t *abs_ts, ct_dissector_info_t *ct_info,
393 conversation_type ctype, uint32_t frameid, int (*proto_conv_cb)(conversation_t *));
394
399WS_DLL_PUBLIC void
400add_conversation_table_data_ipv4_subnet(conv_hash_t *ch, const address *src, const address *dst, uint32_t src_port,
401 uint32_t dst_port, conv_id_t conv_id, int num_frames, int num_bytes,
402 nstime_t *ts, nstime_t *abs_ts, ct_dissector_info_t *ct_info,
403 conversation_type ctype);
404
416WS_DLL_PUBLIC void add_endpoint_table_data(conv_hash_t *ch, const address *addr,
417 uint32_t port, bool sender, int num_frames, int num_bytes, et_dissector_info_t *et_info, endpoint_type etype);
418
423WS_DLL_PUBLIC void add_endpoint_table_data_ipv4_subnet(conv_hash_t *ch, const address *addr,
424 uint32_t port, bool sender, int num_frames, int num_bytes, et_dissector_info_t *et_info, endpoint_type etype);
425
426/* For backwards source and binary compatibility */
427G_DEPRECATED_FOR(add_endpoint_table_data)
428WS_DLL_PUBLIC void add_hostlist_table_data(conv_hash_t *ch, const address *addr,
429 uint32_t port, bool sender, int num_frames, int num_bytes, et_dissector_info_t *et_info, endpoint_type etype);
430
431#ifdef __cplusplus
432}
433#endif /* __cplusplus */
434
435#endif /* __CONVERSATION_TABLE_H__ */
436
437/*
438 * Editor modelines
439 *
440 * Local Variables:
441 * c-basic-offset: 4
442 * tab-width: 8
443 * indent-tabs-mode: nil
444 * End:
445 *
446 * ex: set shiftwidth=4 tabstop=8 expandtab:
447 * :indentSize=4:tabSize=8:noTabs=true:
448 */
uint32_t conv_id_t
Definition conv_id.h:34
WS_DLL_PUBLIC void add_endpoint_table_data(conv_hash_t *ch, const address *addr, uint32_t port, bool sender, int num_frames, int num_bytes, et_dissector_info_t *et_info, endpoint_type etype)
Definition conversation_table.c:928
WS_DLL_PUBLIC char * get_endpoint_filter(endpoint_item_t *endpoint_item)
Definition conversation_table.c:595
WS_DLL_PUBLIC void add_conversation_table_data_ipv4_subnet(conv_hash_t *ch, const address *src, const address *dst, uint32_t src_port, uint32_t 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, conversation_type ctype)
Definition conversation_table.c:837
WS_DLL_PUBLIC char * get_endpoint_port(wmem_allocator_t *allocator, endpoint_item_t *item, bool resolve_names)
Definition conversation_table.c:351
WS_DLL_PUBLIC bool get_conversation_hide_ports(register_ct_t *ct)
Definition conversation_table.c:33
WS_DLL_PUBLIC conv_item_t * add_conversation_table_data_with_conv_id(conv_hash_t *ch, const address *src, const address *dst, uint32_t src_port, uint32_t 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, conversation_type ctype)
Definition conversation_table.c:651
struct _conversation_extension_tcp_t conv_extension_tcp_t
WS_DLL_PUBLIC char * get_conversation_port(wmem_allocator_t *allocator, uint32_t port, conversation_type ctype, bool resolve_names)
Definition conversation_table.c:332
WS_DLL_PUBLIC register_ct_t * get_conversation_by_proto_id(int proto_id)
Definition conversation_table.c:117
WS_DLL_PUBLIC int get_conversation_proto_id(register_ct_t *ct)
Definition conversation_table.c:38
WS_DLL_PUBLIC void dissector_endpoint_init(const char *opt_arg, void *userdata)
Definition conversation_table.c:84
struct _conversation_item_t conv_item_t
WS_DLL_PUBLIC tap_packet_cb get_conversation_packet_func(register_ct_t *ct)
Definition conversation_table.c:46
WS_DLL_PUBLIC void conversation_table_iterate_tables(wmem_foreach_func func, void *user_data)
Definition conversation_table.c:199
WS_DLL_PUBLIC unsigned conversation_table_get_num(void)
Definition conversation_table.c:204
struct _conversation_key_t conv_key_t
WS_DLL_PUBLIC tap_packet_cb get_endpoint_packet_func(register_ct_t *ct)
Definition conversation_table.c:51
WS_DLL_PUBLIC char * get_conversation_filter(conv_item_t *conv_item, conv_direction_e direction)
Definition conversation_table.c:419
WS_DLL_PUBLIC char * get_conversation_address(wmem_allocator_t *allocator, address *addr, bool resolve_names)
Definition conversation_table.c:323
WS_DLL_PUBLIC void add_conversation_table_data(conv_hash_t *ch, const address *src, const address *dst, uint32_t src_port, uint32_t dst_port, int num_frames, int num_bytes, nstime_t *ts, nstime_t *abs_ts, ct_dissector_info_t *ct_info, conversation_type ctype)
Definition conversation_table.c:644
WS_DLL_PUBLIC void reset_endpoint_table_data(conv_hash_t *ch)
Definition conversation_table.c:293
WS_DLL_PUBLIC void register_conversation_table(const int proto_id, bool hide_ports, tap_packet_cb conv_packet_func, tap_packet_cb endpoint_packet_func)
Definition conversation_table.c:123
struct _endpoint_item_t endpoint_item_t
WS_DLL_PUBLIC void add_conversation_table_data_extended(conv_hash_t *ch, const address *src, const address *dst, uint32_t src_port, uint32_t 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, conversation_type ctype, uint32_t frameid, int(*proto_conv_cb)(conversation_t *))
Definition conversation_table.c:795
WS_DLL_PUBLIC void endpoint_table_set_gui_info(endpoint_gui_init_cb init_cb)
Definition conversation_table.c:188
WS_DLL_PUBLIC void conversation_table_set_gui_info(conv_gui_init_cb init_cb)
Definition conversation_table.c:164
WS_DLL_PUBLIC void add_endpoint_table_data_ipv4_subnet(conv_hash_t *ch, const address *addr, uint32_t port, bool sender, int num_frames, int num_bytes, et_dissector_info_t *et_info, endpoint_type etype)
Definition conversation_table.c:1013
struct _conversation_hash_t conv_hash_t
WS_DLL_PUBLIC void reset_conversation_table_data(conv_hash_t *ch)
Definition conversation_table.c:268
WS_DLL_PUBLIC void dissector_conversation_init(const char *opt_arg, void *userdata)
Definition conversation_table.c:65
bool(* wmem_foreach_func)(const void *key, void *value, void *userdata)
Definition wmem_tree.h:247
Definition address.h:56
Definition conversation_table.h:116
uint64_t flows
Definition conversation_table.h:117
Definition conversation_table.h:53
GArray * conv_array
Definition conversation_table.h:55
void * user_data
Definition conversation_table.h:56
GHashTable * hashtable
Definition conversation_table.h:54
unsigned flags
Definition conversation_table.h:57
Definition conversation_table.h:121
conversation_type ctype
Definition conversation_table.h:125
nstime_t start_time
Definition conversation_table.h:140
uint64_t tx_bytes
Definition conversation_table.h:133
conv_id_t conv_id
Definition conversation_table.h:128
address src_address
Definition conversation_table.h:123
nstime_t start_abs_time
Definition conversation_table.h:142
uint64_t tx_frames_total
Definition conversation_table.h:136
uint64_t rx_frames_total
Definition conversation_table.h:135
bool filtered
Definition conversation_table.h:144
uint64_t rx_frames
Definition conversation_table.h:130
ct_dissector_info_t * dissector_info
Definition conversation_table.h:122
uint64_t tx_bytes_total
Definition conversation_table.h:138
address dst_address
Definition conversation_table.h:124
uint32_t dst_port
Definition conversation_table.h:127
uint32_t src_port
Definition conversation_table.h:126
uint64_t rx_bytes
Definition conversation_table.h:132
uint64_t rx_bytes_total
Definition conversation_table.h:137
uint64_t tx_frames
Definition conversation_table.h:131
nstime_t stop_time
Definition conversation_table.h:141
conv_extension_tcp_t ext_tcp
Definition conversation_table.h:146
Definition conversation_table.h:61
Definition conversation_table.h:85
Definition conversation_table.h:150
uint64_t rx_frames_total
Definition conversation_table.h:161
bool modified
Definition conversation_table.h:166
address myaddress
Definition conversation_table.h:152
uint64_t rx_frames
Definition conversation_table.h:156
uint64_t rx_bytes
Definition conversation_table.h:158
uint64_t tx_bytes
Definition conversation_table.h:159
et_dissector_info_t * dissector_info
Definition conversation_table.h:151
endpoint_type etype
Definition conversation_table.h:153
uint64_t tx_bytes_total
Definition conversation_table.h:164
uint64_t rx_bytes_total
Definition conversation_table.h:163
uint64_t tx_frames
Definition conversation_table.h:157
bool filtered
Definition conversation_table.h:167
uint64_t tx_frames_total
Definition conversation_table.h:162
uint32_t port
Definition conversation_table.h:154
Definition conversation_table.h:92
Definition wmem_allocator.h:27
Definition conversation.h:224
Definition conversation_table.h:69
Definition nstime.h:26
Definition conversation_table.c:24