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

Add ICMP extensions to ICMP PDU

The length field is still not being set
This commit is contained in:
Matias Fontanini
2015-12-17 20:42:57 -08:00
parent e3c382efa0
commit 0a16d8f462
5 changed files with 88 additions and 7 deletions

View File

@@ -353,10 +353,21 @@ namespace Tins {
* \brief Returns the header size.
*
* This metod overrides PDU::header_size. This size includes the
* payload and options size. \sa PDU::header_size
* payload and options size.
*
* \sa PDU::header_size
*/
uint32_t header_size() const;
/**
* \brief Returns the trailer size.
*
* This metod overrides PDU::trailer_size. This size will hold the extensions size
*
* \sa PDU::header_size
*/
uint32_t trailer_size() const;
/**
* \brief Check wether ptr points to a valid response for this PDU.
*
@@ -366,7 +377,24 @@ namespace Tins {
*/
bool matches_response(const uint8_t *ptr, uint32_t total_sz) const;
const ICMPExtensionsStructure& extensions() { return extensions_; }
/**
* \brief Getter for the extensions field.
*
* \return The extensions field
*/
const ICMPExtensionsStructure& extensions() const { return extensions_; }
/**
* \brief Getter for the extensions field.
*
* \return The extensions field
*/
ICMPExtensionsStructure& extensions() { return extensions_; }
/**
* \brief Indicates whether this object contains ICMP extensions
*/
bool has_extensions() const { return !extensions_.extensions().empty(); }
/**
* \brief Getter for the PDU's type.

View File

@@ -189,6 +189,13 @@ public:
*/
const extensions_type& extensions() const { return extensions_; }
/**
* \brief Adds an extension to this structure
*
* \param extension The extension to be added;
*/
void add_extension(const ICMPExtension& extension);
/**
* \brief Gets the size of this ICMP extensions structure
*