mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-11 07:10:36 +00:00
7caa87862e
All #ifndef guards on headers have been removed, I think, in favor of #pragma once Headers are now included as `#include "filename"` if the included file resides in the same directory as the file including it, or any subdirectory therein. Otherwise they are included as `#include <project/top/dir/relative/path/filename>` The above does not include system/os headers.
49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
#pragma once
|
|
#include <llarp/config/key_manager.hpp>
|
|
#include <string_view>
|
|
#include <functional>
|
|
#include <memory>
|
|
|
|
#include "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(std::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
|