From 9e28bbfbb2671f71527e76dd20fe4a659109ad4b Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 10 Jul 2013 17:24:27 -0400 Subject: Factored out multicast propagation algorithm from Switch and Topology, also cleaned up and clarified it a bit. --- node/Network.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'node/Network.hpp') diff --git a/node/Network.hpp b/node/Network.hpp index 0ed3bef5..ddb8930f 100644 --- a/node/Network.hpp +++ b/node/Network.hpp @@ -42,6 +42,7 @@ #include "RuntimeEnvironment.hpp" #include "MulticastGroup.hpp" #include "NonCopyable.hpp" +#include "MAC.hpp" namespace ZeroTier { @@ -111,6 +112,19 @@ public: return ((_open)||(_members.count(addr) > 0)); } + /** + * Shortcut to check open(), whether MAC is ZeroTier, then isMember() + * + * @param mac MAC address to check + * @return True if MAC is allowed + */ + inline bool isAllowed(const MAC &mac) const + throw() + { + Mutex::Lock _l(_lock); + return ((_open)||((mac.isZeroTier())&&(_members.count(Address(mac)) > 0))); + } + /** * @return True if network is open (no membership required) */ -- cgit v1.2.3