Diffstat (limited to 'libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp | 63 |
1 files changed, 39 insertions, 24 deletions
diff --git a/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp index 7581888..f800336 100644 --- a/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp +++ b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp | |||
@@ -80,35 +80,12 @@ public: | |||
80 | } | 80 | } |
81 | 81 | ||
82 | // downcast should be safe now | 82 | // downcast should be safe now |
83 | wiface = (OWirelessNetworkInterface*) iface; | 83 | wiface = (OWirelessNetworkInterface*) iface; |
84 | printf( "Using wireless interface '%s' for scanning (current SSID is '%s')...\n", (const char*) interface, (const char*) wiface->SSID() ); | 84 | printf( "Using wireless interface '%s' for scanning (current SSID is '%s')...\n", (const char*) interface, (const char*) wiface->SSID() ); |
85 | 85 | ||
86 | /* | ||
87 | |||
88 | // ifconfig down the interface - this enable more crash-proof | ||
89 | // scanning with drivers like spectrum_cs... | ||
90 | if ( wiface->isUp() ) | ||
91 | { | ||
92 | printf( "Interface status is up... switching to down... " ); | ||
93 | wiface->setUp( false ); | ||
94 | if ( wiface->isUp() ) | ||
95 | { | ||
96 | printf( "failed (%s). Exiting.\n", strerror( errno ) ); | ||
97 | exit( -1 ); | ||
98 | } | ||
99 | else | ||
100 | { | ||
101 | printf( "ok.\n" ); | ||
102 | } | ||
103 | } | ||
104 | else | ||
105 | printf( "Interface status is already down - good.\n" ); | ||
106 | |||
107 | */ | ||
108 | |||
109 | // ifconfig +promisc the interface to receive all packets | 86 | // ifconfig +promisc the interface to receive all packets |
110 | if ( !wiface->promiscuousMode() ) | 87 | if ( !wiface->promiscuousMode() ) |
111 | { | 88 | { |
112 | printf( "Interface status is not promisc... switching to promisc... " ); | 89 | printf( "Interface status is not promisc... switching to promisc... " ); |
113 | wiface->setPromiscuousMode( true ); | 90 | wiface->setPromiscuousMode( true ); |
114 | if ( !wiface->promiscuousMode() ) | 91 | if ( !wiface->promiscuousMode() ) |
@@ -166,13 +143,12 @@ public slots: | |||
166 | { | 143 | { |
167 | printf( "(empty packet received)\n" ); | 144 | printf( "(empty packet received)\n" ); |
168 | return; | 145 | return; |
169 | } | 146 | } |
170 | 147 | ||
171 | OWaveLanManagementPacket* beacon = (OWaveLanManagementPacket*) p->child( "802.11 Management" ); | 148 | OWaveLanManagementPacket* beacon = (OWaveLanManagementPacket*) p->child( "802.11 Management" ); |
172 | |||
173 | if ( beacon ) | 149 | if ( beacon ) |
174 | { | 150 | { |
175 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 151 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
176 | QString essid = ssid ? ssid->ID() : "<unknown>"; | 152 | QString essid = ssid ? ssid->ID() : "<unknown>"; |
177 | 153 | ||
178 | if ( stations.find( essid ) ) | 154 | if ( stations.find( essid ) ) |
@@ -180,12 +156,51 @@ public slots: | |||
180 | else | 156 | else |
181 | { | 157 | { |
182 | printf( "found new network @ channel %d, SSID = '%s'\n", wiface->channel(), (const char*) essid ); | 158 | printf( "found new network @ channel %d, SSID = '%s'\n", wiface->channel(), (const char*) essid ); |
183 | stations.insert( essid, new Station( "unknown", wiface->channel(), | 159 | stations.insert( essid, new Station( "unknown", wiface->channel(), |
184 | ((OWaveLanPacket*) beacon->parent())->usesWep() ) ); | 160 | ((OWaveLanPacket*) beacon->parent())->usesWep() ) ); |
185 | } | 161 | } |
162 | return; | ||
163 | } | ||
164 | |||
165 | OWaveLanDataPacket* data = (OWaveLanDataPacket*) p->child( "802.11 Data" ); | ||
166 | if ( data ) | ||
167 | { | ||
168 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | ||
169 | if ( wlan->fromDS() && !wlan->toDS() ) | ||
170 | { | ||
171 | printf( "FromDS: '%s' -> '%s' via '%s'\n", | ||
172 | (const char*) wlan->macAddress3().toString(true), | ||
173 | (const char*) wlan->macAddress1().toString(true), | ||
174 | (const char*) wlan->macAddress2().toString(true) ); | ||
175 | } | ||
176 | else | ||
177 | if ( !wlan->fromDS() && wlan->toDS() ) | ||
178 | { | ||
179 | printf( "ToDS: '%s' -> '%s' via '%s'\n", | ||
180 | (const char*) wlan->macAddress2().toString(true), | ||
181 | (const char*) wlan->macAddress3().toString(true), | ||
182 | (const char*) wlan->macAddress1().toString(true) ); | ||
183 | } | ||
184 | else | ||
185 | if ( wlan->fromDS() && wlan->toDS() ) | ||
186 | { | ||
187 | printf( "WSD(bridge): '%s' -> '%s' via '%s' and '%s'\n", | ||
188 | (const char*) wlan->macAddress4().toString(true), | ||
189 | (const char*) wlan->macAddress3().toString(true), | ||
190 | (const char*) wlan->macAddress1().toString(true), | ||
191 | (const char*) wlan->macAddress2().toString(true) ); | ||
192 | } | ||
193 | else | ||
194 | { | ||
195 | printf( "IBSS(AdHoc): '%s' -> '%s' (Cell: '%s')'\n", | ||
196 | (const char*) wlan->macAddress2().toString(true), | ||
197 | (const char*) wlan->macAddress1().toString(true), | ||
198 | (const char*) wlan->macAddress3().toString(true) ); | ||
199 | } | ||
200 | return; | ||
186 | } | 201 | } |
187 | } | 202 | } |
188 | private: | 203 | private: |
189 | OPacketCapturer* cap; | 204 | OPacketCapturer* cap; |
190 | OWirelessNetworkInterface* wiface; | 205 | OWirelessNetworkInterface* wiface; |
191 | }; | 206 | }; |