Tidy up a few minor protocol things, improve documentation in Packet.hpp.

This commit is contained in:
Adam Ierymenko 2016-08-23 11:29:02 -07:00
parent 77f7dcf40a
commit 0dfc08b317
4 changed files with 120 additions and 68 deletions

View file

@ -65,6 +65,11 @@
*/
#define ZT_NETWORKCONFIG_SPECIALIST_TYPE_ANCHOR 0x0000040000000000ULL
/**
* Device can send CIRCUIT_TESTs for this network
*/
#define ZT_NETWORKCONFIG_SPECIALIST_TYPE_CIRCUIT_TESTER 0x0000080000000000ULL
namespace ZeroTier {
// Dictionary capacity needed for max size network config
@ -273,6 +278,21 @@ public:
return false;
}
/**
* @param byPeer Address to check
* @return True if this peer is allowed to do circuit tests on this network (controller is always true)
*/
inline bool circuitTestingAllowed(const Address &byPeer) const
{
if (byPeer.toInt() == ((networkId >> 24) & 0xffffffffffULL))
return true;
for(unsigned int i=0;i<specialistCount;++i) {
if ((byPeer == specialists[i])&&((specialists[i] & ZT_NETWORKCONFIG_SPECIALIST_TYPE_CIRCUIT_TESTER) != 0))
return true;
}
return false;
}
/**
* @return True if this network config is non-NULL
*/