---
title: llarp::iwp::Session

---

# llarp::iwp::Session





Inherits from [llarp::ILinkSession](Classes/structllarp_1_1ILinkSession.md), std::enable_shared_from_this< Session >

## Public Types

|                | Name           |
| -------------- | -------------- |
| using std::chrono::milliseconds | **[Time_t](Classes/structllarp_1_1iwp_1_1Session.md#using-time-t)**  |

## Public Functions

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

## Public Attributes

|                | Name           |
| -------------- | -------------- |
| constexpr std::size_t | **[MaxACKSInMACK](Classes/structllarp_1_1iwp_1_1Session.md#variable-maxacksinmack)** <br>maximum number of messages we can ack in a multiack  |

## Additional inherited members

**Public Types inherited from [llarp::ILinkSession](Classes/structllarp_1_1ILinkSession.md)**

|                | Name           |
| -------------- | -------------- |
| enum class| **[DeliveryStatus](Classes/structllarp_1_1ILinkSession.md#enum-deliverystatus)** { eDeliverySuccess, eDeliveryDropped}<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 inherited from [llarp::ILinkSession](Classes/structllarp_1_1ILinkSession.md)**

|                | 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  |
| bool | **[IsRelay](Classes/structllarp_1_1ILinkSession.md#function-isrelay)**() const<br>is this session a session to a relay?  |

**Public Attributes inherited from [llarp::ILinkSession](Classes/structllarp_1_1ILinkSession.md)**

|                | 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

### using Time_t

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


## Public Functions Documentation

### function Session

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

outbound session 

### function Session

```cpp
Session(
    LinkLayer * parent,
    const SockAddr & from
)
```

inbound session 

### function TriggerPump

```cpp
void TriggerPump()
```


### function Pump

```cpp
virtual void Pump() override
```

called during pumping 

**Reimplements**: [llarp::ILinkSession::Pump](Classes/structllarp_1_1ILinkSession.md#function-pump)


### function Tick

```cpp
virtual void Tick(
    llarp_time_t 
) override
```

called every timer tick 

**Reimplements**: [llarp::ILinkSession::Tick](Classes/structllarp_1_1ILinkSession.md#function-tick)


### function SendMessageBuffer

```cpp
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](Classes/structllarp_1_1ILinkSession.md#function-sendmessagebuffer)


### function Send_LL

```cpp
void Send_LL(
    const byte_t * buf,
    size_t sz
)
```


### function EncryptAndSend

```cpp
void EncryptAndSend(
    ILinkSession::Packet_t 
)
```


### function Start

```cpp
virtual void Start() override
```

start the connection 

**Reimplements**: [llarp::ILinkSession::Start](Classes/structllarp_1_1ILinkSession.md#function-start)


### function Close

```cpp
virtual void Close() override
```


**Reimplements**: [llarp::ILinkSession::Close](Classes/structllarp_1_1ILinkSession.md#function-close)


### function Recv_LL

```cpp
virtual bool Recv_LL(
    ILinkSession::Packet_t 
) override
```

recv packet on low layer not used by utp 

**Reimplements**: [llarp::ILinkSession::Recv_LL](Classes/structllarp_1_1ILinkSession.md#function-recv-ll)


### function SendKeepAlive

```cpp
virtual bool SendKeepAlive() override
```

send a keepalive to the remote endpoint 

**Reimplements**: [llarp::ILinkSession::SendKeepAlive](Classes/structllarp_1_1ILinkSession.md#function-sendkeepalive)


### function IsEstablished

```cpp
virtual bool IsEstablished() const override
```

return true if we are established 

**Reimplements**: [llarp::ILinkSession::IsEstablished](Classes/structllarp_1_1ILinkSession.md#function-isestablished)


### function TimedOut

```cpp
virtual bool TimedOut(
    llarp_time_t now
) const override
```

return true if this session has timed out 

**Reimplements**: [llarp::ILinkSession::TimedOut](Classes/structllarp_1_1ILinkSession.md#function-timedout)


### function GetPubKey

```cpp
inline virtual PubKey GetPubKey() const override
```

get remote public identity key 

**Reimplements**: [llarp::ILinkSession::GetPubKey](Classes/structllarp_1_1ILinkSession.md#function-getpubkey)


### function GetRemoteEndpoint

```cpp
inline virtual const SockAddr & GetRemoteEndpoint() const override
```

get remote address 

**Reimplements**: [llarp::ILinkSession::GetRemoteEndpoint](Classes/structllarp_1_1ILinkSession.md#function-getremoteendpoint)


### function GetRemoteRC

```cpp
inline virtual RouterContact GetRemoteRC() const override
```


**Reimplements**: [llarp::ILinkSession::GetRemoteRC](Classes/structllarp_1_1ILinkSession.md#function-getremoterc)


### function SendQueueBacklog

```cpp
inline virtual size_t SendQueueBacklog() const override
```

send queue current blacklog 

**Reimplements**: [llarp::ILinkSession::SendQueueBacklog](Classes/structllarp_1_1ILinkSession.md#function-sendqueuebacklog)


### function GetLinkLayer

```cpp
inline virtual ILinkLayer * GetLinkLayer() const override
```

get parent link layer 

**Reimplements**: [llarp::ILinkSession::GetLinkLayer](Classes/structllarp_1_1ILinkSession.md#function-getlinklayer)


### function RenegotiateSession

```cpp
virtual bool RenegotiateSession() override
```

renegotiate session when we have a new RC locally 

**Reimplements**: [llarp::ILinkSession::RenegotiateSession](Classes/structllarp_1_1ILinkSession.md#function-renegotiatesession)


### function ShouldPing

```cpp
virtual bool ShouldPing() const override
```

return true if we should send an explicit keepalive message 

**Reimplements**: [llarp::ILinkSession::ShouldPing](Classes/structllarp_1_1ILinkSession.md#function-shouldping)


### function GetSessionStats

```cpp
virtual SessionStats GetSessionStats() const override
```

return the current stats for this session 

**Reimplements**: [llarp::ILinkSession::GetSessionStats](Classes/structllarp_1_1ILinkSession.md#function-getsessionstats)


### function ExtractStatus

```cpp
virtual util::StatusObject ExtractStatus() const override
```


**Reimplements**: [llarp::ILinkSession::ExtractStatus](Classes/structllarp_1_1ILinkSession.md#function-extractstatus)


### function IsInbound

```cpp
inline virtual bool IsInbound() const override
```

is an inbound session or not 

**Reimplements**: [llarp::ILinkSession::IsInbound](Classes/structllarp_1_1ILinkSession.md#function-isinbound)


### function HandlePlaintext

```cpp
virtual void HandlePlaintext() override
```


**Reimplements**: [llarp::ILinkSession::HandlePlaintext](Classes/structllarp_1_1ILinkSession.md#function-handleplaintext)


## Public Attributes Documentation

### variable MaxACKSInMACK

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

maximum number of messages we can ack in a multiack 

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

Updated on 2022-11-08 at 16:19:48 +0000