lokinet/llarp/utp/utp.cpp

37 lines
1.2 KiB
C++
Raw Normal View History

2019-03-29 14:23:19 +00:00
#include <utp/utp.hpp>
#include <router/abstractrouter.hpp>
2019-06-02 21:19:10 +00:00
#include <util/memfn.hpp>
#include <utp/linklayer.hpp>
2019-03-26 19:30:10 +00:00
namespace llarp
{
namespace utp
{
2019-05-15 16:15:20 +00:00
LinkLayer_ptr
NewServer(const SecretKey& routerEncSecret, GetRCFunc getrc,
LinkMessageHandler h, SessionEstablishedHandler est,
SessionRenegotiateHandler reneg, SignBufferFunc sign,
TimeoutHandler timeout, SessionClosedHandler closed)
{
return std::make_shared< LinkLayer >(routerEncSecret, getrc, h, sign, est,
reneg, timeout, closed);
}
2019-05-15 15:54:26 +00:00
LinkLayer_ptr
NewServerFromRouter(AbstractRouter* r)
{
return NewServer(
2019-06-02 21:19:10 +00:00
r->encryption(), util::memFn(&AbstractRouter::rc, r),
util::memFn(&AbstractRouter::HandleRecvLinkMessageBuffer, r),
util::memFn(&AbstractRouter::OnSessionEstablished, r),
util::memFn(&AbstractRouter::CheckRenegotiateValid, r),
util::memFn(&AbstractRouter::Sign, r),
util::memFn(&AbstractRouter::OnConnectTimeout, r),
util::memFn(&AbstractRouter::SessionClosed, r));
}
} // namespace utp
} // namespace llarp