summaryrefslogtreecommitdiff
path: root/zto/node/Node.cpp
diff options
context:
space:
mode:
authorJoseph Henry <[email protected]>2017-05-30 13:11:43 -0700
committerJoseph Henry <[email protected]>2017-05-30 13:11:43 -0700
commit673d1b9a095025368177088bbf6875d7d3057f2f (patch)
tree3291ad3a81fb076055e7bf173b5766ccdca675be /zto/node/Node.cpp
parent5cfb4c38ef2ab3a3621bf568db6bb2b2bd83a357 (diff)
updated ZTO core1.1.2
Diffstat (limited to 'zto/node/Node.cpp')
-rw-r--r--zto/node/Node.cpp89
1 files changed, 1 insertions, 88 deletions
diff --git a/zto/node/Node.cpp b/zto/node/Node.cpp
index 5848d95..911c9c4 100644
--- a/zto/node/Node.cpp
+++ b/zto/node/Node.cpp
@@ -327,6 +327,7 @@ ZT_ResultCode Node::leave(uint64_t nwid,void **uptr,void *tptr)
} else {
if (uptr)
*uptr = *n->second->userPtr();
+ n->second->externalConfig(&ctmp);
n->second->destroy();
nUserPtr = n->second->userPtr();
}
@@ -502,64 +503,6 @@ void Node::setNetconfMaster(void *networkControllerInstance)
RR->localNetworkController->init(RR->identity,this);
}
-ZT_ResultCode Node::circuitTestBegin(void *tptr,ZT_CircuitTest *test,void (*reportCallback)(ZT_Node *,ZT_CircuitTest *,const ZT_CircuitTestReport *))
-{
- if (test->hopCount > 0) {
- try {
- Packet outp(Address(),RR->identity.address(),Packet::VERB_CIRCUIT_TEST);
- RR->identity.address().appendTo(outp);
- outp.append((uint16_t)((test->reportAtEveryHop != 0) ? 0x03 : 0x02));
- outp.append((uint64_t)test->timestamp);
- outp.append((uint64_t)test->testId);
- outp.append((uint16_t)0); // originator credential length, updated later
- if (test->credentialNetworkId) {
- outp.append((uint8_t)0x01);
- outp.append((uint64_t)test->credentialNetworkId);
- outp.setAt<uint16_t>(ZT_PACKET_IDX_PAYLOAD + 23,(uint16_t)9);
- }
- outp.append((uint16_t)0);
- C25519::Signature sig(RR->identity.sign(reinterpret_cast<const char *>(outp.data()) + ZT_PACKET_IDX_PAYLOAD,outp.size() - ZT_PACKET_IDX_PAYLOAD));
- outp.append((uint16_t)sig.size());
- outp.append(sig.data,(unsigned int)sig.size());
- outp.append((uint16_t)0); // originator doesn't need an extra credential, since it's the originator
- for(unsigned int h=1;h<test->hopCount;++h) {
- outp.append((uint8_t)0);
- outp.append((uint8_t)(test->hops[h].breadth & 0xff));
- for(unsigned int a=0;a<test->hops[h].breadth;++a)
- Address(test->hops[h].addresses[a]).appendTo(outp);
- }
-
- for(unsigned int a=0;a<test->hops[0].breadth;++a) {
- outp.newInitializationVector();
- outp.setDestination(Address(test->hops[0].addresses[a]));
- RR->sw->send(tptr,outp,true);
- }
- } catch ( ... ) {
- return ZT_RESULT_FATAL_ERROR_INTERNAL; // probably indicates FIFO too big for packet
- }
- }
-
- {
- test->_internalPtr = reinterpret_cast<void *>(reportCallback);
- Mutex::Lock _l(_circuitTests_m);
- if (std::find(_circuitTests.begin(),_circuitTests.end(),test) == _circuitTests.end())
- _circuitTests.push_back(test);
- }
-
- return ZT_RESULT_OK;
-}
-
-void Node::circuitTestEnd(ZT_CircuitTest *test)
-{
- Mutex::Lock _l(_circuitTests_m);
- for(;;) {
- std::vector< ZT_CircuitTest * >::iterator ct(std::find(_circuitTests.begin(),_circuitTests.end(),test));
- if (ct == _circuitTests.end())
- break;
- else _circuitTests.erase(ct);
- }
-}
-
ZT_ResultCode Node::clusterInit(
unsigned int myId,
const struct sockaddr_storage *zeroTierPhysicalEndpoints,
@@ -714,20 +657,6 @@ uint64_t Node::prng()
return z + y;
}
-void Node::postCircuitTestReport(const ZT_CircuitTestReport *report)
-{
- std::vector< ZT_CircuitTest * > toNotify;
- {
- Mutex::Lock _l(_circuitTests_m);
- for(std::vector< ZT_CircuitTest * >::iterator i(_circuitTests.begin());i!=_circuitTests.end();++i) {
- if ((*i)->testId == report->testId)
- toNotify.push_back(*i);
- }
- }
- for(std::vector< ZT_CircuitTest * >::iterator i(toNotify.begin());i!=toNotify.end();++i)
- (reinterpret_cast<void (*)(ZT_Node *,ZT_CircuitTest *,const ZT_CircuitTestReport *)>((*i)->_internalPtr))(reinterpret_cast<ZT_Node *>(this),*i,report);
-}
-
void Node::setTrustedPaths(const struct sockaddr_storage *networks,const uint64_t *ids,unsigned int count)
{
RR->topology->setTrustedPaths(reinterpret_cast<const InetAddress *>(networks),ids,count);
@@ -1069,22 +998,6 @@ void ZT_Node_setNetconfMaster(ZT_Node *node,void *networkControllerInstance)
} catch ( ... ) {}
}
-enum ZT_ResultCode ZT_Node_circuitTestBegin(ZT_Node *node,void *tptr,ZT_CircuitTest *test,void (*reportCallback)(ZT_Node *,ZT_CircuitTest *,const ZT_CircuitTestReport *))
-{
- try {
- return reinterpret_cast<ZeroTier::Node *>(node)->circuitTestBegin(tptr,test,reportCallback);
- } catch ( ... ) {
- return ZT_RESULT_FATAL_ERROR_INTERNAL;
- }
-}
-
-void ZT_Node_circuitTestEnd(ZT_Node *node,ZT_CircuitTest *test)
-{
- try {
- reinterpret_cast<ZeroTier::Node *>(node)->circuitTestEnd(test);
- } catch ( ... ) {}
-}
-
enum ZT_ResultCode ZT_Node_clusterInit(
ZT_Node *node,
unsigned int myId,