summaryrefslogtreecommitdiff
path: root/libopie2/examples
Side-by-side diff
Diffstat (limited to 'libopie2/examples') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp63
-rw-r--r--libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp1
2 files changed, 40 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:
}
// downcast should be safe now
wiface = (OWirelessNetworkInterface*) iface;
printf( "Using wireless interface '%s' for scanning (current SSID is '%s')...\n", (const char*) interface, (const char*) wiface->SSID() );
- /*
-
- // ifconfig down the interface - this enable more crash-proof
- // scanning with drivers like spectrum_cs...
- if ( wiface->isUp() )
- {
- printf( "Interface status is up... switching to down... " );
- wiface->setUp( false );
- if ( wiface->isUp() )
- {
- printf( "failed (%s). Exiting.\n", strerror( errno ) );
- exit( -1 );
- }
- else
- {
- printf( "ok.\n" );
- }
- }
- else
- printf( "Interface status is already down - good.\n" );
-
- */
-
// ifconfig +promisc the interface to receive all packets
if ( !wiface->promiscuousMode() )
{
printf( "Interface status is not promisc... switching to promisc... " );
wiface->setPromiscuousMode( true );
if ( !wiface->promiscuousMode() )
@@ -166,13 +143,12 @@ public slots:
{
printf( "(empty packet received)\n" );
return;
}
OWaveLanManagementPacket* beacon = (OWaveLanManagementPacket*) p->child( "802.11 Management" );
-
if ( beacon )
{
OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
QString essid = ssid ? ssid->ID() : "<unknown>";
if ( stations.find( essid ) )
@@ -180,12 +156,51 @@ public slots:
else
{
printf( "found new network @ channel %d, SSID = '%s'\n", wiface->channel(), (const char*) essid );
stations.insert( essid, new Station( "unknown", wiface->channel(),
((OWaveLanPacket*) beacon->parent())->usesWep() ) );
}
+ return;
+ }
+
+ OWaveLanDataPacket* data = (OWaveLanDataPacket*) p->child( "802.11 Data" );
+ if ( data )
+ {
+ OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" );
+ if ( wlan->fromDS() && !wlan->toDS() )
+ {
+ printf( "FromDS: '%s' -> '%s' via '%s'\n",
+ (const char*) wlan->macAddress3().toString(true),
+ (const char*) wlan->macAddress1().toString(true),
+ (const char*) wlan->macAddress2().toString(true) );
+ }
+ else
+ if ( !wlan->fromDS() && wlan->toDS() )
+ {
+ printf( "ToDS: '%s' -> '%s' via '%s'\n",
+ (const char*) wlan->macAddress2().toString(true),
+ (const char*) wlan->macAddress3().toString(true),
+ (const char*) wlan->macAddress1().toString(true) );
+ }
+ else
+ if ( wlan->fromDS() && wlan->toDS() )
+ {
+ printf( "WSD(bridge): '%s' -> '%s' via '%s' and '%s'\n",
+ (const char*) wlan->macAddress4().toString(true),
+ (const char*) wlan->macAddress3().toString(true),
+ (const char*) wlan->macAddress1().toString(true),
+ (const char*) wlan->macAddress2().toString(true) );
+ }
+ else
+ {
+ printf( "IBSS(AdHoc): '%s' -> '%s' (Cell: '%s')'\n",
+ (const char*) wlan->macAddress2().toString(true),
+ (const char*) wlan->macAddress1().toString(true),
+ (const char*) wlan->macAddress3().toString(true) );
+ }
+ return;
}
}
private:
OPacketCapturer* cap;
OWirelessNetworkInterface* wiface;
};
diff --git a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp
index 020fc23..f801b15 100644
--- a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp
+++ b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp
@@ -9,12 +9,13 @@ int main( int argc, char** argv )
ONetwork::InterfaceIterator it = net->iterator();
while ( it.current() )
{
qDebug( "DEMO: ONetwork contains Interface '%s'", (const char*) it.current()->name() );
qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString() );
+ qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString(true) );
qDebug( "Demo: IPv4 Address is '%s'", (const char*) it.current()->ipV4Address() );
if ( it.current()->isWireless() )
{
OWirelessNetworkInterface* iface = static_cast<OWirelessNetworkInterface*>( it.current() );
qDebug( "DEMO: '%s' seems to feature the wireless extensions.", (const char*) iface->name() );
qDebug( "DEMO: Current SSID is '%s'", (const char*) iface->SSID() );