Wireshark 2.9.0-477-g68ec514b The Wireshark network protocol analyzer

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

- File List
- File Members

packet-f5ethtrailer.h
1 /* packet-f5ethtrailer.h
2 *
3 * F5 Ethernet Trailer Copyright 2008-2017 F5 Networks
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8 /* How to use the fileinfo version tap
9 *
10 * Captures taken on an F5 device in versions 11.2.0 and later contain an
11 * initial packet that has information about how the capture was taken and
12 * about the device it was taken on (tcpdump command line, platform, version,
13 * etc.). This tap allows other dissectors to obtain the version of BIG-IP
14 * software (if it is available).
15 *
16 * There are two functions defined in this header file (f5fileinfo_tap_reset()
17 * and f5fileinfo_tap_pkt()). These functions are registered with the tap and
18 * will populate a structure provided by you with the version information.
19 *
20 * Step 1: Define a static variable of type "struct f5fileinfo". This is where
21 * the version information will be stored.
22 * static struct f5fileinfo myver = F5FILEINFO_TAP_DATA_INIT;
23 *
24 * Step 2: Register with the tap listener using the macro provided in your
25 * proto_reg_handoff function:
26 * F5FILEINFO_TAP_LISTEN(&myver);
27 *
28 * Step 3: Use the version information in other parts of your code.
29 * if(myver.ver[0] == 11) {
30 * ...
31 * }
32 *
33 * If you need to do something additional when you run into a version, you can
34 * define the F5FILEINFO_TAP_POST_FUNC macro before including this header file
35 * to be the name of a fuction to call at the end of the tap function. This
36 * function must have a prototype of
37 * static void F5FILEINFO_TAP_POST_FUNC(struct f5fileinfo_tap_data *);
38 * Note that this function also gets called with version of all zeroes when the
39 * tap gets reset (reload file).
40 * Note that this function does not get called if the version number does not
41 * change.
42 * Example:
43 * #define F5FILEINFO_TAP_POST_FUNC f5info_tap_local
44 * #include <epan/dissectors/packet-f5ethtrailer.h>
45 * ...
46 * static void f5info_tap_local(struct f5fileinfo_tap_data *tap_data)
47 * {
48 * ...
49 * }
50 */
51
52 #ifndef _PACKETH_F5ETHTRAILER_H_
53 #define _PACKETH_F5ETHTRAILER_H_
54
55 #include <glib.h>
56
57 #define F5ETH_TAP_TMM_MAX G_MAXUINT16
58 #define F5ETH_TAP_TMM_BITS 16
59 #define F5ETH_TAP_SLOT_MAX G_MAXUINT16
60 #define F5ETH_TAP_SLOT_BITS 16
61
68 #define F5ETH_TAP_MAGIC 0x68744521
69
71 typedef struct f5eth_tap_data {
72 guint32 magic;
73 guint32 trailer_len;
74 /* 64 bit align */
75 guint64 flow;
76 guint64 peer_flow;
77 /* 64 bit align */
78 gchar *virtual_name;
79 guint16 slot;
80 guint16 tmm;
81 guint8 noise_low:1;
82 guint8 noise_med:1;
83 guint8 noise_high:1;
84 guint8 flows_set:1;
85 guint8 ingress:2;
86 } f5eth_tap_data_t;
87
100 inline static int check_f5eth_tap_magic(f5eth_tap_data_t *tdata)
101 {
102 return(tdata->magic == F5ETH_TAP_MAGIC ? 1 : 0);
103 } /* check_f5eth_tap_magic() */
104
105 #define F5FILEINFO_TAP_MAGIC 0x46350001
106
108 struct f5fileinfo_tap_data {
109 guint32 magic;
110 guint32 ver[6];
111 };
112
113 #define F5FILEINFO_TAP_DATA_INIT { 0, { 0, 0, 0, 0, 0, 0 } }
114
115 #define F5VER_KNOWN(v) ((v)->ver[0] > 0)
116
117
118 #define F5VER_GE_11_2(v) (((v)->ver[0] > 11) \
119 || ((v)->ver[0] == 11 && (v)->ver[1] >= 2))
120
121 #define F5VER_GE_11_2_1(v) (((v)->ver[0] > 11) \
122 || ((v)->ver[0] == 11 && (v)->ver[1] > 2) \
123 || ((v)->ver[0] == 11 && (v)->ver[1] == 2 && (v)->ver[2] >= 1))
124
125 #define F5VER_GE_11_3(v) (((v)->ver[0] > 11) \
126 || ((v)->ver[0] == 11 && (v)->ver[1] >= 3))
127
128 #define F5VER_GE_11_4(v) (((v)->ver[0] > 11) \
129 || ((v)->ver[0] == 11 && (v)->ver[1] >= 4))
130
131 #define F5VER_GE_11_4_1(v) (((v)->ver[0] > 11) \
132 || ((v)->ver[0] == 11 && (v)->ver[1] > 4) \
133 || ((v)->ver[0] == 11 && (v)->ver[1] == 4 && (v)->ver[2] >= 1))
134
135 #define F5VER_GE_11_5(v) (((v)->ver[0] > 11) \
136 || ((v)->ver[0] == 11 && (v)->ver[1] >= 5))
137
138 #define F5VER_GE_11_5_1(v) (((v)->ver[0] > 11) \
139 || ((v)->ver[0] == 11 && (v)->ver[1] > 5) \
140 || ((v)->ver[0] == 11 && (v)->ver[1] == 5 && (v)->ver[2] >= 1))
141
142 #define F5VER_GE_11_6(v) (((v)->ver[0] > 11) \
143 || ((v)->ver[0] == 11 && (v)->ver[1] >= 6))
144
145 #define F5VER_GE_12_0(v) (((v)->ver[0] >= 12))
146
147
148 #ifndef F5FILEINFOTAP_SRC
149
150 #ifdef F5FILEINFO_TAP_POST_FUNC
151 static void F5FILEINFO_TAP_POST_FUNC(struct f5fileinfo_tap_data *);
152 #endif
153
154 static void f5fileinfo_tap_reset(void *p)
155 {
156 struct f5fileinfo_tap_data *s;
157
158 s = (struct f5fileinfo_tap_data *)p;
159 s->ver[0] = 0;
160 s->ver[1] = 0;
161 s->ver[2] = 0;
162 s->ver[3] = 0;
163 s->ver[4] = 0;
164 s->ver[5] = 0;
165 # ifdef F5FILEINFO_TAP_POST_FUNC
166 F5FILEINFO_TAP_POST_FUNC(s);
167 # endif
168 } /* f5fileinfo_tap_reset() */
169
170 static gboolean f5fileinfo_tap_pkt(
171 void *tapdata,
172 packet_info *pinfo _U_,
173 epan_dissect_t *edt _U_,
174 const void *data
175 ) {
176 struct f5fileinfo_tap_data *s;
177 struct f5fileinfo_tap_data *fromtap;
178
179 s = (struct f5fileinfo_tap_data *)tapdata;
180 fromtap = (struct f5fileinfo_tap_data *)data;
181 if(fromtap->magic != F5FILEINFO_TAP_MAGIC) {
182 /* Magic numbers do not match. f5ethtrailer plugin was compiled from
183 * different source than this plugin. */
184 return(FALSE);
185 }
186 if (s->ver[0] == fromtap->ver[0] &&
187 s->ver[1] == fromtap->ver[1] &&
188 s->ver[2] == fromtap->ver[2] &&
189 s->ver[3] == fromtap->ver[3] &&
190 s->ver[4] == fromtap->ver[4] &&
191 s->ver[5] == fromtap->ver[5])
192 {
193 return(FALSE);
194 }
195 s->ver[0] = fromtap->ver[0];
196 s->ver[1] = fromtap->ver[1];
197 s->ver[2] = fromtap->ver[2];
198 s->ver[3] = fromtap->ver[3];
199 s->ver[4] = fromtap->ver[4];
200 s->ver[5] = fromtap->ver[5];
201 # ifdef F5FILEINFO_TAP_POST_FUNC
202 F5FILEINFO_TAP_POST_FUNC(s);
203 # endif
204 return(TRUE);
205 } /* f5fileinfo_tap_pkt() */
206
207
208 #define F5FILEINFO_TAP_LISTEN(a) \
209 register_tap_listener("f5fileinfo", (a), NULL, TL_REQUIRES_NOTHING, f5fileinfo_tap_reset, f5fileinfo_tap_pkt, NULL)
210
211
212 #endif /* ifndef F5INFOTAP_SRC */
213
214
215 #endif /* ifndef _PACKETH_F5ETHTRAILER_H_ */
f5fileinfo_tap_data::ver
guint32 ver[6]
Definition: packet-f5ethtrailer.h:110
f5eth_tap_data::noise_med
guint8 noise_med
Definition: packet-f5ethtrailer.h:82
_packet_info
Definition: packet_info.h:44
f5eth_tap_data::trailer_len
guint32 trailer_len
Definition: packet-f5ethtrailer.h:73
f5eth_tap_data::virtual_name
gchar * virtual_name
Definition: packet-f5ethtrailer.h:78
f5eth_tap_data::flows_set
guint8 flows_set
Definition: packet-f5ethtrailer.h:84
f5fileinfo_tap_data
Definition: packet-f5ethtrailer.h:108
f5eth_tap_data::ingress
guint8 ingress
Definition: packet-f5ethtrailer.h:85
f5eth_tap_data::noise_low
guint8 noise_low
Definition: packet-f5ethtrailer.h:81
f5eth_tap_data
Definition: packet-f5ethtrailer.h:71
f5eth_tap_data::flow
guint64 flow
Definition: packet-f5ethtrailer.h:75
f5eth_tap_data::slot
guint16 slot
Definition: packet-f5ethtrailer.h:79
f5eth_tap_data::tmm
guint16 tmm
Definition: packet-f5ethtrailer.h:80
f5eth_tap_data::peer_flow
guint64 peer_flow
Definition: packet-f5ethtrailer.h:76
f5eth_tap_data::noise_high
guint8 noise_high
Definition: packet-f5ethtrailer.h:83
epan_dissect
Definition: epan_dissect.h:28
f5fileinfo_tap_data::magic
guint32 magic
Definition: packet-f5ethtrailer.h:109
f5eth_tap_data::magic
guint32 magic
Definition: packet-f5ethtrailer.h:72