Wireshark 2.9.0-477-g68ec514b The Wireshark network protocol analyzer

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

airpcap_loader.h
1 /* airpcap_loader.h
2 * Declarations of routines for the "About" dialog
3 *
4 * Giorgio Tino <giorgio.tino@cacetech.com>
5 * Copyright (c) CACE Technologies, LLC 2006
6 *
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
10 *
11 * SPDX-License-Identifier: GPL-2.0-or-later
12 */
13
14 #ifndef __AIRPCAP_LOADER_H__
15 #define __AIRPCAP_LOADER_H__
16
17 #include <epan/crypt/dot11decrypt_system.h>
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23 /* Error values from "get_airpcap_interface_list()". */
24 #define CANT_GET_AIRPCAP_INTERFACE_LIST 0 /* error getting list */
25 #define NO_AIRPCAP_INTERFACES_FOUND 1 /* list is empty */
26 #define AIRPCAP_NOT_LOADED 2 /* Airpcap DLL not loaded */
27
28 #define AIRPCAP_CHANNEL_ANY_NAME "ANY"
29
30 #define AIRPCAP_WEP_KEY_STRING "WEP"
31 /*
32 * XXX - WPA_PWD is the passphrase+ssid and WPA-PSK is the hexadecimal key
33 */
34 #define AIRPCAP_WPA_PWD_KEY_STRING "WPA-PWD"
35 #define AIRPCAP_WPA_BIN_KEY_STRING "WPA-PSK"
36
37 #define AIRPCAP_DLL_OK 0
38 #define AIRPCAP_DLL_OLD 1
39 #define AIRPCAP_DLL_ERROR 2
40 #define AIRPCAP_DLL_NOT_FOUND 3
41
42 /* #define AIRPCAP_DEBUG 1 */
43
44 typedef gchar * (*AirpcapGetLastErrorHandler)(PAirpcapHandle AdapterHandle);
45 typedef gboolean (*AirpcapGetDeviceListHandler)(PAirpcapDeviceDescription *PPAllDevs, gchar * Ebuf);
46 typedef void (*AirpcapFreeDeviceListHandler)(PAirpcapDeviceDescription PAllDevs);
47 typedef PAirpcapHandle (*AirpcapOpenHandler)(gchar * DeviceName, gchar * Ebuf);
48 typedef void (*AirpcapCloseHandler)(PAirpcapHandle AdapterHandle);
49 typedef gboolean (*AirpcapGetLinkTypeHandler)(PAirpcapHandle AdapterHandle, PAirpcapLinkType PLinkType);
50 typedef gboolean (*AirpcapSetLinkTypeHandler)(PAirpcapHandle AdapterHandle, AirpcapLinkType NewLinkType);
51 typedef gboolean (*AirpcapSetKernelBufferHandler)(PAirpcapHandle AdapterHandle, guint BufferSize);
52 typedef gboolean (*AirpcapSetFilterHandler)(PAirpcapHandle AdapterHandle, void * Instructions, guint Len);
53 typedef gboolean (*AirpcapGetMacAddressHandler)(PAirpcapHandle AdapterHandle, PAirpcapMacAddress PMacAddress);
54 typedef gboolean (*AirpcapSetMinToCopyHandler)(PAirpcapHandle AdapterHandle, guint MinToCopy);
55 typedef gboolean (*AirpcapGetReadEventHandler)(PAirpcapHandle AdapterHandle, void *** PReadEvent);
56 typedef gboolean (*AirpcapReadHandler)(PAirpcapHandle AdapterHandle, guint8 * Buffer, guint BufSize, guint * PReceievedBytes);
57 typedef gboolean (*AirpcapGetStatsHandler)(PAirpcapHandle AdapterHandle, PAirpcapStats PStats);
58 typedef gboolean (*AirpcapTurnLedOnHandler)(PAirpcapHandle AdapterHandle, guint LedNumber);
59 typedef gboolean (*AirpcapTurnLedOffHandler)(PAirpcapHandle AdapterHandle, guint LedNumber);
60 typedef gboolean (*AirpcapSetDeviceChannelHandler)(PAirpcapHandle AdapterHandle, guint Channel);
61 typedef gboolean (*AirpcapGetDeviceChannelHandler)(PAirpcapHandle AdapterHandle, guint * PChannel);
62 typedef gboolean (*AirpcapSetFcsPresenceHandler)(PAirpcapHandle AdapterHandle, gboolean IsFcsPresent);
63 typedef gboolean (*AirpcapGetFcsPresenceHandler)(PAirpcapHandle AdapterHandle, gboolean * PIsFcsPresent);
64 typedef gboolean (*AirpcapSetFcsValidationHandler)(PAirpcapHandle AdapterHandle, AirpcapValidationType ValidationType);
65 typedef gboolean (*AirpcapGetFcsValidationHandler)(PAirpcapHandle AdapterHandle, PAirpcapValidationType PValidationType);
66 typedef gboolean (*AirpcapSetDeviceKeysHandler)(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection);
67 typedef gboolean (*AirpcapGetDeviceKeysHandler)(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, guint * PKeysCollectionSize);
68 typedef gboolean (*AirpcapSetDriverKeysHandler)(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection);
69 typedef gboolean (*AirpcapGetDriverKeysHandler)(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, guint * PKeysCollectionSize);
70 typedef gboolean (*AirpcapSetDecryptionStateHandler)(PAirpcapHandle AdapterHandle, AirpcapDecryptionState Enable);
71 typedef gboolean (*AirpcapGetDecryptionStateHandler)(PAirpcapHandle AdapterHandle, PAirpcapDecryptionState PEnable);
72 typedef gboolean (*AirpcapSetDriverDecryptionStateHandler)(PAirpcapHandle AdapterHandle, AirpcapDecryptionState Enable);
73 typedef gboolean (*AirpcapGetDriverDecryptionStateHandler)(PAirpcapHandle AdapterHandle, PAirpcapDecryptionState PEnable);
74 typedef gboolean (*AirpcapStoreCurConfigAsAdapterDefaultHandler)(PAirpcapHandle AdapterHandle);
75 typedef void (*AirpcapGetVersionHandler)(guint * VersionMajor, guint * VersionMinor, guint * VersionRev, guint * VersionBuild);
76 typedef gboolean (*AirpcapSetDeviceChannelExHandler)(PAirpcapHandle AdapterHandle, AirpcapChannelInfo ChannelInfo);
77 typedef gboolean (*AirpcapGetDeviceChannelExHandler)(PAirpcapHandle AdapterHandle, PAirpcapChannelInfo PChannelInfo);
78 typedef gboolean (*AirpcapGetDeviceSupportedChannelsHandler)(PAirpcapHandle AdapterHandle, AirpcapChannelInfo **ppChannelInfo, guint32 * pNumChannelInfo);
79
80 #define FLAG_CAN_BE_LOW 0x00000001
81 #define FLAG_CAN_BE_HIGH 0x00000002
82 #define FLAG_IS_BG_CHANNEL 0x00000004
83 #define FLAG_IS_A_CHANNEL 0x00000008
84
85 typedef struct _Dot11Channel
86 {
87 guint Channel;
88 guint32 Frequency;
89 guint32 Flags;
90 } Dot11Channel;
91
92 /*
93 * The list of interfaces returned by "get_airpcap_interface_list()" is
94 * a list of these structures.
95 */
96 typedef struct {
97 char *name; /* e.g. "eth0" */
98 char *description; /* from OS, e.g. "Local Area Connection" or NULL */
99 GSList *ip_addr; /* containing address values of if_addr_t */
100 gboolean loopback; /* TRUE if loopback, FALSE otherwise */
101 AirpcapLinkType linkType; /* The link layer type */
102 AirpcapChannelInfo channelInfo; /* Channel Information */
103 gboolean IsFcsPresent; /* Include 802.11 CRC in frames */
104 AirpcapValidationType CrcValidationOn; /* Capture Frames with Wrong CRC */
105 AirpcapDecryptionState DecryptionOn; /* TRUE if decryption is on, FALSE otherwise */
106 PAirpcapKeysCollection keysCollection; /* WEP Key collection for the adapter */
107 guint keysCollectionSize; /* Size of the key collection */
108 gboolean blinking; /* TRUE if is blinkng, FALSE otherwise */
109 gboolean led; /* TRUE if on, FALSE if off */
110 gboolean saved; /* TRUE if current configuration has been saved, FALSE otherwise */
111 gint tag; /* int for the gtk blinking callback */
112 Dot11Channel *pSupportedChannels;
113 guint32 numSupportedChannels;
114 } airpcap_if_info_t;
115
116 /*
117 * Struct used to store infos to pass to the preferences manager callbacks
118 */
119 typedef struct {
120 GList *list;
121 int current_index;
122 int number_of_keys;
123 } keys_cb_data_t;
124
125 /* Airpcap interface list */
126 extern GList *g_airpcap_if_list;
127
128 /* Airpcap current selected interface */
129 extern airpcap_if_info_t *airpcap_if_selected;
130
131 /* Airpcap current active interface */
132 extern airpcap_if_info_t *airpcap_if_active;
133
134 #ifdef AIRPCAP_DEBUG
135 /*
136 * USED FOR DEBUG ONLY... PRINTS AN AirPcap ADAPTER STRUCTURE in a fancy way.
137 */
138 void
139 airpcap_if_info_print(airpcap_if_info_t* if_info);
140 #endif
141
142 /*
143 * Used to retrieve the two chars string from interface
144 */
145 gchar*
146 airpcap_get_if_string_number_from_description(gchar* description);
147
148 /*
149 * Function used to free the airpcap interface list
150 */
151 void
152 free_airpcap_interface_list(GList *if_list);
153
154 /*
155 * Used to retrieve the interface given the name
156 * (the name is used in AirpcapOpen).
157 */
158 airpcap_if_info_t* get_airpcap_if_from_name(GList* if_list, const gchar* name);
159
160 /*
161 * Airpcap wrapper, used to store the current settings for the selected adapter
162 */
163 gboolean
164 airpcap_if_store_cur_config_as_adapter_default(PAirpcapHandle ah);
165
166 /*
167 * Function used to load the WEP keys for a selected interface
168 */
169 gboolean
170 airpcap_if_load_keys(PAirpcapHandle ad, airpcap_if_info_t *if_info);
171
172 /*
173 * Function used to load the WEP keys from the global driver list
174 */
175 gboolean
176 airpcap_if_load_driver_keys(PAirpcapHandle ad, airpcap_if_info_t *if_info);
177
178 /*
179 * Function used to save the WEP keys for a selected interface
180 */
181 void
182 airpcap_if_save_keys(PAirpcapHandle ad, airpcap_if_info_t *if_info);
183
184 /*
185 * Function used to save the WEP keys for a selected interface
186 */
187 void
188 airpcap_if_save_driver_keys(PAirpcapHandle ad, airpcap_if_info_t *if_info);
189
190 /*
191 * Airpcap wrapper, used to get the fcs validation of an airpcap adapter
192 */
193 gboolean
194 airpcap_if_get_fcs_validation(PAirpcapHandle ah, PAirpcapValidationType val);
195
196 /*
197 * Airpcap wrapper, used to set the fcs validation of an airpcap adapter
198 */
199 gboolean
200 airpcap_if_set_fcs_validation(PAirpcapHandle ah, AirpcapValidationType val);
201
202 /* Many of these are GTK+ only. */
203 /*
204 * Airpcap wrapper, used to get the decryption enabling of an airpcap adapter
205 */
206 gboolean
207 airpcap_if_get_decryption_state(PAirpcapHandle ah, PAirpcapDecryptionState val);
208
209 /*
210 * Airpcap wrapper, used to set the decryption enabling of an airpcap adapter
211 */
212 gboolean
213 airpcap_if_set_decryption_state(PAirpcapHandle ah, AirpcapDecryptionState val);
214
215 /*
216 * Airpcap wrapper, used to get the fcs presence of an airpcap adapter
217 */
218 gboolean
219 airpcap_if_get_fcs_presence(PAirpcapHandle ah, gboolean * ch);
220
221 /*
222 * Airpcap wrapper, used to set the fcs presence of an airpcap adapter
223 */
224 gboolean
225 airpcap_if_set_fcs_presence(PAirpcapHandle ah, gboolean ch);
226
227 /*
228 * Airpcap wrapper, used to get the link type of an airpcap adapter
229 */
230 gboolean
231 airpcap_if_get_link_type(PAirpcapHandle ah, PAirpcapLinkType lt);
232
233 /*
234 * Airpcap wrapper, used to set the link type of an airpcap adapter
235 */
236 gboolean
237 airpcap_if_set_link_type(PAirpcapHandle ah, AirpcapLinkType lt);
238
239 /*
240 * Airpcap wrapper, used to get the channel of an airpcap adapter
241 */
242 gboolean
243 airpcap_if_get_device_channel(PAirpcapHandle ah, guint * ch);
244
245 /*
246 * Airpcap wrapper, get the channels supported by the adapter
247 */
248 gboolean
249 airpcap_if_get_device_supported_channels(PAirpcapHandle ah, AirpcapChannelInfo **cInfo, guint32 * nInfo);
250
251 /*
252 * Airpcap wrapper, get supported channels formatted into an array
253 */
254 Dot11Channel*
255 airpcap_if_get_device_supported_channels_array(PAirpcapHandle ah, guint32 * pNumSupportedChannels);
256
257 /*
258 * Airpcap wrapper, used to set the channel of an airpcap adapter
259 */
260 gboolean
261 airpcap_if_set_device_channel(PAirpcapHandle ah, guint ch);
262
263 /*
264 * Airpcap wrapper, used to get the frequency of an airpcap adapter
265 */
266 gboolean
267 airpcap_if_get_device_channel_ex(PAirpcapHandle ah, PAirpcapChannelInfo pChannelInfo);
268
269 /*
270 * Airpcap wrapper, used to set the frequency of an airpcap adapter
271 */
272 gboolean
273 airpcap_if_set_device_channel_ex(PAirpcapHandle ah, AirpcapChannelInfo ChannelInfo);
274
275 /*
276 * Airpcap wrapper, used to open an airpcap adapter
277 */
278 PAirpcapHandle airpcap_if_open(gchar * name, gchar * err);
279
280 /*
281 * Airpcap wrapper, used to close an airpcap adapter
282 */
283 void airpcap_if_close(PAirpcapHandle handle);
284
285 /*
286 * Retrieve the state of the Airpcap DLL
287 */
288 int
289 airpcap_get_dll_state(void);
290
291 /*
292 * Airpcap wrapper, used to turn on the led of an airpcap adapter
293 */
294 gboolean airpcap_if_turn_led_on(PAirpcapHandle AdapterHandle, guint LedNumber);
295
296 /*
297 * Airpcap wrapper, used to turn off the led of an airpcap adapter
298 */
299 gboolean airpcap_if_turn_led_off(PAirpcapHandle AdapterHandle, guint LedNumber);
300
301 /*
302 * This function will create a new airpcap_if_info_t using a name and a description
303 */
304 airpcap_if_info_t* airpcap_if_info_new(char *name, char *description);
305
306 /*
307 * This function will create a new fake drivers' interface, to load global keys...
308 */
309 airpcap_if_info_t* airpcap_driver_fake_if_info_new(void);
310
311 /*
312 * Used to dinamically load the airpcap library in order link it only when
313 * it's present on the system.
314 */
315 int load_airpcap(void);
316
317 /*
318 * This function will use the airpcap.dll to find all the airpcap devices.
319 * Will return null if no device is found.
320 */
321 GList* get_airpcap_interface_list(int *err, char **err_str);
322
323 /*
324 * Load the configuration for the specified interface
325 */
326 void
327 airpcap_load_selected_if_configuration(airpcap_if_info_t* if_info);
328
329 /*
330 * Save the configuration for the specified interface
331 */
332 void
333 airpcap_save_selected_if_configuration(airpcap_if_info_t* if_info);
334
335 /*
336 * Used to retrieve the two chars string from interface description
337 */
338 gchar*
339 airpcap_get_if_string_number(airpcap_if_info_t* if_info);
340
341 /*
342 * Airpcap wrapper, used to save the settings for the selected_if
343 */
344 gboolean
345 airpcap_if_set_device_keys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection);
346
347 /*
348 * Airpcap wrapper, used to save the settings for the selected_if
349 */
350 gboolean
351 airpcap_if_get_device_keys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, guint * PKeysCollectionSize);
352
353 /*
354 * Airpcap wrapper, used to save the settings for the selected_if
355 */
356 gboolean
357 airpcap_if_set_driver_keys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection);
358
359 /*
360 * Airpcap wrapper, used to save the settings for the selected_if
361 */
362 gboolean
363 airpcap_if_get_driver_keys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, guint * PKeysCollectionSize);
364
365 /*
366 * Airpcap wrapper, used to get the decryption enabling of an airpcap driver
367 */
368 gboolean
369 airpcap_if_get_driver_decryption_state(PAirpcapHandle ah, PAirpcapDecryptionState PEnable);
370 /*
371 * Airpcap wrapper, used to set the decryption enabling of an airpcap driver
372 */
373 gboolean
374 airpcap_if_set_driver_decryption_state(PAirpcapHandle ah, AirpcapDecryptionState Enable);
375
376 /*
377 * Save the configuration for the specified interface
378 */
379 void
380 airpcap_save_driver_if_configuration(airpcap_if_info_t* fake_if_info);
381
382 /*
383 * Free an instance of airpcap_if_info_t
384 */
385 void
386 airpcap_if_info_free(airpcap_if_info_t *if_info);
387
388 /*
389 * Clear keys and decryption status for the specified interface
390 */
391 void
392 airpcap_if_clear_decryption_settings(airpcap_if_info_t* info_if);
393
394 /*
395 * Adds compiled version string to str
396 */
397 void
398 get_compiled_airpcap_version(GString *str);
399
400 void
401 get_runtime_airpcap_version(GString *str);
402
403 #ifdef __cplusplus
404 }
405 #endif
406
407 #endif /* __AIRPCAP_LOADER_H__ */
keys_cb_data_t
Definition: airpcap_loader.h:119
_AirpcapDeviceDescription
Entry in the list returned by AirpcapGetDeviceList();.
Definition: airpcap.h:67
Buffer
Definition: buffer.h:21
_AirpcapStats
Capture statistics. Returned by AirpcapGetStats();.
Definition: airpcap.h:241
AirpcapDecryptionState
enum _AirpcapDecryptionState AirpcapDecryptionState
Type of decryption the adapter performs. An adapter can be instructed to turn decryption (based on th...
_AirpcapMacAddress
Storage for a MAC address.
Definition: airpcap.h:144
airpcap_if_info_t
Definition: airpcap_loader.h:96
_AirpcapChannelInfo
Channel information. Used by AirpcapSetDeviceChannelEx(), AirpcapGetDeviceChannelEx(), AirpcapGetDeviceSupportedChannels()
Definition: airpcap.h:258
_AirpcapKeysCollection
This structure is used to store a collection of WEP keys. Note that the definition of the structure h...
Definition: airpcap.h:173
_Dot11Channel
Definition: airpcap_loader.h:85
AirpcapValidationType
enum _AirpcapValidationType AirpcapValidationType
Type of frame validation the adapter performs. An adapter can be instructed to accept different kind ...
AirpcapLinkType
enum _AirpcapLinkType AirpcapLinkType
Link type. AirPcap supports two kind of 802.11 linktypes: plain 802.11 and radiotap.