lokinet/llarp/messages/transfer_traffic.hpp

54 lines
1.1 KiB
C++
Raw Normal View History

#ifndef LLARP_MESSAGES_TRANSFER_TRAFFIC_HPP
#define LLARP_MESSAGES_TRANSFER_TRAFFIC_HPP
#include <crypto/encrypted.hpp>
2018-12-12 02:04:32 +00:00
#include <routing/message.hpp>
#include <vector>
namespace llarp
{
namespace routing
{
2018-12-20 16:49:05 +00:00
constexpr size_t ExitPadSize = 512 - 48;
constexpr size_t MaxExitMTU = 1500;
constexpr size_t ExitOverhead = sizeof(uint64_t);
struct TransferTrafficMessage final : public IMessage
{
2018-12-20 16:49:05 +00:00
std::vector< llarp::Encrypted< MaxExitMTU + ExitOverhead > > X;
2018-11-28 16:38:20 +00:00
size_t _size = 0;
void
Clear() override
{
X.clear();
_size = 0;
}
size_t
Size() const
2018-11-28 16:38:20 +00:00
{
return _size;
}
TransferTrafficMessage&
operator=(const TransferTrafficMessage& other);
2018-11-28 16:38:20 +00:00
/// append buffer to X
bool
PutBuffer(const llarp_buffer_t& buf, uint64_t counter);
bool
BEncode(llarp_buffer_t* buf) const override;
bool
DecodeKey(const llarp_buffer_t& k, llarp_buffer_t* val) override;
bool
HandleMessage(IMessageHandler* h, AbstractRouter* r) const override;
};
} // namespace routing
} // namespace llarp
#endif