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 /* Error values from "get_airpcap_interface_list()". */
32 #define CANT_GET_AIRPCAP_INTERFACE_LIST 0 /* error getting list */
33 #define NO_AIRPCAP_INTERFACES_FOUND 1 /* list is empty */
35 #define MAX_ENCRYPTION_KEYS 64
37 typedef PCHAR (*AirpcapGetLastErrorHandler)(PAirpcapHandle AdapterHandle);
38 typedef BOOL (*AirpcapGetDeviceListHandler)(PAirpcapDeviceDescription *PPAllDevs, PCHAR Ebuf);
39 typedef VOID (*AirpcapFreeDeviceListHandler)(PAirpcapDeviceDescription PAllDevs);
40 typedef PAirpcapHandle (*AirpcapOpenHandler)(PCHAR DeviceName, PCHAR Ebuf);
41 typedef VOID (*AirpcapCloseHandler)(PAirpcapHandle AdapterHandle);
42 typedef BOOL (*AirpcapGetLinkTypeHandler)(PAirpcapHandle AdapterHandle, PAirpcapLinkType PLinkType);
43 typedef BOOL (*AirpcapSetLinkTypeHandler)(PAirpcapHandle AdapterHandle, AirpcapLinkType NewLinkType);
44 typedef BOOL (*AirpcapSetKernelBufferHandler)(PAirpcapHandle AdapterHandle, UINT BufferSize);
45 typedef BOOL (*AirpcapSetFilterHandler)(PAirpcapHandle AdapterHandle, PVOID Instructions, UINT Len);
46 typedef BOOL (*AirpcapGetMacAddressHandler)(PAirpcapHandle AdapterHandle, PAirpcapMacAddress PMacAddress);
47 typedef BOOL (*AirpcapSetMinToCopyHandler)(PAirpcapHandle AdapterHandle, UINT MinToCopy);
48 typedef BOOL (*AirpcapGetReadEventHandler)(PAirpcapHandle AdapterHandle, HANDLE* PReadEvent);
49 typedef BOOL (*AirpcapReadHandler)(PAirpcapHandle AdapterHandle, PBYTE Buffer, UINT BufSize, PUINT PReceievedBytes);
50 typedef BOOL (*AirpcapGetStatsHandler)(PAirpcapHandle AdapterHandle, PAirpcapStats PStats);
51 typedef BOOL (*AirpcapTurnLedOnHandler)(PAirpcapHandle AdapterHandle, UINT LedNumber);
52 typedef BOOL (*AirpcapTurnLedOffHandler)(PAirpcapHandle AdapterHandle, UINT LedNumber);
53 typedef BOOL (*AirpcapSetDeviceChannelHandler)(PAirpcapHandle AdapterHandle, UINT Channel);
54 typedef BOOL (*AirpcapGetDeviceChannelHandler)(PAirpcapHandle AdapterHandle, PUINT PChannel);
55 typedef BOOL (*AirpcapSetFcsPresenceHandler)(PAirpcapHandle AdapterHandle, BOOL IsFcsPresent);
56 typedef BOOL (*AirpcapGetFcsPresenceHandler)(PAirpcapHandle AdapterHandle, PBOOL PIsFcsPresent);
57 typedef BOOL (*AirpcapSetFcsValidationHandler)(PAirpcapHandle AdapterHandle, AirpcapValidationType ValidationType);
58 typedef BOOL (*AirpcapGetFcsValidationHandler)(PAirpcapHandle AdapterHandle, PAirpcapValidationType PValidationType);
59 typedef BOOL (*AirpcapSetDeviceKeysHandler)(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection);
60 typedef BOOL (*AirpcapGetDeviceKeysHandler)(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, PUINT PKeysCollectionSize);
61 typedef BOOL (*AirpcapSetDecryptionStateHandler)(PAirpcapHandle AdapterHandle, AirpcapDecryptionState Enable);
62 typedef BOOL (*AirpcapGetDecryptionStateHandler)(PAirpcapHandle AdapterHandle, PAirpcapDecryptionState PEnable);
63 typedef BOOL (*AirpcapStoreCurConfigAsAdapterDefaultHandler)(PAirpcapHandle AdapterHandle);
65 * The list of interfaces returned by "get_airpcap_interface_list()" is
66 * a list of these structures.
69 char *name; /* e.g. "eth0" */
70 char *description; /* from OS, e.g. "Local Area Connection" or NULL */
71 GSList *ip_addr; /* containing address values of if_addr_t */
72 gboolean loopback; /* TRUE if loopback, FALSE otherwise */
73 AirpcapLinkType linkType; /* The link layer type*/
74 UINT channel; /* Channel (1-14)*/
75 BOOL IsFcsPresent; /* Include 802.11 CRC in frames */
76 AirpcapValidationType CrcValidationOn; /* Capture Frames with Wrong CRC */
77 AirpcapDecryptionState DecryptionOn; /* TRUE if decryption is on, FALSE otherwise*/
78 PAirpcapKeysCollection keysCollection; /* WEP Key collection for the adapter */
79 UINT keysCollectionSize; /* Size of the key collection */
80 gboolean blinking; /* TRUE if is blinkng, FALSE otherwise*/
81 gboolean led; /* TRUE if on, FALSE if off*/
82 gboolean saved; /* TRUE if current configuration has been saved, FALSE otherwise */
83 gint tag; /* int for the gtk blinking callback */
86 /* Airpcap interface list */
87 extern GList *airpcap_if_list;
89 /* Airpcap current selected interface */
90 extern airpcap_if_info_t *airpcap_if_selected;
92 /* Airpcap current active interface */
93 extern airpcap_if_info_t *airpcap_if_active;
96 * Callback used to free an instance of airpcap_if_info_t
99 free_airpcap_if_cb(gpointer data, gpointer user_data _U_);
102 * Used to retrieve the two chars string from interface
105 airpcap_get_if_string_number_from_description(gchar* description);
108 * Function used to free the airpcap interface list
111 free_airpcap_interface_list(GList *if_list);
114 * Used to retrieve the interface given the name
115 * (the name is used in AirpcapOpen)
117 airpcap_if_info_t* get_airpcap_if_by_name(GList* if_list, const gchar* name);
120 * Airpcap wrapper, used to store the current settings for the selected adapter
123 airpcap_if_store_cur_config_as_adapter_default(PAirpcapHandle ah);
126 * Function used to load the WEP keys for a selected interface
129 airpcap_if_load_keys(PAirpcapHandle ad, airpcap_if_info_t *if_info);
132 * Function used to save the WEP keys for a selected interface
135 airpcap_if_save_keys(PAirpcapHandle ad, airpcap_if_info_t *if_info);
138 * Airpcap wrapper, used to get the fcs validation of an airpcap adapter
141 airpcap_if_get_fcs_validation(PAirpcapHandle ah, PAirpcapValidationType val);
144 * Airpcap wrapper, used to set the fcs validation of an airpcap adapter
147 airpcap_if_set_fcs_validation(PAirpcapHandle ah, AirpcapValidationType val);
150 * Airpcap wrapper, used to get the decryption enabling of an airpcap adapter
153 airpcap_if_get_decryption_state(PAirpcapHandle ah, PAirpcapDecryptionState val);
156 * Airpcap wrapper, used to set the decryption enabling of an airpcap adapter
159 airpcap_if_set_decryption_state(PAirpcapHandle ah, AirpcapDecryptionState val);
162 * Airpcap wrapper, used to get the fcs presence of an airpcap adapter
165 airpcap_if_get_fcs_presence(PAirpcapHandle ah, PBOOL ch);
168 * Airpcap wrapper, used to set the fcs presence of an airpcap adapter
171 airpcap_if_set_fcs_presence(PAirpcapHandle ah, BOOL ch);
174 * Airpcap wrapper, used to get the link type of an airpcap adapter
177 airpcap_if_get_link_type(PAirpcapHandle ah, PAirpcapLinkType lt);
180 * Airpcap wrapper, used to set the link type of an airpcap adapter
183 airpcap_if_set_link_type(PAirpcapHandle ah, AirpcapLinkType lt);
186 * Airpcap wrapper, used to get the channel of an airpcap adapter
189 airpcap_if_get_device_channel(PAirpcapHandle ah, PUINT ch);
192 * Airpcap wrapper, used to set the channel of an airpcap adapter
195 airpcap_if_set_device_channel(PAirpcapHandle ah, UINT ch);
198 * Airpcap wrapper, used to open an airpcap adapter
200 PAirpcapHandle airpcap_if_open(PCHAR name, PCHAR err);
203 * Airpcap wrapper, used to close an airpcap adapter
205 VOID airpcap_if_close(PAirpcapHandle handle);
208 * Airpcap wrapper, used to turn on the led of an airpcap adapter
210 BOOL airpcap_if_turn_led_on(PAirpcapHandle AdapterHandle, UINT LedNumber);
213 * Airpcap wrapper, used to turn off the led of an airpcap adapter
215 BOOL airpcap_if_turn_led_off(PAirpcapHandle AdapterHandle, UINT LedNumber);
218 * This function will create a new airpcap_if_info_t using a name and a description
220 airpcap_if_info_t* airpcap_if_info_new(char *name, char *description);
223 * Used to dinamically load the airpcap library in order link it only when
224 * it's present on the system.
226 BOOL load_airpcap(void);
229 * Get an error message string for a CANT_GET_INTERFACE_LIST error from
230 * "get_airpcap_interface_list()".
233 cant_get_airpcap_if_list_error_message(const char *err_str);
236 * This function will use the airpcap.dll to find all the airpcap devices.
237 * Will return null if no device is found.
240 get_airpcap_interface_list(int *err, char *err_str);
243 * Returns the ASCII string of a key given the key bites
246 airpcap_get_key_string(AirpcapKey key);
249 * Load the configuration for the specified interface
252 airpcap_load_selected_if_configuration(airpcap_if_info_t* if_info);
255 * Save the configuration for the specified interface
258 airpcap_save_selected_if_configuration(airpcap_if_info_t* if_info);
261 * Used to retrieve the name of the interface given the description
262 * (the name is used in AirpcapOpen, the description is put in the combo box)
265 get_airpcap_name_from_description(GList* if_list, gchar* description);
268 * Used to retrieve the airpcap_if_info_t of the selected interface given the
269 * description (that is the entry of the combo box).
272 get_airpcap_if_from_description(GList* if_list, const gchar* description);
275 * Used to retrieve the two chars string from interface description
278 airpcap_get_if_string_number(airpcap_if_info_t* if_info);
281 * Returns the default airpcap interface of a list, NULL if list is empty
284 airpcap_get_default_if(GList* airpcap_if_list);
287 * Airpcap wrapper, used to save the settings for the selected_if
290 airpcap_if_set_device_keys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection);
293 * Airpcap wrapper, used to save the settings for the selected_if
296 airpcap_if_get_device_keys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, PUINT PKeysCollectionSize);