2018-06-08 13:12:17 +00:00
|
|
|
#ifndef LLARP_MESSAGES_RELAY_HPP
|
|
|
|
#define LLARP_MESSAGES_RELAY_HPP
|
|
|
|
|
2019-01-13 22:39:10 +00:00
|
|
|
#include <crypto/encrypted.hpp>
|
2019-01-13 16:30:07 +00:00
|
|
|
#include <crypto/types.hpp>
|
2019-01-14 21:46:07 +00:00
|
|
|
#include <messages/link_message.hpp>
|
2019-01-11 01:19:36 +00:00
|
|
|
#include <path/path_types.hpp>
|
2018-12-12 01:32:10 +00:00
|
|
|
|
2018-06-22 00:25:30 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2018-06-08 13:12:17 +00:00
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
struct RelayUpstreamMessage : public ILinkMessage
|
|
|
|
{
|
2018-12-20 16:49:05 +00:00
|
|
|
Encrypted< MAX_LINK_MSG_SIZE - 128 > X;
|
2018-06-22 00:25:30 +00:00
|
|
|
TunnelNonce Y;
|
|
|
|
|
2018-06-08 13:12:17 +00:00
|
|
|
bool
|
2019-02-05 00:41:33 +00:00
|
|
|
DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* buf) override;
|
2018-06-08 13:12:17 +00:00
|
|
|
|
|
|
|
bool
|
2018-12-20 16:49:05 +00:00
|
|
|
BEncode(llarp_buffer_t* buf) const override;
|
2018-06-08 13:12:17 +00:00
|
|
|
|
|
|
|
bool
|
2019-02-11 19:45:42 +00:00
|
|
|
HandleMessage(AbstractRouter* router) const override;
|
2018-12-20 16:49:05 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
Clear() override;
|
2019-03-26 20:04:41 +00:00
|
|
|
const char*
|
|
|
|
|
|
|
|
Name() const override
|
|
|
|
{
|
|
|
|
return "RelayUpstream";
|
|
|
|
}
|
2020-01-17 16:33:37 +00:00
|
|
|
uint16_t
|
|
|
|
Priority() const override
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2018-06-08 13:12:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct RelayDownstreamMessage : public ILinkMessage
|
|
|
|
{
|
2018-12-20 16:49:05 +00:00
|
|
|
Encrypted< MAX_LINK_MSG_SIZE - 128 > X;
|
2018-06-22 00:25:30 +00:00
|
|
|
TunnelNonce Y;
|
2018-06-08 13:12:17 +00:00
|
|
|
|
|
|
|
bool
|
2019-02-05 00:41:33 +00:00
|
|
|
DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* buf) override;
|
2018-06-08 13:12:17 +00:00
|
|
|
|
|
|
|
bool
|
2018-12-20 16:49:05 +00:00
|
|
|
BEncode(llarp_buffer_t* buf) const override;
|
2018-06-08 13:12:17 +00:00
|
|
|
|
|
|
|
bool
|
2019-02-11 19:45:42 +00:00
|
|
|
HandleMessage(AbstractRouter* router) const override;
|
2018-12-20 16:49:05 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
Clear() override;
|
2019-03-26 20:04:41 +00:00
|
|
|
|
|
|
|
const char*
|
|
|
|
Name() const override
|
|
|
|
{
|
|
|
|
return "RelayDownstream";
|
|
|
|
}
|
2020-01-17 16:33:37 +00:00
|
|
|
|
|
|
|
uint16_t
|
|
|
|
Priority() const override
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2018-06-08 13:12:17 +00:00
|
|
|
};
|
2018-06-22 00:25:30 +00:00
|
|
|
} // namespace llarp
|
2018-06-08 13:12:17 +00:00
|
|
|
|
|
|
|
#endif
|