2018-05-25 17:52:10 +00:00
|
|
|
#ifndef LLARP_LINK_MESSAGE_HPP
|
|
|
|
#define LLARP_LINK_MESSAGE_HPP
|
|
|
|
|
2018-12-12 01:32:10 +00:00
|
|
|
#include <link/session.hpp>
|
2018-12-12 02:52:51 +00:00
|
|
|
#include <router_id.hpp>
|
2019-01-10 19:41:51 +00:00
|
|
|
#include <util/bencode.hpp>
|
2018-05-25 17:52:10 +00:00
|
|
|
|
|
|
|
#include <queue>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
{
|
2018-09-02 18:25:42 +00:00
|
|
|
struct ILinkSession;
|
2018-12-10 16:26:46 +00:00
|
|
|
struct Router;
|
2018-06-01 14:08:54 +00:00
|
|
|
|
2018-11-22 23:59:03 +00:00
|
|
|
using SendQueue = std::queue< ILinkMessage* >;
|
2018-06-01 14:08:54 +00:00
|
|
|
|
|
|
|
/// parsed link layer message
|
2018-06-23 00:00:44 +00:00
|
|
|
struct ILinkMessage : public IBEncodeMessage
|
2018-05-25 17:52:10 +00:00
|
|
|
{
|
2018-09-02 18:25:42 +00:00
|
|
|
/// who did this message come from or is going to
|
2018-12-20 16:49:05 +00:00
|
|
|
ILinkSession* session = nullptr;
|
|
|
|
uint64_t version = 0;
|
2018-06-01 14:08:54 +00:00
|
|
|
|
2018-12-20 16:49:05 +00:00
|
|
|
ILinkMessage() = default;
|
2018-09-02 18:25:42 +00:00
|
|
|
|
|
|
|
virtual ~ILinkMessage()
|
|
|
|
{
|
|
|
|
}
|
2018-06-01 14:08:54 +00:00
|
|
|
|
|
|
|
virtual bool
|
2018-12-10 16:26:46 +00:00
|
|
|
HandleMessage(Router* router) const = 0;
|
2018-05-25 17:52:10 +00:00
|
|
|
|
2018-12-20 16:49:05 +00:00
|
|
|
virtual void
|
|
|
|
Clear() = 0;
|
2018-05-25 17:52:10 +00:00
|
|
|
};
|
2018-12-20 16:49:05 +00:00
|
|
|
|
2018-06-23 00:00:44 +00:00
|
|
|
} // namespace llarp
|
2018-05-25 17:52:10 +00:00
|
|
|
|
|
|
|
#endif
|