diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-08-18 18:18:50 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-08-18 18:18:50 -0700 |
commit | 4dce71879f5d15af6754c15c606554b1feccdeac (patch) | |
tree | 365067b9068f81d61a2b3a3345c910035043e4dd /controller/EmbeddedNetworkController.cpp | |
parent | 212a5af9a549270abc1230b93a80caf4c0cd4b3c (diff) | |
download | infinitytier-4dce71879f5d15af6754c15c606554b1feccdeac.tar.gz infinitytier-4dce71879f5d15af6754c15c606554b1feccdeac.zip |
.
Diffstat (limited to 'controller/EmbeddedNetworkController.cpp')
-rw-r--r-- | controller/EmbeddedNetworkController.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/controller/EmbeddedNetworkController.cpp b/controller/EmbeddedNetworkController.cpp index d7d5c92c..8d7e90c7 100644 --- a/controller/EmbeddedNetworkController.cpp +++ b/controller/EmbeddedNetworkController.cpp @@ -50,7 +50,7 @@ using json = nlohmann::json; #define ZT_NETCONF_CONTROLLER_API_VERSION 3 // Number of requests to remember in member history -#define ZT_NETCONF_DB_MEMBER_HISTORY_LENGTH 64 +#define ZT_NETCONF_DB_MEMBER_HISTORY_LENGTH 16 // Min duration between requests for an address/nwid combo to prevent floods #define ZT_NETCONF_MIN_REQUEST_PERIOD 1000 @@ -540,6 +540,9 @@ NetworkController::ResultCode EmbeddedNetworkController::doNetworkConfigRequest( auto ipAssignmentPools = network["ipAssignmentPools"]; auto routes = network["routes"]; auto rules = network["rules"]; + auto capabilities = network["capabilities"]; + auto memberCapabilities = member["capabilities"]; + auto memberTags = member["tags"]; if (rules.is_array()) { for(unsigned long i=0;i<rules.size();++i) { @@ -551,6 +554,25 @@ NetworkController::ResultCode EmbeddedNetworkController::doNetworkConfigRequest( } } + if ((memberCapabilities.is_array())&&(memberCapabilities.size() > 0)&&(capabilities.is_array())) { + std::map< uint64_t,json > capsById; + for(unsigned long i=0;i<capabilities.size();++i) { + auto cap = capabilities[i]; + if (cap.is_object()) + capsById[_jI(cap["id"],0ULL)] = cap; + } + + for(unsigned long i=0;i<memberCapabilities.size();++i) { + const uint64_t capId = _jI(memberCapabilities[i],0ULL); + json &cap = capsById[capId]; + if ((cap.is_object())&&(cap.size() > 0)) { + } + } + } + + if (memberTags.is_array()) { + } + if (routes.is_array()) { for(unsigned long i=0;i<routes.size();++i) { if (nc.routeCount >= ZT_MAX_NETWORK_ROUTES) |