mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-31 08:25:38 +00:00
Wire through upstream stuff and add setRole().
This commit is contained in:
parent
6e1da35c12
commit
673c0c811e
@ -1784,6 +1784,17 @@ int ZT_Node_addLocalInterfaceAddress(ZT_Node *node,const struct sockaddr_storage
|
|||||||
*/
|
*/
|
||||||
void ZT_Node_clearLocalInterfaceAddresses(ZT_Node *node);
|
void ZT_Node_clearLocalInterfaceAddresses(ZT_Node *node);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set peer role
|
||||||
|
*
|
||||||
|
* Right now this can only be used to set a peer to either LEAF or
|
||||||
|
* UPSTREAM, since roots are fixed and defined by the World.
|
||||||
|
*
|
||||||
|
* @param ztAddress ZeroTier address (least significant 40 bits)
|
||||||
|
* @param role New peer role (LEAF or UPSTREAM)
|
||||||
|
*/
|
||||||
|
void ZT_Node_setRole(ZT_Node *node,uint64_t ztAddress,ZT_PeerRole role);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a network configuration master instance for this node
|
* Set a network configuration master instance for this node
|
||||||
*
|
*
|
||||||
|
@ -412,7 +412,7 @@ ZT_PeerList *Node::peers() const
|
|||||||
p->versionRev = -1;
|
p->versionRev = -1;
|
||||||
}
|
}
|
||||||
p->latency = pi->second->latency();
|
p->latency = pi->second->latency();
|
||||||
p->role = RR->topology->isRoot(pi->second->identity()) ? ZT_PEER_ROLE_ROOT : ZT_PEER_ROLE_LEAF;
|
p->role = RR->topology->isRoot(pi->second->identity()) ? ZT_PEER_ROLE_ROOT : (RR->topology->isUpstream(pi->second->identity()) ? ZT_PEER_ROLE_UPSTREAM : ZT_PEER_ROLE_LEAF);
|
||||||
|
|
||||||
std::vector< std::pair< SharedPtr<Path>,bool > > paths(pi->second->paths(_now));
|
std::vector< std::pair< SharedPtr<Path>,bool > > paths(pi->second->paths(_now));
|
||||||
SharedPtr<Path> bestp(pi->second->getBestPath(_now,false));
|
SharedPtr<Path> bestp(pi->second->getBestPath(_now,false));
|
||||||
@ -484,6 +484,11 @@ void Node::clearLocalInterfaceAddresses()
|
|||||||
_directPaths.clear();
|
_directPaths.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Node::setRole(uint64_t ztAddress,ZT_PeerRole role)
|
||||||
|
{
|
||||||
|
RR->topology->setUpstream(Address(ztAddress),(role == ZT_PEER_ROLE_UPSTREAM));
|
||||||
|
}
|
||||||
|
|
||||||
void Node::setNetconfMaster(void *networkControllerInstance)
|
void Node::setNetconfMaster(void *networkControllerInstance)
|
||||||
{
|
{
|
||||||
RR->localNetworkController = reinterpret_cast<NetworkController *>(networkControllerInstance);
|
RR->localNetworkController = reinterpret_cast<NetworkController *>(networkControllerInstance);
|
||||||
@ -1007,6 +1012,13 @@ void ZT_Node_clearLocalInterfaceAddresses(ZT_Node *node)
|
|||||||
} catch ( ... ) {}
|
} catch ( ... ) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ZT_Node_setRole(ZT_Node *node,uint64_t ztAddress,ZT_PeerRole role)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
reinterpret_cast<ZeroTier::Node *>(node)->setRole(ztAddress,role);
|
||||||
|
} catch ( ... ) {}
|
||||||
|
}
|
||||||
|
|
||||||
void ZT_Node_setNetconfMaster(ZT_Node *node,void *networkControllerInstance)
|
void ZT_Node_setNetconfMaster(ZT_Node *node,void *networkControllerInstance)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
@ -105,6 +105,7 @@ public:
|
|||||||
void freeQueryResult(void *qr);
|
void freeQueryResult(void *qr);
|
||||||
int addLocalInterfaceAddress(const struct sockaddr_storage *addr);
|
int addLocalInterfaceAddress(const struct sockaddr_storage *addr);
|
||||||
void clearLocalInterfaceAddresses();
|
void clearLocalInterfaceAddresses();
|
||||||
|
void setRole(uint64_t ztAddress,ZT_PeerRole role);
|
||||||
void setNetconfMaster(void *networkControllerInstance);
|
void setNetconfMaster(void *networkControllerInstance);
|
||||||
ZT_ResultCode circuitTestBegin(ZT_CircuitTest *test,void (*reportCallback)(ZT_Node *,ZT_CircuitTest *,const ZT_CircuitTestReport *));
|
ZT_ResultCode circuitTestBegin(ZT_CircuitTest *test,void (*reportCallback)(ZT_Node *,ZT_CircuitTest *,const ZT_CircuitTestReport *));
|
||||||
void circuitTestEnd(ZT_CircuitTest *test);
|
void circuitTestEnd(ZT_CircuitTest *test);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user