2018-11-12 16:43:40 +00:00
|
|
|
#ifndef LLARP_MESSAGES_TRANSFER_TRAFFIC_HPP
|
|
|
|
#define LLARP_MESSAGES_TRANSFER_TRAFFIC_HPP
|
2018-12-12 02:52:51 +00:00
|
|
|
|
2019-01-13 22:39:10 +00:00
|
|
|
#include <crypto/encrypted.hpp>
|
2018-12-12 02:04:32 +00:00
|
|
|
#include <routing/message.hpp>
|
|
|
|
|
2018-11-12 16:43:40 +00:00
|
|
|
#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);
|
2018-11-12 16:43:40 +00:00
|
|
|
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;
|
|
|
|
|
2019-01-13 22:39:10 +00:00
|
|
|
void
|
|
|
|
Clear() override
|
2018-12-27 14:32:37 +00:00
|
|
|
{
|
|
|
|
X.clear();
|
2019-01-07 12:27:29 +00:00
|
|
|
_size = 0;
|
2018-12-27 14:32:37 +00:00
|
|
|
}
|
|
|
|
|
2018-12-02 18:07:07 +00:00
|
|
|
size_t
|
|
|
|
Size() const
|
2018-11-28 16:38:20 +00:00
|
|
|
{
|
|
|
|
return _size;
|
|
|
|
}
|
2018-11-12 16:43:40 +00:00
|
|
|
|
|
|
|
TransferTrafficMessage&
|
|
|
|
operator=(const TransferTrafficMessage& other);
|
|
|
|
|
2018-11-28 16:38:20 +00:00
|
|
|
/// append buffer to X
|
2018-11-12 16:43:40 +00:00
|
|
|
bool
|
2018-11-29 21:19:20 +00:00
|
|
|
PutBuffer(llarp_buffer_t buf, uint64_t counter);
|
2018-11-12 16:43:40 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
BEncode(llarp_buffer_t* buf) const override;
|
|
|
|
|
|
|
|
bool
|
|
|
|
DecodeKey(llarp_buffer_t k, llarp_buffer_t* val) override;
|
|
|
|
|
|
|
|
bool
|
2018-12-10 16:26:46 +00:00
|
|
|
HandleMessage(IMessageHandler* h, llarp::Router* r) const override;
|
2018-11-12 16:43:40 +00:00
|
|
|
};
|
|
|
|
} // namespace routing
|
|
|
|
} // namespace llarp
|
|
|
|
|
2018-12-10 16:26:46 +00:00
|
|
|
#endif
|