Simplify network briding modes -- we only need passive toggle and active bridge list, not three mode types. Also change isOpen to isPublic for terminology consistency.
This commit is contained in:
parent
367b5439e1
commit
cf4700bc26
8 changed files with 17 additions and 35 deletions
|
@ -62,7 +62,7 @@ namespace ZeroTier {
|
|||
#define ZT_NETWORKCONFIG_DICT_KEY_IPV6_STATIC "v6s"
|
||||
#define ZT_NETWORKCONFIG_DICT_KEY_CERTIFICATE_OF_MEMBERSHIP "com"
|
||||
#define ZT_NETWORKCONFIG_DICT_KEY_ENABLE_BROADCAST "eb"
|
||||
#define ZT_NETWORKCONFIG_DICT_KEY_BRIDGING_MODE "br"
|
||||
#define ZT_NETWORKCONFIG_DICT_KEY_ALLOW_PASSIVE_BRIDGING "pb"
|
||||
#define ZT_NETWORKCONFIG_DICT_KEY_ACTIVE_BRIDGES "ab"
|
||||
|
||||
/**
|
||||
|
@ -75,16 +75,6 @@ class NetworkConfig
|
|||
public:
|
||||
friend class SharedPtr<NetworkConfig>;
|
||||
|
||||
/**
|
||||
* Network bridging mode
|
||||
*/
|
||||
enum BridgingMode
|
||||
{
|
||||
BRIDGING_DISABLED = 0, // no bridging
|
||||
BRIDGING_ACTIVE_ONLY = 1, // only active bridges may bridge
|
||||
BRIDGING_PERMISSIVE = 2 // allow passive bridging by any peer
|
||||
};
|
||||
|
||||
/**
|
||||
* Tuple of multicast rate parameters
|
||||
*/
|
||||
|
@ -129,7 +119,8 @@ public:
|
|||
inline unsigned int multicastPrefixBits() const throw() { return _multicastPrefixBits; }
|
||||
inline unsigned int multicastDepth() const throw() { return _multicastDepth; }
|
||||
inline const std::map<MulticastGroup,MulticastRate> &multicastRates() const throw() { return _multicastRates; }
|
||||
inline bool isOpen() const throw() { return (!_private); }
|
||||
inline bool allowPassiveBridging() const throw() { return _allowPassiveBridging; }
|
||||
inline bool isPublic() const throw() { return (!_private); }
|
||||
inline bool isPrivate() const throw() { return _private; }
|
||||
inline const std::string &name() const throw() { return _name; }
|
||||
inline const std::string &description() const throw() { return _description; }
|
||||
|
@ -143,17 +134,8 @@ public:
|
|||
* @return True if this network allows bridging
|
||||
*/
|
||||
inline bool permitsBridging(const Address &fromPeer) const
|
||||
throw()
|
||||
{
|
||||
switch(_bridgingMode) {
|
||||
case BRIDGING_ACTIVE_ONLY:
|
||||
return (_activeBridges.count(fromPeer) > 0);
|
||||
case BRIDGING_PERMISSIVE:
|
||||
return true;
|
||||
//case BRIDGING_DISABLED:
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return ((_allowPassiveBridging) ? true : (_activeBridges.count(fromPeer) > 0));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -175,7 +157,7 @@ private:
|
|||
Address _issuedTo;
|
||||
unsigned int _multicastPrefixBits;
|
||||
unsigned int _multicastDepth;
|
||||
BridgingMode _bridgingMode;
|
||||
bool _allowPassiveBridging;
|
||||
bool _private;
|
||||
bool _enableBroadcast;
|
||||
std::string _name;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue