summaryrefslogtreecommitdiff
path: root/libopie2/opienet/opcap.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opienet/opcap.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/opcap.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp
index 7463320..fdd519c 100644
--- a/libopie2/opienet/opcap.cpp
+++ b/libopie2/opienet/opcap.cpp
@@ -109,16 +109,15 @@ void OPacket::updateStats( QMap<QString,int>& stats, QObjectList* l )
}
}
-void OPacket::dumpStructure( QObjectList* l )
+QString OPacket::dumpStructure() const
{
- QString packetString( "[ |" + _dumpStructure( l ) + " ]" );
- odebug << "OPacket::dumpStructure: " << packetString << oendl;
+ return "[ |" + _dumpStructure( const_cast<QObjectList*>( this->children() ) ) + " ]";
}
-QString OPacket::_dumpStructure( QObjectList* l )
+QString OPacket::_dumpStructure( QObjectList* l ) const
{
if (!l) return QString::null;
QObject* o = l->first();
QString str(" ");
@@ -178,8 +177,14 @@ int OPacket::len() const
return _hdr.len;
}
+QTextStream& operator<<( QTextStream& s, const OPacket& p )
+{
+ s << p.dumpStructure();
+}
+
+
/*======================================================================================
* OEthernetPacket
*======================================================================================*/
@@ -728,9 +733,9 @@ OWaveLanManagementPacket::OWaveLanManagementPacket( const unsigned char* end, co
// Beacons contain a 12 byte long fixed parameters set before the tagged parameters come,
// Other management frames don't - which is why we have to inspect the subtype here.
const unsigned char* ptr = managementType() == "Beacon" ? (const unsigned char*) (_body+1) : (const unsigned char*) (_header+1);
-
+
while (ptr < end)
{
switch ( *ptr )
{
@@ -1187,11 +1192,9 @@ OPacket* OPacketCapturer::next()
// as possible - that is right after they have been processed
// by emit() [ see below ]
//TODO: make gathering statistics optional, because it takes time
p->updateStats( _stats, const_cast<QObjectList*>( p->children() ) );
- #ifndef NODEBUG
- p->dumpStructure( const_cast<QObjectList*>( p->children() ) );
- #endif
+ odebug << "OPacket::dumpStructure: " << p->dumpStructure() << oendl;
return p;
}
else
{
@@ -1337,8 +1340,8 @@ bool OPacketCapturer::swapped() const
QString OPacketCapturer::version() const
{
- return QString().sprintf( "%s.%s", pcap_major_version( _pch ), pcap_minor_version( _pch ) );
+ return QString().sprintf( "%d.%d", pcap_major_version( _pch ), pcap_minor_version( _pch ) );
}