summaryrefslogtreecommitdiff
path: root/node/NetworkConfig.hpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-08-23 11:29:02 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-08-23 11:29:02 -0700
commit0dfc08b31724fe42ad7dc6253b3b673aec90c838 (patch)
tree994d36523d3776e804e8b681ffbce69e22cecb15 /node/NetworkConfig.hpp
parent77f7dcf40a8dbb252e155abf0b7de4a5615a15e7 (diff)
downloadinfinitytier-0dfc08b31724fe42ad7dc6253b3b673aec90c838.tar.gz
infinitytier-0dfc08b31724fe42ad7dc6253b3b673aec90c838.zip
Tidy up a few minor protocol things, improve documentation in Packet.hpp.
Diffstat (limited to 'node/NetworkConfig.hpp')
-rw-r--r--node/NetworkConfig.hpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/node/NetworkConfig.hpp b/node/NetworkConfig.hpp
index 0ada4710..9b12aa0e 100644
--- a/node/NetworkConfig.hpp
+++ b/node/NetworkConfig.hpp
@@ -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
@@ -274,6 +279,21 @@ public:
}
/**
+ * @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
*/
inline operator bool() const throw() { return (networkId != 0); }