1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-29 13:04:28 +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

@@ -76,8 +76,8 @@ ICMPExtension::serialization_type ICMPExtension::serialize() const {
const uint32_t ICMPExtensionsStructure::BASE_HEADER_SIZE = sizeof(uint16_t) * 2;
ICMPExtensionsStructure::ICMPExtensionsStructure()
: version_and_reserved_(0x2000), checksum_(0) {
: version_and_reserved_(), checksum_(0) {
version(2);
}
ICMPExtensionsStructure::ICMPExtensionsStructure(const uint8_t* buffer, uint32_t total_sz) {
@@ -135,6 +135,10 @@ uint32_t ICMPExtensionsStructure::size() const {
return output;
}
void ICMPExtensionsStructure::add_extension(const ICMPExtension& extension) {
extensions_.push_back(extension);
}
void ICMPExtensionsStructure::serialize(uint8_t* buffer, uint32_t buffer_size) {
const uint32_t structure_size = size();
if (buffer_size < structure_size) {