Wireshark  4.3.0
The Wireshark network protocol analyzer
follow.h
Go to the documentation of this file.
1 
13 #ifndef __FOLLOW_H__
14 #define __FOLLOW_H__
15 
16 #include <epan/epan.h>
17 #include <epan/packet.h>
18 #include <epan/ipv6.h>
19 #include <epan/tap.h>
20 #include <epan/wmem_scopes.h>
21 #include "ws_symbol_export.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif /* __cplusplus */
26 
27 typedef enum {
28  FRS_OK,
29  FRS_OPEN_ERROR,
30  FRS_READ_ERROR,
31  FRS_PRINT_ERROR
32 } frs_return_t;
33 
34 /* Show Stream */
35 typedef enum {
36  FROM_CLIENT,
37  FROM_SERVER,
38  BOTH_HOSTS
39 } show_stream_t;
40 
41 typedef union _stream_addr {
42  guint32 ipv4;
43  ws_in6_addr ipv6;
44 } stream_addr;
45 
46 struct _follow_info;
47 
48 typedef gboolean (*follow_print_line_func)(char *, size_t, gboolean, void *);
49 
50 #define SUBSTREAM_UNUSED G_GUINT64_CONSTANT(0xFFFFFFFFFFFFFFFF)
51 
52 typedef struct {
53  gboolean is_server;
54  guint32 packet_num;
55  guint32 seq; /* TCP only */
57  GByteArray *data;
59 
60 typedef struct _follow_info {
61  show_stream_t show_stream;
62  char *filter_out_filter;
63  GList *payload; /* "follow_record_t" entries, in reverse order. */
64  guint bytes_written[2]; /* Index with FROM_CLIENT or FROM_SERVER for readability. */
65  guint32 seq[2]; /* TCP only */
66  GList *fragments[2]; /* TCP only */
67  guint client_port;
68  guint server_port;
69  address client_ip;
70  address server_ip;
71  void* gui_data;
72  guint64 substream_id;
74 
75 struct register_follow;
76 typedef struct register_follow register_follow_t;
77 
78 typedef gchar* (*follow_conv_filter_func)(epan_dissect_t *edt, packet_info *pinfo, guint *stream, guint *sub_stream);
79 typedef gchar* (*follow_index_filter_func)(guint stream, guint sub_stream);
80 typedef gchar* (*follow_address_filter_func)(address* src_addr, address* dst_addr, int src_port, int dst_port);
81 typedef gchar* (*follow_port_to_display_func)(wmem_allocator_t *allocator, guint port);
82 typedef guint32 (*follow_stream_count_func)(void);
83 typedef gboolean (*follow_sub_stream_id_func)(guint stream, guint sub_stream, gboolean le, guint *sub_stream_out);
84 
85 WS_DLL_PUBLIC
86 void register_follow_stream(const int proto_id, const char* tap_listener,
87  follow_conv_filter_func conv_filter, follow_index_filter_func index_filter, follow_address_filter_func address_filter,
88  follow_port_to_display_func port_to_display, tap_packet_cb tap_handler,
89  follow_stream_count_func stream_count, follow_sub_stream_id_func sub_stream_id);
90 
96 WS_DLL_PUBLIC int get_follow_proto_id(register_follow_t* follower);
97 
103 WS_DLL_PUBLIC const char* get_follow_tap_string(register_follow_t* follower);
104 
110 WS_DLL_PUBLIC register_follow_t* get_follow_by_name(const char* proto_short_name);
111 
117 WS_DLL_PUBLIC register_follow_t* get_follow_by_proto_id(const int proto_id);
118 
124 WS_DLL_PUBLIC follow_conv_filter_func get_follow_conv_func(register_follow_t* follower);
125 
131 WS_DLL_PUBLIC follow_index_filter_func get_follow_index_func(register_follow_t* follower);
132 
138 WS_DLL_PUBLIC follow_address_filter_func get_follow_address_func(register_follow_t* follower);
139 
145 WS_DLL_PUBLIC follow_port_to_display_func get_follow_port_to_display(register_follow_t* follower);
146 
152 WS_DLL_PUBLIC tap_packet_cb get_follow_tap_handler(register_follow_t* follower);
153 
160 WS_DLL_PUBLIC follow_stream_count_func get_follow_stream_count_func(register_follow_t* follower);
161 
173 WS_DLL_PUBLIC follow_sub_stream_id_func get_follow_sub_stream_id_func(register_follow_t* follower);
174 
178 WS_DLL_PUBLIC tap_packet_status
179 follow_tvb_tap_listener(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const void *data, tap_flags_t flags);
180 
186 WS_DLL_PUBLIC void follow_iterate_followers(wmem_foreach_func func, gpointer user_data);
187 
194 WS_DLL_PUBLIC gchar* follow_get_stat_tap_string(register_follow_t* follower);
195 
200 WS_DLL_PUBLIC void follow_reset_stream(follow_info_t* info);
201 
207 WS_DLL_PUBLIC void follow_info_free(follow_info_t* follow_info);
208 
209 #ifdef __cplusplus
210 }
211 #endif /* __cplusplus */
212 
213 #endif
WS_DLL_PUBLIC void follow_reset_stream(follow_info_t *info)
Definition: follow.c:150
WS_DLL_PUBLIC tap_packet_cb get_follow_tap_handler(register_follow_t *follower)
Definition: follow.c:104
WS_DLL_PUBLIC follow_address_filter_func get_follow_address_func(register_follow_t *follower)
Definition: follow.c:94
WS_DLL_PUBLIC follow_stream_count_func get_follow_stream_count_func(register_follow_t *follower)
Definition: follow.c:109
WS_DLL_PUBLIC follow_conv_filter_func get_follow_conv_func(register_follow_t *follower)
Definition: follow.c:84
WS_DLL_PUBLIC follow_sub_stream_id_func get_follow_sub_stream_id_func(register_follow_t *follower)
Definition: follow.c:114
WS_DLL_PUBLIC void follow_iterate_followers(wmem_foreach_func func, gpointer user_data)
Definition: follow.c:134
WS_DLL_PUBLIC gchar * follow_get_stat_tap_string(register_follow_t *follower)
Definition: follow.c:139
WS_DLL_PUBLIC register_follow_t * get_follow_by_name(const char *proto_short_name)
Definition: follow.c:119
WS_DLL_PUBLIC follow_index_filter_func get_follow_index_func(register_follow_t *follower)
Definition: follow.c:89
WS_DLL_PUBLIC const char * get_follow_tap_string(register_follow_t *follower)
Definition: follow.c:76
WS_DLL_PUBLIC register_follow_t * get_follow_by_proto_id(const int proto_id)
Definition: follow.c:124
WS_DLL_PUBLIC void follow_info_free(follow_info_t *follow_info)
Definition: follow.c:165
WS_DLL_PUBLIC follow_port_to_display_func get_follow_port_to_display(register_follow_t *follower)
Definition: follow.c:99
WS_DLL_PUBLIC int get_follow_proto_id(register_follow_t *follower)
Definition: follow.c:68
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)
Definition: follow.c:204
bool(* wmem_foreach_func)(const void *key, void *value, void *userdata)
Definition: wmem_tree.h:220
Definition: address.h:55
Definition: follow.h:60
guint64 substream_id
Definition: follow.h:72
Definition: packet_info.h:44
Definition: wmem_allocator.h:27
Definition: inet_ipv6.h:21
Definition: epan_dissect.h:28
Definition: follow.h:52
nstime_t abs_ts
Definition: follow.h:56
Definition: file-pcapng.h:57
Definition: nstime.h:26
Definition: follow.c:23
Definition: stream.c:41
tap_packet_status
Definition: tap.h:25
Definition: follow.h:41