Rename temp variables to a more human readable form
[metze/wireshark/wip.git] / capture_ui_utils.h
1 /* capture_ui_utils.c
2  * Declarations of utilities for capture user interfaces
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
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.
12  *
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.
17  *
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.
21  */
22
23 #ifndef __CAPTURE_UI_UTILS_H__
24 #define __CAPTURE_UI_UTILS_H__
25
26 #include "capture_opts.h"
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
31
32 /** @file
33  *  GList of available capture interfaces.
34  */
35
36 /**
37  * Find user-specified capture device description that matches interface
38  * name, if any.
39  */
40 char *capture_dev_user_descr_find(const gchar *if_name);
41
42 /**
43  * Find user-specified link-layer header type that matches interface
44  * name, if any.
45  */
46 gint capture_dev_user_linktype_find(const gchar *if_name);
47
48 #if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
49 /**
50  * Find user-specified buffer size that matches interface
51  * name, if any.
52  */
53 gint capture_dev_user_buffersize_find(const gchar *if_name);
54 #endif
55
56 /**
57  * Find user-specified snap length that matches interface
58  * name, if any.
59  */
60 gint capture_dev_user_snaplen_find(const gchar *if_name);
61 gboolean capture_dev_user_hassnap_find(const gchar *if_name);
62
63 /**
64  * Find user-specified promiscuous mode that matches interface
65  * name, if any.
66  */
67 gboolean capture_dev_user_pmode_find(const gchar *if_name);
68
69 /** Return as descriptive a name for an interface as we can get.
70  * If the user has specified a comment, use that.  Otherwise,
71  * if capture_interface_list() supplies a description, use that,
72  * otherwise use the interface name.
73  *
74  * @param if_name The name of the interface.
75  *
76  * @return The descriptive name (must be g_free'd later)
77  */
78 char *get_interface_descriptive_name(const char *if_name);
79
80 /** Build the GList of available capture interfaces.
81  *
82  * @param if_list An interface list from capture_interface_list().
83  * @param do_hide Hide the "hidden" interfaces.
84  *
85  * @return A list of if_info_t structs (use free_capture_combo_list() later).
86  */
87 GList *build_capture_combo_list(GList *if_list, gboolean do_hide);
88
89 /** Free the GList from build_capture_combo_list().
90  *
91  * @param combo_list the interface list from build_capture_combo_list()
92  */
93 void free_capture_combo_list(GList *combo_list);
94
95
96 /** Given text that contains an interface name possibly prefixed by an
97  * interface description, extract the interface name.
98  *
99  * @param if_text A string containing the interface description + name.
100  * This is usually the data from one of the list elements returned by
101  * build_capture_combo_list().
102  *
103  * @return The raw interface name, without description (must NOT be g_free'd later)
104  */
105 const char *get_if_name(const char *if_text);
106
107 /** Convert plain interface name to the displayed name in the combo box.
108  *
109  * @param if_list The list of interfaces returned by build_capture_combo_list()
110  * @param if_name The name of the interface.
111  *
112  * @return The descriptive name (must be g_free'd later)
113  */
114 char *build_capture_combo_name(GList *if_list, gchar *if_name);
115
116 /** Return the interface description (after setting it if not already set)
117  *
118  * @param capture_opts The capture_options structure that contains the used interface
119  * @param i The index of the interface
120  *
121  * @return A pointer to interface_opts->descr
122  */
123 const char *get_iface_description_for_interface(capture_options *capture_opts, guint i);
124
125 #ifdef __cplusplus
126 }
127 #endif /* __cplusplus */
128
129 #endif /* __CAPTURE_UI_UTILS_H__ */