---
title: llarp::LinkFactory
summary: LinkFactory is responsible for returning std::functions that create the link layer types. 

---

# llarp::LinkFactory



[LinkFactory]() is responsible for returning std::functions that create the link layer types. 


`#include <factory.hpp>`

## Public Types

|                | Name           |
| -------------- | -------------- |
| enum class| **[LinkType](Classes/structllarp_1_1LinkFactory.md#enum-linktype)** { eLinkUTP, eLinkIWP, eLinkMempipe, eLinkUnknown} |
| using std::function< LinkLayer_ptr(std::shared_ptr< [KeyManager](Classes/structllarp_1_1KeyManager.md) >, [GetRCFunc](Namespaces/namespacellarp.md#using-getrcfunc), [LinkMessageHandler](Namespaces/namespacellarp.md#using-linkmessagehandler), [SignBufferFunc](Namespaces/namespacellarp.md#using-signbufferfunc), [SessionEstablishedHandler](Namespaces/namespacellarp.md#using-sessionestablishedhandler), [SessionRenegotiateHandler](Namespaces/namespacellarp.md#using-sessionrenegotiatehandler), [TimeoutHandler](Namespaces/namespacellarp.md#using-timeouthandler), [SessionClosedHandler](Namespaces/namespacellarp.md#using-sessionclosedhandler), [PumpDoneHandler](Namespaces/namespacellarp.md#using-pumpdonehandler))> | **[Factory](Classes/structllarp_1_1LinkFactory.md#using-factory)**  |

## Public Functions

|                | Name           |
| -------------- | -------------- |
| LinkType | **[TypeFromName](Classes/structllarp_1_1LinkFactory.md#function-typefromname)**(std::string_view name)<br>get link type by name string if invalid returns eLinkUnspec  |
| std::string | **[NameFromType](Classes/structllarp_1_1LinkFactory.md#function-namefromtype)**(LinkType t)<br>turns a link type into a string representation  |
| Factory | **[Obtain](Classes/structllarp_1_1LinkFactory.md#function-obtain)**(LinkType t, bool permitInbound)<br>obtain a link factory of a certain type  |

## Public Types Documentation

### enum LinkType

| Enumerator | Value | Description |
| ---------- | ----- | ----------- |
| eLinkUTP | |   |
| eLinkIWP | |   |
| eLinkMempipe | |   |
| eLinkUnknown | |   |




### using Factory

```cpp
using llarp::LinkFactory::Factory =  std::function<LinkLayer_ptr( std::shared_ptr<KeyManager>, GetRCFunc, LinkMessageHandler, SignBufferFunc, SessionEstablishedHandler, SessionRenegotiateHandler, TimeoutHandler, SessionClosedHandler, PumpDoneHandler)>;
```


## Public Functions Documentation

### function TypeFromName

```cpp
static LinkType TypeFromName(
    std::string_view name
)
```

get link type by name string if invalid returns eLinkUnspec 

### function NameFromType

```cpp
static std::string NameFromType(
    LinkType t
)
```

turns a link type into a string representation 

### function Obtain

```cpp
static Factory Obtain(
    LinkType t,
    bool permitInbound
)
```

obtain a link factory of a certain type 

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

Updated on 2023-01-20 at 23:19:38 +0000