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.
58 lines
1.2 KiB
C++
58 lines
1.2 KiB
C++
#ifndef LLARP_ROUTER_I_OUTBOUND_SESSION_MAKER_HPP
|
|
#define LLARP_ROUTER_I_OUTBOUND_SESSION_MAKER_HPP
|
|
|
|
#include <util/status.hpp>
|
|
#include <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
|
|
|
|
#endif // LLARP_ROUTER_I_OUTBOUND_SESSION_MAKER_HPP
|