lokinet/llarp/utp/utp.cpp

39 lines
1.2 KiB
C++
Raw Normal View History

2019-03-29 14:23:19 +00:00
#include <utp/utp.hpp>
2019-03-29 14:23:19 +00:00
#include <utp/linklayer.hpp>
#include <router/abstractrouter.hpp>
2019-03-26 19:30:10 +00:00
namespace llarp
{
namespace utp
{
using namespace std::placeholders;
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)
{
using namespace std::placeholders;
return NewServer(
r->encryption(), std::bind(&AbstractRouter::rc, r),
std::bind(&AbstractRouter::HandleRecvLinkMessageBuffer, r, _1, _2),
std::bind(&AbstractRouter::OnSessionEstablished, r, _1),
std::bind(&AbstractRouter::CheckRenegotiateValid, r, _1, _2),
std::bind(&AbstractRouter::Sign, r, _1, _2),
std::bind(&AbstractRouter::OnConnectTimeout, r, _1),
std::bind(&AbstractRouter::SessionClosed, r, _1));
}
} // namespace utp
} // namespace llarp