2019-03-29 14:23:19 +00:00
|
|
|
#include <utp/utp.hpp>
|
2019-01-10 19:41:51 +00:00
|
|
|
|
2019-03-29 14:23:19 +00:00
|
|
|
#include <utp/linklayer.hpp>
|
2019-02-11 19:45:42 +00:00
|
|
|
#include <router/abstractrouter.hpp>
|
2019-03-26 19:30:10 +00:00
|
|
|
|
2018-09-04 12:41:25 +00:00
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
namespace utp
|
|
|
|
{
|
2019-01-26 15:40:58 +00:00
|
|
|
using namespace std::placeholders;
|
|
|
|
|
2019-05-15 16:15:20 +00:00
|
|
|
LinkLayer_ptr
|
2019-05-28 19:45:08 +00:00
|
|
|
NewServer(const SecretKey& routerEncSecret, GetRCFunc getrc,
|
2019-02-11 19:45:42 +00:00
|
|
|
LinkMessageHandler h, SessionEstablishedHandler est,
|
|
|
|
SessionRenegotiateHandler reneg, SignBufferFunc sign,
|
|
|
|
TimeoutHandler timeout, SessionClosedHandler closed)
|
2018-12-17 20:46:08 +00:00
|
|
|
{
|
2019-05-28 19:45:08 +00:00
|
|
|
return std::make_shared< LinkLayer >(routerEncSecret, getrc, h, sign, est,
|
|
|
|
reneg, timeout, closed);
|
2018-12-17 20:46:08 +00:00
|
|
|
}
|
2018-09-04 12:41:25 +00:00
|
|
|
|
2019-05-15 15:54:26 +00:00
|
|
|
LinkLayer_ptr
|
2019-02-11 19:45:42 +00:00
|
|
|
NewServerFromRouter(AbstractRouter* r)
|
2018-09-04 12:41:25 +00:00
|
|
|
{
|
2019-02-11 19:45:42 +00:00
|
|
|
using namespace std::placeholders;
|
2018-12-17 20:46:08 +00:00
|
|
|
return NewServer(
|
2019-05-28 19:45:08 +00:00
|
|
|
r->encryption(), std::bind(&AbstractRouter::rc, r),
|
2019-02-11 19:45:42 +00:00
|
|
|
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));
|
2018-09-04 12:41:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace utp
|
|
|
|
|
|
|
|
} // namespace llarp
|