2 * Declarations of routines for the "About" dialog
6 * Giorgio Tino <giorgio.tino@cacetech.com>
7 * Copyright (c) CACE Technologies, LLC 2006
9 * Wireshark - Network traffic analyzer
10 * By Gerald Combs <gerald@wireshark.org>
11 * Copyright 1998 Gerald Combs
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 #ifndef __AIRPCAP_LOADER_H__
29 #define __AIRPCAP_LOADER_H__
31 #include <epan/crypt/airpdcap_user.h>
33 /* Error values from "get_airpcap_interface_list()". */
34 #define CANT_GET_AIRPCAP_INTERFACE_LIST 0 /* error getting list */
35 #define NO_AIRPCAP_INTERFACES_FOUND 1 /* list is empty */
36 #define AIRPCAP_NOT_LOADED 2 /* Airpcap DLL not loaded */
38 #define AIRPCAP_CHANNEL_ANY_NAME "ANY"
40 #define AIRPCAP_WEP_KEY_STRING "WEP"
42 * XXX - WPA_PWD is the passphrase+ssid and WPA-PSK is the hexadecimal key
44 #define AIRPCAP_WPA_PWD_KEY_STRING "WPA-PWD"
45 #define AIRPCAP_WPA_BIN_KEY_STRING "WPA-PSK"
47 #define AIRPCAP_DLL_OK 0
48 #define AIRPCAP_DLL_OLD 1
49 #define AIRPCAP_DLL_ERROR 2
50 #define AIRPCAP_DLL_NOT_FOUND 3
52 typedef gchar * (*AirpcapGetLastErrorHandler)(PAirpcapHandle AdapterHandle);
53 typedef gboolean (*AirpcapGetDeviceListHandler)(PAirpcapDeviceDescription *PPAllDevs, gchar * Ebuf);
54 typedef void (*AirpcapFreeDeviceListHandler)(PAirpcapDeviceDescription PAllDevs);
55 typedef PAirpcapHandle (*AirpcapOpenHandler)(gchar * DeviceName, gchar * Ebuf);
56 typedef void (*AirpcapCloseHandler)(PAirpcapHandle AdapterHandle);
57 typedef gboolean (*AirpcapGetLinkTypeHandler)(PAirpcapHandle AdapterHandle, PAirpcapLinkType PLinkType);
58 typedef gboolean (*AirpcapSetLinkTypeHandler)(PAirpcapHandle AdapterHandle, AirpcapLinkType NewLinkType);
59 typedef gboolean (*AirpcapSetKernelBufferHandler)(PAirpcapHandle AdapterHandle, guint BufferSize);
60 typedef gboolean (*AirpcapSetFilterHandler)(PAirpcapHandle AdapterHandle, void * Instructions, guint Len);
61 typedef gboolean (*AirpcapGetMacAddressHandler)(PAirpcapHandle AdapterHandle, PAirpcapMacAddress PMacAddress);
62 typedef gboolean (*AirpcapSetMinToCopyHandler)(PAirpcapHandle AdapterHandle, guint MinToCopy);
63 typedef gboolean (*AirpcapGetReadEventHandler)(PAirpcapHandle AdapterHandle, void *** PReadEvent);
64 typedef gboolean (*AirpcapReadHandler)(PAirpcapHandle AdapterHandle, guint8 * Buffer, guint BufSize, guint * PReceievedBytes);
65 typedef gboolean (*AirpcapGetStatsHandler)(PAirpcapHandle AdapterHandle, PAirpcapStats PStats);
66 typedef gboolean (*AirpcapTurnLedOnHandler)(PAirpcapHandle AdapterHandle, guint LedNumber);
67 typedef gboolean (*AirpcapTurnLedOffHandler)(PAirpcapHandle AdapterHandle, guint LedNumber);
68 typedef gboolean (*AirpcapSetDeviceChannelHandler)(PAirpcapHandle AdapterHandle, guint Channel);
69 typedef gboolean (*AirpcapGetDeviceChannelHandler)(PAirpcapHandle AdapterHandle, guint * PChannel);
70 typedef gboolean (*AirpcapSetFcsPresenceHandler)(PAirpcapHandle AdapterHandle, gboolean IsFcsPresent);
71 typedef gboolean (*AirpcapGetFcsPresenceHandler)(PAirpcapHandle AdapterHandle, gboolean * PIsFcsPresent);
72 typedef gboolean (*AirpcapSetFcsValidationHandler)(PAirpcapHandle AdapterHandle, AirpcapValidationType ValidationType);
73 typedef gboolean (*AirpcapGetFcsValidationHandler)(PAirpcapHandle AdapterHandle, PAirpcapValidationType PValidationType);
74 typedef gboolean (*AirpcapSetDeviceKeysHandler)(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection);
75 typedef gboolean (*AirpcapGetDeviceKeysHandler)(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, guint * PKeysCollectionSize);
76 typedef gboolean (*AirpcapSetDriverKeysHandler)(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection);
77 typedef gboolean (*AirpcapGetDriverKeysHandler)(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, guint * PKeysCollectionSize);
78 typedef gboolean (*AirpcapSetDecryptionStateHandler)(PAirpcapHandle AdapterHandle, AirpcapDecryptionState Enable);
79 typedef gboolean (*AirpcapGetDecryptionStateHandler)(PAirpcapHandle AdapterHandle, PAirpcapDecryptionState PEnable);
80 typedef gboolean (*AirpcapSetDriverDecryptionStateHandler)(PAirpcapHandle AdapterHandle, AirpcapDecryptionState Enable);
81 typedef gboolean (*AirpcapGetDriverDecryptionStateHandler)(PAirpcapHandle AdapterHandle, PAirpcapDecryptionState PEnable);
82 typedef gboolean (*AirpcapStoreCurConfigAsAdapterDefaultHandler)(PAirpcapHandle AdapterHandle);
83 typedef void (*AirpcapGetVersionHandler)(guint * VersionMajor, guint * VersionMinor, guint * VersionRev, guint * VersionBuild);
84 typedef gboolean (*AirpcapSetDeviceChannelExHandler)(PAirpcapHandle AdapterHandle, AirpcapChannelInfo ChannelInfo);
85 typedef gboolean (*AirpcapGetDeviceChannelExHandler)(PAirpcapHandle AdapterHandle, PAirpcapChannelInfo PChannelInfo);
86 typedef gboolean (*AirpcapGetDeviceSupportedChannelsHandler)(PAirpcapHandle AdapterHandle, AirpcapChannelInfo **ppChannelInfo, guint32 * pNumChannelInfo);
88 #define FLAG_CAN_BE_LOW 0x00000001
89 #define FLAG_CAN_BE_HIGH 0x00000002
90 #define FLAG_IS_BG_CHANNEL 0x00000004
91 #define FLAG_IS_A_CHANNEL 0x00000008
93 typedef struct _Dot11Channel
101 * The list of interfaces returned by "get_airpcap_interface_list()" is
102 * a list of these structures.
105 char *name; /* e.g. "eth0" */
106 char *description; /* from OS, e.g. "Local Area Connection" or NULL */
107 GSList *ip_addr; /* containing address values of if_addr_t */
108 gboolean loopback; /* TRUE if loopback, FALSE otherwise */
109 AirpcapLinkType linkType; /* The link layer type */
110 AirpcapChannelInfo channelInfo; /* Channel Information */
111 gboolean IsFcsPresent; /* Include 802.11 CRC in frames */
112 AirpcapValidationType CrcValidationOn; /* Capture Frames with Wrong CRC */
113 AirpcapDecryptionState DecryptionOn; /* TRUE if decryption is on, FALSE otherwise */
114 PAirpcapKeysCollection keysCollection; /* WEP Key collection for the adapter */
115 guint keysCollectionSize; /* Size of the key collection */
116 gboolean blinking; /* TRUE if is blinkng, FALSE otherwise */
117 gboolean led; /* TRUE if on, FALSE if off */
118 gboolean saved; /* TRUE if current configuration has been saved, FALSE otherwise */
119 gint tag; /* int for the gtk blinking callback */
120 Dot11Channel *pSupportedChannels;
121 guint32 numSupportedChannels;
125 * Struct used to store infos to pass to the preferences manager callbacks
133 /* Airpcap interface list */
134 extern GList *airpcap_if_list;
136 /* Airpcap current selected interface */
137 extern airpcap_if_info_t *airpcap_if_selected;
139 /* Airpcap current active interface */
140 extern airpcap_if_info_t *airpcap_if_active;
142 /* WLAN preferences pointer */
143 /*extern module_t *wlan_prefs; - TODO: What is this?? */
146 * Function used to read the Decryption Keys from the preferences and store them
147 * properly into the airpcap adapter.
150 load_wlan_driver_wep_keys(void);
153 * Function used to save to the prefereces file the Decryption Keys.
156 save_wlan_wep_keys(airpcap_if_info_t* info_if);
159 * This function will tell the airpcap driver the key list to use
160 * This will be stored into the registry...
163 write_wlan_wep_keys_to_registry(airpcap_if_info_t* info_if, GList* key_list);
165 /* Returs TRUE if the WEP key is valid, false otherwise */
167 wep_key_is_valid(char* key);
170 * USED FOR DEBUG ONLY... PRINTS AN AirPcap ADAPTER STRUCTURE in a fancy way.
173 airpcap_if_info_print(airpcap_if_info_t* if_info);
176 * Used to retrieve the two chars string from interface
179 airpcap_get_if_string_number_from_description(gchar* description);
182 * Function used to free the airpcap interface list
185 free_airpcap_interface_list(GList *if_list);
188 * Used to retrieve the interface given the name
189 * (the name is used in AirpcapOpen)
191 airpcap_if_info_t* get_airpcap_if_from_name(GList* if_list, const gchar* name);
194 * Airpcap wrapper, used to store the current settings for the selected adapter
197 airpcap_if_store_cur_config_as_adapter_default(PAirpcapHandle ah);
200 * Function used to load the WEP keys for a selected interface
203 airpcap_if_load_keys(PAirpcapHandle ad, airpcap_if_info_t *if_info);
206 * Function used to load the WEP keys from the global driver list
209 airpcap_if_load_driver_keys(PAirpcapHandle ad, airpcap_if_info_t *if_info);
212 * Function used to save the WEP keys for a selected interface
215 airpcap_if_save_keys(PAirpcapHandle ad, airpcap_if_info_t *if_info);
218 * Function used to save the WEP keys for a selected interface
221 airpcap_if_save_driver_keys(PAirpcapHandle ad, airpcap_if_info_t *if_info);
224 * Airpcap wrapper, used to get the fcs validation of an airpcap adapter
227 airpcap_if_get_fcs_validation(PAirpcapHandle ah, PAirpcapValidationType val);
230 * Airpcap wrapper, used to set the fcs validation of an airpcap adapter
233 airpcap_if_set_fcs_validation(PAirpcapHandle ah, AirpcapValidationType val);
236 * Airpcap wrapper, used to get the decryption enabling of an airpcap adapter
239 airpcap_if_get_decryption_state(PAirpcapHandle ah, PAirpcapDecryptionState val);
242 * Airpcap wrapper, used to set the decryption enabling of an airpcap adapter
245 airpcap_if_set_decryption_state(PAirpcapHandle ah, AirpcapDecryptionState val);
248 * Airpcap wrapper, used to get the fcs presence of an airpcap adapter
251 airpcap_if_get_fcs_presence(PAirpcapHandle ah, gboolean * ch);
254 * Airpcap wrapper, used to set the fcs presence of an airpcap adapter
257 airpcap_if_set_fcs_presence(PAirpcapHandle ah, gboolean ch);
260 * Airpcap wrapper, used to get the link type of an airpcap adapter
263 airpcap_if_get_link_type(PAirpcapHandle ah, PAirpcapLinkType lt);
266 * Airpcap wrapper, used to set the link type of an airpcap adapter
269 airpcap_if_set_link_type(PAirpcapHandle ah, AirpcapLinkType lt);
272 * Airpcap wrapper, used to get the channel of an airpcap adapter
275 airpcap_if_get_device_channel(PAirpcapHandle ah, guint * ch);
278 * Airpcap wrapper, get the channels supported by the adapter
281 airpcap_if_get_device_supported_channels(PAirpcapHandle ah, AirpcapChannelInfo **cInfo, guint32 * nInfo);
284 * Airpcap wrapper, get supported channels formatted into an array
287 airpcap_if_get_device_supported_channels_array(PAirpcapHandle ah, guint32 * pNumSupportedChannels);
290 * Airpcap wrapper, used to set the channel of an airpcap adapter
293 airpcap_if_set_device_channel(PAirpcapHandle ah, guint ch);
296 * Airpcap wrapper, used to get the frequency of an airpcap adapter
299 airpcap_if_get_device_channel_ex(PAirpcapHandle ah, PAirpcapChannelInfo pChannelInfo);
302 * Airpcap wrapper, used to set the frequency of an airpcap adapter
305 airpcap_if_set_device_channel_ex(PAirpcapHandle ah, AirpcapChannelInfo ChannelInfo);
308 * Airpcap wrapper, used to open an airpcap adapter
310 PAirpcapHandle airpcap_if_open(gchar * name, gchar * err);
313 * Airpcap wrapper, used to close an airpcap adapter
315 void airpcap_if_close(PAirpcapHandle handle);
318 * Retrieve the state of the Airpcap DLL
321 airpcap_get_dll_state(void);
324 * Airpcap wrapper, used to turn on the led of an airpcap adapter
326 gboolean airpcap_if_turn_led_on(PAirpcapHandle AdapterHandle, guint LedNumber);
329 * Airpcap wrapper, used to turn off the led of an airpcap adapter
331 gboolean airpcap_if_turn_led_off(PAirpcapHandle AdapterHandle, guint LedNumber);
334 * This function will create a new airpcap_if_info_t using a name and a description
336 airpcap_if_info_t* airpcap_if_info_new(char *name, char *description);
339 * This function will create a new fake drivers' interface, to load global keys...
341 airpcap_if_info_t* airpcap_driver_fake_if_info_new(void);
344 * Used to dinamically load the airpcap library in order link it only when
345 * it's present on the system.
347 int load_airpcap(void);
350 * This function will use the airpcap.dll to find all the airpcap devices.
351 * Will return null if no device is found.
354 get_airpcap_interface_list(int *err, char **err_str);
357 * Returns the ASCII string of a key given the key bites
360 airpcap_get_key_string(AirpcapKey key);
363 * Load the configuration for the specified interface
366 airpcap_load_selected_if_configuration(airpcap_if_info_t* if_info);
369 * Save the configuration for the specified interface
372 airpcap_save_selected_if_configuration(airpcap_if_info_t* if_info);
375 * Used to retrieve the two chars string from interface description
378 airpcap_get_if_string_number(airpcap_if_info_t* if_info);
381 * Returns the default airpcap interface of a list, NULL if list is empty
384 airpcap_get_default_if(GList* airpcap_if_list);
387 * Airpcap wrapper, used to save the settings for the selected_if
390 airpcap_if_set_device_keys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection);
393 * Airpcap wrapper, used to save the settings for the selected_if
396 airpcap_if_get_device_keys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, guint * PKeysCollectionSize);
399 * Airpcap wrapper, used to save the settings for the selected_if
402 airpcap_if_set_driver_keys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection);
405 * Airpcap wrapper, used to save the settings for the selected_if
408 airpcap_if_get_driver_keys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, guint * PKeysCollectionSize);
411 * Airpcap wrapper, used to get the decryption enabling of an airpcap driver
414 airpcap_if_get_driver_decryption_state(PAirpcapHandle ah, PAirpcapDecryptionState PEnable);
416 * Airpcap wrapper, used to set the decryption enabling of an airpcap driver
419 airpcap_if_set_driver_decryption_state(PAirpcapHandle ah, AirpcapDecryptionState Enable);
422 * Save the configuration for the specified interface
425 airpcap_save_driver_if_configuration(airpcap_if_info_t* fake_if_info);
428 * Free an instance of airpcap_if_info_t
431 airpcap_if_info_free(airpcap_if_info_t *if_info);
434 * This function will tell the airpcap driver the key list to use
435 * This will be stored into the registry...
438 write_wlan_driver_wep_keys_to_registry(GList* key_list);
441 * Clear keys and decryption status for the specified interface
444 airpcap_if_clear_decryption_settings(airpcap_if_info_t* info_if);
447 * Function used to save to the preference file the Decryption Keys.
450 save_wlan_driver_wep_keys(void);
453 * Function used to save to the preference file the Decryption Keys.
456 save_wlan_wireshark_wep_keys(GList* key_ls);
459 * DECRYPTION KEYS FUNCTIONS
462 * This function is used for DEBUG PURPOSES ONLY!!!
465 print_key_list(GList* key_list);
468 * Retrieves a GList of decryption_key_t structures containing infos about the
469 * keys for the given adapter... returns NULL if no keys are found.
472 get_airpcap_device_keys(airpcap_if_info_t* if_info);
475 * Retrieves a GList of decryption_key_t structures containing infos about the
476 * keys for the global AirPcap driver... returns NULL if no keys are found.
479 get_airpcap_driver_keys(void);
482 * Returns the list of the decryption keys specified for wireshark, NULL if
486 get_wireshark_keys(void);
489 * Tests if two collection of keys are equal or not, to be considered equals, they have to
490 * contain the same keys in the SAME ORDER! (If both lists are NULL, which means empty will
494 key_lists_are_equal(GList* list1, GList* list2);
497 * Merges two lists of keys. If a key is found multiple times, it will just appear once!
500 merge_key_list(GList* list1, GList* list2);
503 * If the given key is contained in the list, returns TRUE.
504 * Returns FALSE otherwise.
507 key_is_in_list(decryption_key_t *dk,GList *list);
510 * Returns TRUE if keys are equals, FALSE otherwise
513 keys_are_equals(decryption_key_t *k1,decryption_key_t *k2);
516 * Use this function to free a key list.
519 free_key_list(GList *list);
522 * Returns TRUE if the Wireshark decryption is active, FALSE otherwise
525 wireshark_decryption_on(void);
528 * Returns TRUE if the AirPcap decryption for the current adapter is active, FALSE otherwise
531 airpcap_decryption_on(void);
534 * Enables decryption for Wireshark if on_off is TRUE, disables it otherwise.
537 set_wireshark_decryption(gboolean on_off);
540 * Enables decryption for all the adapters if on_off is TRUE, disables it otherwise.
543 set_airpcap_decryption(gboolean on_off);
546 * Adds compiled version string to str
549 get_compiled_airpcap_version(GString *str);
552 get_runtime_airpcap_version(GString *str);