2 * Declarations of routines for the "About" dialog
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #ifndef __AIRPCAP_LOADER_H__
26 #define __AIRPCAP_LOADER_H__
28 /* Error values from "get_airpcap_interface_list()". */
29 #define CANT_GET_AIRPCAP_INTERFACE_LIST 0 /* error getting list */
30 #define NO_AIRPCAP_INTERFACES_FOUND 1 /* list is empty */
32 #define MAX_ENCRYPTION_KEYS 64
34 typedef PCHAR (*AirpcapGetLastErrorHandler)(PAirpcapHandle AdapterHandle);
35 typedef BOOL (*AirpcapGetDeviceListHandler)(PAirpcapDeviceDescription *PPAllDevs, PCHAR Ebuf);
36 typedef VOID (*AirpcapFreeDeviceListHandler)(PAirpcapDeviceDescription PAllDevs);
37 typedef PAirpcapHandle (*AirpcapOpenHandler)(PCHAR DeviceName, PCHAR Ebuf);
38 typedef VOID (*AirpcapCloseHandler)(PAirpcapHandle AdapterHandle);
39 typedef BOOL (*AirpcapGetLinkTypeHandler)(PAirpcapHandle AdapterHandle, PAirpcapLinkType PLinkType);
40 typedef BOOL (*AirpcapSetLinkTypeHandler)(PAirpcapHandle AdapterHandle, AirpcapLinkType NewLinkType);
41 typedef BOOL (*AirpcapSetKernelBufferHandler)(PAirpcapHandle AdapterHandle, UINT BufferSize);
42 typedef BOOL (*AirpcapSetFilterHandler)(PAirpcapHandle AdapterHandle, PVOID Instructions, UINT Len);
43 typedef BOOL (*AirpcapGetMacAddressHandler)(PAirpcapHandle AdapterHandle, PAirpcapMacAddress PMacAddress);
44 typedef BOOL (*AirpcapSetMinToCopyHandler)(PAirpcapHandle AdapterHandle, UINT MinToCopy);
45 typedef BOOL (*AirpcapGetReadEventHandler)(PAirpcapHandle AdapterHandle, HANDLE* PReadEvent);
46 typedef BOOL (*AirpcapReadHandler)(PAirpcapHandle AdapterHandle, PBYTE Buffer, UINT BufSize, PUINT PReceievedBytes);
47 typedef BOOL (*AirpcapGetStatsHandler)(PAirpcapHandle AdapterHandle, PAirpcapStats PStats);
48 typedef BOOL (*AirpcapTurnLedOnHandler)(PAirpcapHandle AdapterHandle, UINT LedNumber);
49 typedef BOOL (*AirpcapTurnLedOffHandler)(PAirpcapHandle AdapterHandle, UINT LedNumber);
50 typedef BOOL (*AirpcapSetDeviceChannelHandler)(PAirpcapHandle AdapterHandle, UINT Channel);
51 typedef BOOL (*AirpcapGetDeviceChannelHandler)(PAirpcapHandle AdapterHandle, PUINT PChannel);
52 typedef BOOL (*AirpcapSetFcsPresenceHandler)(PAirpcapHandle AdapterHandle, BOOL IsFcsPresent);
53 typedef BOOL (*AirpcapGetFcsPresenceHandler)(PAirpcapHandle AdapterHandle, PBOOL PIsFcsPresent);
54 typedef BOOL (*AirpcapSetFcsValidationHandler)(PAirpcapHandle AdapterHandle, AirpcapValidationType ValidationType);
55 typedef BOOL (*AirpcapGetFcsValidationHandler)(PAirpcapHandle AdapterHandle, PAirpcapValidationType PValidationType);
56 typedef BOOL (*AirpcapSetDeviceKeysHandler)(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection);
57 typedef BOOL (*AirpcapGetDeviceKeysHandler)(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, PUINT PKeysCollectionSize);
58 typedef BOOL (*AirpcapSetDecryptionStateHandler)(PAirpcapHandle AdapterHandle, AirpcapDecryptionState Enable);
59 typedef BOOL (*AirpcapGetDecryptionStateHandler)(PAirpcapHandle AdapterHandle, PAirpcapDecryptionState PEnable);
60 typedef BOOL (*AirpcapStoreCurConfigAsAdapterDefaultHandler)(PAirpcapHandle AdapterHandle);
62 * The list of interfaces returned by "get_airpcap_interface_list()" is
63 * a list of these structures.
66 char *name; /* e.g. "eth0" */
67 char *description; /* from OS, e.g. "Local Area Connection" or NULL */
68 GSList *ip_addr; /* containing address values of if_addr_t */
69 gboolean loopback; /* TRUE if loopback, FALSE otherwise */
70 AirpcapLinkType linkType; /* The link layer type*/
71 UINT channel; /* Channel (1-14)*/
72 BOOL IsFcsPresent; /* Include 802.11 CRC in frames */
73 AirpcapValidationType CrcValidationOn; /* Capture Frames with Wrong CRC */
74 AirpcapDecryptionState DecryptionOn; /* TRUE if decryption is on, FALSE otherwise*/
75 PAirpcapKeysCollection keysCollection; /* WEP Key collection for the adapter */
76 UINT keysCollectionSize; /* Size of the key collection */
77 gboolean blinking; /* TRUE if is blinkng, FALSE otherwise*/
78 gboolean led; /* TRUE if on, FALSE if off*/
79 gboolean saved; /* TRUE if current configuration has been saved, FALSE otherwise */
80 gint tag; /* int for the gtk blinking callback */
83 /* Airpcap interface list */
84 extern GList *airpcap_if_list;
86 /* Airpcap current selected interface */
87 extern airpcap_if_info_t *airpcap_if_selected;
89 /* Airpcap current active interface */
90 extern airpcap_if_info_t *airpcap_if_active;
93 * Callback used to free an instance of airpcap_if_info_t
96 free_airpcap_if_cb(gpointer data, gpointer user_data _U_);
99 * Used to retrieve the two chars string from interface
102 airpcap_get_if_string_number_from_description(gchar* description);
105 * Function used to free the airpcap interface list
108 free_airpcap_interface_list(GList *if_list);
111 * Used to retrieve the interface given the name
112 * (the name is used in AirpcapOpen)
114 airpcap_if_info_t* get_airpcap_if_by_name(GList* if_list, const gchar* name);
117 * Airpcap wrapper, used to store the current settings for the selected adapter
120 airpcap_if_store_cur_config_as_adapter_default(PAirpcapHandle ah);
123 * Function used to load the WEP keys for a selected interface
126 airpcap_if_load_keys(PAirpcapHandle ad, airpcap_if_info_t *if_info);
129 * Function used to save the WEP keys for a selected interface
132 airpcap_if_save_keys(PAirpcapHandle ad, airpcap_if_info_t *if_info);
135 * Airpcap wrapper, used to get the fcs validation of an airpcap adapter
138 airpcap_if_get_fcs_validation(PAirpcapHandle ah, PAirpcapValidationType val);
141 * Airpcap wrapper, used to set the fcs validation of an airpcap adapter
144 airpcap_if_set_fcs_validation(PAirpcapHandle ah, AirpcapValidationType val);
147 * Airpcap wrapper, used to get the decryption enabling of an airpcap adapter
150 airpcap_if_get_decryption_state(PAirpcapHandle ah, PAirpcapDecryptionState val);
153 * Airpcap wrapper, used to set the decryption enabling of an airpcap adapter
156 airpcap_if_set_decryption_state(PAirpcapHandle ah, AirpcapDecryptionState val);
159 * Airpcap wrapper, used to get the fcs presence of an airpcap adapter
162 airpcap_if_get_fcs_presence(PAirpcapHandle ah, PBOOL ch);
165 * Airpcap wrapper, used to set the fcs presence of an airpcap adapter
168 airpcap_if_set_fcs_presence(PAirpcapHandle ah, BOOL ch);
171 * Airpcap wrapper, used to get the link type of an airpcap adapter
174 airpcap_if_get_link_type(PAirpcapHandle ah, PAirpcapLinkType lt);
177 * Airpcap wrapper, used to set the link type of an airpcap adapter
180 airpcap_if_set_link_type(PAirpcapHandle ah, AirpcapLinkType lt);
183 * Airpcap wrapper, used to get the channel of an airpcap adapter
186 airpcap_if_get_device_channel(PAirpcapHandle ah, PUINT ch);
189 * Airpcap wrapper, used to set the channel of an airpcap adapter
192 airpcap_if_set_device_channel(PAirpcapHandle ah, UINT ch);
195 * Airpcap wrapper, used to open an airpcap adapter
197 PAirpcapHandle airpcap_if_open(PCHAR name, PCHAR err);
200 * Airpcap wrapper, used to close an airpcap adapter
202 VOID airpcap_if_close(PAirpcapHandle handle);
205 * Airpcap wrapper, used to turn on the led of an airpcap adapter
207 BOOL airpcap_if_turn_led_on(PAirpcapHandle AdapterHandle, UINT LedNumber);
210 * Airpcap wrapper, used to turn off the led of an airpcap adapter
212 BOOL airpcap_if_turn_led_off(PAirpcapHandle AdapterHandle, UINT LedNumber);
215 * This function will create a new airpcap_if_info_t using a name and a description
217 airpcap_if_info_t* airpcap_if_info_new(char *name, char *description);
219 /* HAVE_AIRPCAP_API */
222 * Used to dinamically load the airpcap library in order link it only when
223 * it's present on the system.
225 BOOL load_airpcap(void);
228 * Get an error message string for a CANT_GET_INTERFACE_LIST error from
229 * "get_airpcap_interface_list()".
232 cant_get_airpcap_if_list_error_message(const char *err_str);
235 * This function will use the airpcap.dll to find all the airpcap devices.
236 * Will return null if no device is found.
239 get_airpcap_interface_list(int *err, char *err_str);
242 * Returns the ASCII string of a key given the key bites
245 airpcap_get_key_string(AirpcapKey key);
248 * Load the configuration for the specified interface
251 airpcap_load_selected_if_configuration(airpcap_if_info_t* if_info);
254 * Save the configuration for the specified interface
257 airpcap_save_selected_if_configuration(airpcap_if_info_t* if_info);
260 * Used to retrieve the name of the interface given the description
261 * (the name is used in AirpcapOpen, the description is put in the combo box)
264 get_airpcap_name_from_description(GList* if_list, gchar* description);
267 * Used to retrieve the airpcap_if_info_t of the selected interface given the
268 * description (that is the entry of the combo box).
271 get_airpcap_if_from_description(GList* if_list, const gchar* description);
274 * Used to retrieve the two chars string from interface description
277 airpcap_get_if_string_number(airpcap_if_info_t* if_info);
280 * Returns the default airpcap interface of a list, NULL if list is empty
283 airpcap_get_default_if(GList* airpcap_if_list);
286 * Airpcap wrapper, used to save the settings for the selected_if
289 airpcap_if_set_device_keys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection);
292 * Airpcap wrapper, used to save the settings for the selected_if
295 airpcap_if_get_device_keys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, PUINT PKeysCollectionSize);