2021-03-09 22:24:35 +00:00
|
|
|
#pragma once
|
2018-12-12 02:52:51 +00:00
|
|
|
|
2021-03-09 22:24:35 +00:00
|
|
|
#include <llarp/crypto/encrypted.hpp>
|
|
|
|
#include "message.hpp"
|
2021-03-16 11:56:27 +00:00
|
|
|
#include <llarp/service/protocol_type.hpp>
|
2018-12-12 02:04:32 +00:00
|
|
|
|
2018-11-12 16:43:40 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
namespace routing
|
|
|
|
{
|
2020-04-07 18:38:56 +00:00
|
|
|
constexpr size_t ExitPadSize = 512 - 48;
|
|
|
|
constexpr size_t MaxExitMTU = 1500;
|
2018-12-20 16:49:05 +00:00
|
|
|
constexpr size_t ExitOverhead = sizeof(uint64_t);
|
2018-11-12 16:43:40 +00:00
|
|
|
struct TransferTrafficMessage final : public IMessage
|
|
|
|
{
|
2020-04-07 18:38:56 +00:00
|
|
|
std::vector<llarp::Encrypted<MaxExitMTU + ExitOverhead>> X;
|
2021-03-16 11:56:27 +00:00
|
|
|
service::ProtocolType protocol;
|
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();
|
2020-04-07 18:38:56 +00:00
|
|
|
_size = 0;
|
2019-11-03 15:31:01 +00:00
|
|
|
version = 0;
|
2021-03-16 11:56:27 +00:00
|
|
|
protocol = service::ProtocolType::TrafficV4;
|
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
|
|
|
|
2018-11-28 16:38:20 +00:00
|
|
|
/// append buffer to X
|
2018-11-12 16:43:40 +00:00
|
|
|
bool
|
2019-02-01 01:58:06 +00:00
|
|
|
PutBuffer(const llarp_buffer_t& buf, uint64_t counter);
|
2018-11-12 16:43:40 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
BEncode(llarp_buffer_t* buf) const override;
|
|
|
|
|
|
|
|
bool
|
2019-02-01 01:58:06 +00:00
|
|
|
DecodeKey(const llarp_buffer_t& k, llarp_buffer_t* val) override;
|
2018-11-12 16:43:40 +00:00
|
|
|
|
|
|
|
bool
|
2019-02-11 19:45:42 +00:00
|
|
|
HandleMessage(IMessageHandler* h, AbstractRouter* r) const override;
|
2018-11-12 16:43:40 +00:00
|
|
|
};
|
|
|
|
} // namespace routing
|
|
|
|
} // namespace llarp
|