Factored out multicast propagation algorithm from Switch and Topology, also cleaned up and clarified it a bit.

This commit is contained in:
Adam Ierymenko 2013-07-10 17:24:27 -04:00
parent 47f611e7b8
commit 9e28bbfbb2
10 changed files with 365 additions and 209 deletions

View file

@ -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)
*/