diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-04-15 15:12:09 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-04-15 15:12:09 -0700 |
| commit | 6369c264e2b54f7eb65a9f0f071ef7599ec7b20a (patch) | |
| tree | b2570a21eb6d02040256d8a84855361da8c19e75 /node | |
| parent | 871473255b7b0c5ad6507f0fe62ca6998a41f678 (diff) | |
| download | infinitytier-6369c264e2b54f7eb65a9f0f071ef7599ec7b20a.tar.gz infinitytier-6369c264e2b54f7eb65a9f0f071ef7599ec7b20a.zip | |
Rename netconf to controller and NetworkConfigMaster to NetworkController for consistency.
Diffstat (limited to 'node')
| -rw-r--r-- | node/IncomingPacket.cpp | 28 | ||||
| -rw-r--r-- | node/Network.cpp | 18 | ||||
| -rw-r--r-- | node/Network.hpp | 6 | ||||
| -rw-r--r-- | node/NetworkConfig.cpp | 2 | ||||
| -rw-r--r-- | node/NetworkConfig.hpp | 8 | ||||
| -rw-r--r-- | node/NetworkController.hpp (renamed from node/NetworkConfigMaster.hpp) | 8 | ||||
| -rw-r--r-- | node/Node.cpp | 10 | ||||
| -rw-r--r-- | node/Node.hpp | 2 | ||||
| -rw-r--r-- | node/RuntimeEnvironment.hpp | 8 |
9 files changed, 45 insertions, 45 deletions
diff --git a/node/IncomingPacket.cpp b/node/IncomingPacket.cpp index 67e2ae2a..967f50f2 100644 --- a/node/IncomingPacket.cpp +++ b/node/IncomingPacket.cpp @@ -38,7 +38,7 @@ #include "Topology.hpp" #include "Switch.hpp" #include "Peer.hpp" -#include "NetworkConfigMaster.hpp" +#include "NetworkController.hpp" #include "SelfAwareness.hpp" namespace ZeroTier { @@ -361,14 +361,14 @@ bool IncomingPacket::_doOK(const RuntimeEnvironment *RR,const SharedPtr<Peer> &p if (dict.length()) { if (nw->setConfiguration(Dictionary(dict)) == 2) { // 2 == accepted and actually new /* If this configuration was indeed new, we do another - * netconf request with its revision. We do this in - * order to (a) tell the netconf server we got it (it + * controller request with its revision. We do this in + * order to (a) tell the network controller we got it (it * won't send a duplicate if ts == current), and (b) - * get another one if the netconf is changing rapidly + * get another one if the controller is changing rapidly * until we finally have the final version. * - * Note that we don't do this for netconf masters with - * versions <= 1.0.3, since those regenerate a new netconf + * Note that we don't do this for network controllers with + * versions <= 1.0.3, since those regenerate a new controller * with a new revision every time. In that case this double * confirmation would create a race condition. */ const SharedPtr<NetworkConfig> nc(nw->config2()); @@ -672,10 +672,10 @@ bool IncomingPacket::_doNETWORK_CONFIG_REQUEST(const RuntimeEnvironment *RR,cons const uint64_t pid = packetId(); peer->received(RR,_remoteAddress,_linkDesperation,h,pid,Packet::VERB_NETWORK_CONFIG_REQUEST,0,Packet::VERB_NOP); - if (RR->netconfMaster) { + if (RR->localNetworkController) { Dictionary netconf; - switch(RR->netconfMaster->doNetworkConfigRequest((h > 0) ? InetAddress() : _remoteAddress,peer->identity(),nwid,metaData,haveRevision,netconf)) { - case NetworkConfigMaster::NETCONF_QUERY_OK: { + switch(RR->localNetworkController->doNetworkConfigRequest((h > 0) ? InetAddress() : _remoteAddress,peer->identity(),nwid,metaData,haveRevision,netconf)) { + case NetworkController::NETCONF_QUERY_OK: { const std::string netconfStr(netconf.toString()); if (netconfStr.length() > 0xffff) { // sanity check since field ix 16-bit TRACE("NETWORK_CONFIG_REQUEST failed: internal error: netconf size %u is too large",(unsigned int)netconfStr.length()); @@ -694,9 +694,9 @@ bool IncomingPacket::_doNETWORK_CONFIG_REQUEST(const RuntimeEnvironment *RR,cons } } } break; - case NetworkConfigMaster::NETCONF_QUERY_OK_BUT_NOT_NEWER: // nothing to do -- netconf has not changed + case NetworkController::NETCONF_QUERY_OK_BUT_NOT_NEWER: // nothing to do -- netconf has not changed break; - case NetworkConfigMaster::NETCONF_QUERY_OBJECT_NOT_FOUND: { + case NetworkController::NETCONF_QUERY_OBJECT_NOT_FOUND: { Packet outp(peer->address(),RR->identity.address(),Packet::VERB_ERROR); outp.append((unsigned char)Packet::VERB_NETWORK_CONFIG_REQUEST); outp.append(pid); @@ -705,7 +705,7 @@ bool IncomingPacket::_doNETWORK_CONFIG_REQUEST(const RuntimeEnvironment *RR,cons outp.armor(peer->key(),true); RR->node->putPacket(_remoteAddress,outp.data(),outp.size(),_linkDesperation); } break; - case NetworkConfigMaster::NETCONF_QUERY_ACCESS_DENIED: { + case NetworkController::NETCONF_QUERY_ACCESS_DENIED: { Packet outp(peer->address(),RR->identity.address(),Packet::VERB_ERROR); outp.append((unsigned char)Packet::VERB_NETWORK_CONFIG_REQUEST); outp.append(pid); @@ -714,11 +714,11 @@ bool IncomingPacket::_doNETWORK_CONFIG_REQUEST(const RuntimeEnvironment *RR,cons outp.armor(peer->key(),true); RR->node->putPacket(_remoteAddress,outp.data(),outp.size(),_linkDesperation); } break; - case NetworkConfigMaster::NETCONF_QUERY_INTERNAL_SERVER_ERROR: + case NetworkController::NETCONF_QUERY_INTERNAL_SERVER_ERROR: TRACE("NETWORK_CONFIG_REQUEST failed: internal error: %s",netconf.get("error","(unknown)").c_str()); break; default: - TRACE("NETWORK_CONFIG_REQUEST failed: invalid return value from NetworkConfigMaster::doNetworkConfigRequest()"); + TRACE("NETWORK_CONFIG_REQUEST failed: invalid return value from NetworkController::doNetworkConfigRequest()"); break; } } else { diff --git a/node/Network.cpp b/node/Network.cpp index 7fa17ef1..1c786d24 100644 --- a/node/Network.cpp +++ b/node/Network.cpp @@ -36,7 +36,7 @@ #include "Switch.hpp" #include "Packet.hpp" #include "Buffer.hpp" -#include "NetworkConfigMaster.hpp" +#include "NetworkController.hpp" namespace ZeroTier { @@ -243,21 +243,21 @@ int Network::setConfiguration(const Dictionary &conf,bool saveToDisk) void Network::requestConfiguration() { - if (_id == ZT_TEST_NETWORK_ID) // pseudo-network-ID, no netconf master + if (_id == ZT_TEST_NETWORK_ID) // pseudo-network-ID, uses locally generated static config return; if (controller() == RR->identity.address()) { - if (RR->netconfMaster) { + if (RR->localNetworkController) { SharedPtr<NetworkConfig> nconf(config2()); Dictionary newconf; - switch(RR->netconfMaster->doNetworkConfigRequest(InetAddress(),RR->identity,_id,Dictionary(),(nconf) ? nconf->revision() : (uint64_t)0,newconf)) { - case NetworkConfigMaster::NETCONF_QUERY_OK: + switch(RR->localNetworkController->doNetworkConfigRequest(InetAddress(),RR->identity,_id,Dictionary(),(nconf) ? nconf->revision() : (uint64_t)0,newconf)) { + case NetworkController::NETCONF_QUERY_OK: this->setConfiguration(newconf,true); return; - case NetworkConfigMaster::NETCONF_QUERY_OBJECT_NOT_FOUND: + case NetworkController::NETCONF_QUERY_OBJECT_NOT_FOUND: this->setNotFound(); return; - case NetworkConfigMaster::NETCONF_QUERY_ACCESS_DENIED: + case NetworkController::NETCONF_QUERY_ACCESS_DENIED: this->setAccessDenied(); return; default: @@ -269,7 +269,7 @@ void Network::requestConfiguration() } } - TRACE("requesting netconf for network %.16llx from netconf master %s",(unsigned long long)_id,controller().toString().c_str()); + TRACE("requesting netconf for network %.16llx from controller %s",(unsigned long long)_id,controller().toString().c_str()); Packet outp(controller(),RR->identity.address(),Packet::VERB_NETWORK_CONFIG_REQUEST); outp.append((uint64_t)_id); outp.append((uint16_t)0); // no meta-data @@ -304,7 +304,7 @@ void Network::addMembershipCertificate(const CertificateOfMembership &cert,bool SharedPtr<Peer> signer(RR->topology->getPeer(cert.signedBy())); if (!signer) { - // This would be rather odd, since this is our netconf master... could happen + // This would be rather odd, since this is our controller... could happen // if we get packets before we've gotten config. RR->sw->requestWhois(cert.signedBy()); return; diff --git a/node/Network.hpp b/node/Network.hpp index 213b44c5..79ae3a90 100644 --- a/node/Network.hpp +++ b/node/Network.hpp @@ -88,7 +88,7 @@ public: inline uint64_t id() const throw() { return _id; } /** - * @return Address of network's netconf master (most significant 40 bits of ID) + * @return Address of network's controller (most significant 40 bits of ID) */ inline Address controller() throw() { return Address(_id >> 24); } @@ -148,7 +148,7 @@ public: int setConfiguration(const Dictionary &conf,bool saveToDisk = true); /** - * Set netconf failure to 'access denied' -- called in IncomingPacket when netconf master reports this + * Set netconf failure to 'access denied' -- called in IncomingPacket when controller reports this */ inline void setAccessDenied() { @@ -157,7 +157,7 @@ public: } /** - * Set netconf failure to 'not found' -- called by PacketDecider when netconf master reports this + * Set netconf failure to 'not found' -- called by PacketDecider when controller reports this */ inline void setNotFound() { diff --git a/node/NetworkConfig.cpp b/node/NetworkConfig.cpp index a034b15f..6cab4b41 100644 --- a/node/NetworkConfig.cpp +++ b/node/NetworkConfig.cpp @@ -109,7 +109,7 @@ void NetworkConfig::_fromDictionary(const Dictionary &d) throw std::invalid_argument("configuration contains zero network ID"); _timestamp = Utils::hexStrToU64(d.get(ZT_NETWORKCONFIG_DICT_KEY_TIMESTAMP).c_str()); - _revision = Utils::hexStrToU64(d.get(ZT_NETWORKCONFIG_DICT_KEY_REVISION,"1").c_str()); // older netconf masters don't send this, so default to 1 + _revision = Utils::hexStrToU64(d.get(ZT_NETWORKCONFIG_DICT_KEY_REVISION,"1").c_str()); // older controllers don't send this, so default to 1 memset(_etWhitelist,0,sizeof(_etWhitelist)); std::vector<std::string> ets(Utils::split(d.get(ZT_NETWORKCONFIG_DICT_KEY_ALLOWED_ETHERNET_TYPES).c_str(),",","","")); diff --git a/node/NetworkConfig.hpp b/node/NetworkConfig.hpp index 31e47f41..02c5ba3f 100644 --- a/node/NetworkConfig.hpp +++ b/node/NetworkConfig.hpp @@ -68,9 +68,9 @@ namespace ZeroTier { #define ZT_NETWORKCONFIG_DICT_KEY_RELAYS "rl" /** - * Network configuration received from netconf master nodes + * Network configuration received from network controller nodes * - * This is an immutable value object created from a dictionary received from netconf master. + * This is an immutable value object created from a dictionary received from controller. */ class NetworkConfig { @@ -102,10 +102,10 @@ public: * Create an instance of a NetworkConfig for the test network ID * * The test network ID is defined as ZT_TEST_NETWORK_ID. This is a - * "fake" network with no real netconf master and default options. + * "fake" network with no real controller and default options. * * @param self This node's ZT address - * @return Configured instance of netconf for test network ID + * @return Configuration for test network ID */ static SharedPtr<NetworkConfig> createTestNetworkConfig(const Address &self); diff --git a/node/NetworkConfigMaster.hpp b/node/NetworkController.hpp index f3b013e4..32b8f053 100644 --- a/node/NetworkConfigMaster.hpp +++ b/node/NetworkController.hpp @@ -43,7 +43,7 @@ class RuntimeEnvironment; /** * Interface for network configuration (netconf) master implementations */ -class NetworkConfigMaster +class NetworkController { public: /** @@ -58,8 +58,8 @@ public: NETCONF_QUERY_INTERNAL_SERVER_ERROR = 4 }; - NetworkConfigMaster() {} - virtual ~NetworkConfigMaster() {} + NetworkController() {} + virtual ~NetworkController() {} /** * Handle a network config request, sending replies if necessary @@ -78,7 +78,7 @@ public: * @param result Dictionary to receive resulting signed netconf on success * @return Returns NETCONF_QUERY_OK if result dictionary is valid, or an error code on error */ - virtual NetworkConfigMaster::ResultCode doNetworkConfigRequest( + virtual NetworkController::ResultCode doNetworkConfigRequest( const InetAddress &fromAddr, const Identity &identity, uint64_t nwid, diff --git a/node/Node.cpp b/node/Node.cpp index c6ae54bd..801d4078 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -30,7 +30,7 @@ #include "Constants.hpp" #include "Node.hpp" #include "RuntimeEnvironment.hpp" -#include "NetworkConfigMaster.hpp" +#include "NetworkController.hpp" #include "CMWC4096.hpp" #include "Switch.hpp" #include "Multicaster.hpp" @@ -407,9 +407,9 @@ void Node::freeQueryResult(void *qr) ::free(qr); } -void Node::setNetconfMaster(void *networkConfigMasterInstance) +void Node::setNetconfMaster(void *networkControllerInstance) { - RR->netconfMaster = reinterpret_cast<NetworkConfigMaster *>(networkConfigMasterInstance); + RR->localNetworkController = reinterpret_cast<NetworkController *>(networkControllerInstance); } /****************************************************************************/ @@ -654,10 +654,10 @@ void ZT1_Node_freeQueryResult(ZT1_Node *node,void *qr) } catch ( ... ) {} } -void ZT1_Node_setNetconfMaster(ZT1_Node *node,void *networkConfigMasterInstance) +void ZT1_Node_setNetconfMaster(ZT1_Node *node,void *networkControllerInstance) { try { - reinterpret_cast<ZeroTier::Node *>(node)->setNetconfMaster(networkConfigMasterInstance); + reinterpret_cast<ZeroTier::Node *>(node)->setNetconfMaster(networkControllerInstance); } catch ( ... ) {} } diff --git a/node/Node.hpp b/node/Node.hpp index 429e5171..f07776da 100644 --- a/node/Node.hpp +++ b/node/Node.hpp @@ -105,7 +105,7 @@ public: ZT1_VirtualNetworkConfig *networkConfig(uint64_t nwid) const; ZT1_VirtualNetworkList *networks() const; void freeQueryResult(void *qr); - void setNetconfMaster(void *networkConfigMasterInstance); + void setNetconfMaster(void *networkControllerInstance); // Internal functions ------------------------------------------------------ diff --git a/node/RuntimeEnvironment.hpp b/node/RuntimeEnvironment.hpp index 6bb8c3cf..228040e7 100644 --- a/node/RuntimeEnvironment.hpp +++ b/node/RuntimeEnvironment.hpp @@ -42,7 +42,7 @@ class CMWC4096; class Node; class Multicaster; class AntiRecursion; -class NetworkConfigMaster; +class NetworkController; class SelfAwareness; /** @@ -54,7 +54,7 @@ public: RuntimeEnvironment(Node *n) : node(n), identity(), - netconfMaster((NetworkConfigMaster *)0), + localNetworkController((NetworkController *)0), prng((CMWC4096 *)0), sw((Switch *)0), mc((Multicaster *)0), @@ -72,8 +72,8 @@ public: std::string publicIdentityStr; std::string secretIdentityStr; - // This is set externally to an instance of this base class if netconf functionality is enabled - NetworkConfigMaster *netconfMaster; + // This is set externally to an instance of this base class + NetworkController *localNetworkController; /* * Order matters a bit here. These are constructed in this order |
