#include "airpcap_loader.h"
-/*
- * We load dynamically the dag library in order link it only when
- * it's present on the system
- */
-static void * AirpcapLib = NULL;
-
/*
* Set to TRUE if the DLL was successfully loaded AND all functions
* are present.
*/
static gboolean AirpcapLoaded = FALSE;
-static int AirpcapVersion = 3;
+#ifdef _WIN32
+/*
+ * We load dynamically the dag library in order link it only when
+ * it's present on the system
+ */
+static void * AirpcapLib = NULL;
static AirpcapGetLastErrorHandler g_PAirpcapGetLastError;
-static AirpcapGetDeviceListHandler g_PAirpcapGetDeviceList;
-static AirpcapFreeDeviceListHandler g_PAirpcapFreeDeviceList;
-static AirpcapOpenHandler g_PAirpcapOpen;
-static AirpcapCloseHandler g_PAirpcapClose;
-static AirpcapGetLinkTypeHandler g_PAirpcapGetLinkType;
-static AirpcapSetLinkTypeHandler g_PAirpcapSetLinkType;
static AirpcapSetKernelBufferHandler g_PAirpcapSetKernelBuffer;
static AirpcapSetFilterHandler g_PAirpcapSetFilter;
static AirpcapGetMacAddressHandler g_PAirpcapGetMacAddress;
static AirpcapGetReadEventHandler g_PAirpcapGetReadEvent;
static AirpcapReadHandler g_PAirpcapRead;
static AirpcapGetStatsHandler g_PAirpcapGetStats;
+#endif
+
+static int AirpcapVersion = 3;
+
+static AirpcapGetDeviceListHandler g_PAirpcapGetDeviceList;
+static AirpcapFreeDeviceListHandler g_PAirpcapFreeDeviceList;
+static AirpcapOpenHandler g_PAirpcapOpen;
+static AirpcapCloseHandler g_PAirpcapClose;
+static AirpcapGetLinkTypeHandler g_PAirpcapGetLinkType;
+static AirpcapSetLinkTypeHandler g_PAirpcapSetLinkType;
static AirpcapTurnLedOnHandler g_PAirpcapTurnLedOn;
static AirpcapTurnLedOffHandler g_PAirpcapTurnLedOff;
static AirpcapGetDeviceChannelHandler g_PAirpcapGetDeviceChannel;
* properly into the airpcap adapter.
*/
gboolean
-load_wlan_driver_wep_keys()
+load_wlan_driver_wep_keys(void)
{
keys_cb_data_t* user_data;
guint i;
- gchar *tmp = NULL;
/* Retrieve the wlan preferences */
wlan_prefs = prefs_find_module("wlan");
* Function used to save to the preference file the Decryption Keys.
*/
int
-save_wlan_driver_wep_keys()
+save_wlan_driver_wep_keys(void)
{
GList* key_list = NULL;
char* tmp_key = NULL;
save_wlan_wireshark_wep_keys(GList* key_ls)
{
GList* key_list = NULL;
- char* tmp_key = NULL;
guint keys_in_list,i;
keys_cb_data_t* user_data;
- airpcap_if_info_t* fake_info_if = NULL;
decryption_key_t* tmp_dk;
/* Retrieve the wlan preferences */
* Retrieve the state of the Airpcap DLL
*/
int
-airpcap_get_dll_state()
+airpcap_get_dll_state(void)
{
return AirpcapVersion;
}
switch(chanInfo[i].ExtChannel)
{
case -1:
- pSupportedChannels[numSupportedChannels].Flags = FLAG_CAN_BE_HIGH;
+ pSupportedChannels[numSupportedChannels].Flags = FLAG_CAN_BE_LOW;
break;
case +1:
- pSupportedChannels[numSupportedChannels].Flags = FLAG_CAN_BE_LOW;
+ pSupportedChannels[numSupportedChannels].Flags = FLAG_CAN_BE_HIGH;
break;
case 0:
default:
switch(chanInfo[i].ExtChannel)
{
case -1:
- pSupportedChannels[supportedChannel].Flags |= FLAG_CAN_BE_HIGH;
+ pSupportedChannels[supportedChannel].Flags |= FLAG_CAN_BE_LOW;
break;
case +1:
- pSupportedChannels[supportedChannel].Flags |= FLAG_CAN_BE_LOW;
+ pSupportedChannels[supportedChannel].Flags |= FLAG_CAN_BE_HIGH;
break;
case 0:
default:
{
if (!AirpcapLoaded) return FALSE;
if (airpcap_get_dll_state() == AIRPCAP_DLL_OLD){
- guint channel = 0;
+ gint channel = 0;
channel = ieee80211_mhz_to_chan(ChannelInfo.Frequency);
if (channel < 0){
* This function will create a new fake drivers' interface, to load global keys...
*/
airpcap_if_info_t*
-airpcap_driver_fake_if_info_new()
+airpcap_driver_fake_if_info_new(void)
{
PAirpcapHandle ad;
gchar ebuf[AIRPCAP_ERRBUF_SIZE];
g_print(" LINKTYPE: %d\n",if_info->linkType);
g_print(" LOOPBACK: %s\n",if_info->loopback ? "YES" : "NO");
g_print(" (GTK) TAG: %d\n",if_info->tag);
- g_print("SUPPORTED CHANNELS POINTER: %lu\n",if_info->pSupportedChannels);
- g_print(" NUM SUPPORTED CHANNELS: %lu\n",if_info->numSupportedChannels);
+ g_print("SUPPORTED CHANNELS POINTER: %p\n",if_info->pSupportedChannels);
+ g_print(" NUM SUPPORTED CHANNELS: %u\n",if_info->numSupportedChannels);
for(i=0; i<(if_info->numSupportedChannels); i++){
g_print("\n SUPPORTED CHANNEL #%u\n",i+1);
g_print(" CHANNEL: %u\n",if_info->pSupportedChannels[i].Channel);
- g_print(" FREQUENCY: %lu\n",if_info->pSupportedChannels[i].Frequency);
- g_print(" FLAGS: %lu\n",if_info->pSupportedChannels[i].Flags);
+ g_print(" FREQUENCY: %u\n",if_info->pSupportedChannels[i].Frequency);
+ g_print(" FLAGS: %u\n",if_info->pSupportedChannels[i].Flags);
}
g_print("\n\n");
}
for(j = 0; j < key.KeyLen; j++)
{
- src = g_strdup_printf("%.2x\0", key.KeyData[j]);
+ src = g_strdup_printf("%.2x", key.KeyData[j]);
/*
* XXX - use g_strconcat() or GStrings instead ???
*/
}
else
{
- number = g_strdup_printf("%.2u\0",n);
+ number = g_strdup_printf("%.2u",n);
}
return number;
airpcap_if_info_t*
airpcap_get_default_if(GList* airpcap_if_list)
{
- int ifn = 0;
- GList* popdown_if_list = NULL;
- GList* curr = NULL;
-
gchar* s;
airpcap_if_info_t* if_info = NULL;
* keys for the global AirPcap driver... returns NULL if no keys are found.
*/
GList*
-get_airpcap_driver_keys()
+get_airpcap_driver_keys(void)
{
/* tmp vars */
char* tmp_key = NULL;
* no key is found
*/
GList*
-get_wireshark_keys()
+get_wireshark_keys(void)
{
keys_cb_data_t* wep_user_data = NULL;
- gchar *tmp = NULL;
-
GList* final_list = NULL;
GList* wep_final_list = NULL;
* Returns TRUE if the Wireshark decryption is active, false otherwise
*/
gboolean
-wireshark_decryption_on()
+wireshark_decryption_on(void)
{
gboolean is_on;
* Returns TRUE if the AirPcap decryption for the current adapter is active, false otherwise
*/
gboolean
-airpcap_decryption_on()
+airpcap_decryption_on(void)
{
gboolean is_on = FALSE;
*/
int load_airpcap(void)
{
+#ifdef _WIN32
gboolean base_functions = TRUE;
gboolean eleven_n_functions = TRUE;
-#ifdef _WIN32
if((AirpcapLib = LoadLibrary(TEXT("airpcap.dll"))) == NULL)
{
/* Report the error but go on */