1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-27 04:11:35 +01:00

Add extract_metadata to main PDU classes

This commit is contained in:
Matias Fontanini
2016-02-20 22:19:12 -08:00
parent dae25b3381
commit 17da10d76e
32 changed files with 318 additions and 12 deletions

View File

@@ -47,6 +47,13 @@ using Tins::Memory::OutputMemoryStream;
namespace Tins {
PDU::metadata DHCP::extract_metadata(const uint8_t *buffer, uint32_t total_sz) {
if (TINS_UNLIKELY(total_sz < sizeof(bootp_header))) {
throw malformed_packet();
}
return metadata(total_sz, pdu_flag, PDU::UNKNOWN);
}
// Magic cookie: uint32_t.
DHCP::DHCP()
: size_(sizeof(uint32_t)) {