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