mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-03 23:15:52 +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.
55 lines
1.1 KiB
C++
55 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <llarp/util/status.hpp>
|
|
#include <llarp/util/types.hpp>
|
|
|
|
#include <functional>
|
|
|
|
namespace llarp
|
|
{
|
|
struct ILinkSession;
|
|
struct RouterID;
|
|
struct RouterContact;
|
|
|
|
enum class SessionResult
|
|
{
|
|
Establish,
|
|
Timeout,
|
|
RouterNotFound,
|
|
InvalidRouter,
|
|
NoLink
|
|
};
|
|
|
|
using RouterCallback = std::function<void(const RouterID&, const SessionResult)>;
|
|
|
|
struct IOutboundSessionMaker
|
|
{
|
|
virtual ~IOutboundSessionMaker() = default;
|
|
|
|
virtual bool
|
|
OnSessionEstablished(ILinkSession* session) = 0;
|
|
|
|
virtual void
|
|
OnConnectTimeout(ILinkSession* session) = 0;
|
|
|
|
virtual void
|
|
CreateSessionTo(const RouterID& router, RouterCallback on_result) = 0;
|
|
|
|
virtual void
|
|
CreateSessionTo(const RouterContact& rc, RouterCallback on_result) = 0;
|
|
|
|
virtual bool
|
|
HavePendingSessionTo(const RouterID& router) const = 0;
|
|
|
|
virtual void
|
|
ConnectToRandomRouters(int numDesired) = 0;
|
|
|
|
virtual util::StatusObject
|
|
ExtractStatus() const = 0;
|
|
|
|
virtual bool
|
|
ShouldConnectTo(const RouterID& router) const = 0;
|
|
};
|
|
|
|
} // namespace llarp
|