mirror of
https://github.com/mfontanini/libtins
synced 2026-01-26 12:01:34 +01:00
Add extract_metadata to main PDU classes
This commit is contained in:
@@ -46,6 +46,13 @@ using Tins::Memory::OutputMemoryStream;
|
||||
|
||||
namespace Tins {
|
||||
|
||||
PDU::metadata ICMP::extract_metadata(const uint8_t *buffer, uint32_t total_sz) {
|
||||
if (TINS_UNLIKELY(total_sz < sizeof(icmp_header))) {
|
||||
throw malformed_packet();
|
||||
}
|
||||
return metadata(sizeof(icmp_header), pdu_flag, PDU::UNKNOWN);
|
||||
}
|
||||
|
||||
ICMP::ICMP(Flags flag)
|
||||
: orig_timestamp_or_address_mask_(), recv_timestamp_(), trans_timestamp_() {
|
||||
memset(&header_, 0, sizeof(icmp_header));
|
||||
|
||||
Reference in New Issue
Block a user