2 * Copyright 2004, Irene Ruengeler <i.ruengeler [AT] fh-muenster.de>
4 * $Id: sctp_stat.h 11436 2004-07-19 21:42:01Z tuexen $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@ethereal.com>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #include <epan/dissectors/packet-sctp.h>
26 #include <sys/types.h>
27 #include <sys/socket.h>
28 #include <netinet/in.h>
30 #define SCTP_DATA_CHUNK_ID 0
31 #define SCTP_INIT_CHUNK_ID 1
32 #define SCTP_INIT_ACK_CHUNK_ID 2
33 #define SCTP_SACK_CHUNK_ID 3
35 #define CHUNK_TYPE_LENGTH 1
36 #define CHUNK_FLAGS_LENGTH 1
37 #define CHUNK_LENGTH_LENGTH 2
39 #define CHUNK_HEADER_OFFSET 0
40 #define CHUNK_TYPE_OFFSET CHUNK_HEADER_OFFSET
41 #define CHUNK_FLAGS_OFFSET (CHUNK_TYPE_OFFSET + CHUNK_TYPE_LENGTH)
42 #define CHUNK_LENGTH_OFFSET (CHUNK_FLAGS_OFFSET + CHUNK_FLAGS_LENGTH)
43 #define CHUNK_VALUE_OFFSET (CHUNK_LENGTH_OFFSET + CHUNK_LENGTH_LENGTH)
45 #define INIT_CHUNK_INITIATE_TAG_LENGTH 4
46 #define INIT_CHUNK_ADV_REC_WINDOW_CREDIT_LENGTH 4
47 #define INIT_CHUNK_NUMBER_OF_OUTBOUND_STREAMS_LENGTH 2
48 #define INIT_CHUNK_NUMBER_OF_INBOUND_STREAMS_LENGTH 2
51 #define INIT_CHUNK_INITIATE_TAG_OFFSET CHUNK_VALUE_OFFSET
52 #define INIT_CHUNK_ADV_REC_WINDOW_CREDIT_OFFSET (INIT_CHUNK_INITIATE_TAG_OFFSET + \
53 INIT_CHUNK_INITIATE_TAG_LENGTH )
54 #define INIT_CHUNK_NUMBER_OF_OUTBOUND_STREAMS_OFFSET (INIT_CHUNK_ADV_REC_WINDOW_CREDIT_OFFSET + \
55 INIT_CHUNK_ADV_REC_WINDOW_CREDIT_LENGTH )
56 #define INIT_CHUNK_NUMBER_OF_INBOUND_STREAMS_OFFSET (INIT_CHUNK_NUMBER_OF_OUTBOUND_STREAMS_OFFSET + \
57 INIT_CHUNK_NUMBER_OF_OUTBOUND_STREAMS_LENGTH )
58 #define INIT_CHUNK_INITIAL_TSN_OFFSET (INIT_CHUNK_NUMBER_OF_INBOUND_STREAMS_OFFSET + \
59 INIT_CHUNK_NUMBER_OF_INBOUND_STREAMS_LENGTH )
61 #define DATA_CHUNK_TSN_LENGTH 4
62 #define DATA_CHUNK_TSN_OFFSET (CHUNK_VALUE_OFFSET + 0)
63 #define DATA_CHUNK_STREAM_ID_OFFSET (DATA_CHUNK_TSN_OFFSET + DATA_CHUNK_TSN_LENGTH)
66 typedef struct _v4address {
74 guint32 secs; /* Absolute seconds */
76 struct sockaddr_storage src;
77 struct sockaddr_storage dst;
81 typedef struct _sctp_tmp_info {
82 struct sockaddr_storage src;
83 struct sockaddr_storage dst;
86 guint32 verification_tag1;
87 guint32 verification_tag2;
91 typedef struct _sctp_min_max {
93 guint32 tmp_min_usecs;
95 guint32 tmp_max_usecs;
112 typedef struct _sctp_assoc_info {
114 struct sockaddr_storage src;
115 struct sockaddr_storage dst;
118 guint32 verification_tag1;
119 guint32 verification_tag2;
127 guint32 n_adler32_calculated;
128 guint32 n_adler32_correct;
129 guint32 n_crc32c_calculated;
130 guint32 n_crc32c_correct;
131 char checksum_type[8];
132 guint32 n_checksum_errors;
133 guint32 n_bundling_errors;
134 guint32 n_padding_errors;
135 guint32 n_length_errors;
136 guint32 n_value_errors;
137 guint32 n_data_chunks;
138 guint32 n_data_bytes;
140 guint32 n_data_chunks_ep1;
141 guint32 n_data_bytes_ep1;
142 guint32 n_data_chunks_ep2;
143 guint32 n_data_bytes_ep2;
144 guint32 n_sack_chunks_ep1;
145 guint32 n_sack_chunks_ep2;
146 guint32 n_array_tsn1;
147 guint32 n_array_tsn2;
165 GList *frame_numbers;
174 gboolean check_address;
175 GList* error_info_list;
178 typedef struct _sctp_error_info {
179 guint32 frame_number;
180 char chunk_info[200];
185 typedef struct _sctp_allassocs_info {
187 GList* assoc_info_list;
188 gboolean is_registered;
190 } sctp_allassocs_info_t;
193 //Data structures for sctp_assoc_analyse
196 GtkWidget *checktype;
202 GtkWidget *chunks_ep1;
203 GtkWidget *bytes_ep1;
204 GtkWidget *chunks_ep2;
205 GtkWidget *bytes_ep2;
211 GtkWidget *addr_frame;
212 GtkWidget *scrolled_window;
222 struct sctp_analyse {
223 sctp_assoc_info_t* assoc;
225 struct notes *analyse_nb;
227 guint16 num_children;
230 //Data Structures for sctp_graph_dlg
232 typedef struct _sctp_graph_t {
233 gboolean needs_redraw;
237 GtkWidget *draw_area;
258 guint32 tmp_min_tsn1;
259 guint32 tmp_max_tsn1;
260 guint32 tmp_min_tsn2;
261 guint32 tmp_max_tsn2;
271 sctp_assoc_info_t * assoc;
273 struct sctp_analyse* parent;
278 void register_tap_listener_sctp_stat(void);
280 const sctp_allassocs_info_t* sctp_stat_get_info(void);
282 void sctp_stat_scan(void);
284 void remove_tap_listener_sctp_stat(void);
286 void reset(sctp_allassocs_info_t *tapdata _U_);
289 void assoc_analyse(sctp_assoc_info_t* assoc);
291 const sctp_assoc_info_t* get_selected_assoc(void);
293 void create_graph(guint16 dir, struct sctp_analyse* u_data);
295 void create_byte_graph(guint16 dir, struct sctp_analyse* u_data);
297 void sctp_error_dlg_show();
299 void sctp_stat_dlg_update(void);
301 GtkWidget *get_stat_dlg(void);
303 void update_analyse_dlg(struct sctp_analyse* u_data);
305 void sctp_analyse_start(GtkWidget *w _U_, gpointer data _U_);
307 void increase_childcount(struct sctp_analyse *parent);
309 void decrease_childcount(struct sctp_analyse *parent);
311 void set_child(struct sctp_udata *child, struct sctp_analyse *parent);
313 void remove_child(struct sctp_udata *child, struct sctp_analyse *parent);
315 void decrease_analyse_childcount();
317 void increase_analyse_childcount();
319 void set_analyse_child(struct sctp_analyse *child);
321 void remove_analyse_child(struct sctp_analyse *child);