Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
follow.h
Go to the documentation of this file.
1
12#pragma once
13#include <epan/epan.h>
14#include <epan/packet.h>
15#include <wsutil/inet_cidr.h>
16#include <epan/tap.h>
17#include <epan/wmem_scopes.h>
18#include "ws_symbol_export.h"
19
20#ifdef __cplusplus
21extern "C" {
22#endif /* __cplusplus */
23
24/* Show Stream */
35
46
47struct _follow_info;
48
49#define SUBSTREAM_UNUSED UINT64_C(0xFFFFFFFFFFFFFFFF)
50
54typedef struct {
55 bool is_server;
56 uint32_t packet_num;
57 uint32_t seq;
59 GByteArray* data;
61
80
81struct register_follow;
83
86extern void follow_init(void);
87
88typedef char* (*follow_conv_filter_func)(epan_dissect_t *edt, packet_info *pinfo, unsigned *stream, unsigned *sub_stream);
89typedef char* (*follow_index_filter_func)(unsigned stream, unsigned sub_stream);
90typedef char* (*follow_address_filter_func)(address* src_addr, address* dst_addr, int src_port, int dst_port);
91typedef char* (*follow_port_to_display_func)(wmem_allocator_t *allocator, unsigned port);
92typedef uint32_t (*follow_stream_count_func)(void);
93typedef bool (*follow_sub_stream_id_func)(unsigned stream, unsigned sub_stream, bool le, unsigned *sub_stream_out);
94
108WS_DLL_PUBLIC
109void register_follow_stream(const int proto_id, const char* tap_listener,
110 follow_conv_filter_func conv_filter, follow_index_filter_func index_filter, follow_address_filter_func address_filter,
111 follow_port_to_display_func port_to_display, tap_packet_cb tap_handler,
112 follow_stream_count_func stream_count, follow_sub_stream_id_func sub_stream_id);
113
120WS_DLL_PUBLIC int get_follow_proto_id(register_follow_t* follower);
121
128WS_DLL_PUBLIC const char* get_follow_tap_string(register_follow_t* follower);
129
136WS_DLL_PUBLIC register_follow_t* get_follow_by_name(const char* proto_short_name);
137
144WS_DLL_PUBLIC register_follow_t* get_follow_by_proto_id(const int proto_id);
145
152WS_DLL_PUBLIC follow_conv_filter_func get_follow_conv_func(register_follow_t* follower);
153
160WS_DLL_PUBLIC follow_index_filter_func get_follow_index_func(register_follow_t* follower);
161
168WS_DLL_PUBLIC follow_address_filter_func get_follow_address_func(register_follow_t* follower);
169
176WS_DLL_PUBLIC follow_port_to_display_func get_follow_port_to_display(register_follow_t* follower);
177
184WS_DLL_PUBLIC tap_packet_cb get_follow_tap_handler(register_follow_t* follower);
185
193WS_DLL_PUBLIC follow_stream_count_func get_follow_stream_count_func(register_follow_t* follower);
194
209WS_DLL_PUBLIC follow_sub_stream_id_func get_follow_sub_stream_id_func(register_follow_t* follower);
210
224WS_DLL_PUBLIC tap_packet_status
225follow_tvb_tap_listener(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const void *data, tap_flags_t flags);
226
233WS_DLL_PUBLIC void follow_iterate_followers(wmem_foreach_func func, void *user_data);
234
242WS_DLL_PUBLIC char* follow_get_stat_tap_string(register_follow_t* follower);
243
255WS_DLL_PUBLIC void follow_reset_stream(follow_info_t* info);
256
263WS_DLL_PUBLIC void follow_info_free(follow_info_t* follow_info);
264
265#ifdef __cplusplus
266}
267#endif /* __cplusplus */
union _stream_addr stream_addr
Represents an IP address for a stream, supporting both IPv4 and IPv6.
show_stream_t
Indicates the direction of a network stream for display purposes.
Definition follow.h:30
@ BOTH_HOSTS
Definition follow.h:33
@ FROM_CLIENT
Definition follow.h:31
@ FROM_SERVER
Definition follow.h:32
WS_DLL_PUBLIC void follow_reset_stream(follow_info_t *info)
Clear payload, fragments, counters, addresses, and ports of follow_info_t for retapping.
Definition follow.c:152
WS_DLL_PUBLIC tap_packet_cb get_follow_tap_handler(register_follow_t *follower)
Provide function that handles tap data (tap_packet_cb parameter of register_tap_listener)
Definition follow.c:106
WS_DLL_PUBLIC follow_address_filter_func get_follow_address_func(register_follow_t *follower)
Provide function that builds a follow filter based on address/port pairs.
Definition follow.c:96
WS_DLL_PUBLIC const char * get_follow_tap_string(register_follow_t *follower)
Get tap name string from registered follower (used for register_tap_listener)
Definition follow.c:78
WS_DLL_PUBLIC follow_stream_count_func get_follow_stream_count_func(register_follow_t *follower)
Provide function that gets the total number of streams for a registered follower The function can be ...
Definition follow.c:111
WS_DLL_PUBLIC void register_follow_stream(const int proto_id, const char *tap_listener, follow_conv_filter_func conv_filter, follow_index_filter_func index_filter, follow_address_filter_func address_filter, follow_port_to_display_func port_to_display, tap_packet_cb tap_handler, follow_stream_count_func stream_count, follow_sub_stream_id_func sub_stream_id)
Register a new follow stream.
Definition follow.c:42
WS_DLL_PUBLIC follow_conv_filter_func get_follow_conv_func(register_follow_t *follower)
Provide function that builds a follow filter based on the current packet's conversation.
Definition follow.c:86
WS_DLL_PUBLIC register_follow_t * get_follow_by_proto_id(const int proto_id)
Get a registered follower by protocol id.
Definition follow.c:126
WS_DLL_PUBLIC follow_sub_stream_id_func get_follow_sub_stream_id_func(register_follow_t *follower)
Retrieve the next sub-stream ID for a given stream and stream ID.
Definition follow.c:116
WS_DLL_PUBLIC register_follow_t * get_follow_by_name(const char *proto_short_name)
Get a registered follower by protocol short name.
Definition follow.c:121
WS_DLL_PUBLIC follow_index_filter_func get_follow_index_func(register_follow_t *follower)
Provide function that builds a follow filter based on stream.
Definition follow.c:91
void follow_init(void)
Definition follow.c:37
struct _follow_info follow_info_t
Aggregates all state for following and reassembling a single stream across both client and server dir...
WS_DLL_PUBLIC char * follow_get_stat_tap_string(register_follow_t *follower)
Generate -z stat (tap) name for a follower Currently used only by TShark.
Definition follow.c:141
WS_DLL_PUBLIC void follow_iterate_followers(wmem_foreach_func func, void *user_data)
Iterator to walk all registered followers and execute func.
Definition follow.c:136
WS_DLL_PUBLIC void follow_info_free(follow_info_t *follow_info)
Free follow_info_t structure Free everything except the GUI element.
Definition follow.c:205
WS_DLL_PUBLIC follow_port_to_display_func get_follow_port_to_display(register_follow_t *follower)
Provide function that resolves port number to name based on follower.
Definition follow.c:101
WS_DLL_PUBLIC int get_follow_proto_id(register_follow_t *follower)
Get protocol ID from registered follower.
Definition follow.c:70
WS_DLL_PUBLIC tap_packet_status follow_tvb_tap_listener(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const void *data, tap_flags_t flags)
Tap listener for dissectors that export follow data via a tvb.
Definition follow.c:212
bool(* wmem_foreach_func)(const void *key, void *value, void *userdata)
Function type for processing one node of a tree during a traversal.
Definition wmem_tree.h:389
Holds a network or link-layer address of any supported type.
Definition address.h:62
Aggregates all state for following and reassembling a single stream across both client and server dir...
Definition follow.h:65
address client_ip
Definition follow.h:74
uint64_t substream_id
Definition follow.h:78
address server_ip
Definition follow.h:75
show_stream_t show_stream
Definition follow.h:66
GList * fragments[2]
Definition follow.h:71
unsigned client_port
Definition follow.h:72
uint32_t seq[2]
Definition follow.h:70
GList * payload
Definition follow.h:68
unsigned server_port
Definition follow.h:73
unsigned bytes_written[2]
Definition follow.h:69
void * gui_data
Definition follow.h:76
char * filter_out_filter
Definition follow.h:67
uint64_t stream_id
Definition follow.h:77
Represents the metadata and indexing information for a single captured frame.
Definition packet_info.h:43
Internal memory allocator interface used by the wmem subsystem.
Definition wmem_allocator.h:34
Represents a 128-bit IPv6 address.
Definition inet_addr.h:27
Holds all state for the dissection of a single byte array, including session, buffer,...
Definition epan_dissect.h:28
Represents a single chunk of data from one side of a followed stream.
Definition follow.h:54
uint32_t packet_num
Definition follow.h:56
uint32_t seq
Definition follow.h:57
GByteArray * data
Definition follow.h:59
bool is_server
Definition follow.h:55
nstime_t abs_ts
Definition follow.h:58
Definition file-pcapng.h:57
Definition nstime.h:26
Definition follow.c:23
Definition stream.c:41
tap_packet_status
Definition tap.h:22
Represents an IP address for a stream, supporting both IPv4 and IPv6.
Definition follow.h:42
uint32_t ipv4
Definition follow.h:43
ws_in6_addr ipv6
Definition follow.h:44