Removed unused argument to new_packet_list_copy_summary_cb().
[obnox/wireshark/wip.git] / gtk / main_proto_draw.h
1 /* proto_draw.h
2  * Definitions for GTK+ packet display structures and routines
3  *
4  * $Id$
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
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.
14  *
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.
19  *
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.
23  */
24
25 #ifndef __MAIN_PROTO_DRAW_H__
26 #define __MAIN_PROTO_DRAW_H__
27
28 /** @file
29  *  Packet tree and details panes.
30  *  @ingroup main_window_group
31  */
32
33 /** Create byte views in the main window.
34  */
35 void add_main_byte_views(epan_dissect_t *edt);
36
37 /** Display the protocol tree in the main window.
38  */
39 void main_proto_tree_draw(proto_tree *protocol_tree);
40
41 /** Clear the hex dump and protocol tree panes.
42  */
43 void clear_tree_and_hex_views(void);
44
45
46 /** Get the current text notebook page of the packet details notebook.
47  *
48  * @param nb_ptr the notebook widget
49  * @return the notebook page
50  */
51 extern GtkWidget *get_notebook_bv_ptr(GtkWidget *nb_ptr);
52
53 /**
54  * Get the data and length for a byte view, given the byte view page widget.
55  *
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
59  */
60 extern const guint8 *get_byte_view_data_and_length(GtkWidget *byte_view,
61                                                    guint *data_len);
62
63 /** Set the current text page of the notebook to the window that
64  * refers to a particular tvbuff.
65  *
66  * @param nb_ptr the byte view notebook
67  * @param tvb the tvbuff to look at
68  */
69 extern void set_notebook_page(GtkWidget *nb_ptr, tvbuff_t *tvb);
70
71 /** Redraw a given byte view window.
72  *
73  * @param nb_ptr the byte view notebook
74  * @param fd selected frame
75  * @param finfo selected field_info
76  */
77 extern void redraw_packet_bytes(GtkWidget *nb_ptr, frame_data *fd, field_info *finfo);
78
79 /** Redraw all byte view windows. */
80 extern void redraw_packet_bytes_all(void);
81
82 /** Create a new byte view (packet details pane).
83  *
84  * @return the new byte view
85  */
86 extern GtkWidget *byte_view_new(void);
87
88 /** Clear and fill all the byte view notebook tabs.
89  *
90  * @param edt current dissections
91  * @param tree_view the corresponding packet tree
92  * @param nb_ptr the byte view notebook
93  */
94 extern void add_byte_views(epan_dissect_t *edt, GtkWidget *tree_view,
95                            GtkWidget *nb_ptr);
96
97 /** Gdk button click appeared, select the byte view from that position.
98  * 
99  * @param widget the byte view
100  * @param event the button event clicked
101  * @return TRUE if could be selected
102  */
103 extern gboolean byte_view_select(GtkWidget *widget, GdkEventButton *event);
104
105 /** This highlights the field in the proto tree that is at position byte
106  *
107  * @param tvb the current tvbuff
108  * @param byte the byte offset within the packet to highlight
109  * @param tree_view the current tree_view
110  * @param tree the current tree
111  * @return TRUE if highlighting was successful
112  */
113 gboolean
114 highlight_field(tvbuff_t *tvb, gint byte, GtkTreeView *tree_view,
115                 proto_tree *tree);
116
117 /** Callback for "Export Selected Packet Bytes" operation.
118  *
119  * @param w unused
120  * @param data unused
121  */
122 extern void savehex_cb(GtkWidget * w, gpointer data);
123
124 /** Format of packet data to copy to clipboard.
125  *  Lower nibble holds data type, next nibble holds flags.
126  */
127 typedef enum {
128     CD_ALLINFO,     /* All information - columated hex with text in separate column */
129     CD_TEXTONLY,    /* Printable characters */
130     CD_HEX,         /* Hex, space separated, no linebreaks */
131     CD_HEXCOLUMNS,  /* Like "All Information" but with no ASCII */
132     CD_BINARY,      /* Raw binary octets */
133
134     CD_TYPEMASK = 0x0000FFFF,          /* Mask for extracting type */
135     CD_FLAGSMASK = 0xFFFF0000,         /* Mask for extracting flags */
136
137     CD_FLAGS_SELECTEDONLY = 0x00010000 /* Copy only selected bytes */
138 } copy_data_type;
139
140
141 /** Callback for "Copy packet bytes to clipboard" operation.
142  *
143  * @param w unused
144  * @param data unused
145  * @param data_type copy_data_type 
146  *
147  */
148 extern void copy_hex_cb(GtkWidget * w, gpointer data, copy_data_type data_type);
149
150 /** Redraw a given byte view window.
151  *
152  * @param bv the byte view
153  * @param pd the packet data
154  * @param fd the current fame
155  * @param finfo the current field info
156  * @param len the byte view length
157  */
158 extern void packet_hex_print(GtkWidget *bv, const guint8 *pd, frame_data *fd,
159                  field_info *finfo, guint len);
160
161 extern void packet_hex_editor_print(GtkWidget *bv, const guint8 *pd, frame_data *fd, 
162                 int offset, int bitoffset, guint len);
163
164 /**
165  * Redraw the text using the saved information. Usually called if
166  * the preferences have changed.
167  *
168  * @param bv the byte view
169  */
170 extern void packet_hex_reprint(GtkWidget *bv);
171
172 /** Set a new font for all protocol trees.
173  *
174  * @param font the new font
175  */
176 extern void set_ptree_font_all(PangoFontDescription *font);
177
178 /** Find field in tree view by field_info.
179  *
180  * @param tree_view the tree view to look at
181  * @param finfo the field info the look for
182  * @return the path to the field
183  */
184 extern GtkTreePath *tree_find_by_field_info(GtkTreeView *tree_view, field_info *finfo);
185
186 /** Create a new tree view (packet details).
187  *
188  * @param prefs current preferences
189  * @param tree_view_p fill in the new tree view
190  * @return the new scrolled window (parent of the tree view)
191  */
192 extern GtkWidget * main_tree_view_new(e_prefs *prefs, GtkWidget **tree_view_p);
193
194 /** Clear and redraw the whole tree view.
195  *
196  * @param protocol_tree the currently dissected protocol tree
197  * @param tree_view the tree view to redraw
198  */
199 extern void proto_tree_draw(proto_tree *protocol_tree, GtkWidget *tree_view);
200
201 /** Expand the whole tree view.
202  *
203  * @param protocol_tree the currently dissected protocol tree
204  * @param tree_view the tree view to redraw
205  */
206 extern void expand_all_tree(proto_tree *protocol_tree, GtkWidget *tree_view);
207
208 /** Collapse the whole tree view.
209  *
210  * @param protocol_tree the currently dissected protocol tree
211  * @param tree_view the tree view to redraw
212  */
213 extern void collapse_all_tree(proto_tree *protocol_tree, GtkWidget *tree_view);
214
215 /** Gdk button click appeared, select the byte view from that position.
216  * 
217  * @param widget the tree view
218  * @param event the button event clicked
219  * @return TRUE if could be selected
220  */
221 extern gboolean tree_view_select(GtkWidget *widget, GdkEventButton *event);
222
223 /** Set the selection mode of all packet tree windows.
224  *
225  * @param val GTK_SELECTION_SINGLE if TRUE, GTK_SELECTION_BROWSE if FALSE
226  */
227 extern void set_ptree_sel_browse_all(gboolean val);
228
229 typedef enum {
230   BYTES_HEX,
231   BYTES_BITS
232 } bytes_view_type;
233 extern void select_bytes_view (GtkWidget *widget, gpointer data, gint view);
234
235 /** init the expert colors */
236 extern void proto_draw_colors_init(void);
237
238 /** the expert colors */
239 extern GdkColor expert_color_chat;
240 extern GdkColor expert_color_note;
241 extern GdkColor expert_color_warn;
242 extern GdkColor expert_color_error;
243 extern GdkColor expert_color_foreground;
244
245 /* string representation of expert colors */
246 extern gchar *expert_color_chat_str;
247 extern gchar *expert_color_note_str;
248 extern gchar *expert_color_warn_str;
249 extern gchar *expert_color_error_str;
250 extern gchar *expert_color_foreground_str;
251
252 #endif /* __MAIN_PROTO_DRAW_H__ */