getting there...
This commit is contained in:
parent
5e35346f17
commit
2eef9d22e6
11 changed files with 278 additions and 45 deletions
|
@ -36,28 +36,19 @@ class ManagedRoute
|
|||
friend class SharedPtr<ManagedRoute>;
|
||||
|
||||
public:
|
||||
ManagedRoute(const InetAddress &target,const InetAddress &via,const InetAddress &src,const char *device)
|
||||
ZT_ALWAYS_INLINE ManagedRoute(const InetAddress &target,const InetAddress &via,const char *device)
|
||||
{
|
||||
_target = target;
|
||||
_via = via;
|
||||
_src = src;
|
||||
if (via.ss_family == AF_INET)
|
||||
_via.setPort(32);
|
||||
else if (via.ss_family == AF_INET6)
|
||||
_via.setPort(128);
|
||||
if (src.ss_family == AF_INET) {
|
||||
_src.setPort(32);
|
||||
} else if (src.ss_family == AF_INET6) {
|
||||
_src.setPort(128);
|
||||
}
|
||||
Utils::scopy(_device,sizeof(_device),device);
|
||||
_systemDevice[0] = (char)0;
|
||||
}
|
||||
|
||||
~ManagedRoute()
|
||||
{
|
||||
this->remove();
|
||||
}
|
||||
ZT_ALWAYS_INLINE ~ManagedRoute() { this->remove(); }
|
||||
|
||||
/**
|
||||
* Set or update currently set route
|
||||
|
@ -78,18 +69,16 @@ public:
|
|||
*/
|
||||
void remove();
|
||||
|
||||
inline const InetAddress &target() const { return _target; }
|
||||
inline const InetAddress &via() const { return _via; }
|
||||
inline const InetAddress &src() const { return _src; }
|
||||
inline const char *device() const { return _device; }
|
||||
ZT_ALWAYS_INLINE const InetAddress &target() const { return _target; }
|
||||
ZT_ALWAYS_INLINE const InetAddress &via() const { return _via; }
|
||||
ZT_ALWAYS_INLINE const char *device() const { return _device; }
|
||||
|
||||
private:
|
||||
ManagedRoute(const ManagedRoute &) {}
|
||||
inline ManagedRoute &operator=(const ManagedRoute &) { return *this; }
|
||||
ZT_ALWAYS_INLINE ManagedRoute(const ManagedRoute &) {}
|
||||
ZT_ALWAYS_INLINE ManagedRoute &operator=(const ManagedRoute &) { return *this; }
|
||||
|
||||
InetAddress _target;
|
||||
InetAddress _via;
|
||||
InetAddress _src;
|
||||
InetAddress _systemVia; // for route overrides
|
||||
std::map<InetAddress,bool> _applied; // routes currently applied
|
||||
char _device[128];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue