2018-07-11 13:20:14 +00:00
|
|
|
#ifndef LLARP_DHT_MESSAGES_FIND_INTRO_HPP
|
|
|
|
#define LLARP_DHT_MESSAGES_FIND_INTRO_HPP
|
2018-12-12 02:04:32 +00:00
|
|
|
|
2018-12-12 00:48:54 +00:00
|
|
|
#include <dht/message.hpp>
|
2018-12-12 02:04:32 +00:00
|
|
|
#include <routing/message.hpp>
|
2018-12-12 02:15:08 +00:00
|
|
|
#include <service/address.hpp>
|
|
|
|
#include <service/tag.hpp>
|
2018-07-11 13:20:14 +00:00
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
namespace dht
|
|
|
|
{
|
2018-11-05 11:27:12 +00:00
|
|
|
struct FindIntroMessage final : public IMessage
|
2018-07-11 13:20:14 +00:00
|
|
|
{
|
2018-08-10 03:51:38 +00:00
|
|
|
uint64_t R = 0;
|
2018-07-11 13:20:14 +00:00
|
|
|
llarp::service::Address S;
|
2018-07-17 07:30:03 +00:00
|
|
|
llarp::service::Tag N;
|
2018-07-18 20:58:16 +00:00
|
|
|
uint64_t T = 0;
|
|
|
|
bool relayed = false;
|
2018-07-11 13:20:14 +00:00
|
|
|
|
2018-07-18 20:58:16 +00:00
|
|
|
FindIntroMessage(const Key_t& from, bool relay) : IMessage(from)
|
2018-07-16 21:22:25 +00:00
|
|
|
{
|
2018-07-18 20:58:16 +00:00
|
|
|
relayed = relay;
|
2018-07-16 21:22:25 +00:00
|
|
|
}
|
|
|
|
|
2018-10-21 14:19:49 +00:00
|
|
|
FindIntroMessage(const llarp::service::Tag& tag, uint64_t txid,
|
2018-11-08 15:15:02 +00:00
|
|
|
bool iterate = true)
|
|
|
|
: IMessage({}), N(tag), T(txid)
|
2018-07-18 03:10:21 +00:00
|
|
|
{
|
2018-07-18 20:58:16 +00:00
|
|
|
S.Zero();
|
2018-11-08 15:15:02 +00:00
|
|
|
if(iterate)
|
|
|
|
R = 0;
|
|
|
|
else
|
|
|
|
R = 1;
|
2018-07-18 03:10:21 +00:00
|
|
|
}
|
|
|
|
|
2018-08-29 20:40:26 +00:00
|
|
|
FindIntroMessage(uint64_t txid, const llarp::service::Address& addr,
|
2018-11-08 15:15:02 +00:00
|
|
|
bool iterate = true)
|
|
|
|
: IMessage({}), S(addr), T(txid)
|
2018-07-18 03:10:21 +00:00
|
|
|
{
|
2018-07-18 20:58:16 +00:00
|
|
|
N.Zero();
|
2018-11-08 15:15:02 +00:00
|
|
|
if(iterate)
|
|
|
|
R = 0;
|
|
|
|
else
|
|
|
|
R = 1;
|
2018-07-18 03:10:21 +00:00
|
|
|
}
|
|
|
|
|
2018-07-18 20:58:16 +00:00
|
|
|
~FindIntroMessage();
|
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
|
2018-11-05 11:27:12 +00:00
|
|
|
DecodeKey(llarp_buffer_t key, llarp_buffer_t* val) override;
|
2018-07-11 13:20:14 +00:00
|
|
|
|
2018-07-16 21:22:25 +00:00
|
|
|
bool
|
2018-11-05 11:27:12 +00:00
|
|
|
HandleMessage(
|
|
|
|
llarp_dht_context* ctx,
|
|
|
|
std::vector< std::unique_ptr< IMessage > >& replies) const override;
|
2018-07-16 21:22:25 +00:00
|
|
|
};
|
2018-07-12 18:21:44 +00:00
|
|
|
} // namespace dht
|
|
|
|
} // namespace llarp
|
2018-08-29 20:40:26 +00:00
|
|
|
#endif
|