You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lokinet/llarp/service/session.hpp

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>
1 year ago
namespace llarp::service
{
1 year ago
static constexpr auto SessionLifetime = path::DEFAULT_LIFETIME * 2;
1 year ago
struct Session
{
/// the intro we have
Introduction replyIntro;
SharedSecret sharedKey;
ServiceInfo remote;
/// the intro they have
Introduction intro;
1 year ago
/// the sequence number we are to use for the next message
uint64_t seqno = 0;
1 year ago
/// number of remote messages we sent to them
uint64_t messagesSend = 0;
/// number of remote messages we got from them
uint64_t messagesRecv = 0;
1 year ago
bool inbound = false;
bool forever = false;
1 year ago
Duration_t lastSend{};
Duration_t lastRecv{};
1 year ago
util::StatusObject
ExtractStatus() const;
1 year ago
/// called to indicate we recieved on this session
void
RX();
1 year ago
/// called to indicate we transimitted on this session
void
TX();
1 year ago
bool
IsExpired(llarp_time_t now, llarp_time_t lifetime = SessionLifetime) const;
1 year ago
Address
Addr() const;
};
1 year ago
} // namespace llarp::service