mirror of
https://github.com/mfontanini/libtins
synced 2026-01-26 12:01:34 +01:00
Port all PDUs to use InputMemoryStream on constructors from buffer
This commit is contained in:
@@ -34,6 +34,9 @@
|
||||
#include <algorithm>
|
||||
#include "stp.h"
|
||||
#include "exceptions.h"
|
||||
#include "memory_helpers.h"
|
||||
|
||||
using Tins::Memory::InputMemoryStream;
|
||||
|
||||
namespace Tins {
|
||||
|
||||
@@ -45,9 +48,8 @@ STP::STP()
|
||||
|
||||
STP::STP(const uint8_t *buffer, uint32_t total_sz)
|
||||
{
|
||||
if(total_sz < sizeof(_header))
|
||||
throw malformed_packet();
|
||||
std::memcpy(&_header, buffer ,sizeof(_header));
|
||||
InputMemoryStream stream(buffer, total_sz);
|
||||
stream.read(_header);
|
||||
}
|
||||
|
||||
void STP::proto_id(uint16_t new_proto_id) {
|
||||
|
||||
Reference in New Issue
Block a user