nexmon – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 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 | * @param if_name The name of the interface. |
||
41 | * |
||
42 | * @return The device description (must be g_free'd later) or NULL |
||
43 | * if not found. |
||
44 | */ |
||
45 | char *capture_dev_user_descr_find(const gchar *if_name); |
||
46 | |||
47 | /** |
||
48 | * Find user-specified link-layer header type that matches interface |
||
49 | * name, if any. |
||
50 | * |
||
51 | * @param if_name The name of the interface. |
||
52 | * |
||
53 | * @return The link-layer header type (a DLT_) or -1 if not found. |
||
54 | */ |
||
55 | gint capture_dev_user_linktype_find(const gchar *if_name); |
||
56 | |||
57 | #ifdef CAN_SET_CAPTURE_BUFFER_SIZE |
||
58 | /** |
||
59 | * Find user-specified buffer size that matches interface |
||
60 | * name, if any. |
||
61 | * |
||
62 | * @param if_name The name of the interface. |
||
63 | * |
||
64 | * @return The buffer size or -1 if not found. |
||
65 | */ |
||
66 | gint capture_dev_user_buffersize_find(const gchar *if_name); |
||
67 | #endif |
||
68 | |||
69 | /** |
||
70 | * Find user-specified snap length that matches interface |
||
71 | * name, if any. |
||
72 | * |
||
73 | * @param if_name The name of the interface. |
||
74 | * @param hassnap Pointer to a variable to be set to TRUE if the |
||
75 | * interface should be given a snap length or FALSE if it shouldn't |
||
76 | * be given a snap length. |
||
77 | * @param snaplen Pointer to a variable to be set to the snap length |
||
78 | * if the interface should be given a snap length or the maximum |
||
79 | * snap length if it shouldn't be given a snap length. |
||
80 | * |
||
81 | * @return TRUE if found or FALSE if not found. |
||
82 | */ |
||
83 | gboolean capture_dev_user_snaplen_find(const gchar *if_name, gboolean *hassnap, int *snaplen); |
||
84 | |||
85 | /** |
||
86 | * Find user-specified promiscuous mode that matches interface |
||
87 | * name, if any. |
||
88 | * |
||
89 | * @param if_name The name of the interface. |
||
90 | * @param pmode Pointer to a variable to be set to TRUE if promiscuous |
||
91 | * mode should be used and FALSE if it shouldn't be used. |
||
92 | * |
||
93 | * @return TRUE if found or FALSE if not found. |
||
94 | */ |
||
95 | gboolean capture_dev_user_pmode_find(const gchar *if_name, gboolean *pmode); |
||
96 | |||
97 | /** |
||
98 | * Find user-specified capture filter that matches interface |
||
99 | * name, if any. |
||
100 | * |
||
101 | * This is deprecated and should not be used in new code. |
||
102 | * |
||
103 | * @param if_name The name of the interface. |
||
104 | * |
||
105 | * @return The capture filter (must be g_free'd later) or NULL if not found. |
||
106 | */ |
||
107 | gchar* capture_dev_user_cfilter_find(const gchar *if_name); |
||
108 | |||
109 | /** Return as descriptive a name for an interface as we can get. |
||
110 | * If the user has specified a comment, use that. Otherwise, |
||
111 | * if capture_interface_list() supplies a description, use that, |
||
112 | * otherwise use the interface name. |
||
113 | * |
||
114 | * @param if_name The name of the interface. |
||
115 | * |
||
116 | * @return The descriptive name (must be g_free'd later) |
||
117 | */ |
||
118 | char *get_interface_descriptive_name(const char *if_name); |
||
119 | |||
120 | /** Build the GList of available capture interfaces. |
||
121 | * |
||
122 | * @param if_list An interface list from capture_interface_list(). |
||
123 | * @param do_hide Hide the "hidden" interfaces. |
||
124 | * |
||
125 | * @return A list of if_info_t structs (use free_capture_combo_list() later). |
||
126 | */ |
||
127 | GList *build_capture_combo_list(GList *if_list, gboolean do_hide); |
||
128 | |||
129 | /** Free the GList from build_capture_combo_list(). |
||
130 | * |
||
131 | * @param combo_list the interface list from build_capture_combo_list() |
||
132 | */ |
||
133 | void free_capture_combo_list(GList *combo_list); |
||
134 | |||
135 | |||
136 | /** Given text that contains an interface name possibly prefixed by an |
||
137 | * interface description, extract the interface name. |
||
138 | * |
||
139 | * @param if_text A string containing the interface description + name. |
||
140 | * This is usually the data from one of the list elements returned by |
||
141 | * build_capture_combo_list(). |
||
142 | * |
||
143 | * @return The raw interface name, without description (must NOT be g_free'd later) |
||
144 | */ |
||
145 | const char *get_if_name(const char *if_text); |
||
146 | |||
147 | /** Return the interface description (after setting it if not already set) |
||
148 | * |
||
149 | * @param capture_opts The capture_options structure that contains the used interface |
||
150 | * @param i The index of the interface |
||
151 | * |
||
152 | * @return A pointer to interface_opts->descr |
||
153 | */ |
||
154 | const char *get_iface_description_for_interface(capture_options *capture_opts, guint i); |
||
155 | |||
156 | /** Set the active DLT for a device appropriately. |
||
157 | * |
||
158 | * @param device the device on which to set the active DLT |
||
159 | * @param global_default_dlt the global default DLT |
||
160 | */ |
||
161 | extern void set_active_dlt(interface_t *device, int global_default_dlt); |
||
162 | |||
163 | /** Get a descriptive string for a list of interfaces. |
||
164 | * |
||
165 | * @param capture_opts The capture_options structure that contains the interfaces |
||
166 | * @param style flags to indicate the style of string to use: |
||
167 | * |
||
168 | * IFLIST_QUOTE_IF_DESCRIPTION: put the interface descriptive string in |
||
169 | * single quotes |
||
170 | * |
||
171 | * IFLIST_SHOW_FILTER: include the capture filters in the string |
||
172 | * |
||
173 | * @return A GString set to the descriptive string |
||
174 | */ |
||
175 | #define IFLIST_QUOTE_IF_DESCRIPTION 0x00000001 |
||
176 | #define IFLIST_SHOW_FILTER 0x00000002 |
||
177 | |||
178 | extern GString *get_iface_list_string(capture_options *capture_opts, guint32 style); |
||
179 | |||
180 | /** Get the interface display name to present in the interfaces list. |
||
181 | * |
||
182 | * @param description A user-specified capture device description |
||
183 | * @param if_info The if_info for the interface |
||
184 | * |
||
185 | * @return A interface display name (must be g_free'd later) |
||
186 | */ |
||
187 | extern gchar *get_iface_display_name(const gchar *description, const if_info_t *if_info); |
||
188 | |||
189 | #ifdef __cplusplus |
||
190 | } |
||
191 | #endif /* __cplusplus */ |
||
192 | |||
193 | #endif /* __CAPTURE_UI_UTILS_H__ */ |
||
194 | |||
195 | /* |
||
196 | * Editor modelines - http://www.wireshark.org/tools/modelines.html |
||
197 | * |
||
198 | * Local Variables: |
||
199 | * c-basic-offset: 2 |
||
200 | * tab-width: 8 |
||
201 | * indent-tabs-mode: nil |
||
202 | * End: |
||
203 | * |
||
204 | * vi: set shiftwidth=2 tabstop=8 expandtab: |
||
205 | * :indentSize=2:tabSize=8:noTabs=true: |
||
206 | */ |