Cleanup header file define guards.
[obnox/wireshark/wip.git] / gtk / graph_analysis.h
1 /* graph_analysis.h
2  * Graphic Analysis addition for Wireshark
3  *
4  * $Id$
5  *
6  * Copyright 2004, Verso Technologies Inc.
7  * By Alejandro Vaquero <alejandrovaquero@yahoo.com>
8  *
9  * based on rtp_analysis.c and io_stat
10  *
11  *
12  * Wireshark - Network traffic analyzer
13  * By Gerald Combs <gerald@wireshark.org>
14  * Copyright 1998 Gerald Combs
15  *
16  * This program is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU General Public License
18  * as published by the Free Software Foundation; either version 2
19  * of the License, or (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with this program; if not, write to the Free Software
28  * Foundation,  Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
29  */
30
31 #ifndef __GRAPH_ANALYSIS_H__
32 #define __GRAPH_ANALYSIS_H__
33
34 #include <glib.h>
35 #include <gtk/gtk.h>
36 #include <epan/address.h>
37
38 #define MAX_NUM_NODES 10
39
40 /* defines an entry in for the graph analysis */
41 typedef struct _graph_analysis_item {
42         guint32 frame_num;                      /* frame number used to "go to" that frame */
43         double time;                            /* frame time */
44         address src_addr;
45         guint16 port_src;
46         address dst_addr;
47         guint16 port_dst;
48         gchar *frame_label;                     /* the label on top of the arrow */
49         gchar *comment;                         /* a comment that appears at the left of the graph */
50         guint16 conv_num;                       /* the conversation number, each conversation will be colored */
51         gboolean display;                       /* indicate if the packet is displayed or not in the graph */
52         guint16 src_node;                       /* this is used by graph_analysis.c to identify the node */
53         guint16 dst_node;                       /* a node is an IP address that will be displayed in columns */
54         guint16 line_style;                     /* the arrow line width in pixels*/
55 } graph_analysis_item_t;
56
57 /* defines the graph analysis structure */
58 typedef struct _graph_analysis_info {
59         int     nconv;       /* number of conversations in the list */
60         GList*  list;   /* list with the graph analysis items */
61 } graph_analysis_info_t;
62
63 /* max number of nodes to display, each node will be an IP address */
64 #define MAX_NUM_COL_CONV 10
65 #define NODE_OVERFLOW MAX_NUM_NODES+1
66 #define NUM_DISPLAY_ITEMS 1000
67
68 typedef struct _display_items {
69         guint32 frame_num;                      /* frame number used to "go to" that frame */
70         double time;                            /* frame time */
71         guint16 port_src;
72         guint16 port_dst;
73         gchar *frame_label;                     /* the label on top of the arrow */
74         gchar *comment;                         /* a comment that appears at the left of the graph */
75         guint16 conv_num;                       /* the conversation number, each conversation will be colored */
76         guint16 src_node;                       /* this is used by graph_analysis.c to identify the node */
77         guint16 dst_node;                       /* a node is an IP address that will be displayed in columns */
78         guint16 line_style;                     /* the arrow line width in pixels*/
79 } display_items_t;
80
81 typedef struct _graph_analysis_dialog_data_t {
82         GtkWidget *window;
83         GtkWidget *parent_w;
84         gboolean needs_redraw;
85         gboolean inverse;          /* set the nodes in reverse mode as "dst <---- src" instead of "src ----> dst"*/
86         gint selected_row;
87     GtkWidget *draw_area_time;
88     GtkWidget *draw_area;
89         GtkWidget *draw_area_comments;
90     GdkPixmap *pixmap_time;
91     GdkPixmap *pixmap_main;
92     GdkPixmap *pixmap_comments;
93         GdkPixmap *pixmap_tile_select;
94         GtkWidget *scroll_window;
95         GtkWidget *v_scrollbar;
96         GtkAdjustment *v_scrollbar_adjustment;
97         GtkWidget *hpane;
98         GdkGC *div_line_gc[2];
99         GdkGC *bg_gc[MAX_NUM_COL_CONV+1];
100     int pixmap_width;
101     int pixmap_height;
102         guint16 first_node;                     /* the first node on the left to show in the screen */
103         guint32 first_item;                     /* the first item (row) to show from the top */
104         guint32 selected_item;          /* the selected item */
105         display_items_t items[NUM_DISPLAY_ITEMS];
106     guint32 left_x_border;
107     char *save_file;
108         char *title;                            /* Graph analysis window's title */
109 } graph_analysis_dialog_data_t;
110
111 typedef void (*destroy_user_data_cb)(void *data);
112
113 /* structure that holds general information and the dialog */
114 typedef struct _graph_analysis_data_t {
115         /* graphic data */
116         graph_analysis_info_t *graph_info;
117
118         /* dialog associated data */
119         graph_analysis_dialog_data_t dlg;
120         address nodes[MAX_NUM_NODES];
121         guint32 num_nodes;
122         guint32 num_items;
123         destroy_user_data_cb on_destroy_user_data;  /* callback info for destroy */
124         void *data; /* data to be passes when on destroy */
125 } graph_analysis_data_t;
126
127 graph_analysis_data_t* graph_analysis_init(void);
128 void graph_analysis_create(graph_analysis_data_t* user_data);
129 void graph_analysis_update(graph_analysis_data_t* user_data);
130 void graph_analysis_redraw(graph_analysis_data_t* user_data);
131
132
133 #endif /* __GRAPH_ANALYSIS_H__ */