lokinet/llarp/router/i_rc_lookup_handler.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

64 lines
1.3 KiB
C++

#pragma once
#include <llarp/util/types.hpp>
#include <llarp/router_id.hpp>
#include <memory>
#include <set>
#include <vector>
namespace llarp
{
struct RouterContact;
enum class RCRequestResult
{
Success,
InvalidRouter,
RouterNotFound,
BadRC
};
using RCRequestCallback =
std::function<void(const RouterID&, const RouterContact* const, const RCRequestResult)>;
struct I_RCLookupHandler
{
virtual ~I_RCLookupHandler() = default;
virtual void
AddValidRouter(const RouterID& router) = 0;
virtual void
RemoveValidRouter(const RouterID& router) = 0;
virtual void
SetRouterWhitelist(const std::vector<RouterID>& routers) = 0;
virtual void
GetRC(const RouterID& router, RCRequestCallback callback, bool forceLookup = false) = 0;
virtual bool
RemoteIsAllowed(const RouterID& remote) const = 0;
virtual bool
CheckRC(const RouterContact& rc) const = 0;
virtual bool
GetRandomWhitelistRouter(RouterID& router) const = 0;
virtual bool
CheckRenegotiateValid(RouterContact newrc, RouterContact oldrc) = 0;
virtual void
PeriodicUpdate(llarp_time_t now) = 0;
virtual void
ExploreNetwork() = 0;
virtual size_t
NumberOfStrictConnectRouters() const = 0;
};
} // namespace llarp