mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-10-29 11:05:43 +00:00
baf8019fe5
This commit refactors functionality from the Router class into separate, dedicated classes. There are a few behavior changes that came as a result of discussion on what the correct behavior should be. In addition, many things Router was previously doing can now be provided callback functions to alert the calling point when the asynchronous action completes, successfully or otherwise.
44 lines
817 B
C++
44 lines
817 B
C++
#ifndef LLARP_ROUTER_I_OUTBOUND_MESSAGE_HANDLER_HPP
|
|
#define LLARP_ROUTER_I_OUTBOUND_MESSAGE_HANDLER_HPP
|
|
|
|
#include <cstdint>
|
|
#include <functional>
|
|
|
|
namespace llarp
|
|
{
|
|
enum class SendStatus
|
|
{
|
|
Success,
|
|
Timeout,
|
|
NoLink,
|
|
InvalidRouter,
|
|
RouterNotFound,
|
|
Congestion
|
|
};
|
|
|
|
struct ILinkMessage;
|
|
struct RouterID;
|
|
|
|
namespace util
|
|
{
|
|
struct StatusObject;
|
|
}
|
|
|
|
using SendStatusHandler = std::function< void(SendStatus) >;
|
|
|
|
struct IOutboundMessageHandler
|
|
{
|
|
virtual ~IOutboundMessageHandler() = default;
|
|
|
|
virtual bool
|
|
QueueMessage(const RouterID &remote, const ILinkMessage *msg,
|
|
SendStatusHandler callback) = 0;
|
|
|
|
virtual util::StatusObject
|
|
ExtractStatus() const = 0;
|
|
};
|
|
|
|
} // namespace llarp
|
|
|
|
#endif // LLARP_ROUTER_I_OUTBOUND_MESSAGE_HANDLER_HPP
|