lokinet/llarp/routing/handler.hpp

79 lines
2.1 KiB
C++
Raw Normal View History

#pragma once
#include <memory>
namespace llarp
{
struct AbstractRouter;
namespace dht
{
2023-08-29 14:26:59 +00:00
struct AbstractDHTMessage;
}
namespace service
{
struct ProtocolFrameMessage;
}
namespace routing
{
struct DataDiscardMessage;
struct GrantExitMessage;
struct ObtainExitMessage;
struct RejectExitMessage;
struct TransferTrafficMessage;
struct UpdateExitMessage;
struct UpdateExitVerifyMessage;
struct CloseExitMessage;
struct PathTransferMessage;
struct PathConfirmMessage;
struct PathLatencyMessage;
2018-06-26 16:23:43 +00:00
// handles messages on the routing level
2023-08-29 14:26:59 +00:00
struct AbstractRoutingMessageHandler
{
virtual bool
HandleObtainExitMessage(const ObtainExitMessage& msg, AbstractRouter* r) = 0;
virtual bool
HandleGrantExitMessage(const GrantExitMessage& msg, AbstractRouter* r) = 0;
virtual bool
HandleRejectExitMessage(const RejectExitMessage& msg, AbstractRouter* r) = 0;
virtual bool
HandleTransferTrafficMessage(const TransferTrafficMessage& msg, AbstractRouter* r) = 0;
virtual bool
HandleUpdateExitMessage(const UpdateExitMessage& msg, AbstractRouter* r) = 0;
2018-11-14 12:23:08 +00:00
virtual bool
HandleUpdateExitVerifyMessage(const UpdateExitVerifyMessage& msg, AbstractRouter* r) = 0;
2018-11-14 12:23:08 +00:00
virtual bool
HandleCloseExitMessage(const CloseExitMessage& msg, AbstractRouter* r) = 0;
virtual bool
HandleDataDiscardMessage(const DataDiscardMessage& msg, AbstractRouter* r) = 0;
2018-06-23 00:00:44 +00:00
virtual bool
HandlePathTransferMessage(const PathTransferMessage& msg, AbstractRouter* r) = 0;
virtual bool
HandleHiddenServiceFrame(const service::ProtocolFrameMessage& msg) = 0;
virtual bool
HandlePathConfirmMessage(const PathConfirmMessage& msg, AbstractRouter* r) = 0;
virtual bool
HandlePathLatencyMessage(const PathLatencyMessage& msg, AbstractRouter* r) = 0;
2018-06-26 16:23:43 +00:00
virtual bool
2023-08-29 14:26:59 +00:00
HandleDHTMessage(const dht::AbstractDHTMessage& msg, AbstractRouter* r) = 0;
};
2023-08-29 14:26:59 +00:00
using MessageHandler_ptr = std::shared_ptr<AbstractRoutingMessageHandler>;
} // namespace routing
} // namespace llarp