mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-19 05:26:54 +02:00
Pipe member capabilites to network json
This commit is contained in:
parent
f187a6c34f
commit
c36d8213f8
3 changed files with 22 additions and 0 deletions
|
@ -1255,6 +1255,9 @@ typedef struct
|
|||
uint32_t tags[ZT_MAX_NETWORK_TAGS][2];
|
||||
unsigned int tagsCount;
|
||||
|
||||
uint32_t capabilities[ZT_MAX_NETWORK_CAPABILITIES];
|
||||
unsigned int capabilitiesCount;
|
||||
|
||||
|
||||
} ZT_VirtualNetworkConfig;
|
||||
|
||||
|
|
|
@ -1502,6 +1502,15 @@ void Network::_externalConfig(ZT_VirtualNetworkConfig *ec) const
|
|||
}
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i<ZT_MAX_NETWORK_CAPABILITIES; i++) {
|
||||
if (_config.capabilities[i].id()) {
|
||||
ec->capabilities[i] = _config.capabilities[i].id();
|
||||
} else {
|
||||
ec->capabilitiesCount = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ec->assignedAddressCount = 0;
|
||||
for(unsigned int i=0;i<ZT_MAX_ZT_ASSIGNED_ADDRESSES;++i) {
|
||||
if (i < _config.staticIpCount) {
|
||||
|
|
|
@ -554,6 +554,16 @@ static void _networkToJson(nlohmann::json &nj,NetworkState &ns)
|
|||
}
|
||||
nj["tags"] = tags;
|
||||
|
||||
nlohmann::json caps = nlohmann::json::array();
|
||||
for(unsigned int i=0;i<ns.config().capabilitiesCount;++i) {
|
||||
if (ns.config().capabilities[i]) {
|
||||
caps[i] = ns.config().capabilities[i];
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
nj["capabilities"] = caps;
|
||||
|
||||
|
||||
nlohmann::json aa = nlohmann::json::array();
|
||||
for(unsigned int i=0;i<ns.config().assignedAddressCount;++i) {
|
||||
|
|
Loading…
Add table
Reference in a new issue