LATER... ei_kerberos_kdc_session_key ...
[wireshark-sm.git] / ui / capture_ui_utils.h
blobc6f32f12fe0eb3ba16a5d022f57559813f366f4e
1 /** @file
3 * Declarations of utilities for capture user interfaces
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 #ifndef __CAPTURE_UI_UTILS_H__
13 #define __CAPTURE_UI_UTILS_H__
15 #include "capture_opts.h"
17 #ifdef __cplusplus
18 extern "C" {
19 #endif /* __cplusplus */
21 /** @file
22 * GList of available capture interfaces.
25 /**
26 * Find user-specified capture device description that matches interface
27 * name, if any.
29 * @param if_name The name of the interface.
31 * @return The device description (must be g_free'd later) or NULL
32 * if not found.
34 char *capture_dev_user_descr_find(const char *if_name);
36 /**
37 * Find user-specified link-layer header type that matches interface
38 * name, if any.
40 * @param if_name The name of the interface.
42 * @return The link-layer header type (a DLT_) or -1 if not found.
44 int capture_dev_user_linktype_find(const char *if_name);
46 #ifdef CAN_SET_CAPTURE_BUFFER_SIZE
47 /**
48 * Find user-specified buffer size that matches interface
49 * name, if any.
51 * @param if_name The name of the interface.
53 * @return The buffer size or -1 if not found.
55 int capture_dev_user_buffersize_find(const char *if_name);
56 #endif
58 /**
59 * Find user-specified snap length that matches interface
60 * name, if any.
62 * @param if_name The name of the interface.
63 * @param hassnap Pointer to a variable to be set to true if the
64 * interface should be given a snap length or false if it shouldn't
65 * be given a snap length.
66 * @param snaplen Pointer to a variable to be set to the snap length
67 * if the interface should be given a snap length or the maximum
68 * snap length if it shouldn't be given a snap length.
70 * @return true if found or false if not found.
72 bool capture_dev_user_snaplen_find(const char *if_name, bool *hassnap, int *snaplen);
74 /**
75 * Find user-specified promiscuous mode that matches interface
76 * name, if any.
78 * @param if_name The name of the interface.
79 * @param pmode Pointer to a variable to be set to true if promiscuous
80 * mode should be used and false if it shouldn't be used.
82 * @return true if found or false if not found.
84 bool capture_dev_user_pmode_find(const char *if_name, bool *pmode);
86 /**
87 * Find user-specified capture filter that matches interface
88 * name, if any.
90 * This is deprecated and should not be used in new code.
92 * @param if_name The name of the interface.
94 * @return The capture filter (must be g_free'd later) or NULL if not found.
96 char* capture_dev_user_cfilter_find(const char *if_name);
98 /** Return as descriptive a name for an interface as we can get.
99 * If the user has specified a comment, use that. Otherwise,
100 * if the get_iface_list() method of capture_opts supplies a
101 * description, use that, otherwise use the interface name.
103 * @param capture_opts The capture options to use to find the interface
104 * @param if_name The name of the interface.
106 * @return The descriptive name (must be g_free'd later)
108 char *get_interface_descriptive_name(const capture_options *capture_opts, const char *if_name);
110 /** Build the GList of available capture interfaces.
112 * @param if_list An interface list from capture_interface_list().
113 * @param do_hide Hide the "hidden" interfaces.
115 * @return A list of if_info_t structs (use free_capture_combo_list() later).
117 GList *build_capture_combo_list(GList *if_list, bool do_hide);
119 /** Free the GList from build_capture_combo_list().
121 * @param combo_list the interface list from build_capture_combo_list()
123 void free_capture_combo_list(GList *combo_list);
126 /** Given text that contains an interface name possibly prefixed by an
127 * interface description, extract the interface name.
129 * @param if_text A string containing the interface description + name.
130 * This is usually the data from one of the list elements returned by
131 * build_capture_combo_list().
133 * @return The raw interface name, without description (must NOT be g_free'd later)
135 const char *get_if_name(const char *if_text);
137 /** Set the active DLT for a device appropriately.
139 * @param device the device on which to set the active DLT
140 * @param global_default_dlt the global default DLT
142 extern void set_active_dlt(interface_t *device, int global_default_dlt);
144 /** Get a descriptive string for a list of interfaces.
146 * @param capture_opts The capture_options structure that contains the interfaces
147 * @param style flags to indicate the style of string to use:
149 * IFLIST_QUOTE_IF_DESCRIPTION: put the interface descriptive string in
150 * single quotes
152 * IFLIST_SHOW_FILTER: include the capture filters in the string
154 * @return A GString set to the descriptive string
156 #define IFLIST_QUOTE_IF_DESCRIPTION 0x00000001
157 #define IFLIST_SHOW_FILTER 0x00000002
159 extern GString *get_iface_list_string(capture_options *capture_opts, uint32_t style);
161 #ifdef __cplusplus
163 #endif /* __cplusplus */
165 #endif /* __CAPTURE_UI_UTILS_H__ */