2018-06-22 13:59:28 +00:00
|
|
|
#ifndef LLARP_ROUTING_MESSAGE_HPP
|
|
|
|
#define LLARP_ROUTING_MESSAGE_HPP
|
|
|
|
|
|
|
|
#include <llarp/buffer.h>
|
|
|
|
#include <llarp/router.h>
|
2018-06-23 00:00:44 +00:00
|
|
|
#include <llarp/bencode.hpp>
|
2018-06-22 13:59:28 +00:00
|
|
|
#include <llarp/path_types.hpp>
|
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
namespace routing
|
|
|
|
{
|
|
|
|
struct IMessageHandler;
|
|
|
|
|
2018-06-23 00:00:44 +00:00
|
|
|
struct IMessage : public llarp::IBEncodeMessage
|
2018-06-22 13:59:28 +00:00
|
|
|
{
|
|
|
|
llarp::PathID_t from;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
HandleMessage(IMessageHandler* r) const = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct InboundMessageParser
|
|
|
|
{
|
|
|
|
InboundMessageParser();
|
|
|
|
bool
|
|
|
|
ParseMessageBuffer(llarp_buffer_t buf, IMessageHandler* handler);
|
|
|
|
|
|
|
|
private:
|
|
|
|
static bool
|
|
|
|
OnKey(dict_reader* r, llarp_buffer_t* key);
|
|
|
|
bool firstKey;
|
|
|
|
dict_reader reader;
|
|
|
|
IMessage* msg;
|
|
|
|
};
|
|
|
|
} // namespace routing
|
|
|
|
} // namespace llarp
|
|
|
|
|
|
|
|
#endif
|