summaryrefslogtreecommitdiff
authormjm <mjm>2002-12-16 17:57:51 (UTC)
committer mjm <mjm>2002-12-16 17:57:51 (UTC)
commite6255e52c1ec8988f3a1490827b92874459d6ede (patch) (unidiff)
tree53907450c66fd3c48b6001c43166a81429df091c
parent0228363d2dead01a93a4ae151f415cff4393a2b0 (diff)
downloadopie-e6255e52c1ec8988f3a1490827b92874459d6ede.zip
opie-e6255e52c1ec8988f3a1490827b92874459d6ede.tar.gz
opie-e6255e52c1ec8988f3a1490827b92874459d6ede.tar.bz2
fixed some forgotten includes (again)
Diffstat (more/less context) (ignore 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 @@
1/* $Id$ */ 1/* $Id$ */
2 2
3#ifndef CARDMODE_HH 3#ifndef CARDMODE_HH
4#define CARDMODE_HH 4#define CARDMODE_HH
5 5
6#include <string.h> 6#include <string.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#include <errno.h> 8#include <errno.h>
9#include <sys/types.h>
10#include <sys/time.h>
9#include <sys/socket.h> 11#include <sys/socket.h>
10#include <netinet/in.h> 12#include <netinet/in.h>
11#include <arpa/inet.h>
12 13
13extern "C" 14extern "C"
14{ 15{
15#include <net/bpf.h> 16#include <net/bpf.h>
16#include <pcap.h> 17#include <pcap.h>
17} 18}
18 19
19/* Defines, used for the card setup */ 20/* Defines, used for the card setup */
20#define DEFAULT_PATH "/proc/driver/aironet/%s/Config" 21#define DEFAULT_PATH "/proc/driver/aironet/%s/Config"
21 #define CARD_TYPE_CISCO1 22 #define CARD_TYPE_CISCO1
22 #define CARD_TYPE_NG 2 23 #define CARD_TYPE_NG 2
23 #define CARD_TYPE_HOSTAP3 24 #define CARD_TYPE_HOSTAP3
24 25
25/* only for now, until we have the daemon running */ 26/* only for now, until we have the daemon running */
26/*the config file should provide these information */ 27/*the config file should provide these information */
27#define CARD_TYPE CARD_TYPE_HOSTAP 28#define CARD_TYPE CARD_TYPE_HOSTAP
28 #define SBIN_PATH "/sbin/ifconfig %s promisc up" 29 #define SBIN_PATH "/sbin/ifconfig %s promisc up"
29#define WLANCTL_PATH "/sbin/wlanctl-ng" 30#define WLANCTL_PATH "/sbin/wlanctl-ng"
30 31
31/* Prototypes */ 32/* Prototypes */
32int card_into_monitormode (pcap_t **, char *, int); 33int card_into_monitormode (pcap_t **, char *, int);
33int card_set_promisc_up (const char *); 34int card_set_promisc_up (const char *);
34 35
35#endif /* CARDMODE_HH */ 36#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,108 +1,109 @@
1/* 1/*
2 * Communication protocol 2 * Communication protocol
3 * 3 *
4 * $Id$ 4 * $Id$
5 */ 5 */
6 6
7#include "proto.hh" 7#include "proto.hh"
8#include "sock.hh" 8#include "sock.hh"
9#include "log.hh"
9 10
10/* Send found network to GUI */ 11/* Send found network to GUI */
11int send_network_found (const char *guihost, int guiport, void *structure) 12int send_network_found (const char *guihost, int guiport, void *structure)
12{ 13{
13 wl_network_t *ptr; 14 wl_network_t *ptr;
14 char buffer[2048]; 15 char buffer[2048];
15 char temp[5]; 16 char temp[5];
16 17
17 ptr = (wl_network_t *)structure; 18 ptr = (wl_network_t *)structure;
18 19
19 memset(buffer, 0, 2048); 20 memset(buffer, 0, 2048);
20 21
21 /* Type = Found new net */ 22 /* Type = Found new net */
22 memcpy(buffer, "01", 2); 23 memcpy(buffer, "01", 2);
23 24
24 /* Set Net-type */ 25 /* Set Net-type */
25 memset(temp, 0, sizeof(temp)); 26 memset(temp, 0, sizeof(temp));
26 snprintf(temp, 2, "%d", ptr->net_type); 27 snprintf(temp, 2, "%d", ptr->net_type);
27 memcpy(buffer + 2, temp, 1); 28 memcpy(buffer + 2, temp, 1);
28 29
29 /* Set channel */ 30 /* Set channel */
30 memset(temp, 0, sizeof(temp)); 31 memset(temp, 0, sizeof(temp));
31 32
32 if(ptr->channel < 10) 33 if(ptr->channel < 10)
33 snprintf(temp, 3, "0%d", ptr->channel); 34 snprintf(temp, 3, "0%d", ptr->channel);
34 else 35 else
35 snprintf(temp, 3, "%d", ptr->channel); 36 snprintf(temp, 3, "%d", ptr->channel);
36 37
37 memcpy(buffer + 3, temp, 2); 38 memcpy(buffer + 3, temp, 2);
38 39
39 /* Set WEP y/n */ 40 /* Set WEP y/n */
40 memset(temp, 0, sizeof(temp)); 41 memset(temp, 0, sizeof(temp));
41 snprintf(temp, 2, "%d", ptr->wep); 42 snprintf(temp, 2, "%d", ptr->wep);
42 memcpy(buffer + 5, temp, 1); 43 memcpy(buffer + 5, temp, 1);
43 44
44 /* Set MAC address */ 45 /* Set MAC address */
45 memcpy(buffer + 6, ptr->mac, 17); 46 memcpy(buffer + 6, ptr->mac, 17);
46 47
47 /* Set lenght of ssid */ 48 /* Set lenght of ssid */
48 memset(temp, 0, sizeof(temp)); 49 memset(temp, 0, sizeof(temp));
49 50
50 if(ptr->ssid_len > 99) 51 if(ptr->ssid_len > 99)
51 snprintf(temp, 4, "%d", ptr->ssid_len); 52 snprintf(temp, 4, "%d", ptr->ssid_len);
52 else if(ptr->ssid_len < 10) 53 else if(ptr->ssid_len < 10)
53 snprintf(temp, 4, "00%d", ptr->ssid_len); 54 snprintf(temp, 4, "00%d", ptr->ssid_len);
54 else 55 else
55 snprintf(temp, 4, "0%d", ptr->ssid_len); 56 snprintf(temp, 4, "0%d", ptr->ssid_len);
56 57
57 memcpy(buffer + 23, temp, 3); 58 memcpy(buffer + 23, temp, 3);
58 59
59 /* Set ssid */ 60 /* Set ssid */
60 memcpy(buffer + 26, ptr->bssid, ptr->ssid_len); 61 memcpy(buffer + 26, ptr->bssid, ptr->ssid_len);
61 62
62 /* Send prepared buffer to GUI */ 63 /* Send prepared buffer to GUI */
63#ifdef DEBUG 64#ifdef DEBUG
64 wl_loginfo("Sending network to GUI: '%s'", buffer); 65 wl_loginfo("Sending network to GUI: '%s'", buffer);
65#endif 66#endif
66 67
67 sendcomm(guihost, guiport, buffer); 68 sendcomm(guihost, guiport, buffer);
68 69
69 return 1; 70 return 1;
70} 71}
71 72
72/* Fill buffer into structur */ 73/* Fill buffer into structur */
73int get_network_found (void *structure, const char *buffer) 74int get_network_found (void *structure, const char *buffer)
74{ 75{
75 wl_network_t *ptr; 76 wl_network_t *ptr;
76 char temp[512]; 77 char temp[512];
77 78
78 ptr = (wl_network_t *)structure; 79 ptr = (wl_network_t *)structure;
79 80
80 /* Get net type */ 81 /* Get net type */
81 memset(temp, 0, sizeof(temp)); 82 memset(temp, 0, sizeof(temp));
82 memcpy(temp, buffer + 2, 1); 83 memcpy(temp, buffer + 2, 1);
83 ptr->net_type = atoi(temp); 84 ptr->net_type = atoi(temp);
84 85
85 /* Get channel */ 86 /* Get channel */
86 memset(temp, 0, sizeof(temp)); 87 memset(temp, 0, sizeof(temp));
87 memcpy(temp, buffer + 3, 2); 88 memcpy(temp, buffer + 3, 2);
88 ptr->channel = atoi(temp); 89 ptr->channel = atoi(temp);
89 90
90 /* Set WEP y/n */ 91 /* Set WEP y/n */
91 memset(temp, 0, sizeof(temp)); 92 memset(temp, 0, sizeof(temp));
92 memcpy(temp, buffer + 5, 1); 93 memcpy(temp, buffer + 5, 1);
93 ptr->wep = atoi(temp); 94 ptr->wep = atoi(temp);
94 95
95 /* Set MAC address */ 96 /* Set MAC address */
96 memcpy(ptr->mac, buffer + 6, 17); 97 memcpy(ptr->mac, buffer + 6, 17);
97 ptr->mac[17]='\0'; 98 ptr->mac[17]='\0';
98 99
99 /* Set lenght of ssid */ 100 /* Set lenght of ssid */
100 memset(temp, 0, sizeof(temp)); 101 memset(temp, 0, sizeof(temp));
101 memcpy(temp, buffer + 23, 3); 102 memcpy(temp, buffer + 23, 3);
102 ptr->ssid_len = atoi(temp); 103 ptr->ssid_len = atoi(temp);
103 104
104 /* Set ssid */ 105 /* Set ssid */
105 memcpy(ptr->bssid, buffer + 26, ptr->ssid_len + 1); 106 memcpy(ptr->bssid, buffer + 26, ptr->ssid_len + 1);
106 107
107 return 1; 108 return 1;
108} 109}
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 @@
1/* $Id$ */ 1/* $Id$ */
2 2
3#ifndef SNIFF_HH 3#ifndef SNIFF_HH
4#define SNIFF_HH 4#define SNIFF_HH
5 5
6#include <string.h> 6#include <string.h>
7#include <stdio.h> 7#include <stdio.h>
8#include <stdlib.h> 8#include <stdlib.h>
9#include <errno.h> 9#include <errno.h>
10#include <sys/types.h>
11#include <sys/time.h>
10#include <sys/socket.h> 12#include <sys/socket.h>
11#include <netinet/in.h> 13#include <netinet/in.h>
12#include <arpa/inet.h> 14#include <arpa/inet.h>
13 15
14extern "C" 16extern "C"
15{ 17{
16#include <net/bpf.h> 18#include <net/bpf.h>
17#include <pcap.h> 19#include <pcap.h>
18} 20}
19 21
20#define NONBROADCASTING "non-broadcasting" 22#define NONBROADCASTING "non-broadcasting"
21 23
22/* holds all the interresting data */ 24/* holds all the interresting data */
23struct packetinfo 25struct packetinfo
24{ 26{
25 int isvalid; 27 int isvalid;
26 int pktlen; 28 int pktlen;
27 int fctype; 29 int fctype;
28 int fcsubtype; 30 int fcsubtype;
29 int fc_wep; 31 int fc_wep;
30 int cap_WEP; 32 int cap_WEP;
31 int cap_IBSS; 33 int cap_IBSS;
32 int cap_ESS; 34 int cap_ESS;
33 int channel; 35 int channel;
34 char bssid[sizeof("00:00:00:00:00:00") + 1]; 36 char bssid[sizeof("00:00:00:00:00:00") + 1];
35 char desthwaddr[sizeof("00:00:00:00:00:00") + 1]; 37 char desthwaddr[sizeof("00:00:00:00:00:00") + 1];
36 char sndhwaddr[sizeof("00:00:00:00:00:00") + 1]; 38 char sndhwaddr[sizeof("00:00:00:00:00:00") + 1];
37 char ssid[128]; 39 char ssid[128];
38 int ssid_len; 40 int ssid_len;
39}; 41};
40 42
41void process_packets(const struct pcap_pkthdr* pkthdr,const u_char* packet, char *, int); 43void process_packets(const struct pcap_pkthdr* pkthdr,const u_char* packet, char *, int);
42int decode_80211b_hdr(const u_char *p,struct packetinfo *ppinfo); 44int decode_80211b_hdr(const u_char *p,struct packetinfo *ppinfo);
43void etheraddr_string(register const u_char *ep,char * text); 45void etheraddr_string(register const u_char *ep,char * text);
44int handle_beacon(u_int16_t fc, const u_char *p,struct packetinfo *ppinfo); 46int handle_beacon(u_int16_t fc, const u_char *p,struct packetinfo *ppinfo);
45 47
46int GetHeaderLength(u_int16_t fc); 48int GetHeaderLength(u_int16_t fc);
47 49
48/* 50/*
49 * True if "l" bytes of "var" were captured. 51 * True if "l" bytes of "var" were captured.
50 * 52 *
51 * The "snapend - (l) <= snapend" checks to make sure "l" isn't so large 53 * The "snapend - (l) <= snapend" checks to make sure "l" isn't so large
52 * that "snapend - (l)" underflows. 54 * that "snapend - (l)" underflows.
53 * 55 *
54 * The check is for <= rather than < because "l" might be 0. 56 * The check is for <= rather than < because "l" might be 0.
55 */ 57 */
56#define TTEST2(var, l) (snapend - (l) <= snapend && \ 58#define TTEST2(var, l) (snapend - (l) <= snapend && \
57 (const u_char *)&(var) <= snapend - (l)) 59 (const u_char *)&(var) <= snapend - (l))
58 60
59/* True if "var" was captured */ 61/* True if "var" was captured */
60#define TTEST(var) TTEST2(var, sizeof(var)) 62#define TTEST(var) TTEST2(var, sizeof(var))
61 63
62/* Bail if "l" bytes of "var" were not captured */ 64/* Bail if "l" bytes of "var" were not captured */
63#define TCHECK2(var, l) if (!TTEST2(var, l)) goto trunc 65#define TCHECK2(var, l) if (!TTEST2(var, l)) goto trunc
64 66
65/* Bail if "var" was not captured */ 67/* Bail if "var" was not captured */
66#define TCHECK(var) TCHECK2(var, sizeof(var)) 68#define TCHECK(var) TCHECK2(var, sizeof(var))
67 69
68#endif /* SNIFF_HH */ 70#endif /* SNIFF_HH */