Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
follow.h
1 /* follow.h
2  *
3  * Copyright 1998 Mike Hall <mlh@io.com>
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 
13 #ifndef __FOLLOW_H__
14 #define __FOLLOW_H__
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
19 
20 #include <epan/epan.h>
21 #include <epan/packet.h>
22 #include <epan/ipv6.h>
23 #include <epan/wmem/wmem.h>
24 #include "ws_symbol_export.h"
25 
26 typedef enum {
27  TCP_STREAM = 0,
28  UDP_STREAM,
29  MAX_STREAM
30 } stream_type;
31 
32 typedef enum {
33  FRS_OK,
34  FRS_OPEN_ERROR,
35  FRS_READ_ERROR,
36  FRS_PRINT_ERROR
37 } frs_return_t;
38 
39 /* Type of follow we are doing */
40 typedef enum {
41  FOLLOW_TCP,
42  FOLLOW_SSL,
43  FOLLOW_UDP,
44  FOLLOW_HTTP
45 } follow_type_t;
46 
47 /* Show Type */
48 typedef enum {
49  SHOW_ASCII,
50  SHOW_EBCDIC,
51  SHOW_HEXDUMP,
52  SHOW_CARRAY,
53  SHOW_RAW,
54  SHOW_YAML,
55  SHOW_UTF8,
56  SHOW_UTF16
57 } show_type_t;
58 
59 
60 /* Show Stream */
61 typedef enum {
62  FROM_CLIENT,
63  FROM_SERVER,
64  BOTH_HOSTS
65 } show_stream_t;
66 
67 typedef union _stream_addr {
68  guint32 ipv4;
69  ws_in6_addr ipv6;
70 } stream_addr;
71 
72 struct _follow_info;
73 
74 typedef gboolean (*follow_print_line_func)(char *, size_t, gboolean, void *);
75 typedef frs_return_t (*follow_read_stream_func)(struct _follow_info *follow_info, follow_print_line_func follow_print, void *arg);
76 
77 typedef struct {
78  gboolean is_server;
79  guint32 packet_num;
80  guint32 seq; /* TCP only */
81  GByteArray *data;
83 
84 typedef struct _follow_info {
85  show_stream_t show_stream;
86  char *filter_out_filter;
87  GList *payload;
88  guint bytes_written[2]; /* Index with FROM_CLIENT or FROM_SERVER for readability. */
89  guint32 seq[2]; /* TCP only */
90  GList *fragments[2]; /* TCP only */
91  guint client_port;
92  guint server_port;
93  address client_ip;
94  address server_ip;
95  void* gui_data;
97 
98 struct register_follow;
99 typedef struct register_follow register_follow_t;
100 
101 typedef gchar* (*follow_conv_filter_func)(packet_info* pinfo, int* stream);
102 typedef gchar* (*follow_index_filter_func)(int stream);
103 typedef gchar* (*follow_address_filter_func)(address* src_addr, address* dst_addr, int src_port, int dst_port);
104 typedef gchar* (*follow_port_to_display_func)(wmem_allocator_t *allocator, guint port);
105 typedef gboolean (*follow_tap_func)(void *tapdata, packet_info *pinfo, epan_dissect_t *edt, const void *data);
106 
107 WS_DLL_PUBLIC
108 void register_follow_stream(const int proto_id, const char* tap_listener,
109  follow_conv_filter_func conv_filter, follow_index_filter_func index_filter, follow_address_filter_func address_filter,
110  follow_port_to_display_func port_to_display, follow_tap_func tap_handler);
111 
117 WS_DLL_PUBLIC int get_follow_proto_id(register_follow_t* follower);
118 
124 WS_DLL_PUBLIC const char* get_follow_tap_string(register_follow_t* follower);
125 
131 WS_DLL_PUBLIC register_follow_t* get_follow_by_name(const char* proto_short_name);
132 
138 WS_DLL_PUBLIC follow_conv_filter_func get_follow_conv_func(register_follow_t* follower);
139 
145 WS_DLL_PUBLIC follow_index_filter_func get_follow_index_func(register_follow_t* follower);
146 
152 WS_DLL_PUBLIC follow_address_filter_func get_follow_address_func(register_follow_t* follower);
153 
159 WS_DLL_PUBLIC follow_port_to_display_func get_follow_port_to_display(register_follow_t* follower);
160 
166 WS_DLL_PUBLIC follow_tap_func get_follow_tap_handler(register_follow_t* follower);
167 
168 
172 WS_DLL_PUBLIC gboolean
173 follow_tvb_tap_listener(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const void *data);
174 
180 WS_DLL_PUBLIC void follow_iterate_followers(wmem_foreach_func func, gpointer user_data);
181 
188 WS_DLL_PUBLIC gchar* follow_get_stat_tap_string(register_follow_t* follower);
189 
194 WS_DLL_PUBLIC void follow_reset_stream(follow_info_t* info);
195 
201 WS_DLL_PUBLIC void follow_info_free(follow_info_t* follow_info);
202 
203 #ifdef __cplusplus
204 }
205 #endif /* __cplusplus */
206 
207 #endif
Definition: inet_ipv6.h:20
Definition: packet_info.h:44
gboolean(* wmem_foreach_func)(const void *key, void *value, void *userdata)
Definition: wmem_tree.h:213
Definition: file-pcapng.c:177
Definition: follow.h:84
Definition: follow.h:67
Definition: follow.h:77
Definition: wmem_allocator.h:26
Definition: stream.c:40
Definition: follow.c:23
Definition: epan_dissect.h:28
Definition: address.h:47