Better encode/decode code for control bus.

This commit is contained in:
Adam Ierymenko 2013-07-18 11:43:46 -04:00
parent 1fce55fab1
commit a677597b44
4 changed files with 214 additions and 60 deletions

View file

@ -40,6 +40,45 @@ namespace ZeroTier {
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
*/
@ -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
};