mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 12:33:44 +02: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
1 changed files with 25 additions and 29 deletions
|
@ -313,37 +313,33 @@ unsigned int ControlPlane::handleRequest(
|
||||||
responseBody = "{}"; // TODO
|
responseBody = "{}"; // TODO
|
||||||
scode = 200;
|
scode = 200;
|
||||||
} else if (ps[0] == "network") {
|
} else if (ps[0] == "network") {
|
||||||
if ((ps.size() > 1)&&(ps[1] == "controller")) {
|
ZT1_VirtualNetworkList *nws = _node->networks();
|
||||||
// TODO
|
if (nws) {
|
||||||
} else {
|
if (ps.size() == 1) {
|
||||||
ZT1_VirtualNetworkList *nws = _node->networks();
|
// Return [array] of all networks
|
||||||
if (nws) {
|
responseContentType = "application/json";
|
||||||
if (ps.size() == 1) {
|
responseBody = "[";
|
||||||
// Return [array] of all networks
|
for(unsigned long i=0;i<nws->networkCount;++i) {
|
||||||
responseContentType = "application/json";
|
if (i > 0)
|
||||||
responseBody = "[";
|
responseBody.push_back(',');
|
||||||
for(unsigned long i=0;i<nws->networkCount;++i) {
|
_jsonAppend(responseBody,&(nws->networks[i]),_svc->portDeviceName(nws->networks[i].nwid));
|
||||||
if (i > 0)
|
}
|
||||||
responseBody.push_back(',');
|
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));
|
_jsonAppend(responseBody,&(nws->networks[i]),_svc->portDeviceName(nws->networks[i].nwid));
|
||||||
|
scode = 200;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
responseBody.push_back(']');
|
}
|
||||||
scode = 200;
|
} // else 404
|
||||||
} else if (ps.size() == 2) {
|
_node->freeQueryResult((void *)nws);
|
||||||
// Return a single network by ID or 404 if not found
|
} else scode = 500;
|
||||||
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 if (ps[0] == "peer") {
|
} else if (ps[0] == "peer") {
|
||||||
ZT1_PeerList *pl = _node->peers();
|
ZT1_PeerList *pl = _node->peers();
|
||||||
if (pl) {
|
if (pl) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue