summaryrefslogtreecommitdiff
path: root/node/Node.hpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2013-07-18 11:43:46 -0400
committerAdam Ierymenko <adam.ierymenko@gmail.com>2013-07-18 11:43:46 -0400
commita677597b44ff94bf1f642f7ef81f926e09439ffd (patch)
tree3169ed1a90cce09ddfae89b23f1a5cfa17990448 /node/Node.hpp
parent1fce55fab10260ae942cc46c6fee15d71a1403c2 (diff)
downloadinfinitytier-a677597b44ff94bf1f642f7ef81f926e09439ffd.tar.gz
infinitytier-a677597b44ff94bf1f642f7ef81f926e09439ffd.zip
Better encode/decode code for control bus.
Diffstat (limited to 'node/Node.hpp')
-rw-r--r--node/Node.hpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/node/Node.hpp b/node/Node.hpp
index f4e2d423..bddced58 100644
--- a/node/Node.hpp
+++ b/node/Node.hpp
@@ -41,6 +41,45 @@ class Node
{
public:
/**
+ * Client for controlling a local ZeroTier One node
+ */
+ class LocalClient
+ {
+ public:
+ /**
+ * Create a new node config client
+ *
+ * The result handler will be called from a different thread. Its
+ * arguments are the request ID generated by send() and each line
+ * of output. It may be called more than once per request result
+ * if the command generates more than one line of output.
+ *
+ * @param authToken Authentication token
+ * @param resultHandler Function to call when commands provide results
+ */
+ LocalClient(const char *authToken,void (*resultHandler)(void *,unsigned long,const char *),void *arg)
+ throw();
+
+ ~LocalClient();
+
+ /**
+ * Send a command to the local node
+ *
+ * @param command
+ * @return Request ID that will be provided to result handler when/if results are sent back
+ */
+ unsigned long send(const char *command)
+ throw();
+
+ private:
+ // LocalClient is not copyable
+ LocalClient(const LocalClient&);
+ const LocalClient& operator=(const LocalClient&);
+
+ void *_impl;
+ };
+
+ /**
* Returned by node main if/when it terminates
*/
enum ReasonForTermination
@@ -108,6 +147,10 @@ public:
static unsigned int versionRevision() throw();
private:
+ // Nodes are not copyable
+ Node(const Node&);
+ const Node& operator=(const Node&);
+
void *const _impl; // private implementation
};