lokinet/llarp/service/session.hpp

39 lines
867 B
C++
Raw Normal View History

#pragma once
#include <llarp/crypto/types.hpp>
#include <llarp/path/path.hpp>
#include "info.hpp"
#include "intro.hpp"
#include <llarp/util/status.hpp>
#include <llarp/util/types.hpp>
namespace llarp
{
namespace service
{
2020-02-24 19:40:45 +00:00
static constexpr auto SessionLifetime = path::default_lifetime * 2;
struct Session
{
2019-06-28 14:12:20 +00:00
/// the intro we have
Introduction replyIntro;
SharedSecret sharedKey;
ServiceInfo remote;
2019-06-28 14:12:20 +00:00
/// the intro they have
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;
uint64_t seqno = 0;
bool inbound = false;
util::StatusObject
ExtractStatus() const;
bool
IsExpired(llarp_time_t now, llarp_time_t lifetime = SessionLifetime) const;
};
} // namespace service
} // namespace llarp