lokinet/llarp/messages/link_intro.hpp

51 lines
942 B
C++
Raw Normal View History

2018-06-01 14:08:54 +00:00
#ifndef LLARP_MESSAGES_LINK_INTRO_HPP
#define LLARP_MESSAGES_LINK_INTRO_HPP
2018-12-12 01:55:30 +00:00
#include <crypto/types.hpp>
#include <messages/link_message.hpp>
2018-12-12 01:55:30 +00:00
#include <router_contact.hpp>
2018-06-01 14:08:54 +00:00
namespace llarp
{
struct ILinkSession;
2018-06-01 14:08:54 +00:00
struct LinkIntroMessage : public ILinkMessage
{
static constexpr size_t MaxSize = MAX_RC_SIZE + 256;
2018-09-04 19:15:06 +00:00
LinkIntroMessage() : ILinkMessage()
{
}
2018-06-01 14:08:54 +00:00
~LinkIntroMessage();
RouterContact rc;
KeyExchangeNonce N;
Signature Z;
uint64_t P;
LinkIntroMessage&
operator=(const LinkIntroMessage& msg);
2018-06-01 14:08:54 +00:00
bool
2018-12-23 13:29:11 +00:00
DecodeKey(llarp_buffer_t key, llarp_buffer_t* buf) override;
2018-06-01 14:08:54 +00:00
bool
2018-12-23 13:29:11 +00:00
BEncode(llarp_buffer_t* buf) const override;
2018-06-01 14:08:54 +00:00
bool
2018-12-23 13:29:11 +00:00
HandleMessage(llarp::Router* router) const override;
bool
Sign(std::function< bool(Signature&, llarp_buffer_t) > signer);
bool
Verify(llarp::Crypto* c) const;
2018-12-20 16:49:05 +00:00
void
Clear() override;
2018-06-01 14:08:54 +00:00
};
2018-07-09 03:34:29 +00:00
} // namespace llarp
2018-06-01 14:08:54 +00:00
#endif