summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh3
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/proto.cc1
-rw-r--r--noncore/net/wellenreiter/libwellenreiter/source/sniff.hh2
3 files changed, 5 insertions, 1 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh
index 7c6a21d..b85b7b7 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh
+++ b/noncore/net/wellenreiter/libwellenreiter/source/cardmode.hh
@@ -1,35 +1,36 @@
/* $Id$ */
#ifndef CARDMODE_HH
#define CARDMODE_HH
#include <string.h>
#include <stdlib.h>
#include <errno.h>
+#include <sys/types.h>
+#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
-#include <arpa/inet.h>
extern "C"
{
#include <net/bpf.h>
#include <pcap.h>
}
/* Defines, used for the card setup */
#define DEFAULT_PATH "/proc/driver/aironet/%s/Config"
#define CARD_TYPE_CISCO 1
#define CARD_TYPE_NG 2
#define CARD_TYPE_HOSTAP 3
/* only for now, until we have the daemon running */
/*the config file should provide these information */
#define CARD_TYPE CARD_TYPE_HOSTAP
#define SBIN_PATH "/sbin/ifconfig %s promisc up"
#define WLANCTL_PATH "/sbin/wlanctl-ng"
/* Prototypes */
int card_into_monitormode (pcap_t **, char *, int);
int card_set_promisc_up (const char *);
#endif /* CARDMODE_HH */
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/proto.cc b/noncore/net/wellenreiter/libwellenreiter/source/proto.cc
index 2ec23f4..a1228e4 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/proto.cc
+++ b/noncore/net/wellenreiter/libwellenreiter/source/proto.cc
@@ -1,104 +1,105 @@
/*
* Communication protocol
*
* $Id$
*/
#include "proto.hh"
#include "sock.hh"
+#include "log.hh"
/* Send found network to GUI */
int send_network_found (const char *guihost, int guiport, void *structure)
{
wl_network_t *ptr;
char buffer[2048];
char temp[5];
ptr = (wl_network_t *)structure;
memset(buffer, 0, 2048);
/* Type = Found new net */
memcpy(buffer, "01", 2);
/* Set Net-type */
memset(temp, 0, sizeof(temp));
snprintf(temp, 2, "%d", ptr->net_type);
memcpy(buffer + 2, temp, 1);
/* Set channel */
memset(temp, 0, sizeof(temp));
if(ptr->channel < 10)
snprintf(temp, 3, "0%d", ptr->channel);
else
snprintf(temp, 3, "%d", ptr->channel);
memcpy(buffer + 3, temp, 2);
/* Set WEP y/n */
memset(temp, 0, sizeof(temp));
snprintf(temp, 2, "%d", ptr->wep);
memcpy(buffer + 5, temp, 1);
/* Set MAC address */
memcpy(buffer + 6, ptr->mac, 17);
/* Set lenght of ssid */
memset(temp, 0, sizeof(temp));
if(ptr->ssid_len > 99)
snprintf(temp, 4, "%d", ptr->ssid_len);
else if(ptr->ssid_len < 10)
snprintf(temp, 4, "00%d", ptr->ssid_len);
else
snprintf(temp, 4, "0%d", ptr->ssid_len);
memcpy(buffer + 23, temp, 3);
/* Set ssid */
memcpy(buffer + 26, ptr->bssid, ptr->ssid_len);
/* Send prepared buffer to GUI */
#ifdef DEBUG
wl_loginfo("Sending network to GUI: '%s'", buffer);
#endif
sendcomm(guihost, guiport, buffer);
return 1;
}
/* Fill buffer into structur */
int get_network_found (void *structure, const char *buffer)
{
wl_network_t *ptr;
char temp[512];
ptr = (wl_network_t *)structure;
/* Get net type */
memset(temp, 0, sizeof(temp));
memcpy(temp, buffer + 2, 1);
ptr->net_type = atoi(temp);
/* Get channel */
memset(temp, 0, sizeof(temp));
memcpy(temp, buffer + 3, 2);
ptr->channel = atoi(temp);
/* Set WEP y/n */
memset(temp, 0, sizeof(temp));
memcpy(temp, buffer + 5, 1);
ptr->wep = atoi(temp);
/* Set MAC address */
memcpy(ptr->mac, buffer + 6, 17);
ptr->mac[17]='\0';
/* Set lenght of ssid */
memset(temp, 0, sizeof(temp));
memcpy(temp, buffer + 23, 3);
ptr->ssid_len = atoi(temp);
/* Set ssid */
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/sniff.hh b/noncore/net/wellenreiter/libwellenreiter/source/sniff.hh
index c13461a..c7108ac 100644
--- a/noncore/net/wellenreiter/libwellenreiter/source/sniff.hh
+++ b/noncore/net/wellenreiter/libwellenreiter/source/sniff.hh
@@ -1,68 +1,70 @@
/* $Id$ */
#ifndef SNIFF_HH
#define SNIFF_HH
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
+#include <sys/types.h>
+#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
extern "C"
{
#include <net/bpf.h>
#include <pcap.h>
}
#define NONBROADCASTING "non-broadcasting"
/* holds all the interresting data */
struct packetinfo
{
int isvalid;
int pktlen;
int fctype;
int fcsubtype;
int fc_wep;
int cap_WEP;
int cap_IBSS;
int cap_ESS;
int channel;
char bssid[sizeof("00:00:00:00:00:00") + 1];
char desthwaddr[sizeof("00:00:00:00:00:00") + 1];
char sndhwaddr[sizeof("00:00:00:00:00:00") + 1];
char ssid[128];
int ssid_len;
};
void process_packets(const struct pcap_pkthdr* pkthdr,const u_char* packet, char *, int);
int decode_80211b_hdr(const u_char *p,struct packetinfo *ppinfo);
void etheraddr_string(register const u_char *ep,char * text);
int handle_beacon(u_int16_t fc, const u_char *p,struct packetinfo *ppinfo);
int GetHeaderLength(u_int16_t fc);
/*
* True if "l" bytes of "var" were captured.
*
* The "snapend - (l) <= snapend" checks to make sure "l" isn't so large
* that "snapend - (l)" underflows.
*
* The check is for <= rather than < because "l" might be 0.
*/
#define TTEST2(var, l) (snapend - (l) <= snapend && \
(const u_char *)&(var) <= snapend - (l))
/* True if "var" was captured */
#define TTEST(var) TTEST2(var, sizeof(var))
/* Bail if "l" bytes of "var" were not captured */
#define TCHECK2(var, l) if (!TTEST2(var, l)) goto trunc
/* Bail if "var" was not captured */
#define TCHECK(var) TCHECK2(var, sizeof(var))
#endif /* SNIFF_HH */