2 * Declarations of utilities for capture user interfaces
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef __CAPTURE_UI_UTILS_H__
24 #define __CAPTURE_UI_UTILS_H__
26 #include "capture_opts.h"
30 #endif /* __cplusplus */
33 * GList of available capture interfaces.
37 * Find user-specified capture device description that matches interface
40 char *capture_dev_user_descr_find(const gchar *if_name);
43 * Find user-specified link-layer header type that matches interface
46 gint capture_dev_user_linktype_find(const gchar *if_name);
48 #if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
50 * Find user-specified buffer size that matches interface
53 gint capture_dev_user_buffersize_find(const gchar *if_name);
57 * Find user-specified snap length that matches interface
60 gint capture_dev_user_snaplen_find(const gchar *if_name);
61 gboolean capture_dev_user_hassnap_find(const gchar *if_name);
64 * Find user-specified promiscuous mode that matches interface
67 gboolean capture_dev_user_pmode_find(const gchar *if_name);
70 * Find user-specified capture filter that matches interface
73 gchar* capture_dev_user_cfilter_find(const gchar *if_name);
75 /** Return as descriptive a name for an interface as we can get.
76 * If the user has specified a comment, use that. Otherwise,
77 * if capture_interface_list() supplies a description, use that,
78 * otherwise use the interface name.
80 * @param if_name The name of the interface.
82 * @return The descriptive name (must be g_free'd later)
84 char *get_interface_descriptive_name(const char *if_name);
86 /** Build the GList of available capture interfaces.
88 * @param if_list An interface list from capture_interface_list().
89 * @param do_hide Hide the "hidden" interfaces.
91 * @return A list of if_info_t structs (use free_capture_combo_list() later).
93 GList *build_capture_combo_list(GList *if_list, gboolean do_hide);
95 /** Free the GList from build_capture_combo_list().
97 * @param combo_list the interface list from build_capture_combo_list()
99 void free_capture_combo_list(GList *combo_list);
102 /** Given text that contains an interface name possibly prefixed by an
103 * interface description, extract the interface name.
105 * @param if_text A string containing the interface description + name.
106 * This is usually the data from one of the list elements returned by
107 * build_capture_combo_list().
109 * @return The raw interface name, without description (must NOT be g_free'd later)
111 const char *get_if_name(const char *if_text);
113 /** Convert plain interface name to the displayed name in the combo box.
115 * @param if_list The list of interfaces returned by build_capture_combo_list()
116 * @param if_name The name of the interface.
118 * @return The descriptive name (must be g_free'd later)
120 char *build_capture_combo_name(GList *if_list, gchar *if_name);
122 /** Return the interface description (after setting it if not already set)
124 * @param capture_opts The capture_options structure that contains the used interface
125 * @param i The index of the interface
127 * @return A pointer to interface_opts->descr
129 const char *get_iface_description_for_interface(capture_options *capture_opts, guint i);
133 #endif /* __cplusplus */
135 #endif /* __CAPTURE_UI_UTILS_H__ */