lokinet/llarp/routing/handler.hpp

93 lines
2.5 KiB
C++
Raw Normal View History

#ifndef LLARP_ROUTING_HANDLER_HPP
#define LLARP_ROUTING_HANDLER_HPP
#include <memory>
namespace llarp
{
struct AbstractRouter;
namespace dht
{
struct IMessage;
}
namespace service
{
struct ProtocolFrame;
}
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
struct IMessageHandler
{
virtual bool
HandleObtainExitMessage(const ObtainExitMessage& msg,
2019-04-23 16:13:22 +00:00
AbstractRouter* r) = 0;
virtual bool
HandleGrantExitMessage(const GrantExitMessage& msg,
2019-04-23 16:13:22 +00:00
AbstractRouter* r) = 0;
virtual bool
HandleRejectExitMessage(const RejectExitMessage& msg,
2019-04-23 16:13:22 +00:00
AbstractRouter* r) = 0;
virtual bool
HandleTransferTrafficMessage(const TransferTrafficMessage& msg,
2019-04-23 16:13:22 +00:00
AbstractRouter* r) = 0;
virtual bool
HandleUpdateExitMessage(const UpdateExitMessage& msg,
2019-04-23 16:13:22 +00:00
AbstractRouter* r) = 0;
2018-11-14 12:23:08 +00:00
virtual bool
HandleUpdateExitVerifyMessage(const UpdateExitVerifyMessage& msg,
2019-04-23 16:13:22 +00:00
AbstractRouter* r) = 0;
2018-11-14 12:23:08 +00:00
virtual bool
HandleCloseExitMessage(const CloseExitMessage& msg,
2019-04-23 16:13:22 +00:00
AbstractRouter* r) = 0;
virtual bool
HandleDataDiscardMessage(const DataDiscardMessage& msg,
2019-04-23 16:13:22 +00:00
AbstractRouter* r) = 0;
2018-06-23 00:00:44 +00:00
virtual bool
HandlePathTransferMessage(const PathTransferMessage& msg,
2019-04-23 16:13:22 +00:00
AbstractRouter* r) = 0;
virtual bool
HandleHiddenServiceFrame(const service::ProtocolFrame& msg) = 0;
virtual bool
HandlePathConfirmMessage(const PathConfirmMessage& msg,
2019-04-23 16:13:22 +00:00
AbstractRouter* r) = 0;
virtual bool
HandlePathLatencyMessage(const PathLatencyMessage& msg,
2019-04-23 16:13:22 +00:00
AbstractRouter* r) = 0;
2018-06-26 16:23:43 +00:00
virtual bool
2019-04-23 16:13:22 +00:00
HandleDHTMessage(const dht::IMessage& msg, AbstractRouter* r) = 0;
};
2019-04-23 16:13:22 +00:00
using MessageHandler_ptr = std::shared_ptr< IMessageHandler >;
} // namespace routing
} // namespace llarp
#endif