Replace "svn" with "git" all over the place.
[metze/wireshark/wip.git] / ui / gtk / hostlist_table.h
1 /* hostlist_table.h   2004 Ian Schorr
2  * modified from endpoint_talkers_table   2003 Ronnie Sahlberg
3  * Helper routines common to all host talkers taps.
4  *
5  * $Id$
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  */
25
26 #ifndef __HOSTLIST_TABLE_H__
27 #define __HOSTLIST_TABLE_H__
28
29 #include "sat.h"
30
31 /** @file
32  *  Hostlist definitions.
33  */
34
35 /** Hostlist information */
36 typedef struct _hostlist_talker_t {
37         address myaddress;      /**< address */
38         SAT_E   sat;            /**< address type */
39         guint32 port_type;      /**< port_type (e.g. PT_TCP) */
40         guint32 port;           /**< port */
41
42         guint64 rx_frames;      /**< number of received packets */
43         guint64 tx_frames;      /**< number of transmitted packets */
44         guint64 rx_bytes;       /**< number of received bytes */
45         guint64 tx_bytes;       /**< number of transmitted bytes */
46
47         gboolean modified;      /**< new to redraw the row */   
48         GtkTreeIter iter; 
49         gboolean iter_valid;    /**< not a new row */
50
51 } hostlist_talker_t;
52
53 #define NUM_BUILTIN_COLS 8
54 #ifdef HAVE_GEOIP
55 # define NUM_GEOIP_COLS 13
56 #else
57 # define NUM_GEOIP_COLS 0
58 #endif
59 #define NUM_HOSTLIST_COLS (NUM_BUILTIN_COLS + NUM_GEOIP_COLS)
60
61 /** Hostlist widget */
62 typedef struct _hostlist_table {
63         const char          *name;              /**< the name of the table */
64         const char          *filter;            /**< the filter used */
65         gboolean             use_dfilter;       /**< use display filter */
66         GtkWidget           *win;               /**< GTK window */
67         GtkWidget           *page_lb;           /**< page label */
68         GtkWidget           *name_lb;           /**< name label */
69         GtkWidget           *scrolled_window;   /**< the scrolled window */
70         GtkTreeView         *table;             /**< the GTK table */
71         const char          *default_titles[NUM_HOSTLIST_COLS]; /**< Column headers */
72         GtkWidget           *menu;              /**< context menu */
73         gboolean            has_ports;          /**< table has ports */
74         guint32             num_hosts;          /**< number of hosts (0 or 1) */
75         GArray              *hosts;             /**< array of host values */
76         GHashTable          *hashtable;         /**< conversations hash table */
77         gboolean            fixed_col;          /**< if switched to fixed column */
78         gboolean            resolve_names;      /**< resolve address names? */
79         gboolean            geoip_visible;      /**< if geoip columns are visible */
80 } hostlist_table;
81
82 /** Register the hostlist table for the multiple hostlist window.
83  *
84  * @param hide_ports hide the port columns
85  * @param table_name the table name to be displayed
86  * @param tap_name the registered tap name
87  * @param filter the optional filter name or NULL
88  * @param packet_func the function to be called for each incoming packet
89  */
90 extern void register_hostlist_table(gboolean hide_ports, const char *table_name, const char *tap_name, const char *filter, tap_packet_cb packet_func);
91
92 /** Init the hostlist table for the single hostlist window.
93  *
94  * @param hide_ports hide the port columns
95  * @param table_name the table name to be displayed
96  * @param tap_name the registered tap name
97  * @param filter the optional filter name or NULL
98  * @param packet_func the function to be called for each incoming packet
99  */
100 extern void init_hostlist_table(gboolean hide_ports, const char *table_name, const char *tap_name, const char *filter, tap_packet_cb packet_func);
101
102 /** Callback for "Endpoints" statistics item.
103  *
104  * @param w unused
105  * @param d unused
106  */
107 extern void init_hostlist_notebook_cb(GtkWidget *w, gpointer d);
108
109 /** Add some data to the table.
110  *
111  * @param hl the table to add the data to
112  * @param addr address
113  * @param port port
114  * @param sender TRUE, if this is a sender
115  * @param num_frames number of packets
116  * @param num_bytes number of bytes
117  * @param sat address type
118  * @param port_type the port type (e.g. PT_TCP)
119  */
120 void add_hostlist_table_data(hostlist_table *hl, const address *addr,
121                              guint32 port, gboolean sender, int num_frames, int num_bytes, SAT_E sat, int port_type);
122
123 #endif /* __HOSTLIST_TABLE_H__ */