mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-02 03:40:12 +00:00
7caa87862e
All #ifndef guards on headers have been removed, I think, in favor of #pragma once Headers are now included as `#include "filename"` if the included file resides in the same directory as the file including it, or any subdirectory therein. Otherwise they are included as `#include <project/top/dir/relative/path/filename>` The above does not include system/os headers.
71 lines
1.7 KiB
C++
71 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include <llarp/constants/link_layer.hpp>
|
|
#include <llarp/crypto/crypto.hpp>
|
|
#include <llarp/crypto/encrypted.hpp>
|
|
#include <llarp/crypto/types.hpp>
|
|
#include <llarp/link/server.hpp>
|
|
#include <llarp/config/key_manager.hpp>
|
|
|
|
#include <memory>
|
|
|
|
#include <llarp/ev/ev.hpp>
|
|
|
|
namespace llarp::iwp
|
|
{
|
|
struct Session;
|
|
|
|
struct LinkLayer final : public ILinkLayer
|
|
{
|
|
LinkLayer(
|
|
std::shared_ptr<KeyManager> keyManager,
|
|
std::shared_ptr<EventLoop> ev,
|
|
GetRCFunc getrc,
|
|
LinkMessageHandler h,
|
|
SignBufferFunc sign,
|
|
BeforeConnectFunc_t before,
|
|
SessionEstablishedHandler est,
|
|
SessionRenegotiateHandler reneg,
|
|
TimeoutHandler timeout,
|
|
SessionClosedHandler closed,
|
|
PumpDoneHandler pumpDone,
|
|
WorkerFunc_t dowork,
|
|
bool permitInbound);
|
|
|
|
std::shared_ptr<ILinkSession>
|
|
NewOutboundSession(const RouterContact& rc, const AddressInfo& ai) override;
|
|
|
|
const char*
|
|
Name() const override;
|
|
|
|
uint16_t
|
|
Rank() const override;
|
|
|
|
void
|
|
RecvFrom(const SockAddr& from, ILinkSession::Packet_t pkt) override;
|
|
|
|
bool
|
|
MapAddr(const RouterID& pk, ILinkSession* s) override;
|
|
|
|
void
|
|
UnmapAddr(const SockAddr& addr);
|
|
|
|
void
|
|
WakeupPlaintext();
|
|
|
|
void
|
|
AddWakeup(std::weak_ptr<Session> peer);
|
|
|
|
private:
|
|
void
|
|
HandleWakeupPlaintext();
|
|
|
|
const std::shared_ptr<EventLoopWakeup> m_Wakeup;
|
|
std::unordered_map<SockAddr, std::weak_ptr<Session>, SockAddr::Hash> m_PlaintextRecv;
|
|
std::unordered_map<SockAddr, RouterID, SockAddr::Hash> m_AuthedAddrs;
|
|
const bool permitInbound;
|
|
};
|
|
|
|
using LinkLayer_ptr = std::shared_ptr<LinkLayer>;
|
|
} // namespace llarp::iwp
|