TODO netlogon_user_flags_ntlmv2_enabled
[wireshark-sm.git] / ui / capture_ui_utils.h
blobd5ceb0796a4116b18d57b856681d30660173ea50
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 "ui/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 /**
47 * Find user-specified buffer size that matches interface
48 * name, if any.
50 * @param if_name The name of the interface.
52 * @return The buffer size or -1 if not found.
54 int capture_dev_user_buffersize_find(const char *if_name);
56 /**
57 * Find user-specified snap length that matches interface
58 * name, if any.
60 * @param if_name The name of the interface.
61 * @param hassnap Pointer to a variable to be set to true if the
62 * interface should be given a snap length or false if it shouldn't
63 * be given a snap length.
64 * @param snaplen Pointer to a variable to be set to the snap length
65 * if the interface should be given a snap length or the maximum
66 * snap length if it shouldn't be given a snap length.
68 * @return true if found or false if not found.
70 bool capture_dev_user_snaplen_find(const char *if_name, bool *hassnap, int *snaplen);
72 /**
73 * Find user-specified promiscuous mode that matches interface
74 * name, if any.
76 * @param if_name The name of the interface.
77 * @param pmode Pointer to a variable to be set to true if promiscuous
78 * mode should be used and false if it shouldn't be used.
80 * @return true if found or false if not found.
82 bool capture_dev_user_pmode_find(const char *if_name, bool *pmode);
84 /**
85 * Find user-specified capture filter that matches interface
86 * name, if any.
88 * This is deprecated and should not be used in new code.
90 * @param if_name The name of the interface.
92 * @return The capture filter (must be g_free'd later) or NULL if not found.
94 char* capture_dev_user_cfilter_find(const char *if_name);
96 /** Return as descriptive a name for an interface as we can get.
97 * If the user has specified a comment, use that. Otherwise,
98 * if the get_iface_list() method of capture_opts supplies a
99 * description, use that, otherwise use the interface name.
101 * @param capture_opts The capture options to use to find the interface
102 * @param if_name The name of the interface.
104 * @return The descriptive name (must be g_free'd later)
106 char *get_interface_descriptive_name(const capture_options *capture_opts, const char *if_name);
108 /** Build the GList of available capture interfaces.
110 * @param if_list An interface list from capture_interface_list().
111 * @param do_hide Hide the "hidden" interfaces.
113 * @return A list of if_info_t structs (use free_capture_combo_list() later).
115 GList *build_capture_combo_list(GList *if_list, bool do_hide);
117 /** Free the GList from build_capture_combo_list().
119 * @param combo_list the interface list from build_capture_combo_list()
121 void free_capture_combo_list(GList *combo_list);
124 /** Given text that contains an interface name possibly prefixed by an
125 * interface description, extract the interface name.
127 * @param if_text A string containing the interface description + name.
128 * This is usually the data from one of the list elements returned by
129 * build_capture_combo_list().
131 * @return The raw interface name, without description (must NOT be g_free'd later)
133 const char *get_if_name(const char *if_text);
135 /** Set the active DLT for a device appropriately.
137 * @param device the device on which to set the active DLT
138 * @param global_default_dlt the global default DLT
140 extern void set_active_dlt(interface_t *device, int global_default_dlt);
142 /** Get a descriptive string for a list of interfaces.
144 * @param capture_opts The capture_options structure that contains the interfaces
145 * @param style flags to indicate the style of string to use:
147 * IFLIST_QUOTE_IF_DESCRIPTION: put the interface descriptive string in
148 * single quotes
150 * IFLIST_SHOW_FILTER: include the capture filters in the string
152 * @return A GString set to the descriptive string
154 #define IFLIST_QUOTE_IF_DESCRIPTION 0x00000001
155 #define IFLIST_SHOW_FILTER 0x00000002
157 extern GString *get_iface_list_string(capture_options *capture_opts, uint32_t style);
159 #ifdef __cplusplus
161 #endif /* __cplusplus */
163 #endif /* __CAPTURE_UI_UTILS_H__ */