const OBJECT_LIST_SEPARATOR = ',';
/**
- * IP/port number of bootstrap node
+ * Universal node locator of bootstrap node
*/
- private $bootIpPort = '';
+ private $bootUniversalNodeLocator = '';
/**
* Whether this node is anncounced (keep on FALSE!)
$rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class');
// Generate a pseudo-random string
- $randomString = $rngInstance->randomString($length) . ':' . $this->getBootIpPort() . ':' . $this->getRequestInstance()->getRequestElement('mode');
+ $randomString = $rngInstance->randomString($length) . ':' . $this->getBootUniversalNodeLocator() . ':' . $this->getRequestInstance()->getRequestElement('mode');
// Add UUID for even more entropy for the hasher
$randomString .= $this->getCryptoInstance()->createUuid();
/**
* Getter for boot IP/port combination
*
- * @return $bootIpPort The IP/port combination of the boot node
+ * @return $bootUniversalNodeLocator The IP/port combination of the boot node
*/
- protected final function getBootIpPort () {
- return $this->bootIpPort;
+ protected final function getBootUniversalNodeLocator () {
+ return $this->bootUniversalNodeLocator;
}
/**
$isFound = FALSE;
// Run through all configured IPs
- foreach (explode(BaseHubSystem::BOOTSTRAP_NODES_SEPARATOR, $this->getConfigInstance()->getConfigEntry('hub_bootstrap_nodes')) as $ipPort) {
- // Split it up in IP/port
- $ipPortArray = explode(':', $ipPort);
+ foreach (explode(BaseHubSystem::BOOTSTRAP_NODES_SEPARATOR, $this->getConfigInstance()->getConfigEntry('hub_bootstrap_nodes')) as $unl) {
+ // Get back an array from the UNL
+ $unlArray = HubTools::getArrayFromUniversalNodeLocator($unl);
+ // @TODO Unfinished
+ die(__METHOD__ . ':' . print_r($unlArray, TRUE));
// Does it match?
- if ($ipPortArray[0] == $remoteAddr) {
+ if ($unlArray[0] == $remoteAddr) {
// Found it!
$isFound = TRUE;
// Remember the port number
- $this->bootIpPort = $ipPort;
+ $this->bootUniversalNodeLocator = $unl;
// Output message
- self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . '[' . __METHOD__ . ':' . __LINE__ . ']: IP matches remote address ' . $ipPort . '.');
+ self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . '[' . __METHOD__ . ':' . __LINE__ . ']: IP matches remote address ' . $unl . '.');
// Stop further searching
break;
- } elseif ($ipPortArray[0] == $this->getConfigInstance()->getConfigEntry('node_listen_addr')) {
+ } elseif ($unlArray[0] == $this->getConfigInstance()->getConfigEntry('node_listen_addr')) {
/*
* IP matches listen address. At this point we really don't care
* if we can really listen on that address
$isFound = TRUE;
// Remember the port number
- $this->bootIpPort = $ipPort;
+ $this->bootUniversalNodeLocator = $unl;
// Output message
- self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . '[' . __METHOD__ . ':' . __LINE__ . ']: IP matches listen address ' . $ipPort . '.');
+ self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: ' . __FUNCTION__ . '[' . __METHOD__ . ':' . __LINE__ . ']: IP matches listen address ' . $unl . '.');
// Stop further searching
break;
}
/**
- * "Getter" for address:port combination
+ * Determines the universal node locator
*
- * @return $addressPort A address:port combination for this node
+ * @return $unl A an universal node locator for this node
*/
- public final function getAddressPort () {
+ public final function determineUniversalNodeLocator () {
// Get IP and port
- $addressPort = $this->getConfigInstance()->detectServerAddress() . ':' . $this->getConfigInstance()->getConfigEntry('node_listen_port');
+ $unl = $this->getConfigInstance()->detectServerAddress() . ':' . $this->getConfigInstance()->getConfigEntry('node_listen_port');
// Return it
- return $addressPort;
+ return $unl;
}
/**
- * "Getter" for address:port array
+ * "Getter" for universal node locator array
*
- * @return $addressPortArray An array of a address:port combination for this node
+ * @return $unlArray An array of the universal node locator for this node
*/
- public final function getAddressPortArray () {
+ public final function getUniversalNodeLocatorArray () {
// Get IP and port
- $addressPortArray = explode(':', $this->getAddressPort());
+ // @TODO Unfinished
+ die(__METHOD__ . ':' . print_r($this, TRUE));
+ $unlArray = explode(':', $this->determineUniversalNodeLocator());
// Return it
- return $addressPortArray;
+ return $unlArray;
}
/**