2018-07-11 13:20:14 +00:00
|
|
|
#ifndef LLARP_DHT_MESSAGES_FIND_INTRO_HPP
|
|
|
|
#define LLARP_DHT_MESSAGES_FIND_INTRO_HPP
|
|
|
|
#include <llarp/dht/message.hpp>
|
|
|
|
#include <llarp/service/address.hpp>
|
2018-07-17 07:30:03 +00:00
|
|
|
#include <llarp/service/tag.hpp>
|
2018-07-11 13:20:14 +00:00
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
namespace dht
|
|
|
|
{
|
|
|
|
struct FindIntroMessage : public IMessage
|
|
|
|
{
|
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-08-10 21:34:11 +00:00
|
|
|
FindIntroMessage(const llarp::service::Tag& tag, uint64_t txid)
|
|
|
|
: IMessage({}), N(tag), T(txid)
|
2018-07-18 03:10:21 +00:00
|
|
|
{
|
2018-07-18 20:58:16 +00:00
|
|
|
S.Zero();
|
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,
|
|
|
|
uint64_t r)
|
|
|
|
: IMessage({}), R(r), S(addr), T(txid)
|
2018-07-18 03:10:21 +00:00
|
|
|
{
|
2018-07-18 20:58:16 +00:00
|
|
|
N.Zero();
|
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
|
|
|
|
BEncode(llarp_buffer_t* buf) const;
|
|
|
|
|
|
|
|
bool
|
|
|
|
DecodeKey(llarp_buffer_t key, llarp_buffer_t* val);
|
|
|
|
|
2018-07-16 21:22:25 +00:00
|
|
|
bool
|
|
|
|
HandleMessage(llarp_dht_context* ctx,
|
|
|
|
std::vector< IMessage* >& replies) const;
|
|
|
|
};
|
2018-07-12 18:21:44 +00:00
|
|
|
} // namespace dht
|
|
|
|
} // namespace llarp
|
2018-08-29 20:40:26 +00:00
|
|
|
#endif
|