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.
37 lines
709 B
C++
37 lines
709 B
C++
6 years ago
|
#ifndef LLARP_SERVICE_PENDINGBUFFER_HPP
|
||
|
#define LLARP_SERVICE_PENDINGBUFFER_HPP
|
||
|
|
||
|
#include <service/protocol.hpp>
|
||
|
#include <util/buffer.hpp>
|
||
|
|
||
|
#include <algorithm>
|
||
|
#include <iterator>
|
||
|
#include <vector>
|
||
|
|
||
|
namespace llarp
|
||
|
{
|
||
|
namespace service
|
||
|
{
|
||
|
struct PendingBuffer
|
||
|
{
|
||
|
std::vector< byte_t > payload;
|
||
|
ProtocolType protocol;
|
||
|
|
||
|
PendingBuffer(const llarp_buffer_t& buf, ProtocolType t)
|
||
|
: payload(buf.sz), protocol(t)
|
||
|
{
|
||
|
std::copy(buf.base, buf.base + buf.sz, std::back_inserter(payload));
|
||
|
}
|
||
|
|
||
|
ManagedBuffer
|
||
|
Buffer()
|
||
|
{
|
||
|
return ManagedBuffer{llarp_buffer_t(payload)};
|
||
|
}
|
||
|
};
|
||
|
} // namespace service
|
||
|
|
||
|
} // namespace llarp
|
||
|
|
||
|
#endif
|