author | mjm <mjm> | 2002-12-04 19:51:24 (UTC) |
---|---|---|
committer | mjm <mjm> | 2002-12-04 19:51:24 (UTC) |
commit | ad62016e2d341876c068bead69a40ebd0370d822 (patch) (unidiff) | |
tree | f974069739d25de1ffd4107b302234b7183d145a | |
parent | ba2de7d7233c0fbbd8ef31fae7aa5a9ded70225e (diff) | |
download | opie-ad62016e2d341876c068bead69a40ebd0370d822.zip opie-ad62016e2d341876c068bead69a40ebd0370d822.tar.gz opie-ad62016e2d341876c068bead69a40ebd0370d822.tar.bz2 |
implemented send_to_gui
-rw-r--r-- | noncore/net/wellenreiter/libwellenreiter/source/sniff.cc | 41 | ||||
-rw-r--r-- | noncore/net/wellenreiter/libwellenreiter/source/sniff.hh | 10 |
2 files changed, 31 insertions, 20 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc b/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc index fedd8fc..66299d1 100644 --- a/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc +++ b/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc | |||
@@ -10,5 +10,6 @@ | |||
10 | #include "log.hh" | 10 | #include "log.hh" |
11 | #include "proto.hh" | ||
11 | 12 | ||
12 | /* Main function, checks packets */ | 13 | /* Main function, checks packets */ |
13 | void process_packets(const struct pcap_pkthdr *pkthdr, const unsigned char *packet) | 14 | void process_packets(const struct pcap_pkthdr *pkthdr, const unsigned char *packet, char *guihost, int guiport) |
14 | { | 15 | { |
@@ -22,2 +23,6 @@ void process_packets(const struct pcap_pkthdr *pkthdr, const unsigned char *pack | |||
22 | struct packetinfo *pinfoptr; | 23 | struct packetinfo *pinfoptr; |
24 | |||
25 | /* wl_network_t will finally be set and send to the ui */ | ||
26 | wl_network_t wl_net; | ||
27 | |||
23 | pinfoptr=&pinfo; | 28 | pinfoptr=&pinfo; |
@@ -94,4 +99,5 @@ void process_packets(const struct pcap_pkthdr *pkthdr, const unsigned char *pack | |||
94 | if (pinfoptr->cap_ESS == 1 &&pinfoptr->cap_IBSS ==0) | 99 | if (pinfoptr->cap_ESS == 1 &&pinfoptr->cap_IBSS ==0) |
95 | { | 100 | { |
96 | printf ("\nHave found an accesspoint:"); | 101 | wl_loginfo("Found an access point"); |
102 | wl_net.net_type=1; | ||
97 | } | 103 | } |
@@ -99,4 +105,4 @@ void process_packets(const struct pcap_pkthdr *pkthdr, const unsigned char *pack | |||
99 | { | 105 | { |
100 | printf ("\nHave found an AD-HOC station:"); | 106 | wl_loginfo("Found an ad-hoc network"); |
101 | 107 | wl_net.net_type=2; | |
102 | } | 108 | } |
@@ -104,3 +110,3 @@ void process_packets(const struct pcap_pkthdr *pkthdr, const unsigned char *pack | |||
104 | { | 110 | { |
105 | printf ("\n\tOn a non-broadcasting network"); | 111 | wl_loginfo("Net is a non-broadcasting network"); |
106 | } | 112 | } |
@@ -108,10 +114,15 @@ void process_packets(const struct pcap_pkthdr *pkthdr, const unsigned char *pack | |||
108 | { | 114 | { |
109 | printf ("\n\tOn network : %s",pinfoptr->ssid); | 115 | wl_loginfo("SSID is: %s", pinfoptr->ssid); |
116 | // wl_net.bssid=pinfoptr->ssid; | ||
110 | } | 117 | } |
111 | printf ("\n\tLen SSID : %d",pinfoptr->ssid_len); | 118 | |
112 | printf ("\n\tOn Channel : %d",pinfoptr->channel); | 119 | wl_net.ssid_len=pinfoptr->ssid_len; |
113 | printf ("\n\tEncryption : %s", pinfoptr->cap_WEP ? "ON" : "OFF"); | 120 | wl_net.channel=pinfoptr->channel; |
114 | printf ("\n\tMacaddress : %s",pinfoptr->sndhwaddr); | 121 | wl_net.wep=pinfoptr->cap_WEP; |
115 | printf ("\n\tBssid : %s",pinfoptr->bssid); | 122 | memcpy(wl_net.mac, pinfoptr->sndhwaddr, sizeof(wl_net.mac));; |
116 | printf ("\n\tDest : %s\n",pinfoptr->desthwaddr); | 123 | memcpy(wl_net.bssid, pinfoptr->ssid, sizeof(wl_net.bssid)); |
124 | |||
125 | // printf ("\n\tDest : %s\n",pinfoptr->desthwaddr); | ||
126 | send_network_found((char *)guihost, guiport, &wl_net); | ||
127 | wl_loginfo("Sent network to GUI '%s:%d'", guihost, guiport); | ||
117 | } | 128 | } |
@@ -207,5 +218,5 @@ int handle_beacon(u_int16_t fc, const u_char *p,struct packetinfo *ppinfo) | |||
207 | if (strcmp((char *)pbody.ssid.ssid,"")==0) | 218 | if (strcmp((char *)pbody.ssid.ssid,"")==0) |
208 | ppinfo->ssid = NONBROADCASTING; | 219 | memcpy(ppinfo->ssid, NONBROADCASTING, sizeof(ppinfo->ssid)); |
209 | else | 220 | else |
210 | ppinfo->ssid = (char *)pbody.ssid.ssid; | 221 | memcpy(ppinfo->ssid, pbody.ssid.ssid, sizeof(ppinfo->ssid)); |
211 | ppinfo->ssid_len = pbody.ssid.length; | 222 | ppinfo->ssid_len = pbody.ssid.length; |
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/sniff.hh b/noncore/net/wellenreiter/libwellenreiter/source/sniff.hh index fa8519b..60cdc43 100644 --- a/noncore/net/wellenreiter/libwellenreiter/source/sniff.hh +++ b/noncore/net/wellenreiter/libwellenreiter/source/sniff.hh | |||
@@ -29,6 +29,6 @@ struct packetinfo | |||
29 | int channel; | 29 | int channel; |
30 | char bssid[sizeof("00:00:00:00:00:00")]; | 30 | char bssid[sizeof("00:00:00:00:00:00") + 1]; |
31 | char desthwaddr[sizeof("00:00:00:00:00:00")]; | 31 | char desthwaddr[sizeof("00:00:00:00:00:00") + 1]; |
32 | char sndhwaddr[sizeof("00:00:00:00:00:00")]; | 32 | char sndhwaddr[sizeof("00:00:00:00:00:00") + 1]; |
33 | char *ssid; | 33 | char ssid[128]; |
34 | int ssid_len; | 34 | int ssid_len; |
@@ -36,3 +36,3 @@ struct packetinfo | |||
36 | 36 | ||
37 | void process_packets(const struct pcap_pkthdr* pkthdr,const u_char* packet); | 37 | void process_packets(const struct pcap_pkthdr* pkthdr,const u_char* packet, char *, int); |
38 | int decode_80211b_hdr(const u_char *p,struct packetinfo *ppinfo); | 38 | int decode_80211b_hdr(const u_char *p,struct packetinfo *ppinfo); |