2021-03-09 22:24:35 +00:00
|
|
|
#pragma once
|
2018-12-12 02:15:08 +00:00
|
|
|
|
2021-03-09 22:24:35 +00:00
|
|
|
#include <llarp/crypto/types.hpp>
|
|
|
|
#include <llarp/path/path.hpp>
|
|
|
|
#include "intro_set.hpp"
|
2021-03-12 13:50:21 +00:00
|
|
|
#include "convotag.hpp"
|
2019-07-15 09:15:51 +00:00
|
|
|
|
2019-05-03 13:15:03 +00:00
|
|
|
#include <memory>
|
2019-07-15 09:15:51 +00:00
|
|
|
#include <set>
|
2018-09-14 13:43:42 +00:00
|
|
|
|
2018-08-08 19:37:33 +00:00
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
namespace service
|
|
|
|
{
|
2019-11-28 23:08:02 +00:00
|
|
|
struct ProtocolMessage;
|
|
|
|
|
|
|
|
struct RecvDataEvent
|
|
|
|
{
|
|
|
|
path::Path_ptr fromPath;
|
|
|
|
PathID_t pathid;
|
2020-04-07 18:38:56 +00:00
|
|
|
std::shared_ptr<ProtocolMessage> msg;
|
2019-11-28 23:08:02 +00:00
|
|
|
};
|
2018-08-09 19:02:17 +00:00
|
|
|
|
|
|
|
struct ProtocolMessage;
|
2018-08-08 19:37:33 +00:00
|
|
|
struct IDataHandler
|
|
|
|
{
|
2018-09-18 11:08:47 +00:00
|
|
|
virtual bool
|
2020-04-07 18:38:56 +00:00
|
|
|
HandleDataMessage(
|
|
|
|
path::Path_ptr path, const PathID_t from, std::shared_ptr<ProtocolMessage> msg) = 0;
|
2018-08-09 19:02:17 +00:00
|
|
|
|
|
|
|
virtual bool
|
2020-04-07 18:38:56 +00:00
|
|
|
GetCachedSessionKeyFor(const ConvoTag& remote, SharedSecret& secret) const = 0;
|
2018-08-09 19:02:17 +00:00
|
|
|
virtual void
|
2020-04-07 18:38:56 +00:00
|
|
|
PutCachedSessionKeyFor(const ConvoTag& remote, const SharedSecret& secret) = 0;
|
2018-08-09 19:02:17 +00:00
|
|
|
|
2021-04-02 15:10:37 +00:00
|
|
|
/// called when we send data to remote on a convotag
|
2019-09-19 20:28:12 +00:00
|
|
|
virtual void
|
2021-04-02 15:10:37 +00:00
|
|
|
ConvoTagTX(const ConvoTag& tag) = 0;
|
|
|
|
|
|
|
|
/// called when we got data from remote on a convotag
|
|
|
|
virtual void
|
|
|
|
ConvoTagRX(const ConvoTag& tag) = 0;
|
2019-09-19 20:28:12 +00:00
|
|
|
|
2019-03-08 16:00:45 +00:00
|
|
|
virtual void
|
|
|
|
RemoveConvoTag(const ConvoTag& remote) = 0;
|
|
|
|
|
2019-03-08 17:00:13 +00:00
|
|
|
virtual bool
|
|
|
|
HasConvoTag(const ConvoTag& remote) const = 0;
|
|
|
|
|
2018-08-09 19:02:17 +00:00
|
|
|
virtual void
|
2020-04-07 18:38:56 +00:00
|
|
|
PutSenderFor(const ConvoTag& remote, const ServiceInfo& si, bool inbound) = 0;
|
2018-08-09 19:02:17 +00:00
|
|
|
|
|
|
|
virtual bool
|
|
|
|
GetSenderFor(const ConvoTag& remote, ServiceInfo& si) const = 0;
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
PutIntroFor(const ConvoTag& remote, const Introduction& intro) = 0;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
GetIntroFor(const ConvoTag& remote, Introduction& intro) const = 0;
|
|
|
|
|
2019-02-21 17:41:29 +00:00
|
|
|
virtual void
|
|
|
|
PutReplyIntroFor(const ConvoTag& remote, const Introduction& intro) = 0;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
GetReplyIntroFor(const ConvoTag& remote, Introduction& intro) const = 0;
|
|
|
|
|
2018-08-09 19:02:17 +00:00
|
|
|
virtual bool
|
2020-04-07 18:38:56 +00:00
|
|
|
GetConvoTagsForService(const Address& si, std::set<ConvoTag>& tag) const = 0;
|
2019-06-14 12:49:45 +00:00
|
|
|
|
|
|
|
virtual bool
|
|
|
|
HasInboundConvo(const Address& addr) const = 0;
|
2019-11-28 23:08:02 +00:00
|
|
|
|
2021-03-31 10:57:06 +00:00
|
|
|
virtual bool
|
|
|
|
HasOutboundConvo(const Address& addr) const = 0;
|
|
|
|
|
2020-02-18 16:00:45 +00:00
|
|
|
/// do we want a session outbound to addr
|
|
|
|
virtual bool
|
|
|
|
WantsOutboundSession(const Address& addr) const = 0;
|
2019-11-28 23:08:02 +00:00
|
|
|
virtual void
|
|
|
|
QueueRecvData(RecvDataEvent ev) = 0;
|
2018-08-08 19:37:33 +00:00
|
|
|
};
|
|
|
|
} // namespace service
|
|
|
|
} // namespace llarp
|