llarp/link/factory.hpp

Namespaces

Name
llarp
[crypto.hpp]

Classes

Name
struct llarp::LinkFactory
LinkFactory is responsible for returning std::functions that create the link layer types.

Source code

#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 2026-01-10 at 22:49:45 +0000