2 * Graphic Analysis addition for ethereal
6 * Copyright 2004, Verso Technologies Inc.
7 * By Alejandro Vaquero <alejandrovaquero@yahoo.com>
9 * based on rtp_analysis.c and io_stat
12 * Ethereal - Network traffic analyzer
13 * By Gerald Combs <gerald@ethereal.com>
14 * Copyright 1998 Gerald Combs
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.
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.
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.
31 #ifndef GRAPH_ANALYSIS_H_INCLUDED
32 #define GRAPH_ANALYSIS_H_INCLUDED
36 #include "gtkglobals.h"
37 #include <epan/address.h>
39 #define MAX_NUM_NODES 10
41 /* defines an entry in for the graph analysis */
42 typedef struct _graph_analysis_item {
43 guint32 frame_num; /* frame number used to "go to" that frame */
44 double time; /* frame time */
49 gchar *frame_label; /* the label on top of the arrow */
50 gchar *comment; /* a comment that appears at the left of the graph */
51 guint16 conv_num; /* the conversation number, each conversation will be colored */
52 gboolean display; /* indicate if the packet is displayed or not in the graph */
53 guint16 src_node; /* this is used by graph_analysis.c to identify the node */
54 guint16 dst_node; /* a node is an IP address that will be displayed in columns */
55 guint16 line_style; /* the arrow line width in pixels*/
56 } graph_analysis_item_t;
58 /* defines the graph analysis structure */
59 typedef struct _graph_analysis_info {
60 int nconv; /* number of conversations in the list */
61 GList* list; /* list with the graph analysis items */
62 } graph_analysis_info_t;
64 /* max number of nodes to display, each node will be an IP address */
65 #define MAX_NUM_COL_CONV 10
66 #define NODE_OVERFLOW MAX_NUM_NODES+1
67 #define NUM_DISPLAY_ITEMS 1000
69 typedef struct _display_items {
70 guint32 frame_num; /* frame number used to "go to" that frame */
71 double time; /* frame time */
74 gchar *frame_label; /* the label on top of the arrow */
75 gchar *comment; /* a comment that appears at the left of the graph */
76 guint16 conv_num; /* the conversation number, each conversation will be colored */
77 guint16 src_node; /* this is used by graph_analysis.c to identify the node */
78 guint16 dst_node; /* a node is an IP address that will be displayed in columns */
79 guint16 line_style; /* the arrow line width in pixels*/
82 typedef struct _dialog_data_t {
84 gboolean needs_redraw;
85 gboolean inverse; /* set the nodes in reverse mode as "dst <---- src" instead of "src ----> dst"*/
87 GtkWidget *draw_area_time;
89 GtkWidget *draw_area_comments;
90 GdkPixmap *pixmap_time;
92 GdkPixmap *pixmap_comments;
93 GtkWidget *scroll_window;
94 GtkWidget *v_scrollbar;
95 GtkAdjustment *v_scrollbar_adjustment;
97 GdkGC *div_line_gc[2];
98 GdkGC *bg_gc[MAX_NUM_COL_CONV+1];
101 guint16 first_node; /* the first node on the left to show in the screen */
102 guint32 first_item; /* the first item (row) to show from the top */
103 guint32 selected_item; /* the selected item */
104 display_items_t items[NUM_DISPLAY_ITEMS];
105 guint32 left_x_border;
107 char *title; /* Graph analysis window's title */
110 typedef void (*destroy_user_data_cb)(void *data);
112 /* structure that holds general information and the dialog */
113 typedef struct _graph_analysis_data_t {
115 graph_analysis_info_t *graph_info;
117 /* dialog associated data */
119 address nodes[MAX_NUM_NODES];
122 destroy_user_data_cb on_destroy_user_data; /* callback info for destroy */
123 void *data; /* data to be passes when on destroy */
124 } graph_analysis_data_t;
126 graph_analysis_data_t* graph_analysis_init(void);
127 void graph_analysis_create(graph_analysis_data_t* user_data);
128 void graph_analysis_update(graph_analysis_data_t* user_data);
129 void graph_analysis_redraw(graph_analysis_data_t* user_data);
132 #endif /*GRAPH_ANALYSIS_H_INCLUDED*/