summaryrefslogtreecommitdiff
path: root/netcon
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-09-02 16:31:13 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-09-02 16:31:13 -0700
commitbf4cab5f2f4c9109d8c33c2c0e04456e17ef1f84 (patch)
treec49196c1035642339ee68567710bfc18f90ec76e /netcon
parent1f4c667646eeed9a2efa8a7df6a3b077108fbdcd (diff)
downloadinfinitytier-bf4cab5f2f4c9109d8c33c2c0e04456e17ef1f84.tar.gz
infinitytier-bf4cab5f2f4c9109d8c33c2c0e04456e17ef1f84.zip
Netcon build fixes.
Diffstat (limited to 'netcon')
-rw-r--r--netcon/NetconEthernetTap.cpp13
-rw-r--r--netcon/NetconEthernetTap.hpp24
2 files changed, 20 insertions, 17 deletions
diff --git a/netcon/NetconEthernetTap.cpp b/netcon/NetconEthernetTap.cpp
index fe1dac83..55168f62 100644
--- a/netcon/NetconEthernetTap.cpp
+++ b/netcon/NetconEthernetTap.cpp
@@ -44,7 +44,7 @@ NetconEthernetTap::NetconEthernetTap(
const char *friendlyName,
void (*handler)(void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int),
void *arg) :
- _phy(this,false,true),
+ _phy(new Phy<NetconEthernetTap *>(this,false,true)),
_unixListenSocket((PhySocket *)0),
_handler(handler),
_arg(arg),
@@ -61,7 +61,7 @@ NetconEthernetTap::NetconEthernetTap(
Utils::snprintf(sockPath,sizeof(sockPath),"/tmp/.ztnc_%.16llx",(unsigned long long)nwid);
_dev = sockPath;
- _unixListenSocket = _phy.unixListen(sockPath,(void *)this);
+ _unixListenSocket = _phy->unixListen(sockPath,(void *)this);
if (!_unixListenSocket)
throw std::runtime_error(std::string("unable to bind to ")+sockPath);
@@ -71,10 +71,11 @@ NetconEthernetTap::NetconEthernetTap(
NetconEthernetTap::~NetconEthernetTap()
{
_run = false;
- _phy.whack();
- _phy.whack();
+ _phy->whack();
+ _phy->whack();
Thread::join(_thread);
- _phy.close(_unixListenSocket,false);
+ _phy->close(_unixListenSocket,false);
+ delete _phy;
}
void NetconEthernetTap::setEnabled(bool en)
@@ -126,7 +127,7 @@ void NetconEthernetTap::threadMain()
// TODO: compute timeout from LWIP stuff
- _phy.poll(pollTimeout);
+ _phy->poll(pollTimeout);
}
// TODO: cleanup -- destroy LWIP state, kill any clients, unload .so, etc.
diff --git a/netcon/NetconEthernetTap.hpp b/netcon/NetconEthernetTap.hpp
index 5453b250..785ace12 100644
--- a/netcon/NetconEthernetTap.hpp
+++ b/netcon/NetconEthernetTap.hpp
@@ -45,12 +45,14 @@
namespace ZeroTier {
+class NetconEthernetTap;
+
/**
* Network Containers instance -- emulates an Ethernet tap device as far as OneService knows
*/
class NetconEthernetTap
{
- friend class Phy<NetconEthernetTap>;
+ friend class Phy<NetconEthernetTap *>;
public:
NetconEthernetTap(
@@ -80,20 +82,20 @@ public:
private:
void phyOnDatagram(PhySocket *sock,void **uptr,const struct sockaddr *from,void *data,unsigned long len);
- void phyOnTcpConnect(PhySocket *sock,void **uptr,bool success);
- void phyOnTcpAccept(PhySocket *sockL,PhySocket *sockN,void **uptrL,void **uptrN,const struct sockaddr *from);
- void phyOnTcpClose(PhySocket *sock,void **uptr);
- void phyOnTcpData(PhySocket *sock,void **uptr,void *data,unsigned long len);
- void phyOnTcpWritable(PhySocket *sock,void **uptr);
- void phyOnUnixAccept(PhySocket *sockL,PhySocket *sockN,void **uptrL,void **uptrN);
- void phyOnUnixClose(PhySocket *sock,void **uptr);
- void phyOnUnixData(PhySocket *sock,void **uptr,void *data,unsigned long len);
- void phyOnUnixWritable(PhySocket *sock,void **uptr);
+ void phyOnTcpConnect(PhySocket *sock,void **uptr,bool success);
+ void phyOnTcpAccept(PhySocket *sockL,PhySocket *sockN,void **uptrL,void **uptrN,const struct sockaddr *from);
+ void phyOnTcpClose(PhySocket *sock,void **uptr);
+ void phyOnTcpData(PhySocket *sock,void **uptr,void *data,unsigned long len);
+ void phyOnTcpWritable(PhySocket *sock,void **uptr);
+ void phyOnUnixAccept(PhySocket *sockL,PhySocket *sockN,void **uptrL,void **uptrN);
+ void phyOnUnixClose(PhySocket *sock,void **uptr);
+ void phyOnUnixData(PhySocket *sock,void **uptr,void *data,unsigned long len);
+ void phyOnUnixWritable(PhySocket *sock,void **uptr);
void (*_handler)(void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int);
void *_arg;
- Phy<NetconEthernetTap> _phy;
+ Phy<NetconEthernetTap *> *_phy;
PhySocket *_unixListenSocket;
uint64_t _nwid;