diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-04-09 18:14:27 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-04-09 18:14:27 -0700 |
| commit | 46ecad451c2d7c305f1ca14be2be6786909dd8ff (patch) | |
| tree | 84ddc8cb0b8eafb024597e8bda36f685da10f703 /node/Node.cpp | |
| parent | 9342380146565b76146f16b703e863b57b323fd3 (diff) | |
| download | infinitytier-46ecad451c2d7c305f1ca14be2be6786909dd8ff.tar.gz infinitytier-46ecad451c2d7c305f1ca14be2be6786909dd8ff.zip | |
Starting on new service/ code to encapsulate node/ with osdep/ stuff, and add a user pointer to the CAPI.
Diffstat (limited to 'node/Node.cpp')
| -rw-r--r-- | node/Node.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/node/Node.cpp b/node/Node.cpp index 4b6f76ee..e6f73879 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -51,6 +51,7 @@ namespace ZeroTier { Node::Node( uint64_t now, + void *uptr, ZT1_DataStoreGetFunction dataStoreGetFunction, ZT1_DataStorePutFunction dataStorePutFunction, ZT1_WirePacketSendFunction wirePacketSendFunction, @@ -59,6 +60,7 @@ Node::Node( ZT1_EventCallback eventCallback, const char *overrideRootTopology) : RR(new RuntimeEnvironment(this)), + _uptr(uptr), _dataStoreGetFunction(dataStoreGetFunction), _dataStorePutFunction(dataStorePutFunction), _wirePacketSendFunction(wirePacketSendFunction), @@ -412,7 +414,7 @@ std::string Node::dataStoreGet(const char *name) std::string r; unsigned long olen = 0; do { - long n = _dataStoreGetFunction(reinterpret_cast<ZT1_Node *>(this),name,buf,sizeof(buf),r.length(),&olen); + long n = _dataStoreGetFunction(reinterpret_cast<ZT1_Node *>(this),_uptr,name,buf,sizeof(buf),r.length(),&olen); if (n <= 0) return std::string(); r.append(buf,n); @@ -467,6 +469,7 @@ extern "C" { enum ZT1_ResultCode ZT1_Node_new( ZT1_Node **node, + void *uptr, uint64_t now, ZT1_DataStoreGetFunction dataStoreGetFunction, ZT1_DataStorePutFunction dataStorePutFunction, @@ -478,7 +481,7 @@ enum ZT1_ResultCode ZT1_Node_new( { *node = (ZT1_Node *)0; try { - *node = reinterpret_cast<ZT1_Node *>(new ZeroTier::Node(now,dataStoreGetFunction,dataStorePutFunction,wirePacketSendFunction,virtualNetworkFrameFunction,virtualNetworkConfigFunction,eventCallback,overrideRootTopology)); + *node = reinterpret_cast<ZT1_Node *>(new ZeroTier::Node(now,uptr,dataStoreGetFunction,dataStorePutFunction,wirePacketSendFunction,virtualNetworkFrameFunction,virtualNetworkConfigFunction,eventCallback,overrideRootTopology)); return ZT1_RESULT_OK; } catch (std::bad_alloc &exc) { return ZT1_RESULT_FATAL_ERROR_OUT_OF_MEMORY; |
