-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 58 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 2 |
2 files changed, 53 insertions, 7 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index afb010c..02a6f76 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -30,2 +30,3 @@ | |||
30 | #include "../libwellenreiter/source/sock.hh" // <--- ugly path, FIX THIS! | 30 | #include "../libwellenreiter/source/sock.hh" // <--- ugly path, FIX THIS! |
31 | #include "../libwellenreiter/source/proto.hh" // <--- ugly path, FIX THIS! | ||
31 | #include "../daemon/source/config.hh" // <--- ugly path, FIX THIS! | 32 | #include "../daemon/source/config.hh" // <--- ugly path, FIX THIS! |
@@ -61,2 +62,43 @@ void Wellenreiter::handleMessage() | |||
61 | qDebug( "received message from daemon." ); | 62 | qDebug( "received message from daemon." ); |
63 | |||
64 | char buffer[128]; | ||
65 | |||
66 | int result = recvcomm( &daemon_fd, (char*) &buffer, sizeof(buffer) ); | ||
67 | qDebug( "received %d from recvcomm", result ); | ||
68 | |||
69 | /* | ||
70 | typedef struct { | ||
71 | int net_type; 1 = Accesspoint ; 2 = Ad-Hoc | ||
72 | int ssid_len; Length of SSID | ||
73 | int channel; Channel | ||
74 | int wep; 1 = WEP enabled ; 0 = disabled | ||
75 | char mac[64]; MAC address of Accesspoint | ||
76 | char bssid[128]; BSSID of Accesspoint | ||
77 | } wl_network_t; | ||
78 | */ | ||
79 | |||
80 | if ( result == 1 ) /* new network found */ | ||
81 | { | ||
82 | qDebug( "Sniffer said: new network found." ); | ||
83 | wl_network_t n; | ||
84 | get_network_found( &n, (const char*) &buffer ); | ||
85 | n.bssid[n.ssid_len] = "\0"; | ||
86 | |||
87 | QString type; | ||
88 | |||
89 | if ( n.net_type == 1 ) | ||
90 | type == "managed"; | ||
91 | else | ||
92 | type == "adhoc"; | ||
93 | |||
94 | addNewItem( type, n.bssid, n.mac, n.wep, n.channel, 0 ); | ||
95 | |||
96 | } | ||
97 | |||
98 | else | ||
99 | |||
100 | { | ||
101 | qDebug( "unknown sniffer command." ); | ||
102 | } | ||
103 | |||
62 | } | 104 | } |
@@ -66,2 +108,5 @@ bool Wellenreiter::hasMessage() | |||
66 | { | 108 | { |
109 | |||
110 | // FIXME: do this in libwellenreiter, not here!!! | ||
111 | |||
67 | fd_set rfds; | 112 | fd_set rfds; |
@@ -72,3 +117,4 @@ bool Wellenreiter::hasMessage() | |||
72 | tv.tv_usec = 0; | 117 | tv.tv_usec = 0; |
73 | return select( 1, &rfds, NULL, NULL, &tv ); | 118 | int result = select( daemon_fd+1, &rfds, NULL, NULL, &tv ); |
119 | return FD_ISSET( daemon_fd, &rfds ); | ||
74 | } | 120 | } |
@@ -77,3 +123,3 @@ void Wellenreiter::timerEvent( QTimerEvent* e ) | |||
77 | { | 123 | { |
78 | // qDebug( "checking for message..." ); | 124 | qDebug( "checking for message..." ); |
79 | 125 | ||
@@ -85,3 +131,3 @@ void Wellenreiter::timerEvent( QTimerEvent* e ) | |||
85 | { | 131 | { |
86 | // qDebug( "no message :(" ); | 132 | qDebug( "no message :(" ); |
87 | } | 133 | } |
@@ -89,3 +135,3 @@ void Wellenreiter::timerEvent( QTimerEvent* e ) | |||
89 | 135 | ||
90 | void Wellenreiter::addNewStation( QString type, QString essid, QString ap, bool wep, int channel, int signal ) | 136 | void Wellenreiter::addNewItem( QString type, QString essid, QString ap, bool wep, int channel, int signal ) |
91 | { | 137 | { |
@@ -122,4 +168,4 @@ void Wellenreiter::buttonClicked() | |||
122 | 168 | ||
123 | addNewStation( "managed", "MyNet", "04:00:20:EF:A6:43", true, 6, 80 ); | 169 | addNewItem( "managed", "MyNet", "04:00:20:EF:A6:43", true, 6, 80 ); |
124 | addNewStation( "adhoc", "YourNet", "40:03:A3:E7:56:22", false, 11, 30 ); | 170 | addNewItem( "adhoc", "YourNet", "40:03:A3:E7:56:22", false, 11, 30 ); |
125 | 171 | ||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index b0f41e3..61f7503 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h | |||
@@ -35,3 +35,3 @@ public slots: | |||
35 | void buttonClicked(); | 35 | void buttonClicked(); |
36 | void addNewStation( QString type, QString essid, QString ap, bool wep, int channel, int signal ); | 36 | void addNewItem( QString type, QString essid, QString ap, bool wep, int channel, int signal ); |
37 | 37 | ||