summaryrefslogtreecommitdiff
path: root/libopie2/opienet/opcap.cpp
Unidiff
Diffstat (limited to 'libopie2/opienet/opcap.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/opcap.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp
index fdd519c..4081d4f 100644
--- a/libopie2/opienet/opcap.cpp
+++ b/libopie2/opienet/opcap.cpp
@@ -24,48 +24,53 @@
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31/* OPIE */ 31/* OPIE */
32#include <opie2/opcap.h> 32#include <opie2/opcap.h>
33#include <opie2/odebug.h> 33#include <opie2/odebug.h>
34 34
35/* QT */ 35/* QT */
36#include <qapplication.h> // don't use oapplication here (will decrease reusability in other projects) 36#include <qapplication.h> // don't use oapplication here (will decrease reusability in other projects)
37#include <qsocketnotifier.h> 37#include <qsocketnotifier.h>
38#include <qobjectlist.h> 38#include <qobjectlist.h>
39 39
40/* SYSTEM */ 40/* SYSTEM */
41#include <sys/time.h> 41#include <sys/time.h>
42#include <sys/types.h> 42#include <sys/types.h>
43#include <unistd.h> 43#include <unistd.h>
44 44
45/* LOCAL */ 45/* LOCAL */
46#include "udp_ports.h" 46#include "udp_ports.h"
47 47
48using namespace Opie::Core;
49
50namespace Opie {
51namespace Net {
52
48/*====================================================================================== 53/*======================================================================================
49 * OPacket 54 * OPacket
50 *======================================================================================*/ 55 *======================================================================================*/
51 56
52OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char* data, QObject* parent ) 57OPacket::OPacket( int datalink, packetheaderstruct header, const unsigned char* data, QObject* parent )
53 :QObject( parent, "Generic" ), _hdr( header ), _data( data ) 58 :QObject( parent, "Generic" ), _hdr( header ), _data( data )
54{ 59{
55 //qDebug( "OPacket::OPacket(): (Len %d, CapLen %d)" /*, ctime((const time_t*) header.ts.tv_sec)*/, header.len, header.caplen ); 60 //qDebug( "OPacket::OPacket(): (Len %d, CapLen %d)" /*, ctime((const time_t*) header.ts.tv_sec)*/, header.len, header.caplen );
56 61
57 _end = (unsigned char*) data + header.len; 62 _end = (unsigned char*) data + header.len;
58 //qDebug( "OPacket::data @ %0x, end @ %0x", data, _end ); 63 //qDebug( "OPacket::data @ %0x, end @ %0x", data, _end );
59 64
60 switch ( datalink ) 65 switch ( datalink )
61 { 66 {
62 case DLT_EN10MB: 67 case DLT_EN10MB:
63 odebug << "OPacket::OPacket(): Received Packet. Datalink = ETHERNET" << oendl; 68 odebug << "OPacket::OPacket(): Received Packet. Datalink = ETHERNET" << oendl;
64 new OEthernetPacket( _end, (const struct ether_header*) data, this ); 69 new OEthernetPacket( _end, (const struct ether_header*) data, this );
65 break; 70 break;
66 71
67 case DLT_IEEE802_11: 72 case DLT_IEEE802_11:
68 odebug << "OPacket::OPacket(): Received Packet. Datalink = IEEE802.11" << oendl; 73 odebug << "OPacket::OPacket(): Received Packet. Datalink = IEEE802.11" << oendl;
69 new OWaveLanPacket( _end, (const struct ieee_802_11_header*) data, this ); 74 new OWaveLanPacket( _end, (const struct ieee_802_11_header*) data, this );
70 break; 75 break;
71 76
@@ -1323,25 +1328,26 @@ void OPacketCapturer::readyToReceive()
1323 1328
1324const QMap<QString,int>& OPacketCapturer::statistics() const 1329const QMap<QString,int>& OPacketCapturer::statistics() const
1325{ 1330{
1326 return _stats; 1331 return _stats;
1327} 1332}
1328 1333
1329 1334
1330int OPacketCapturer::snapShot() const 1335int OPacketCapturer::snapShot() const
1331{ 1336{
1332 return pcap_snapshot( _pch ); 1337 return pcap_snapshot( _pch );
1333} 1338}
1334 1339
1335 1340
1336bool OPacketCapturer::swapped() const 1341bool OPacketCapturer::swapped() const
1337{ 1342{
1338 return pcap_is_swapped( _pch ); 1343 return pcap_is_swapped( _pch );
1339} 1344}
1340 1345
1341 1346
1342QString OPacketCapturer::version() const 1347QString OPacketCapturer::version() const
1343{ 1348{
1344 return QString().sprintf( "%d.%d", pcap_major_version( _pch ), pcap_minor_version( _pch ) ); 1349 return QString().sprintf( "%d.%d", pcap_major_version( _pch ), pcap_minor_version( _pch ) );
1345} 1350}
1346 1351
1347 1352}
1353}