]> git.mxchange.org Git - hub.git/commitdiff
Continued rewriting:
authorRoland Haeder <roland@mxchange.org>
Mon, 15 Dec 2014 20:23:31 +0000 (21:23 +0100)
committerRoland Haeder <roland@mxchange.org>
Mon, 15 Dec 2014 22:27:22 +0000 (23:27 +0100)
- IPs are a little "static" which means that you only connect to Internet nodes.
  Universal node locators (UNL) give you the ability to connect also to node
  which are not available over the internet, such as "fax nodes".
- Updated core
- Added new script for finding bad scripts
- Added more stuff towards refacturing to protocol handler
- Introduced discoverUniversalNodeLocatorByConfiguredAddress()
- Introduced resolveUniversalNodeLocatorFromConfigKey()
- Other rewrites

Signed-off-by: Roland Haeder <roland@mxchange.org>
48 files changed:
application/hub/class_ApplicationHelper.php
application/hub/config-local.php-dist
application/hub/config.php
application/hub/exceptions/announcement/class_AnnouncementNotAcceptedException.php
application/hub/exceptions/announcement/class_NoAnnouncementAttemptedException.php
application/hub/exceptions/dht/class_DhtBootstrapNotAcceptedException.php
application/hub/exceptions/node/class_NodeSessionIdVerficationException.php
application/hub/exceptions/wrapper/class_NodeAlreadyRegisteredException.php
application/hub/exceptions/wrapper/class_NodeDataMissingException.php
application/hub/interfaces/discovery/unl/class_DiscoverableUniversalNodeLocator.php
application/hub/interfaces/distributable/node/class_DistributableNode.php
application/hub/interfaces/resolver/class_ProtocolResolver.php
application/hub/interfaces/wrapper/class_NodeDhtWrapper.php
application/hub/main/dht/node/class_NodeDhtFacade.php
application/hub/main/discovery/node/class_UniversalNodeLocatorDiscovery.php
application/hub/main/discovery/recipient/package/class_PackageRecipientDiscovery.php
application/hub/main/filter/tags/answer/class_PackageAnnouncementAnswerTagFilter.php
application/hub/main/filter/tags/class_PackageAnnouncementTagFilter.php
application/hub/main/filter/tags/class_PackageDhtBootstrapTagFilter.php
application/hub/main/handler/answer-status/announcement/class_AnnouncementAnswerOkayHandler.php
application/hub/main/handler/message-types/announcement/class_NodeMessageAnnouncementHandler.php
application/hub/main/handler/message-types/answer/class_NodeMessageAnnouncementAnswerHandler.php
application/hub/main/handler/message-types/answer/class_NodeMessageDhtBootstrapAnswerHandler.php
application/hub/main/handler/message-types/class_
application/hub/main/handler/message-types/class_BaseMessageHandler.php
application/hub/main/handler/message-types/dht/class_NodeMessageDhtBootstrapHandler.php
application/hub/main/helper/connection/tcp/class_TcpConnectionHelper.php
application/hub/main/nodes/boot/class_HubBootNode.php
application/hub/main/nodes/class_BaseHubNode.php
application/hub/main/recipient/dht/class_DhtRecipient.php
application/hub/main/recipient/self/class_SelfRecipient.php
application/hub/main/resolver/protocol/class_
application/hub/main/resolver/protocol/tcp/class_TcpProtocolResolver.php
application/hub/main/template/announcement/class_XmlAnnouncementTemplateEngine.php
application/hub/main/template/answer/announcement/class_XmlAnnouncementAnswerTemplateEngine.php
application/hub/main/template/answer/dht/class_XmlDhtBootstrapAnswerTemplateEngine.php
application/hub/main/template/dht/class_XmlDhtBootstrapTemplateEngine.php
application/hub/main/template/publish/class_XmlDhtPublishEntryTemplateEngine.php
application/hub/main/tools/class_HubTools.php
application/hub/main/wrapper/node/class_NodeDistributedHashTableDatabaseWrapper.php
application/hub/main/wrapper/node/class_NodeInformationDatabaseWrapper.php
application/hub/templates/xml/announcement/announcement.xml
application/hub/templates/xml/answer/announcement/announcement_answer.xml
application/hub/templates/xml/answer/dht_bootstrap/dht_bootstrap_answer.xml
application/hub/templates/xml/dht_bootstrap/dht_bootstrap.xml
application/hub/templates/xml/dht_publish/publish.xml
core
find-bad-php.sh [new file with mode: 0755]

index 7352bc010aa33fe2f0ca77c453f08fc795270452..c20e60d77bb8f65c05e6a556f3068b8d1394ee5c 100644 (file)
@@ -152,10 +152,10 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
                // Set this application in registry
                Registry::getRegistry()->addInstance('app', $this);
 
-               // Is no external IP set?
-               if ($this->getConfigInstance()->getConfigEntry('external_ip') == '') {
-                       // Determine external IP
-                       $this->getConfigInstance()->setConfigEntry('external_ip', ConsoleTools::determineExternalIp());
+               // Is no external address set?
+               if ($this->getConfigInstance()->getConfigEntry('external_address') == '') {
+                       // Determine external address
+                       $this->getConfigInstance()->setConfigEntry('external_address', ConsoleTools::determineExternalAddress());
                } // END - if
 
                // Default response is console
index 33430f29c63813db98633245754c6061b09ceed0..5f4bff07a02abfb3f468e9bfd00d7b03e472ebed 100644 (file)
@@ -9,7 +9,7 @@
  * objects which would be rejected by the global network) please change
  * hub_bootstrap_nodes (semicolon-seperated list) to your bootstrapper.
  *
- * You can set external_ip to a hostname, e.g. me.homelinux.org, which will be
+ * You can set external_address to a hostname, e.g. me.homelinux.org, which will be
  * included in the announcement. This is very useful for consumer DSL
  * connections because they might be disconnected every 24 hours and rotate the
  * IP number.
@@ -45,11 +45,11 @@ $cfg->setConfigEntry('node_listen_port', 9060);
 // CFG: NODE-DEFAULT-MODE (can be 'regular', 'list', 'master' or 'boot', default is 'regular')
 $cfg->setConfigEntry('node_default_mode', 'regular');
 
-// CFG: EXTERNAL-IP
-// Use this if auto-detection fails: $cfg->setConfigEntry('external_ip', '');
+// CFG: EXTERNAL-ADDRESS
+// Use this if auto-detection fails: $cfg->setConfigEntry('external_address', '');
 
-// CFG: ALLOW-PUBLISH-INTERNAL-IP
-// Use this in intranet-only environment: $cfg->setConfigEntry('allow_publish_internal_ip', 'Y');
+// CFG: ALLOW-PUBLISH-INTERNAL-ADDRESS
+// Use this in intranet-only environment: $cfg->setConfigEntry('allow_publish_internal_address', 'Y');
 
 // CFG: HUB-BOOTSTRAP-NODES
 $cfg->setConfigEntry('hub_bootstrap_nodes', 'tcp://188.138.90.169:9060');
index f6196ff8b6f106de492d1078625554cf336ae068..b68b510004e0f98c6ebb6913c8d26b1852fcb3f3 100644 (file)
@@ -784,14 +784,14 @@ $cfg->setConfigEntry('private_key', '');
 // CFG: PRIVATE-KEY-HASH
 $cfg->setConfigEntry('private_key_hash', '');
 
-// CFG: INTERNAL-IP
-$cfg->setConfigEntry('internal_ip', ConsoleTools::acquireSelfIPAddress());
+// CFG: INTERNAL-ADDRESS
+$cfg->setConfigEntry('internal_address', ConsoleTools::acquireSelfIPAddress());
 
-// CFG: EXTERNAL-IP
-$cfg->setConfigEntry('external_ip', '');
+// CFG: EXTERNAL-ADDRESS
+$cfg->setConfigEntry('external_address', '');
 
-// CFG: ALLOW-PUBLISH-INTERNAL-IP
-$cfg->setConfigEntry('allow_publish_internal_ip', 'N');
+// CFG: ALLOW-PUBLISH-INTERNAL-ADDRESS
+$cfg->setConfigEntry('allow_publish_internal_address', 'N');
 
 // CFG: NODE-STATUS
 $cfg->setConfigEntry('node_status', 'invalid');
index 46ac205cd94cfa3a41062a51f640513e13f0eb8a..8ec66001ed3ceb6745801b2a9eb6e21f86c8df1e 100644 (file)
@@ -37,8 +37,8 @@ class AnnouncementNotAcceptedException extends FrameworkException {
                        $this->getLine(),
                        $messageArray[1]->__toString(),
                        $messageArray[2][XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID],
-                       $messageArray[2][XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_IP],
-                       $messageArray[2][XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_IP],
+                       $messageArray[2][XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS],
+                       $messageArray[2][XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS],
                        $messageArray[2][XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_LISTEN_PORT],
                        $messageArray[2][XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_NODE_STATUS],
                        $messageArray[2][XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_NODE_MODE]
index c5500752dbeea251c27eb05c33bce20cf23298f8..9f96fdd812f5d519fc273f4aeb9b21f09e3b3430 100644 (file)
@@ -37,8 +37,8 @@ class NoAnnouncementAttemptedException extends FrameworkException {
                        $this->getLine(),
                        $messageArray[1]->__toString(),
                        $messageArray[2][XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID],
-                       $messageArray[2][XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_IP],
-                       $messageArray[2][XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_IP],
+                       $messageArray[2][XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS],
+                       $messageArray[2][XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS],
                        $messageArray[2][XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_LISTEN_PORT],
                        $messageArray[2][XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_NODE_STATUS]
                );
index ad8c18bce23e452795491e6c144a7982d70fcba0..b8f196af361b3acf85994b6c483e969cdf10e28f 100644 (file)
@@ -37,8 +37,8 @@ class DhtBootstrapNotAcceptedException extends FrameworkException {
                        $this->getLine(),
                        $messageArray[0]->getNodeInstance()->__toString(),
                        $messageArray[1][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID],
-                       $messageArray[1][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_IP],
-                       $messageArray[1][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_IP],
+                       $messageArray[1][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS],
+                       $messageArray[1][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS],
                        $messageArray[1][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_LISTEN_PORT],
                        $messageArray[1][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS],
                        $messageArray[1][XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_MODE]
index d91f14453439184a60ee3a4195d7196342526eab..93640c0e78584ca09a6be5a8ccadf54e85ece24d 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * This exception is thrown when a provided session id in a message cannot be
  * verified. This can be the case when e.g. it doesn't match any records or the
- * IP/port combination doesn't match to it.
+ * address doesn't match to it.
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
@@ -37,8 +37,8 @@ class NodeSessionIdVerficationException extends FrameworkException {
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1][XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID],
-                       $messageArray[1][XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_IP],
-                       $messageArray[1][XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_IP],
+                       $messageArray[1][XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS],
+                       $messageArray[1][XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS],
                        $messageArray[1][XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_LISTEN_PORT],
                        $messageArray[1][XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_NODE_STATUS]
                );
index 84da0b169a618c9d5d95a1d4d63af1d6e0ba1e60..887cfd69cfc2e4cfc097a66d26d657660f0c9d9e 100644 (file)
@@ -31,11 +31,11 @@ class NodeAlreadyRegisteredException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf('[%s:%d] Node already registered: session-id=%s, external-ip=%s, listen-port=%s',
+               $message = sprintf('[%s:%d] Node already registered: session-id=%s, external-address=%s, listen-port=%s',
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $msssageArray[1][NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_SESSION_ID],
-                       $msssageArray[1][NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_IP],
+                       $msssageArray[1][NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_ADDRESS],
                        $msssageArray[1][NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_LISTEN_PORT],
                );
 
index a9cd0090a55940c7bf95f300c8facd5f07797c71..4187ba2e625535d1e12303ce81d53aff333cec71 100644 (file)
@@ -31,11 +31,11 @@ class NodeDataMissingException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf('[%s:%d] Node not registered/missing: session-id=%s, external-ip=%s, listen-port=%s',
+               $message = sprintf('[%s:%d] Node not registered/missing: session-id=%s, external-address=%s, listen-port=%s',
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $msssageArray[1][NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_SESSION_ID],
-                       $msssageArray[1][NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_IP],
+                       $msssageArray[1][NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_ADDRESS],
                        $msssageArray[1][NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_LISTEN_PORT],
                );
 
index 9885b370e25889fa37ce13fdd476e08e446fbbe3..769389fcbb05ff3e37f646c4aab621aec4524e8c 100644 (file)
@@ -29,6 +29,19 @@ interface DiscoverableUniversalNodeLocator extends Discoverable {
         * @return      $unlInstance    An instance of a LocateableNode class
         */
        function discoverUniversalNodeLocatorByNode (NodeHelper $nodeInstance);
+
+       /**
+        * "Discovers" the full universal node locator for given configuration entry
+        * which should represent the address part of the UNL. In case of an IP
+        * address, this *must not* include the port number as this is being found
+        * out for you.
+        *
+        * Valid values for $configKey: internal,external
+        *
+        * @param       $configKey      Key for address to get (valid: internal,external)
+        * @return      $unl            Universal node locator
+        */
+       function discoverUniversalNodeLocatorByConfiguredAddress ($configKey);
 }
 
 // [EOF]
index 5f5596f8ebae1a422147129171528e386fe357e3..9461918a5741bb361a620f0c88c617f476e6a662 100644 (file)
@@ -35,7 +35,7 @@ interface DistributableNode extends Distributable {
         * following data must always be present:
         *
         * - session-id  (for finding the node's record together with below data)
-        * - external-ip (hostname or IP number)
+        * - external-address (hostname or IP number)
         * - listen-port (TCP/UDP listen port for inbound connections)
         *
         * @param       $messageData            An array with all minimum message data
index 84bc584c92a0b6dc8baaaddd71ac77b73aa87698..d33a492335b322ad264763b088a90e45717a038d 100644 (file)
@@ -1,4 +1,4 @@
-OS<?php
+<?php
 /**
  * An interface for ProtocolResolvers
  *
@@ -23,13 +23,21 @@ OS<?php
  */
 interface ProtocolResolver extends FrameworkInterface {
        /**
-        * Returns an command instance for a given NodeHelper instance or null if it
-        * was not found.
+        * Returns an instance of a LocateableNode class for a given NodeHelper
+        * instance or null if it was not found.
         *
         * @param       $nodeInstance   An instance of a NodeHelper class
         * @return      $unlInstance    An instance of a LocateableNode class
         */
-       function resolveUniversalResourceLocatorFromNodeHelper (NodeHelper $nodeInstance);
+       function resolveUniversalNodeLocatorFromNodeHelper (NodeHelper $nodeInstance);
+
+       /**
+        * Returns the UNL as string from given configuration key.
+        *
+        * @param       $configKey      Configuration key for UNL address (valid: internal,external)
+        * @return      $unl            Universal node locator
+        */
+       function resolveUniversalNodeLocatorFromConfigKey ($configKey);
 }
 
 // [EOF]
index 33a547495b77b9957606b1c00d1e9bc9a09a9ed8..d2b21e337f91135b6062ba82e5fee6b2c2584a75 100644 (file)
@@ -38,7 +38,7 @@ interface NodeDhtWrapper extends DatabaseWrapper {
 
        /**
         * Checks whether the local (*this*) node is registered in the DHT by
-        * checking if the external ip/port is found.
+        * checking if the external address is found.
         *
         * @return      $isRegistered   Whether *this* node is registered in the DHT
         */
index 281c51a752fd1716b57ce4cd7450b422f31627d9..bccf4116e3087d4b8ef3eca9df6c78b574221a39 100644 (file)
@@ -158,7 +158,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
         * following data must always be present:
         *
         * - session-id  (for finding the node's record together with below data)
-        * - external-ip (hostname or IP number)
+        * - external-address (hostname or IP number)
         * - listen-port (TCP/UDP listen port for inbound connections)
         *
         * @param       $messageArray           An array with all minimum message data
@@ -174,7 +174,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DHT-FACADE[' . __METHOD__ . ':' . __LINE__ . ']: state=' . $this->getPrintableState() . ',messageData=' . print_r($messageData, TRUE) . ',handlerInstance=' . $handlerInstance->__toString() . ',forceUpdate=' . intval($forceUpdate) . ',count(getSearchData())=' . count($handlerInstance->getSearchData()));
 
-               // Search for the node's session id and external IP/hostname + TCP/UDP listen port
+               // Search for the node's session id and external address/hostname + TCP/UDP listen port
                foreach ($handlerInstance->getSearchData() as $key) {
                        // Debug message
                        //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DHT-FACADE[' . __METHOD__ . ':' . __LINE__ . ']: state=' . $this->getPrintableState() . ',key=' . $key);
@@ -208,8 +208,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
                } else {
                        /*
                         * Do not register non-existent nodes here. This is maybe fatal,
-                        * caused by "stolen" session id and/or not matching IP
-                        * number/port combination.
+                        * caused by "stolen" session id and/or not matching address.
                         */
                        throw new NodeSessionIdVerficationException(array($this, $messageData), BaseHubSystem::EXCEPTION_NODE_SESSION_ID_NOT_VERIFYING);
                }
index 8011b3aa60d8653464b62843822dc947f68dee14..b3e0ee1b1b6c5600e84c054edbcacd7a3c166d09 100644 (file)
@@ -59,9 +59,44 @@ class UniversalNodeLocatorDiscovery extends BaseNodeDiscovery implements Discove
                $resolverInstance = ProtocolResolverFactory::createResolverFromConfiguredProtocol();
 
                // Then resolve the node instance into an UNL instance
-               $unlInstance = $resolverInstance->resolveUniversalResourceLocatorFromNodeHelper($nodeInstance);
+               $unlInstance = $resolverInstance->resolveUniversalNodeLocatorFromNodeHelper($nodeInstance);
                die(__METHOD__ . ':unlInstance=' . print_r($unlInstance, TRUE));
        }
+
+       /**
+        * "Discovers" the full universal node locator for given configuration entry
+        * which should represent the address part of the UNL. In case of an IP
+        * address, this *must not* include the port number as this is being found
+        * out for you.
+        *
+        * Valid values for $configKey: internal,external
+        *
+        * @param       $configKey      Key for address to get (valid: internal,external)
+        * @return      $unl            Universal node locator
+        */
+       public function discoverUniversalNodeLocatorByConfiguredAddress ($configKey) {
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('UNL-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']:configKey=' . $configKey . ' - CALLED!');
+
+               // Is there cache?
+               if (!isset($GLOBALS[__METHOD__][$configKey])) {
+                       // Validate config key
+                       assert(($configKey == 'internal') || ($configKey == 'external'));
+
+                       /*
+                        * First get an instance from the configured hub communication protocol
+                        * type (which is mostly TCP, so you get a TcpProtocolResolver here).
+                        */
+                       $resolverInstance = ProtocolResolverFactory::createResolverFromConfiguredProtocol();
+
+                       // Get back the full UNL
+                       $GLOBALS[__METHOD__][$configKey] = $resolverInstance->resolveUniversalNodeLocatorFromConfigKey($configKey);
+               } // END - if
+
+               // Return cached value
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('UNL-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']:configKey=' . $configKey . ',unl=' . $GLOBALS[__METHOD__][$configKey] . ' - EXIT!');
+               return $GLOBALS[__METHOD__][$configKey];
+       }
 }
 
 // [EOF]
index 9fa8fe942381eeac1227c4bed36cfc590bf7d7da..dbde1508d660dda23cdb0b2446deec74bd4e9eb9 100644 (file)
@@ -98,18 +98,19 @@ class PackageRecipientDiscovery extends BaseRecipientDiscovery implements Discov
                $recipient = explode(':', $decodedData[NetworkPackage::PACKAGE_DATA_RECIPIENT]);
 
                // Is the 'recipient' field same as this peer's IP?
-               if ((($recipient[0] == HubTools::determineOwnExternalIp()) && ($recipient[1] == $this->getConfigInstance()->getConfigEntry('node_listen_port'))) || ($recipient[0] == $this->getConfigInstance()->getServerAddress())) {
+               if ((($recipient[0] == HubTools::determineOwnExternalAddress()) && ($recipient[1] == $this->getConfigInstance()->getConfigEntry('node_listen_port'))) || ($recipient[0] == $this->getConfigInstance()->getServerAddress())) {
                        /*
-                        * Is same as own external IP + TCP/UDP listen port or internal IP, don't do anything here so other
-                        * classes found an empty recipient list for internal (own) handling
-                        * of the original content.
+                        * Is same as own external address + TCP/UDP listen port or
+                        * internal address, don't do anything here so other classes found
+                        * an empty recipient list for internal (own) handling of the
+                        * original content.
                         */
 
                        // Debug output (may flood)
-                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('RECIPIENT-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Recipient ' . $recipient[0] . ' matches own ip (' .  HubTools::determineOwnExternalIp() . ' or ' . $this->getConfigInstance()->getServerAddress() . ')');
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('RECIPIENT-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Recipient ' . $recipient[0] . ' matches own ip (' .  HubTools::determineOwnExternalAddress() . ' or ' . $this->getConfigInstance()->getServerAddress() . ')');
                } else {
                        // Debug output (may flood)
-                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('RECIPIENT-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Recipient ' . $recipient[0] . ' is different than own external ip (' .  HubTools::determineOwnExternalIp() . ') nor internal ip (' . $this->getConfigInstance()->getServerAddress() . '), need to forward (not yet implemented)!');
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('RECIPIENT-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Recipient ' . $recipient[0] . ' is different than own external address (' .  HubTools::determineOwnExternalAddress() . ') nor internal address (' . $this->getConfigInstance()->getServerAddress() . '), need to forward (not yet implemented)!');
 
                        // This package is to be delivered to someone else, so add it
                        $this->getListInstance()->addEntry('unl', $decodedData[NetworkPackage::PACKAGE_DATA_RECIPIENT]);
index c8b88ca9ab9ab64c4ef46807d70918fb8ca377ab..290fba128047360c05c1ee5d7a63fb90ffd86562 100644 (file)
@@ -33,12 +33,12 @@ class PackageAnnouncementAnswerTagFilter extends BaseNodeFilter implements Filte
 
                // Init array
                $this->dataXmlNodes = array(
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_IP   => '',
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_IP   => '',
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_NODE_STATUS   => '',
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID    => '',
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_LISTEN_PORT   => 9060,
-                       BaseXmlAnswerTemplateEngine::ANSWER_STATUS                           => '',
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS => '',
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS => '',
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_NODE_STATUS      => '',
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID       => '',
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_LISTEN_PORT      => 9060,
+                       BaseXmlAnswerTemplateEngine::ANSWER_STATUS                              => '',
                );
        }
 
index 6b3cb8f6f2d4eef7906f6722278523de02bd2a64..5dac03418558aee63b8e9980059a740fd3dfd11f 100644 (file)
@@ -33,12 +33,12 @@ class PackageAnnouncementTagFilter extends BaseNodeFilter implements FilterableP
 
                // Init array
                $this->dataXmlNodes = array(
-                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_IP => '',
-                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_IP => '',
-                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_NODE_STATUS => '',
-                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_NODE_MODE   => '',
-                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID  => '',
-                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_LISTEN_PORT => 9060,
+                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS => '',
+                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS => '',
+                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_NODE_STATUS      => '',
+                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_NODE_MODE        => '',
+                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID       => '',
+                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_LISTEN_PORT      => 9060,
                );
        }
 
index beb2edd1488396ed0397ae608c6550d8d7c72d4c..151137d30b56b1ed93359ef19d3492e7a54abc79 100644 (file)
@@ -33,12 +33,12 @@ class PackageDhtBootstrapTagFilter extends BaseNodeFilter implements FilterableP
 
                // Init array
                $this->dataXmlNodes = array(
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_IP => '',
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_IP => '',
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS => '',
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_MODE   => '',
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID  => '',
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_LISTEN_PORT => 9060,
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS => '',
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS => '',
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS      => '',
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_MODE        => '',
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID       => '',
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_LISTEN_PORT      => 9060,
                );
        }
 
index e5d11f7cc4e5f055e415467ea36ed87ad008073e..53775e3aed370523557aa0d1d346005c1bcf5888 100644 (file)
@@ -34,7 +34,7 @@ class AnnouncementAnswerOkayHandler extends BaseAnserStatusHandler implements Ha
                // Init array
                $this->searchData = array(
                        XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID,
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_IP,
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS,
                        XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_LISTEN_PORT
                );
 
@@ -94,14 +94,14 @@ class AnnouncementAnswerOkayHandler extends BaseAnserStatusHandler implements Ha
         *
         * The following array is being handled over:
         *
-        *   my-external-ip => 1.2.3.4
-        *   my-internal-ip => 5.6.7.8
-        *   my-status      => reachable
-        *   my-session-id  => aaabbbcccdddeeefff123456789
-        *   my-tcp-port    => 9060
-        *   my-udp-port    => 9060
-        *   answer-status  => OKAY
-        *   message_type   => announcement_answer
+        *   my-external-address => 1.2.3.4
+        *   my-internal-address => 5.6.7.8
+        *   my-status           => reachable
+        *   my-session-id       => aaabbbcccdddeeefff123456789
+        *   my-tcp-port         => 9060
+        *   my-udp-port         => 9060
+        *   answer-status       => OKAY
+        *   message_type        => announcement_answer
         *
         * @param       $messageData    An array with all message data
         * @return      void
index 1c8111bcf16b0bd916805a255a5112b5b1f5a152..dc83f404a09b7175f48c99c5cb966fb32a33e8b9 100644 (file)
@@ -36,8 +36,8 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl
 
                // Init message data array
                $this->messageDataElements = array(
-                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_IP,
-                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_IP,
+                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS,
+                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS,
                        XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_NODE_STATUS,
                        XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_NODE_MODE,
                        XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID,
@@ -46,23 +46,23 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl
 
                // Init message-data->configuration translation array
                $this->messageToConfig = array(
-                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_IP => 'your_external_ip',
-                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_IP => 'your_internal_ip',
-                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID  => 'your_session_id'
+                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS => 'your_external_address',
+                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS => 'your_internal_address',
+                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID       => 'your_session_id'
                );
 
                // Init config-copy array
                $this->configCopy = array(
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_IP => 'external_ip',
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_IP => 'internal_ip',
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_NODE_STATUS => 'node_status',
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID  => 'session_id',
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_LISTEN_PORT => 'node_listen_port',
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS => 'external_address',
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS => 'internal_address',
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_NODE_STATUS      => 'node_status',
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID       => 'session_id',
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_LISTEN_PORT      => 'node_listen_port',
                );
 
                // Init array
                $this->searchData = array(
-                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_IP,
+                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS,
                        XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_LISTEN_PORT
                );
        }
index 0fd0d7bded5be4631a844652adeb995724bb5937..02cafcdf62ba3208457ca8c95745ee7282d40199 100644 (file)
@@ -36,8 +36,8 @@ class NodeMessageAnnouncementAnswerHandler extends BaseMessageHandler implements
 
                // Init message data array
                $this->messageDataElements = array(
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_IP,
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_IP,
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS,
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS,
                        XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_NODE_STATUS,
                        XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID,
                        XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_LISTEN_PORT,
@@ -47,25 +47,25 @@ class NodeMessageAnnouncementAnswerHandler extends BaseMessageHandler implements
                // Init message-data->configuration translation array
                $this->messageToConfig = array(
                /*
-                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_IP => 'your_external_ip',
-                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_IP => 'your_internal_ip',
-                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID  => 'your_session_id'
+                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS => 'your_external_address',
+                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS => 'your_internal_address',
+                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID       => 'your_session_id'
                */
                );
 
                // Init config-copy array
                $this->configCopy = array(
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_IP => 'external_ip',
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_IP => 'internal_ip',
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_NODE_STATUS => 'node_status',
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID  => 'session_id',
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_LISTEN_PORT => 'node_listen_port',
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS => 'external_address',
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS => 'internal_address',
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_NODE_STATUS      => 'node_status',
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID       => 'session_id',
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_LISTEN_PORT      => 'node_listen_port',
                );
 
                // Init array
                $this->searchData = array(
                        XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID,
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_IP,
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS,
                        XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_LISTEN_PORT
                );
        }
index 10be0846615a4106647382f00739a0c53dd4833d..d981b685fc28667a5d7fd88a6dc2e6171ae62e67 100644 (file)
@@ -36,8 +36,8 @@ class NodeMessageDhtBootstrapAnswerHandler extends BaseMessageHandler implements
 
                // Init message data array
                $this->messageDataElements = array(
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_IP,
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_IP,
+                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS,
+                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS,
                        XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS,
                        XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID,
                        XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_LISTEN_PORT,
@@ -47,25 +47,25 @@ class NodeMessageDhtBootstrapAnswerHandler extends BaseMessageHandler implements
                // Init message-data->configuration translation array
                $this->messageToConfig = array(
                /*
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_IP => 'your_external_ip',
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_IP => 'your_internal_ip',
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID  => 'your_session_id'
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS => 'your_external_address',
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS => 'your_internal_address',
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID       => 'your_session_id'
                */
                );
 
                // Init config-copy array
                $this->configCopy = array(
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_IP => 'external_ip',
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_IP => 'internal_ip',
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS => 'node_status',
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID  => 'session_id',
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_LISTEN_PORT => 'node_listen_port',
+                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS => 'external_address',
+                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS => 'internal_address',
+                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS      => 'node_status',
+                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID       => 'session_id',
+                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_LISTEN_PORT      => 'node_listen_port',
                );
 
                // Init array
                $this->searchData = array(
                        XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID,
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_IP,
+                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS,
                        XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_LISTEN_PORT
                );
        }
index 074cc3e03c6925e9b85dc4ffeda8d64ac20c40e2..131e3c1c89cba2c2e10525220fc135196d8c2630 100644 (file)
@@ -36,7 +36,7 @@ class NodeMessage???Handler extends BaseMessageHandler implements HandleableMess
 
                // Init message data array
                $this->messageDataElements = array(
-                       Xml???TemplateEngine::!!!_DATA_EXTERNAL_IP,
+                       Xml???TemplateEngine::!!!_DATA_EXTERNAL_ADDRESS,
                        Xml???TemplateEngine::!!!_DATA_NODE_STATUS,
                        Xml???TemplateEngine::!!!_DATA_SESSION_ID,
                        Xml???TemplateEngine::!!!_DATA_LISTEN_PORT,
index f852722e753eca5cea02cbce310e859346ee7cf9..78902af7194494461aceafaa71856ab5ba18e676 100644 (file)
@@ -58,7 +58,7 @@ abstract class BaseMessageHandler extends BaseDataHandler {
         * following data must always be present:
         *
         * - session-id  (for finding the node's record together with below data)
-        * - external-ip (hostname or IP number)
+        * - external-address (hostname or IP number)
         * - listen-port (TCP/UDP listen port for inbound connections)
         *
         * @param       $messageArray   An array with all minimum message data
index 23225957365fea8b157c598f208ec16584b64f47..ee5ce6334c9149ab3c40b03cb0d4c12085dbe3a3 100644 (file)
@@ -36,8 +36,8 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl
 
                // Init message data array
                $this->messageDataElements = array(
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_IP,
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_IP,
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS,
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS,
                        XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS,
                        XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_MODE,
                        XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID,
@@ -46,23 +46,23 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl
 
                // Init message-data->configuration translation array
                $this->messageToConfig = array(
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_IP => 'your_external_ip',
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_IP => 'your_internal_ip',
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID  => 'your_session_id'
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS => 'your_external_address',
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS => 'your_internal_address',
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID       => 'your_session_id'
                );
 
                // Init config-copy array
                $this->configCopy = array(
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_IP => 'external_ip',
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_IP => 'internal_ip',
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS => 'node_status',
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID  => 'session_id',
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_LISTEN_PORT => 'node_listen_port',
+                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS => 'external_address',
+                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS => 'internal_address',
+                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS      => 'node_status',
+                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID       => 'session_id',
+                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_LISTEN_PORT      => 'node_listen_port',
                );
 
                // Init array
                $this->searchData = array(
-                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_IP,
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS,
                        XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_LISTEN_PORT
                );
        }
index 9cbd20fcd53b3d9459a3711b3ebfb6cb15fea7f5..0734089b064f85dca2c9d93d6c4a4e7850be2c07 100644 (file)
@@ -99,9 +99,9 @@ class TcpConnectionHelper extends BaseConnectionHelper implements ConnectionHelp
                        self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-HELPER[' . __METHOD__ . ':' . __LINE__ . ']: Failed to resolve ' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ':' . $e->getMessage());
 
                        // Is the recipient equal as configured IP
-                       if (substr($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT], 0, strlen($helperInstance->getConfigInstance()->getConfigEntry('external_ip'))) == $helperInstance->getConfigInstance()->getConfigEntry('external_ip')) {
-                               // This connects to shipsimu.org and requests /ip.php which will return our external IP number
-                               $recipientData[0] = ConsoleTools::determineExternalIp();
+                       if (substr($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT], 0, strlen($helperInstance->getConfigInstance()->getConfigEntry('external_address'))) == $helperInstance->getConfigInstance()->getConfigEntry('external_address')) {
+                               // This connects to shipsimu.org and requests /ip.php which will return our external address
+                               $recipientData[0] = ConsoleTools::determineExternalAddress();
 
                                // Do we have hostname:ip match?
                                if (strpos($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT], ':') === FALSE) {
@@ -116,11 +116,11 @@ class TcpConnectionHelper extends BaseConnectionHelper implements ConnectionHelp
                                $recipientData[1] = $recipientArray[1];
                        } else {
                                // It doesn't match, we need to take care of this later
-                               $helperInstance->debugInstance($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . '!=' . $helperInstance->getConfigInstance()->getConfigEntry('external_ip'));
+                               $helperInstance->debugInstance($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . '!=' . $helperInstance->getConfigInstance()->getConfigEntry('external_address'));
                        }
                }
 
-               // Set ip/port
+               // Set address and maybe port
                $helperInstance->setAddress($recipientData[0]);
                $helperInstance->setPort($recipientData[1]);
 
index 984e2c86122a01269c1342f94df22f4db27a3a62..ed7a894f79c41437c2dc0011499a4bbe8d5125e7 100644 (file)
@@ -69,7 +69,7 @@ class HubBootNode extends BaseHubNode implements NodeHelper, Registerable {
                        // Is the port the same?
                        if ($bootPort == $ourPort) {
                                // It is the same!
-                               self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: IP/port matches bootstrap node ' . $this->getBootUniversalNodeLocator() . '.');
+                               self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: UNL matches bootstrap node ' . $this->getBootUniversalNodeLocator() . '.');
 
                                // Now, does the mode match
                                if ($this->getRequestInstance()->getRequestElement('mode') == self::NODE_TYPE_BOOT) {
index 398f32aa8bd90aa509e1ee16d45b5e6d0c8d17d4..dc3eb68cd6f6ced39071a30aa21bdc8b98995ad5 100644 (file)
@@ -102,7 +102,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
         * Generates a private key and hashes it (for speeding up things)
         *
         * @param       $searchInstance         An instance of a LocalSearchCriteria class
-        * @return void
+        * @return      void
         */
        private function generatePrivateKeyAndHash (LocalSearchCriteria $searchInstance) {
                // Get an RNG instance
@@ -122,6 +122,54 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
                self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: Created new private key with hash: ' . $this->getPrivateKeyHash() . '');
        }
 
+       /**
+        * Generates an UNL (Universal Node Locator) for the internal address
+        *
+        * @return      $internalUnl    Internal UNL
+        */
+       private function generateInternalUnl () {
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: CALLED!');
+
+               // Is there cache? (This shortens a lot calls)
+               if (!isset($GLOBALS[__METHOD__])) {
+                       // Determine UNL based on this node:
+                       // 1) Get discovery class
+                       $discoveryInstance = ObjectFactory::createObjectByConfiguredName('unl_discovery_class');
+
+                       // 2) "Determine" it
+                       $GLOBALS[__METHOD__] = $discoveryInstance->discoverUniversalNodeLocatorByConfiguredAddress('internal');
+               } // END - if
+
+               // Return it
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: unl=' . $GLOBALS[__METHOD__] . ' - EXIT!');
+               return $GLOBALS[__METHOD__];
+       }
+
+       /**
+        * Generates an UNL (Universal Node Locator) for the external address
+        *
+        * @return      $externalUnl    External UNL
+        */
+       private function generateExternalUnl () {
+               // Debug message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: CALLED!');
+
+               // Is there cache? (This shortens a lot calls)
+               if (!isset($GLOBALS[__METHOD__])) {
+                       // Determine UNL based on this node:
+                       // 1) Get discovery class
+                       $discoveryInstance = ObjectFactory::createObjectByConfiguredName('unl_discovery_class');
+
+                       // 2) "Determine" it
+                       $GLOBALS[__METHOD__] = $discoveryInstance->discoverUniversalNodeLocatorByConfiguredAddress('external');
+               } // END - if
+
+               // Return it
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: unl=' . $GLOBALS[__METHOD__] . ' - EXIT!');
+               return $GLOBALS[__METHOD__];
+       }
+
        /**
         * Generates a random string from various data inluding UUID if PECL
         * extension uuid is installed.
@@ -145,9 +193,9 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
        }
 
        /**
-        * Getter for boot IP/port combination
+        * Getter for boot UNL (Universal Node Locator)
         *
-        * @return      $bootUnl        The IP/port combination of the boot node
+        * @return      $bootUnl        The UNL (Universal Node Locator) of the boot node
         */
        protected final function getBootUniversalNodeLocator () {
                return $this->bootUnl;
@@ -348,7 +396,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
         * @return      void
         */
        public function addElementsToDataSet (StoreableCriteria $criteriaInstance, Requestable $requestInstance = NULL) {
-               // Make sure request instance is set as it is not optional
+               // Make sure the request instance is set as it is not optional.
                assert($requestInstance instanceof Requestable);
 
                // Add node number and type
@@ -368,6 +416,10 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
                        $criteriaInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_PRIVATE_KEY, base64_encode($this->getPrivateKey()));
                        $criteriaInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_PRIVATE_KEY_HASH, $this->getPrivateKeyHash());
                } // END - if
+
+               // Add own external and internal addresses as UNLs
+               $criteriaInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_INTERNAL_UNL, $this->generateInternalUnl());
+               $criteriaInstance->addCriteria(NodeInformationDatabaseWrapper::DB_COLUMN_EXTERNAL_UNL, $this->generateExternalUnl());
        }
 
        /**
@@ -703,12 +755,14 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
         * @return      $unlInstance    An instance of a LocateableNode class for this node
         */
        public function determineUniversalNodeLocator () {
+               // Debug message
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: CALLED!');
+
                // Determine UNL based on this node:
                // 1) Get discovery class
                $discoveryInstance = ObjectFactory::createObjectByConfiguredName('unl_discovery_class');
 
-               // 2) "Determine it
+               // 2) "Determine" it
                $unlInstance = $discoveryInstance->discoverUniversalNodeLocatorByNode($this);
 
                // 3) Return it
@@ -722,6 +776,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
         * @return      $unlArray       An array from an instance of a LocateableNode class for this node
         */
        public final function getUniversalNodeLocatorArray () {
+               // Debug message
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE[' . __METHOD__ . ':' . __LINE__ . ']: CALLED!');
 
                // Get the Universal Node Locator (UNL) instance
index 40a4efd283f7e747c3866393450f8906772c4172..c6bfea60304c73271a449a458e86deba1fd04d6d 100644 (file)
@@ -75,11 +75,11 @@ class DhtRecipient extends BaseRecipient implements Recipient {
                        // These array elements must exist for this loop:
                        // @TODO Unfinished
                        die(__METHOD__ . ':recipient=' . print_r($recipient, TRUE));
-                       assert(!empty($recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_IP]));
+                       assert(!empty($recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_ADDRESS]));
                        assert(!empty($recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_LISTEN_PORT]));
 
                        // Put ip and port both together
-                       $unl = $recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_IP] . ':' . $recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_LISTEN_PORT];
+                       $unl = $recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_ADDRESS] . ':' . $recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_LISTEN_PORT];
 
                        // Add it to the list
                        //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DHT-RECIPIENT[' . __METHOD__ . ':' . __LINE__ . ']: Calling listInstance->addEntry(' . $unl . ') ...');
index 85d29eab85b3a1e13598497075d278db4a7d0361..d3262368e388dfcbdc443b6a5d7410e274a2b565 100644 (file)
@@ -65,8 +65,8 @@ class SelfRecipient extends BaseRecipient implements Recipient {
                // Determine own port
                $port = $this->getConfigInstance()->getConfigEntry('node_listen_port');
 
-               // Determine IP or 'external_ip' if set
-               $ip = HubTools::determineOwnExternalIp();
+               // Determine IP or 'external_address' if set
+               $ip = HubTools::determineOwnExternalAddress();
 
                // Is it not empty?
                if (!empty($ip)) {
index 8246fbca6f15bf195ed19c476ddd1466ef6d3992..232d884c16dc64f84b025ad08e56b92dc6c0a915 100644 (file)
@@ -33,7 +33,7 @@ class !!!ProtocolResolver extends BaseProtocolResolver implements ProtocolResolv
        }
 
        /**
-        * Creates an instance of a !!! command resolver with a given default command
+        * Creates an instance of a !!! protocol resolver
         *
         * @return      $resolverInstance       The prepared command resolver instance
         */
@@ -46,15 +46,37 @@ class !!!ProtocolResolver extends BaseProtocolResolver implements ProtocolResolv
        }
 
        /**
-        * Returns an command instance for a given request class or null if
-        * it was not found
+        * Returns an instance of a LocateableNode class for a given NodeHelper
+        * instance or null if it was not found.
         *
         * @param       $nodeInstance   An instance of a NodeHelper class
         * @return      $unlInstance    An instance of a LocateableNode class
         * @todo        0% done
         */
-       public function resolveUniversalResourceLocatorFromNodeHelper (NodeHelper $nodeInstance) {
-               $this->partialStub('Please implement this method.');
+       public function resolveUniversalNodeLocatorFromNodeHelper (NodeHelper $nodeInstance) {
+               $this->partialStub('Please implement this method. nodeInstance=' . $nodeInstance->__toString());
+       }
+
+       /**
+        * Returns the UNL as string from given configuration key.
+        *
+        * @param       $configKey      Configuration key for UNL address (valid: internal,external)
+        * @return      $unl            Universal node locator
+        * @todo        90% done
+        */
+       public function resolveUniversalNodeLocatorFromConfigKey ($configKey) {
+               // Put all together
+               $unl = sprintf('%s://%s',
+                       $this->getProtocolName(),
+                       $this->getConfigInstance()->getConfigEntry($configKey . '_address')
+               );
+
+               /*
+                * And return it. Please note that e.g. a FaxProtocolResolver will
+                * return a different UNL and therefore all protocol resolvers must do
+                * it on their own way.
+                */
+               return $unl;
        }
 }
 
index 41a1f6d2093d97ae50c91c15785126c81ec94f2f..8a3aae4bf4f5a01c33bba2dab2e088ff1124ca36 100644 (file)
@@ -36,7 +36,7 @@ class TcpProtocolResolver extends BaseProtocolResolver implements ProtocolResolv
        }
 
        /**
-        * Creates an instance of a Tcp command resolver with a given default command
+        * Creates an instance of a TCP protocol resolver
         *
         * @return      $resolverInstance       The prepared command resolver instance
         */
@@ -49,15 +49,54 @@ class TcpProtocolResolver extends BaseProtocolResolver implements ProtocolResolv
        }
 
        /**
-        * Returns an command instance for a given NodeHelper instance or null if it
-        * was not found.
+        * Returns an instance of a LocateableNode class for a given NodeHelper
+        * instance or null if it was not found.
         *
         * @param       $nodeInstance   An instance of a NodeHelper class
         * @return      $unlInstance    An instance of a LocateableNode class
         * @todo        0% done
         */
-       public function resolveUniversalResourceLocatorFromNodeHelper (NodeHelper $nodeInstance) {
-               $this->partialStub('Please implement this method.');
+       public function resolveUniversalNodeLocatorFromNodeHelper (NodeHelper $nodeInstance) {
+               // Get result instance
+               $resultInstance = $nodeInstance->getResultInstance();
+
+               // Make sure the result instance is valid
+               assert($resultInstance instanceof SearchableResult);
+
+               // Rewind iterator
+               $resultInstance->rewind();
+
+               // Lookup node's id
+               while ($resultInstance->next()) {
+                       // Get current entry
+                       $current = $resultInstance->current();
+
+                       // Do we have found an entry?
+                       // $nodeInstance->getNodeId()
+                       die(print_r($current, TRUE));
+               } // END - while
+       }
+
+       /**
+        * Returns the UNL as string from given configuration key.
+        *
+        * @param       $configKey      Configuration key for UNL address (valid: internal,external)
+        * @return      $unl            Universal node locator
+        */
+       public function resolveUniversalNodeLocatorFromConfigKey ($configKey) {
+               // Put all together
+               $unl = sprintf('%s://%s:%s',
+                       $this->getProtocolName(),
+                       $this->getConfigInstance()->getConfigEntry($configKey . '_address'),
+                       $this->getConfigInstance()->getConfigEntry('node_listen_port')
+               );
+
+               /*
+                * And return it. Please note that e.g. a FaxProtocolResolver will
+                * return a different UNL and therefore all protocol resolvers must do
+                * it on their own way.
+                */
+               return $unl;
        }
 }
 
index 0ca17982afb6a8c5b29132e3432f1329cfb42d2d..e5701d43a4647ad9411f2023df4ab6358fa8f627 100644 (file)
@@ -26,12 +26,12 @@ class XmlAnnouncementTemplateEngine extends BaseXmlTemplateEngine implements Com
        /**
         * Some XML nodes must be available for later data extraction
         */
-       const ANNOUNCEMENT_DATA_SESSION_ID  = 'session-id';
-       const ANNOUNCEMENT_DATA_NODE_STATUS = 'node-status';
-       const ANNOUNCEMENT_DATA_NODE_MODE   = 'node-mode';
-       const ANNOUNCEMENT_DATA_EXTERNAL_IP = 'external-ip';
-       const ANNOUNCEMENT_DATA_INTERNAL_IP = 'internal-ip';
-       const ANNOUNCEMENT_DATA_LISTEN_PORT = 'listen-port';
+       const ANNOUNCEMENT_DATA_SESSION_ID       = 'session-id';
+       const ANNOUNCEMENT_DATA_NODE_STATUS      = 'node-status';
+       const ANNOUNCEMENT_DATA_NODE_MODE        = 'node-mode';
+       const ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS = 'external-address';
+       const ANNOUNCEMENT_DATA_INTERNAL_ADDRESS = 'internal-address';
+       const ANNOUNCEMENT_DATA_LISTEN_PORT      = 'listen-port';
 
        /**
         * Protected constructor
@@ -50,8 +50,8 @@ class XmlAnnouncementTemplateEngine extends BaseXmlTemplateEngine implements Com
                        self::ANNOUNCEMENT_DATA_NODE_MODE,
                        self::ANNOUNCEMENT_DATA_LISTEN_PORT,
                        self::ANNOUNCEMENT_DATA_SESSION_ID,
-                       self::ANNOUNCEMENT_DATA_EXTERNAL_IP,
-                       self::ANNOUNCEMENT_DATA_INTERNAL_IP,
+                       self::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS,
+                       self::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS,
                        'object-type-list',
                );
        }
@@ -186,9 +186,9 @@ class XmlAnnouncementTemplateEngine extends BaseXmlTemplateEngine implements Com
         *
         * @return      void
         */
-       protected function startExternalIp () {
+       protected function startExternalAddress () {
                // Push the node name on the stacker
-               $this->getStackInstance()->pushNamed('node_announcement', self::ANNOUNCEMENT_DATA_EXTERNAL_IP);
+               $this->getStackInstance()->pushNamed('node_announcement', self::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS);
        }
 
        /**
@@ -196,9 +196,9 @@ class XmlAnnouncementTemplateEngine extends BaseXmlTemplateEngine implements Com
         *
         * @return      void
         */
-       protected function startInternalIp () {
+       protected function startInternalAddress () {
                // Push the node name on the stacker
-               $this->getStackInstance()->pushNamed('node_announcement', self::ANNOUNCEMENT_DATA_INTERNAL_IP);
+               $this->getStackInstance()->pushNamed('node_announcement', self::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS);
        }
 
        /**
@@ -256,7 +256,7 @@ class XmlAnnouncementTemplateEngine extends BaseXmlTemplateEngine implements Com
         *
         * @return      void
         */
-       protected function finishInternalIp () {
+       protected function finishInternalAddress () {
                // Pop the last entry
                $this->getStackInstance()->popNamed('node_announcement');
        }
@@ -266,7 +266,7 @@ class XmlAnnouncementTemplateEngine extends BaseXmlTemplateEngine implements Com
         *
         * @return      void
         */
-       protected function finishExternalIp () {
+       protected function finishExternalAddress () {
                // Pop the last entry
                $this->getStackInstance()->popNamed('node_announcement');
        }
index d4f0dc738feb5291a01b3d09437e84388d45e16f..17a3bda18d39039de578bc3049d6c851050c1218 100644 (file)
@@ -26,10 +26,10 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
        /**
         * Some XML nodes must be available for later data extraction
         */
-       const ANNOUNCEMENT_DATA_SESSION_ID    = 'my-session-id';
-       const ANNOUNCEMENT_DATA_NODE_STATUS   = 'my-status';
-       const ANNOUNCEMENT_DATA_EXTERNAL_IP   = 'my-external-ip';
-       const ANNOUNCEMENT_DATA_INTERNAL_IP   = 'my-internal-ip';
+       const ANNOUNCEMENT_DATA_SESSION_ID       = 'my-session-id';
+       const ANNOUNCEMENT_DATA_NODE_STATUS      = 'my-status';
+       const ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS = 'my-external-address';
+       const ANNOUNCEMENT_DATA_INTERNAL_ADDRESS = 'my-internal-address';
        const ANNOUNCEMENT_DATA_LISTEN_PORT      = 'my-listen-port';
 
        /**
@@ -47,14 +47,14 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
                        'my-data',
                        'your-data',
                        // Data from *this* node
-                       self::ANNOUNCEMENT_DATA_EXTERNAL_IP,
-                       self::ANNOUNCEMENT_DATA_INTERNAL_IP,
+                       self::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS,
+                       self::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS,
                        self::ANNOUNCEMENT_DATA_LISTEN_PORT,
                        self::ANNOUNCEMENT_DATA_NODE_STATUS,
                        self::ANNOUNCEMENT_DATA_SESSION_ID,
                        // Data from other node
-                       'your-external-ip',
-                       'your-internal-ip',
+                       'your-external-address',
+                       'your-internal-address',
                        'your-session-id',
                        // Answer status (generic field)
                        self::ANSWER_STATUS,
@@ -138,23 +138,23 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
        }
 
        /**
-        * Starts the my-external-ip
+        * Starts the my-external-address
         *
         * @return      void
         */
-       protected function startMyExternalIp () {
+       protected function startMyExternalAddress () {
                // Push the node name on the stacker
-               $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_EXTERNAL_IP);
+               $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS);
        }
 
        /**
-        * Starts the my-internal-ip
+        * Starts the my-internal-address
         *
         * @return      void
         */
-       protected function startMyInternalIp () {
+       protected function startMyInternalAddress () {
                // Push the node name on the stacker
-               $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_INTERNAL_IP);
+               $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS);
        }
 
        /**
@@ -218,21 +218,21 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
        }
 
        /**
-        * Finishes the my-internal-ip
+        * Finishes the my-internal-address
         *
         * @return      void
         */
-       protected function finishMyInternalIp () {
+       protected function finishMyInternalAddress () {
                // Pop the last entry
                $this->getStackInstance()->popNamed('node_announcement_answer');
        }
 
        /**
-        * Finishes the my-external-ip
+        * Finishes the my-external-address
         *
         * @return      void
         */
-       protected function finishMyExternalIp () {
+       protected function finishMyExternalAddress () {
                // Pop the last entry
                $this->getStackInstance()->popNamed('node_announcement_answer');
        }
@@ -258,23 +258,23 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
        }
 
        /**
-        * Starts the your-external-ip
+        * Starts the your-external-address
         *
         * @return      void
         */
-       protected function startYourExternalIp () {
+       protected function startYourExternalAddress () {
                // Push the node name on the stacker
-               $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-external-ip');
+               $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-external-address');
        }
 
        /**
-        * Starts the your-internal-ip
+        * Starts the your-internal-address
         *
         * @return      void
         */
-       protected function startYourInternalIp () {
+       protected function startYourInternalAddress () {
                // Push the node name on the stacker
-               $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-internal-ip');
+               $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-internal-address');
        }
 
        /**
@@ -298,21 +298,21 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
        }
 
        /**
-        * Finishes the your-internal-ip
+        * Finishes the your-internal-address
         *
         * @return      void
         */
-       protected function finishYourInternalIp () {
+       protected function finishYourInternalAddress () {
                // Pop the last entry
                $this->getStackInstance()->popNamed('node_announcement_answer');
        }
 
        /**
-        * Finishes the your-external-ip
+        * Finishes the your-external-address
         *
         * @return      void
         */
-       protected function finishYourExternalIp () {
+       protected function finishYourExternalAddress () {
                // Pop the last entry
                $this->getStackInstance()->popNamed('node_announcement_answer');
        }
index aaeaa6e653ec9807fee2e79fb3fde95382e33e9e..f5e26d7a36f659560b1910d608b772389f599043 100644 (file)
@@ -26,12 +26,12 @@ class XmlDhtBootstrapAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
        /**
         * Some XML nodes must be available for later data extraction
         */
-       const DHT_BOOTSTRAP_DATA_SESSION_ID    = 'my-session-id';
-       const DHT_BOOTSTRAP_DATA_NODE_STATUS   = 'my-status';
-       const DHT_BOOTSTRAP_DATA_EXTERNAL_IP   = 'my-external-ip';
-       const DHT_BOOTSTRAP_DATA_INTERNAL_IP   = 'my-internal-ip';
-       const DHT_BOOTSTRAP_DATA_LISTEN_PORT   = 'my-listen-port';
-       const DHT_BOOTSTRAP_DATA_NODE_LIST     = 'dht-nodes-list';
+       const DHT_BOOTSTRAP_DATA_SESSION_ID       = 'my-session-id';
+       const DHT_BOOTSTRAP_DATA_NODE_STATUS      = 'my-status';
+       const DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS = 'my-external-address';
+       const DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS = 'my-internal-address';
+       const DHT_BOOTSTRAP_DATA_LISTEN_PORT      = 'my-listen-port';
+       const DHT_BOOTSTRAP_DATA_NODE_LIST        = 'dht-nodes-list';
 
        /**
         * Protected constructor
@@ -48,14 +48,14 @@ class XmlDhtBootstrapAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
                        'my-data',
                        'your-data',
                        // Data from *this* node
-                       self::DHT_BOOTSTRAP_DATA_EXTERNAL_IP,
-                       self::DHT_BOOTSTRAP_DATA_INTERNAL_IP,
+                       self::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS,
+                       self::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS,
                        self::DHT_BOOTSTRAP_DATA_LISTEN_PORT,
                        self::DHT_BOOTSTRAP_DATA_NODE_STATUS,
                        self::DHT_BOOTSTRAP_DATA_SESSION_ID,
                        // Data from other node
-                       'your-external-ip',
-                       'your-internal-ip',
+                       'your-external-address',
+                       'your-internal-address',
                        'your-session-id',
                        // Answer status (generic field)
                        self::ANSWER_STATUS,
@@ -141,23 +141,23 @@ class XmlDhtBootstrapAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
        }
 
        /**
-        * Starts the my-external-ip
+        * Starts the my-external-address
         *
         * @return      void
         */
-       protected function startMyExternalIp () {
+       protected function startMyExternalAddress () {
                // Push the node name on the stacker
-               $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', self::DHT_BOOTSTRAP_DATA_EXTERNAL_IP);
+               $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', self::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS);
        }
 
        /**
-        * Starts the my-internal-ip
+        * Starts the my-internal-address
         *
         * @return      void
         */
-       protected function startMyInternalIp () {
+       protected function startMyInternalAddress () {
                // Push the node name on the stacker
-               $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', self::DHT_BOOTSTRAP_DATA_INTERNAL_IP);
+               $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', self::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS);
        }
 
        /**
@@ -241,21 +241,21 @@ class XmlDhtBootstrapAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
        }
 
        /**
-        * Finishes the my-internal-ip
+        * Finishes the my-internal-address
         *
         * @return      void
         */
-       protected function finishMyInternalIp () {
+       protected function finishMyInternalAddress () {
                // Pop the last entry
                $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
        }
 
        /**
-        * Finishes the my-external-ip
+        * Finishes the my-external-address
         *
         * @return      void
         */
-       protected function finishMyExternalIp () {
+       protected function finishMyExternalAddress () {
                // Pop the last entry
                $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
        }
@@ -281,23 +281,23 @@ class XmlDhtBootstrapAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
        }
 
        /**
-        * Starts the your-external-ip
+        * Starts the your-external-address
         *
         * @return      void
         */
-       protected function startYourExternalIp () {
+       protected function startYourExternalAddress () {
                // Push the node name on the stacker
-               $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', 'your-external-ip');
+               $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', 'your-external-address');
        }
 
        /**
-        * Starts the your-internal-ip
+        * Starts the your-internal-address
         *
         * @return      void
         */
-       protected function startYourInternalIp () {
+       protected function startYourInternalAddress () {
                // Push the node name on the stacker
-               $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', 'your-internal-ip');
+               $this->getStackInstance()->pushNamed('node_dht_bootstrap_answer', 'your-internal-address');
        }
 
        /**
@@ -321,21 +321,21 @@ class XmlDhtBootstrapAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
        }
 
        /**
-        * Finishes the your-internal-ip
+        * Finishes the your-internal-address
         *
         * @return      void
         */
-       protected function finishYourInternalIp () {
+       protected function finishYourInternalAddress () {
                // Pop the last entry
                $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
        }
 
        /**
-        * Finishes the your-external-ip
+        * Finishes the your-external-address
         *
         * @return      void
         */
-       protected function finishYourExternalIp () {
+       protected function finishYourExternalAddress () {
                // Pop the last entry
                $this->getStackInstance()->popNamed('node_dht_bootstrap_answer');
        }
index 151a5988744f0da1781e8a8f4eca450ce29741b1..47e08cec0ed009140aceda7467a9d3dc230c0bc4 100644 (file)
@@ -26,13 +26,13 @@ class XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements Com
        /**
         * Some XML nodes must be available for later data extraction
         */
-       const DHT_BOOTSTRAP_DATA_BOOTSTRAP_DATA = 'dht-bootstrap-data';
-       const DHT_BOOTSTRAP_DATA_SESSION_ID     = 'session-id';
-       const DHT_BOOTSTRAP_DATA_NODE_STATUS    = 'node-status';
-       const DHT_BOOTSTRAP_DATA_NODE_MODE      = 'node-mode';
-       const DHT_BOOTSTRAP_DATA_EXTERNAL_IP    = 'external-ip';
-       const DHT_BOOTSTRAP_DATA_INTERNAL_IP    = 'internal-ip';
-       const DHT_BOOTSTRAP_DATA_LISTEN_PORT    = 'listen-port';
+       const DHT_BOOTSTRAP_DATA_BOOTSTRAP_DATA   = 'dht-bootstrap-data';
+       const DHT_BOOTSTRAP_DATA_SESSION_ID       = 'session-id';
+       const DHT_BOOTSTRAP_DATA_NODE_STATUS      = 'node-status';
+       const DHT_BOOTSTRAP_DATA_NODE_MODE        = 'node-mode';
+       const DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS = 'external-address';
+       const DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS = 'internal-address';
+       const DHT_BOOTSTRAP_DATA_LISTEN_PORT      = 'listen-port';
 
        /**
         * Protected constructor
@@ -51,8 +51,8 @@ class XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements Com
                        self::DHT_BOOTSTRAP_DATA_NODE_MODE,
                        self::DHT_BOOTSTRAP_DATA_LISTEN_PORT,
                        self::DHT_BOOTSTRAP_DATA_SESSION_ID,
-                       self::DHT_BOOTSTRAP_DATA_EXTERNAL_IP,
-                       self::DHT_BOOTSTRAP_DATA_INTERNAL_IP
+                       self::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS,
+                       self::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS
                );
        }
 
@@ -176,9 +176,9 @@ class XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements Com
         *
         * @return      void
         */
-       protected function startExternalIp () {
+       protected function startExternalAddress () {
                // Push the node name on the stacker
-               $this->getStackInstance()->pushNamed('dht_bootstrap', self::DHT_BOOTSTRAP_DATA_EXTERNAL_IP);
+               $this->getStackInstance()->pushNamed('dht_bootstrap', self::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS);
        }
 
        /**
@@ -186,9 +186,9 @@ class XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements Com
         *
         * @return      void
         */
-       protected function startInternalIp () {
+       protected function startInternalAddress () {
                // Push the node name on the stacker
-               $this->getStackInstance()->pushNamed('dht_bootstrap', self::DHT_BOOTSTRAP_DATA_INTERNAL_IP);
+               $this->getStackInstance()->pushNamed('dht_bootstrap', self::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS);
        }
 
        /**
@@ -216,7 +216,7 @@ class XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements Com
         *
         * @return      void
         */
-       protected function finishInternalIp () {
+       protected function finishInternalAddress () {
                // Pop the last entry
                $this->getStackInstance()->popNamed('dht_bootstrap');
        }
@@ -226,7 +226,7 @@ class XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements Com
         *
         * @return      void
         */
-       protected function finishExternalIp () {
+       protected function finishExternalAddress () {
                // Pop the last entry
                $this->getStackInstance()->popNamed('dht_bootstrap');
        }
index 305aab162c154de491c6399d3fdada3ed8ab594b..9cbd20c4efdc76f4a9ac74f9dcf17b31433afaa2 100644 (file)
@@ -30,7 +30,7 @@ class XmlDhtPublishEntryTemplateEngine extends BaseXmlTemplateEngine implements
        const PUBLISH_DATA_SESSION_ID            = 'session-id';
        const PUBLISH_DATA_NODE_STATUS           = 'node-status';
        const PUBLISH_DATA_NODE_MODE             = 'node-mode';
-       const PUBLISH_DATA_EXTERNAL_IP           = 'external-ip';
+       const PUBLISH_DATA_EXTERNAL_ADDRESS      = 'external-address';
        const PUBLISH_DATA_LISTEN_PORT           = 'listen-port';
        const PUBLISH_DATA_PRIVATE_KEY_HASH      = 'private-key-hash';
        const PUBLISH_DATA_ACCEPTED_OBJECT_TYPES = 'accepted-object-types';
@@ -55,7 +55,7 @@ class XmlDhtPublishEntryTemplateEngine extends BaseXmlTemplateEngine implements
                        self::PUBLISH_DATA_ACCEPTED_OBJECT_TYPES,
                        self::PUBLISH_DATA_NODE_ID,
                        self::PUBLISH_DATA_SESSION_ID,
-                       self::PUBLISH_DATA_EXTERNAL_IP,
+                       self::PUBLISH_DATA_EXTERNAL_ADDRESS,
                        'object-type-list',
                );
        }
@@ -220,9 +220,9 @@ class XmlDhtPublishEntryTemplateEngine extends BaseXmlTemplateEngine implements
         *
         * @return      void
         */
-       protected function startExternalIp () {
+       protected function startExternalAddress () {
                // Push the node name on the stacker
-               $this->getStackInstance()->pushNamed('dht_publish', self::PUBLISH_DATA_EXTERNAL_IP);
+               $this->getStackInstance()->pushNamed('dht_publish', self::PUBLISH_DATA_EXTERNAL_ADDRESS);
        }
 
        /**
@@ -290,7 +290,7 @@ class XmlDhtPublishEntryTemplateEngine extends BaseXmlTemplateEngine implements
         *
         * @return      void
         */
-       protected function finishExternalIp () {
+       protected function finishExternalAddress () {
                // Pop the last entry
                $this->getStackInstance()->popNamed('dht_publish');
        }
index c2c6197e58e866e46e0250b2f466884b2aca7330..d550b64a05c176850f7b5e9be6cc5d27fb7dc5d6 100644 (file)
@@ -101,9 +101,9 @@ class HubTools extends BaseHubSystem {
                $recipient = $this->getDhtInstance()->findNodeLocalBySessionId($sessionId);
 
                // Is the recipient valid?
-               if ((isset($recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_IP])) && (isset($recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_LISTEN_PORT]))) {
+               if ((isset($recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_ADDRESS])) && (isset($recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_LISTEN_PORT]))) {
                        // Then use this
-                       $recipientUniversalNodeLocator = $recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_IP] . ':' . $recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_LISTEN_PORT];
+                       $recipientUniversalNodeLocator = $recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_ADDRESS] . ':' . $recipient[NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_LISTEN_PORT];
                } else {
                        // Get the instance, this might throw a NPE
                        $nodeInstance = NodeObjectFactory::createNodeInstance();
@@ -111,7 +111,7 @@ class HubTools extends BaseHubSystem {
                        // Is the session id the same?
                        if ($nodeInstance->getSessionId() == $sessionId) {
                                // Then get an instance of a LocateableNode class from it, assume TCP by default
-                               $recipientUniversalNodeLocator = self::determineOwnExternalIp() . ':' . $nodeInstance->getConfigInstance()->getConfigEntry('node_listen_port');
+                               $recipientUniversalNodeLocator = self::determineOwnExternalAddress() . ':' . $nodeInstance->getConfigInstance()->getConfigEntry('node_listen_port');
                        } // END - if
                }
 
@@ -186,18 +186,18 @@ class HubTools extends BaseHubSystem {
        }
 
        /**
-        * Determine IP or 'external_ip' if set
+        * Determine IP or 'external_address' if set
         *
-        * @return      $ip             The determined external ip of this node
+        * @return      $ip             The determined external address of this node
         */
-       public static function determineOwnExternalIp () {
-               // Is the external_ip config entry set?
-               if (FrameworkConfiguration::getSelfInstance()->getConfigEntry('external_ip') != '') {
-                       // Use it as external ip
-                       $ip = FrameworkConfiguration::getSelfInstance()->getConfigEntry('external_ip');
+       public static function determineOwnExternalAddress () {
+               // Is the external_address config entry set?
+               if (FrameworkConfiguration::getSelfInstance()->getConfigEntry('external_address') != '') {
+                       // Use it as external address
+                       $ip = FrameworkConfiguration::getSelfInstance()->getConfigEntry('external_address');
                } else {
-                       // Determine own external ip by connecting to my (coder) server at 188.138.90.169
-                       $ip = ConsoleTools::determineExternalIp();
+                       // Determine own external address by connecting to my (coder) server at 188.138.90.169
+                       $ip = ConsoleTools::determineExternalAddress();
                }
 
                // Return it
@@ -205,20 +205,20 @@ class HubTools extends BaseHubSystem {
        }
 
        /**
-        * Determine IP or 'internal_ip' if set
+        * Determine IP or 'internal_address' if set
         *
-        * @return      $ip             The determined external ip of this node
+        * @return      $ip             The determined external address of this node
         */
-       public static function determineOwnInternalIp () {
-               // Is the internal_ip config entry set?
-               if (FrameworkConfiguration::getSelfInstance()->getConfigEntry('allow_publish_internal_ip') == 'N') {
-                       // Not allowed to publish internal IP, so use external
-                       $ip = self::determineOwnExternalIp();
-               } elseif (FrameworkConfiguration::getSelfInstance()->getConfigEntry('internal_ip') != '') {
-                       // Use it as internal ip
-                       $ip = FrameworkConfiguration::getSelfInstance()->getConfigEntry('internal_ip');
+       public static function determineOwnInternalAddress () {
+               // Is the internal_address config entry set?
+               if (FrameworkConfiguration::getSelfInstance()->getConfigEntry('allow_publish_internal_address') == 'N') {
+                       // Not allowed to publish internal address, so use external
+                       $ip = self::determineOwnExternalAddress();
+               } elseif (FrameworkConfiguration::getSelfInstance()->getConfigEntry('internal_address') != '') {
+                       // Use it as internal address
+                       $ip = FrameworkConfiguration::getSelfInstance()->getConfigEntry('internal_address');
                } else {
-                       // Determine own internal ip by connecting to my (coder) server at 188.138.90.169
+                       // Determine own internal address by connecting to my (coder) server at 188.138.90.169
                        $ip = ConsoleTools::acquireSelfIPAddress();
                }
 
index 928eb3310072f37ab4ca31be2ed3871cd3c77b31..218e5163bb98bd27a16fe63b93c982a76ad02e5b 100644 (file)
@@ -33,7 +33,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem
        // Constants for database column names
        const DB_COLUMN_NODE_ID            = 'node_id';
        const DB_COLUMN_SESSION_ID         = 'session_id';
-       const DB_COLUMN_EXTERNAL_IP        = 'external_ip';
+       const DB_COLUMN_EXTERNAL_ADDRESS   = 'external_address';
        const DB_COLUMN_LISTEN_PORT        = 'listen_port';
        const DB_COLUMN_PRIVATE_KEY_HASH   = 'private_key_hash';
        const DB_COLUMN_NODE_MODE          = 'node_mode';
@@ -86,7 +86,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem
                $elements = array(
                        self::DB_COLUMN_NODE_ID,
                        self::DB_COLUMN_SESSION_ID,
-                       self::DB_COLUMN_EXTERNAL_IP,
+                       self::DB_COLUMN_EXTERNAL_ADDRESS,
                        self::DB_COLUMN_LISTEN_PORT,
                        self::DB_COLUMN_PRIVATE_KEY_HASH,
                        self::DB_COLUMN_NODE_MODE,
@@ -162,7 +162,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem
 
                // Add public node data
                $dataSetInstance->addCriteria(self::DB_COLUMN_NODE_MODE       , $requestInstance->getRequestElement('mode'));
-               $dataSetInstance->addCriteria(self::DB_COLUMN_EXTERNAL_IP     , $unl[0]);
+               $dataSetInstance->addCriteria(self::DB_COLUMN_EXTERNAL_ADDRESS     , $unl[0]);
                $dataSetInstance->addCriteria(self::DB_COLUMN_LISTEN_PORT     , $unl[1]);
                $dataSetInstance->addCriteria(self::DB_COLUMN_NODE_ID         , $nodeInstance->getNodeId());
                $dataSetInstance->addCriteria(self::DB_COLUMN_SESSION_ID      , $nodeInstance->getSessionId());
@@ -177,7 +177,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem
 
        /**
         * Checks whether the local (*this*) node is registered in the DHT by
-        * checking if the external ip/port is found.
+        * checking if the external address is found.
         *
         * @return      $isRegistered   Whether *this* node is registered in the DHT
         */
@@ -200,7 +200,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem
                assert(($unl[0] !== 'invalid') && ($unl[1] !== 'invalid') && ($unl[2] !== 'invalid'));
 
                // Add Universal Node Locator/node id as criteria
-               $searchInstance->addCriteria(self::DB_COLUMN_EXTERNAL_IP, $unl[0]);
+               $searchInstance->addCriteria(self::DB_COLUMN_EXTERNAL_ADDRESS, $unl[0]);
                $searchInstance->addCriteria(self::DB_COLUMN_LISTEN_PORT, $unl[1]);
                $searchInstance->addCriteria(self::DB_COLUMN_NODE_ID    , $nodeInstance->getNodeId());
                $searchInstance->addCriteria(self::DB_COLUMN_SESSION_ID , $nodeInstance->getSessionId());
@@ -379,9 +379,9 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem
                        $searchInstance,
                        // Only look for these array elements ("keys")
                        array(
-                               self::DB_COLUMN_NODE_ID     => TRUE,
-                               self::DB_COLUMN_EXTERNAL_IP => TRUE,
-                               self::DB_COLUMN_LISTEN_PORT => TRUE,
+                               self::DB_COLUMN_NODE_ID          => TRUE,
+                               self::DB_COLUMN_EXTERNAL_ADDRESS => TRUE,
+                               self::DB_COLUMN_LISTEN_PORT      => TRUE,
                        )
                );
 
index 7445a87ce0f6a2cc74974a9a9e37d06c98bb9f20..a7632edb8dd237b9ee68381c716d06916e37d469 100644 (file)
@@ -32,6 +32,8 @@ class NodeInformationDatabaseWrapper extends BaseDatabaseWrapper implements Node
        const DB_COLUMN_PRIVATE_KEY      = 'private_key';
        const DB_COLUMN_PRIVATE_KEY_HASH = 'private_key_hash';
        const DB_COLUMN_NODE_MODE        = 'node_mode';
+       const DB_COLUMN_INTERNAL_UNL     = 'internal_unl';
+       const DB_COLUMN_EXTERNAL_UNL     = 'external_unl';
 
        /**
         * Protected constructor
index 944ee01ab7a75112ea88232a2eaffb9aa0ea297d..32b33e55595bd196a64748c4fc7db1b6a2dca208 100644 (file)
@@ -33,10 +33,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
                <session-id>{?session_id?}</session-id>
                <!-- Data from our listeners (e.g. which port) //-->
                <listener>
-                       <!-- Public external IP address //-->
-                       <external-ip>{?external_ip?}</external-ip>
-                       <!-- Private internal IP address //-->
-                       <internal-ip>{?internal_ip?}</internal-ip>
+                       <!-- Public external address //-->
+                       <external-address>{?external_address?}</external-address>
+                       <!-- Private internal address //-->
+                       <internal-address>{?internal_address?}</internal-address>
                        <!-- Listener ports for both connections //-->
                        <listen-port>{?node_listen_port?}</listen-port>
                </listener>
index 8421fe80128a4336e91868a43ff01e2eae4aeeea..456403fd48ffe9fc79811a0b047a16de7b899d19 100644 (file)
@@ -28,13 +28,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
        //-->
        <my-data>
                <!--
-               This node's external IP/hostname
+               This node's external address
                //-->
-               <my-external-ip>{?my_external_ip?}</my-external-ip>
+               <my-external-address>{?my_external_address?}</my-external-address>
                <!--
-               This node's internal IP/hostname
+               This node's internal address
                //-->
-               <my-internal-ip>{?my_internal_ip?}</my-internal-ip>
+               <my-internal-address>{?my_internal_address?}</my-internal-address>
                <!--
                This node's TCP/UDP listen port
                //-->
@@ -54,13 +54,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
        //-->
        <your-data>
                <!--
-               Other node's external IP/hostname
+               Other node's external address
                //-->
-               <your-external-ip>{?your_external_ip?}</your-external-ip>
+               <your-external-address>{?your_external_address?}</your-external-address>
                <!--
-               Other node's internal IP/hostname
+               Other node's internal address
                //-->
-               <your-internal-ip>{?your_internal_ip?}</your-internal-ip>
+               <your-internal-address>{?your_internal_address?}</your-internal-address>
                <!--
                Other node's session id
                //-->
index a4fa6f2c4e79b1253bd481199cb22c8f3f6bc5d4..6b5f570244ce73c378663b300fd9a06ec0fb2b8a 100644 (file)
@@ -29,13 +29,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
        //-->
        <my-data>
                <!--
-               This node's external IP/hostname
+               This node's external address
                //-->
-               <my-external-ip>{?my_external_ip?}</my-external-ip>
+               <my-external-address>{?my_external_address?}</my-external-address>
                <!--
-               This node's internal IP/hostname
+               This node's internal address
                //-->
-               <my-internal-ip>{?my_internal_ip?}</my-internal-ip>
+               <my-internal-address>{?my_internal_address?}</my-internal-address>
                <!--
                This node's TCP/UDP listen port
                //-->
@@ -55,13 +55,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
        //-->
        <your-data>
                <!--
-               Other node's external IP/hostname
+               Other node's external address
                //-->
-               <your-external-ip>{?your_external_ip?}</your-external-ip>
+               <your-external-address>{?your_external_address?}</your-external-address>
                <!--
-               Other node's internal IP/hostname
+               Other node's internal address
                //-->
-               <your-internal-ip>{?your_internal_ip?}</your-internal-ip>
+               <your-internal-address>{?your_internal_address?}</your-internal-address>
                <!--
                Other node's session id
                //-->
index 70482d8d81b9dc05258213220c7f3d12c672d13c..06f9eab673da33a0b90c575489389c128e774db8 100644 (file)
@@ -42,10 +42,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
                <session-id>{?session_id?}</session-id>
                <!-- Data from our listeners (e.g. which port) //-->
                <listener>
-                       <!-- Public external IP address //-->
-                       <external-ip>{?external_ip?}</external-ip>
-                       <!-- Private internal IP address //-->
-                       <internal-ip>{?internal_ip?}</internal-ip>
+                       <!-- Public external address //-->
+                       <external-address>{?external_address?}</external-address>
+                       <!-- Private internal address //-->
+                       <internal-address>{?internal_address?}</internal-address>
                        <!-- Listener ports for both connections //-->
                        <listen-port>{?node_listen_port?}</listen-port>
                </listener>
index f40eea3dee9cab2802cdb2750cd154a40d5f6c18..c6b8604ab3bd6c47289aa1142f5277a28de91e69 100644 (file)
@@ -37,7 +37,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
 Array
 (
     [node_mode] => regular
-    [external_ip] => 192.168.2.3
+    [external_address] => 192.168.2.3
     [listen_port] => 9061
     [node_id] => 38fc625d3d9aa05654bfc90a7aea7ff72c883f1573
     [session_id] => 38fc625d3dabe9ff09b54253b298e91985191472a3
@@ -61,8 +61,8 @@ Array
                <accepted-object-types>{?accepted_object_types?}</accepted-object-types>
                <!-- Data from our listeners (e.g. which port) //-->
                <listener>
-                       <!-- Public external IP address //-->
-                       <external-ip>{?external_ip?}</external-ip>
+                       <!-- Public external address //-->
+                       <external-address>{?external_address?}</external-address>
                        <!-- Listener ports for both connections //-->
                        <listen-port>{?listen_port?}</listen-port>
                </listener>
diff --git a/core b/core
index 3333662bc8456250b12127c35a9365b403c1f40a..eea9aadff7619b2a5c25972f37b34a1b83d30891 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit 3333662bc8456250b12127c35a9365b403c1f40a
+Subproject commit eea9aadff7619b2a5c25972f37b34a1b83d30891
diff --git a/find-bad-php.sh b/find-bad-php.sh
new file mode 100755 (executable)
index 0000000..1d530b3
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+echo "$0: Searching for PHP scripts (except 3rd party) ..."
+PHP=`find -type f -name "*.php" | grep -v "third_party"`
+
+for SCRIPT in ${PHP};
+do
+       HEADER=`cat ${SCRIPT} | head -n 1 | grep -v "<?"`
+
+       FOOTER=`cat ${SCRIPT} | tail -n 1 | grep -v "?>"`
+
+       if [ -n "${HEADER}" ];
+       then
+               echo "$0: Script '${SCRIPT}' has non-typical header."
+       fi
+
+       if [ -n "${FOOTER}" ];
+       then
+               echo "$0: Script '${SCRIPT}' has non-typical footer."
+       fi
+done
+
+echo "$0: All done."
+exit 0