mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-11 04:59:54 +00:00
Remove network/controller -- we will do this in Ruby instead since it will be part of the whole OnePoint project anyway.
This commit is contained in:
parent
d2503172d8
commit
c301d8e438
@ -313,37 +313,33 @@ unsigned int ControlPlane::handleRequest(
|
||||
responseBody = "{}"; // TODO
|
||||
scode = 200;
|
||||
} else if (ps[0] == "network") {
|
||||
if ((ps.size() > 1)&&(ps[1] == "controller")) {
|
||||
// TODO
|
||||
} else {
|
||||
ZT1_VirtualNetworkList *nws = _node->networks();
|
||||
if (nws) {
|
||||
if (ps.size() == 1) {
|
||||
// Return [array] of all networks
|
||||
responseContentType = "application/json";
|
||||
responseBody = "[";
|
||||
for(unsigned long i=0;i<nws->networkCount;++i) {
|
||||
if (i > 0)
|
||||
responseBody.push_back(',');
|
||||
ZT1_VirtualNetworkList *nws = _node->networks();
|
||||
if (nws) {
|
||||
if (ps.size() == 1) {
|
||||
// Return [array] of all networks
|
||||
responseContentType = "application/json";
|
||||
responseBody = "[";
|
||||
for(unsigned long i=0;i<nws->networkCount;++i) {
|
||||
if (i > 0)
|
||||
responseBody.push_back(',');
|
||||
_jsonAppend(responseBody,&(nws->networks[i]),_svc->portDeviceName(nws->networks[i].nwid));
|
||||
}
|
||||
responseBody.push_back(']');
|
||||
scode = 200;
|
||||
} else if (ps.size() == 2) {
|
||||
// Return a single network by ID or 404 if not found
|
||||
uint64_t wantnw = Utils::hexStrToU64(ps[1].c_str());
|
||||
for(unsigned long i=0;i<nws->networkCount;++i) {
|
||||
if (nws->networks[i].nwid == wantnw) {
|
||||
responseContentType = "application/json";
|
||||
_jsonAppend(responseBody,&(nws->networks[i]),_svc->portDeviceName(nws->networks[i].nwid));
|
||||
scode = 200;
|
||||
break;
|
||||
}
|
||||
responseBody.push_back(']');
|
||||
scode = 200;
|
||||
} else if (ps.size() == 2) {
|
||||
// Return a single network by ID or 404 if not found
|
||||
uint64_t wantnw = Utils::hexStrToU64(ps[1].c_str());
|
||||
for(unsigned long i=0;i<nws->networkCount;++i) {
|
||||
if (nws->networks[i].nwid == wantnw) {
|
||||
responseContentType = "application/json";
|
||||
_jsonAppend(responseBody,&(nws->networks[i]),_svc->portDeviceName(nws->networks[i].nwid));
|
||||
scode = 200;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // else 404
|
||||
_node->freeQueryResult((void *)nws);
|
||||
} else scode = 500;
|
||||
}
|
||||
}
|
||||
} // else 404
|
||||
_node->freeQueryResult((void *)nws);
|
||||
} else scode = 500;
|
||||
} else if (ps[0] == "peer") {
|
||||
ZT1_PeerList *pl = _node->peers();
|
||||
if (pl) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user