llarp::ILinkLayer
Inherited by llarp::dtls::LinkLayer, llarp::iwp::LinkLayer
Protected Types
| Name | |
|---|---|
| using util::NullLock | Lock_t |
| using util::NullMutex | Mutex_t |
| using std::unordered_multimap< RouterID, std::shared_ptr< ILinkSession > > | AuthedLinks |
| using std::unordered_map< SockAddr, std::shared_ptr< ILinkSession > > | Pending |
Public Functions
| Name | |
|---|---|
| ILinkLayer(std::shared_ptr< KeyManager > keyManager, EventLoop_ptr evloop, GetRCFunc getrc, LinkMessageHandler handler, SignBufferFunc signFunc, BeforeConnectFunc_t before, SessionEstablishedHandler sessionEstablish, SessionRenegotiateHandler renegotiate, TimeoutHandler timeout, SessionClosedHandler closed, PumpDoneHandler pumpDone, WorkerFunc_t doWork) | |
| virtual | ~ILinkLayer() =default |
| llarp_time_t | Now() const get current time via event loop |
| bool | HasSessionTo(const RouterID & pk) |
| void | ForEachSession(std::function< void(const ILinkSession *)> visit, bool randomize =false) const |
| void | ForEachSession(std::function< void(ILinkSession *)> visit) |
| void | UnmapAddr(const SockAddr & addr) |
| void | SendTo_LL(const SockAddr & to, const llarp_buffer_t & pkt) |
| void | Bind(AbstractRouter * router, SockAddr addr) |
| virtual std::shared_ptr< ILinkSession > | NewOutboundSession(const RouterContact & rc, const AddressInfo & ai) =0 |
| std::shared_ptr< ILinkSession > | FindSessionByPubkey(RouterID pk) fetch a session by the identity pubkey it claims |
| virtual void | Pump() |
| virtual void | RecvFrom(const SockAddr & from, ILinkSession::Packet_t pkt) =0 |
| bool | PickAddress(const RouterContact & rc, AddressInfo & picked) const |
| bool | TryEstablishTo(RouterContact rc) |
| bool | Start() |
| virtual void | Stop() |
| virtual std::string_view | Name() const =0 |
| void | CloseSessionTo(const RouterID & remote) |
| void | KeepAliveSessionTo(const RouterID & remote) |
| virtual bool | SendTo(const RouterID & remote, const llarp_buffer_t & buf, ILinkSession::CompletionHandler completed, uint16_t priority) |
| virtual bool | GetOurAddressInfo(AddressInfo & addr) const |
| bool | VisitSessionByPubkey(const RouterID & pk, std::function< bool(ILinkSession *)> visit) |
| virtual uint16_t | Rank() const =0 |
| const byte_t * | TransportPubKey() const |
| const SecretKey & | RouterEncryptionSecret() const |
| const SecretKey & | TransportSecretKey() const |
| bool | IsCompatable(const llarp::RouterContact & other) const |
| bool | MapAddr(const RouterID & pk, ILinkSession * s) |
| void | Tick(llarp_time_t now) |
| bool | operator<(const ILinkLayer & other) const |
| size_t | NumberOfPendingSessions() const called by link session to remove a pending session who is timed out |
| std::optional< int > | GetUDPFD() const |
| AbstractRouter * | Router() const |
| const SockAddr & | LocalSocketAddr() const Get the local sock addr we are bound on. |
| void | TriggerPump() |
Protected Functions
| Name | |
|---|---|
| bool | PutSession(const std::shared_ptr< ILinkSession > & s) |
| DECLARE_LOCK(Mutex_t , m_AuthedLinksMutex , ACQUIRED_BEFORE(m_PendingMutex) ) | |
| AuthedLinks m_AuthedLinks | GUARDED_BY(m_AuthedLinksMutex ) |
| DECLARE_LOCK(Mutex_t , m_PendingMutex , ACQUIRED_AFTER(m_AuthedLinksMutex) ) | |
| Pending m_Pending | GUARDED_BY(m_PendingMutex ) |
Public Attributes
Protected Attributes
| Name | |
|---|---|
| AbstractRouter * | m_Router |
| SockAddr | m_ourAddr |
| std::shared_ptr< llarp::UDPHandle > | m_udp |
| SecretKey | m_SecretKey |
| std::unordered_map< SockAddr, RouterID > | m_AuthedAddrs |
| std::unordered_map< SockAddr, llarp_time_t > | m_RecentlyClosed |
Protected Types Documentation
using Lock_t
using llarp::ILinkLayer::Lock_t = util::NullLock;
using Mutex_t
using llarp::ILinkLayer::Mutex_t = util::NullMutex;
using AuthedLinks
using llarp::ILinkLayer::AuthedLinks = std::unordered_multimap<RouterID, std::shared_ptr<ILinkSession> >;
using Pending
using llarp::ILinkLayer::Pending = std::unordered_map<SockAddr, std::shared_ptr<ILinkSession> >;
Public Functions Documentation
function ILinkLayer
ILinkLayer(
std::shared_ptr< KeyManager > keyManager,
EventLoop_ptr evloop,
GetRCFunc getrc,
LinkMessageHandler handler,
SignBufferFunc signFunc,
BeforeConnectFunc_t before,
SessionEstablishedHandler sessionEstablish,
SessionRenegotiateHandler renegotiate,
TimeoutHandler timeout,
SessionClosedHandler closed,
PumpDoneHandler pumpDone,
WorkerFunc_t doWork
)
function ~ILinkLayer
virtual ~ILinkLayer() =default
function Now
llarp_time_t Now() const
get current time via event loop
function HasSessionTo
bool HasSessionTo(
const RouterID & pk
)
function ForEachSession
void ForEachSession(
std::function< void(const ILinkSession *)> visit,
bool randomize =false
) const
function ForEachSession
void ForEachSession(
std::function< void(ILinkSession *)> visit
)
function UnmapAddr
void UnmapAddr(
const SockAddr & addr
)
function SendTo_LL
void SendTo_LL(
const SockAddr & to,
const llarp_buffer_t & pkt
)
function Bind
void Bind(
AbstractRouter * router,
SockAddr addr
)
function NewOutboundSession
virtual std::shared_ptr< ILinkSession > NewOutboundSession(
const RouterContact & rc,
const AddressInfo & ai
) =0
Reimplemented by: llarp::dtls::LinkLayer::NewOutboundSession, llarp::iwp::LinkLayer::NewOutboundSession
function FindSessionByPubkey
std::shared_ptr< ILinkSession > FindSessionByPubkey(
RouterID pk
)
fetch a session by the identity pubkey it claims
function Pump
virtual void Pump()
function RecvFrom
virtual void RecvFrom(
const SockAddr & from,
ILinkSession::Packet_t pkt
) =0
Reimplemented by: llarp::dtls::LinkLayer::RecvFrom, llarp::iwp::LinkLayer::RecvFrom
function PickAddress
bool PickAddress(
const RouterContact & rc,
AddressInfo & picked
) const
function TryEstablishTo
bool TryEstablishTo(
RouterContact rc
)
function Start
bool Start()
function Stop
virtual void Stop()
function Name
virtual std::string_view Name() const =0
Reimplemented by: llarp::dtls::LinkLayer::Name, llarp::iwp::LinkLayer::Name
function CloseSessionTo
void CloseSessionTo(
const RouterID & remote
)
function KeepAliveSessionTo
void KeepAliveSessionTo(
const RouterID & remote
)
function SendTo
virtual bool SendTo(
const RouterID & remote,
const llarp_buffer_t & buf,
ILinkSession::CompletionHandler completed,
uint16_t priority
)
function GetOurAddressInfo
virtual bool GetOurAddressInfo(
AddressInfo & addr
) const
function VisitSessionByPubkey
bool VisitSessionByPubkey(
const RouterID & pk,
std::function< bool(ILinkSession *)> visit
)
function Rank
virtual uint16_t Rank() const =0
Reimplemented by: llarp::dtls::LinkLayer::Rank, llarp::iwp::LinkLayer::Rank
function TransportPubKey
const byte_t * TransportPubKey() const
function RouterEncryptionSecret
inline const SecretKey & RouterEncryptionSecret() const
function TransportSecretKey
const SecretKey & TransportSecretKey() const
function IsCompatable
inline bool IsCompatable(
const llarp::RouterContact & other
) const
function MapAddr
bool MapAddr(
const RouterID & pk,
ILinkSession * s
)
function Tick
void Tick(
llarp_time_t now
)
function operator<
inline bool operator<(
const ILinkLayer & other
) const
function NumberOfPendingSessions
inline size_t NumberOfPendingSessions() const
called by link session to remove a pending session who is timed out
count the number of sessions that are yet to be fully connected
function GetUDPFD
std::optional< int > GetUDPFD() const
function Router
inline AbstractRouter * Router() const
function LocalSocketAddr
inline const SockAddr & LocalSocketAddr() const
Get the local sock addr we are bound on.
function TriggerPump
void TriggerPump()
Protected Functions Documentation
function PutSession
bool PutSession(
const std::shared_ptr< ILinkSession > & s
)
function DECLARE_LOCK
DECLARE_LOCK(
Mutex_t ,
m_AuthedLinksMutex ,
ACQUIRED_BEFORE(m_PendingMutex)
)
function GUARDED_BY
AuthedLinks m_AuthedLinks GUARDED_BY(
m_AuthedLinksMutex
)
function DECLARE_LOCK
DECLARE_LOCK(
Mutex_t ,
m_PendingMutex ,
ACQUIRED_AFTER(m_AuthedLinksMutex)
)
function GUARDED_BY
Pending m_Pending GUARDED_BY(
m_PendingMutex
)
Public Attributes Documentation
variable HandleMessage
LinkMessageHandler HandleMessage;
variable HandleTimeout
TimeoutHandler HandleTimeout;
variable Sign
SignBufferFunc Sign;
variable GetOurRC
GetRCFunc GetOurRC;
variable BeforeConnect
BeforeConnectFunc_t BeforeConnect;
variable SessionEstablished
SessionEstablishedHandler SessionEstablished;
variable SessionClosed
SessionClosedHandler SessionClosed;
variable SessionRenegotiate
SessionRenegotiateHandler SessionRenegotiate;
variable PumpDone
PumpDoneHandler PumpDone;
variable keyManager
std::shared_ptr< KeyManager > keyManager;
variable QueueWork
WorkerFunc_t QueueWork;
Protected Attributes Documentation
variable m_Router
AbstractRouter * m_Router;
variable m_ourAddr
SockAddr m_ourAddr;
variable m_udp
std::shared_ptr< llarp::UDPHandle > m_udp;
variable m_SecretKey
SecretKey m_SecretKey;
variable m_AuthedAddrs
std::unordered_map< SockAddr, RouterID > m_AuthedAddrs;
variable m_RecentlyClosed
std::unordered_map< SockAddr, llarp_time_t > m_RecentlyClosed;
Updated on 2026-01-10 at 22:49:45 +0000