1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Added PDU::matches_pdu override on RC4EAPOL and RSNEAPOL.

This commit is contained in:
Matias Fontanini
2011-09-08 15:44:05 -03:00
parent af50d41be1
commit db0e838e6f
3 changed files with 35 additions and 3 deletions

View File

@@ -293,6 +293,21 @@ namespace Tins {
*/
uint32_t header_size() const;
/**
* \brief Getter for the PDU's type.
* \return Returns the PDUType corresponding to the PDU.
*/
PDUType pdu_type() const { return PDU::RC4EAPOL; }
/**
* \brief Check wether this PDU matches the specified flag.
* \param flag The flag to match
* \sa PDU::matches_flag
*/
bool matches_flag(PDUType flag) {
return flag == PDU::RC4EAPOL || EAPOL::matches_flag(flag);
}
/**
* \brief Clones this PDU.
*
@@ -491,6 +506,21 @@ namespace Tins {
*/
void rsn_information(const RSNInformation &rsn);
/**
* \brief Getter for the PDU's type.
* \return Returns the PDUType corresponding to the PDU.
*/
PDUType pdu_type() const { return PDU::RSNEAPOL; }
/**
* \brief Check wether this PDU matches the specified flag.
* \param flag The flag to match
* \sa PDU::matches_flag
*/
bool matches_flag(PDUType flag) {
return flag == PDU::RSNEAPOL || EAPOL::matches_flag(flag);
}
/**
* \brief Clones this PDU.
*

View File

@@ -81,7 +81,9 @@ namespace Tins {
ICMP,
BOOTP,
DHCP,
EAPOL
EAPOL,
RC4EAPOL,
RSNEAPOL
};
/** \brief PDU constructor

View File

@@ -49,11 +49,11 @@ Tins::EAPOL *Tins::EAPOL::from_bytes(const uint8_t *buffer, uint32_t total_sz) {
const eapolhdr *ptr = (const eapolhdr*)buffer;
switch(ptr->type) {
case RC4:
return new RC4EAPOL(buffer, total_sz);
return new Tins::RC4EAPOL(buffer, total_sz);
break;
case RSN:
case EAPOL_WPA:
return new RSNEAPOL(buffer, total_sz);
return new Tins::RSNEAPOL(buffer, total_sz);
break;
}
return 0;