lokinet/llarp/messages/relay.hpp

75 lines
1.3 KiB
C++
Raw Normal View History

#pragma once
2018-06-08 13:12:17 +00:00
#include <llarp/crypto/encrypted.hpp>
#include <llarp/crypto/types.hpp>
#include "link_message.hpp"
#include <llarp/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
{
2023-09-26 17:54:50 +00:00
/*
Data messages to be sent via quic datagrams
*/
struct RelayUpstreamMessage final : public AbstractDataMessage
2018-06-08 13:12:17 +00:00
{
2023-08-29 14:26:59 +00:00
Encrypted<MAX_LINK_MSG_SIZE - 128> enc;
TunnelNonce nonce;
2018-06-22 00:25:30 +00:00
2018-06-08 13:12:17 +00:00
bool
2023-08-29 14:26:59 +00:00
decode_key(const llarp_buffer_t& key, llarp_buffer_t* buf) override;
2018-06-08 13:12:17 +00:00
2023-08-29 14:26:59 +00:00
std::string
bt_encode() const override;
2018-06-08 13:12:17 +00:00
bool
handle_message(Router* router) const override;
2018-12-20 16:49:05 +00:00
void
2023-08-29 14:26:59 +00:00
clear() override;
2019-03-26 20:04:41 +00:00
2023-08-29 14:26:59 +00:00
const char*
name() const override
2019-03-26 20:04:41 +00:00
{
return "RelayUpstream";
}
2020-01-17 16:33:37 +00:00
uint16_t
2023-08-29 14:26:59 +00:00
priority() const override
2020-01-17 16:33:37 +00:00
{
return 0;
}
2018-06-08 13:12:17 +00:00
};
2023-09-26 17:54:50 +00:00
struct RelayDownstreamMessage final : public AbstractDataMessage
2018-06-08 13:12:17 +00:00
{
2023-08-29 14:26:59 +00:00
Encrypted<MAX_LINK_MSG_SIZE - 128> enc;
TunnelNonce nonce;
2018-06-08 13:12:17 +00:00
bool
2023-08-29 14:26:59 +00:00
decode_key(const llarp_buffer_t& key, llarp_buffer_t* buf) override;
2018-06-08 13:12:17 +00:00
2023-08-29 14:26:59 +00:00
std::string
bt_encode() const override;
2018-06-08 13:12:17 +00:00
bool
handle_message(Router* router) const override;
2018-12-20 16:49:05 +00:00
void
2023-08-29 14:26:59 +00:00
clear() override;
2019-03-26 20:04:41 +00:00
const char*
2023-08-29 14:26:59 +00:00
name() const override
2019-03-26 20:04:41 +00:00
{
return "RelayDownstream";
}
2020-01-17 16:33:37 +00:00
uint16_t
2023-08-29 14:26:59 +00:00
priority() const override
2020-01-17 16:33:37 +00:00
{
return 0;
}
2018-06-08 13:12:17 +00:00
};
2018-06-22 00:25:30 +00:00
} // namespace llarp