1 /* conversations_table.h
2 * conversations_table 2003 Ronnie Sahlberg
3 * Helper routines common to all conversations taps.
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
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.
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.
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.
26 #ifndef __CONVERSATIONS_TABLE_H__
27 #define __CONVERSATIONS_TABLE_H__
32 * Conversation definitions.
35 /** Conversation information */
36 typedef struct _conversation_t {
37 address src_address; /**< source address */
38 address dst_address; /**< destination address */
39 SAT_E sat; /**< address type */
40 guint32 port_type; /**< port_type (e.g. PT_TCP) */
41 guint32 src_port; /**< source port */
42 guint32 dst_port; /**< destination port */
44 guint64 rx_frames; /**< number of received packets */
45 guint64 tx_frames; /**< number of transmitted packets */
46 guint64 rx_bytes; /**< number of received bytes */
47 guint64 tx_bytes; /**< number of transmitted bytes */
49 nstime_t start_time; /**< start time for the conversation */
50 nstime_t stop_time; /**< stop time for the conversation */
52 gboolean modified; /**< new to redraw the row */
54 gboolean iter_valid; /**< not a new row */
57 /** Conversation widget */
58 typedef struct _conversations_table {
59 const char *name; /**< the name of the table */
60 const char *filter; /**< the filter used */
61 gboolean use_dfilter; /**< use display filter */
62 GtkWidget *win; /**< GTK window */
63 GtkWidget *page_lb; /**< page label */
64 GtkWidget *name_lb; /**< name label */
65 GtkWidget *scrolled_window; /**< the scrolled window */
66 GtkTreeView *table; /**< the GTK table */
67 const char *default_titles[14]; /**< Column headers */
68 GtkWidget *menu; /**< context menu */
69 gboolean has_ports; /**< table has ports */
70 guint32 num_conversations; /**< number of conversations */
71 GArray *conversations; /**< array of conversation values */
72 GHashTable *hashtable; /**< conversations hash table */
74 gboolean fixed_col; /**< if switched to fixed column */
75 gboolean resolve_names; /**< resolve address names? */
76 } conversations_table;
78 /** Register the conversation table for the multiple conversation window.
80 * @param hide_ports hide the port columns
81 * @param table_name the table name to be displayed
82 * @param tap_name the registered tap name
83 * @param filter the optional filter name or NULL
84 * @param packet_func the function to be called for each incoming packet
86 extern void register_conversation_table(gboolean hide_ports, const char *table_name, const char *tap_name, const char *filter, tap_packet_cb packet_func);
88 /** Init the conversation table for the single conversation window.
90 * @param hide_ports hide the port columns
91 * @param table_name the table name to be displayed
92 * @param tap_name the registered tap name
93 * @param filter the optional filter name or NULL
94 * @param packet_func the function to be called for each incoming packet
96 extern void init_conversation_table(gboolean hide_ports, const char *table_name, const char *tap_name, const char *filter, tap_packet_cb packet_func);
98 /** Callback for "Conversations" statistics item.
100 * @param widget unused
103 extern void init_conversation_notebook_cb(GtkWidget *widget, gpointer data);
105 /** Add some data to the conversation table.
107 * @param ct the table to add the data to
108 * @param src source address
109 * @param dst destination address
110 * @param src_port source port
111 * @param dst_port destination port
112 * @param num_frames number of packets
113 * @param num_bytes number of bytes
114 * @param ts timestamp
115 * @param sat address type
116 * @param port_type the port type (e.g. PT_TCP)
118 extern void add_conversation_table_data(conversations_table *ct, const address *src, const address *dst,
119 guint32 src_port, guint32 dst_port, int num_frames, int num_bytes, nstime_t *ts,
120 SAT_E sat, int port_type);
121 #endif /* __CONVERSATIONS_TABLE_H__ */