diff --git a/include/eapol.h b/include/eapol.h index e7a32da..8e906d5 100644 --- a/include/eapol.h +++ b/include/eapol.h @@ -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. * diff --git a/include/pdu.h b/include/pdu.h index b0cb98e..438bdb9 100644 --- a/include/pdu.h +++ b/include/pdu.h @@ -81,7 +81,9 @@ namespace Tins { ICMP, BOOTP, DHCP, - EAPOL + EAPOL, + RC4EAPOL, + RSNEAPOL }; /** \brief PDU constructor diff --git a/src/eapol.cpp b/src/eapol.cpp index 5fbc801..4516851 100644 --- a/src/eapol.cpp +++ b/src/eapol.cpp @@ -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;