1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-28 12:44:25 +01:00

Add MPLS PDU and hook it up with ICMP extensions

This commit is contained in:
Matias Fontanini
2015-12-31 05:57:18 -08:00
parent 4ba9085eeb
commit 7bffa7801d
14 changed files with 434 additions and 1 deletions

View File

@@ -4,6 +4,7 @@
#include "exceptions.h"
#include "utils.h"
#include "memory_helpers.h"
#include "mpls.h"
using std::runtime_error;
@@ -135,6 +136,12 @@ void ICMPExtensionsStructure::add_extension(const ICMPExtension& extension) {
extensions_.push_back(extension);
}
void ICMPExtensionsStructure::add_extension(MPLS& mpls) {
ICMPExtension extension(1, 1);
extension.payload(mpls.serialize());
add_extension(extension);
}
void ICMPExtensionsStructure::serialize(uint8_t* buffer, uint32_t buffer_size) {
OutputMemoryStream stream(buffer, buffer_size);
uint8_t* original_ptr = buffer;