2021-11-30 13:01:36 +00:00
|
|
|
/** @file
|
|
|
|
*
|
2004-01-19 00:42:12 +00:00
|
|
|
* Definitions for recent "preference" handling routines
|
|
|
|
* Copyright 2004, Ulf Lamping <ulf.lamping@web.de>
|
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2004-01-19 00:42:12 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-07 11:26:45 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2004-01-19 00:42:12 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __RECENT_H__
|
|
|
|
#define __RECENT_H__
|
|
|
|
|
2021-02-10 14:32:18 +00:00
|
|
|
#include <glib.h>
|
|
|
|
|
2014-07-09 11:50:11 +00:00
|
|
|
#include <stdio.h>
|
2012-12-29 01:39:02 +00:00
|
|
|
#include "epan/timestamp.h"
|
2017-10-14 20:14:14 +00:00
|
|
|
#include "ui/ws_ui_util.h"
|
2012-12-29 01:39:02 +00:00
|
|
|
|
2021-03-16 20:50:13 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2004-06-02 22:13:04 +00:00
|
|
|
/** @file
|
|
|
|
* Recent user interface settings.
|
2004-06-04 17:19:01 +00:00
|
|
|
* @ingroup main_window_group
|
2004-06-02 22:13:04 +00:00
|
|
|
*/
|
2004-01-19 00:42:12 +00:00
|
|
|
|
2004-06-02 22:13:04 +00:00
|
|
|
/** ???. */
|
2004-01-19 00:42:12 +00:00
|
|
|
#define RECENT_KEY_CAPTURE_FILE "recent.capture_file"
|
2004-06-02 22:13:04 +00:00
|
|
|
|
|
|
|
/** ???. */
|
2004-01-19 00:42:12 +00:00
|
|
|
#define RECENT_KEY_DISPLAY_FILTER "recent.display_filter"
|
|
|
|
|
2012-01-18 19:38:34 +00:00
|
|
|
#define RECENT_KEY_COL_WIDTH "column.width"
|
|
|
|
|
|
|
|
#define RECENT_KEY_CAPTURE_FILTER "recent.capture_filter"
|
|
|
|
|
|
|
|
#define RECENT_KEY_REMOTE_HOST "recent.remote_host"
|
|
|
|
|
2008-04-12 19:37:05 +00:00
|
|
|
typedef struct _col_width_data {
|
2014-10-06 03:40:42 +00:00
|
|
|
gint cfmt;
|
|
|
|
gchar *cfield;
|
|
|
|
gint width;
|
|
|
|
gchar xalign;
|
2008-04-12 19:37:05 +00:00
|
|
|
} col_width_data;
|
|
|
|
|
2009-12-09 15:48:38 +00:00
|
|
|
/** Defines used in col_width_data.xalign */
|
|
|
|
#define COLUMN_XALIGN_DEFAULT 0
|
|
|
|
#define COLUMN_XALIGN_LEFT 'L'
|
|
|
|
#define COLUMN_XALIGN_CENTER 'C'
|
|
|
|
#define COLUMN_XALIGN_RIGHT 'R'
|
|
|
|
|
2015-12-17 19:41:46 +00:00
|
|
|
typedef enum {
|
2017-11-29 00:03:11 +00:00
|
|
|
BYTES_HEX,
|
2023-03-09 22:31:35 +00:00
|
|
|
BYTES_BITS,
|
|
|
|
BYTES_DEC,
|
|
|
|
BYTES_OCT
|
2015-12-17 19:41:46 +00:00
|
|
|
} bytes_view_type;
|
|
|
|
|
2018-01-03 21:29:55 +00:00
|
|
|
typedef enum {
|
|
|
|
BYTES_ENC_FROM_PACKET, // frame_data packet_char_enc
|
|
|
|
BYTES_ENC_ASCII,
|
|
|
|
BYTES_ENC_EBCDIC
|
|
|
|
} bytes_encoding_type;
|
|
|
|
|
2019-09-12 10:32:41 +00:00
|
|
|
typedef enum {
|
|
|
|
SEARCH_IN_PACKET_LIST,
|
|
|
|
SEARCH_IN_PACKET_DETAILS,
|
|
|
|
SEARCH_IN_PACKET_BYTES
|
|
|
|
} search_in_type;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
SEARCH_CHAR_SET_NARROW_AND_WIDE,
|
|
|
|
SEARCH_CHAR_SET_NARROW,
|
|
|
|
SEARCH_CHAR_SET_WIDE
|
|
|
|
} search_char_set_type;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
SEARCH_TYPE_DISPLAY_FILTER,
|
|
|
|
SEARCH_TYPE_HEX_VALUE,
|
|
|
|
SEARCH_TYPE_STRING,
|
|
|
|
SEARCH_TYPE_REGEX
|
|
|
|
} search_type_type;
|
|
|
|
|
2023-06-17 07:20:03 +00:00
|
|
|
typedef enum {
|
|
|
|
SHOW_ASCII,
|
2023-09-24 12:09:38 +00:00
|
|
|
SHOW_ASCII_CONTROL,
|
2023-06-17 07:20:03 +00:00
|
|
|
SHOW_CARRAY,
|
|
|
|
SHOW_EBCDIC,
|
|
|
|
SHOW_HEXDUMP,
|
2023-09-24 12:09:38 +00:00
|
|
|
SHOW_HTML,
|
|
|
|
SHOW_IMAGE,
|
|
|
|
SHOW_JSON,
|
2023-06-17 07:20:03 +00:00
|
|
|
SHOW_RAW,
|
2023-09-24 12:09:38 +00:00
|
|
|
SHOW_RUSTARRAY,
|
|
|
|
SHOW_CODEC, // Will map to UTF-8 in the combobox (other codecs
|
|
|
|
// are generated at runtime).
|
2023-06-17 07:20:03 +00:00
|
|
|
SHOW_YAML
|
2023-09-24 12:09:38 +00:00
|
|
|
} bytes_show_type;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
DecodeAsNone,
|
|
|
|
DecodeAsBASE64,
|
|
|
|
DecodeAsCompressed,
|
|
|
|
DecodeAsHexDigits,
|
|
|
|
DecodeAsPercentEncoding,
|
|
|
|
DecodeAsQuotedPrintable,
|
|
|
|
DecodeAsROT13
|
|
|
|
} bytes_decode_type;
|
2023-06-17 07:20:03 +00:00
|
|
|
|
2004-06-02 22:13:04 +00:00
|
|
|
/** Recent settings. */
|
2004-01-19 00:42:12 +00:00
|
|
|
typedef struct recent_settings_tag {
|
|
|
|
gboolean main_toolbar_show;
|
|
|
|
gboolean filter_toolbar_show;
|
2014-10-06 03:40:42 +00:00
|
|
|
gboolean wireless_toolbar_show;
|
2004-01-19 00:42:12 +00:00
|
|
|
gboolean packet_list_show;
|
|
|
|
gboolean tree_view_show;
|
|
|
|
gboolean byte_view_show;
|
2020-05-05 18:58:52 +00:00
|
|
|
gboolean packet_diagram_show;
|
2004-01-19 00:42:12 +00:00
|
|
|
gboolean statusbar_show;
|
2005-03-27 02:19:51 +00:00
|
|
|
gboolean packet_list_colorize;
|
2023-08-12 19:24:25 +00:00
|
|
|
gboolean capture_auto_scroll;
|
2012-12-29 01:39:02 +00:00
|
|
|
ts_type gui_time_format;
|
2005-08-25 21:29:54 +00:00
|
|
|
gint gui_time_precision;
|
2012-12-29 01:39:02 +00:00
|
|
|
ts_seconds_type gui_seconds_format;
|
2004-01-20 18:47:25 +00:00
|
|
|
gint gui_zoom_level;
|
2015-12-17 19:41:46 +00:00
|
|
|
bytes_view_type gui_bytes_view;
|
2018-01-03 21:29:55 +00:00
|
|
|
bytes_encoding_type gui_bytes_encoding;
|
2020-10-28 16:55:19 +00:00
|
|
|
gboolean gui_packet_diagram_field_values;
|
2021-09-13 15:00:48 +00:00
|
|
|
gboolean gui_allow_hover_selection;
|
2004-02-01 20:28:11 +00:00
|
|
|
|
2019-09-12 10:32:41 +00:00
|
|
|
search_in_type gui_search_in;
|
|
|
|
search_char_set_type gui_search_char_set;
|
|
|
|
gboolean gui_search_case_sensitive;
|
2023-09-27 11:54:51 +00:00
|
|
|
gboolean gui_search_reverse_dir;
|
|
|
|
gboolean gui_search_multiple_occurs;
|
2019-09-12 10:32:41 +00:00
|
|
|
search_type_type gui_search_type;
|
2023-09-24 12:09:38 +00:00
|
|
|
bytes_show_type gui_follow_show;
|
|
|
|
bytes_decode_type gui_show_bytes_decode;
|
|
|
|
bytes_show_type gui_show_bytes_show;
|
2019-09-12 10:32:41 +00:00
|
|
|
|
2004-02-01 20:28:11 +00:00
|
|
|
gint gui_geometry_main_x;
|
|
|
|
gint gui_geometry_main_y;
|
|
|
|
gint gui_geometry_main_width;
|
|
|
|
gint gui_geometry_main_height;
|
|
|
|
|
2008-04-12 19:37:05 +00:00
|
|
|
gboolean gui_geometry_main_maximized;
|
2019-11-05 11:41:18 +00:00
|
|
|
gboolean gui_geometry_leftalign_actions;
|
2004-04-25 23:45:12 +00:00
|
|
|
|
2008-04-12 19:37:05 +00:00
|
|
|
gint gui_geometry_main_upper_pane;
|
|
|
|
gint gui_geometry_main_lower_pane;
|
2023-11-22 12:46:56 +00:00
|
|
|
gchar *gui_geometry_main;
|
2023-11-22 00:36:09 +00:00
|
|
|
gchar *gui_geometry_main_master_split;
|
|
|
|
gchar *gui_geometry_main_extra_split;
|
2007-08-30 00:24:40 +00:00
|
|
|
gboolean privs_warn_if_elevated;
|
2020-02-03 17:18:29 +00:00
|
|
|
gboolean sys_warn_if_no_capture;
|
2008-04-12 19:37:05 +00:00
|
|
|
GList *col_width_list; /* column widths */
|
2014-04-29 15:10:27 +00:00
|
|
|
GList *conversation_tabs; /* enabled conversation dialog tabs */
|
2022-06-19 09:18:16 +00:00
|
|
|
GList *conversation_tabs_columns; /* save the columns for conversation dialogs */
|
2014-08-06 17:07:42 +00:00
|
|
|
GList *endpoint_tabs; /* enabled endpoint dialog tabs */
|
2022-06-19 09:18:16 +00:00
|
|
|
GList *endpoint_tabs_columns; /* save the columns for endpoint dialogs */
|
2011-12-29 00:08:47 +00:00
|
|
|
gchar *gui_fileopen_remembered_dir; /* folder of last capture loaded in File Open dialog */
|
2015-09-30 11:49:01 +00:00
|
|
|
gboolean gui_rlc_use_pdus_from_mac;
|
2015-12-15 18:47:02 +00:00
|
|
|
GList *custom_colors;
|
2017-01-24 16:34:07 +00:00
|
|
|
GList *gui_additional_toolbars;
|
2017-04-15 21:30:30 +00:00
|
|
|
GList *interface_toolbars;
|
2004-01-19 00:42:12 +00:00
|
|
|
} recent_settings_t;
|
|
|
|
|
2004-06-02 22:13:04 +00:00
|
|
|
/** Global recent settings. */
|
2004-01-19 00:42:12 +00:00
|
|
|
extern recent_settings_t recent;
|
|
|
|
|
2017-09-14 12:53:18 +00:00
|
|
|
/** Initialize recent settings module (done at startup) */
|
|
|
|
extern void recent_init(void);
|
|
|
|
|
|
|
|
/** Cleanup/Frees recent settings (done at shutdown) */
|
|
|
|
extern void recent_cleanup(void);
|
|
|
|
|
2019-12-11 03:01:16 +00:00
|
|
|
/** Write recent_common settings file.
|
2004-06-02 22:13:04 +00:00
|
|
|
*
|
2005-03-26 01:05:29 +00:00
|
|
|
* @return TRUE if succeeded, FALSE if failed
|
2004-06-02 22:13:04 +00:00
|
|
|
*/
|
2005-03-26 01:05:29 +00:00
|
|
|
extern gboolean write_recent(void);
|
2004-01-19 00:42:12 +00:00
|
|
|
|
2008-04-28 12:35:03 +00:00
|
|
|
/** Write profile recent settings file.
|
|
|
|
*
|
|
|
|
* @return TRUE if succeeded, FALSE if failed
|
|
|
|
*/
|
|
|
|
extern gboolean write_profile_recent(void);
|
|
|
|
|
2005-05-30 04:06:22 +00:00
|
|
|
/** Read recent settings file (static part).
|
2004-06-02 22:13:04 +00:00
|
|
|
*
|
|
|
|
* @param rf_path_return path to recent file if function failed
|
|
|
|
* @param rf_errno_return if failed
|
2015-10-04 09:31:19 +00:00
|
|
|
* @return TRUE if succeeded, FALSE if failed (check parameters for reason).
|
2004-06-02 22:13:04 +00:00
|
|
|
*/
|
2015-10-04 09:31:19 +00:00
|
|
|
extern gboolean recent_read_static(char **rf_path_return, int *rf_errno_return);
|
2005-05-30 04:06:22 +00:00
|
|
|
|
2008-04-28 12:35:03 +00:00
|
|
|
/** Read profile recent settings file (static part).
|
|
|
|
*
|
|
|
|
* @param rf_path_return path to recent file if function failed
|
|
|
|
* @param rf_errno_return if failed
|
2015-10-04 09:31:19 +00:00
|
|
|
* @return TRUE if succeeded, FALSE if failed (check parameters for reason).
|
2008-04-28 12:35:03 +00:00
|
|
|
*/
|
2015-10-04 09:31:19 +00:00
|
|
|
extern gboolean recent_read_profile_static(char **rf_path_return, int *rf_errno_return);
|
2008-04-28 12:35:03 +00:00
|
|
|
|
2005-05-30 04:06:22 +00:00
|
|
|
/** Read recent settings file (dynamic part).
|
|
|
|
*
|
|
|
|
* @param rf_path_return path to recent file if function failed
|
|
|
|
* @param rf_errno_return if failed
|
2015-10-04 09:31:19 +00:00
|
|
|
* @return TRUE if succeeded, FALSE if failed (check parameters for reason).
|
2005-05-30 04:06:22 +00:00
|
|
|
*/
|
2015-10-04 09:31:19 +00:00
|
|
|
extern gboolean recent_read_dynamic(char **rf_path_return, int *rf_errno_return);
|
2004-01-19 00:42:12 +00:00
|
|
|
|
2005-05-30 04:06:22 +00:00
|
|
|
/**
|
|
|
|
* Given a -o command line string, parse it and set the recent value in
|
|
|
|
* question. Return an indication of whether it succeeded or failed
|
|
|
|
* in some fashion.
|
|
|
|
*
|
2005-07-19 20:46:38 +00:00
|
|
|
* @param prefarg a string of the form "<recent name>:<recent value>", as might appear
|
2005-05-30 04:06:22 +00:00
|
|
|
* as an argument to a "-o" command line option
|
|
|
|
* @return PREFS_SET_OK or PREFS_SET_SYNTAX_ERR
|
|
|
|
*/
|
|
|
|
extern int recent_set_arg(char *prefarg);
|
|
|
|
|
2008-04-12 19:37:05 +00:00
|
|
|
/** Get the column width for the given column
|
2011-12-29 00:08:47 +00:00
|
|
|
*
|
2008-04-12 19:37:05 +00:00
|
|
|
* @param col column number
|
|
|
|
*/
|
|
|
|
extern gint recent_get_column_width(gint col);
|
|
|
|
|
2008-06-14 16:45:06 +00:00
|
|
|
/** Set the column width for the given column
|
2011-12-29 00:08:47 +00:00
|
|
|
*
|
2008-06-14 16:45:06 +00:00
|
|
|
* @param col column number
|
|
|
|
* @param width column width
|
|
|
|
*/
|
|
|
|
extern void recent_set_column_width(gint col, gint width);
|
|
|
|
|
2009-12-01 17:07:13 +00:00
|
|
|
/** Get the column xalign for the given column
|
2011-12-29 00:08:47 +00:00
|
|
|
*
|
2009-12-01 17:07:13 +00:00
|
|
|
* @param col column number
|
|
|
|
*/
|
|
|
|
extern gchar recent_get_column_xalign(gint col);
|
|
|
|
|
|
|
|
/** Set the column xalign for the given column
|
|
|
|
*
|
|
|
|
* @param col column number
|
|
|
|
* @param xalign column alignment
|
|
|
|
*/
|
|
|
|
extern void recent_set_column_xalign(gint col, gchar xalign);
|
|
|
|
|
2013-02-02 05:34:31 +00:00
|
|
|
/* save the window and its current geometry into the geometry hashtable */
|
|
|
|
extern void window_geom_save(const gchar *name, window_geometry_t *geom);
|
|
|
|
|
|
|
|
/* load the desired geometry for this window from the geometry hashtable */
|
|
|
|
extern gboolean window_geom_load(const gchar *name, window_geometry_t *geom);
|
|
|
|
|
2023-11-27 14:54:18 +00:00
|
|
|
extern void window_splitter_save(const char *name, const char *splitter_state);
|
|
|
|
|
|
|
|
extern const char * window_splitter_load(const char *name);
|
|
|
|
|
2013-07-27 22:37:26 +00:00
|
|
|
/**
|
|
|
|
* Returns a list of recent capture filters.
|
|
|
|
*
|
|
|
|
* @param ifname interface name; NULL refers to the global list.
|
|
|
|
*/
|
|
|
|
extern GList *recent_get_cfilter_list(const gchar *ifname);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a capture filter to the global recent capture filter list or
|
|
|
|
* the recent capture filter list for an interface.
|
|
|
|
*
|
|
|
|
* @param ifname interface name; NULL refers to the global list.
|
|
|
|
* @param s text of capture filter
|
|
|
|
*/
|
|
|
|
extern void recent_add_cfilter(const gchar *ifname, const gchar *s);
|
|
|
|
|
2014-07-09 11:50:11 +00:00
|
|
|
/**
|
2017-02-21 02:46:08 +00:00
|
|
|
* Get the value of an entry for a remote host from the remote host list.
|
2014-07-09 11:50:11 +00:00
|
|
|
*
|
2017-02-21 02:46:08 +00:00
|
|
|
* @param host host name for the remote host.
|
|
|
|
*
|
|
|
|
* @return pointer to the entry for the remote host.
|
2014-07-09 11:50:11 +00:00
|
|
|
*/
|
|
|
|
extern struct remote_host *recent_get_remote_host(const gchar *host);
|
|
|
|
|
|
|
|
/**
|
2017-02-21 02:46:08 +00:00
|
|
|
* Get the number of entries of the remote host list.
|
2014-07-09 11:50:11 +00:00
|
|
|
*
|
2017-02-21 02:46:08 +00:00
|
|
|
* @return number of entries in the list.
|
2014-07-09 11:50:11 +00:00
|
|
|
*/
|
2014-07-11 07:34:38 +00:00
|
|
|
extern int recent_get_remote_host_list_size(void);
|
2014-07-09 11:50:11 +00:00
|
|
|
|
|
|
|
/**
|
2017-02-21 02:46:08 +00:00
|
|
|
* Iterate over all items in the remote host list, calling a
|
2017-02-21 02:31:15 +00:00
|
|
|
* function for each member
|
2014-07-09 11:50:11 +00:00
|
|
|
*
|
2017-02-21 02:46:08 +00:00
|
|
|
* @param func function to be called
|
|
|
|
* @param user_data argument to pass as user data to the function
|
2014-07-09 11:50:11 +00:00
|
|
|
*/
|
2023-11-19 14:24:37 +00:00
|
|
|
extern void recent_remote_host_list_foreach(GFunc func, gpointer user_data);
|
2014-07-09 11:50:11 +00:00
|
|
|
|
|
|
|
/**
|
2017-02-21 02:46:08 +00:00
|
|
|
* Free all entries of the remote host list.
|
2014-07-09 11:50:11 +00:00
|
|
|
*/
|
2017-02-21 02:46:08 +00:00
|
|
|
extern void recent_free_remote_host_list(void);
|
2014-07-09 11:50:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add an entry to the remote_host_list.
|
|
|
|
*
|
|
|
|
* @param host Key of the entry
|
2017-02-21 02:46:08 +00:00
|
|
|
* @param rh Value of the entry
|
2014-07-09 11:50:11 +00:00
|
|
|
*/
|
|
|
|
extern void recent_add_remote_host(gchar *host, struct remote_host *rh);
|
|
|
|
|
2011-12-29 00:08:47 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2004-01-19 00:42:12 +00:00
|
|
|
#endif /* recent.h */
|