2021-03-09 22:24:35 +00:00
|
|
|
#pragma once
|
2018-06-22 13:59:28 +00:00
|
|
|
|
2019-04-23 14:28:59 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2018-06-22 13:59:28 +00:00
|
|
|
namespace llarp
|
|
|
|
{
|
2019-02-11 19:45:42 +00:00
|
|
|
struct AbstractRouter;
|
|
|
|
|
|
|
|
namespace dht
|
|
|
|
{
|
2023-08-29 14:26:59 +00:00
|
|
|
struct AbstractDHTMessage;
|
2019-02-11 19:45:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace service
|
|
|
|
{
|
2023-08-31 16:28:02 +00:00
|
|
|
struct ProtocolFrameMessage;
|
2019-02-11 19:45:42 +00:00
|
|
|
}
|
|
|
|
|
2018-06-22 13:59:28 +00:00
|
|
|
namespace routing
|
|
|
|
{
|
2018-09-11 15:28:36 +00:00
|
|
|
struct DataDiscardMessage;
|
2019-02-11 19:45:42 +00:00
|
|
|
struct GrantExitMessage;
|
|
|
|
struct ObtainExitMessage;
|
|
|
|
struct RejectExitMessage;
|
|
|
|
struct TransferTrafficMessage;
|
|
|
|
struct UpdateExitMessage;
|
|
|
|
struct UpdateExitVerifyMessage;
|
|
|
|
struct CloseExitMessage;
|
|
|
|
struct PathTransferMessage;
|
|
|
|
struct PathConfirmMessage;
|
|
|
|
struct PathLatencyMessage;
|
2018-09-11 15:28:36 +00:00
|
|
|
|
2018-06-26 16:23:43 +00:00
|
|
|
// handles messages on the routing level
|
2023-08-29 14:26:59 +00:00
|
|
|
struct AbstractRoutingMessageHandler
|
2018-06-22 13:59:28 +00:00
|
|
|
{
|
2018-11-12 16:43:40 +00:00
|
|
|
virtual bool
|
2020-04-07 18:38:56 +00:00
|
|
|
HandleObtainExitMessage(const ObtainExitMessage& msg, AbstractRouter* r) = 0;
|
2018-11-12 16:43:40 +00:00
|
|
|
|
|
|
|
virtual bool
|
2020-04-07 18:38:56 +00:00
|
|
|
HandleGrantExitMessage(const GrantExitMessage& msg, AbstractRouter* r) = 0;
|
2018-11-12 16:43:40 +00:00
|
|
|
|
|
|
|
virtual bool
|
2020-04-07 18:38:56 +00:00
|
|
|
HandleRejectExitMessage(const RejectExitMessage& msg, AbstractRouter* r) = 0;
|
2018-11-12 16:43:40 +00:00
|
|
|
|
|
|
|
virtual bool
|
2020-04-07 18:38:56 +00:00
|
|
|
HandleTransferTrafficMessage(const TransferTrafficMessage& msg, AbstractRouter* r) = 0;
|
2018-11-12 16:43:40 +00:00
|
|
|
|
|
|
|
virtual bool
|
2020-04-07 18:38:56 +00:00
|
|
|
HandleUpdateExitMessage(const UpdateExitMessage& msg, AbstractRouter* r) = 0;
|
2018-11-12 16:43:40 +00:00
|
|
|
|
2018-11-14 12:23:08 +00:00
|
|
|
virtual bool
|
2020-04-07 18:38:56 +00:00
|
|
|
HandleUpdateExitVerifyMessage(const UpdateExitVerifyMessage& msg, AbstractRouter* r) = 0;
|
2018-11-14 12:23:08 +00:00
|
|
|
|
2018-11-12 16:43:40 +00:00
|
|
|
virtual bool
|
2020-04-07 18:38:56 +00:00
|
|
|
HandleCloseExitMessage(const CloseExitMessage& msg, AbstractRouter* r) = 0;
|
2018-11-12 16:43:40 +00:00
|
|
|
|
2018-09-11 15:28:36 +00:00
|
|
|
virtual bool
|
2020-04-07 18:38:56 +00:00
|
|
|
HandleDataDiscardMessage(const DataDiscardMessage& msg, AbstractRouter* r) = 0;
|
2018-09-11 15:28:36 +00:00
|
|
|
|
2018-06-23 00:00:44 +00:00
|
|
|
virtual bool
|
2020-04-07 18:38:56 +00:00
|
|
|
HandlePathTransferMessage(const PathTransferMessage& msg, AbstractRouter* r) = 0;
|
2018-06-25 15:12:08 +00:00
|
|
|
|
|
|
|
virtual bool
|
2023-08-31 16:28:02 +00:00
|
|
|
HandleHiddenServiceFrame(const service::ProtocolFrameMessage& msg) = 0;
|
2018-06-25 15:12:08 +00:00
|
|
|
|
|
|
|
virtual bool
|
2020-04-07 18:38:56 +00:00
|
|
|
HandlePathConfirmMessage(const PathConfirmMessage& msg, AbstractRouter* r) = 0;
|
2018-06-25 15:12:08 +00:00
|
|
|
|
|
|
|
virtual bool
|
2020-04-07 18:38:56 +00:00
|
|
|
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;
|
2018-06-22 13:59:28 +00:00
|
|
|
};
|
2019-04-23 14:28:59 +00:00
|
|
|
|
2023-08-29 14:26:59 +00:00
|
|
|
using MessageHandler_ptr = std::shared_ptr<AbstractRoutingMessageHandler>;
|
2019-04-23 14:28:59 +00:00
|
|
|
|
2018-06-22 13:59:28 +00:00
|
|
|
} // namespace routing
|
|
|
|
} // namespace llarp
|