lokinet/llarp/iwp/linklayer.hpp

55 lines
1.3 KiB
C++
Raw Normal View History

2019-03-29 15:17:49 +00:00
#ifndef LLARP_IWP_LINKLAYER_HPP
#define LLARP_IWP_LINKLAYER_HPP
2019-03-29 14:30:19 +00:00
#include <constants/link_layer.hpp>
#include <crypto/crypto.hpp>
#include <crypto/encrypted.hpp>
#include <crypto/types.hpp>
#include <link/server.hpp>
namespace llarp
{
namespace iwp
{
struct LinkLayer final : public ILinkLayer
{
2019-08-22 20:53:27 +00:00
LinkLayer(const SecretKey &routerEncSecret, GetRCFunc getrc,
LinkMessageHandler h, SignBufferFunc sign,
SessionEstablishedHandler est, SessionRenegotiateHandler reneg,
TimeoutHandler timeout, SessionClosedHandler closed,
bool permitInbound);
2019-03-29 14:30:19 +00:00
2019-07-30 23:42:13 +00:00
~LinkLayer() override;
2019-04-02 09:03:53 +00:00
2019-03-29 14:30:19 +00:00
bool
2019-05-22 16:20:50 +00:00
Start(std::shared_ptr< Logic > l) override;
2019-03-29 14:30:19 +00:00
2019-04-02 09:03:53 +00:00
std::shared_ptr< ILinkSession >
2019-03-29 14:30:19 +00:00
NewOutboundSession(const RouterContact &rc,
const AddressInfo &ai) override;
void
Pump() override;
bool
KeyGen(SecretKey &k) override;
const char *
Name() const override;
uint16_t
Rank() const override;
void
RecvFrom(const Addr &from, const void *buf, size_t sz) override;
private:
2019-08-22 20:53:27 +00:00
const bool permitInbound;
2019-03-29 14:30:19 +00:00
};
2019-08-22 20:53:27 +00:00
using LinkLayer_ptr = std::shared_ptr< LinkLayer >;
2019-03-29 14:30:19 +00:00
} // namespace iwp
} // namespace llarp
#endif