2019-04-21 18:38:30 +00:00
|
|
|
#ifndef LLARP_SERVICE_SESSION_HPP
|
|
|
|
#define LLARP_SERVICE_SESSION_HPP
|
|
|
|
|
|
|
|
#include <crypto/types.hpp>
|
|
|
|
#include <path/path.hpp>
|
2019-04-22 18:35:19 +00:00
|
|
|
#include <service/info.hpp>
|
|
|
|
#include <service/intro.hpp>
|
2019-04-21 18:38:30 +00:00
|
|
|
#include <util/status.hpp>
|
|
|
|
#include <util/types.hpp>
|
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
namespace service
|
|
|
|
{
|
2020-02-24 19:40:45 +00:00
|
|
|
static constexpr auto SessionLifetime = path::default_lifetime * 2;
|
|
|
|
|
2019-04-21 18:38:30 +00:00
|
|
|
struct Session
|
|
|
|
{
|
2019-06-28 14:12:20 +00:00
|
|
|
/// the intro we have
|
2019-04-21 18:38:30 +00:00
|
|
|
Introduction replyIntro;
|
|
|
|
SharedSecret sharedKey;
|
|
|
|
ServiceInfo remote;
|
2019-06-28 14:12:20 +00:00
|
|
|
/// the intro they have
|
2019-04-21 18:38:30 +00:00
|
|
|
Introduction intro;
|
2019-06-28 14:12:20 +00:00
|
|
|
/// the intro remoet last sent on
|
|
|
|
Introduction lastInboundIntro;
|
2020-02-24 19:40:45 +00:00
|
|
|
llarp_time_t lastUsed = 0s;
|
2020-04-07 18:38:56 +00:00
|
|
|
uint64_t seqno = 0;
|
|
|
|
bool inbound = false;
|
2019-04-21 18:38:30 +00:00
|
|
|
|
|
|
|
util::StatusObject
|
|
|
|
ExtractStatus() const;
|
|
|
|
bool
|
2020-04-07 18:38:56 +00:00
|
|
|
IsExpired(llarp_time_t now, llarp_time_t lifetime = SessionLifetime) const;
|
2019-04-21 18:38:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace service
|
|
|
|
|
|
|
|
} // namespace llarp
|
|
|
|
|
|
|
|
#endif
|