summaryrefslogtreecommitdiff
path: root/libopie2/opienet/onetwork.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opienet/onetwork.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/onetwork.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp
index 95c813f..6a9280f 100644
--- a/libopie2/opienet/onetwork.cpp
+++ b/libopie2/opienet/onetwork.cpp
@@ -1,54 +1,51 @@
/*
                This file is part of the Opie Project
-              Copyright (C) 2003 by the Wellenreiter team:
- Martin J. Muench <mjm@remote-exploit.org>
- Max Moser <mmo@remote-exploit.org
- Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
+              Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de>
=.
.=l.
           .>+-=
 _;:,     .>    :=|. This program is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This program is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/* OPIE */
#include <opie2/onetwork.h>
#include <opie2/ostation.h>
/* QT */
#include <qfile.h>
#include <qtextstream.h>
/* UNIX */
#include <assert.h>
#include <arpa/inet.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/types.h>
@@ -905,96 +902,97 @@ OStationList* OWirelessNetworkInterface::scanNetwork()
int offset = 0;
struct iw_event* we = (struct iw_event*) &buffer[0];
while ( offset < _iwr.u.data.length )
{
//const char* cmd = *(*_ioctlmap)[we->cmd];
//if ( !cmd ) cmd = "<unknown>";
qDebug( "reading next event... cmd=%d, len=%d", we->cmd, we->len );
switch (we->cmd)
{
case SIOCGIWAP:
{
qDebug( "SIOCGIWAP" );
stations->append( new OStation() );
stations->last()->macAddress = (const unsigned char*) &we->u.ap_addr.sa_data[0];
break;
}
case SIOCGIWMODE:
{
qDebug( "SIOCGIWMODE" );
stations->last()->type = modeToString( we->u.mode );
break;
}
case SIOCGIWFREQ:
{
qDebug( "SIOCGIWFREQ" );
stations->last()->channel = _channels[ static_cast<int>(double( we->u.freq.m ) * pow( 10.0, we->u.freq.e ) / 1000000) ];
break;
}
case SIOCGIWESSID:
{
qDebug( "SIOCGIWESSID" );
stations->last()->ssid = we->u.essid.pointer;
break;
}
case SIOCGIWSENS: qDebug( "SIOCGIWSENS" ); break;
case SIOCGIWENCODE: qDebug( "SIOCGIWENCODE" ); break;
case IWEVTXDROP: qDebug( "IWEVTXDROP" ); break; /* Packet dropped to excessive retry */
case IWEVQUAL: qDebug( "IWEVQUAL" ); break; /* Quality part of statistics (scan) */
case IWEVCUSTOM: qDebug( "IWEVCUSTOM" ); break; /* Driver specific ascii string */
case IWEVREGISTERED: qDebug( "IWEVREGISTERED" ); break; /* Discovered a new node (AP mode) */
case IWEVEXPIRED: qDebug( "IWEVEXPIRED" ); break; /* Expired a node (AP mode) */
default: qDebug( "unhandled event" );
}
offset += we->len;
we = (struct iw_event*) &buffer[offset];
}
+ return stations;
return stations;
}
else
{
qDebug( " - no results (timeout) :(" );
return stations;
}
}
bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const
{
#ifndef NODEBUG
int result = ::ioctl( _sfd, call, &iwreq );
if ( result == -1 )
qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Failed: %d (%s)", name(), (const char*) debugmapper->map( call ), call, result, strerror( errno ) );
else
qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) debugmapper->map( call ), call );
return ( result != -1 );
#else
return ::ioctl( _sfd, call, &iwreq ) != -1;
#endif
}
bool OWirelessNetworkInterface::wioctl( int call ) const
{
strcpy( _iwr.ifr_name, name() );
return wioctl( call, _iwr );
}
/*======================================================================================
* OMonitoringInterface
*======================================================================================*/
OMonitoringInterface::OMonitoringInterface( ONetworkInterface* iface, bool prismHeader )
:_if( static_cast<OWirelessNetworkInterface*>( iface ) ), _prismHeader( prismHeader )
{
}
OMonitoringInterface::~OMonitoringInterface()
{
}