summaryrefslogtreecommitdiff
path: root/libopie2/opienet/opcap.h
Side-by-side diff
Diffstat (limited to 'libopie2/opienet/opcap.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/opcap.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/libopie2/opienet/opcap.h b/libopie2/opienet/opcap.h
index ddef278..c9b0624 100644
--- a/libopie2/opienet/opcap.h
+++ b/libopie2/opienet/opcap.h
@@ -37,27 +37,29 @@
/* LINUX */
extern "C" // work around a bpf/pcap conflict in recent headers
{
#include <pcap.h>
}
#include <netinet/ether.h>
#include <netinet/ip.h>
#include <netinet/udp.h>
#include <netinet/tcp.h>
#include <time.h>
/* QT */
+#include <qevent.h>
#include <qhostaddress.h>
#include <qobject.h>
#include <qstring.h>
+#include <qmap.h>
/* OPIE */
#include <opie2/onetutils.h>
#include "802_11_user.h"
/* TYPEDEFS */
typedef struct timeval timevalstruct;
typedef struct pcap_pkthdr packetheaderstruct;
/* FORWARDS */
class OPacketCapturer;
class QSocketNotifier;
@@ -71,24 +73,26 @@ class OPacket : public QObject
Q_OBJECT
public:
OPacket( int datalink, packetheaderstruct, const unsigned char*, QObject* parent );
virtual ~OPacket();
timevalstruct timeval() const;
int caplen() const;
int len() const;
QString dump( int = 32 ) const;
+ void updateStats( QMap<QString,int>&, QObjectList* );
+
private:
const packetheaderstruct _hdr; // pcap packet header
const unsigned char* _data; // pcap packet data
const unsigned char* _end; // end of pcap packet data
};
/*======================================================================================
* OEthernetPacket - DLT_EN10MB frame
*======================================================================================*/
class OEthernetPacket : public QObject
{
@@ -425,28 +429,31 @@ class OPacketCapturer : public QObject
~OPacketCapturer();
void setBlocking( bool );
bool blocking() const;
void close();
int dataLink() const;
int fileno() const;
OPacket* next();
bool open( const QString& name );
bool isOpen() const;
+ const QMap<QString,int>& statistics() const;
+
signals:
void receivedPacket( OPacket* );
protected slots:
void readyToReceive();
protected:
QString _name; // devicename
bool _open; // check this before doing pcap calls
pcap_t* _pch; // pcap library handle
QSocketNotifier* _sn; // socket notifier for main loop
mutable char _errbuf[PCAP_ERRBUF_SIZE];
+ QMap<QString, int> _stats; // statistics;
};
#endif // OPCAP_H