nexmon – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* |
2 | * Copyright 2004-2013, Irene Ruengeler <i.ruengeler [AT] fh-muenster.de> |
||
3 | * |
||
4 | * Wireshark - Network traffic analyzer |
||
5 | * By Gerald Combs <gerald@wireshark.org> |
||
6 | * Copyright 1998 Gerald Combs |
||
7 | * |
||
8 | * This program is free software; you can redistribute it and/or |
||
9 | * modify it under the terms of the GNU General Public License |
||
10 | * as published by the Free Software Foundation; either version 2 |
||
11 | * of the License, or (at your option) any later version. |
||
12 | * |
||
13 | * This program is distributed in the hope that it will be useful, |
||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
16 | * GNU General Public License for more details. |
||
17 | * |
||
18 | * You should have received a copy of the GNU General Public License |
||
19 | * along with this program; if not, write to the Free Software |
||
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
||
21 | */ |
||
22 | |||
23 | #ifndef __TAP_SCTP_ANALYSIS_H__ |
||
24 | #define __TAP_SCTP_ANALYSIS_H__ |
||
25 | |||
26 | #ifdef __cplusplus |
||
27 | extern "C" { |
||
28 | #endif /* __cplusplus */ |
||
29 | |||
30 | #include <epan/dissectors/packet-sctp.h> |
||
31 | #include <epan/address.h> |
||
32 | #ifndef _WIN32 |
||
33 | #include <sys/types.h> |
||
34 | #include <sys/socket.h> |
||
35 | #include <netinet/in.h> |
||
36 | #else |
||
37 | #ifdef HAVE_WINSOCK2_H |
||
38 | #include <winsock2.h> |
||
39 | #endif |
||
40 | #endif |
||
41 | |||
42 | #define CHUNK_TYPE_LENGTH 1 |
||
43 | #define CHUNK_FLAGS_LENGTH 1 |
||
44 | #define CHUNK_LENGTH_LENGTH 2 |
||
45 | |||
46 | #define CHUNK_HEADER_OFFSET 0 |
||
47 | #define CHUNK_TYPE_OFFSET CHUNK_HEADER_OFFSET |
||
48 | #define CHUNK_FLAGS_OFFSET (CHUNK_TYPE_OFFSET + CHUNK_TYPE_LENGTH) |
||
49 | #define CHUNK_LENGTH_OFFSET (CHUNK_FLAGS_OFFSET + CHUNK_FLAGS_LENGTH) |
||
50 | #define CHUNK_VALUE_OFFSET (CHUNK_LENGTH_OFFSET + CHUNK_LENGTH_LENGTH) |
||
51 | |||
52 | #define INIT_CHUNK_INITIATE_TAG_LENGTH 4 |
||
53 | #define INIT_CHUNK_ADV_REC_WINDOW_CREDIT_LENGTH 4 |
||
54 | #define INIT_CHUNK_NUMBER_OF_OUTBOUND_STREAMS_LENGTH 2 |
||
55 | #define INIT_CHUNK_NUMBER_OF_INBOUND_STREAMS_LENGTH 2 |
||
56 | |||
57 | |||
58 | #define INIT_CHUNK_INITIATE_TAG_OFFSET CHUNK_VALUE_OFFSET |
||
59 | #define INIT_CHUNK_ADV_REC_WINDOW_CREDIT_OFFSET (INIT_CHUNK_INITIATE_TAG_OFFSET + \ |
||
60 | INIT_CHUNK_INITIATE_TAG_LENGTH ) |
||
61 | #define INIT_CHUNK_NUMBER_OF_OUTBOUND_STREAMS_OFFSET (INIT_CHUNK_ADV_REC_WINDOW_CREDIT_OFFSET + \ |
||
62 | INIT_CHUNK_ADV_REC_WINDOW_CREDIT_LENGTH ) |
||
63 | #define INIT_CHUNK_NUMBER_OF_INBOUND_STREAMS_OFFSET (INIT_CHUNK_NUMBER_OF_OUTBOUND_STREAMS_OFFSET + \ |
||
64 | INIT_CHUNK_NUMBER_OF_OUTBOUND_STREAMS_LENGTH ) |
||
65 | #define INIT_CHUNK_INITIAL_TSN_OFFSET (INIT_CHUNK_NUMBER_OF_INBOUND_STREAMS_OFFSET + \ |
||
66 | INIT_CHUNK_NUMBER_OF_INBOUND_STREAMS_LENGTH ) |
||
67 | |||
68 | #define DATA_CHUNK_TSN_LENGTH 4 |
||
69 | #define DATA_CHUNK_TSN_OFFSET (CHUNK_VALUE_OFFSET + 0) |
||
70 | #define DATA_CHUNK_STREAM_ID_OFFSET (DATA_CHUNK_TSN_OFFSET + DATA_CHUNK_TSN_LENGTH) |
||
71 | #define DATA_CHUNK_STREAM_ID_LENGTH 2 |
||
72 | #define DATA_CHUNK_STREAM_SEQ_NUMBER_LENGTH 2 |
||
73 | #define DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH 4 |
||
74 | #define I_DATA_CHUNK_RESERVED_LENGTH 2 |
||
75 | #define I_DATA_CHUNK_MID_LENGTH 4 |
||
76 | #define I_DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH 4 |
||
77 | #define I_DATA_CHUNK_FSN_LENGTH 4 |
||
78 | #define I_DATA_CHUNK_RESERVED_OFFSET (DATA_CHUNK_STREAM_ID_OFFSET + \ |
||
79 | DATA_CHUNK_STREAM_ID_LENGTH) |
||
80 | #define I_DATA_CHUNK_MID_OFFSET (I_DATA_CHUNK_RESERVED_OFFSET + \ |
||
81 | I_DATA_CHUNK_RESERVED_LENGTH) |
||
82 | #define I_DATA_CHUNK_PAYLOAD_PROTOCOL_ID_OFFSET (I_DATA_CHUNK_MID_OFFSET + \ |
||
83 | I_DATA_CHUNK_MID_LENGTH) |
||
84 | #define I_DATA_CHUNK_FSN_OFFSET (I_DATA_CHUNK_MID_OFFSET + \ |
||
85 | I_DATA_CHUNK_MID_LENGTH) |
||
86 | #define I_DATA_CHUNK_PAYLOAD_OFFSET (I_DATA_CHUNK_PAYLOAD_PROTOCOL_ID_OFFSET + \ |
||
87 | I_DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH) |
||
88 | #define DATA_CHUNK_HEADER_LENGTH (CHUNK_HEADER_LENGTH + \ |
||
89 | DATA_CHUNK_TSN_LENGTH + \ |
||
90 | DATA_CHUNK_STREAM_ID_LENGTH + \ |
||
91 | DATA_CHUNK_STREAM_SEQ_NUMBER_LENGTH + \ |
||
92 | DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH) |
||
93 | #define I_DATA_CHUNK_HEADER_LENGTH (CHUNK_HEADER_LENGTH + \ |
||
94 | DATA_CHUNK_TSN_LENGTH + \ |
||
95 | DATA_CHUNK_STREAM_ID_LENGTH + \ |
||
96 | I_DATA_CHUNK_RESERVED_LENGTH + \ |
||
97 | I_DATA_CHUNK_MID_LENGTH +\ |
||
98 | I_DATA_CHUNK_PAYLOAD_PROTOCOL_ID_LENGTH) |
||
99 | #define MAX_ADDRESS_LEN 47 |
||
100 | |||
101 | #define SCTP_ABORT_CHUNK_T_BIT 0x01 |
||
102 | |||
103 | #define PARAMETER_TYPE_LENGTH 2 |
||
104 | #define PARAMETER_LENGTH_LENGTH 2 |
||
105 | #define PARAMETER_HEADER_LENGTH (PARAMETER_TYPE_LENGTH + PARAMETER_LENGTH_LENGTH) |
||
106 | |||
107 | #define PARAMETER_HEADER_OFFSET 0 |
||
108 | #define PARAMETER_TYPE_OFFSET PARAMETER_HEADER_OFFSET |
||
109 | #define PARAMETER_LENGTH_OFFSET (PARAMETER_TYPE_OFFSET + PARAMETER_TYPE_LENGTH) |
||
110 | #define PARAMETER_VALUE_OFFSET (PARAMETER_LENGTH_OFFSET + PARAMETER_LENGTH_LENGTH) |
||
111 | |||
112 | #define IPV6_ADDRESS_LENGTH 16 |
||
113 | #define IPV6_ADDRESS_OFFSET PARAMETER_VALUE_OFFSET |
||
114 | #define IPV4_ADDRESS_LENGTH 4 |
||
115 | #define IPV4_ADDRESS_OFFSET PARAMETER_VALUE_OFFSET |
||
116 | #define IPV4ADDRESS_PARAMETER_ID 0x0005 |
||
117 | #define IPV6ADDRESS_PARAMETER_ID 0x0006 |
||
118 | |||
119 | #define SACK_CHUNK_CUMULATIVE_TSN_ACK_LENGTH 4 |
||
120 | #define SACK_CHUNK_CUMULATIVE_TSN_ACK_OFFSET (CHUNK_VALUE_OFFSET + 0) |
||
121 | #define SACK_CHUNK_ADV_REC_WINDOW_CREDIT_LENGTH 4 |
||
122 | #define SACK_CHUNK_ADV_REC_WINDOW_CREDIT_OFFSET (SACK_CHUNK_CUMULATIVE_TSN_ACK_OFFSET + \ |
||
123 | SACK_CHUNK_CUMULATIVE_TSN_ACK_LENGTH) |
||
124 | |||
125 | #define INIT_CHUNK_INITIAL_TSN_LENGTH 4 |
||
126 | #define INIT_CHUNK_FIXED_PARAMETERS_LENGTH (INIT_CHUNK_INITIATE_TAG_LENGTH + \ |
||
127 | INIT_CHUNK_ADV_REC_WINDOW_CREDIT_LENGTH + \ |
||
128 | INIT_CHUNK_NUMBER_OF_OUTBOUND_STREAMS_LENGTH + \ |
||
129 | INIT_CHUNK_NUMBER_OF_INBOUND_STREAMS_LENGTH + \ |
||
130 | INIT_CHUNK_INITIAL_TSN_LENGTH) |
||
131 | #define CHUNK_HEADER_LENGTH (CHUNK_TYPE_LENGTH + \ |
||
132 | CHUNK_FLAGS_LENGTH + \ |
||
133 | CHUNK_LENGTH_LENGTH) |
||
134 | #define INIT_CHUNK_VARIABLE_LENGTH_PARAMETER_OFFSET (INIT_CHUNK_INITIAL_TSN_OFFSET + \ |
||
135 | INIT_CHUNK_INITIAL_TSN_LENGTH ) |
||
136 | |||
137 | /* The below value is 255 */ |
||
138 | #define NUM_CHUNKS 0x100 |
||
139 | |||
140 | /* This variable is used as an index into arrays |
||
141 | * which store the cumulative information corresponding |
||
142 | * all chunks with Chunk Type greater > 16 |
||
143 | * The value for the below variable is 17 |
||
144 | */ |
||
145 | #define OTHER_CHUNKS_INDEX 0xfe |
||
146 | |||
147 | /* VNB */ |
||
148 | /* This variable stores the maximum chunk type value |
||
149 | * that can be associated with a sctp chunk. |
||
150 | */ |
||
151 | #define MAX_SCTP_CHUNK_TYPE 256 |
||
152 | |||
153 | typedef struct _tsn { |
||
154 | guint32 frame_number; |
||
155 | guint32 secs; /* Absolute seconds */ |
||
156 | guint32 usecs; |
||
157 | address src; |
||
158 | address dst; |
||
159 | guint32 first_tsn; |
||
160 | GList *tsns; |
||
161 | } tsn_t; |
||
162 | |||
163 | typedef struct _sctp_tmp_info { |
||
164 | guint16 assoc_id; |
||
165 | guint16 direction; |
||
166 | address src; |
||
167 | address dst; |
||
168 | guint16 port1; |
||
169 | guint16 port2; |
||
170 | guint32 verification_tag1; |
||
171 | guint32 verification_tag2; |
||
172 | guint32 initiate_tag; |
||
173 | guint32 n_tvbs; |
||
174 | } sctp_tmp_info_t; |
||
175 | |||
176 | typedef struct _sctp_min_max { |
||
177 | guint32 tmp_min_secs; |
||
178 | guint32 tmp_min_usecs; |
||
179 | guint32 tmp_max_secs; |
||
180 | guint32 tmp_max_usecs; |
||
181 | guint32 tmp_min_tsn1; |
||
182 | guint32 tmp_min_tsn2; |
||
183 | guint32 tmp_max_tsn1; |
||
184 | guint32 tmp_max_tsn2; |
||
185 | gint tmp_secs; |
||
186 | } sctp_min_max_t; |
||
187 | |||
188 | struct tsn_sort{ |
||
189 | guint32 tsnumber; |
||
190 | guint32 secs; |
||
191 | guint32 usecs; |
||
192 | guint32 offset; |
||
193 | guint32 length; |
||
194 | guint32 framenumber; |
||
195 | }; |
||
196 | |||
197 | typedef struct _sctp_addr_chunk { |
||
198 | guint32 direction; |
||
199 | address *addr; |
||
200 | /* The array is initialized to MAX_SCTP_CHUNK_TYPE |
||
201 | * so that there is no memory overwrite |
||
202 | * when accessed using sctp chunk type as index. |
||
203 | */ |
||
204 | guint32 addr_count[MAX_SCTP_CHUNK_TYPE]; |
||
205 | } sctp_addr_chunk; |
||
206 | |||
207 | typedef struct _sctp_assoc_info { |
||
208 | guint16 assoc_id; |
||
209 | address src; |
||
210 | address dst; |
||
211 | guint16 port1; |
||
212 | guint16 port2; |
||
213 | guint32 verification_tag1; |
||
214 | guint32 verification_tag2; |
||
215 | guint32 initiate_tag; |
||
216 | guint32 n_tvbs; |
||
217 | GList *addr1; |
||
218 | GList *addr2; |
||
219 | guint16 instream1; |
||
220 | guint16 outstream1; |
||
221 | guint16 instream2; |
||
222 | guint16 outstream2; |
||
223 | guint32 n_adler32_calculated; |
||
224 | guint32 n_adler32_correct; |
||
225 | guint32 n_crc32c_calculated; |
||
226 | guint32 n_crc32c_correct; |
||
227 | gchar checksum_type[8]; |
||
228 | guint32 n_checksum_errors; |
||
229 | guint32 n_bundling_errors; |
||
230 | guint32 n_padding_errors; |
||
231 | guint32 n_length_errors; |
||
232 | guint32 n_value_errors; |
||
233 | guint32 n_data_chunks; |
||
234 | guint32 n_forward_chunks; |
||
235 | guint32 n_forward_chunks_ep1; |
||
236 | guint32 n_forward_chunks_ep2; |
||
237 | guint32 n_data_bytes; |
||
238 | guint32 n_packets; |
||
239 | guint32 n_data_chunks_ep1; |
||
240 | guint32 n_data_bytes_ep1; |
||
241 | guint32 n_data_chunks_ep2; |
||
242 | guint32 n_data_bytes_ep2; |
||
243 | guint32 n_sack_chunks_ep1; |
||
244 | guint32 n_sack_chunks_ep2; |
||
245 | guint32 n_array_tsn1; |
||
246 | guint32 n_array_tsn2; |
||
247 | guint32 max_window1; |
||
248 | guint32 max_window2; |
||
249 | guint32 arwnd1; |
||
250 | guint32 arwnd2; |
||
251 | gboolean init; |
||
252 | gboolean initack; |
||
253 | guint16 initack_dir; |
||
254 | guint16 direction; |
||
255 | guint32 min_secs; |
||
256 | guint32 min_usecs; |
||
257 | guint32 max_secs; |
||
258 | guint32 max_usecs; |
||
259 | guint32 min_tsn1; |
||
260 | guint32 min_tsn2; |
||
261 | guint32 max_tsn1; |
||
262 | guint32 max_tsn2; |
||
263 | guint32 max_bytes1; |
||
264 | guint32 max_bytes2; |
||
265 | GSList *min_max; |
||
266 | GList *frame_numbers; |
||
267 | GList *tsn1; |
||
268 | GPtrArray *sort_tsn1; |
||
269 | GPtrArray *sort_sack1; |
||
270 | GList *sack1; |
||
271 | GList *tsn2; |
||
272 | GPtrArray *sort_tsn2; |
||
273 | GPtrArray *sort_sack2; |
||
274 | GList *sack2; |
||
275 | gboolean check_address; |
||
276 | GList* error_info_list; |
||
277 | /* The array is initialized to MAX_SCTP_CHUNK_TYPE |
||
278 | * so that there is no memory overwrite |
||
279 | * when accessed using sctp chunk type as index. |
||
280 | */ |
||
281 | guint32 chunk_count[MAX_SCTP_CHUNK_TYPE]; |
||
282 | guint32 ep1_chunk_count[MAX_SCTP_CHUNK_TYPE]; |
||
283 | guint32 ep2_chunk_count[MAX_SCTP_CHUNK_TYPE]; |
||
284 | GList *addr_chunk_count; |
||
285 | } sctp_assoc_info_t; |
||
286 | |||
287 | typedef struct _sctp_error_info { |
||
288 | guint32 frame_number; |
||
289 | gchar chunk_info[200]; |
||
290 | const gchar *info_text; |
||
291 | } sctp_error_info_t; |
||
292 | |||
293 | |||
294 | typedef struct _sctp_allassocs_info { |
||
295 | guint32 sum_tvbs; |
||
296 | GList *assoc_info_list; |
||
297 | gboolean is_registered; |
||
298 | GList *children; |
||
299 | } sctp_allassocs_info_t; |
||
300 | |||
301 | |||
302 | |||
303 | void register_tap_listener_sctp_stat(void); |
||
304 | |||
305 | const sctp_allassocs_info_t* sctp_stat_get_info(void); |
||
306 | |||
307 | void sctp_stat_scan(void); |
||
308 | |||
309 | void remove_tap_listener_sctp_stat(void); |
||
310 | |||
311 | |||
312 | const sctp_assoc_info_t* get_selected_assoc(void); |
||
313 | |||
314 | #ifdef __cplusplus |
||
315 | } |
||
316 | #endif /* __cplusplus */ |
||
317 | |||
318 | #endif /* __TAP_SCTP_ANALYSIS_H__ */ |
||
319 | |||
320 | /* |
||
321 | * Editor modelines - http://www.wireshark.org/tools/modelines.html |
||
322 | * |
||
323 | * Local variables: |
||
324 | * c-basic-offset: 8 |
||
325 | * tab-width: 8 |
||
326 | * indent-tabs-mode: t |
||
327 | * End: |
||
328 | * |
||
329 | * vi: set shiftwidth=8 tabstop=8 noexpandtab: |
||
330 | * :indentSize=8:tabSize=8:noTabs=false: |
||
331 | */ |