mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-07 15:20:31 +00:00
511c20cdb6
- `::handle_message` is transposed; Rather than the message calling the method and taking a reference to the router, the router should have a handle_message method and take a reference to the message - `::EndcodeBuffer` takes a string reference, to which the result of `::bt_encode()` is assigned
47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
#pragma once
|
|
#include <llarp/dht/message.hpp>
|
|
#include <llarp/service/intro_set.hpp>
|
|
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
namespace llarp::dht
|
|
{
|
|
struct PublishIntroMessage final : public AbstractDHTMessage
|
|
{
|
|
static const uint64_t MaxPropagationDepth;
|
|
llarp::service::EncryptedIntroSet introset;
|
|
bool relayed = false;
|
|
uint64_t relayOrder = 0;
|
|
uint64_t txID = 0;
|
|
PublishIntroMessage(const Key_t& from, bool relayed_)
|
|
: AbstractDHTMessage(from), relayed(relayed_)
|
|
{}
|
|
|
|
PublishIntroMessage(
|
|
const llarp::service::EncryptedIntroSet& introset_,
|
|
uint64_t tx,
|
|
bool relayed_,
|
|
uint64_t relayOrder_)
|
|
: AbstractDHTMessage({})
|
|
, introset(introset_)
|
|
, relayed(relayed_)
|
|
, relayOrder(relayOrder_)
|
|
, txID(tx)
|
|
{}
|
|
|
|
~PublishIntroMessage() override;
|
|
|
|
void
|
|
bt_encode(oxenc::bt_dict_producer& btdp) const override;
|
|
|
|
bool
|
|
decode_key(const llarp_buffer_t& key, llarp_buffer_t* val) override;
|
|
|
|
bool
|
|
handle_message(
|
|
AbstractDHTMessageHandler& dht,
|
|
std::vector<std::unique_ptr<AbstractDHTMessage>>& replies) const override;
|
|
};
|
|
} // namespace llarp::dht
|