summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/opcap.cpp2
-rw-r--r--libopie2/opienet/opcap.h10
2 files changed, 7 insertions, 5 deletions
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp
index c5df041..93176c0 100644
--- a/libopie2/opienet/opcap.cpp
+++ b/libopie2/opienet/opcap.cpp
@@ -44,32 +44,34 @@
44 44
45/* LOCAL */ 45/* LOCAL */
46#include "udp_ports.h" 46#include "udp_ports.h"
47 47
48using namespace Opie::Core; 48using namespace Opie::Core;
49 49
50namespace Opie { 50namespace Opie {
51namespace Net { 51namespace Net {
52 52
53/*====================================================================================== 53/*======================================================================================
54 * OPacket 54 * OPacket
55 *======================================================================================*/ 55 *======================================================================================*/
56 56
57OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char* data, QObject* parent ) 57OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char* data, QObject* parent )
58 :QObject( parent, "Generic" ), _hdr( header ), _data( data ) 58 :QObject( parent, "Generic" ), _hdr( header ), _data( data )
59{ 59{
60 //FIXME: Copy the data structure here, because it isn't persistent. Check that.
61
60 qDebug( "OPacket::OPacket(): (Len %d, CapLen %d)" /*, ctime((const time_t*) header.ts.tv_sec)*/, header.len, header.caplen ); 62 qDebug( "OPacket::OPacket(): (Len %d, CapLen %d)" /*, ctime((const time_t*) header.ts.tv_sec)*/, header.len, header.caplen );
61 63
62 _end = (unsigned char*) data + header.len; 64 _end = (unsigned char*) data + header.len;
63 //qDebug( "OPacket::data @ %0x, end @ %0x", data, _end ); 65 //qDebug( "OPacket::data @ %0x, end @ %0x", data, _end );
64 66
65 switch ( datalink ) 67 switch ( datalink )
66 { 68 {
67 case DLT_EN10MB: 69 case DLT_EN10MB:
68 odebug << "OPacket::OPacket(): Received Packet. Datalink = ETHERNET" << oendl; 70 odebug << "OPacket::OPacket(): Received Packet. Datalink = ETHERNET" << oendl;
69 new OEthernetPacket( _end, (const struct ether_header*) data, this ); 71 new OEthernetPacket( _end, (const struct ether_header*) data, this );
70 break; 72 break;
71 73
72 case DLT_IEEE802_11: 74 case DLT_IEEE802_11:
73 odebug << "OPacket::OPacket(): Received Packet. Datalink = IEEE802.11" << oendl; 75 odebug << "OPacket::OPacket(): Received Packet. Datalink = IEEE802.11" << oendl;
74 new OWaveLanPacket( _end, (const struct ieee_802_11_header*) data, this ); 76 new OWaveLanPacket( _end, (const struct ieee_802_11_header*) data, this );
75 break; 77 break;
diff --git a/libopie2/opienet/opcap.h b/libopie2/opienet/opcap.h
index 4ff8495..2dbe030 100644
--- a/libopie2/opienet/opcap.h
+++ b/libopie2/opienet/opcap.h
@@ -117,50 +117,50 @@ class OPacketCapturer;
117 117
118class OPacket : public QObject 118class OPacket : public QObject
119{ 119{
120 Q_OBJECT 120 Q_OBJECT
121 121
122 friend class OPacketCapturer; 122 friend class OPacketCapturer;
123 friend QTextStream& operator<<( QTextStream& s, const OPacket& p ); 123 friend QTextStream& operator<<( QTextStream& s, const OPacket& p );
124 124
125 public: 125 public:
126 OPacket( int datalink, packetheaderstruct, const unsigned char*, QObject* parent ); 126 OPacket( int datalink, packetheaderstruct, const unsigned char*, QObject* parent );
127 virtual ~OPacket(); 127 virtual ~OPacket();
128 128
129 timevalstruct timeval() const; 129 timevalstruct timeval() const;
130 130
131 int caplen() const; 131 int caplen() const;
132 int len() const; 132 int len() const;
133 QString dump( int = 32 ) const; 133 QString dump( int = 32 ) const; //FIXME: remove that
134 134
135 void updateStats( QMap<QString,int>&, QObjectList* ); 135 void updateStats( QMap<QString,int>&, QObjectList* ); //FIXME: Revise
136 136
137 QString dumpStructure() const; 137 QString dumpStructure() const; //FIXME: Revise
138 private: 138 private:
139 QString _dumpStructure( QObjectList* ) const; 139 QString _dumpStructure( QObjectList* ) const; //FIXME: Revise
140 140
141 private: 141 private:
142 const packetheaderstruct _hdr; // pcap packet header 142 const packetheaderstruct _hdr; // pcap packet header
143 const unsigned char* _data; // pcap packet data 143 const unsigned char* _data; // pcap packet data
144 const unsigned char* _end; // end of pcap packet data 144 const unsigned char* _end; // end of pcap packet data
145 private: 145 private:
146 class Private; 146 class Private;
147 Private *d; 147 Private *d;
148}; 148};
149 149
150QTextStream& operator<<( QTextStream& s, const OPacket& p ); 150QTextStream& operator<<( QTextStream& s, const OPacket& p ); //FIXME: Revise
151 151
152/*====================================================================================== 152/*======================================================================================
153 * OEthernetPacket - DLT_EN10MB frame 153 * OEthernetPacket - DLT_EN10MB frame
154 *======================================================================================*/ 154 *======================================================================================*/
155 155
156class OEthernetPacket : public QObject 156class OEthernetPacket : public QObject
157{ 157{
158 Q_OBJECT 158 Q_OBJECT
159 159
160 public: 160 public:
161 OEthernetPacket( const unsigned char*, const struct ether_header*, QObject* parent = 0 ); 161 OEthernetPacket( const unsigned char*, const struct ether_header*, QObject* parent = 0 );
162 virtual ~OEthernetPacket(); 162 virtual ~OEthernetPacket();
163 163
164 OMacAddress sourceAddress() const; 164 OMacAddress sourceAddress() const;
165 OMacAddress destinationAddress() const; 165 OMacAddress destinationAddress() const;
166 int type() const; 166 int type() const;