getting there...

This commit is contained in:
Adam Ierymenko 2019-09-21 18:22:25 -07:00
parent 5e35346f17
commit 2eef9d22e6
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3
11 changed files with 278 additions and 45 deletions

View file

@ -661,3 +661,52 @@ extern "C" void ZT_GoTap_setMtu(ZT_GoTap *tap,unsigned int mtu)
{
reinterpret_cast<EthernetTap *>(tap)->setMtu(mtu);
}
extern "C" int ZT_GoTap_addRoute(ZT_GoTap *tap,int targetAf,const void *targetIp,int targetNetmaskBits,int viaAf,const void *viaIp,unsigned int metric)
{
InetAddress target,via;
switch(targetAf) {
case AF_INET:
target.set(targetIp,4,(unsigned int)targetNetmaskBits);
break;
case AF_INET6:
target.set(targetIp,16,(unsigned int)targetNetmaskBits);
break;
}
switch(viaAf) {
case AF_INET:
via.set(viaIp,4,0);
break;
case AF_INET6:
via.set(viaIp,16,0);
break;
}
return reinterpret_cast<EthernetTap *>(tap)->addRoute(target,via,metric);
}
extern "C" int ZT_GoTap_removeRoute(ZT_GoTap *tap,int targetAf,const void *targetIp,int targetNetmaskBits,int viaAf,const void *viaIp,unsigned int metric)
{
InetAddress target,via;
switch(targetAf) {
case AF_INET:
target.set(targetIp,4,(unsigned int)targetNetmaskBits);
break;
case AF_INET6:
target.set(targetIp,16,(unsigned int)targetNetmaskBits);
break;
}
switch(viaAf) {
case AF_INET:
via.set(viaIp,4,0);
break;
case AF_INET6:
via.set(viaIp,16,0);
break;
}
return reinterpret_cast<EthernetTap *>(tap)->removeRoute(target,via,metric);
}
extern "C" int ZT_GoTap_syncRoutes(ZT_GoTap *tap)
{
return reinterpret_cast<EthernetTap *>(tap)->syncRoutes();
}

View file

@ -91,6 +91,12 @@ void ZT_GoTap_setFriendlyName(ZT_GoTap *tap,const char *friendlyName);
void ZT_GoTap_setMtu(ZT_GoTap *tap,unsigned int mtu);
int ZT_GoTap_addRoute(ZT_GoTap *tap,int targetAf,const void *targetIp,int targetNetmaskBits,int viaAf,const void *viaIp,unsigned int metric);
int ZT_GoTap_removeRoute(ZT_GoTap *tap,int targetAf,const void *targetIp,int targetNetmaskBits,int viaAf,const void *viaIp,unsigned int metric);
int ZT_GoTap_syncRoutes(ZT_GoTap *tap);
/****************************************************************************/
#ifdef __cplusplus