lokinet/llarp/routing/message.hpp

46 lines
798 B
C++
Raw Normal View History

#ifndef LLARP_ROUTING_MESSAGE_HPP
#define LLARP_ROUTING_MESSAGE_HPP
2019-05-24 02:01:36 +00:00
#include <constants/proto.hpp>
2019-01-11 01:19:36 +00:00
#include <path/path_types.hpp>
2019-02-02 23:12:42 +00:00
#include <util/buffer.hpp>
namespace llarp
{
struct AbstractRouter;
namespace routing
{
struct IMessageHandler;
2019-05-24 02:01:36 +00:00
struct IMessage
{
PathID_t from;
uint64_t S;
2019-05-24 02:01:36 +00:00
uint64_t version = LLARP_PROTO_VERSION;
2018-09-17 15:32:37 +00:00
2019-05-24 02:01:36 +00:00
IMessage() : S(0)
2018-09-17 15:32:37 +00:00
{
}
virtual ~IMessage()
{
}
2018-09-17 15:32:37 +00:00
2019-05-24 02:01:36 +00:00
virtual bool
BEncode(llarp_buffer_t* buf) const = 0;
virtual bool
DecodeKey(const llarp_buffer_t& key, llarp_buffer_t* buf) = 0;
virtual bool
HandleMessage(IMessageHandler* h, AbstractRouter* r) const = 0;
virtual void
Clear() = 0;
};
} // namespace routing
} // namespace llarp
2018-09-17 15:32:37 +00:00
#endif