-rw-r--r-- | libopie2/opienet/opcap.h | 7 |
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 | |||
@@ -43,15 +43,17 @@ extern "C" // work around a bpf/pcap conflict in recent headers | |||
43 | #include <netinet/ip.h> | 43 | #include <netinet/ip.h> |
44 | #include <netinet/udp.h> | 44 | #include <netinet/udp.h> |
45 | #include <netinet/tcp.h> | 45 | #include <netinet/tcp.h> |
46 | #include <time.h> | 46 | #include <time.h> |
47 | 47 | ||
48 | /* QT */ | 48 | /* QT */ |
49 | #include <qevent.h> | ||
49 | #include <qhostaddress.h> | 50 | #include <qhostaddress.h> |
50 | #include <qobject.h> | 51 | #include <qobject.h> |
51 | #include <qstring.h> | 52 | #include <qstring.h> |
53 | #include <qmap.h> | ||
52 | 54 | ||
53 | /* OPIE */ | 55 | /* OPIE */ |
54 | #include <opie2/onetutils.h> | 56 | #include <opie2/onetutils.h> |
55 | #include "802_11_user.h" | 57 | #include "802_11_user.h" |
56 | 58 | ||
57 | /* TYPEDEFS */ | 59 | /* TYPEDEFS */ |
@@ -77,12 +79,14 @@ class OPacket : public QObject | |||
77 | timevalstruct timeval() const; | 79 | timevalstruct timeval() const; |
78 | 80 | ||
79 | int caplen() const; | 81 | int caplen() const; |
80 | int len() const; | 82 | int len() const; |
81 | QString dump( int = 32 ) const; | 83 | QString dump( int = 32 ) const; |
82 | 84 | ||
85 | void updateStats( QMap<QString,int>&, QObjectList* ); | ||
86 | |||
83 | private: | 87 | private: |
84 | const packetheaderstruct _hdr; // pcap packet header | 88 | const packetheaderstruct _hdr; // pcap packet header |
85 | const unsigned char* _data; // pcap packet data | 89 | const unsigned char* _data; // pcap packet data |
86 | const unsigned char* _end; // end of pcap packet data | 90 | const unsigned char* _end; // end of pcap packet data |
87 | }; | 91 | }; |
88 | 92 | ||
@@ -431,22 +435,25 @@ class OPacketCapturer : public QObject | |||
431 | int dataLink() const; | 435 | int dataLink() const; |
432 | int fileno() const; | 436 | int fileno() const; |
433 | OPacket* next(); | 437 | OPacket* next(); |
434 | bool open( const QString& name ); | 438 | bool open( const QString& name ); |
435 | bool isOpen() const; | 439 | bool isOpen() const; |
436 | 440 | ||
441 | const QMap<QString,int>& statistics() const; | ||
442 | |||
437 | signals: | 443 | signals: |
438 | void receivedPacket( OPacket* ); | 444 | void receivedPacket( OPacket* ); |
439 | 445 | ||
440 | protected slots: | 446 | protected slots: |
441 | void readyToReceive(); | 447 | void readyToReceive(); |
442 | 448 | ||
443 | protected: | 449 | protected: |
444 | QString _name; // devicename | 450 | QString _name; // devicename |
445 | bool _open; // check this before doing pcap calls | 451 | bool _open; // check this before doing pcap calls |
446 | pcap_t* _pch; // pcap library handle | 452 | pcap_t* _pch; // pcap library handle |
447 | QSocketNotifier* _sn; // socket notifier for main loop | 453 | QSocketNotifier* _sn; // socket notifier for main loop |
448 | mutable char _errbuf[PCAP_ERRBUF_SIZE]; | 454 | mutable char _errbuf[PCAP_ERRBUF_SIZE]; |
455 | QMap<QString, int> _stats; // statistics; | ||
449 | }; | 456 | }; |
450 | 457 | ||
451 | #endif // OPCAP_H | 458 | #endif // OPCAP_H |
452 | 459 | ||