diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-05-17 15:51:07 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-05-17 15:51:07 -0700 |
commit | 086f21ed70c56b1f52791816acd812fa6d5b3ed3 (patch) | |
tree | 05ab6f0028209d59c2f46eaf117061ba13f86bf3 /service/ControlPlane.cpp | |
parent | 7649d6746b49512a6ab6bb83306aa19c6e74b2a6 (diff) | |
download | infinitytier-086f21ed70c56b1f52791816acd812fa6d5b3ed3.tar.gz infinitytier-086f21ed70c56b1f52791816acd812fa6d5b3ed3.zip |
Refactor and simplify controller integration with JSON API and OneService.
Diffstat (limited to 'service/ControlPlane.cpp')
-rw-r--r-- | service/ControlPlane.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/service/ControlPlane.cpp b/service/ControlPlane.cpp index 1047067e..81fb61ca 100644 --- a/service/ControlPlane.cpp +++ b/service/ControlPlane.cpp @@ -245,6 +245,9 @@ static void _jsonAppend(unsigned int depth,std::string &buf,const ZT1_Peer *peer ControlPlane::ControlPlane(OneService *svc,Node *n,const char *uiStaticPath) : _svc(svc), _node(n), +#ifdef ZT_ENABLE_NETWORK_CONTROLLER + _controller((SqliteNetworkController *)0), +#endif _uiStaticPath((uiStaticPath) ? uiStaticPath : "") { } @@ -446,9 +449,8 @@ unsigned int ControlPlane::handleRequest( scode = 200; } else { #ifdef ZT_ENABLE_NETWORK_CONTROLLER - std::map<std::string,SqliteNetworkController *>::const_iterator ss(_subsystems.find(ps[0])); - if (ss != _subsystems.end()) - scode = ss->second->handleControlPlaneHttpGET(std::vector<std::string>(ps.begin()+1,ps.end()),urlArgs,headers,body,responseBody,responseContentType); + if (_controller) + _controller->handleControlPlaneHttpGET(std::vector<std::string>(ps.begin()+1,ps.end()),urlArgs,headers,body,responseBody,responseContentType); else scode = 404; #else scode = 404; @@ -483,9 +485,8 @@ unsigned int ControlPlane::handleRequest( } } else { #ifdef ZT_ENABLE_NETWORK_CONTROLLER - std::map<std::string,SqliteNetworkController *>::const_iterator ss(_subsystems.find(ps[0])); - if (ss != _subsystems.end()) - scode = ss->second->handleControlPlaneHttpPOST(std::vector<std::string>(ps.begin()+1,ps.end()),urlArgs,headers,body,responseBody,responseContentType); + if (_controller) + _controller->handleControlPlaneHttpPOST(std::vector<std::string>(ps.begin()+1,ps.end()),urlArgs,headers,body,responseBody,responseContentType); else scode = 404; #else scode = 404; @@ -519,9 +520,8 @@ unsigned int ControlPlane::handleRequest( } else scode = 500; } else { #ifdef ZT_ENABLE_NETWORK_CONTROLLER - std::map<std::string,SqliteNetworkController *>::const_iterator ss(_subsystems.find(ps[0])); - if (ss != _subsystems.end()) - scode = ss->second->handleControlPlaneHttpDELETE(std::vector<std::string>(ps.begin()+1,ps.end()),urlArgs,headers,body,responseBody,responseContentType); + if (_controller) + _controller->handleControlPlaneHttpDELETE(std::vector<std::string>(ps.begin()+1,ps.end()),urlArgs,headers,body,responseBody,responseContentType); else scode = 404; #else scode = 404; |