summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opienet/onetwork.cpp128
-rw-r--r--libopie2/opienet/opcap.cpp163
-rw-r--r--libopie2/opienet/ostation.cpp7
3 files changed, 152 insertions, 146 deletions
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp
index 6a9280f..d918193 100644
--- a/libopie2/opienet/onetwork.cpp
+++ b/libopie2/opienet/onetwork.cpp
@@ -34,2 +34,3 @@
#include <opie2/ostation.h>
+#include <opie2/odebug.h>
@@ -69,4 +70,4 @@ ONetwork::ONetwork()
{
- qDebug( "ONetwork::ONetwork()" );
- qDebug( "ONetwork: This code has been compiled against Wireless Extensions V%d", WIRELESS_EXT );
+ odebug << "ONetwork::ONetwork()" << oendl;
+ odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl;
synchronize();
@@ -87,3 +88,3 @@ void ONetwork::synchronize()
{
- qDebug( "ONetwork: /proc/net/dev not existing. No network devices available" );
+ odebug << "ONetwork: /proc/net/dev not existing. No network devices available" << oendl;
return;
@@ -97,3 +98,3 @@ void ONetwork::synchronize()
str.truncate( str.find( ':' ) );
- qDebug( "ONetwork: found interface '%s'", (const char*) str );
+ odebug << "ONetwork: found interface '" << str << "'" << oendl;
ONetworkInterface* iface;
@@ -102,3 +103,3 @@ void ONetwork::synchronize()
iface = new OWirelessNetworkInterface( this, (const char*) str );
- qDebug( "ONetwork: interface '%s' has Wireless Extensions", (const char*) str );
+ odebug << "ONetwork: interface '" << str << "' has Wireless Extensions" << oendl;
}
@@ -163,3 +164,3 @@ ONetworkInterface::ONetworkInterface( QObject* parent, const char* name )
{
- qDebug( "ONetworkInterface::ONetworkInterface()" );
+ odebug << "ONetworkInterface::ONetworkInterface()" << oendl;
init();
@@ -176,3 +177,3 @@ void ONetworkInterface::init()
{
- qDebug( "ONetworkInterface::init()" );
+ odebug << "ONetworkInterface::init()" << oendl;
@@ -182,3 +183,3 @@ void ONetworkInterface::init()
{
- qDebug( "ONetworkInterface::init(): Warning - can't get socket for device '%s'", name() );
+ odebug << "ONetworkInterface::init(): Warning - can't get socket for device '" << name() << "'" << oendl;
return;
@@ -193,5 +194,7 @@ bool ONetworkInterface::ioctl( int call, struct ifreq& ifreq ) const
if ( result == -1 )
- qDebug( "ONetworkInterface::ioctl (%s) call %s (0x%04X) - Status: Failed: %d (%s)", name(), (const char*) debugmapper->map( call ), call, result, strerror( errno ) );
+ odebug << "ONetworkInterface::ioctl (" << name() << ") call '" << debugmapper->map( call )
+ << "' FAILED! " << result << " (" << strerror( errno ) << ")" << oendl;
else
- qDebug( "ONetworkInterface::ioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) debugmapper->map( call ), call );
+ odebug << "ONetworkInterface::ioctl (" << name() << ") call '" << debugmapper->map( call )
+ << "' - Status: Ok." << oendl;
return ( result != -1 );
@@ -317,3 +320,3 @@ void ONetworkInterface::setMonitoring( OMonitoringInterface* m )
_mon = m;
- qDebug( "ONetwork::setMonitoring(): Installed monitoring driver '%s' on interface '%s'", (const char*) m->name(), name() );
+ odebug << "ONetwork::setMonitoring(): Installed monitoring driver '" << m->name() << "' on interface '" << name() << "'" << oendl;
}
@@ -329,3 +332,3 @@ ONetworkInterface::~ONetworkInterface()
{
- qDebug( "ONetworkInterface::~ONetworkInterface()" );
+ odebug << "ONetworkInterface::~ONetworkInterface()" << oendl;
if ( _sfd != -1 ) ::close( _sfd );
@@ -406,4 +409,3 @@ void OChannelHopper::timerEvent( QTimerEvent* )
emit( hopped( *_channel ) );
- qDebug( "OChannelHopper::timerEvent(): set channel %d on interface '%s'",
- *_channel, (const char*) _iface->name() );
+ odebug << "OChannelHopper::timerEvent(): set channel " << *_channel << " on interface '" << _iface->name() << "'" << oendl;
if ( ++_channel == _channels.end() ) _channel = _channels.begin();
@@ -443,3 +445,3 @@ OWirelessNetworkInterface::OWirelessNetworkInterface( QObject* parent, const cha
{
- qDebug( "OWirelessNetworkInterface::OWirelessNetworkInterface()" );
+ odebug << "OWirelessNetworkInterface::OWirelessNetworkInterface()" << oendl;
init();
@@ -461,3 +463,3 @@ void OWirelessNetworkInterface::init()
{
- qDebug( "OWirelessNetworkInterface::init()" );
+ odebug << "OWirelessNetworkInterface::init()" << oendl;
memset( &_iwr, 0, sizeof( struct iwreq ) );
@@ -508,3 +510,3 @@ void OWirelessNetworkInterface::buildInformation()
{
- qDebug( "OWirelessNetworkInterface::buildInformation(): SIOCGIWRANGE failed (%s) - using default values.", strerror( errno ) );
+ owarn << "OWirelessNetworkInterface::buildInformation(): Can't get channel information - using default values." << oendl;
_channels.insert( 2412, 1 ); // 2.412 GHz
@@ -532,4 +534,4 @@ void OWirelessNetworkInterface::buildInformation()
{
- qWarning( "OWirelessNetworkInterface::buildInformation(): Driver for wireless interface '%s' sucks!\n"
- "It overwrote the buffer end with at least %i bytes!\n", name(), max - sizeof( struct iw_range ) );
+ owarn << "OWirelessNetworkInterface::buildInformation(): Driver for wireless interface '" << name()
+ << "' sucks! It overwrote the buffer end with at least " << max - sizeof( struct iw_range ) << " bytes!" << oendl;
}
@@ -540,3 +542,3 @@ void OWirelessNetworkInterface::buildInformation()
- qDebug( "OWirelessNetworkInterface::buildInformation(): Interface %s reported to have %d channels.", name(), range.num_frequency );
+ odebug << "OWirelessNetworkInterface::buildInformation(): Interface reported to have " << (int) range.num_frequency << " channels." << oendl;
for ( int i = 0; i < range.num_frequency; ++i )
@@ -549,3 +551,3 @@ void OWirelessNetworkInterface::buildInformation()
memcpy( &_range, buffer, sizeof( struct iw_range ) );
- qDebug( "OWirelessNetworkInterface::buildInformation(): Information block constructed." );
+ odebug << "OWirelessNetworkInterface::buildInformation(): Information block constructed." << oendl;
free(buffer);
@@ -556,3 +558,3 @@ void OWirelessNetworkInterface::buildPrivateList()
{
- qDebug( "OWirelessNetworkInterface::buildPrivateList()" );
+ odebug << "OWirelessNetworkInterface::buildPrivateList()" << oendl;
@@ -566,3 +568,3 @@ void OWirelessNetworkInterface::buildPrivateList()
{
- qDebug( "OWirelessNetworkInterface::buildPrivateList(): SIOCGIWPRIV failed (%s) - can't get private ioctl information.", strerror( errno ) );
+ owarn << "OWirelessNetworkInterface::buildPrivateList(): Can't get private ioctl information." << oendl;
return;
@@ -574,3 +576,3 @@ void OWirelessNetworkInterface::buildPrivateList()
}
- qDebug( "OWirelessNetworkInterface::buildPrivateList(): Private IOCTL list constructed." );
+ odebug << "OWirelessNetworkInterface::buildPrivateList(): Private ioctl list constructed." << oendl;
}
@@ -580,3 +582,3 @@ void OWirelessNetworkInterface::dumpInformation() const
{
- qDebug( "OWirelessNetworkInterface::() -------------- dumping information block ----------------" );
+ odebug << "OWirelessNetworkInterface::() -------------- dumping information block ----------------" << oendl;
@@ -585,3 +587,3 @@ void OWirelessNetworkInterface::dumpInformation() const
- qDebug( "OWirelessNetworkInterface::() ---------------------------------------------------------" );
+ odebug << "OWirelessNetworkInterface::() ---------------------------------------------------------" << oendl;
}
@@ -612,3 +614,3 @@ void OWirelessNetworkInterface::setChannel( int c ) const
{
- qWarning( "OWirelessNetworkInterface::setChannel( 0 ) called - fix your application!" );
+ oerr << "OWirelessNetworkInterface::setChannel( 0 ) called - fix your application!" << oendl;
return;
@@ -683,3 +685,3 @@ void OWirelessNetworkInterface::setMode( const QString& newMode )
- qDebug( "OWirelessNetworkInterface::setMode(): trying to set mode '%s' (%d)", (const char*) newMode, stringToMode( newMode ) );
+ odebug << "OWirelessNetworkInterface::setMode(): trying to set mode " << newMode << oendl;
@@ -697,3 +699,3 @@ void OWirelessNetworkInterface::setMode( const QString& newMode )
{
- qDebug( "OWirelessNetworkInterface::setMode(): SIOCSIWMODE not sufficient - trying fallback to iwpriv..." );
+ odebug << "OWirelessNetworkInterface::setMode(): SIOCSIWMODE not sufficient - trying fallback to iwpriv..." << oendl;
if ( _mon )
@@ -701,3 +703,3 @@ void OWirelessNetworkInterface::setMode( const QString& newMode )
else
- qDebug( "ONetwork(): can't switch monitor mode without installed monitoring interface" );
+ odebug << "ONetwork(): can't switch monitor mode without installed monitoring interface" << oendl;
}
@@ -709,3 +711,3 @@ void OWirelessNetworkInterface::setMode( const QString& newMode )
{
- qDebug( "OWirelessNetworkInterface::setMode(): IW_MODE_MONITOR ok" );
+ odebug << "OWirelessNetworkInterface::setMode(): IW_MODE_MONITOR ok" << oendl;
}
@@ -713,3 +715,3 @@ void OWirelessNetworkInterface::setMode( const QString& newMode )
{
- qDebug( "OWirelessNetworkInterface::setMode(): SIOCSIWMODE not working - trying fallback to iwpriv..." );
+ odebug << "OWirelessNetworkInterface::setMode(): SIOCSIWMODE not working - trying fallback to iwpriv..." << oendl;
@@ -718,3 +720,3 @@ void OWirelessNetworkInterface::setMode( const QString& newMode )
else
- qDebug( "ONetwork(): can't switch monitor mode without installed monitoring interface" );
+ odebug << "ONetwork(): can't switch monitor mode without installed monitoring interface" << oendl;
}
@@ -733,3 +735,3 @@ QString OWirelessNetworkInterface::mode() const
- qDebug( "DEBUG: WE's idea of current mode seems to be '%s'", (const char*) modeToString( _iwr.u.mode ) );
+ odebug << "OWirelessNetworkInterface::setMode(): WE's idea of current mode seems to be " << modeToString( _iwr.u.mode ) << oendl;
@@ -777,3 +779,4 @@ void OWirelessNetworkInterface::setPrivate( const QString& call, int numargs, ..
{
- qDebug( "OWirelessNetworkInterface::setPrivate(): interface '%s' does not support private ioctl '%s'", name(), (const char*) call );
+ owarn << "OWirelessNetworkInterface::setPrivate(): interface '" << name()
+ << "' does not support private ioctl '" << call << "'" << oendl;
return;
@@ -782,3 +785,4 @@ void OWirelessNetworkInterface::setPrivate( const QString& call, int numargs, ..
{
- qDebug( "OWirelessNetworkInterface::setPrivate(): parameter count not matching. '%s' expects %d arguments, but got %d", (const char*) call, priv->numberSetArgs(), numargs );
+ owarn << "OWirelessNetworkInterface::setPrivate(): parameter count not matching. '"
+ << call << "' expects " << priv->numberSetArgs() << ", but got " << numargs << oendl;
return;
@@ -786,3 +790,3 @@ void OWirelessNetworkInterface::setPrivate( const QString& call, int numargs, ..
- qDebug( "OWirelessNetworkInterface::setPrivate(): about to call '%s' on interface '%s'", (const char*) call, name() );
+ odebug << "OWirelessNetworkInterface::setPrivate(): about to call '" << call << "' on interface '" << name() << "'" << oendl;
memset( &_iwr, 0, sizeof _iwr );
@@ -801,3 +805,3 @@ void OWirelessNetworkInterface::getPrivate( const QString& call )
{
- qWarning( "OWirelessNetworkInterface::getPrivate() is not implemented yet." );
+ oerr << "OWirelessNetworkInterface::getPrivate() is not implemented yet." << oendl;
}
@@ -848,3 +852,3 @@ OStationList* OWirelessNetworkInterface::scanNetwork()
- qDebug( "ONetworkInterface::scanNetwork() - scan started." );
+ odebug << "ONetworkInterface::scanNetwork() - scan started." << oendl;
@@ -871,3 +875,3 @@ OStationList* OWirelessNetworkInterface::scanNetwork()
{
- qDebug( "ONetworkInterface::scanNetwork() - scan in progress..." );
+ odebug << "ONetworkInterface::scanNetwork() - scan in progress..." << oendl;
#if 0
@@ -885,3 +889,3 @@ OStationList* OWirelessNetworkInterface::scanNetwork()
- qDebug( "ONetworkInterface::scanNetwork() - scan finished." );
+ odebug << "ONetworkInterface::scanNetwork() - scan finished." << oendl;
@@ -889,6 +893,6 @@ OStationList* OWirelessNetworkInterface::scanNetwork()
{
- qDebug( " - result length = %d", _iwr.u.data.length );
+ odebug << " - result length = " << _iwr.u.data.length << oendl;
if ( !_iwr.u.data.length )
{
- qDebug( " - no results (empty neighbourhood)" );
+ odebug << " - no results (empty neighbourhood)" << oendl;
return stations;
@@ -896,3 +900,3 @@ OStationList* OWirelessNetworkInterface::scanNetwork()
- qDebug( " - results are in!" );
+ odebug << " - results are in!" << oendl;
dumpBytes( (const unsigned char*) &buffer[0], _iwr.u.data.length );
@@ -908,3 +912,3 @@ OStationList* OWirelessNetworkInterface::scanNetwork()
//if ( !cmd ) cmd = "<unknown>";
- qDebug( "reading next event... cmd=%d, len=%d", we->cmd, we->len );
+ odebug << " - reading next event... cmd=" << we->cmd << ", len=" << we->len << oendl;
switch (we->cmd)
@@ -913,3 +917,3 @@ OStationList* OWirelessNetworkInterface::scanNetwork()
{
- qDebug( "SIOCGIWAP" );
+ odebug << "SIOCGIWAP" << oendl;
stations->append( new OStation() );
@@ -920,3 +924,3 @@ OStationList* OWirelessNetworkInterface::scanNetwork()
{
- qDebug( "SIOCGIWMODE" );
+ odebug << "SIOCGIWMODE" << oendl;
stations->last()->type = modeToString( we->u.mode );
@@ -926,3 +930,3 @@ OStationList* OWirelessNetworkInterface::scanNetwork()
{
- qDebug( "SIOCGIWFREQ" );
+ odebug << "SIOCGIWFREQ" << oendl;
stations->last()->channel = _channels[ static_cast<int>(double( we->u.freq.m ) * pow( 10.0, we->u.freq.e ) / 1000000) ];
@@ -932,3 +936,3 @@ OStationList* OWirelessNetworkInterface::scanNetwork()
{
- qDebug( "SIOCGIWESSID" );
+ odebug << "SIOCGIWESSID" << oendl;
stations->last()->ssid = we->u.essid.pointer;
@@ -936,10 +940,10 @@ OStationList* OWirelessNetworkInterface::scanNetwork()
}
- 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" );
+ case SIOCGIWSENS: odebug << "SIOCGIWSENS" << oendl; break;
+ case SIOCGIWENCODE: odebug << "SIOCGIWENCODE" << oendl; break;
+ case IWEVTXDROP: odebug << "IWEVTXDROP" << oendl; break; /* Packet dropped to excessive retry */
+ case IWEVQUAL: odebug << "IWEVQUAL" << oendl; break; /* Quality part of statistics (scan) */
+ case IWEVCUSTOM: odebug << "IWEVCUSTOM" << oendl; break; /* Driver specific ascii string */
+ case IWEVREGISTERED: odebug << "IWEVREGISTERED" << oendl; break; /* Discovered a new node (AP mode) */
+ case IWEVEXPIRED: odebug << "IWEVEXPIRED" << oendl; break; /* Expired a node (AP mode) */
+ default: odebug << "unhandled event" << oendl;
}
@@ -956,3 +960,3 @@ OStationList* OWirelessNetworkInterface::scanNetwork()
{
- qDebug( " - no results (timeout) :(" );
+ odebug << " - no results (timeout) :(" << oendl;
return stations;
@@ -966,6 +970,10 @@ bool OWirelessNetworkInterface::wioctl( int call, struct iwreq& iwreq ) const
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 ) );
+ odebug << "ONetworkInterface::wioctl (" << name() << ") call '"
+ << debugmapper->map( call ) << "' FAILED! " << result << " (" << strerror( errno ) << ")" << oendl;
else
- qDebug( "ONetworkInterface::wioctl (%s) call %s (0x%04X) - Status: Ok.", name(), (const char*) debugmapper->map( call ), call );
+ odebug << "ONetworkInterface::wioctl (" << name() << ") call '"
+ << debugmapper->map( call ) << "' - Status: Ok." << oendl;
+
return ( result != -1 );
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp
index 635224c..e9b3b2c 100644
--- a/libopie2/opienet/opcap.cpp
+++ b/libopie2/opienet/opcap.cpp
@@ -32,2 +32,3 @@
#include <opie2/opcap.h>
+#include <opie2/odebug.h>
@@ -61,3 +62,3 @@ OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char*
case DLT_EN10MB:
- qDebug( "OPacket::OPacket(): Received Packet. Datalink = ETHERNET" );
+ odebug << "OPacket::OPacket(): Received Packet. Datalink = ETHERNET" << oendl;
new OEthernetPacket( _end, (const struct ether_header*) data, this );
@@ -66,3 +67,3 @@ OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char*
case DLT_IEEE802_11:
- qDebug( "OPacket::OPacket(): Received Packet. Datalink = IEEE802.11" );
+ odebug << "OPacket::OPacket(): Received Packet. Datalink = IEEE802.11" << oendl;
new OWaveLanPacket( _end, (const struct ieee_802_11_header*) data, this );
@@ -71,3 +72,3 @@ OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char*
case DLT_PRISM_HEADER:
- qDebug( "OPacket::OPacket(): Received Packet. Datalink = PRISM_HEADER" );
+ odebug << "OPacket::OPacket(): Received Packet. Datalink = PRISM_HEADER" << oendl;
new OPrismHeaderPacket( _end, (const struct prism_hdr*) (unsigned char*) data, this );
@@ -76,3 +77,3 @@ OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char*
default:
- qWarning( "OPacket::OPacket(): Received Packet over unsupported datalink (type %d)!", datalink );
+ owarn << "OPacket::OPacket(): Received Packet over unsupported datalink, type " << datalink << "!" << oendl;
}
@@ -114,3 +115,3 @@ void OPacket::dumpStructure( QObjectList* l )
QString packetString( "[ |" + _dumpStructure( l ) + " ]" );
- qDebug( "OPacket::dumpStructure: %s", (const char*) packetString );
+ odebug << "OPacket::dumpStructure: " << packetString << oendl;
}
@@ -188,9 +189,9 @@ OEthernetPacket::OEthernetPacket( const unsigned char* end, const struct ether_h
- qDebug( "Source = %s", (const char*) sourceAddress().toString() );
- qDebug( "Destination = %s", (const char*) destinationAddress().toString() );
+ odebug << "Source = " << sourceAddress().toString();
+ odebug << "Destination = " << destinationAddress().toString();
if ( sourceAddress() == OMacAddress::broadcast )
- qDebug( "Source is broadcast address" );
+ odebug << "Source is broadcast address" << oendl;
if ( destinationAddress() == OMacAddress::broadcast )
- qDebug( "Destination is broadcast address" );
+ odebug << "Destination is broadcast address" << oendl;
@@ -200,4 +201,4 @@ OEthernetPacket::OEthernetPacket( const unsigned char* end, const struct ether_h
case ETHERTYPE_ARP: new OARPPacket( end, (const struct myarphdr*) (data+1), this ); break;
- case ETHERTYPE_REVARP: { qDebug( "OPacket::OPacket(): Received Ethernet Packet : Type = RARP" ); break; }
- default: qDebug( "OPacket::OPacket(): Received Ethernet Packet : Type = UNKNOWN" );
+ case ETHERTYPE_REVARP: { odebug << "OPacket::OPacket(): Received Ethernet Packet : Type = RARP" << oendl; break; }
+ default: odebug << "OPacket::OPacket(): Received Ethernet Packet : Type = UNKNOWN" << oendl;
}
@@ -237,9 +238,6 @@ OIPPacket::OIPPacket( const unsigned char* end, const struct iphdr* data, QObjec
{
- qDebug( "OIPPacket::OIPPacket(): decoding IP header..." );
+ odebug << "OIPPacket::OIPPacket(): decoding IP header..." << oendl;
- //qDebug( "FromAddress: %s", (const char*) inet_ntoa( *src ) );
- //qDebug( " ToAddress: %s", (const char*) inet_ntoa( *dst ) );
-
- qDebug( "FromAddress: %s", (const char*) fromIPAddress().toString() );
- qDebug( " toAddress: %s", (const char*) toIPAddress().toString() );
+ odebug << "FromAddress = " << fromIPAddress().toString();
+ odebug << " toAddress = " << toIPAddress().toString();
@@ -249,3 +247,3 @@ OIPPacket::OIPPacket( const unsigned char* end, const struct iphdr* data, QObjec
case IPPROTO_TCP: new OTCPPacket( end, (const struct tcphdr*) (data+1), this ); break;
- default: qDebug( "OIPPacket::OIPPacket(): unknown IP protocol type = %d", protocol() );
+ default: odebug << "OIPPacket::OIPPacket(): unknown IP protocol, type = " << protocol() << oendl;
}
@@ -320,6 +318,6 @@ OARPPacket::OARPPacket( const unsigned char* end, const struct myarphdr* data, Q
{
- qDebug( "OARPPacket::OARPPacket(): decoding ARP header..." );
- qDebug( "ARP type seems to be %02d - '%s'", EXTRACT_16BITS( &_arphdr->ar_op ), (const char*) type() );
- qDebug( "Sender: MAC %s = IP %s", (const char*) senderMacAddress().toString(), (const char*) senderIPV4Address().toString() );
- qDebug( "Target: MAC %s = IP %s", (const char*) targetMacAddress().toString(), (const char*) targetIPV4Address().toString() );
+ odebug << "OARPPacket::OARPPacket(): decoding ARP header..." << oendl;
+ odebug << "ARP type seems to be " << EXTRACT_16BITS( &_arphdr->ar_op ) << " = " << type() << oendl;
+ odebug << "Sender: MAC " << senderMacAddress().toString() << " = IP " << senderIPV4Address().toString() << oendl;
+ odebug << "Target: MAC " << targetMacAddress().toString() << " = IP " << targetIPV4Address().toString() << oendl;
}
@@ -381,5 +379,5 @@ OUDPPacket::OUDPPacket( const unsigned char* end, const struct udphdr* data, QOb
{
- qDebug( "OUDPPacket::OUDPPacket(): decoding UDP header..." );
- qDebug( "fromPort = %d", fromPort() );
- qDebug( " toPort = %d", toPort() );
+ odebug << "OUDPPacket::OUDPPacket(): decoding UDP header..." << oendl;
+ odebug << "fromPort = " << fromPort() << oendl;
+ odebug << " toPort = " << toPort() << oendl;
@@ -390,3 +388,3 @@ OUDPPacket::OUDPPacket( const unsigned char* end, const struct udphdr* data, QOb
{
- qDebug( "seems to be part of a DHCP conversation => creating DHCP packet." );
+ odebug << "seems to be part of a DHCP conversation => creating DHCP packet." << oendl;
new ODHCPPacket( end, (const struct dhcp_packet*) (data+1), this );
@@ -434,9 +432,9 @@ ODHCPPacket::ODHCPPacket( const unsigned char* end, const struct dhcp_packet* da
{
- qDebug( "ODHCPPacket::ODHCPPacket(): decoding DHCP information..." );
- qDebug( "DHCP opcode seems to be %02d - '%s'", _dhcphdr->op, isRequest() ? "REQUEST" : "REPLY" );
- qDebug( "clientAddress: %s", (const char*) clientAddress().toString() );
- qDebug( " yourAddress: %s", (const char*) yourAddress().toString() );
- qDebug( "serverAddress: %s", (const char*) serverAddress().toString() );
- qDebug( " relayAddress: %s", (const char*) relayAddress().toString() );
- qDebug( "parsing DHCP options..." );
+ odebug << "ODHCPPacket::ODHCPPacket(): decoding DHCP information..." << oendl;
+ odebug << "DHCP opcode seems to be " << _dhcphdr->op << ": " << ( isRequest() ? "REQUEST" : "REPLY" ) << oendl;
+ odebug << "clientAddress = " << clientAddress().toString() << oendl;
+ odebug << " yourAddress = " << yourAddress().toString() << oendl;
+ odebug << "serverAddress = " << serverAddress().toString() << oendl;
+ odebug << " relayAddress = " << relayAddress().toString() << oendl;
+ odebug << "parsing DHCP options..." << oendl;
@@ -451,3 +449,3 @@ ODHCPPacket::ODHCPPacket( const unsigned char* end, const struct dhcp_packet* da
len = *option++;
- qDebug( "recognized DHCP option #%d, length %d", tag, len );
+ odebug << "recognized DHCP option #" << tag << ", length " << len << oendl;
@@ -459,3 +457,3 @@ ODHCPPacket::ODHCPPacket( const unsigned char* end, const struct dhcp_packet* da
{
- qWarning( "DHCP parsing ERROR: sanity check says the packet is at its end!" );
+ owarn << "DHCP parsing ERROR: sanity check says the packet is at its end!" << oendl;
break;
@@ -464,3 +462,3 @@ ODHCPPacket::ODHCPPacket( const unsigned char* end, const struct dhcp_packet* da
- qDebug( "DHCP type seems to be '%s'", (const char*) type() );
+ odebug << "DHCP type seems to be << " << type() << oendl;
}
@@ -541,3 +539,3 @@ OTCPPacket::OTCPPacket( const unsigned char* end, const struct tcphdr* data, QOb
{
- qDebug( "OTCPPacket::OTCPPacket(): decoding TCP header..." );
+ odebug << "OTCPPacket::OTCPPacket(): decoding TCP header..." << oendl;
}
@@ -594,5 +592,5 @@ OPrismHeaderPacket::OPrismHeaderPacket( const unsigned char* end, const struct p
{
- qDebug( "OPrismHeaderPacket::OPrismHeaderPacket(): decoding PRISM header..." );
+ odebug << "OPrismHeaderPacket::OPrismHeaderPacket(): decoding PRISM header..." << oendl;
- qDebug( "Signal Strength = %d", data->signal.data );
+ odebug << "Signal Strength = " << data->signal.data << oendl;
@@ -620,12 +618,12 @@ OWaveLanPacket::OWaveLanPacket( const unsigned char* end, const struct ieee_802_
{
- qDebug( "OWaveLanPacket::OWaveLanPacket(): decoding IEEE 802.11 header..." );
- qDebug( "type: %0X", type() );
- qDebug( "subType: %0X", subType() );
- qDebug( "duration: %d", duration() );
- qDebug( "powermanagement: %d", usesPowerManagement() );
- qDebug( "payload is encrypted: %s", usesWep() ? "yes" : "no" );
- qDebug( "MAC1: %s", (const char*) macAddress1().toString() );
- qDebug( "MAC2: %s", (const char*) macAddress2().toString() );
- qDebug( "MAC3: %s", (const char*) macAddress3().toString() );
- qDebug( "MAC4: %s", (const char*) macAddress4().toString() );
+ odebug << "OWaveLanPacket::OWaveLanPacket(): decoding IEEE 802.11 header..." << oendl;
+ odebug << "type = " << type() << oendl;
+ odebug << "subType = " << subType() << oendl;
+ odebug << "duration = " << duration() << oendl;
+ odebug << "powermanagement = " << usesPowerManagement() << oendl;
+ odebug << "payload is encrypted = " << ( usesWep() ? "yes" : "no" ) << oendl;
+ odebug << "MAC1 = " << macAddress1().toString() << oendl;
+ odebug << "MAC2 = " << macAddress2().toString() << oendl;
+ odebug << "MAC3 = " << macAddress3().toString() << oendl;
+ odebug << "MAC4 = " << macAddress4().toString() << oendl;
@@ -636,3 +634,3 @@ OWaveLanPacket::OWaveLanPacket( const unsigned char* end, const struct ieee_802_
case T_CTRL: new OWaveLanControlPacket( end, (const struct ieee_802_11_control_header*) data, this ); break;
- default: qDebug( "OWaveLanPacket::OWaveLanPacket(): Warning: Unknown major type '%d'!", type() );
+ default: odebug << "OWaveLanPacket::OWaveLanPacket(): Warning: Unknown major type = " << type() << oendl;
}
@@ -725,4 +723,4 @@ OWaveLanManagementPacket::OWaveLanManagementPacket( const unsigned char* end, co
{
- qDebug( "OWaveLanManagementPacket::OWaveLanManagementPacket(): decoding frame..." );
- qDebug( "Detected subtype is '%s'", (const char*) managementType() );
+ odebug << "OWaveLanManagementPacket::OWaveLanManagementPacket(): decoding frame..." << oendl;
+ odebug << "Detected subtype is " << managementType() << oendl;
@@ -825,3 +823,3 @@ OWaveLanManagementSSID::OWaveLanManagementSSID( const unsigned char* end, const
{
- qDebug( "OWaveLanManagementSSID()" );
+ odebug << "OWaveLanManagementSSID()" << oendl;
}
@@ -852,3 +850,3 @@ OWaveLanManagementRates::OWaveLanManagementRates( const unsigned char* end, cons
{
- qDebug( "OWaveLanManagementRates()" );
+ odebug << "OWaveLanManagementRates()" << oendl;
}
@@ -867,3 +865,3 @@ OWaveLanManagementCF::OWaveLanManagementCF( const unsigned char* end, const stru
{
- qDebug( "OWaveLanManagementCF()" );
+ odebug << "OWaveLanManagementCF()" << oendl;
}
@@ -882,3 +880,3 @@ OWaveLanManagementFH::OWaveLanManagementFH( const unsigned char* end, const stru
{
- qDebug( "OWaveLanManagementFH()" );
+ odebug << "OWaveLanManagementFH()" << oendl;
}
@@ -897,3 +895,3 @@ OWaveLanManagementDS::OWaveLanManagementDS( const unsigned char* end, const stru
{
- qDebug( "OWaveLanManagementDS()" );
+ odebug << "OWaveLanManagementDS()" << oendl;
}
@@ -918,3 +916,3 @@ OWaveLanManagementTim::OWaveLanManagementTim( const unsigned char* end, const st
{
- qDebug( "OWaveLanManagementTim()" );
+ odebug << "OWaveLanManagementTim()" << oendl;
}
@@ -933,3 +931,3 @@ OWaveLanManagementIBSS::OWaveLanManagementIBSS( const unsigned char* end, const
{
- qDebug( "OWaveLanManagementIBSS()" );
+ odebug << "OWaveLanManagementIBSS()" << oendl;
}
@@ -948,3 +946,3 @@ OWaveLanManagementChallenge::OWaveLanManagementChallenge( const unsigned char* e
{
- qDebug( "OWaveLanManagementChallenge()" );
+ odebug << "OWaveLanManagementChallenge()" << oendl;
}
@@ -963,3 +961,3 @@ OWaveLanDataPacket::OWaveLanDataPacket( const unsigned char* end, const struct i
{
- qDebug( "OWaveLanDataPacket::OWaveLanDataPacket(): decoding frame..." );
+ odebug << "OWaveLanDataPacket::OWaveLanDataPacket(): decoding frame..." << oendl;
@@ -986,3 +984,3 @@ OLLCPacket::OLLCPacket( const unsigned char* end, const struct ieee_802_11_802_2
{
- qDebug( "OLLCPacket::OLLCPacket(): decoding frame..." );
+ odebug << "OLLCPacket::OLLCPacket(): decoding frame..." << oendl;
@@ -990,3 +988,3 @@ OLLCPacket::OLLCPacket( const unsigned char* end, const struct ieee_802_11_802_2
{
- qDebug( "OLLCPacket::OLLCPacket(): contains an encapsulated Ethernet frame (type=%04X)", EXTRACT_16BITS( &_header->type ) );
+ owarn << "OLLCPacket::OLLCPacket(): contains an encapsulated Ethernet frame (type = " << EXTRACT_16BITS( &_header->type ) << ")" << oendl;
@@ -996,5 +994,4 @@ OLLCPacket::OLLCPacket( const unsigned char* end, const struct ieee_802_11_802_2
case ETH_P_ARP: new OARPPacket( end, (const struct myarphdr*) (data+1), this ); break;
- default: qWarning( "OLLCPacket::OLLCPacket(): Unknown Encapsulation (type=%04X)", EXTRACT_16BITS( &_header->type ) );
+ default: owarn << "OLLCPacket::OLLCPacket(): Unknown Encapsulation type = " << EXTRACT_16BITS( &_header->type ) << oendl;
}
-
}
@@ -1015,3 +1012,3 @@ OWaveLanControlPacket::OWaveLanControlPacket( const unsigned char* end, const st
{
- qDebug( "OWaveLanControlPacket::OWaveLanDataControl(): decoding frame..." );
+ odebug << "OWaveLanControlPacket::OWaveLanDataControl(): decoding frame..." << oendl;
//TODO: Implement this
@@ -1040,3 +1037,3 @@ OPacketCapturer::~OPacketCapturer()
{
- qDebug( "OPacketCapturer::~OPacketCapturer(): pcap still open, autoclosing." );
+ odebug << "OPacketCapturer::~OPacketCapturer(): pcap still open, autoclosing." << oendl;
close();
@@ -1050,3 +1047,3 @@ void OPacketCapturer::setBlocking( bool b )
{
- qDebug( "OPacketCapturer::setBlocking(): blocking mode changed successfully." );
+ odebug << "OPacketCapturer::setBlocking(): blocking mode changed successfully." << oendl;
}
@@ -1054,3 +1051,3 @@ void OPacketCapturer::setBlocking( bool b )
{
- qDebug( "OPacketCapturer::setBlocking(): can't change blocking mode: %s", _errbuf );
+ odebug << "OPacketCapturer::setBlocking(): can't change blocking mode: " << _errbuf << oendl;
}
@@ -1064,3 +1061,3 @@ bool OPacketCapturer::blocking() const
{
- qDebug( "OPacketCapturer::blocking(): can't get blocking mode: %s", _errbuf );
+ odebug << "OPacketCapturer::blocking(): can't get blocking mode: " << _errbuf << oendl;
return -1;
@@ -1095,7 +1092,7 @@ void OPacketCapturer::close()
- qDebug( "OPacketCapturer::close() --- dumping capturing statistics..." );
- qDebug( "--------------------------------------------------" );
+ odebug << "OPacketCapturer::close() --- dumping capturing statistics..." << oendl;
+ odebug << "--------------------------------------------------" << oendl;
for( QMap<QString,int>::Iterator it = _stats.begin(); it != _stats.end(); ++it )
- qDebug( "%s : %d", (const char*) it.key(), it.data() );
- qDebug( "--------------------------------------------------" );
+ odebug << it.key() << " = " << it.data() << oendl;
+ odebug << "--------------------------------------------------" << oendl;
@@ -1153,5 +1150,5 @@ OPacket* OPacketCapturer::next()
packetheaderstruct header;
- qDebug( "==> OPacketCapturer::next()" );
+ odebug << "==> OPacketCapturer::next()" << oendl;
const unsigned char* pdata = pcap_next( _pch, &header );
- qDebug( "<== OPacketCapturer::next()" );
+ odebug << "<== OPacketCapturer::next()" << oendl;
@@ -1200,3 +1197,3 @@ bool OPacketCapturer::open( const QString& name )
{
- qWarning( "OPacketCapturer::open(): can't open libpcap with '%s': %s", (const char*) name, _errbuf );
+ owarn << "OPacketCapturer::open(): can't open libpcap with '" << name << "': " << _errbuf << oendl;
return false;
@@ -1204,3 +1201,3 @@ bool OPacketCapturer::open( const QString& name )
- qDebug( "OPacketCapturer::open(): libpcap [%s] opened successfully.", (const char*) name );
+ odebug << "OPacketCapturer::open(): libpcap [" << name << "] opened successfully." << oendl;
_pch = handle;
@@ -1225,6 +1222,6 @@ bool OPacketCapturer::openDumpFile( const QString& filename )
{
- qWarning( "OPacketCapturer::open(): can't open dump with '%s': %s", (const char*) filename, _errbuf );
+ owarn << "OPacketCapturer::open(): can't open dump with '" << filename << "': " << _errbuf << oendl;
return false;
}
- qDebug( "OPacketCapturer::open(): dump [%s] opened successfully.", (const char*) filename );
+ odebug << "OPacketCapturer::open(): dump [" << filename << "] opened successfully." << oendl;
_pcd = dump;
@@ -1258,3 +1255,3 @@ bool OPacketCapturer::open( const QFile& file )
{
- qDebug( "OPacketCapturer::open(): libpcap opened successfully." );
+ odebug << "OPacketCapturer::open(): libpcap opened successfully." << oendl;
_pch = handle;
@@ -1273,3 +1270,3 @@ bool OPacketCapturer::open( const QFile& file )
{
- qDebug( "OPacketCapturer::open(): can't open libpcap with '%s': %s", (const char*) name, _errbuf );
+ odebug << "OPacketCapturer::open(): can't open libpcap with '" << name << "': " << _errbuf << oendl;
return false;
@@ -1288,3 +1285,3 @@ void OPacketCapturer::readyToReceive()
{
- qDebug( "OPacketCapturer::readyToReceive(): about to emit 'receivePacket(p)'" );
+ odebug << "OPacketCapturer::readyToReceive(): about to emit 'receivePacket(p)'" << oendl;
OPacket* p = next();
diff --git a/libopie2/opienet/ostation.cpp b/libopie2/opienet/ostation.cpp
index c363f0c..8c989d8 100644
--- a/libopie2/opienet/ostation.cpp
+++ b/libopie2/opienet/ostation.cpp
@@ -31,2 +31,3 @@
#include <opie2/ostation.h>
+#include <opie2/odebug.h>
@@ -38,3 +39,3 @@ OStation::OStation()
{
- qDebug( "OStation::OStation()" );
+ odebug << "OStation::OStation()" << oendl;
@@ -51,3 +52,3 @@ OStation::~OStation()
{
- qDebug( "OStation::~OStation()" );
+ odebug << "OStation::~OStation()" << oendl;
}
@@ -57,3 +58,3 @@ void OStation::dump()
{
- qDebug( "------- OStation::dump() ------------" );
+ odebug << "------- OStation::dump() ------------" << oendl;
qDebug( "type: %s", (const char*) type );