nexmon – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 /* recent.h
2 * Definitions for recent "preference" handling routines
3 * Copyright 2004, Ulf Lamping <ulf.lamping@web.de>
4 *
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 */
23  
24 #ifndef __RECENT_H__
25 #define __RECENT_H__
26  
27 #ifdef __cplusplus
28 extern "C" {
29 #endif /* __cplusplus */
30  
31 #include <glib.h>
32 #include <stdio.h>
33 #include "epan/timestamp.h"
34 #include "ui/ui_util.h"
35  
36 /** @file
37 * Recent user interface settings.
38 * @ingroup main_window_group
39 */
40  
41 /** ???. */
42 #define RECENT_KEY_CAPTURE_FILE "recent.capture_file"
43  
44 /** ???. */
45 #define RECENT_KEY_DISPLAY_FILTER "recent.display_filter"
46  
47 #define RECENT_KEY_COL_WIDTH "column.width"
48  
49 #define RECENT_KEY_CAPTURE_FILTER "recent.capture_filter"
50  
51 #define RECENT_KEY_REMOTE_HOST "recent.remote_host"
52  
53 typedef struct _col_width_data {
54 gint cfmt;
55 gchar *cfield;
56 gint width;
57 gchar xalign;
58 } col_width_data;
59  
60 /** Defines used in col_width_data.xalign */
61 #define COLUMN_XALIGN_DEFAULT 0
62 #define COLUMN_XALIGN_LEFT 'L'
63 #define COLUMN_XALIGN_CENTER 'C'
64 #define COLUMN_XALIGN_RIGHT 'R'
65  
66 typedef enum {
67 BYTES_HEX,
68 BYTES_BITS
69 } bytes_view_type;
70  
71 /** Recent settings. */
72 typedef struct recent_settings_tag {
73 gboolean main_toolbar_show;
74 gboolean filter_toolbar_show;
75 gboolean wireless_toolbar_show;
76 gboolean airpcap_driver_check_show;
77 gboolean packet_list_show;
78 gboolean tree_view_show;
79 gboolean byte_view_show;
80 gboolean statusbar_show;
81 gboolean packet_list_colorize;
82 ts_type gui_time_format;
83 gint gui_time_precision;
84 ts_seconds_type gui_seconds_format;
85 gint gui_zoom_level;
86 bytes_view_type gui_bytes_view;
87  
88 gint gui_geometry_main_x;
89 gint gui_geometry_main_y;
90 gint gui_gtk_geometry_main_x;
91 gint gui_gtk_geometry_main_y;
92 gint gui_geometry_main_width;
93 gint gui_geometry_main_height;
94  
95 gboolean gui_geometry_main_maximized;
96  
97 gboolean has_gui_geometry_main_upper_pane; /* gui_geometry_main_upper_pane is valid */
98 gint gui_geometry_main_upper_pane;
99 gboolean has_gui_geometry_main_lower_pane; /* gui_geometry_main_lower_pane is valid */
100 gint gui_geometry_main_lower_pane;
101 gboolean has_gui_geometry_status_pane; /* gui_geometry_status_pane is valid */
102 gint gui_geometry_status_pane_left;
103 gint gui_geometry_status_pane_right;
104 gint gui_geometry_wlan_stats_pane;
105 gboolean privs_warn_if_elevated;
106 gboolean privs_warn_if_no_npf;
107 GList *col_width_list; /* column widths */
108 GList *conversation_tabs; /* enabled conversation dialog tabs */
109 GList *endpoint_tabs; /* enabled endpoint dialog tabs */
110 gchar *gui_fileopen_remembered_dir; /* folder of last capture loaded in File Open dialog */
111 gboolean gui_rlc_use_pdus_from_mac;
112 GList *custom_colors;
113 } recent_settings_t;
114  
115 /** Global recent settings. */
116 extern recent_settings_t recent;
117  
118 /** Write recent settings file.
119 *
120 * @return TRUE if succeeded, FALSE if failed
121 */
122 extern gboolean write_recent(void);
123  
124 /** Write profile recent settings file.
125 *
126 * @return TRUE if succeeded, FALSE if failed
127 */
128 extern gboolean write_profile_recent(void);
129  
130 /** Read recent settings file (static part).
131 *
132 * @param rf_path_return path to recent file if function failed
133 * @param rf_errno_return if failed
134 * @return TRUE if succeeded, FALSE if failed (check parameters for reason).
135 */
136 extern gboolean recent_read_static(char **rf_path_return, int *rf_errno_return);
137  
138 /** Read profile recent settings file (static part).
139 *
140 * @param rf_path_return path to recent file if function failed
141 * @param rf_errno_return if failed
142 * @return TRUE if succeeded, FALSE if failed (check parameters for reason).
143 */
144 extern gboolean recent_read_profile_static(char **rf_path_return, int *rf_errno_return);
145  
146 /** Read recent settings file (dynamic part).
147 *
148 * @param rf_path_return path to recent file if function failed
149 * @param rf_errno_return if failed
150 * @return TRUE if succeeded, FALSE if failed (check parameters for reason).
151 */
152 extern gboolean recent_read_dynamic(char **rf_path_return, int *rf_errno_return);
153  
154 /**
155 * Given a -o command line string, parse it and set the recent value in
156 * question. Return an indication of whether it succeeded or failed
157 * in some fashion.
158 *
159 * @param prefarg a string of the form "<recent name>:<recent value>", as might appear
160 * as an argument to a "-o" command line option
161 * @return PREFS_SET_OK or PREFS_SET_SYNTAX_ERR
162 */
163 extern int recent_set_arg(char *prefarg);
164  
165 /** Get the column width for the given column
166 *
167 * @param col column number
168 */
169 extern gint recent_get_column_width(gint col);
170  
171 /** Set the column width for the given column
172 *
173 * @param col column number
174 * @param width column width
175 */
176 extern void recent_set_column_width(gint col, gint width);
177  
178 /** Get the column xalign for the given column
179 *
180 * @param col column number
181 */
182 extern gchar recent_get_column_xalign(gint col);
183  
184 /** Set the column xalign for the given column
185 *
186 * @param col column number
187 * @param xalign column alignment
188 */
189 extern void recent_set_column_xalign(gint col, gchar xalign);
190  
191 /* save the window and its current geometry into the geometry hashtable */
192 extern void window_geom_save(const gchar *name, window_geometry_t *geom);
193  
194 /* load the desired geometry for this window from the geometry hashtable */
195 extern gboolean window_geom_load(const gchar *name, window_geometry_t *geom);
196  
197 /**
198 * Returns a list of recent capture filters.
199 *
200 * @param ifname interface name; NULL refers to the global list.
201 */
202 extern GList *recent_get_cfilter_list(const gchar *ifname);
203  
204 /**
205 * Add a capture filter to the global recent capture filter list or
206 * the recent capture filter list for an interface.
207 *
208 * @param ifname interface name; NULL refers to the global list.
209 * @param s text of capture filter
210 */
211 extern void recent_add_cfilter(const gchar *ifname, const gchar *s);
212  
213 /**
214 * Get the value of a remote host from the remote_host_list.
215 *
216 * @param host Host's address
217 */
218 extern struct remote_host *recent_get_remote_host(const gchar *host);
219  
220 /**
221 * Get the number of entries of the remote_host_list.
222 *
223 * @return size of the hash table
224 */
225 extern int recent_get_remote_host_list_size(void);
226  
227 /**
228 * Get the pointer of the remote_host_list.
229 *
230 * @return Pointer to the hash table
231 */
232 extern GHashTable *get_remote_host_list(void);
233  
234 /**
235 * Free all entries of the remote_host_list.
236 *
237 */
238 extern void free_remote_host_list(void);
239  
240 /**
241 * Add an entry to the remote_host_list.
242 *
243 * @param host Key of the entry
244 * @param rh Vakue of the entry
245 */
246 extern void recent_add_remote_host(gchar *host, struct remote_host *rh);
247  
248 /**
249 * Fill the remote_host_list with the entries stored in the 'recent' file.
250 *
251 * @param s String to be filled from the 'recent' file.
252 * @return True, if the list was written successfully, False otherwise.
253 */
254 extern gboolean capture_remote_combo_add_recent(const gchar *s);
255  
256 /**
257 * Write the contents of the remote_host_list to the 'recent' file.
258 *
259 * @param rf File to write to.
260 */
261 extern void capture_remote_combo_recent_write_all(FILE *rf);
262  
263 #ifdef __cplusplus
264 }
265 #endif /* __cplusplus */
266  
267 #endif /* recent.h */
268  
269 /*
270 * Editor modelines
271 *
272 * Local Variables:
273 * c-basic-offset: 4
274 * tab-width: 8
275 * indent-tabs-mode: nil
276 * End:
277 *
278 * ex: set shiftwidth=4 tabstop=8 expandtab:
279 * :indentSize=4:tabSize=8:noTabs=true:
280 */