2004-02-20 09:09:12 +00:00
|
|
|
/* hostlist_table.h 2004 Ian Schorr
|
|
|
|
* modified from endpoint_talkers_table 2003 Ronnie Sahlberg
|
|
|
|
* Helper routines common to all host talkers taps.
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2004-02-20 09:09:12 +00:00
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2004-02-20 09:09:12 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2008-10-27 04:50:57 +00:00
|
|
|
*
|
2004-02-20 09:09:12 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2008-10-27 04:50:57 +00:00
|
|
|
*
|
2004-02-20 09:09:12 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2008-10-27 04:50:57 +00:00
|
|
|
*
|
2004-02-20 09:09:12 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2010-06-15 21:18:31 +00:00
|
|
|
#ifndef __HOSTLIST_TABLE_H__
|
|
|
|
#define __HOSTLIST_TABLE_H__
|
|
|
|
|
2004-06-03 21:46:27 +00:00
|
|
|
#include "sat.h"
|
|
|
|
|
2004-06-01 21:56:04 +00:00
|
|
|
/** @file
|
|
|
|
* Hostlist definitions.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** Hostlist information */
|
2004-02-20 09:09:12 +00:00
|
|
|
typedef struct _hostlist_talker_t {
|
2004-06-02 06:44:40 +00:00
|
|
|
address address; /**< address */
|
2004-06-01 21:56:04 +00:00
|
|
|
SAT_E sat; /**< address type */
|
|
|
|
guint32 port_type; /**< port_type (e.g. PT_TCP) */
|
2004-06-02 06:44:40 +00:00
|
|
|
guint32 port; /**< port */
|
2004-06-01 21:56:04 +00:00
|
|
|
|
2005-07-07 22:24:28 +00:00
|
|
|
guint64 rx_frames; /**< number of received packets */
|
|
|
|
guint64 tx_frames; /**< number of transmitted packets */
|
|
|
|
guint64 rx_bytes; /**< number of received bytes */
|
|
|
|
guint64 tx_bytes; /**< number of transmitted bytes */
|
2009-10-09 09:01:04 +00:00
|
|
|
|
|
|
|
gboolean modified; /**< new to redraw the row */
|
|
|
|
GtkTreeIter iter;
|
|
|
|
gboolean iter_valid; /**< not a new row */
|
|
|
|
|
2004-02-20 09:09:12 +00:00
|
|
|
} hostlist_talker_t;
|
|
|
|
|
2008-10-27 04:50:57 +00:00
|
|
|
#define NUM_BUILTIN_COLS 8
|
|
|
|
#ifdef HAVE_GEOIP
|
2009-02-04 01:02:59 +00:00
|
|
|
# define NUM_GEOIP_COLS 13
|
2008-10-27 04:50:57 +00:00
|
|
|
#else
|
|
|
|
# define NUM_GEOIP_COLS 0
|
|
|
|
#endif
|
|
|
|
#define NUM_HOSTLIST_COLS (NUM_BUILTIN_COLS + NUM_GEOIP_COLS)
|
|
|
|
|
2004-06-01 21:56:04 +00:00
|
|
|
/** Hostlist widget */
|
2004-02-20 09:09:12 +00:00
|
|
|
typedef struct _hostlist_table {
|
2005-08-06 03:44:55 +00:00
|
|
|
const char *name; /**< the name of the table */
|
2008-02-17 00:35:55 +00:00
|
|
|
const char *filter; /**< the filter used */
|
|
|
|
gboolean use_dfilter; /**< use display filter */
|
2004-06-01 21:56:04 +00:00
|
|
|
GtkWidget *win; /**< GTK window */
|
2008-02-17 00:35:55 +00:00
|
|
|
GtkWidget *page_lb; /**< page label */
|
|
|
|
GtkWidget *name_lb; /**< name label */
|
2004-06-01 23:00:24 +00:00
|
|
|
GtkWidget *scrolled_window; /**< the scrolled window */
|
2009-10-09 09:01:04 +00:00
|
|
|
GtkTreeView *table; /**< the GTK table */
|
2008-10-27 04:50:57 +00:00
|
|
|
const char *default_titles[NUM_HOSTLIST_COLS]; /**< Column headers */
|
2004-06-01 21:56:04 +00:00
|
|
|
GtkWidget *menu; /**< context menu */
|
|
|
|
gboolean has_ports; /**< table has ports */
|
|
|
|
guint32 num_hosts; /**< number of hosts (0 or 1) */
|
2009-10-09 09:01:04 +00:00
|
|
|
GArray *hosts; /**< array of host values */
|
|
|
|
GHashTable *hashtable; /**< conversations hash table */
|
|
|
|
gboolean fixed_col; /**< if switched to fixed column */
|
2004-06-01 21:56:04 +00:00
|
|
|
gboolean resolve_names; /**< resolve address names? */
|
2009-10-09 09:01:04 +00:00
|
|
|
gboolean geoip_visible; /**< if geoip columns are visible */
|
2004-02-20 09:09:12 +00:00
|
|
|
} hostlist_table;
|
|
|
|
|
2004-06-01 21:56:04 +00:00
|
|
|
/** Register the hostlist table for the multiple hostlist window.
|
|
|
|
*
|
|
|
|
* @param hide_ports hide the port columns
|
|
|
|
* @param table_name the table name to be displayed
|
|
|
|
* @param tap_name the registered tap name
|
|
|
|
* @param filter the optional filter name or NULL
|
|
|
|
* @param packet_func the function to be called for each incoming packet
|
|
|
|
*/
|
2007-05-25 19:13:49 +00:00
|
|
|
extern void register_hostlist_table(gboolean hide_ports, const char *table_name, const char *tap_name, const char *filter, tap_packet_cb packet_func);
|
2004-05-02 21:16:09 +00:00
|
|
|
|
2004-06-01 21:56:04 +00:00
|
|
|
/** Init the hostlist table for the single hostlist window.
|
|
|
|
*
|
|
|
|
* @param hide_ports hide the port columns
|
|
|
|
* @param table_name the table name to be displayed
|
|
|
|
* @param tap_name the registered tap name
|
|
|
|
* @param filter the optional filter name or NULL
|
|
|
|
* @param packet_func the function to be called for each incoming packet
|
|
|
|
*/
|
2005-08-05 20:59:08 +00:00
|
|
|
extern void init_hostlist_table(gboolean hide_ports, const char *table_name, const char *tap_name, const char *filter, tap_packet_cb packet_func);
|
2004-02-20 09:09:12 +00:00
|
|
|
|
2004-06-03 21:46:27 +00:00
|
|
|
/** Callback for "Endpoints" statistics item.
|
|
|
|
*
|
|
|
|
* @param w unused
|
|
|
|
* @param d unused
|
|
|
|
*/
|
|
|
|
extern void init_hostlist_notebook_cb(GtkWidget *w, gpointer d);
|
|
|
|
|
2004-06-01 21:56:04 +00:00
|
|
|
/** Add some data to the table.
|
|
|
|
*
|
|
|
|
* @param hl the table to add the data to
|
2004-06-01 23:00:24 +00:00
|
|
|
* @param addr address
|
|
|
|
* @param port port
|
2004-06-01 21:56:04 +00:00
|
|
|
* @param sender TRUE, if this is a sender
|
|
|
|
* @param num_frames number of packets
|
|
|
|
* @param num_bytes number of bytes
|
|
|
|
* @param sat address type
|
|
|
|
* @param port_type the port type (e.g. PT_TCP)
|
|
|
|
*/
|
2005-01-01 12:49:54 +00:00
|
|
|
void add_hostlist_table_data(hostlist_table *hl, const address *addr,
|
2004-06-01 23:00:24 +00:00
|
|
|
guint32 port, gboolean sender, int num_frames, int num_bytes, SAT_E sat, int port_type);
|
2010-06-15 21:18:31 +00:00
|
|
|
|
|
|
|
#endif /* __HOSTLIST_TABLE_H__ */
|