author | mickeyl <mickeyl> | 2003-10-06 17:38:19 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-06 17:38:19 (UTC) |
commit | 42aefe8bc6a8089b771d6f109fed22a770295cc8 (patch) (side-by-side diff) | |
tree | 3233ee1af3d857cd2fddca3b27623cee8d2aa45b | |
parent | e0acd0d9400bb489415d21ec715c5f6704c22b95 (diff) | |
download | opie-42aefe8bc6a8089b771d6f109fed22a770295cc8.zip opie-42aefe8bc6a8089b771d6f109fed22a770295cc8.tar.gz opie-42aefe8bc6a8089b771d6f109fed22a770295cc8.tar.bz2 |
add client mac address decoding to DHCP
-rw-r--r-- | libopie2/opienet/opcap.cpp | 7 | ||||
-rw-r--r-- | libopie2/opienet/opcap.h | 2 |
2 files changed, 9 insertions, 0 deletions
diff --git a/libopie2/opienet/opcap.cpp b/libopie2/opienet/opcap.cpp index 313f5bb..9ed2b83 100644 --- a/libopie2/opienet/opcap.cpp +++ b/libopie2/opienet/opcap.cpp @@ -501,48 +501,55 @@ QString ODHCPPacket::type() const QHostAddress ODHCPPacket::clientAddress() const { return EXTRACT_32BITS( &_dhcphdr->ciaddr ); } QHostAddress ODHCPPacket::yourAddress() const { return EXTRACT_32BITS( &_dhcphdr->yiaddr ); } QHostAddress ODHCPPacket::serverAddress() const { return EXTRACT_32BITS( &_dhcphdr->siaddr ); } QHostAddress ODHCPPacket::relayAddress() const { return EXTRACT_32BITS( &_dhcphdr->giaddr ); } + +OMacAddress ODHCPPacket::clientMacAddress() const +{ + return OMacAddress( _dhcphdr->chaddr ); +} + + /*====================================================================================== * OTCPPacket *======================================================================================*/ OTCPPacket::OTCPPacket( const unsigned char* end, const struct tcphdr* data, QObject* parent ) :QObject( parent, "TCP" ), _tcphdr( data ) { qDebug( "OTCPPacket::OTCPPacket(): decoding TCP header..." ); } OTCPPacket::~OTCPPacket() { } int OTCPPacket::fromPort() const { return EXTRACT_16BITS( &_tcphdr->source ); } diff --git a/libopie2/opienet/opcap.h b/libopie2/opienet/opcap.h index f0d1d81..51f067a 100644 --- a/libopie2/opienet/opcap.h +++ b/libopie2/opienet/opcap.h @@ -488,48 +488,50 @@ class OUDPPacket : public QObject int length() const; int checksum() const; private: const struct udphdr* _udphdr; }; /*====================================================================================== * ODHCPPacket *======================================================================================*/ class ODHCPPacket : public QObject { Q_OBJECT public: ODHCPPacket( const unsigned char*, const struct dhcp_packet*, QObject* parent = 0 ); virtual ~ODHCPPacket(); QHostAddress clientAddress() const; QHostAddress yourAddress() const; QHostAddress serverAddress() const; QHostAddress relayAddress() const; + OMacAddress clientMacAddress() const; + bool isRequest() const; bool isReply() const; QString type() const; private: const struct dhcp_packet* _dhcphdr; unsigned char _type; }; /*====================================================================================== * OTCPPacket *======================================================================================*/ class OTCPPacket : public QObject { Q_OBJECT public: OTCPPacket( const unsigned char*, const struct tcphdr*, QObject* parent = 0 ); virtual ~OTCPPacket(); int fromPort() const; int toPort() const; int seq() const; |