2 * Definitions for GTK+ packet display structures and routines (packet
3 * details and hex dump panes)
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #ifndef __PACKET_PANES_H__
27 #define __PACKET_PANES_H__
30 * Packet tree and details panes.
31 * @ingroup main_window_group
34 /** Get the current text notebook page of the packet details notebook.
36 * @param nb_ptr the notebook widget
37 * @return the notebook page
39 extern GtkWidget
*get_notebook_bv_ptr(GtkWidget
*nb_ptr
);
42 * Get the data and length for a byte view, given the byte view page widget.
44 * @param byte_view the byte view to look at
45 * @param data_len set "*data_len" to the length
46 * @return the pointer, or NULL on error
48 extern const guint8
*get_byte_view_data_and_length(GtkWidget
*byte_view
,
51 /** Set the current text page of the notebook to the window that
52 * refers to a particular tvbuff.
54 * @param nb_ptr the byte view notebook
55 * @param tvb the tvbuff to look at
57 extern void set_notebook_page(GtkWidget
*nb_ptr
, tvbuff_t
*tvb
);
59 /** Redraw a given byte view window.
61 * @param nb_ptr the byte view notebook
62 * @param fd selected frame
63 * @param finfo selected field_info
65 extern void redraw_packet_bytes(GtkWidget
*nb_ptr
, frame_data
*fd
, field_info
*finfo
);
67 /** Redraw all byte view windows. */
68 extern void redraw_packet_bytes_all(void);
70 /** Create a new byte view (packet details pane).
72 * @return the new byte view
74 extern GtkWidget
*byte_view_new(void);
76 /** Add a new tab to a byte view.
78 extern GtkWidget
*add_byte_tab(GtkWidget
*byte_nb
, const char *name
,
79 tvbuff_t
*tvb
, proto_tree
*tree
,
80 GtkWidget
*tree_view
);
82 /** Clear and fill all the byte view notebook tabs.
84 * @param edt current dissections
85 * @param tree_view the corresponding packet tree
86 * @param nb_ptr the byte view notebook
88 extern void add_byte_views(epan_dissect_t
*edt
, GtkWidget
*tree_view
,
91 /** Gdk button click appeared, select the byte view from that position.
93 * @param widget the byte view
94 * @param event the button event clicked
95 * @return TRUE if could be selected
97 extern gboolean
byte_view_select(GtkWidget
*widget
, GdkEventButton
*event
);
99 /** This highlights the field in the proto tree that is at position byte
101 * @param tvb the current tvbuff
102 * @param byte the byte offset within the packet to highlight
103 * @param tree_view the current tree_view
104 * @param tree the current tree
105 * @return TRUE if highlighting was successful
108 highlight_field(tvbuff_t
*tvb
, gint byte
, GtkTreeView
*tree_view
,
111 /** Callback for "Export Selected Packet Bytes" operation.
116 extern void savehex_cb(GtkWidget
* w
, gpointer data
);
118 /** Format of packet data to copy to clipboard.
119 * Lower nibble holds data type, next nibble holds flags.
122 CD_ALLINFO
, /* All information - columated hex with text in separate column */
123 CD_TEXTONLY
, /* Printable characters */
124 CD_HEX
, /* Hex, space separated, no linebreaks */
125 CD_HEXCOLUMNS
, /* Like "All Information" but with no ASCII */
126 CD_BINARY
, /* Raw binary octets */
128 CD_TYPEMASK
= 0x0000FFFF, /* Mask for extracting type */
129 CD_FLAGSMASK
= -65536, /* i.e., 0xFFFF0000: Mask for extracting flags */
131 CD_FLAGS_SELECTEDONLY
= 0x00010000 /* Copy only selected bytes */
135 /** Callback for "Copy packet bytes to clipboard" operation.
139 * @param data_type copy_data_type
142 extern void copy_hex_cb(GtkWidget
* w
, gpointer data
, copy_data_type data_type
);
144 /** Redraw a given byte view window.
146 * @param bv the byte view
147 * @param pd the packet data
148 * @param fd the current fame
149 * @param finfo the current field info
150 * @param len the byte view length
152 extern void packet_hex_print(GtkWidget
*bv
, const guint8
*pd
, frame_data
*fd
,
153 field_info
*finfo
, guint len
);
155 extern void packet_hex_editor_print(GtkWidget
*bv
, const guint8
*pd
, frame_data
*fd
,
156 int offset
, int bitoffset
, guint len
);
159 * Redraw the text using the saved information. Usually called if
160 * the preferences have changed.
162 * @param bv the byte view
164 extern void packet_hex_reprint(GtkWidget
*bv
);
166 /** Set a new font for all protocol trees.
168 * @param font the new font
170 extern void set_ptree_font_all(PangoFontDescription
*font
);
172 /** Find field in tree view by field_info.
174 * @param tree_view the tree view to look at
175 * @param finfo the field info the look for
176 * @return the path to the field
178 extern GtkTreePath
*tree_find_by_field_info(GtkTreeView
*tree_view
, field_info
*finfo
);
180 /** Create a new tree view (packet details).
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
* proto_tree_view_new(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 extern void proto_tree_draw_resolve(proto_tree
*protocol_tree
, GtkWidget
*tree_view
, const e_addr_resolve
*resolv
);
196 /** Expand the whole tree view.
198 * @param protocol_tree the currently dissected protocol tree
199 * @param tree_view the tree view to redraw
201 extern void expand_all_tree(proto_tree
*protocol_tree
, GtkWidget
*tree_view
);
203 /** Collapse the whole tree view.
205 * @param protocol_tree the currently dissected protocol tree
206 * @param tree_view the tree view to redraw
208 extern void collapse_all_tree(proto_tree
*protocol_tree
, GtkWidget
*tree_view
);
210 /** Gdk button click appeared, select the byte view from that position.
212 * @param widget the tree view
213 * @param event the button event clicked
214 * @return TRUE if could be selected
216 extern gboolean
tree_view_select(GtkWidget
*widget
, GdkEventButton
*event
);
222 extern void select_bytes_view (GtkWidget
*widget
, gpointer data
, gint view
);
224 /** init the expert colors */
225 extern void proto_draw_colors_init(void);
227 /** the expert colors */
228 extern GdkColor expert_color_comment
;
229 extern GdkColor expert_color_chat
;
230 extern GdkColor expert_color_note
;
231 extern GdkColor expert_color_warn
;
232 extern GdkColor expert_color_error
;
233 extern GdkColor expert_color_foreground
;
235 /* string representation of expert colors */
236 extern gchar
*expert_color_comment_str
;
237 extern gchar
*expert_color_chat_str
;
238 extern gchar
*expert_color_note_str
;
239 extern gchar
*expert_color_warn_str
;
240 extern gchar
*expert_color_error_str
;
241 extern gchar
*expert_color_foreground_str
;
243 #endif /* __PACKET_PANES_H__ */