2021-03-09 22:24:35 +00:00
|
|
|
#pragma once
|
2019-01-10 19:41:51 +00:00
|
|
|
|
2021-03-09 22:24:35 +00:00
|
|
|
#include <llarp/util/bencode.h>
|
|
|
|
#include <llarp/util/buffer.hpp>
|
2018-12-27 14:32:37 +00:00
|
|
|
|
2019-02-11 19:45:42 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2019-01-10 19:41:51 +00:00
|
|
|
namespace llarp
|
2018-12-27 14:32:37 +00:00
|
|
|
{
|
2019-02-11 19:45:42 +00:00
|
|
|
struct AbstractRouter;
|
|
|
|
struct PathID_t;
|
2018-12-27 14:32:37 +00:00
|
|
|
|
2019-01-10 19:41:51 +00:00
|
|
|
namespace routing
|
2018-12-27 14:32:37 +00:00
|
|
|
{
|
2023-08-29 14:26:59 +00:00
|
|
|
struct AbstractRoutingMessage;
|
|
|
|
struct AbstractRoutingMessageHandler;
|
2018-12-27 14:32:37 +00:00
|
|
|
|
|
|
|
struct InboundMessageParser
|
|
|
|
{
|
|
|
|
InboundMessageParser();
|
2019-02-11 19:45:42 +00:00
|
|
|
~InboundMessageParser();
|
2018-12-27 14:32:37 +00:00
|
|
|
|
|
|
|
bool
|
2020-04-07 18:38:56 +00:00
|
|
|
ParseMessageBuffer(
|
|
|
|
const llarp_buffer_t& buf,
|
2023-08-29 14:26:59 +00:00
|
|
|
AbstractRoutingMessageHandler* handler,
|
2020-04-07 18:38:56 +00:00
|
|
|
const PathID_t& from,
|
|
|
|
AbstractRouter* r);
|
2018-12-27 14:32:37 +00:00
|
|
|
|
2019-05-22 00:36:03 +00:00
|
|
|
bool
|
|
|
|
operator()(llarp_buffer_t* buffer, llarp_buffer_t* key);
|
2019-02-11 19:45:42 +00:00
|
|
|
|
2019-05-22 00:36:03 +00:00
|
|
|
private:
|
2019-11-03 15:31:01 +00:00
|
|
|
uint64_t version = 0;
|
2019-07-30 23:42:13 +00:00
|
|
|
bool firstKey{false};
|
|
|
|
char ourKey{'\0'};
|
2019-02-11 19:45:42 +00:00
|
|
|
struct MessageHolder;
|
|
|
|
|
2023-08-29 14:26:59 +00:00
|
|
|
AbstractRoutingMessage* msg{nullptr};
|
2020-04-07 18:38:56 +00:00
|
|
|
std::unique_ptr<MessageHolder> m_Holder;
|
2018-12-27 14:32:37 +00:00
|
|
|
};
|
2019-01-17 14:02:50 +00:00
|
|
|
} // namespace routing
|
|
|
|
} // namespace llarp
|