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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 #ifdef HAVE_SYS_TYPES_H
29 # include <sys/types.h>
35 #include "epan/packet.h"
36 #include <epan/stat_cmd_args.h>
38 #include <epan/dissectors/packet-sctp.h>
40 #include "../stat_menu.h"
42 #include "gtk/gui_stat_menu.h"
43 #include "gtk/hostlist_table.h"
47 sctp_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
49 hostlist_table *hosts=(hostlist_table *)pit;
50 const struct _sctp_info *sctphdr=vip;
52 /* Take two "add" passes per packet, adding for each direction, ensures that all
53 packets are counted properly (even if address is sending to itself)
54 XXX - this could probably be done more efficiently inside hostlist_table */
55 add_hostlist_table_data(hosts, &sctphdr->ip_src, sctphdr->sport, TRUE, 1,
56 pinfo->fd->pkt_len, SAT_NONE, PT_SCTP);
57 add_hostlist_table_data(hosts, &sctphdr->ip_dst, sctphdr->dport, FALSE, 1,
58 pinfo->fd->pkt_len, SAT_NONE, PT_SCTP);
64 gtk_sctp_hostlist_init(const char *optarg, void* userdata _U_)
66 const char *filter=NULL;
68 if(!strncmp(optarg,"hosts,sctp,",11)){
74 init_hostlist_table(FALSE, "SCTP", "sctp", filter, sctp_hostlist_packet);
79 gtk_sctp_hostlist_cb(GtkWidget *w _U_, gpointer d _U_)
81 gtk_sctp_hostlist_init("hosts,sctp",NULL);
86 register_tap_listener_sctp_hostlist(void)
88 register_stat_cmd_arg("hosts,sctp", gtk_sctp_hostlist_init,NULL);
90 register_stat_menu_item("SCTP", REGISTER_STAT_GROUP_ENDPOINT_LIST,
91 gtk_sctp_hostlist_cb, NULL, NULL, NULL);
93 register_hostlist_table(FALSE, "SCTP", "sctp", NULL /*filter*/, sctp_hostlist_packet);