---
title: llarp::service

---

# llarp::service



## Classes

|                | Name           |
| -------------- | -------------- |
| struct | **[llarp::service::Address](Classes/structllarp_1_1service_1_1Address.md)** <br>Snapp [Address]().  |
| struct | **[llarp::service::AsyncKeyExchange](Classes/structllarp_1_1service_1_1AsyncKeyExchange.md)**  |
| struct | **[llarp::service::AuthResult](Classes/structllarp_1_1service_1_1AuthResult.md)** <br>auth result object with code and reason  |
| struct | **[llarp::service::IAuthPolicy](Classes/structllarp_1_1service_1_1IAuthPolicy.md)**  |
| struct | **[llarp::service::AuthInfo](Classes/structllarp_1_1service_1_1AuthInfo.md)** <br>info needed by clients in order to authenticate to a remote endpoint  |
| struct | **[llarp::service::Context](Classes/structllarp_1_1service_1_1Context.md)** <br>holds all the hidden service endpoints we own this should be refactored (removed entirely...?) now that lokinet only supports one endpoint per instance  |
| struct | **[llarp::service::ConvoTag](Classes/structllarp_1_1service_1_1ConvoTag.md)**  |
| struct | **[llarp::service::Endpoint](Classes/structllarp_1_1service_1_1Endpoint.md)**  |
| struct | **[llarp::service::EndpointState](Classes/structllarp_1_1service_1_1EndpointState.md)**  |
| struct | **[llarp::service::EndpointUtil](Classes/structllarp_1_1service_1_1EndpointUtil.md)**  |
| struct | **[llarp::service::RecvDataEvent](Classes/structllarp_1_1service_1_1RecvDataEvent.md)**  |
| struct | **[llarp::service::IDataHandler](Classes/structllarp_1_1service_1_1IDataHandler.md)**  |
| struct | **[llarp::service::HiddenServiceAddressLookup](Classes/structllarp_1_1service_1_1HiddenServiceAddressLookup.md)**  |
| struct | **[llarp::service::Identity](Classes/structllarp_1_1service_1_1Identity.md)**  |
| struct | **[llarp::service::ServiceInfo](Classes/structllarp_1_1service_1_1ServiceInfo.md)**  |
| struct | **[llarp::service::Introduction](Classes/structllarp_1_1service_1_1Introduction.md)**  |
| struct | **[llarp::service::CompareIntroTimestamp](Classes/structllarp_1_1service_1_1CompareIntroTimestamp.md)** <br>comparator for introset timestamp  |
| struct | **[llarp::service::IntroSet](Classes/structllarp_1_1service_1_1IntroSet.md)**  |
| struct | **[llarp::service::EncryptedIntroSet](Classes/structllarp_1_1service_1_1EncryptedIntroSet.md)** <br>public version of the introset that is encrypted  |
| class | **[llarp::service::LNSLookupTracker](Classes/classllarp_1_1service_1_1LNSLookupTracker.md)** <br>tracks and manages consensus of lns names we fetch from the network  |
| struct | **[llarp::service::IServiceLookup](Classes/structllarp_1_1service_1_1IServiceLookup.md)**  |
| struct | **[llarp::service::ILookupHolder](Classes/structllarp_1_1service_1_1ILookupHolder.md)**  |
| struct | **[llarp::service::EncryptedName](Classes/structllarp_1_1service_1_1EncryptedName.md)**  |
| struct | **[llarp::service::OutboundContext](Classes/structllarp_1_1service_1_1OutboundContext.md)** <br>context needed to initiate an outbound hidden service session  |
| struct | **[llarp::service::PendingBuffer](Classes/structllarp_1_1service_1_1PendingBuffer.md)**  |
| struct | **[llarp::service::ProtocolMessage](Classes/structllarp_1_1service_1_1ProtocolMessage.md)** <br>inner message  |
| struct | **[llarp::service::ProtocolFrame](Classes/structllarp_1_1service_1_1ProtocolFrame.md)** <br>outer message  |
| struct | **[llarp::service::RouterLookupJob](Classes/structllarp_1_1service_1_1RouterLookupJob.md)**  |
| struct | **[llarp::service::SendContext](Classes/structllarp_1_1service_1_1SendContext.md)**  |
| struct | **[llarp::service::Session](Classes/structllarp_1_1service_1_1Session.md)**  |
| struct | **[llarp::service::Tag](Classes/structllarp_1_1service_1_1Tag.md)**  |

## Types

|                | Name           |
| -------------- | -------------- |
| enum class uint64_t | **[AuthResultCode](Namespaces/namespacellarp_1_1service.md#enum-authresultcode)** { eAuthAccepted = 0, eAuthRejected = 1, eAuthFailed = 2, eAuthRateLimit = 3, eAuthPaymentRequired = 4}<br>authentication status code  |
| enum class| **[AuthType](Namespaces/namespacellarp_1_1service.md#enum-authtype)** { eAuthTypeNone, eAuthTypeWhitelist, eAuthTypeLMQ, eAuthTypeFile}<br>what kind of backend to use for auth  |
| enum class| **[AuthFileType](Namespaces/namespacellarp_1_1service.md#enum-authfiletype)** { eAuthFilePlain, eAuthFileHashes}<br>how to interpret an file for auth  |
| enum class uint64_t | **[ProtocolType](Namespaces/namespacellarp_1_1service.md#enum-protocoltype)** { Control = 0UL, TrafficV4 = 1UL, TrafficV6 = 2UL, Exit = 3UL, Auth = 4UL, QUIC = 5UL} |
| using std::shared_ptr< [Endpoint](Classes/structllarp_1_1service_1_1Endpoint.md) > | **[Endpoint_ptr](Namespaces/namespacellarp_1_1service.md#using-endpoint-ptr)**  |
| using std::shared_ptr< [routing::PathTransferMessage](Classes/structllarp_1_1routing_1_1PathTransferMessage.md) > | **[Msg_ptr](Namespaces/namespacellarp_1_1service.md#using-msg-ptr)**  |
| using std::pair< Msg_ptr, path::Path_ptr > | **[SendEvent_t](Namespaces/namespacellarp_1_1service.md#using-sendevent-t)**  |
| using [thread::Queue](Classes/classllarp_1_1thread_1_1Queue.md)< SendEvent_t > | **[SendMessageQueue_t](Namespaces/namespacellarp_1_1service.md#using-sendmessagequeue-t)**  |
| using std::deque< [PendingBuffer](Classes/structllarp_1_1service_1_1PendingBuffer.md) > | **[PendingBufferQueue](Namespaces/namespacellarp_1_1service.md#using-pendingbufferqueue)**  |
| using std::unordered_map< [Address](Classes/structllarp_1_1service_1_1Address.md), PendingBufferQueue > | **[PendingTraffic](Namespaces/namespacellarp_1_1service.md#using-pendingtraffic)**  |
| using std::shared_ptr< [ProtocolMessage](Classes/structllarp_1_1service_1_1ProtocolMessage.md) > | **[ProtocolMessagePtr](Namespaces/namespacellarp_1_1service.md#using-protocolmessageptr)**  |
| using [thread::Queue](Classes/classllarp_1_1thread_1_1Queue.md)< ProtocolMessagePtr > | **[RecvPacketQueue_t](Namespaces/namespacellarp_1_1service.md#using-recvpacketqueue-t)**  |
| using std::unordered_map< [RouterID](Classes/structllarp_1_1RouterID.md), [RouterLookupJob](Classes/structllarp_1_1service_1_1RouterLookupJob.md) > | **[PendingRouters](Namespaces/namespacellarp_1_1service.md#using-pendingrouters)**  |
| using std::unordered_map< uint64_t, std::unique_ptr< [IServiceLookup](Classes/structllarp_1_1service_1_1IServiceLookup.md) > > | **[PendingLookups](Namespaces/namespacellarp_1_1service.md#using-pendinglookups)**  |
| using std::unordered_multimap< [Address](Classes/structllarp_1_1service_1_1Address.md), std::shared_ptr< [OutboundContext](Classes/structllarp_1_1service_1_1OutboundContext.md) > > | **[Sessions](Namespaces/namespacellarp_1_1service.md#using-sessions)**  |
| using std::unordered_map< [RouterID](Classes/structllarp_1_1RouterID.md), std::shared_ptr< [exit::BaseSession](Classes/structllarp_1_1exit_1_1BaseSession.md) > > | **[SNodeSessions](Namespaces/namespacellarp_1_1service.md#using-snodesessions)**  |
| using std::unordered_map< [ConvoTag](Classes/structllarp_1_1service_1_1ConvoTag.md), [Session](Classes/structllarp_1_1service_1_1Session.md) > | **[ConvoMap](Namespaces/namespacellarp_1_1service.md#using-convomap)**  |
| using std::unordered_set< [Address](Classes/structllarp_1_1service_1_1Address.md) > | **[OutboundSessions_t](Namespaces/namespacellarp_1_1service.md#using-outboundsessions-t)** <br>set of outbound addresses to maintain to  |
| using std::function< void([Address](Classes/structllarp_1_1service_1_1Address.md), [OutboundContext](Classes/structllarp_1_1service_1_1OutboundContext.md) *)> | **[PathEnsureHook](Namespaces/namespacellarp_1_1service.md#using-pathensurehook)**  |
| using std::unordered_map< std::string, std::pair< [Address](Classes/structllarp_1_1service_1_1Address.md), llarp_time_t > > | **[LNSNameCache](Namespaces/namespacellarp_1_1service.md#using-lnsnamecache)**  |
| using std::function< void(const std::vector< [EncryptedIntroSet](Classes/structllarp_1_1service_1_1EncryptedIntroSet.md) > &)> | **[EncryptedIntroSetLookupHandler](Namespaces/namespacellarp_1_1service.md#using-encryptedintrosetlookuphandler)**  |
| using std::function< void(const std::vector< [IntroSet](Classes/structllarp_1_1service_1_1IntroSet.md) > &)> | **[IntroSetLookupHandler](Namespaces/namespacellarp_1_1service.md#using-introsetlookuphandler)**  |
| using [AlignedBuffer](Classes/structllarp_1_1AlignedBuffer.md)< 16 > | **[VanityNonce](Namespaces/namespacellarp_1_1service.md#using-vanitynonce)** <br>hidden service address  |

## Functions

|                | Name           |
| -------------- | -------------- |
| std::optional< std::variant< [Address](Classes/structllarp_1_1service_1_1Address.md), [RouterID](Classes/structllarp_1_1RouterID.md) > > | **[ParseAddress](Namespaces/namespacellarp_1_1service.md#function-parseaddress)**(std::string_view lokinet_addr) |
| uint64_t | **[AuthResultCodeAsInt](Namespaces/namespacellarp_1_1service.md#function-authresultcodeasint)**(AuthResultCode code)<br>turn an auth result code into an int  |
| std::optional< AuthResultCode > | **[AuthResultCodeFromInt](Namespaces/namespacellarp_1_1service.md#function-authresultcodefromint)**(uint64_t code)<br>may turn an int into an auth result code  |
| std::optional< AuthResultCode > | **[ParseAuthResultCode](Namespaces/namespacellarp_1_1service.md#function-parseauthresultcode)**(std::string data)<br>maybe get auth result from string  |
| AuthType | **[ParseAuthType](Namespaces/namespacellarp_1_1service.md#function-parseauthtype)**(std::string arg)<br>get an auth type from a string throws std::invalid_argument if arg is invalid  |
| AuthFileType | **[ParseAuthFileType](Namespaces/namespacellarp_1_1service.md#function-parseauthfiletype)**(std::string arg)<br>get an auth file type from a string throws std::invalid_argument if arg is invalid  |
| std::shared_ptr< [IAuthPolicy](Classes/structllarp_1_1service_1_1IAuthPolicy.md) > | **[MakeFileAuthPolicy](Namespaces/namespacellarp_1_1service.md#function-makefileauthpolicy)**([AbstractRouter](Classes/structllarp_1_1AbstractRouter.md) * , std::set< fs::path > files, AuthFileType fileType)<br>make an [IAuthPolicy]() that reads out of a static file  |
| template <typename Endpoint_t \> <br>[path::Path::UniqueEndpointSet_t](Classes/structllarp_1_1path_1_1Path.md#using-uniqueendpointset-t) | **[GetManyPathsWithUniqueEndpoints](Namespaces/namespacellarp_1_1service.md#function-getmanypathswithuniqueendpoints)**(Endpoint_t * ep, size_t N, std::optional< [dht::Key_t](Classes/structllarp_1_1dht_1_1Key__t.md) > maybeLocation =std::nullopt, size_t tries =10) |
| bool | **[operator==](Namespaces/namespacellarp_1_1service.md#function-operator==)**(const [Identity](Classes/structllarp_1_1service_1_1Identity.md) & lhs, const [Identity](Classes/structllarp_1_1service_1_1Identity.md) & rhs) |
| bool | **[operator<](Namespaces/namespacellarp_1_1service.md#function-operator<)**(const [IntroSet](Classes/structllarp_1_1service_1_1IntroSet.md) & lhs, const [IntroSet](Classes/structllarp_1_1service_1_1IntroSet.md) & rhs) |
| bool | **[operator==](Namespaces/namespacellarp_1_1service.md#function-operator==)**(const [IntroSet](Classes/structllarp_1_1service_1_1IntroSet.md) & lhs, const [IntroSet](Classes/structllarp_1_1service_1_1IntroSet.md) & rhs) |
| bool | **[operator!=](Namespaces/namespacellarp_1_1service.md#function-operator!=)**(const [IntroSet](Classes/structllarp_1_1service_1_1IntroSet.md) & lhs, const [IntroSet](Classes/structllarp_1_1service_1_1IntroSet.md) & rhs) |
| bool | **[operator<](Namespaces/namespacellarp_1_1service.md#function-operator<)**(const [EncryptedIntroSet](Classes/structllarp_1_1service_1_1EncryptedIntroSet.md) & lhs, const [EncryptedIntroSet](Classes/structllarp_1_1service_1_1EncryptedIntroSet.md) & rhs) |
| bool | **[operator==](Namespaces/namespacellarp_1_1service.md#function-operator==)**(const [EncryptedIntroSet](Classes/structllarp_1_1service_1_1EncryptedIntroSet.md) & lhs, const [EncryptedIntroSet](Classes/structllarp_1_1service_1_1EncryptedIntroSet.md) & rhs) |
| bool | **[operator!=](Namespaces/namespacellarp_1_1service.md#function-operator!=)**(const [EncryptedIntroSet](Classes/structllarp_1_1service_1_1EncryptedIntroSet.md) & lhs, const [EncryptedIntroSet](Classes/structllarp_1_1service_1_1EncryptedIntroSet.md) & rhs) |
| bool | **[NameIsValid](Namespaces/namespacellarp_1_1service.md#function-nameisvalid)**(std::string_view name)<br>check if an lns name complies with the registration rules  |
| constexpr std::string_view | **[ToString](Namespaces/namespacellarp_1_1service.md#function-tostring)**(ProtocolType t) |

## Attributes

|                | Name           |
| -------------- | -------------- |
| constexpr auto | **[IntrosetPublishInterval](Namespaces/namespacellarp_1_1service.md#variable-introsetpublishinterval)** <br>minimum interval for publishing introsets  |
| constexpr auto | **[IntrosetPublishRetryCooldown](Namespaces/namespacellarp_1_1service.md#variable-introsetpublishretrycooldown)** <br>how agressively should we retry publishing introset on failure  |
| constexpr auto | **[IntrosetLookupCooldown](Namespaces/namespacellarp_1_1service.md#variable-introsetlookupcooldown)** <br>how aggressively should we retry looking up introsets  |
| constexpr auto | **[IntrosetLookupGraceInterval](Namespaces/namespacellarp_1_1service.md#variable-introsetlookupgraceinterval)** <br>interval for which we will add to lookup timeout interval  |
| constexpr std::size_t | **[MAX_INTROSET_SIZE](Namespaces/namespacellarp_1_1service.md#variable-max-introset-size)**  |
| constexpr llarp_time_t | **[MAX_INTROSET_TIME_DELTA](Namespaces/namespacellarp_1_1service.md#variable-max-introset-time-delta)**  |
| constexpr size_t | **[MaxConcurrentLookups](Namespaces/namespacellarp_1_1service.md#variable-maxconcurrentlookups)**  |
| constexpr std::size_t | **[MAX_PROTOCOL_MESSAGE_SIZE](Namespaces/namespacellarp_1_1service.md#variable-max-protocol-message-size)**  |
| constexpr auto | **[SessionLifetime](Namespaces/namespacellarp_1_1service.md#variable-sessionlifetime)**  |

## Types Documentation

### enum AuthResultCode

| Enumerator | Value | Description |
| ---------- | ----- | ----------- |
| eAuthAccepted | 0| explicitly accepted   |
| eAuthRejected | 1| explicitly rejected   |
| eAuthFailed | 2| attempt failed   |
| eAuthRateLimit | 3| attempt rate limited   |
| eAuthPaymentRequired | 4| need mo munny   |



authentication status code 

### enum AuthType

| Enumerator | Value | Description |
| ---------- | ----- | ----------- |
| eAuthTypeNone | | no authentication   |
| eAuthTypeWhitelist | | manual whitelist   |
| eAuthTypeLMQ | | LMQ server.   |
| eAuthTypeFile | | static file   |



what kind of backend to use for auth 

### enum AuthFileType

| Enumerator | Value | Description |
| ---------- | ----- | ----------- |
| eAuthFilePlain | |   |
| eAuthFileHashes | |   |



how to interpret an file for auth 

### enum ProtocolType

| Enumerator | Value | Description |
| ---------- | ----- | ----------- |
| Control | 0UL|   |
| TrafficV4 | 1UL|   |
| TrafficV6 | 2UL|   |
| Exit | 3UL|   |
| Auth | 4UL|   |
| QUIC | 5UL|   |




### using Endpoint_ptr

```cpp
using llarp::service::Endpoint_ptr = typedef std::shared_ptr<Endpoint>;
```


### using Msg_ptr

```cpp
using llarp::service::Msg_ptr = typedef std::shared_ptr<routing::PathTransferMessage>;
```


### using SendEvent_t

```cpp
using llarp::service::SendEvent_t = typedef std::pair<Msg_ptr, path::Path_ptr>;
```


### using SendMessageQueue_t

```cpp
using llarp::service::SendMessageQueue_t = typedef thread::Queue<SendEvent_t>;
```


### using PendingBufferQueue

```cpp
using llarp::service::PendingBufferQueue = typedef std::deque<PendingBuffer>;
```


### using PendingTraffic

```cpp
using llarp::service::PendingTraffic = typedef std::unordered_map<Address, PendingBufferQueue>;
```


### using ProtocolMessagePtr

```cpp
using llarp::service::ProtocolMessagePtr = typedef std::shared_ptr<ProtocolMessage>;
```


### using RecvPacketQueue_t

```cpp
using llarp::service::RecvPacketQueue_t = typedef thread::Queue<ProtocolMessagePtr>;
```


### using PendingRouters

```cpp
using llarp::service::PendingRouters = typedef std::unordered_map<RouterID, RouterLookupJob>;
```


### using PendingLookups

```cpp
using llarp::service::PendingLookups = typedef std::unordered_map<uint64_t, std::unique_ptr<IServiceLookup> >;
```


### using Sessions

```cpp
using llarp::service::Sessions = typedef std::unordered_multimap<Address, std::shared_ptr<OutboundContext> >;
```


### using SNodeSessions

```cpp
using llarp::service::SNodeSessions = typedef std::unordered_map<RouterID, std::shared_ptr<exit::BaseSession> >;
```


### using ConvoMap

```cpp
using llarp::service::ConvoMap = typedef std::unordered_map<ConvoTag, Session>;
```


### using OutboundSessions_t

```cpp
using llarp::service::OutboundSessions_t = typedef std::unordered_set<Address>;
```

set of outbound addresses to maintain to 

### using PathEnsureHook

```cpp
using llarp::service::PathEnsureHook = typedef std::function<void(Address, OutboundContext*)>;
```


### using LNSNameCache

```cpp
using llarp::service::LNSNameCache = typedef std::unordered_map<std::string, std::pair<Address, llarp_time_t> >;
```


### using EncryptedIntroSetLookupHandler

```cpp
using llarp::service::EncryptedIntroSetLookupHandler = typedef std::function<void(const std::vector<EncryptedIntroSet>&)>;
```


### using IntroSetLookupHandler

```cpp
using llarp::service::IntroSetLookupHandler = typedef std::function<void(const std::vector<IntroSet>&)>;
```


### using VanityNonce

```cpp
using llarp::service::VanityNonce = typedef AlignedBuffer<16>;
```

hidden service address 


## Functions Documentation

### function ParseAddress

```cpp
std::optional< std::variant< Address, RouterID > > ParseAddress(
    std::string_view lokinet_addr
)
```


### function AuthResultCodeAsInt

```cpp
uint64_t AuthResultCodeAsInt(
    AuthResultCode code
)
```

turn an auth result code into an int 

### function AuthResultCodeFromInt

```cpp
std::optional< AuthResultCode > AuthResultCodeFromInt(
    uint64_t code
)
```

may turn an int into an auth result code 

### function ParseAuthResultCode

```cpp
std::optional< AuthResultCode > ParseAuthResultCode(
    std::string data
)
```

maybe get auth result from string 

### function ParseAuthType

```cpp
AuthType ParseAuthType(
    std::string arg
)
```

get an auth type from a string throws std::invalid_argument if arg is invalid 

### function ParseAuthFileType

```cpp
AuthFileType ParseAuthFileType(
    std::string arg
)
```

get an auth file type from a string throws std::invalid_argument if arg is invalid 

### function MakeFileAuthPolicy

```cpp
std::shared_ptr< IAuthPolicy > MakeFileAuthPolicy(
    AbstractRouter * ,
    std::set< fs::path > files,
    AuthFileType fileType
)
```

make an [IAuthPolicy]() that reads out of a static file 

### function GetManyPathsWithUniqueEndpoints

```cpp
template <typename Endpoint_t >
static path::Path::UniqueEndpointSet_t GetManyPathsWithUniqueEndpoints(
    Endpoint_t * ep,
    size_t N,
    std::optional< dht::Key_t > maybeLocation =std::nullopt,
    size_t tries =10
)
```


### function operator==

```cpp
inline bool operator==(
    const Identity & lhs,
    const Identity & rhs
)
```


### function operator<

```cpp
inline bool operator<(
    const IntroSet & lhs,
    const IntroSet & rhs
)
```


### function operator==

```cpp
inline bool operator==(
    const IntroSet & lhs,
    const IntroSet & rhs
)
```


### function operator!=

```cpp
inline bool operator!=(
    const IntroSet & lhs,
    const IntroSet & rhs
)
```


### function operator<

```cpp
inline bool operator<(
    const EncryptedIntroSet & lhs,
    const EncryptedIntroSet & rhs
)
```


### function operator==

```cpp
inline bool operator==(
    const EncryptedIntroSet & lhs,
    const EncryptedIntroSet & rhs
)
```


### function operator!=

```cpp
inline bool operator!=(
    const EncryptedIntroSet & lhs,
    const EncryptedIntroSet & rhs
)
```


### function NameIsValid

```cpp
bool NameIsValid(
    std::string_view name
)
```

check if an lns name complies with the registration rules 

### function ToString

```cpp
constexpr std::string_view ToString(
    ProtocolType t
)
```



## Attributes Documentation

### variable IntrosetPublishInterval

```cpp
static constexpr auto IntrosetPublishInterval = path::intro_path_spread / 2;
```

minimum interval for publishing introsets 

### variable IntrosetPublishRetryCooldown

```cpp
static constexpr auto IntrosetPublishRetryCooldown = 1s;
```

how agressively should we retry publishing introset on failure 

### variable IntrosetLookupCooldown

```cpp
static constexpr auto IntrosetLookupCooldown = 250ms;
```

how aggressively should we retry looking up introsets 

### variable IntrosetLookupGraceInterval

```cpp
constexpr auto IntrosetLookupGraceInterval = 20s;
```

interval for which we will add to lookup timeout interval 

### variable MAX_INTROSET_SIZE

```cpp
constexpr std::size_t MAX_INTROSET_SIZE = 4096;
```


### variable MAX_INTROSET_TIME_DELTA

```cpp
constexpr llarp_time_t MAX_INTROSET_TIME_DELTA = 10s;
```


### variable MaxConcurrentLookups

```cpp
constexpr size_t MaxConcurrentLookups = size_t(16);
```


### variable MAX_PROTOCOL_MESSAGE_SIZE

```cpp
constexpr std::size_t MAX_PROTOCOL_MESSAGE_SIZE = 2048 * 2;
```


### variable SessionLifetime

```cpp
static constexpr auto SessionLifetime = path::default_lifetime * 2;
```





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

Updated on 2022-09-19 at 17:18:34 +0000