2 * Definitions for GTK+ packet display structures and routines
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #ifndef __GTKPACKET_H__
26 #define __GTKPACKET_H__
29 * Packet tree and details panes.
30 * @ingroup main_window_group
33 /** Create byte views in the main window.
35 void add_main_byte_views(epan_dissect_t *edt);
37 /** Display the protocol tree in the main window.
39 void main_proto_tree_draw(proto_tree *protocol_tree);
41 /** Clear the hex dump and protocol tree panes.
43 void clear_tree_and_hex_views(void);
46 /** Get the current text notebook page of the packet details notebook.
48 * @param nb_ptr the notebook widget
49 * @return the notebook page
51 extern GtkWidget *get_notebook_bv_ptr(GtkWidget *nb_ptr);
54 * Get the data and length for a byte view, given the byte view page widget.
56 * @param byte_view the byte view to look at
57 * @param data_len set "*data_len" to the length
58 * @return the pointer, or NULL on error
60 extern const guint8 *get_byte_view_data_and_length(GtkWidget *byte_view,
63 /** Set the current text page of the notebook to the window that
64 * refers to a particular tvbuff.
66 * @param nb_ptr the byte view notebook
67 * @param tvb the tvbuff to look at
69 extern void set_notebook_page(GtkWidget *nb_ptr, tvbuff_t *tvb);
71 /** Redraw a given byte view window.
73 * @param nb_ptr the byte view notebook
74 * @param fd selected frame
75 * @param finfo selected field_info
77 extern void redraw_hex_dump(GtkWidget *nb_ptr, frame_data *fd, field_info *finfo);
79 /** Redraw all byte view windows. */
80 extern void redraw_hex_dump_all(void);
82 /** Create a new byte view (packet details pane).
84 * @return the new byte view
86 extern GtkWidget *byte_view_new(void);
88 /** Clear and fill all the byte view notebook tabs.
90 * @param edt current dissections
91 * @param tree_view the corresponding packet tree
92 * @param nb_ptr the byte view notebook
94 extern void add_byte_views(epan_dissect_t *edt, GtkWidget *tree_view,
97 /** Gdk button click appeared, select the byte view from that position.
99 * @param widget the byte view
100 * @param event the button event clicked
101 * @return TRUE if could be selected
103 extern gboolean byte_view_select(GtkWidget *widget, GdkEventButton *event);
105 /** Callback for "Export Selected Packet Bytes" operation.
110 extern void savehex_cb(GtkWidget * w, gpointer data);
112 /** Callback for "Copy packet bytes to clipboard" operation.
117 extern void copy_hex_cb(GtkWidget * w, gpointer data, int data_type);
119 #if GTK_MAJOR_VERSION < 2
120 /** Redraw a given byte view window.
122 * @param bv the byte view
123 * @param pd the packet data
124 * @param fd the current fame
125 * @param finfo the current field info
126 * @param len the byte view length
128 extern void packet_hex_print(GtkText *bv, const guint8 *pd, frame_data *fd,
129 field_info *finfo, guint len);
132 * Redraw the text using the saved information. Usually called if
133 * the preferences have changed.
135 * @param bv the byte view
137 extern void packet_hex_reprint(GtkText *bv);
139 /** Set a new font for all protocol trees.
141 * @param font the new font
143 extern void set_ptree_font_all(GdkFont *font);
145 /** Redraw a given byte view window.
147 * @param bv the byte view
148 * @param pd the packet data
149 * @param fd the current fame
150 * @param finfo the current field info
151 * @param len the byte view length
153 extern void packet_hex_print(GtkTextView *bv, const guint8 *pd, frame_data *fd,
154 field_info *finfo, guint len);
157 * Redraw the text using the saved information. Usually called if
158 * the preferences have changed.
160 * @param bv the byte view
162 extern void packet_hex_reprint(GtkTextView *bv);
164 /** Set a new font for all protocol trees.
166 * @param font the new font
168 extern void set_ptree_font_all(PangoFontDescription *font);
170 /** Find field in tree view by field_info.
172 * @param tree_view the tree view to look at
173 * @param finfo the field info the look for
174 * @return the path to the field
176 extern GtkTreePath *tree_find_by_field_info(GtkTreeView *tree_view, field_info *finfo);
179 /** Create a new tree view (packet details).
181 * @param prefs current preferences
182 * @param tree_view_p fill in the new tree view
183 * @return the new scrolled window (parent of the tree view)
185 extern GtkWidget * main_tree_view_new(e_prefs *prefs, GtkWidget **tree_view_p);
187 /** Clear and redraw the whole tree view.
189 * @param protocol_tree the currently dissected protocol tree
190 * @param tree_view the tree view to redraw
192 extern void proto_tree_draw(proto_tree *protocol_tree, GtkWidget *tree_view);
194 /** Expand the whole tree view.
196 * @param protocol_tree the currently dissected protocol tree
197 * @param tree_view the tree view to redraw
199 extern void expand_all_tree(proto_tree *protocol_tree, GtkWidget *tree_view);
201 /** Collapse the whole tree view.
203 * @param protocol_tree the currently dissected protocol tree
204 * @param tree_view the tree view to redraw
206 extern void collapse_all_tree(proto_tree *protocol_tree, GtkWidget *tree_view);
208 /** Gdk button click appeared, select the byte view from that position.
210 * @param widget the tree view
211 * @param event the button event clicked
212 * @return TRUE if could be selected
214 extern gboolean tree_view_select(GtkWidget *widget, GdkEventButton *event);
216 /** Set the selection mode of all packet tree windows.
218 * @param val GTK_SELECTION_SINGLE if TRUE, GTK_SELECTION_BROWSE if FALSE
220 extern void set_ptree_sel_browse_all(gboolean val);
223 /** init the expert colors */
224 extern void proto_draw_colors_init(void);
226 /** the expert colors */
227 extern GdkColor expert_color_chat;
228 extern GdkColor expert_color_note;
229 extern GdkColor expert_color_warn;
230 extern GdkColor expert_color_error;