lokinet/llarp/routing/path_transfer_message.hpp

49 lines
1014 B
C++
Raw Normal View History

2018-06-26 16:23:43 +00:00
#ifndef LLARP_MESSAGES_PATH_TRANSFER_HPP
#define LLARP_MESSAGES_PATH_TRANSFER_HPP
#include <crypto/encrypted.hpp>
#include <crypto/types.hpp>
2018-12-12 02:04:32 +00:00
#include <routing/message.hpp>
2018-12-12 02:15:08 +00:00
#include <service/protocol.hpp>
2018-06-26 16:23:43 +00:00
namespace llarp
{
namespace routing
{
struct PathTransferMessage final : public IMessage
2018-06-26 16:23:43 +00:00
{
PathID_t P;
2018-08-12 17:22:29 +00:00
service::ProtocolFrame T;
2018-06-26 16:23:43 +00:00
TunnelNonce Y;
2019-06-15 14:55:13 +00:00
PathTransferMessage() = default;
2018-08-12 17:22:29 +00:00
PathTransferMessage(const service::ProtocolFrame& f, const PathID_t& p)
: P(p), T(f)
{
Y.Randomize();
}
2019-07-30 23:42:13 +00:00
~PathTransferMessage() override = default;
bool
2019-02-05 00:41:33 +00:00
DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* val) override;
bool
BEncode(llarp_buffer_t* buf) const override;
bool
HandleMessage(IMessageHandler*, AbstractRouter* r) const override;
2018-12-29 15:45:33 +00:00
void
Clear() override
{
2018-12-29 15:45:33 +00:00
P.Zero();
T.Clear();
2018-12-29 15:45:33 +00:00
Y.Zero();
}
2018-06-26 16:23:43 +00:00
};
} // namespace routing
} // namespace llarp
#endif