1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00
lokinet/llarp/service/endpoint_state.hpp

103 lines
2.8 KiB
C++
Raw Normal View History

#ifndef LLARP_SERVICE_ENDPOINT_STATE_HPP
#define LLARP_SERVICE_ENDPOINT_STATE_HPP
#include <hook/ihook.hpp>
#include <router_id.hpp>
#include <service/address.hpp>
#include <service/pendingbuffer.hpp>
#include <service/router_lookup_job.hpp>
#include <service/session.hpp>
#include <service/tag_lookup_job.hpp>
#include <service/endpoint_types.hpp>
#include <util/compare_ptr.hpp>
#include <util/status.hpp>
#include <memory>
#include <queue>
#include <set>
#include <unordered_map>
struct llarp_ev_loop;
using llarp_ev_loop_ptr = std::shared_ptr<llarp_ev_loop>;
namespace llarp
{
// clang-format off
namespace exit { struct BaseSession; }
namespace path { struct Path; using Path_ptr = std::shared_ptr< Path >; }
namespace routing { struct PathTransferMessage; }
// clang-format on
namespace service
{
struct IServiceLookup;
struct OutboundContext;
2019-07-18 18:28:17 +02:00
struct Endpoint;
struct EndpointState
{
hooks::Backend_ptr m_OnUp;
hooks::Backend_ptr m_OnDown;
hooks::Backend_ptr m_OnReady;
2019-08-08 01:18:56 +02:00
util::Mutex m_InboundTrafficQueueMutex; // protects m_InboundTrafficQueue
/// ordered queue for inbound hidden service traffic
RecvPacketQueue_t m_InboundTrafficQueue GUARDED_BY(m_InboundTrafficQueueMutex);
std::set<RouterID> m_SnodeBlacklist;
AbstractRouter* m_Router;
std::shared_ptr<Logic> m_IsolatedLogic = nullptr;
llarp_ev_loop_ptr m_IsolatedNetLoop = nullptr;
std::string m_Keyfile;
std::string m_Name;
std::string m_NetNS;
bool m_BundleRC = false;
2019-08-08 01:18:56 +02:00
util::Mutex m_SendQueueMutex; // protects m_SendQueue
std::deque<SendEvent_t> m_SendQueue GUARDED_BY(m_SendQueueMutex);
PendingTraffic m_PendingTraffic;
Sessions m_RemoteSessions;
Sessions m_DeadSessions;
std::set<ConvoTag> m_InboundConvos;
SNodeSessions m_SNodeSessions;
std::unordered_multimap<Address, PathEnsureHook, Address::Hash> m_PendingServiceLookups;
std::unordered_map<RouterID, uint32_t, RouterID::Hash> m_ServiceLookupFails;
PendingRouters m_PendingRouters;
llarp_time_t m_LastPublish = 0s;
2020-02-24 20:40:45 +01:00
llarp_time_t m_LastPublishAttempt = 0s;
/// our introset
IntroSet m_IntroSet;
/// pending remote service lookups by id
PendingLookups m_PendingLookups;
/// on initialize functions
std::list<std::function<bool(void)>> m_OnInit;
/// conversations
ConvoMap m_Sessions;
2020-02-18 17:00:45 +01:00
OutboundSessions_t m_OutboundSessions;
std::unordered_map<Tag, CachedTagResult, Tag::Hash> m_PrefetchedTags;
util::DecayingHashSet<Address> m_RemoteLookupFilter;
bool
2020-04-28 19:49:55 +02:00
Configure(const EndpointConfig& conf);
util::StatusObject
ExtractStatus(util::StatusObject& obj) const;
};
} // namespace service
} // namespace llarp
#endif