diff options
author | Joseph Henry <joseph.henry@zerotier.com> | 2015-09-10 15:46:37 -0400 |
---|---|---|
committer | Joseph Henry <joseph.henry@zerotier.com> | 2015-09-10 15:46:37 -0400 |
commit | 3802d37d2905a47d23da49237e24cbe7904d9f50 (patch) | |
tree | 36cb5a185fed1a20eda97fec31bb70913a173d0e /netcon/NetconEthernetTap.cpp | |
parent | 750352836f72c5dc0136b6aae96ec28f8fe356cb (diff) | |
download | infinitytier-3802d37d2905a47d23da49237e24cbe7904d9f50.tar.gz infinitytier-3802d37d2905a47d23da49237e24cbe7904d9f50.zip |
started refactor
Diffstat (limited to 'netcon/NetconEthernetTap.cpp')
-rw-r--r-- | netcon/NetconEthernetTap.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/netcon/NetconEthernetTap.cpp b/netcon/NetconEthernetTap.cpp index dd788813..bf93b9cd 100644 --- a/netcon/NetconEthernetTap.cpp +++ b/netcon/NetconEthernetTap.cpp @@ -78,13 +78,10 @@ NetconEthernetTap::NetconEthernetTap( if(!lwipstack) // TODO double check this check throw std::runtime_error("unable to load lwip lib."); lwipstack->lwip_init(); - nc_service = new NetconService(lwipstack, sockPath); // Netcon Service _unixListenSocket = _phy.unixListen(sockPath,(void *)this); if (!_unixListenSocket) throw std::runtime_error(std::string("unable to bind to ")+sockPath); - else - _unixListenSocket.uptr = (void*) new NetconSocket(_unixListenSocket.sock, NetconSocketType.RPC); _thread = Thread::start(this); } @@ -232,15 +229,18 @@ void NetconEthernetTap::phyOnTcpWritable(PhySocket *sock,void **uptr) {} void NetconEthernetTap::phyOnUnixAccept(PhySocket *sockL,PhySocket *sockN,void **uptrL,void **uptrN) { + _phy.setuptr(sockN, new NIntercept()); } void NetconEthernetTap::phyOnUnixClose(PhySocket *sock,void **uptr) { + NIntercept *h = (NIntercept*)_phy.getuptr(sock); + h->close(); } void NetconEthernetTap::phyOnUnixData(PhySocket *sock,void **uptr,void *data,unsigned long len) { - Phy<NetconEthernetTap*>::PhySocketImpl &sws = *(reinterpret_cast<Phy<NetconEthernetTap*>::PhySocketImpl *>(sock)); + NIntercept *h = (NIntercept*)_phy.getuptr(sock); int r; nc_service->possible_state_change = true; @@ -621,7 +621,7 @@ void NetconEthernetTap::handle_connect(NetconIntercept *h, struct connect_st* co //dwr(-1, "connect(): TCP_SNDBUF = %d\n", tcp_sndbuf(nc->pcb)); lwipstack->tcp_sent(c->pcb, nc_sent); // FIXME: Move? lwipstack->tcp_recv(c->pcb, nc_recved); - lwipstack->tcp_err(c->pcb, ZeroTier::NetconEthernetTap::nc_err); + lwipstack->tcp_err(c->pcb, nc_err); lwipstack->tcp_poll(c->pcb, nc_poll, APPLICATION_POLL_FREQ); lwipstack->tcp_arg(c->pcb,(void*)(intptr_t)c->our_fd); |