LATER... ei_kerberos_kdc_session_key ...
[wireshark-sm.git] / ui / recent.h
blob07163dbda217abf3ff08ba9d2a36c1f9bab4e1a9
1 /** @file
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
13 #ifndef __RECENT_H__
14 #define __RECENT_H__
16 #include <glib.h>
18 #include <stdio.h>
19 #include "epan/timestamp.h"
20 #include "ui/ws_ui_util.h"
22 #ifdef __cplusplus
23 extern "C" {
24 #endif /* __cplusplus */
26 /** @file
27 * Recent user interface settings.
28 * @ingroup main_window_group
31 /** ???. */
32 #define RECENT_KEY_CAPTURE_FILE "recent.capture_file"
34 /** ???. */
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 {
44 int width;
45 char xalign;
46 } 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'
54 typedef enum {
55 BYTES_HEX,
56 BYTES_BITS,
57 BYTES_DEC,
58 BYTES_OCT
59 } bytes_view_type;
61 typedef enum {
62 BYTES_ENC_FROM_PACKET, // frame_data packet_char_enc
63 BYTES_ENC_ASCII,
64 BYTES_ENC_EBCDIC
65 } bytes_encoding_type;
67 typedef enum {
68 SEARCH_IN_PACKET_LIST,
69 SEARCH_IN_PACKET_DETAILS,
70 SEARCH_IN_PACKET_BYTES
71 } search_in_type;
73 typedef enum {
74 SEARCH_CHAR_SET_NARROW_AND_WIDE,
75 SEARCH_CHAR_SET_NARROW,
76 SEARCH_CHAR_SET_WIDE
77 } search_char_set_type;
79 typedef enum {
80 SEARCH_TYPE_DISPLAY_FILTER,
81 SEARCH_TYPE_HEX_VALUE,
82 SEARCH_TYPE_STRING,
83 SEARCH_TYPE_REGEX
84 } search_type_type;
86 typedef enum {
87 SHOW_ASCII,
88 SHOW_ASCII_CONTROL,
89 SHOW_CARRAY,
90 SHOW_EBCDIC,
91 SHOW_HEXDUMP,
92 SHOW_HTML,
93 SHOW_IMAGE,
94 SHOW_JSON,
95 SHOW_RAW,
96 SHOW_RUSTARRAY,
97 SHOW_CODEC, // Will map to UTF-8 in the combobox (other codecs
98 // are generated at runtime).
99 SHOW_YAML
100 } bytes_show_type;
102 typedef enum {
103 FOLLOW_DELTA_NONE,
104 FOLLOW_DELTA_TURN,
105 FOLLOW_DELTA_ALL
106 } follow_delta_type;
108 typedef enum {
109 DecodeAsNone,
110 DecodeAsBASE64,
111 DecodeAsCompressed,
112 DecodeAsHexDigits,
113 DecodeAsPercentEncoding,
114 DecodeAsQuotedPrintable,
115 DecodeAsROT13
116 } bytes_decode_type;
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;
124 bool tree_view_show;
125 bool byte_view_show;
126 bool packet_diagram_show;
127 bool statusbar_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;
133 int gui_zoom_level;
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;
176 } recent_settings_t;
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
226 * in some fashion.
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);
346 #ifdef __cplusplus
348 #endif /* __cplusplus */
350 #endif /* recent.h */