lokinet/include/llarp/dht/messages/findintro.hpp

52 lines
1.2 KiB
C++
Raw Normal View History

#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>
namespace llarp
{
namespace dht
{
struct FindIntroMessage : public IMessage
{
2018-08-10 03:51:38 +00:00
uint64_t R = 0;
llarp::service::Address S;
2018-07-17 07:30:03 +00:00
llarp::service::Tag N;
uint64_t T = 0;
bool relayed = false;
FindIntroMessage(const Key_t& from, bool relay) : IMessage(from)
{
relayed = relay;
}
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
{
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
{
N.Zero();
2018-07-18 03:10:21 +00:00
}
~FindIntroMessage();
bool
BEncode(llarp_buffer_t* buf) const;
bool
DecodeKey(llarp_buffer_t key, llarp_buffer_t* val);
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