summaryrefslogtreecommitdiff
path: root/libopie2/opienet/opcap.cpp
authormickeyl <mickeyl>2004-03-12 13:04:07 (UTC)
committer mickeyl <mickeyl>2004-03-12 13:04:07 (UTC)
commitd38384a6edb0110117e0297864f813b379d52789 (patch) (side-by-side diff)
tree82929ccdea4c9e30e39971beea1a9f4a51bc7b57 /libopie2/opienet/opcap.cpp
parent36d9d18055dbed7a85ab2979d1e96dfb4017560b (diff)
downloadopie-d38384a6edb0110117e0297864f813b379d52789.zip
opie-d38384a6edb0110117e0297864f813b379d52789.tar.gz
opie-d38384a6edb0110117e0297864f813b379d52789.tar.bz2
API change: OPacket::dumpStructure() now returns a QString and accepts void
API change: add QTextStream& operator<<( QTextStream& s, const OPacket& p );
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
@@ -112,6 +112,5 @@ 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() ) ) + " ]";
}
@@ -119,3 +118,3 @@ void OPacket::dumpStructure( QObjectList* l )
-QString OPacket::_dumpStructure( QObjectList* l )
+QString OPacket::_dumpStructure( QObjectList* l ) const
{
@@ -181,2 +180,8 @@ int OPacket::len() const
+QTextStream& operator<<( QTextStream& s, const OPacket& p )
+{
+ s << p.dumpStructure();
+}
+
+
/*======================================================================================
@@ -731,3 +736,3 @@ OWaveLanManagementPacket::OWaveLanManagementPacket( const unsigned char* end, co
const unsigned char* ptr = managementType() == "Beacon" ? (const unsigned char*) (_body+1) : (const unsigned char*) (_header+1);
-
+
while (ptr < end)
@@ -1190,5 +1195,3 @@ OPacket* OPacketCapturer::next()
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;
@@ -1340,3 +1343,3 @@ 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 ) );
}