summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-03-30 03:06:07 (UTC)
committer mickeyl <mickeyl>2003-03-30 03:06:07 (UTC)
commit8e1504c3e8b8e5af509147f0b33f4e92a7c1c041 (patch) (side-by-side diff)
treebb3b73b0d14c5f304405d473ed6a3ed381240652
parente1c4cb3364f8f7ff68da88b5ec26053ee561c8a1 (diff)
downloadopie-8e1504c3e8b8e5af509147f0b33f4e92a7c1c041.zip
opie-8e1504c3e8b8e5af509147f0b33f4e92a7c1c041.tar.gz
opie-8e1504c3e8b8e5af509147f0b33f4e92a7c1c041.tar.bz2
very interesting: gcc 2.9x does not handle operator? with mixed types, e.g. operator?(bool,QString,char*), while gcc 3.x does the necessary format conversion.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 5bdc1b3..3bff7c4 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -33,193 +33,193 @@ using namespace Opie;
#include <opie2/opcap.h>
// Standard
#include <assert.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <stdlib.h>
// Local
#include "wellenreiter.h"
#include "scanlist.h"
#include "logwindow.h"
#include "hexwindow.h"
#include "configwindow.h"
#include "manufacturers.h"
Wellenreiter::Wellenreiter( QWidget* parent )
: WellenreiterBase( parent, 0, 0 ),
sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 )
{
//
// construct manufacturer database
//
QString manufile;
#ifdef QWS
manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() );
#else
manufile.sprintf( "/usr/local/share/wellenreiter/manufacturers.dat" );
#endif
manufacturerdb = new ManufacturerDB( manufile );
logwindow->log( "(i) Wellenreiter has been started." );
//
// detect operating system
//
#ifdef QWS
QString sys;
sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() );
_system = ODevice::inst()->system();
logwindow->log( sys );
#endif
// setup GUI
netview->setColumnWidthMode( 1, QListView::Manual );
if ( manufacturerdb )
netview->setManufacturerDB( manufacturerdb );
pcap = new OPacketCapturer();
}
Wellenreiter::~Wellenreiter()
{
// no need to delete child widgets, Qt does it all for us
delete manufacturerdb;
delete pcap;
}
void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw )
{
configwindow = cw;
}
void Wellenreiter::receivePacket(OPacket* p)
{
logwindow->log( "(d) Received data from daemon" );
//TODO
// check if we received a beacon frame
// static_cast is justified here
OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) );
if ( !beacon ) return;
QString type;
//FIXME: Can stations in ESS mode can be distinguished from APs?
//FIXME: Apparently yes, but not by listening to beacons, because
//FIXME: they simply don't send beacons in infrastructure mode.
//FIXME: so we also have to listen to data packets
if ( beacon->canIBSS() )
type = "adhoc";
else
type = "managed";
OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) );
- QString essid = ssid ? ssid->ID() : "<unknown>";
+ QString essid = ssid ? ssid->ID() : QString("<unknown>");
OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) );
int channel = ds ? ds->channel() : -1;
OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) );
netView()->addNewItem( type, essid, header->macAddress2().toString(), header->usesWep(), channel, 0 );
}
void Wellenreiter::startStopClicked()
{
if ( sniffing )
{
disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
iface->setChannelHopping(); // stop hopping channels
pcap->close();
sniffing = false;
oApp->setTitle();
// get interface name from config window
const QString& interface = configwindow->interfaceName->currentText();
ONetwork* net = ONetwork::instance();
iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface ));
// switch off monitor mode
iface->setMonitorMode( false );
// switch off promisc flag
iface->setPromiscuousMode( false );
//TODO: Display "please wait..." (use owait?)
/*
QString cmdline;
cmdline.sprintf( "ifdown %s; sleep 1; ifup %s", (const char*) interface, (const char*) interface, (const char*) interface );
system( cmdline ); //FIXME: Use OProcess
*/
// message the user
//QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." );
}
else
{
// get configuration from config window
const QString& interface = configwindow->interfaceName->currentText();
const int cardtype = configwindow->daemonDeviceType();
const int interval = configwindow->daemonHopInterval();
if ( ( interface == "" ) || ( cardtype == 0 ) )
{
QMessageBox::information( this, "Wellenreiter II", "Your device is not\nproperly configured. Please reconfigure!" );
return;
}
// configure device
ONetwork* net = ONetwork::instance();
iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface ));
// set monitor mode
switch ( cardtype )
{
case 1: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break;
case 2: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break;
case 3: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break;
case 4: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break;
default: assert( 0 ); // shouldn't happen
}
iface->setMonitorMode( true );
// open pcap and start sniffing
pcap->open( interface );
if ( !pcap->isOpen() )
{
QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) ));
return;
}
// set capturer to non-blocking mode
pcap->setBlocking( false );
// start channel hopper
iface->setChannelHopping( 1000 ); //use interval from config window
// connect
connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
logwindow->log( "(i) Daemon has been started." );
oApp->setTitle( "Scanning ..." );
sniffing = true;