2021-03-09 22:24:35 +00:00
|
|
|
#pragma once
|
2019-06-26 21:39:29 +00:00
|
|
|
|
2021-03-09 22:24:35 +00:00
|
|
|
#include <llarp/util/status.hpp>
|
2019-08-19 09:33:26 +00:00
|
|
|
|
2019-06-26 21:39:29 +00:00
|
|
|
#include <cstdint>
|
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
enum class SendStatus
|
|
|
|
{
|
|
|
|
Success,
|
|
|
|
Timeout,
|
|
|
|
NoLink,
|
|
|
|
InvalidRouter,
|
|
|
|
RouterNotFound,
|
|
|
|
Congestion
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ILinkMessage;
|
|
|
|
struct RouterID;
|
2019-10-25 21:13:11 +00:00
|
|
|
struct PathID_t;
|
2019-06-26 21:39:29 +00:00
|
|
|
|
2020-04-07 18:38:56 +00:00
|
|
|
using SendStatusHandler = std::function<void(SendStatus)>;
|
2019-06-26 21:39:29 +00:00
|
|
|
|
2020-05-21 14:27:41 +00:00
|
|
|
static const size_t MAX_PATH_QUEUE_SIZE = 100;
|
|
|
|
static const size_t MAX_OUTBOUND_QUEUE_SIZE = 1000;
|
|
|
|
static const size_t MAX_OUTBOUND_MESSAGES_PER_TICK = 500;
|
2019-10-25 21:13:11 +00:00
|
|
|
|
2019-06-26 21:39:29 +00:00
|
|
|
struct IOutboundMessageHandler
|
|
|
|
{
|
|
|
|
virtual ~IOutboundMessageHandler() = default;
|
|
|
|
|
|
|
|
virtual bool
|
2021-04-12 11:39:07 +00:00
|
|
|
QueueMessage(const RouterID& remote, const ILinkMessage& msg, SendStatusHandler callback) = 0;
|
2019-06-26 21:39:29 +00:00
|
|
|
|
2019-10-25 21:13:11 +00:00
|
|
|
virtual void
|
2021-11-11 14:17:48 +00:00
|
|
|
Pump() = 0;
|
2019-10-25 21:13:11 +00:00
|
|
|
|
|
|
|
virtual void
|
2021-04-29 22:54:43 +00:00
|
|
|
RemovePath(const PathID_t& pathid) = 0;
|
2019-10-25 21:13:11 +00:00
|
|
|
|
2019-06-26 21:39:29 +00:00
|
|
|
virtual util::StatusObject
|
|
|
|
ExtractStatus() const = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace llarp
|