---
title: llarp/link/factory.hpp

---

# llarp/link/factory.hpp



## Namespaces

| Name           |
| -------------- |
| **[llarp](Namespaces/namespacellarp.md)** <br>[crypto.hpp] |

## Classes

|                | Name           |
| -------------- | -------------- |
| struct | **[llarp::LinkFactory](Classes/structllarp_1_1LinkFactory.md)** <br>[LinkFactory]() is responsible for returning std::functions that create the link layer types.  |




## Source code

```cpp
#pragma once
#include <llarp/config/key_manager.hpp>
#include <string_view>
#include <functional>
#include <memory>

#include "server.hpp"

namespace llarp
{
  struct LinkFactory
  {
    enum class LinkType
    {
      eLinkUTP,
      eLinkIWP,
      eLinkMempipe,
      eLinkUnknown
    };

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

    static LinkType
    TypeFromName(std::string_view name);

    static std::string
    NameFromType(LinkType t);

    static Factory
    Obtain(LinkType t, bool permitInbound);
  };

}  // namespace llarp
```


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

Updated on 2023-01-09 at 18:23:49 +0000
