mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-15 12:13:24 +00:00
f574cd798f
- includes are now sorted in consistent, logical order; first step in an attempt to fix the tomfoolery (no relation to Tom) brought in by include-what-you-use - shuffled around some cmake linking to simplify dependency graph - superfluous files removed
57 lines
1.2 KiB
C++
57 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include "info.hpp"
|
|
#include "intro.hpp"
|
|
|
|
#include <llarp/crypto/types.hpp>
|
|
#include <llarp/path/path.hpp>
|
|
#include <llarp/util/status.hpp>
|
|
#include <llarp/util/types.hpp>
|
|
|
|
namespace llarp::service
|
|
{
|
|
static constexpr auto SessionLifetime = path::DEFAULT_LIFETIME * 2;
|
|
|
|
struct Session
|
|
{
|
|
/// the intro we have
|
|
Introduction replyIntro;
|
|
SharedSecret sharedKey;
|
|
ServiceInfo remote;
|
|
/// the intro they have
|
|
Introduction intro;
|
|
|
|
/// the sequence number we are to use for the next message
|
|
uint64_t seqno = 0;
|
|
|
|
/// number of remote messages we sent to them
|
|
uint64_t messagesSend = 0;
|
|
/// number of remote messages we got from them
|
|
uint64_t messagesRecv = 0;
|
|
|
|
bool inbound = false;
|
|
bool forever = false;
|
|
|
|
Duration_t lastSend{};
|
|
Duration_t lastRecv{};
|
|
|
|
util::StatusObject
|
|
ExtractStatus() const;
|
|
|
|
/// called to indicate we recieved on this session
|
|
void
|
|
RX();
|
|
|
|
/// called to indicate we transimitted on this session
|
|
void
|
|
TX();
|
|
|
|
bool
|
|
IsExpired(llarp_time_t now, llarp_time_t lifetime = SessionLifetime) const;
|
|
|
|
Address
|
|
Addr() const;
|
|
};
|
|
|
|
} // namespace llarp::service
|