Avoid calling some free() on WIN32 on memory that may be allocated in
[obnox/wireshark/wip.git] / 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25
26 #include "sat.h"
27
28 /** @file
29  *  Hostlist definitions.
30  */
31
32 /** Hostlist information */
33 typedef struct _hostlist_talker_t {
34         address address;        /**< address */
35         SAT_E   sat;            /**< address type */
36         guint32 port_type;      /**< port_type (e.g. PT_TCP) */
37         guint32 port;           /**< port */
38
39         guint64 rx_frames;      /**< number of received packets */
40         guint64 tx_frames;      /**< number of transmitted packets */
41         guint64 rx_bytes;       /**< number of received bytes */
42         guint64 tx_bytes;       /**< number of transmitted bytes */
43 } hostlist_talker_t;
44
45 /** Hostlist widget */
46 typedef struct _hostlist_table {
47         const char          *name;              /**< the name of the table */
48         const char          *filter;            /**< the filter used */
49         gboolean             use_dfilter;       /**< use display filter */
50         GtkWidget           *win;               /**< GTK window */
51         GtkWidget           *page_lb;           /**< page label */
52         GtkWidget           *name_lb;           /**< name label */
53         GtkWidget           *scrolled_window;   /**< the scrolled window */
54         GtkCList            *table;             /**< the GTK table */
55         guint32             num_columns;        /**< number of columns in the above table */
56         const char          *default_titles[8]; /**< Column headers */
57         GtkWidget           *menu;              /**< context menu */
58         gboolean            has_ports;          /**< table has ports */
59         guint32             num_hosts;          /**< number of hosts (0 or 1) */
60         hostlist_talker_t   *hosts;             /**< array of host values */
61         gboolean            resolve_names;      /**< resolve address names? */
62 } hostlist_table;
63
64 /** Register the hostlist table for the multiple hostlist window.
65  *
66  * @param hide_ports hide the port columns
67  * @param table_name the table name to be displayed
68  * @param tap_name the registered tap name
69  * @param filter the optional filter name or NULL
70  * @param packet_func the function to be called for each incoming packet
71  */
72 extern void register_hostlist_table(gboolean hide_ports, const char *table_name, const char *tap_name, const char *filter, tap_packet_cb packet_func);
73
74 /** Init the hostlist table for the single hostlist window.
75  *
76  * @param hide_ports hide the port columns
77  * @param table_name the table name to be displayed
78  * @param tap_name the registered tap name
79  * @param filter the optional filter name or NULL
80  * @param packet_func the function to be called for each incoming packet
81  */
82 extern void init_hostlist_table(gboolean hide_ports, const char *table_name, const char *tap_name, const char *filter, tap_packet_cb packet_func);
83
84 /** Callback for "Endpoints" statistics item.
85  *
86  * @param w unused
87  * @param d unused
88  */
89 extern void init_hostlist_notebook_cb(GtkWidget *w, gpointer d);
90
91 /** Add some data to the table.
92  *
93  * @param hl the table to add the data to
94  * @param addr address
95  * @param port port
96  * @param sender TRUE, if this is a sender
97  * @param num_frames number of packets
98  * @param num_bytes number of bytes
99  * @param sat address type
100  * @param port_type the port type (e.g. PT_TCP)
101  */
102 void add_hostlist_table_data(hostlist_table *hl, const address *addr,
103                              guint32 port, gboolean sender, int num_frames, int num_bytes, SAT_E sat, int port_type);