1 /* hostlist_sctp.c 2008 Stig Bjorlykke
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 #include "epan/packet.h"
31 #include <epan/stat_cmd_args.h>
33 #include <epan/dissectors/packet-sctp.h>
35 #include "../stat_menu.h"
37 #include "ui/gtk/gui_stat_menu.h"
38 #include "ui/gtk/hostlist_table.h"
41 sctp_hostlist_packet(void *pit
, packet_info
*pinfo
, epan_dissect_t
*edt _U_
, const void *vip
)
43 hostlist_table
*hosts
=(hostlist_table
*)pit
;
44 const struct _sctp_info
*sctphdr
=(struct _sctp_info
*)vip
;
46 /* Take two "add" passes per packet, adding for each direction, ensures that all
47 packets are counted properly (even if address is sending to itself)
48 XXX - this could probably be done more efficiently inside hostlist_table */
49 add_hostlist_table_data(hosts
, &sctphdr
->ip_src
, sctphdr
->sport
, TRUE
, 1,
50 pinfo
->fd
->pkt_len
, SAT_NONE
, PT_SCTP
);
51 add_hostlist_table_data(hosts
, &sctphdr
->ip_dst
, sctphdr
->dport
, FALSE
, 1,
52 pinfo
->fd
->pkt_len
, SAT_NONE
, PT_SCTP
);
58 gtk_sctp_hostlist_init(const char *opt_arg
, void* userdata _U_
)
60 const char *filter
=NULL
;
62 if(!strncmp(opt_arg
,"hosts,sctp,",11)){
68 init_hostlist_table(FALSE
, "SCTP", "sctp", filter
, sctp_hostlist_packet
);
72 gtk_sctp_hostlist_cb(GtkAction
*action _U_
, gpointer user_data _U_
)
74 gtk_sctp_hostlist_init("hosts,sctp",NULL
);
78 register_tap_listener_sctp_hostlist(void)
80 register_stat_cmd_arg("hosts,sctp", gtk_sctp_hostlist_init
,NULL
);
81 register_hostlist_table(FALSE
, "SCTP", "sctp", NULL
/*filter*/, sctp_hostlist_packet
);