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