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
|
|
|
|
2018-12-12 01:32:10 +00:00
|
|
|
#include <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
|
|
|
|
{
|
2018-09-02 18:25:42 +00:00
|
|
|
struct ILinkSession;
|
|
|
|
|
2018-06-01 14:08:54 +00:00
|
|
|
struct LinkIntroMessage : public ILinkMessage
|
|
|
|
{
|
2018-09-08 15:53:20 +00:00
|
|
|
static constexpr size_t MaxSize = MAX_RC_SIZE + 256;
|
|
|
|
|
2018-09-04 19:15:06 +00:00
|
|
|
LinkIntroMessage() : ILinkMessage()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-09-04 12:41:25 +00:00
|
|
|
LinkIntroMessage(ILinkSession* s) : ILinkMessage(s)
|
2018-06-01 14:08:54 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
~LinkIntroMessage();
|
|
|
|
|
2018-09-02 18:25:42 +00:00
|
|
|
RouterContact rc;
|
2018-09-04 12:41:25 +00:00
|
|
|
KeyExchangeNonce N;
|
2018-09-08 15:53:20 +00:00
|
|
|
Signature Z;
|
|
|
|
uint64_t P;
|
|
|
|
|
|
|
|
LinkIntroMessage&
|
|
|
|
operator=(const LinkIntroMessage& msg);
|
2018-09-04 12:41:25 +00:00
|
|
|
|
2018-06-01 14:08:54 +00:00
|
|
|
bool
|
|
|
|
DecodeKey(llarp_buffer_t key, llarp_buffer_t* buf);
|
|
|
|
|
|
|
|
bool
|
|
|
|
BEncode(llarp_buffer_t* buf) const;
|
|
|
|
|
|
|
|
bool
|
2018-12-10 16:26:46 +00:00
|
|
|
HandleMessage(llarp::Router* router) const;
|
2018-09-08 15:53:20 +00:00
|
|
|
|
|
|
|
bool
|
2018-12-11 00:53:11 +00:00
|
|
|
Sign(llarp::Crypto* c, const SecretKey& signKeySecret);
|
2018-09-08 15:53:20 +00:00
|
|
|
|
|
|
|
bool
|
2018-12-11 00:53:11 +00:00
|
|
|
Verify(llarp::Crypto* c) const;
|
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
|