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
|
|
|
|
{
|
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;
|
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;
|
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
|
|
|
|
|
2018-12-10 16:26:46 +00:00
|
|
|
#endif
|