2018-12-27 14:32:37 +00:00
|
|
|
#ifndef LLARP_ROUTING_MESSAGE_PARSER_HPP
|
|
|
|
#define LLARP_ROUTING_MESSAGE_PARSER_HPP
|
2019-01-10 19:41:51 +00:00
|
|
|
|
2018-12-27 14:32:37 +00:00
|
|
|
#include <messages/dht.hpp>
|
|
|
|
#include <messages/discard.hpp>
|
|
|
|
#include <messages/path_confirm.hpp>
|
|
|
|
#include <messages/path_latency.hpp>
|
|
|
|
#include <messages/path_transfer.hpp>
|
2019-01-11 01:19:36 +00:00
|
|
|
#include <path/path_types.hpp>
|
2019-01-10 19:41:51 +00:00
|
|
|
#include <util/bencode.hpp>
|
|
|
|
#include <util/buffer.h>
|
2018-12-27 14:32:37 +00:00
|
|
|
|
2019-01-10 19:41:51 +00:00
|
|
|
namespace llarp
|
2018-12-27 14:32:37 +00:00
|
|
|
{
|
|
|
|
struct Router;
|
|
|
|
|
2019-01-10 19:41:51 +00:00
|
|
|
namespace routing
|
2018-12-27 14:32:37 +00:00
|
|
|
{
|
|
|
|
struct IMessageHandler;
|
|
|
|
|
|
|
|
struct InboundMessageParser
|
|
|
|
{
|
|
|
|
InboundMessageParser();
|
|
|
|
|
|
|
|
bool
|
|
|
|
ParseMessageBuffer(llarp_buffer_t buf, IMessageHandler* handler,
|
|
|
|
const PathID_t& from, llarp::Router* r);
|
|
|
|
|
|
|
|
private:
|
|
|
|
static bool
|
|
|
|
OnKey(dict_reader* r, llarp_buffer_t* key);
|
|
|
|
bool firstKey;
|
|
|
|
char key;
|
|
|
|
dict_reader reader;
|
2019-01-10 19:41:51 +00:00
|
|
|
|
|
|
|
struct MessageHolder
|
2018-12-27 14:32:37 +00:00
|
|
|
{
|
|
|
|
DataDiscardMessage D;
|
|
|
|
PathLatencyMessage L;
|
|
|
|
DHTMessage M;
|
|
|
|
PathConfirmMessage P;
|
|
|
|
PathTransferMessage T;
|
|
|
|
service::ProtocolFrame H;
|
|
|
|
TransferTrafficMessage I;
|
|
|
|
GrantExitMessage G;
|
|
|
|
RejectExitMessage J;
|
|
|
|
ObtainExitMessage O;
|
|
|
|
UpdateExitMessage U;
|
|
|
|
CloseExitMessage C;
|
|
|
|
};
|
|
|
|
|
2019-01-17 14:02:50 +00:00
|
|
|
IMessage* msg = nullptr;
|
2018-12-27 14:32:37 +00:00
|
|
|
MessageHolder m_Holder;
|
|
|
|
};
|
2019-01-17 14:02:50 +00:00
|
|
|
} // namespace routing
|
|
|
|
} // namespace llarp
|
2019-01-10 19:41:51 +00:00
|
|
|
#endif
|