-rw-r--r-- | libopie2/opienet/opcap.h | 166 |
1 files changed, 154 insertions, 12 deletions
diff --git a/libopie2/opienet/opcap.h b/libopie2/opienet/opcap.h index 65c550c..0b06572 100644 --- a/libopie2/opienet/opcap.h +++ b/libopie2/opienet/opcap.h @@ -59,8 +59,9 @@ typedef struct timeval timevalstruct; typedef struct pcap_pkthdr packetheaderstruct; /* FORWARDS */ class OPacketCapturer; +class QSocketNotifier; /*====================================================================================== * OPacket - A frame on the wire *======================================================================================*/ @@ -83,8 +84,9 @@ class OPacket : public QObject 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 @@ -94,9 +96,9 @@ class OEthernetPacket : public QObject { Q_OBJECT public: - OEthernetPacket( const struct ether_header*, QObject* parent = 0 ); + OEthernetPacket( const unsigned char*, const struct ether_header*, QObject* parent = 0 ); virtual ~OEthernetPacket(); OMacAddress sourceAddress() const; OMacAddress destinationAddress() const; @@ -115,9 +117,9 @@ class OWaveLanPacket : public QObject { Q_OBJECT public: - OWaveLanPacket( const struct ieee_802_11_header*, QObject* parent = 0 ); + OWaveLanPacket( const unsigned char*, const struct ieee_802_11_header*, QObject* parent = 0 ); virtual ~OWaveLanPacket(); int duration() const; bool fromDS() const; @@ -145,29 +147,168 @@ class OWaveLanManagementPacket : public QObject { Q_OBJECT public: - OWaveLanManagementPacket( const struct ieee_802_11_mgmt_header*, OWaveLanPacket* parent = 0 ); + OWaveLanManagementPacket( const unsigned char*, const struct ieee_802_11_mgmt_header*, OWaveLanPacket* parent = 0 ); virtual ~OWaveLanManagementPacket(); - QString SSID() const; + int beaconInterval() const; + int capabilities() const; // generic + + bool canESS() const; + bool canIBSS() const; + bool canCFP() const; + bool canCFP_REQ() const; + bool canPrivacy() const; private: const struct ieee_802_11_mgmt_header* _header; const struct ieee_802_11_mgmt_body* _body; }; /*====================================================================================== + * OWaveLanManagementSSID + *======================================================================================*/ + +class OWaveLanManagementSSID : public QObject +{ + Q_OBJECT + + public: + OWaveLanManagementSSID( const unsigned char*, const struct ssid_t*, QObject* parent = 0 ); + virtual ~OWaveLanManagementSSID(); + + QString ID() const; + + private: + const struct ssid_t* _data; +}; + +/*====================================================================================== + * OWaveLanManagementRates + *======================================================================================*/ + +class OWaveLanManagementRates : public QObject +{ + Q_OBJECT + + public: + OWaveLanManagementRates( const unsigned char*, const struct rates_t*, QObject* parent = 0 ); + virtual ~OWaveLanManagementRates(); + + private: + const struct rates_t* _data; +}; + +/*====================================================================================== + * OWaveLanManagementCF + *======================================================================================*/ + +class OWaveLanManagementCF : public QObject +{ + Q_OBJECT + + public: + OWaveLanManagementCF( const unsigned char*, const struct cf_t*, QObject* parent = 0 ); + virtual ~OWaveLanManagementCF(); + + private: + const struct cf_t* _data; +}; + +/*====================================================================================== + * OWaveLanManagementFH + *======================================================================================*/ + +class OWaveLanManagementFH : public QObject +{ + Q_OBJECT + + public: + OWaveLanManagementFH( const unsigned char*, const struct fh_t*, QObject* parent = 0 ); + virtual ~OWaveLanManagementFH(); + + private: + const struct fh_t* _data; +}; + +/*====================================================================================== + * OWaveLanManagementDS + *======================================================================================*/ + +class OWaveLanManagementDS : public QObject +{ + Q_OBJECT + + public: + OWaveLanManagementDS( const unsigned char*, const struct ds_t*, QObject* parent = 0 ); + virtual ~OWaveLanManagementDS(); + + int channel() const; + + private: + const struct ds_t* _data; +}; + +/*====================================================================================== + * OWaveLanManagementTim + *======================================================================================*/ + +class OWaveLanManagementTim : public QObject +{ + Q_OBJECT + + public: + OWaveLanManagementTim( const unsigned char*, const struct tim_t*, QObject* parent = 0 ); + virtual ~OWaveLanManagementTim(); + + private: + const struct tim_t* _data; +}; + +/*====================================================================================== + * OWaveLanManagementIBSS + *======================================================================================*/ + +class OWaveLanManagementIBSS : public QObject +{ + Q_OBJECT + + public: + OWaveLanManagementIBSS( const unsigned char*, const struct ibss_t*, QObject* parent = 0 ); + virtual ~OWaveLanManagementIBSS(); + + private: + const struct ibss_t* _data; +}; + +/*====================================================================================== + * OWaveLanManagementChallenge + *======================================================================================*/ + +class OWaveLanManagementChallenge : public QObject +{ + Q_OBJECT + + public: + OWaveLanManagementChallenge( const unsigned char*, const struct challenge_t*, QObject* parent = 0 ); + virtual ~OWaveLanManagementChallenge(); + + private: + const struct challenge_t* _data; +}; + +/*====================================================================================== * OWaveLanDataPacket - type: data (T_DATA) *======================================================================================*/ class OWaveLanDataPacket : public QObject { Q_OBJECT public: - OWaveLanDataPacket( const struct ieee_802_11_data_header*, OWaveLanPacket* parent = 0 ); + OWaveLanDataPacket( const unsigned char*, const struct ieee_802_11_data_header*, OWaveLanPacket* parent = 0 ); virtual ~OWaveLanDataPacket(); private: const struct ieee_802_11_data_header* _header; @@ -181,9 +322,9 @@ class OLLCPacket : public QObject { Q_OBJECT public: - OLLCPacket( const struct ieee_802_11_802_2_header* data, QObject* parent = 0 ); + OLLCPacket( const unsigned char*, const struct ieee_802_11_802_2_header* data, QObject* parent = 0 ); virtual ~OLLCPacket(); private: const struct ieee_802_11_802_2_header* _header; @@ -197,9 +338,9 @@ class OIPPacket : public QObject { Q_OBJECT public: - OIPPacket( const struct iphdr*, QObject* parent = 0 ); + OIPPacket( const unsigned char*, const struct iphdr*, QObject* parent = 0 ); virtual ~OIPPacket(); QHostAddress fromIPAddress() const; QHostAddress toIPAddress() const; @@ -224,9 +365,9 @@ class OUDPPacket : public QObject { Q_OBJECT public: - OUDPPacket( const struct udphdr*, QObject* parent = 0 ); + OUDPPacket( const unsigned char*, const struct udphdr*, QObject* parent = 0 ); virtual ~OUDPPacket(); int fromPort() const; int toPort() const; @@ -243,9 +384,9 @@ class OTCPPacket : public QObject { Q_OBJECT public: - OTCPPacket( const struct tcphdr*, QObject* parent = 0 ); + OTCPPacket( const unsigned char*, const struct tcphdr*, QObject* parent = 0 ); virtual ~OTCPPacket(); int fromPort() const; int toPort() const; @@ -283,11 +424,12 @@ class OPacketCapturer : public QObject protected slots: void readyToReceive(); protected: - QString _name; // devicename - bool _open; // check this before doing pcap calls - pcap_t* _pch; // pcap library handle + 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]; }; #endif // OPCAP_H |