2018-07-11 13:20:14 +00:00
|
|
|
#ifndef LLARP_DHT_MESSAGES_PUB_INTRO_HPP
|
|
|
|
#define LLARP_DHT_MESSAGES_PUB_INTRO_HPP
|
2018-12-12 00:48:54 +00:00
|
|
|
#include <dht/message.hpp>
|
2019-04-22 18:35:19 +00:00
|
|
|
#include <service/intro_set.hpp>
|
2018-12-12 02:15:08 +00:00
|
|
|
|
2019-07-30 23:42:13 +00:00
|
|
|
#include <utility>
|
2018-07-20 04:50:28 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2018-07-11 13:20:14 +00:00
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
namespace dht
|
|
|
|
{
|
2018-11-05 11:27:12 +00:00
|
|
|
struct PublishIntroMessage final : public IMessage
|
2018-07-11 13:20:14 +00:00
|
|
|
{
|
2020-01-23 12:11:11 +00:00
|
|
|
static const uint64_t MaxPropagationDepth;
|
2020-01-27 21:30:41 +00:00
|
|
|
llarp::service::EncryptedIntroSet introset;
|
2020-04-07 18:38:56 +00:00
|
|
|
bool relayed = false;
|
2020-02-20 00:07:46 +00:00
|
|
|
uint64_t relayOrder = 0;
|
2020-04-07 18:38:56 +00:00
|
|
|
uint64_t txID = 0;
|
|
|
|
PublishIntroMessage(const Key_t& from, bool relayed_) : IMessage(from), relayed(relayed_)
|
2018-07-11 13:20:14 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-04-07 18:38:56 +00:00
|
|
|
PublishIntroMessage(
|
|
|
|
const llarp::service::EncryptedIntroSet& introset_,
|
|
|
|
uint64_t tx,
|
|
|
|
bool relayed_,
|
|
|
|
uint64_t relayOrder_)
|
|
|
|
: IMessage({}), introset(introset_), relayed(relayed_), relayOrder(relayOrder_), txID(tx)
|
2018-07-11 16:11:19 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-07-30 23:42:13 +00:00
|
|
|
~PublishIntroMessage() override;
|
2018-07-11 13:20:14 +00:00
|
|
|
|
|
|
|
bool
|
2018-11-05 11:27:12 +00:00
|
|
|
BEncode(llarp_buffer_t* buf) const override;
|
2018-07-11 13:20:14 +00:00
|
|
|
|
|
|
|
bool
|
2019-02-05 00:41:33 +00:00
|
|
|
DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* val) override;
|
2018-07-11 13:20:14 +00:00
|
|
|
|
2019-07-30 23:42:13 +00:00
|
|
|
bool
|
2018-11-05 11:27:12 +00:00
|
|
|
HandleMessage(
|
2020-04-07 18:38:56 +00:00
|
|
|
llarp_dht_context* ctx, std::vector<std::unique_ptr<IMessage>>& replies) const override;
|
2018-07-11 13:20:14 +00:00
|
|
|
};
|
2018-07-17 04:37:50 +00:00
|
|
|
} // namespace dht
|
|
|
|
} // namespace llarp
|
2018-09-02 18:25:42 +00:00
|
|
|
#endif
|