llarp::iwp::Session

Inherits from llarp::ILinkSession, std::enable_shared_from_this< Session >

Public Types

Name
using std::chrono::milliseconds Time_t

Public Functions

Name
Session(LinkLayer * parent, const RouterContact & rc, const AddressInfo & ai)
outbound session
Session(LinkLayer * parent, const SockAddr & from)
inbound session
void TriggerPump()
virtual void Pump() override
called during pumping
virtual void Tick(llarp_time_t ) override
called every timer tick
virtual bool SendMessageBuffer(ILinkSession::Message_t , CompletionHandler handler, uint16_t priority =0) override
send a message buffer to the remote endpoint
void Send_LL(const byte_t * buf, size_t sz)
void EncryptAndSend(ILinkSession::Packet_t )
virtual void Start() override
start the connection
virtual void Close() override
virtual bool Recv_LL(ILinkSession::Packet_t ) override
recv packet on low layer not used by utp
virtual bool SendKeepAlive() override
send a keepalive to the remote endpoint
virtual bool IsEstablished() const override
return true if we are established
virtual bool TimedOut(llarp_time_t now) const override
return true if this session has timed out
virtual PubKey GetPubKey() const override
get remote public identity key
virtual const SockAddr & GetRemoteEndpoint() const override
get remote address
virtual RouterContact GetRemoteRC() const override
virtual size_t SendQueueBacklog() const override
send queue current blacklog
virtual ILinkLayer * GetLinkLayer() const override
get parent link layer
virtual bool RenegotiateSession() override
renegotiate session when we have a new RC locally
virtual bool ShouldPing() const override
return true if we should send an explicit keepalive message
virtual SessionStats GetSessionStats() const override
return the current stats for this session
virtual bool IsInbound() const override
is an inbound session or not
virtual void HandlePlaintext() override
void VerifiedMessage(uint64_t msgid)
void DropMessage(uint64_t msgid)
void TriggerHashGen()
void SendMACK()
void RecvHashed(std::vector< OutboundMessage > msgs)

Public Attributes

Name
constexpr std::size_t MaxACKSInMACK
maximum number of messages we can ack in a multiack

Additional inherited members

Public Types inherited from llarp::ILinkSession

Name
enum class DeliveryStatus { eDeliverySuccess, eDeliveryDropped}
delivery status of a message
using std::function< void(DeliveryStatus)> CompletionHandler
message delivery result hook function
using std::vector< byte_t > Packet_t
using std::vector< byte_t > Message_t

Public Functions inherited from llarp::ILinkSession

Name
virtual ~ILinkSession() =default
virtual void OnLinkEstablished(ILinkLayer * )
hook for utp for when we have established a connection
bool IsRelay() const
is this session a session to a relay?

Public Attributes inherited from llarp::ILinkSession

Name
std::function< bool(const LinkIntroMessage *msg)> GotLIM
handle a valid LIM

Public Types Documentation

using Time_t

using llarp::iwp::Session::Time_t =  std::chrono::milliseconds;

Public Functions Documentation

function Session

Session(
    LinkLayer * parent,
    const RouterContact & rc,
    const AddressInfo & ai
)

outbound session

function Session

Session(
    LinkLayer * parent,
    const SockAddr & from
)

inbound session

function TriggerPump

void TriggerPump()

function Pump

virtual void Pump() override

called during pumping

Reimplements: llarp::ILinkSession::Pump

function Tick

virtual void Tick(
    llarp_time_t 
) override

called every timer tick

Reimplements: llarp::ILinkSession::Tick

function SendMessageBuffer

virtual bool SendMessageBuffer(
    ILinkSession::Message_t ,
    CompletionHandler handler,
    uint16_t priority =0
) override

send a message buffer to the remote endpoint

Reimplements: llarp::ILinkSession::SendMessageBuffer

function Send_LL

void Send_LL(
    const byte_t * buf,
    size_t sz
)

function EncryptAndSend

void EncryptAndSend(
    ILinkSession::Packet_t 
)

function Start

virtual void Start() override

start the connection

Reimplements: llarp::ILinkSession::Start

function Close

virtual void Close() override

Reimplements: llarp::ILinkSession::Close

function Recv_LL

virtual bool Recv_LL(
    ILinkSession::Packet_t 
) override

recv packet on low layer not used by utp

Reimplements: llarp::ILinkSession::Recv_LL

function SendKeepAlive

virtual bool SendKeepAlive() override

send a keepalive to the remote endpoint

Reimplements: llarp::ILinkSession::SendKeepAlive

function IsEstablished

virtual bool IsEstablished() const override

return true if we are established

Reimplements: llarp::ILinkSession::IsEstablished

function TimedOut

virtual bool TimedOut(
    llarp_time_t now
) const override

return true if this session has timed out

Reimplements: llarp::ILinkSession::TimedOut

function GetPubKey

inline virtual PubKey GetPubKey() const override

get remote public identity key

Reimplements: llarp::ILinkSession::GetPubKey

function GetRemoteEndpoint

inline virtual const SockAddr & GetRemoteEndpoint() const override

get remote address

Reimplements: llarp::ILinkSession::GetRemoteEndpoint

function GetRemoteRC

inline virtual RouterContact GetRemoteRC() const override

Reimplements: llarp::ILinkSession::GetRemoteRC

function SendQueueBacklog

inline virtual size_t SendQueueBacklog() const override

send queue current blacklog

Reimplements: llarp::ILinkSession::SendQueueBacklog

function GetLinkLayer

inline virtual ILinkLayer * GetLinkLayer() const override

get parent link layer

Reimplements: llarp::ILinkSession::GetLinkLayer

function RenegotiateSession

virtual bool RenegotiateSession() override

renegotiate session when we have a new RC locally

Reimplements: llarp::ILinkSession::RenegotiateSession

function ShouldPing

virtual bool ShouldPing() const override

return true if we should send an explicit keepalive message

Reimplements: llarp::ILinkSession::ShouldPing

function GetSessionStats

virtual SessionStats GetSessionStats() const override

return the current stats for this session

Reimplements: llarp::ILinkSession::GetSessionStats

function IsInbound

inline virtual bool IsInbound() const override

is an inbound session or not

Reimplements: llarp::ILinkSession::IsInbound

function HandlePlaintext

virtual void HandlePlaintext() override

Reimplements: llarp::ILinkSession::HandlePlaintext

function VerifiedMessage

void VerifiedMessage(
    uint64_t msgid
)

function DropMessage

void DropMessage(
    uint64_t msgid
)

function TriggerHashGen

void TriggerHashGen()

function SendMACK

void SendMACK()

function RecvHashed

void RecvHashed(
    std::vector< OutboundMessage > msgs
)

Public Attributes Documentation

variable MaxACKSInMACK

static constexpr std::size_t MaxACKSInMACK = 1024 / sizeof(uint64_t);

maximum number of messages we can ack in a multiack


Updated on 2026-01-10 at 22:49:45 +0000