2019-06-26 21:39:29 +00:00
|
|
|
#ifndef LLARP_ROUTER_I_OUTBOUND_MESSAGE_HANDLER_HPP
|
|
|
|
#define LLARP_ROUTER_I_OUTBOUND_MESSAGE_HANDLER_HPP
|
|
|
|
|
2019-08-19 09:33:26 +00:00
|
|
|
#include <util/status.hpp>
|
|
|
|
|
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
|
|
|
|
|
|
|
using SendStatusHandler = std::function< void(SendStatus) >;
|
|
|
|
|
2019-10-25 21:13:11 +00:00
|
|
|
static const size_t MAX_PATH_QUEUE_SIZE = 40;
|
|
|
|
static const size_t MAX_OUTBOUND_QUEUE_SIZE = 200;
|
|
|
|
static const size_t MAX_OUTBOUND_MESSAGES_PER_TICK = 20;
|
|
|
|
|
2019-06-26 21:39:29 +00:00
|
|
|
struct IOutboundMessageHandler
|
|
|
|
{
|
|
|
|
virtual ~IOutboundMessageHandler() = default;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
QueueMessage(const RouterID &remote, const ILinkMessage *msg,
|
|
|
|
SendStatusHandler callback) = 0;
|
|
|
|
|
2019-10-25 21:13:11 +00:00
|
|
|
virtual void
|
|
|
|
Tick() = 0;
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
QueueRemoveEmptyPath(const PathID_t &pathid) = 0;
|
|
|
|
|
2019-06-26 21:39:29 +00:00
|
|
|
virtual util::StatusObject
|
|
|
|
ExtractStatus() const = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace llarp
|
|
|
|
|
|
|
|
#endif // LLARP_ROUTER_I_OUTBOUND_MESSAGE_HANDLER_HPP
|