mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-11 07:10:36 +00:00
273270916e
This commit reflects changes to clang-format rules. Unfortunately, these rule changes create a massive change to the codebase, which causes an apparent rewrite of git history. Git blame's --ignore-rev flag can be used to ignore this commit when attempting to `git blame` some code.
51 lines
1.1 KiB
C++
51 lines
1.1 KiB
C++
#ifndef LLARP_LINK_FACTORY_HPP
|
|
#define LLARP_LINK_FACTORY_HPP
|
|
#include <util/string_view.hpp>
|
|
#include <config/key_manager.hpp>
|
|
#include <functional>
|
|
#include <memory>
|
|
|
|
#include <link/server.hpp>
|
|
|
|
namespace llarp
|
|
{
|
|
/// LinkFactory is responsible for returning std::functions that create the
|
|
/// link layer types
|
|
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)>;
|
|
|
|
/// get link type by name string
|
|
/// if invalid returns eLinkUnspec
|
|
static LinkType
|
|
TypeFromName(string_view name);
|
|
|
|
/// turns a link type into a string representation
|
|
static std::string
|
|
NameFromType(LinkType t);
|
|
|
|
/// obtain a link factory of a certain type
|
|
static Factory
|
|
Obtain(LinkType t, bool permitInbound);
|
|
};
|
|
|
|
} // namespace llarp
|
|
|
|
#endif |