lokinet/llarp/routing/path_transfer_message.hpp

44 lines
989 B
C++
Raw Normal View History

#pragma once
2018-06-26 16:23:43 +00:00
#include <llarp/crypto/encrypted.hpp>
#include <llarp/crypto/types.hpp>
#include "message.hpp"
#include <llarp/service/protocol.hpp>
2018-06-26 16:23:43 +00:00
namespace llarp::routing
2018-06-26 16:23:43 +00:00
{
struct PathTransferMessage final : public AbstractRoutingMessage
2018-06-26 16:23:43 +00:00
{
PathID_t path_id;
service::ProtocolFrameMessage protocol_frame_msg;
TunnelNonce nonce;
PathTransferMessage() = default;
PathTransferMessage(const service::ProtocolFrameMessage& f, const PathID_t& p)
: path_id(p), protocol_frame_msg(f)
{
nonce.Randomize();
}
~PathTransferMessage() override = default;
bool
decode_key(const llarp_buffer_t& key, llarp_buffer_t* val) override;
std::string
bt_encode() const override;
bool
handle_message(AbstractRoutingMessageHandler*, Router* r) const override;
void
clear() override
2018-06-26 16:23:43 +00:00
{
path_id.Zero();
protocol_frame_msg.clear();
nonce.Zero();
version = 0;
}
};
} // namespace llarp::routing