|
|
|
|
@ -391,12 +391,12 @@ static std::string _trimString(const std::string &s)
|
|
|
|
|
|
|
|
|
|
class OneServiceImpl; |
|
|
|
|
|
|
|
|
|
static int SnodeVirtualNetworkConfigFunction(ZT_Node *node,void *uptr,uint64_t nwid,void *nuptr,enum ZT_VirtualNetworkConfigOperation op,const ZT_VirtualNetworkConfig *nwconf); |
|
|
|
|
static int SnodeVirtualNetworkConfigFunction(ZT_Node *node,void *uptr,uint64_t nwid,void **nuptr,enum ZT_VirtualNetworkConfigOperation op,const ZT_VirtualNetworkConfig *nwconf); |
|
|
|
|
static void SnodeEventCallback(ZT_Node *node,void *uptr,enum ZT_Event event,const void *metaData); |
|
|
|
|
static long SnodeDataStoreGetFunction(ZT_Node *node,void *uptr,const char *name,void *buf,unsigned long bufSize,unsigned long readIndex,unsigned long *totalSize); |
|
|
|
|
static int SnodeDataStorePutFunction(ZT_Node *node,void *uptr,const char *name,const void *data,unsigned long len,int secure); |
|
|
|
|
static int SnodeWirePacketSendFunction(ZT_Node *node,void *uptr,const struct sockaddr_storage *localAddr,const struct sockaddr_storage *addr,const void *data,unsigned int len,unsigned int ttl); |
|
|
|
|
static void SnodeVirtualNetworkFrameFunction(ZT_Node *node,void *uptr,uint64_t nwid,void *nuptr,uint64_t sourceMac,uint64_t destMac,unsigned int etherType,unsigned int vlanId,const void *data,unsigned int len); |
|
|
|
|
static void SnodeVirtualNetworkFrameFunction(ZT_Node *node,void *uptr,uint64_t nwid,void **nuptr,uint64_t sourceMac,uint64_t destMac,unsigned int etherType,unsigned int vlanId,const void *data,unsigned int len); |
|
|
|
|
static int SnodePathCheckFunction(ZT_Node *node,void *uptr,const struct sockaddr_storage *localAddr,const struct sockaddr_storage *remoteAddr); |
|
|
|
|
|
|
|
|
|
#ifdef ZT_ENABLE_CLUSTER |
|
|
|
|
@ -1131,7 +1131,7 @@ public:
|
|
|
|
|
inline void phyOnUnixData(PhySocket *sock,void **uptr,void *data,unsigned long len) {} |
|
|
|
|
inline void phyOnUnixWritable(PhySocket *sock,void **uptr) {} |
|
|
|
|
|
|
|
|
|
inline int nodeVirtualNetworkConfigFunction(uint64_t nwid,enum ZT_VirtualNetworkConfigOperation op,const ZT_VirtualNetworkConfig *nwc) |
|
|
|
|
inline int nodeVirtualNetworkConfigFunction(uint64_t nwid,void **nuptr,enum ZT_VirtualNetworkConfigOperation op,const ZT_VirtualNetworkConfig *nwc) |
|
|
|
|
{ |
|
|
|
|
Mutex::Lock _l(_taps_m); |
|
|
|
|
std::map< uint64_t,EthernetTap * >::iterator t(_taps.find(nwid)); |
|
|
|
|
@ -1150,6 +1150,7 @@ public:
|
|
|
|
|
friendlyName, |
|
|
|
|
StapFrameHandler, |
|
|
|
|
(void *)this))).first; |
|
|
|
|
*nuptr = (void *)t->second; |
|
|
|
|
} catch (std::exception &exc) { |
|
|
|
|
#ifdef __WINDOWS__ |
|
|
|
|
FILE *tapFailLog = fopen((_homePath + ZT_PATH_SEPARATOR_S"port_error_log.txt").c_str(),"a"); |
|
|
|
|
@ -1197,6 +1198,7 @@ public:
|
|
|
|
|
#ifdef __WINDOWS__ |
|
|
|
|
std::string winInstanceId(t->second->instanceId()); |
|
|
|
|
#endif |
|
|
|
|
*nuptr = (void *)0; |
|
|
|
|
delete t->second; |
|
|
|
|
_taps.erase(t); |
|
|
|
|
_tapAssignedIps.erase(nwid); |
|
|
|
|
@ -1387,12 +1389,12 @@ public:
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inline void nodeVirtualNetworkFrameFunction(uint64_t nwid,uint64_t sourceMac,uint64_t destMac,unsigned int etherType,unsigned int vlanId,const void *data,unsigned int len) |
|
|
|
|
inline void nodeVirtualNetworkFrameFunction(uint64_t nwid,void **nuptr,uint64_t sourceMac,uint64_t destMac,unsigned int etherType,unsigned int vlanId,const void *data,unsigned int len) |
|
|
|
|
{ |
|
|
|
|
Mutex::Lock _l(_taps_m); |
|
|
|
|
std::map< uint64_t,EthernetTap * >::const_iterator t(_taps.find(nwid)); |
|
|
|
|
if (t != _taps.end()) |
|
|
|
|
t->second->put(MAC(sourceMac),MAC(destMac),etherType,data,len); |
|
|
|
|
EthernetTap *tap = reinterpret_cast<EthernetTap *>(*nuptr); |
|
|
|
|
if (!tap) |
|
|
|
|
return; |
|
|
|
|
tap->put(MAC(sourceMac),MAC(destMac),etherType,data,len); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inline int nodePathCheckFunction(const struct sockaddr_storage *localAddr,const struct sockaddr_storage *remoteAddr) |
|
|
|
|
@ -1533,8 +1535,8 @@ public:
|
|
|
|
|
Mutex _run_m; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static int SnodeVirtualNetworkConfigFunction(ZT_Node *node,void *uptr,uint64_t nwid,void *nuptr,enum ZT_VirtualNetworkConfigOperation op,const ZT_VirtualNetworkConfig *nwconf) |
|
|
|
|
{ return reinterpret_cast<OneServiceImpl *>(uptr)->nodeVirtualNetworkConfigFunction(nwid,op,nwconf); } |
|
|
|
|
static int SnodeVirtualNetworkConfigFunction(ZT_Node *node,void *uptr,uint64_t nwid,void **nuptr,enum ZT_VirtualNetworkConfigOperation op,const ZT_VirtualNetworkConfig *nwconf) |
|
|
|
|
{ return reinterpret_cast<OneServiceImpl *>(uptr)->nodeVirtualNetworkConfigFunction(nwid,nuptr,op,nwconf); } |
|
|
|
|
static void SnodeEventCallback(ZT_Node *node,void *uptr,enum ZT_Event event,const void *metaData) |
|
|
|
|
{ reinterpret_cast<OneServiceImpl *>(uptr)->nodeEventCallback(event,metaData); } |
|
|
|
|
static long SnodeDataStoreGetFunction(ZT_Node *node,void *uptr,const char *name,void *buf,unsigned long bufSize,unsigned long readIndex,unsigned long *totalSize) |
|
|
|
|
@ -1543,8 +1545,8 @@ static int SnodeDataStorePutFunction(ZT_Node *node,void *uptr,const char *name,c
|
|
|
|
|
{ return reinterpret_cast<OneServiceImpl *>(uptr)->nodeDataStorePutFunction(name,data,len,secure); } |
|
|
|
|
static int SnodeWirePacketSendFunction(ZT_Node *node,void *uptr,const struct sockaddr_storage *localAddr,const struct sockaddr_storage *addr,const void *data,unsigned int len,unsigned int ttl) |
|
|
|
|
{ return reinterpret_cast<OneServiceImpl *>(uptr)->nodeWirePacketSendFunction(localAddr,addr,data,len,ttl); } |
|
|
|
|
static void SnodeVirtualNetworkFrameFunction(ZT_Node *node,void *uptr,uint64_t nwid,void *nuptr,uint64_t sourceMac,uint64_t destMac,unsigned int etherType,unsigned int vlanId,const void *data,unsigned int len) |
|
|
|
|
{ reinterpret_cast<OneServiceImpl *>(uptr)->nodeVirtualNetworkFrameFunction(nwid,sourceMac,destMac,etherType,vlanId,data,len); } |
|
|
|
|
static void SnodeVirtualNetworkFrameFunction(ZT_Node *node,void *uptr,uint64_t nwid,void **nuptr,uint64_t sourceMac,uint64_t destMac,unsigned int etherType,unsigned int vlanId,const void *data,unsigned int len) |
|
|
|
|
{ reinterpret_cast<OneServiceImpl *>(uptr)->nodeVirtualNetworkFrameFunction(nwid,nuptr,sourceMac,destMac,etherType,vlanId,data,len); } |
|
|
|
|
static int SnodePathCheckFunction(ZT_Node *node,void *uptr,const struct sockaddr_storage *localAddr,const struct sockaddr_storage *remoteAddr) |
|
|
|
|
{ return reinterpret_cast<OneServiceImpl *>(uptr)->nodePathCheckFunction(localAddr,remoteAddr); } |
|
|
|
|
|
|
|
|
|
|