lokinet/llarp/router/i_outbound_session_maker.hpp
Thomas Winget 7caa87862e standardize include format and pragma once
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.
2021-03-09 19:01:41 -05:00

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