---
title: llarp::ILinkSession

---

# llarp::ILinkSession





Inherited by [llarp::iwp::Session](Classes/structllarp_1_1iwp_1_1Session.md)

## Public Types

|                | Name           |
| -------------- | -------------- |
| enum class| **[DeliveryStatus](Classes/structllarp_1_1ILinkSession.md#enum-deliverystatus)** { eDeliverySuccess = 0, eDeliveryDropped = 1}<br>delivery status of a message  |
| using std::function< void([DeliveryStatus](Classes/structllarp_1_1ILinkSession.md#enum-deliverystatus))> | **[CompletionHandler](Classes/structllarp_1_1ILinkSession.md#using-completionhandler)** <br>message delivery result hook function  |
| using std::vector< byte_t > | **[Packet_t](Classes/structllarp_1_1ILinkSession.md#using-packet-t)**  |
| using std::vector< byte_t > | **[Message_t](Classes/structllarp_1_1ILinkSession.md#using-message-t)**  |

## Public Functions

|                | Name           |
| -------------- | -------------- |
| virtual | **[~ILinkSession](Classes/structllarp_1_1ILinkSession.md#function-~ilinksession)**() =default |
| virtual void | **[OnLinkEstablished](Classes/structllarp_1_1ILinkSession.md#function-onlinkestablished)**([ILinkLayer](Classes/structllarp_1_1ILinkLayer.md) * )<br>hook for utp for when we have established a connection  |
| virtual void | **[Pump](Classes/structllarp_1_1ILinkSession.md#function-pump)**() =0<br>called during pumping  |
| virtual void | **[Tick](Classes/structllarp_1_1ILinkSession.md#function-tick)**(llarp_time_t ) =0<br>called every timer tick  |
| virtual bool | **[SendMessageBuffer](Classes/structllarp_1_1ILinkSession.md#function-sendmessagebuffer)**(Message_t , [CompletionHandler](Classes/structllarp_1_1ILinkSession.md#using-completionhandler) handler, uint16_t priority) =0<br>send a message buffer to the remote endpoint  |
| virtual void | **[Start](Classes/structllarp_1_1ILinkSession.md#function-start)**() =0<br>start the connection  |
| virtual void | **[Close](Classes/structllarp_1_1ILinkSession.md#function-close)**() =0 |
| virtual bool | **[Recv_LL](Classes/structllarp_1_1ILinkSession.md#function-recv-ll)**(Packet_t )<br>recv packet on low layer not used by utp  |
| virtual bool | **[SendKeepAlive](Classes/structllarp_1_1ILinkSession.md#function-sendkeepalive)**() =0<br>send a keepalive to the remote endpoint  |
| virtual bool | **[IsEstablished](Classes/structllarp_1_1ILinkSession.md#function-isestablished)**() const =0<br>return true if we are established  |
| virtual bool | **[TimedOut](Classes/structllarp_1_1ILinkSession.md#function-timedout)**(llarp_time_t now) const =0<br>return true if this session has timed out  |
| virtual [PubKey](Classes/structllarp_1_1PubKey.md) | **[GetPubKey](Classes/structllarp_1_1ILinkSession.md#function-getpubkey)**() const =0<br>get remote public identity key  |
| virtual bool | **[IsInbound](Classes/structllarp_1_1ILinkSession.md#function-isinbound)**() const =0<br>is an inbound session or not  |
| virtual const [SockAddr](Classes/structllarp_1_1SockAddr.md) & | **[GetRemoteEndpoint](Classes/structllarp_1_1ILinkSession.md#function-getremoteendpoint)**() const =0<br>get remote address  |
| virtual [RouterContact](Classes/structllarp_1_1RouterContact.md) | **[GetRemoteRC](Classes/structllarp_1_1ILinkSession.md#function-getremoterc)**() const =0 |
| bool | **[IsRelay](Classes/structllarp_1_1ILinkSession.md#function-isrelay)**() const<br>is this session a session to a relay?  |
| virtual size_t | **[SendQueueBacklog](Classes/structllarp_1_1ILinkSession.md#function-sendqueuebacklog)**() const =0<br>send queue current blacklog  |
| virtual [ILinkLayer](Classes/structllarp_1_1ILinkLayer.md) * | **[GetLinkLayer](Classes/structllarp_1_1ILinkSession.md#function-getlinklayer)**() const =0<br>get parent link layer  |
| virtual bool | **[RenegotiateSession](Classes/structllarp_1_1ILinkSession.md#function-renegotiatesession)**() =0<br>renegotiate session when we have a new RC locally  |
| virtual bool | **[ShouldPing](Classes/structllarp_1_1ILinkSession.md#function-shouldping)**() const =0<br>return true if we should send an explicit keepalive message  |
| virtual [SessionStats](Classes/structllarp_1_1SessionStats.md) | **[GetSessionStats](Classes/structllarp_1_1ILinkSession.md#function-getsessionstats)**() const =0<br>return the current stats for this session  |
| virtual util::StatusObject | **[ExtractStatus](Classes/structllarp_1_1ILinkSession.md#function-extractstatus)**() const =0 |
| virtual void | **[HandlePlaintext](Classes/structllarp_1_1ILinkSession.md#function-handleplaintext)**() =0 |

## Public Attributes

|                | Name           |
| -------------- | -------------- |
| std::function< bool(const [LinkIntroMessage](Classes/structllarp_1_1LinkIntroMessage.md) *msg)> | **[GotLIM](Classes/structllarp_1_1ILinkSession.md#variable-gotlim)** <br>handle a valid LIM  |

## Public Types Documentation

### enum DeliveryStatus

| Enumerator | Value | Description |
| ---------- | ----- | ----------- |
| eDeliverySuccess | 0|   |
| eDeliveryDropped | 1|   |



delivery status of a message 

### using CompletionHandler

```cpp
using llarp::ILinkSession::CompletionHandler =  std::function<void(DeliveryStatus)>;
```

message delivery result hook function 

### using Packet_t

```cpp
using llarp::ILinkSession::Packet_t =  std::vector<byte_t>;
```


### using Message_t

```cpp
using llarp::ILinkSession::Message_t =  std::vector<byte_t>;
```


## Public Functions Documentation

### function ~ILinkSession

```cpp
virtual ~ILinkSession() =default
```


### function OnLinkEstablished

```cpp
inline virtual void OnLinkEstablished(
    ILinkLayer * 
)
```

hook for utp for when we have established a connection 

### function Pump

```cpp
virtual void Pump() =0
```

called during pumping 

**Reimplemented by**: [llarp::iwp::Session::Pump](Classes/structllarp_1_1iwp_1_1Session.md#function-pump)


### function Tick

```cpp
virtual void Tick(
    llarp_time_t 
) =0
```

called every timer tick 

**Reimplemented by**: [llarp::iwp::Session::Tick](Classes/structllarp_1_1iwp_1_1Session.md#function-tick)


### function SendMessageBuffer

```cpp
virtual bool SendMessageBuffer(
    Message_t ,
    CompletionHandler handler,
    uint16_t priority
) =0
```

send a message buffer to the remote endpoint 

**Reimplemented by**: [llarp::iwp::Session::SendMessageBuffer](Classes/structllarp_1_1iwp_1_1Session.md#function-sendmessagebuffer)


### function Start

```cpp
virtual void Start() =0
```

start the connection 

**Reimplemented by**: [llarp::iwp::Session::Start](Classes/structllarp_1_1iwp_1_1Session.md#function-start)


### function Close

```cpp
virtual void Close() =0
```


**Reimplemented by**: [llarp::iwp::Session::Close](Classes/structllarp_1_1iwp_1_1Session.md#function-close)


### function Recv_LL

```cpp
inline virtual bool Recv_LL(
    Packet_t 
)
```

recv packet on low layer not used by utp 

**Reimplemented by**: [llarp::iwp::Session::Recv_LL](Classes/structllarp_1_1iwp_1_1Session.md#function-recv-ll)


### function SendKeepAlive

```cpp
virtual bool SendKeepAlive() =0
```

send a keepalive to the remote endpoint 

**Reimplemented by**: [llarp::iwp::Session::SendKeepAlive](Classes/structllarp_1_1iwp_1_1Session.md#function-sendkeepalive)


### function IsEstablished

```cpp
virtual bool IsEstablished() const =0
```

return true if we are established 

**Reimplemented by**: [llarp::iwp::Session::IsEstablished](Classes/structllarp_1_1iwp_1_1Session.md#function-isestablished)


### function TimedOut

```cpp
virtual bool TimedOut(
    llarp_time_t now
) const =0
```

return true if this session has timed out 

**Reimplemented by**: [llarp::iwp::Session::TimedOut](Classes/structllarp_1_1iwp_1_1Session.md#function-timedout)


### function GetPubKey

```cpp
virtual PubKey GetPubKey() const =0
```

get remote public identity key 

**Reimplemented by**: [llarp::iwp::Session::GetPubKey](Classes/structllarp_1_1iwp_1_1Session.md#function-getpubkey)


### function IsInbound

```cpp
virtual bool IsInbound() const =0
```

is an inbound session or not 

**Reimplemented by**: [llarp::iwp::Session::IsInbound](Classes/structllarp_1_1iwp_1_1Session.md#function-isinbound)


### function GetRemoteEndpoint

```cpp
virtual const SockAddr & GetRemoteEndpoint() const =0
```

get remote address 

**Reimplemented by**: [llarp::iwp::Session::GetRemoteEndpoint](Classes/structllarp_1_1iwp_1_1Session.md#function-getremoteendpoint)


### function GetRemoteRC

```cpp
virtual RouterContact GetRemoteRC() const =0
```


**Reimplemented by**: [llarp::iwp::Session::GetRemoteRC](Classes/structllarp_1_1iwp_1_1Session.md#function-getremoterc)


### function IsRelay

```cpp
bool IsRelay() const
```

is this session a session to a relay? 

### function SendQueueBacklog

```cpp
virtual size_t SendQueueBacklog() const =0
```

send queue current blacklog 

**Reimplemented by**: [llarp::iwp::Session::SendQueueBacklog](Classes/structllarp_1_1iwp_1_1Session.md#function-sendqueuebacklog)


### function GetLinkLayer

```cpp
virtual ILinkLayer * GetLinkLayer() const =0
```

get parent link layer 

**Reimplemented by**: [llarp::iwp::Session::GetLinkLayer](Classes/structllarp_1_1iwp_1_1Session.md#function-getlinklayer)


### function RenegotiateSession

```cpp
virtual bool RenegotiateSession() =0
```

renegotiate session when we have a new RC locally 

**Reimplemented by**: [llarp::iwp::Session::RenegotiateSession](Classes/structllarp_1_1iwp_1_1Session.md#function-renegotiatesession)


### function ShouldPing

```cpp
virtual bool ShouldPing() const =0
```

return true if we should send an explicit keepalive message 

**Reimplemented by**: [llarp::iwp::Session::ShouldPing](Classes/structllarp_1_1iwp_1_1Session.md#function-shouldping)


### function GetSessionStats

```cpp
virtual SessionStats GetSessionStats() const =0
```

return the current stats for this session 

**Reimplemented by**: [llarp::iwp::Session::GetSessionStats](Classes/structllarp_1_1iwp_1_1Session.md#function-getsessionstats)


### function ExtractStatus

```cpp
virtual util::StatusObject ExtractStatus() const =0
```


**Reimplemented by**: [llarp::iwp::Session::ExtractStatus](Classes/structllarp_1_1iwp_1_1Session.md#function-extractstatus)


### function HandlePlaintext

```cpp
virtual void HandlePlaintext() =0
```


**Reimplemented by**: [llarp::iwp::Session::HandlePlaintext](Classes/structllarp_1_1iwp_1_1Session.md#function-handleplaintext)


## Public Attributes Documentation

### variable GotLIM

```cpp
std::function< bool(const LinkIntroMessage *msg)> GotLIM;
```

handle a valid LIM 

-------------------------------

Updated on 2023-01-27 at 23:09:26 +0000