summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorJoseph Henry <josephjah@gmail.com>2017-08-10 00:59:15 -0700
committerJoseph Henry <josephjah@gmail.com>2017-08-10 00:59:15 -0700
commitee1dc16e8ffc5c5cc8f3b5da97cf2d01c7604ab7 (patch)
tree092110b1e5df561bfa64aad5160c20432bd73ea3 /service
parent1c04cc0485c58f4f84e75d090025ead2c0f8202d (diff)
downloadinfinitytier-ee1dc16e8ffc5c5cc8f3b5da97cf2d01c7604ab7.tar.gz
infinitytier-ee1dc16e8ffc5c5cc8f3b5da97cf2d01c7604ab7.zip
Added getRoutes() for libzt
Diffstat (limited to 'service')
-rw-r--r--service/OneService.cpp26
-rw-r--r--service/OneService.hpp3
2 files changed, 7 insertions, 22 deletions
diff --git a/service/OneService.cpp b/service/OneService.cpp
index 27f2ef3c..ab3b8d73 100644
--- a/service/OneService.cpp
+++ b/service/OneService.cpp
@@ -925,29 +925,15 @@ public:
return _homePath;
}
- virtual EthernetTap * getTap(uint64_t nwid)
+ std::vector<ZT_VirtualNetworkRoute> *getRoutes(uint64_t nwid)
{
Mutex::Lock _l(_nets_m);
- std::map<uint64_t,NetworkState>::const_iterator n(_nets.find(nwid));
- if (n == _nets.end())
- return NULL;
- return n->second.tap;
- }
-
- virtual EthernetTap *getTap(InetAddress &addr)
- {
- Mutex::Lock _l(_nets_m);
- std::map<uint64_t,NetworkState>::iterator it;
- for(it = _nets.begin(); it != _nets.end(); it++) {
- if(it->second.tap) {
- for(int j=0; j<it->second.tap->_ips.size(); j++) {
- if(it->second.tap->_ips[j].isEqualPrefix(addr) || it->second.tap->_ips[j].ipsEqual(addr) || it->second.tap->_ips[j].containsAddress(addr)) {
- return it->second.tap;
- }
- }
- }
+ NetworkState &n = _nets[nwid];
+ std::vector<ZT_VirtualNetworkRoute> *routes = new std::vector<ZT_VirtualNetworkRoute>();
+ for(int i=0; i<ZT_MAX_NETWORK_ROUTES; i++) {
+ routes->push_back(n.config.routes[i]);
}
- return NULL;
+ return routes;
}
virtual Node *getNode()
diff --git a/service/OneService.hpp b/service/OneService.hpp
index eba10ca0..0d37ec63 100644
--- a/service/OneService.hpp
+++ b/service/OneService.hpp
@@ -150,10 +150,9 @@ public:
virtual void leave(const char *hp) = 0;
virtual void join(const char *hp) = 0;
virtual std::string givenHomePath() = 0;
- virtual EthernetTap * getTap(uint64_t nwid) = 0;
- virtual EthernetTap * getTap(InetAddress &addr) = 0;
virtual Node * getNode() = 0;
virtual void removeNets() = 0;
+ virtual std::vector<ZT_VirtualNetworkRoute> *getRoutes(uint64_t nwid) = 0;
#endif
/**