3 * Definitions for recent "preference" handling routines
4 * Copyright 2004, Ulf Lamping <ulf.lamping@web.de>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
19 #include "epan/timestamp.h"
20 #include "ui/ws_ui_util.h"
24 #endif /* __cplusplus */
27 * Recent user interface settings.
28 * @ingroup main_window_group
32 #define RECENT_KEY_CAPTURE_FILE "recent.capture_file"
35 #define RECENT_KEY_DISPLAY_FILTER "recent.display_filter"
37 #define RECENT_KEY_COL_WIDTH "column.width"
39 #define RECENT_KEY_CAPTURE_FILTER "recent.capture_filter"
41 #define RECENT_KEY_REMOTE_HOST "recent.remote_host"
43 typedef struct _col_width_data
{
48 /** Defines used in col_width_data.xalign */
49 #define COLUMN_XALIGN_DEFAULT 0
50 #define COLUMN_XALIGN_LEFT 'L'
51 #define COLUMN_XALIGN_CENTER 'C'
52 #define COLUMN_XALIGN_RIGHT 'R'
62 BYTES_ENC_FROM_PACKET
, // frame_data packet_char_enc
65 } bytes_encoding_type
;
68 SEARCH_IN_PACKET_LIST
,
69 SEARCH_IN_PACKET_DETAILS
,
70 SEARCH_IN_PACKET_BYTES
74 SEARCH_CHAR_SET_NARROW_AND_WIDE
,
75 SEARCH_CHAR_SET_NARROW
,
77 } search_char_set_type
;
80 SEARCH_TYPE_DISPLAY_FILTER
,
81 SEARCH_TYPE_HEX_VALUE
,
97 SHOW_CODEC
, // Will map to UTF-8 in the combobox (other codecs
98 // are generated at runtime).
113 DecodeAsPercentEncoding
,
114 DecodeAsQuotedPrintable
,
118 /** Recent settings. */
119 typedef struct recent_settings_tag
{
120 bool main_toolbar_show
;
121 bool filter_toolbar_show
;
122 bool wireless_toolbar_show
;
123 bool packet_list_show
;
126 bool packet_diagram_show
;
128 bool packet_list_colorize
;
129 bool capture_auto_scroll
;
130 ts_type gui_time_format
;
131 int gui_time_precision
;
132 ts_seconds_type gui_seconds_format
;
134 bytes_view_type gui_bytes_view
;
135 bytes_encoding_type gui_bytes_encoding
;
136 bool gui_packet_diagram_field_values
;
137 bool gui_allow_hover_selection
;
139 search_in_type gui_search_in
;
140 search_char_set_type gui_search_char_set
;
141 bool gui_search_case_sensitive
;
142 bool gui_search_reverse_dir
;
143 bool gui_search_multiple_occurs
;
144 search_type_type gui_search_type
;
145 bytes_show_type gui_follow_show
;
146 follow_delta_type gui_follow_delta
;
147 bytes_decode_type gui_show_bytes_decode
;
148 bytes_show_type gui_show_bytes_show
;
150 int gui_geometry_main_x
;
151 int gui_geometry_main_y
;
152 int gui_geometry_main_width
;
153 int gui_geometry_main_height
;
155 bool gui_geometry_main_maximized
;
156 bool gui_geometry_leftalign_actions
;
158 int gui_geometry_main_upper_pane
;
159 int gui_geometry_main_lower_pane
;
160 char *gui_geometry_main
;
161 char *gui_geometry_main_master_split
;
162 char *gui_geometry_main_extra_split
;
163 bool privs_warn_if_elevated
;
164 bool sys_warn_if_no_capture
;
165 GList
*col_width_list
; /* column widths */
166 GList
*conversation_tabs
; /* enabled conversation dialog tabs */
167 GList
*conversation_tabs_columns
; /* save the columns for conversation dialogs */
168 GList
*endpoint_tabs
; /* enabled endpoint dialog tabs */
169 GList
*endpoint_tabs_columns
; /* save the columns for endpoint dialogs */
170 int gui_profile_switch_check_count
; /* number of packets / events to check for automatic profile switching */
171 char *gui_fileopen_remembered_dir
; /* folder of last capture loaded in File Open dialog */
172 bool gui_rlc_use_pdus_from_mac
;
173 GList
*custom_colors
;
174 GList
*gui_additional_toolbars
;
175 GList
*interface_toolbars
;
178 /** Global recent settings. */
179 extern recent_settings_t recent
;
181 /** Initialize recent settings module (done at startup) */
182 extern void recent_init(void);
184 /** Cleanup/Frees recent settings (done at shutdown) */
185 extern void recent_cleanup(void);
187 /** Write recent_common settings file.
189 * @return true if succeeded, false if failed
191 extern bool write_recent(void);
193 /** Write profile recent settings file.
195 * @return true if succeeded, false if failed
197 extern bool write_profile_recent(void);
199 /** Read recent settings file (static part).
201 * @param rf_path_return path to recent file if function failed
202 * @param rf_errno_return if failed
203 * @return true if succeeded, false if failed (check parameters for reason).
205 extern bool recent_read_static(char **rf_path_return
, int *rf_errno_return
);
207 /** Read profile recent settings file (static part).
209 * @param rf_path_return path to recent file if function failed
210 * @param rf_errno_return if failed
211 * @return true if succeeded, false if failed (check parameters for reason).
213 extern bool recent_read_profile_static(char **rf_path_return
, int *rf_errno_return
);
215 /** Read recent settings file (dynamic part).
217 * @param rf_path_return path to recent file if function failed
218 * @param rf_errno_return if failed
219 * @return true if succeeded, false if failed (check parameters for reason).
221 extern bool recent_read_dynamic(char **rf_path_return
, int *rf_errno_return
);
224 * Given a -o command line string, parse it and set the recent value in
225 * question. Return an indication of whether it succeeded or failed
228 * @param prefarg a string of the form "<recent name>:<recent value>", as might appear
229 * as an argument to a "-o" command line option
230 * @return PREFS_SET_OK or PREFS_SET_SYNTAX_ERR
232 extern int recent_set_arg(char *prefarg
);
234 /** Free the recent settings list of column width information
236 * @param rs the recent settings (currently a global)
238 extern void recent_free_column_width_info(recent_settings_t
*rs
);
240 /** Insert an entry in the recent column width setting for
241 * the given column, which should have been just added to
242 * the column list preference. (This keeps them in sync.)
244 * @param col column number
246 extern void recent_insert_column(int col
);
248 /** Remove an entry in the recent column width setting for
249 * the given column, which should have been just removed to
250 * the column list preference. (This keeps them in sync.)
252 * @param col column number
254 extern void recent_remove_column(int col
);
256 /** Get the column width for the given column
258 * @param col column number
260 extern int recent_get_column_width(int col
);
262 /** Set the column width for the given column
264 * @param col column number
265 * @param width column width
267 extern void recent_set_column_width(int col
, int width
);
269 /** Get the column xalign for the given column
271 * @param col column number
273 extern char recent_get_column_xalign(int col
);
275 /** Set the column xalign for the given column
277 * @param col column number
278 * @param xalign column alignment
280 extern void recent_set_column_xalign(int col
, char xalign
);
282 /* save the window and its current geometry into the geometry hashtable */
283 extern void window_geom_save(const char *name
, window_geometry_t
*geom
);
285 /* load the desired geometry for this window from the geometry hashtable */
286 extern bool window_geom_load(const char *name
, window_geometry_t
*geom
);
288 extern void window_splitter_save(const char *name
, const char *splitter_state
);
290 extern const char * window_splitter_load(const char *name
);
293 * Returns a list of recent capture filters.
295 * @param ifname interface name; NULL refers to the global list.
297 extern GList
*recent_get_cfilter_list(const char *ifname
);
300 * Add a capture filter to the global recent capture filter list or
301 * the recent capture filter list for an interface.
303 * @param ifname interface name; NULL refers to the global list.
304 * @param s text of capture filter
306 extern void recent_add_cfilter(const char *ifname
, const char *s
);
309 * Get the value of an entry for a remote host from the remote host list.
311 * @param host host name for the remote host.
313 * @return pointer to the entry for the remote host.
315 extern struct remote_host
*recent_get_remote_host(const char *host
);
318 * Get the number of entries of the remote host list.
320 * @return number of entries in the list.
322 extern int recent_get_remote_host_list_size(void);
325 * Iterate over all items in the remote host list, calling a
326 * function for each member
328 * @param func function to be called
329 * @param user_data argument to pass as user data to the function
331 extern void recent_remote_host_list_foreach(GFunc func
, void *user_data
);
334 * Free all entries of the remote host list.
336 extern void recent_free_remote_host_list(void);
339 * Add an entry to the remote_host_list.
341 * @param host Key of the entry
342 * @param rh Value of the entry
344 extern void recent_add_remote_host(char *host
, struct remote_host
*rh
);
348 #endif /* __cplusplus */
350 #endif /* recent.h */