2021-03-09 22:24:35 +00:00
|
|
|
#pragma once
|
2019-04-19 16:02:32 +00:00
|
|
|
|
2021-03-09 22:24:35 +00:00
|
|
|
#include "protocol.hpp"
|
|
|
|
#include <llarp/util/buffer.hpp>
|
2019-04-19 16:02:32 +00:00
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
#include <iterator>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
namespace service
|
|
|
|
{
|
|
|
|
struct PendingBuffer
|
|
|
|
{
|
2020-04-07 18:38:56 +00:00
|
|
|
std::vector<byte_t> payload;
|
2019-04-19 16:02:32 +00:00
|
|
|
ProtocolType protocol;
|
|
|
|
|
2020-04-07 18:38:56 +00:00
|
|
|
PendingBuffer(const llarp_buffer_t& buf, ProtocolType t) : payload(buf.sz), protocol(t)
|
2019-04-19 16:02:32 +00:00
|
|
|
{
|
|
|
|
std::copy(buf.base, buf.base + buf.sz, std::back_inserter(payload));
|
|
|
|
}
|
|
|
|
|
|
|
|
ManagedBuffer
|
|
|
|
Buffer()
|
|
|
|
{
|
|
|
|
return ManagedBuffer{llarp_buffer_t(payload)};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
} // namespace service
|
|
|
|
|
|
|
|
} // namespace llarp
|