Adjust terminology

This commit is contained in:
Joseph Henry 2020-06-17 14:54:13 -07:00
commit a33a494d60
13 changed files with 440 additions and 442 deletions

View file

@ -347,11 +347,11 @@ public:
}
}
// Generate set of unique interface names (used for formation of logical slave set in multipath code)
// Generate set of unique interface names (used for formation of logical link set in multipath code)
for(std::map<InetAddress,std::string>::const_iterator ii(localIfAddrs.begin());ii!=localIfAddrs.end();++ii) {
slaveIfNames.insert(ii->second);
linkIfNames.insert(ii->second);
}
for (std::set<std::string>::iterator si(slaveIfNames.begin());si!=slaveIfNames.end();si++) {
for (std::set<std::string>::iterator si(linkIfNames.begin());si!=linkIfNames.end();si++) {
bool bFoundMatch = false;
for(std::map<InetAddress,std::string>::const_iterator ii(localIfAddrs.begin());ii!=localIfAddrs.end();++ii) {
if (ii->second == *si) {
@ -360,7 +360,7 @@ public:
}
}
if (!bFoundMatch) {
slaveIfNames.erase(si);
linkIfNames.erase(si);
}
}
@ -461,15 +461,15 @@ public:
return false;
}
inline std::set<std::string> getSlaveInterfaceNames()
inline std::set<std::string> getLinkInterfaceNames()
{
Mutex::Lock _l(_lock);
return slaveIfNames;
return linkIfNames;
}
private:
std::set<std::string> slaveIfNames;
std::set<std::string> linkIfNames;
_Binding _bindings[ZT_BINDER_MAX_BINDINGS];
std::atomic<unsigned int> _bindingCount;
Mutex _lock;

View file

@ -11,8 +11,8 @@
*/
/****/
#ifndef ZT_SLAVE_HPP
#define ZT_SLAVE_HPP
#ifndef ZT_LINK_HPP
#define ZT_LINK_HPP
#include <string>
@ -20,13 +20,13 @@
namespace ZeroTier {
class Slave
class Link
{
friend class SharedPtr<Slave>;
friend class SharedPtr<Link>;
public:
Slave() {}
Link() {}
/**
*
@ -35,60 +35,60 @@ public:
* @param speed
* @param enabled
* @param mode
* @param failoverToSlaveStr
* @param failoverToLinkStr
* @param userSpecifiedAlloc
*/
Slave(std::string& ifnameStr,
Link(std::string& ifnameStr,
uint8_t ipvPref,
uint32_t speed,
uint32_t slaveMonitorInterval,
uint32_t linkMonitorInterval,
uint32_t upDelay,
uint32_t downDelay,
bool enabled,
uint8_t mode,
std::string failoverToSlaveStr,
std::string failoverToLinkStr,
float userSpecifiedAlloc) :
_ifnameStr(ifnameStr),
_ipvPref(ipvPref),
_speed(speed),
_relativeSpeed(0),
_slaveMonitorInterval(slaveMonitorInterval),
_linkMonitorInterval(linkMonitorInterval),
_upDelay(upDelay),
_downDelay(downDelay),
_enabled(enabled),
_mode(mode),
_failoverToSlaveStr(failoverToSlaveStr),
_failoverToLinkStr(failoverToLinkStr),
_userSpecifiedAlloc(userSpecifiedAlloc),
_isUserSpecified(false)
{}
/**
* @return The string representation of this slave's underlying interface's system name.
* @return The string representation of this link's underlying interface's system name.
*/
inline std::string ifname() { return _ifnameStr; }
/**
* @return Whether this slave is designated as a primary.
* @return Whether this link is designated as a primary.
*/
inline bool primary() { return _mode == ZT_MULTIPATH_SLAVE_MODE_PRIMARY; }
/**
* @return Whether this slave is designated as a spare.
* @return Whether this link is designated as a spare.
*/
inline bool spare() { return _mode == ZT_MULTIPATH_SLAVE_MODE_SPARE; }
/**
* @return The name of the slave interface that should be used in the event of a failure.
* @return The name of the link interface that should be used in the event of a failure.
*/
inline std::string failoverToSlave() { return _failoverToSlaveStr; }
inline std::string failoverToLink() { return _failoverToLinkStr; }
/**
* @return Whether this slave interface was specified by the user or auto-detected.
* @return Whether this link interface was specified by the user or auto-detected.
*/
inline bool isUserSpecified() { return _isUserSpecified; }
/**
* Signify that this slave was specified by the user and not the result of auto-detection.
* Signify that this link was specified by the user and not the result of auto-detection.
*
* @param isUserSpecified
*/
@ -97,59 +97,59 @@ public:
/**
* @return Whether or not the user has specified failover instructions.
*/
inline bool userHasSpecifiedFailoverInstructions() { return _failoverToSlaveStr.length(); }
inline bool userHasSpecifiedFailoverInstructions() { return _failoverToLinkStr.length(); }
/**
* @return The speed of the slave relative to others in the bond.
* @return The speed of the link relative to others in the bond.
*/
inline uint8_t relativeSpeed() { return _relativeSpeed; }
/**
* Sets the speed of the slave relative to others in the bond.
* Sets the speed of the link relative to others in the bond.
*
* @param relativeSpeed The speed relative to the rest of the slave interfaces.
* @param relativeSpeed The speed relative to the rest of the link.
*/
inline void setRelativeSpeed(uint8_t relativeSpeed) { _relativeSpeed = relativeSpeed; }
/**
* Sets the speed of the slave relative to others in the bond.
* Sets the speed of the link relative to others in the bond.
*
* @param relativeSpeed
*/
inline void setMonitorInterval(uint32_t interval) { _slaveMonitorInterval = interval; }
inline void setMonitorInterval(uint32_t interval) { _linkMonitorInterval = interval; }
/**
* @return The absolute speed of the slave interface (as specified by the user.)
* @return The absolute speed of the link (as specified by the user.)
*/
inline uint32_t monitorInterval() { return _slaveMonitorInterval; }
inline uint32_t monitorInterval() { return _linkMonitorInterval; }
/**
* @return The absolute speed of the slave interface (as specified by the user.)
* @return The absolute speed of the link (as specified by the user.)
*/
inline uint32_t speed() { return _speed; }
/**
* @return The address preference for this slave interface (as specified by the user.)
* @return The address preference for this link (as specified by the user.)
*/
inline uint8_t ipvPref() { return _ipvPref; }
/**
* @return The mode (e.g. primary/spare) for this slave interface (as specified by the user.)
* @return The mode (e.g. primary/spare) for this link (as specified by the user.)
*/
inline uint8_t mode() { return _mode; }
/**
* @return The upDelay parameter for all paths on this slave interface.
* @return The upDelay parameter for all paths on this link.
*/
inline uint32_t upDelay() { return _upDelay; }
/**
* @return The downDelay parameter for all paths on this slave interface.
* @return The downDelay parameter for all paths on this link.
*/
inline uint32_t downDelay() { return _downDelay; }
/**
* @return Whether this slave is enabled or disabled
* @return Whether this link is enabled or disabled
*/
inline uint8_t enabled() { return _enabled; }
@ -173,21 +173,21 @@ private:
uint8_t _ipvPref;
/**
* User-specified speed of this slave/link
* User-specified speed of this link
*/
uint32_t _speed;
/**
* Speed relative to other specified slaves/links (computed by Bond)
* Speed relative to other specified links (computed by Bond)
*/
uint8_t _relativeSpeed;
/**
* User-specified interval for monitoring paths on this specific slave
* User-specified interval for monitoring paths on this specific link
* instead of using the more generic interval specified for the entire
* bond.
*/
uint32_t _slaveMonitorInterval;
uint32_t _linkMonitorInterval;
/**
* How long before a path is considered to be usable after coming online. (when using policies that
@ -202,20 +202,20 @@ private:
uint32_t _downDelay;
/**
* Whether this slave is enabled, or (disabled (possibly bad config))
* Whether this link is enabled, or (disabled (possibly bad config))
*/
uint8_t _enabled;
/**
* Whether this slave is designated as a primary, a spare, or no preference.
* Whether this link is designated as a primary, a spare, or no preference.
*/
uint8_t _mode;
/**
* The specific name of the interface to be used in the event that this
* slave fails.
* The specific name of the link to be used in the event that this
* link fails.
*/
std::string _failoverToSlaveStr;
std::string _failoverToLinkStr;
/**
* User-specified allocation
@ -223,7 +223,7 @@ private:
float _userSpecifiedAlloc;
/**
* Whether or not this slave was created as a result of manual user specification. This is
* Whether or not this link was created as a result of manual user specification. This is
* important to know because certain policy decisions are dependent on whether the user
* intents to use a specific set of interfaces.
*/