mirror of https://github.com/oxen-io/lokinet
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
421 B
C++
19 lines
421 B
C++
#include <llarp/endian.h>
|
|
#include <llarp/ip.hpp>
|
|
|
|
namespace llarp
|
|
{
|
|
namespace net
|
|
{
|
|
std::unique_ptr< IPv4Packet >
|
|
ParseIPv4Packet(const void* buf, size_t sz)
|
|
{
|
|
if(sz < 16 || sz > IPv4Packet::MaxSize)
|
|
return nullptr;
|
|
IPv4Packet* pkt = new IPv4Packet();
|
|
memcpy(pkt->buf, buf, sz);
|
|
return std::unique_ptr< IPv4Packet >(pkt);
|
|
}
|
|
} // namespace net
|
|
} // namespace llarp
|