summaryrefslogtreecommitdiff
path: root/service/ControlPlane.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'service/ControlPlane.hpp')
-rw-r--r--service/ControlPlane.hpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/service/ControlPlane.hpp b/service/ControlPlane.hpp
index fc8a0182..75cd8cac 100644
--- a/service/ControlPlane.hpp
+++ b/service/ControlPlane.hpp
@@ -52,30 +52,26 @@ public:
ControlPlane(OneService *svc,Node *n,const char *uiStaticPath);
~ControlPlane();
+#ifdef ZT_ENABLE_NETWORK_CONTROLLER
/**
- * Add an authentication token for API access
+ * Set controller, which will be available under /controller
+ *
+ * @param c Network controller instance
*/
- inline void addAuthToken(const char *tok)
+ inline void setController(SqliteNetworkController *c)
{
Mutex::Lock _l(_lock);
- _authTokens.insert(std::string(tok));
+ _controller = c;
}
+#endif
/**
- * Mount a subsystem under a prefix
- *
- * Note that the prefix must not contain a dot -- this is reserved for
- * static pages -- and must not be a reserved prefix such as /peer
- * or /network. Do not include path / characters in the prefix. Example
- * would be 'controller' for SqliteNetworkController.
- *
- * @param prefix First element in URI path
- * @param subsys Object to call for results of GET and POST/PUT operations
+ * Add an authentication token for API access
*/
- inline void mount(const char *prefix,SqliteNetworkController *subsys)
+ inline void addAuthToken(const char *tok)
{
Mutex::Lock _l(_lock);
- _subsystems[std::string(prefix)] = subsys;
+ _authTokens.insert(std::string(tok));
}
/**
@@ -102,9 +98,11 @@ public:
private:
OneService *const _svc;
Node *const _node;
+#ifdef ZT_ENABLE_NETWORK_CONTROLLER
+ SqliteNetworkController *_controller;
+#endif
std::string _uiStaticPath;
std::set<std::string> _authTokens;
- std::map<std::string,SqliteNetworkController *> _subsystems;
Mutex _lock;
};