]> git.mxchange.org Git - hub.git/commitdiff
Continued on rewrite:
authorRoland Haeder <roland@mxchange.org>
Fri, 31 Oct 2014 22:43:41 +0000 (23:43 +0100)
committerRoland Haeder <roland@mxchange.org>
Fri, 31 Oct 2014 22:43:41 +0000 (23:43 +0100)
- Added new interface + first (completely unfinished) implementation for UNL discovery
-
- Made UNL upper-case

Signed-off-by: Roland Haeder <roland@mxchange.org>
50 files changed:
application/hub/config.php
application/hub/interfaces/discovery/class_Discoverable.php
application/hub/interfaces/discovery/dht/.htaccess [deleted file]
application/hub/interfaces/discovery/dht/class_DiscoverableDhtRecipient.php [deleted file]
application/hub/interfaces/discovery/node/.htaccess [deleted file]
application/hub/interfaces/discovery/node/class_DiscoverableNodeRecipient.php [deleted file]
application/hub/interfaces/discovery/recipient/.htaccess [new file with mode: 0644]
application/hub/interfaces/discovery/recipient/class_DiscoverableRecipient.php [new file with mode: 0644]
application/hub/interfaces/discovery/recipient/dht/.htaccess [new file with mode: 0644]
application/hub/interfaces/discovery/recipient/dht/class_DiscoverableDhtRecipient.php [new file with mode: 0644]
application/hub/interfaces/discovery/recipient/node/.htaccess [new file with mode: 0644]
application/hub/interfaces/discovery/recipient/node/class_DiscoverableNodeRecipient.php [new file with mode: 0644]
application/hub/interfaces/discovery/recipient/socket/.htaccess [new file with mode: 0644]
application/hub/interfaces/discovery/recipient/socket/class_DiscoverableSocket.php [new file with mode: 0644]
application/hub/interfaces/discovery/socket/.htaccess [deleted file]
application/hub/interfaces/discovery/socket/class_DiscoverableSocket.php [deleted file]
application/hub/interfaces/discovery/unl/.htaccess [new file with mode: 0644]
application/hub/interfaces/discovery/unl/class_DiscoverableUniversalNodeLocator.php [new file with mode: 0644]
application/hub/interfaces/helper/nodes/class_NodeHelper.php
application/hub/interfaces/recipient/class_Recipient.php
application/hub/main/discovery/class_ [new file with mode: 0644]
application/hub/main/discovery/class_BaseNodeDiscovery.php
application/hub/main/discovery/dht/.htaccess [deleted file]
application/hub/main/discovery/dht/class_DhtRecipientDiscovery.php [deleted file]
application/hub/main/discovery/node/.htaccess [new file with mode: 0644]
application/hub/main/discovery/node/class_UniversalNodeLocatorDiscovery.php [new file with mode: 0644]
application/hub/main/discovery/package/.htaccess [deleted file]
application/hub/main/discovery/package/class_PackageRecipientDiscovery.php [deleted file]
application/hub/main/discovery/recipient/.htaccess [new file with mode: 0644]
application/hub/main/discovery/recipient/class_ [new file with mode: 0644]
application/hub/main/discovery/recipient/class_BaseRecipientDiscovery.php [new file with mode: 0644]
application/hub/main/discovery/recipient/dht/.htaccess [new file with mode: 0644]
application/hub/main/discovery/recipient/dht/class_DhtRecipientDiscovery.php [new file with mode: 0644]
application/hub/main/discovery/recipient/package/.htaccess [new file with mode: 0644]
application/hub/main/discovery/recipient/package/class_PackageRecipientDiscovery.php [new file with mode: 0644]
application/hub/main/discovery/recipient/socket/.htaccess [new file with mode: 0644]
application/hub/main/discovery/recipient/socket/class_PackageSocketDiscovery.php [new file with mode: 0644]
application/hub/main/discovery/socket/.htaccess [deleted file]
application/hub/main/discovery/socket/class_PackageSocketDiscovery.php [deleted file]
application/hub/main/lists/recipient/class_RecipientList.php
application/hub/main/nodes/class_BaseHubNode.php
application/hub/main/pools/peer/class_DefaultPeerPool.php
application/hub/main/recipient/class_
application/hub/main/recipient/dht/class_DhtRecipient.php
application/hub/main/recipient/direct/class_DirectRecipient.php
application/hub/main/recipient/self/class_SelfRecipient.php
application/hub/main/recipient/upper/class_UpperRecipient.php
application/hub/main/tools/class_HubTools.php
application/hub/main/wrapper/node/class_NodeDistributedHashTableDatabaseWrapper.php
core

index 1e0180534cb0ff5dfe564ae4c75881914ceda8f7..d66d1badfa1cd90a65fb74e104276f2db2e443ae 100644 (file)
@@ -729,6 +729,9 @@ $cfg->setConfigEntry('socket_discovery_class', 'PackageSocketDiscovery');
 // CFG: DHT-RECIPIENT-DISCOVERY-CLASS
 $cfg->setConfigEntry('dht_recipient_discovery_class', 'DhtRecipientDiscovery');
 
+// CFG: UNIVERSAL-NODE-LOCATOR-DISCOVERY-CLASS
+$cfg->setConfigEntry('unl_discovery_class', 'UniversalNodeLocatorDiscovery');
+
 // CFG: RECIPIENT-LIST-CLASS
 $cfg->setConfigEntry('recipient_list_class', 'RecipientList');
 
index edeba3578477e111a2db86cbd69c1940e9f001a3..8bb0dc9f0b0528b34ef40840acc81ce8941a9218 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 interface Discoverable extends FrameworkInterface {
-       /**
-        * "Getter" for recipient iterator
-        *
-        * @return      $iteratorInstance       An instance of a Iterateable object
-        */
-       function getIterator ();
-
-       /**
-        * Clears all recipients for e.g. another package to deliver
-        *
-        * @return      void
-        */
-       function clearRecipients ();
-
-       /**
-        * Checks whether the recipient list is empty
-        *
-        * @return      $isEmpty        Whether the recipient list is empty
-        */
-       function isRecipientListEmpty ();
 }
 
 // [EOF]
diff --git a/application/hub/interfaces/discovery/dht/.htaccess b/application/hub/interfaces/discovery/dht/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/hub/interfaces/discovery/dht/class_DiscoverableDhtRecipient.php b/application/hub/interfaces/discovery/dht/class_DiscoverableDhtRecipient.php
deleted file mode 100644 (file)
index 0dd47fb..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/**
- * An interface for socket discovery
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-interface DiscoverableDhtRecipient extends Discoverable {
-       /**
-        * Resolves one or more recipients for a DHT transfer by given package data.
-        *
-        * @param       $packageData    Valid package data array
-        * @return      $recipients             An indexed array with DHT recipients
-        */
-       function resolveRecipientsByPackageData (array $packageData);
-}
-
-// [EOF]
-?>
diff --git a/application/hub/interfaces/discovery/node/.htaccess b/application/hub/interfaces/discovery/node/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/hub/interfaces/discovery/node/class_DiscoverableNodeRecipient.php b/application/hub/interfaces/discovery/node/class_DiscoverableNodeRecipient.php
deleted file mode 100644 (file)
index 5c6a489..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-/**
- * An interface for recipient discovery
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-interface DiscoverableNodeRecipient extends Discoverable, IteratorAggregate {
-       /**
-        * Tries to discover all recipients for given package data
-        *
-        * @param       $packageData    Raw package data array
-        * @return      void
-        */
-       function discoverRecipients (array $packageData);
-
-       /**
-        * Tries to discover all recipients by given decoded package data.
-        *
-        * @param       $decodedData    Raw raw package data array
-        * @return      void
-        */
-       function discoverRawRecipients (array $decodedData);
-
-       /**
-        * "Getter" for recipient iterator
-        *
-        * @return      $iteratorInstance       An instance of a Iterateable object
-        */
-       function getIterator ();
-
-       /**
-        * Clears all recipients for e.g. another package to deliver
-        *
-        * @return      void
-        */
-       function clearRecipients ();
-}
-
-// [EOF]
-?>
diff --git a/application/hub/interfaces/discovery/recipient/.htaccess b/application/hub/interfaces/discovery/recipient/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/interfaces/discovery/recipient/class_DiscoverableRecipient.php b/application/hub/interfaces/discovery/recipient/class_DiscoverableRecipient.php
new file mode 100644 (file)
index 0000000..28f7db1
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+/**
+ * An interface for recipient discovery
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface DiscoverableRecipient extends Discoverable {
+       /**
+        * "Getter" for recipient iterator
+        *
+        * @return      $iteratorInstance       An instance of a Iterateable object
+        */
+       function getIterator ();
+
+       /**
+        * Clears all recipients for e.g. another package to deliver
+        *
+        * @return      void
+        */
+       function clearRecipients ();
+
+       /**
+        * Checks whether the recipient list is empty
+        *
+        * @return      $isEmpty        Whether the recipient list is empty
+        */
+       function isRecipientListEmpty ();
+}
+
+// [EOF]
+?>
diff --git a/application/hub/interfaces/discovery/recipient/dht/.htaccess b/application/hub/interfaces/discovery/recipient/dht/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/interfaces/discovery/recipient/dht/class_DiscoverableDhtRecipient.php b/application/hub/interfaces/discovery/recipient/dht/class_DiscoverableDhtRecipient.php
new file mode 100644 (file)
index 0000000..79e721c
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+/**
+ * An interface for DHT recipient discovery
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface DiscoverableDhtRecipient extends DiscoverableRecipient {
+       /**
+        * Resolves one or more recipients for a DHT transfer by given package data.
+        *
+        * @param       $packageData    Valid package data array
+        * @return      $recipients             An indexed array with DHT recipients
+        */
+       function resolveRecipientsByPackageData (array $packageData);
+}
+
+// [EOF]
+?>
diff --git a/application/hub/interfaces/discovery/recipient/node/.htaccess b/application/hub/interfaces/discovery/recipient/node/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/interfaces/discovery/recipient/node/class_DiscoverableNodeRecipient.php b/application/hub/interfaces/discovery/recipient/node/class_DiscoverableNodeRecipient.php
new file mode 100644 (file)
index 0000000..a36d119
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+/**
+ * An interface for node recipient discovery
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface DiscoverableNodeRecipient extends DiscoverableRecipient {
+       /**
+        * Tries to discover all recipients for given package data
+        *
+        * @param       $packageData    Raw package data array
+        * @return      void
+        */
+       function discoverRecipients (array $packageData);
+
+       /**
+        * Tries to discover all recipients by given decoded package data.
+        *
+        * @param       $decodedData    Raw raw package data array
+        * @return      void
+        */
+       function discoverRawRecipients (array $decodedData);
+}
+
+// [EOF]
+?>
diff --git a/application/hub/interfaces/discovery/recipient/socket/.htaccess b/application/hub/interfaces/discovery/recipient/socket/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/interfaces/discovery/recipient/socket/class_DiscoverableSocket.php b/application/hub/interfaces/discovery/recipient/socket/class_DiscoverableSocket.php
new file mode 100644 (file)
index 0000000..a943526
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+/**
+ * An interface for socket discovery
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface DiscoverableSocket extends DiscoverableRecipient {
+       /**
+        * Tries to discover the right socket for given package data and returns a
+        * matching socket resource.
+        *
+        * @param       $packageData            Raw package data array
+        * @param       $connectionType         Type of connection, can be 'incoming' or 'outgoing', *NEVER* 'server'!
+        * @return      $socketResource         A valid socket resource
+        * @throws      NoListGroupException    If the procol group is not found in peer list
+        * @throws      NullPointerException    If listenerInstance is NULL
+        */
+       function discoverSocket (array $packageData, $connectionType);
+}
+
+// [EOF]
+?>
diff --git a/application/hub/interfaces/discovery/socket/.htaccess b/application/hub/interfaces/discovery/socket/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/hub/interfaces/discovery/socket/class_DiscoverableSocket.php b/application/hub/interfaces/discovery/socket/class_DiscoverableSocket.php
deleted file mode 100644 (file)
index d147d0a..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-/**
- * An interface for socket discovery
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-interface DiscoverableSocket extends Discoverable {
-       /**
-        * Tries to discover the right socket for given package data and returns a
-        * matching socket resource.
-        *
-        * @param       $packageData            Raw package data array
-        * @param       $connectionType         Type of connection, can be 'incoming' or 'outgoing', *NEVER* 'server'!
-        * @return      $socketResource         A valid socket resource
-        * @throws      NoListGroupException    If the procol group is not found in peer list
-        * @throws      NullPointerException    If listenerInstance is NULL
-        */
-       function discoverSocket (array $packageData, $connectionType);
-}
-
-// [EOF]
-?>
diff --git a/application/hub/interfaces/discovery/unl/.htaccess b/application/hub/interfaces/discovery/unl/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/interfaces/discovery/unl/class_DiscoverableUniversalNodeLocator.php b/application/hub/interfaces/discovery/unl/class_DiscoverableUniversalNodeLocator.php
new file mode 100644 (file)
index 0000000..203ce42
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ * An interface for UNL discovery
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface DiscoverableUniversalNodeLocator extends Discoverable {
+}
+
+// [EOF]
+?>
index 83d4fca5a76756a3867904965720b956bef8a37f..81d4a4000266981af02a9eb999266e74fe18b85d 100644 (file)
@@ -109,16 +109,16 @@ interface NodeHelper extends Helper, AddableCriteria {
        function doSelfConnection (Taskable $taskInstance);
 
        /**
-        * Determines the universal node locator
+        * Determines the Universal Node Locator
         *
-        * @return      $unl    A an universal node locator for this node
+        * @return      $unl    A an Universal Node Locator for this node
         */
        function determineUniversalNodeLocator ();
 
        /**
-        * "Getter for an universal node locator array
+        * "Getter for an Universal Node Locator array
         *
-        * @return      $unlArray       An array an universal node locator for this node
+        * @return      $unlArray       An array an Universal Node Locator for this node
         */
        function getUniversalNodeLocatorArray ();
 
index bf01e643f953babf8adf2bd79a04ef7f70f20bfb..eab4a6a69a97bfbb3c7fa3df266c499276984028 100644 (file)
@@ -23,7 +23,7 @@
  */
 interface Recipient extends FrameworkInterface {
        /**
-        * Tries to resolve given recipient into session ids or universal node locator
+        * Tries to resolve given recipient into session ids or Universal Node Locator
         * depending on implementation (hint: Template Method Pattern)
         *
         * @param       $recipient              Recipient to resolve (e.g. could be a virtual recipient or direct session id)
diff --git a/application/hub/main/discovery/class_ b/application/hub/main/discovery/class_
new file mode 100644 (file)
index 0000000..95ee1f0
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/**
+ * A !!! discovery class
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class !!!Discovery extends BaseNodeDiscovery implements Discoverable,,,, Registerable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Create an instance of this class
+        *
+        * @return      $discoveryInstance      An instance of this discovery class
+        */
+       public static final function create!!!Discovery () {
+               // Get an instance of this class
+               $discoveryInstance = new !!!Discovery();
+
+               // Return the prepared instance
+               return $discoveryInstance;
+       }
+}
+
+// [EOF]
+?>
index 2e5ff6a529203b5277be669191725455d7914487..9a8db0a27f39f2b9c7405d86d315d3789d7adabc 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * A PackageRecipient discovery class
+ * A general node discovery class
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
@@ -31,73 +31,6 @@ class BaseNodeDiscovery extends BaseDiscovery implements Discoverable {
        protected function __construct ($className) {
                // Call parent constructor
                parent::__construct($className);
-
-               /*
-                * Get recipients list instance and set it here for all discovery
-                * implementations.
-                */
-               $listInstance = RecipientListFactory::createRecipientListInstance();
-               $this->setListInstance($listInstance);
-       }
-
-       /**
-        * Determines the protoctol name
-        *
-        * @param       $packageData            Valid package data
-        * @return      $protocolInstance       An instance of a ProtocolHandler class
-        */
-       protected function determineProtocolByPackageData (array $packageData) {
-               // First we need a tags instance
-               $tagsInstance = PackageTagsFactory::createPackageTagsInstance();
-
-               /*
-                * We need to decide here which socket (TCP or UDP) should be used for
-                * the actual data transmission. In this process we will find out if
-                * the recipient of this package has already a known (registered) socket
-                * and if so we can re-use it. If there is no socket registered, we try
-                * to make a new connection to the given universal node locator.
-                */
-               $protocolInstance = $tagsInstance->chooseProtocolFromPackageData($packageData);
-
-               // Return it
-               return $protocolInstance;
-       }
-
-       /**
-        * "Getter" for recipient iterator
-        *
-        * @return$iteratorInstance An instance of a Iterateable object
-        */
-       public final function getIterator () {
-               // Get iterator from it
-               $iteratorInstance = $this->getListInstance()->getIterator();
-
-               // Return it
-               return $iteratorInstance;
-       }
-
-       /**
-        * Clears all recipients for e.g. another package to deliver. This method
-        * simply clears the inner list instance.
-        *
-        * @return      void
-        */
-       public final function clearRecipients () {
-               // Clear the list
-               $this->getListInstance()->clearList();
-       }
-
-       /**
-        * Checks whether the recipient list is empty
-        *
-        * @return      $isEmpty        Whether the recipient list is empty
-        */
-       public final function isRecipientListEmpty () {
-               // Check it ...
-               $isEmpty = ($this->getListInstance()->count() == 0);
-
-               // Return it
-               return $isEmpty;
        }
 }
 
diff --git a/application/hub/main/discovery/dht/.htaccess b/application/hub/main/discovery/dht/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/hub/main/discovery/dht/class_DhtRecipientDiscovery.php b/application/hub/main/discovery/dht/class_DhtRecipientDiscovery.php
deleted file mode 100644 (file)
index 7a82c1c..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-/**
- * A DhtRecipient discovery class
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class DhtRecipientDiscovery extends BaseNodeDiscovery implements DiscoverableDhtRecipient, Registerable {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Create an instance of this class
-        *
-        * @return      $discoveryInstance      An instance of this discovery class
-        */
-       public static final function createDhtRecipientDiscovery () {
-               // Get an instance of this class
-               $discoveryInstance = new DhtRecipientDiscovery();
-
-               // Get a DHT instance
-               $dhtInstance = DhtObjectFactory::createDhtInstance('node');
-
-               // Set it here
-               $discoveryInstance->setDhtInstance($dhtInstance);
-
-               // Return the prepared instance
-               return $discoveryInstance;
-       }
-
-       /**
-        * Resolves one or more recipients for a DHT transfer by given package data.
-        *
-        * @param       $packageData    Valid package data array
-        * @return      $recipients             An indexed array with DHT recipients
-        */
-       public function resolveRecipientsByPackageData (array $packageData) {
-               // Use facade to get recipients back
-               $recipients = $this->getDhtInstance()->findRecipientsByPackageData($packageData);
-
-               // Return it
-               return $recipients;
-       }
-}
-
-// [EOF]
-?>
diff --git a/application/hub/main/discovery/node/.htaccess b/application/hub/main/discovery/node/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/discovery/node/class_UniversalNodeLocatorDiscovery.php b/application/hub/main/discovery/node/class_UniversalNodeLocatorDiscovery.php
new file mode 100644 (file)
index 0000000..b5c3126
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/**
+ * A UniversalNodeLocator discovery class
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class UniversalNodeLocatorDiscovery extends BaseNodeDiscovery implements DiscoverableUniversalNodeLocator, Registerable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Create an instance of this class
+        *
+        * @return      $discoveryInstance      An instance of this discovery class
+        */
+       public static final function createUniversalNodeLocatorDiscovery () {
+               // Get an instance of this class
+               $discoveryInstance = new UniversalNodeLocatorDiscovery();
+
+               // Return the prepared instance
+               return $discoveryInstance;
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/discovery/package/.htaccess b/application/hub/main/discovery/package/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/hub/main/discovery/package/class_PackageRecipientDiscovery.php b/application/hub/main/discovery/package/class_PackageRecipientDiscovery.php
deleted file mode 100644 (file)
index ee4c3b1..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-<?php
-/**
- * A PackageRecipient discovery class
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class PackageRecipientDiscovery extends BaseNodeDiscovery implements DiscoverableNodeRecipient, Registerable {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Create an instance of this class
-        *
-        * @return      $discoveryInstance      An instance of this discovery class
-        */
-       public static final function createPackageRecipientDiscovery () {
-               // Get an instance of this class
-               $discoveryInstance = new PackageRecipientDiscovery();
-
-               // Return the prepared instance
-               return $discoveryInstance;
-       }
-
-       /**
-        * Tries to discover all recipients for given package data
-        *
-        * @param       $packageData    Raw package data array
-        * @return      void
-        */
-       public function discoverRecipients (array $packageData) {
-               // This must be available
-               //* DEBUG: */ print $this->__toString() . ': packageData=' . print_r($packageData, TRUE);
-               assert(isset($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT]));
-
-               // First try out the direct recipient (session id)
-               try {
-                       // Get instance (should not break)
-                       $recipientInstance = ObjectFactory::createObjectByConfiguredName('direct_recipient_class');
-
-                       // Try to solve it
-                       $recipientInstance->resolveRecipient($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT], $this->getListInstance(), $packageData);
-               } catch (FrameworkException $e) {
-                       // Didn't work, so try the non-generic, depending recipient field itself (this may fail)
-                       try {
-                               // Try to find the right class
-                               $recipientInstance = ObjectFactory::createObjectByConfiguredName(strtolower($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT]) . '_recipient_class');
-
-                               // And try to solve again
-                               $recipientInstance->resolveRecipient($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT], $this->getListInstance(), $packageData);
-                       } catch (FrameworkException $e) {
-                               // Could not find class, what ever failed
-                               $this->debugInstance($e->getMessage());
-                       }
-               }
-       }
-
-       /**
-        * Tries to discover all recipients by given decoded package data.
-        *
-        * @param       $decodedData    Raw raw package data array
-        * @return      void
-        * @todo        Add some validation of recipient field, e.g. an universal node locator is found
-        * @todo        The if() does only check for TCP, not UDP, e.g. try to get a $handlerInstance here
-        */
-       public function discoverRawRecipients (array $decodedData) {
-               // This must be available
-               assert(isset($decodedData[NetworkPackage::PACKAGE_DATA_RECIPIENT]));
-
-               // First clear all recipients
-               $this->clearRecipients();
-
-               // Explode 'recipient', first element is the IP/hostname
-               $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())) {
-                       /*
-                        * 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.
-                        */
-
-                       // 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() . ')');
-               } 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)!');
-
-                       // This package is to be delivered to someone else, so add it
-                       $this->getListInstance()->addEntry('unl', $decodedData[NetworkPackage::PACKAGE_DATA_RECIPIENT]);
-               }
-       }
-}
-
-// [EOF]
-?>
diff --git a/application/hub/main/discovery/recipient/.htaccess b/application/hub/main/discovery/recipient/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/discovery/recipient/class_ b/application/hub/main/discovery/recipient/class_
new file mode 100644 (file)
index 0000000..bd90342
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/**
+ * A !!! recipient discovery class
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class !!!RecipientDiscovery extends BaseRecipientDiscovery implements Discoverable,,,Recipient, Registerable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Create an instance of this class
+        *
+        * @return      $discoveryInstance      An instance of this discovery class
+        */
+       public static final function create!!!Discovery () {
+               // Get an instance of this class
+               $discoveryInstance = new !!!Discovery();
+
+               // Return the prepared instance
+               return $discoveryInstance;
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/discovery/recipient/class_BaseRecipientDiscovery.php b/application/hub/main/discovery/recipient/class_BaseRecipientDiscovery.php
new file mode 100644 (file)
index 0000000..a9741d9
--- /dev/null
@@ -0,0 +1,105 @@
+<?php
+/**
+ * A PackageRecipient discovery class
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class BaseRecipientDiscovery extends BaseRecipientDiscovery implements DiscoverableRecipient {
+       /**
+        * Protected constructor
+        *
+        * @param       $className      Real class name
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+
+               /*
+                * Get recipients list instance and set it here for all discovery
+                * implementations.
+                */
+               $listInstance = RecipientListFactory::createRecipientListInstance();
+               $this->setListInstance($listInstance);
+       }
+
+       /**
+        * Determines the protoctol name
+        *
+        * @param       $packageData            Valid package data
+        * @return      $protocolInstance       An instance of a ProtocolHandler class
+        */
+       protected function determineProtocolByPackageData (array $packageData) {
+               // First we need a tags instance
+               $tagsInstance = PackageTagsFactory::createPackageTagsInstance();
+
+               /*
+                * We need to decide here which socket (TCP or UDP) should be used for
+                * the actual data transmission. In this process we will find out if
+                * the recipient of this package has already a known (registered) socket
+                * and if so we can re-use it. If there is no socket registered, we try
+                * to make a new connection to the given Universal Node Locator.
+                */
+               $protocolInstance = $tagsInstance->chooseProtocolFromPackageData($packageData);
+
+               // Return it
+               return $protocolInstance;
+       }
+
+       /**
+        * "Getter" for recipient iterator
+        *
+        * @return$iteratorInstance An instance of a Iterateable object
+        */
+       public final function getIterator () {
+               // Get iterator from it
+               $iteratorInstance = $this->getListInstance()->getIterator();
+
+               // Return it
+               return $iteratorInstance;
+       }
+
+       /**
+        * Clears all recipients for e.g. another package to deliver. This method
+        * simply clears the inner list instance.
+        *
+        * @return      void
+        */
+       public final function clearRecipients () {
+               // Clear the list
+               $this->getListInstance()->clearList();
+       }
+
+       /**
+        * Checks whether the recipient list is empty
+        *
+        * @return      $isEmpty        Whether the recipient list is empty
+        */
+       public final function isRecipientListEmpty () {
+               // Check it ...
+               $isEmpty = ($this->getListInstance()->count() == 0);
+
+               // Return it
+               return $isEmpty;
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/discovery/recipient/dht/.htaccess b/application/hub/main/discovery/recipient/dht/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/discovery/recipient/dht/class_DhtRecipientDiscovery.php b/application/hub/main/discovery/recipient/dht/class_DhtRecipientDiscovery.php
new file mode 100644 (file)
index 0000000..5fe1bee
--- /dev/null
@@ -0,0 +1,70 @@
+<?php
+/**
+ * A DhtRecipient discovery class
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class DhtRecipientDiscovery extends BaseRecipientDiscovery implements DiscoverableDhtRecipient, Registerable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Create an instance of this class
+        *
+        * @return      $discoveryInstance      An instance of this discovery class
+        */
+       public static final function createDhtRecipientDiscovery () {
+               // Get an instance of this class
+               $discoveryInstance = new DhtRecipientDiscovery();
+
+               // Get a DHT instance
+               $dhtInstance = DhtObjectFactory::createDhtInstance('node');
+
+               // Set it here
+               $discoveryInstance->setDhtInstance($dhtInstance);
+
+               // Return the prepared instance
+               return $discoveryInstance;
+       }
+
+       /**
+        * Resolves one or more recipients for a DHT transfer by given package data.
+        *
+        * @param       $packageData    Valid package data array
+        * @return      $recipients             An indexed array with DHT recipients
+        */
+       public function resolveRecipientsByPackageData (array $packageData) {
+               // Use facade to get recipients back
+               $recipients = $this->getDhtInstance()->findRecipientsByPackageData($packageData);
+
+               // Return it
+               return $recipients;
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/discovery/recipient/package/.htaccess b/application/hub/main/discovery/recipient/package/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/discovery/recipient/package/class_PackageRecipientDiscovery.php b/application/hub/main/discovery/recipient/package/class_PackageRecipientDiscovery.php
new file mode 100644 (file)
index 0000000..46325e9
--- /dev/null
@@ -0,0 +1,120 @@
+<?php
+/**
+ * A PackageRecipient discovery class
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class PackageRecipientDiscovery extends BaseRecipientDiscovery implements DiscoverableNodeRecipient, Registerable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Create an instance of this class
+        *
+        * @return      $discoveryInstance      An instance of this discovery class
+        */
+       public static final function createPackageRecipientDiscovery () {
+               // Get an instance of this class
+               $discoveryInstance = new PackageRecipientDiscovery();
+
+               // Return the prepared instance
+               return $discoveryInstance;
+       }
+
+       /**
+        * Tries to discover all recipients for given package data
+        *
+        * @param       $packageData    Raw package data array
+        * @return      void
+        */
+       public function discoverRecipients (array $packageData) {
+               // This must be available
+               //* DEBUG: */ print $this->__toString() . ': packageData=' . print_r($packageData, TRUE);
+               assert(isset($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT]));
+
+               // First try out the direct recipient (session id)
+               try {
+                       // Get instance (should not break)
+                       $recipientInstance = ObjectFactory::createObjectByConfiguredName('direct_recipient_class');
+
+                       // Try to solve it
+                       $recipientInstance->resolveRecipient($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT], $this->getListInstance(), $packageData);
+               } catch (FrameworkException $e) {
+                       // Didn't work, so try the non-generic, depending recipient field itself (this may fail)
+                       try {
+                               // Try to find the right class
+                               $recipientInstance = ObjectFactory::createObjectByConfiguredName(strtolower($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT]) . '_recipient_class');
+
+                               // And try to solve again
+                               $recipientInstance->resolveRecipient($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT], $this->getListInstance(), $packageData);
+                       } catch (FrameworkException $e) {
+                               // Could not find class, what ever failed
+                               $this->debugInstance($e->getMessage());
+                       }
+               }
+       }
+
+       /**
+        * Tries to discover all recipients by given decoded package data.
+        *
+        * @param       $decodedData    Raw raw package data array
+        * @return      void
+        * @todo        Add some validation of recipient field, e.g. an Universal Node Locator is found
+        * @todo        The if() does only check for TCP, not UDP, e.g. try to get a $handlerInstance here
+        */
+       public function discoverRawRecipients (array $decodedData) {
+               // This must be available
+               assert(isset($decodedData[NetworkPackage::PACKAGE_DATA_RECIPIENT]));
+
+               // First clear all recipients
+               $this->clearRecipients();
+
+               // Explode 'recipient', first element is the IP/hostname
+               $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())) {
+                       /*
+                        * 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.
+                        */
+
+                       // 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() . ')');
+               } 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)!');
+
+                       // This package is to be delivered to someone else, so add it
+                       $this->getListInstance()->addEntry('unl', $decodedData[NetworkPackage::PACKAGE_DATA_RECIPIENT]);
+               }
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/discovery/recipient/socket/.htaccess b/application/hub/main/discovery/recipient/socket/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/discovery/recipient/socket/class_PackageSocketDiscovery.php b/application/hub/main/discovery/recipient/socket/class_PackageSocketDiscovery.php
new file mode 100644 (file)
index 0000000..dcb95db
--- /dev/null
@@ -0,0 +1,182 @@
+<?php
+/**
+ * A socket discovery class
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class PackageSocketDiscovery extends BaseRecipientDiscovery implements DiscoverableSocket, Registerable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Create an instance of this class
+        *
+        * @return      $discoveryInstance      An instance of this discovery class
+        */
+       public static final function createPackageSocketDiscovery () {
+               // Get an instance of this class
+               $discoveryInstance = new PackageSocketDiscovery();
+
+               // Output debug message
+               self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Initialized.');
+
+               // Return the prepared instance
+               return $discoveryInstance;
+       }
+
+       /**
+        * Tries to dicover the right listener instance
+        *
+        * @param       $protocolName           Protocol name
+        * @param       $packageData            Raw package data
+        * @return      $listenerInstance       An instance of a Listenable instance or null
+        */
+       public function discoverListenerInstance ($protocolName, array $packageData) {
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: protocolName=' . $protocolName . ' - ENTERED!');
+
+               /*
+                * Get the listener pool instance, we need to lookup the matching
+                * listener->poolInstance chain there.
+                */
+               $poolInstance = NodeObjectFactory::createNodeInstance()->getListenerPoolInstance();
+
+               // Init listener instance
+               $listenerInstance = NULL;
+
+               /*
+                * Now we need to choose again. It is whether we are speaking with a hub
+                * or with a client. So just handle it over to all listeners in this
+                * pool.
+                */
+               foreach ($poolInstance->getPoolEntriesInstance()->getArrayFromGroup($protocolName) as $listenerInstance) {
+                       // Debug output
+                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: protocolName=' . $protocolName . ',listenerInstance=' . $listenerInstance->__toString());
+
+                       // Does the listener want that package?
+                       if ($listenerInstance->ifListenerAcceptsPackageData($packageData)) {
+                               // This listener likes our package data, so abort here
+                               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Listener is accepting package data.');
+                               break;
+                       } // END - if
+
+                       // Debug output
+                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Listener is NOT accepting package data.');
+               } // END - foreach
+
+               // Return it
+               return $listenerInstance;
+       }
+
+       /**
+        * Tries to discover the right socket for given package data and returns a
+        * matching socket resource for that protocol.
+        *
+        * @param       $packageData            Raw package data array
+        * @param       $connectionType         Type of connection, can be 'incoming' or 'outgoing', *NEVER* 'server'!
+        * @return      $socketResource         A valid socket resource or FALSE if an error occured
+        * @throws      NoListGroupException    If the procol group is not found in peer list
+        * @throws      NullPointerException    If listenerInstance is NULL
+        */
+       public function discoverSocket (array $packageData, $connectionType) {
+               // Assert on type
+               assert($connectionType != BaseConnectionHelper::CONNECTION_TYPE_SERVER);
+
+               // Determine protocol name
+               $protocolName = $this->determineProtocolByPackageData($packageData);
+
+               // Is it the same?
+               assert(strtoupper($protocolName) == $packageData[NetworkPackage::PACKAGE_DATA_PROTOCOL]);
+
+               // Get the listener instance
+               $listenerInstance = $this->discoverListenerInstance($protocolName, $packageData);
+
+               // If there is no listener who wants to have that package, we simply drop it here
+               if (is_null($listenerInstance)) {
+                       // Abort with no resource
+                       throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+               } // END - if
+
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('protocolName=' . $protocolName . ',packageData=' . print_r($packageData, TRUE));
+
+               /*
+                * Now we have the listener instance, we can determine the right
+                * resource to continue. The first step is to get the attached pool
+                * instance and pass over the whole package data to get the right
+                * socket.
+                */
+               $socketResource = $listenerInstance->getPoolInstance()->getSocketFromPackageData($packageData, $connectionType);
+
+               // Debug message
+               if (is_resource($socketResource)) {
+                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('socketResource[' . gettype($socketResource) . ']=' . $socketResource . ',error=' . socket_strerror(socket_last_error($socketResource)) . ',packageData=' . print_r($packageData, TRUE));
+               } else {
+                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('socketResource[' . gettype($socketResource) . ']=' . $socketResource . ',packageData=' . print_r($packageData, TRUE));
+               }
+
+               // Is it FALSE, the recipient isn't known to us and we have no connection to it
+               if (($socketResource === FALSE) || (!is_resource($socketResource)) || (socket_last_error($socketResource) > 0)) {
+                       // Try to create a new socket resource
+                       try {
+                               // Possibly noisy debug message
+                               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Trying to establish a ' . strtoupper($protocolName) . ' connection to ' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ' ...');
+
+                               // Get a socket resource from our factory (if succeeded)
+                               $socketResource = SocketFactory::createSocketFromPackageData($packageData, $protocolName);
+                       } catch (SocketConnectionException $e) {
+                               // The connection fails of being established, so log it away
+                               self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Caught ' . $e->__toString() . ',message=' . $e->getMessage());
+                       }
+               } // END - if
+
+               // Try to resolve the socket resource
+               try {
+                       // Get the helper instance from registry
+                       $helperInstance = Registry::getRegistry()->getInstance('connection');
+
+                       // Possibly noisy debug message
+                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Going to resolve socket from peer state and given package data ...');
+
+                       // Resolve the peer's state (but ignore return value)
+                       PeerStateResolver::resolveStateByPackage($helperInstance, $packageData, $socketResource);
+               } catch (InvalidSocketException $e) {
+                       // This cannot be fixed, so log it away
+                       self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Cannot discover socket resource for recipient ' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ': ' . $e->getMessage());
+
+                       // Make any failed attempts to 'FALSE'
+                       $socketResource = FALSE;
+               }
+
+               // And return it
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: socketResource=' . $socketResource . ',packageData=' . print_r($packageData, TRUE));
+               return $socketResource;
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/discovery/socket/.htaccess b/application/hub/main/discovery/socket/.htaccess
deleted file mode 100644 (file)
index 3a42882..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Deny from all
diff --git a/application/hub/main/discovery/socket/class_PackageSocketDiscovery.php b/application/hub/main/discovery/socket/class_PackageSocketDiscovery.php
deleted file mode 100644 (file)
index 156397a..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-<?php
-/**
- * A socket discovery class
- *
- * @author             Roland Haeder <webmaster@shipsimu.org>
- * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
- * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class PackageSocketDiscovery extends BaseNodeDiscovery implements DiscoverableSocket, Registerable {
-       /**
-        * Protected constructor
-        *
-        * @return      void
-        */
-       protected function __construct () {
-               // Call parent constructor
-               parent::__construct(__CLASS__);
-       }
-
-       /**
-        * Create an instance of this class
-        *
-        * @return      $discoveryInstance      An instance of this discovery class
-        */
-       public static final function createPackageSocketDiscovery () {
-               // Get an instance of this class
-               $discoveryInstance = new PackageSocketDiscovery();
-
-               // Output debug message
-               self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Initialized.');
-
-               // Return the prepared instance
-               return $discoveryInstance;
-       }
-
-       /**
-        * Tries to dicover the right listener instance
-        *
-        * @param       $protocolName           Protocol name
-        * @param       $packageData            Raw package data
-        * @return      $listenerInstance       An instance of a Listenable instance or null
-        */
-       public function discoverListenerInstance ($protocolName, array $packageData) {
-               // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: protocolName=' . $protocolName . ' - ENTERED!');
-
-               /*
-                * Get the listener pool instance, we need to lookup the matching
-                * listener->poolInstance chain there.
-                */
-               $poolInstance = NodeObjectFactory::createNodeInstance()->getListenerPoolInstance();
-
-               // Init listener instance
-               $listenerInstance = NULL;
-
-               /*
-                * Now we need to choose again. It is whether we are speaking with a hub
-                * or with a client. So just handle it over to all listeners in this
-                * pool.
-                */
-               foreach ($poolInstance->getPoolEntriesInstance()->getArrayFromGroup($protocolName) as $listenerInstance) {
-                       // Debug output
-                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: protocolName=' . $protocolName . ',listenerInstance=' . $listenerInstance->__toString());
-
-                       // Does the listener want that package?
-                       if ($listenerInstance->ifListenerAcceptsPackageData($packageData)) {
-                               // This listener likes our package data, so abort here
-                               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Listener is accepting package data.');
-                               break;
-                       } // END - if
-
-                       // Debug output
-                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Listener is NOT accepting package data.');
-               } // END - foreach
-
-               // Return it
-               return $listenerInstance;
-       }
-
-       /**
-        * Tries to discover the right socket for given package data and returns a
-        * matching socket resource for that protocol.
-        *
-        * @param       $packageData            Raw package data array
-        * @param       $connectionType         Type of connection, can be 'incoming' or 'outgoing', *NEVER* 'server'!
-        * @return      $socketResource         A valid socket resource or FALSE if an error occured
-        * @throws      NoListGroupException    If the procol group is not found in peer list
-        * @throws      NullPointerException    If listenerInstance is NULL
-        */
-       public function discoverSocket (array $packageData, $connectionType) {
-               // Assert on type
-               assert($connectionType != BaseConnectionHelper::CONNECTION_TYPE_SERVER);
-
-               // Determine protocol name
-               $protocolName = $this->determineProtocolByPackageData($packageData);
-
-               // Is it the same?
-               assert(strtoupper($protocolName) == $packageData[NetworkPackage::PACKAGE_DATA_PROTOCOL]);
-
-               // Get the listener instance
-               $listenerInstance = $this->discoverListenerInstance($protocolName, $packageData);
-
-               // If there is no listener who wants to have that package, we simply drop it here
-               if (is_null($listenerInstance)) {
-                       // Abort with no resource
-                       throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
-               } // END - if
-
-               // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('protocolName=' . $protocolName . ',packageData=' . print_r($packageData, TRUE));
-
-               /*
-                * Now we have the listener instance, we can determine the right
-                * resource to continue. The first step is to get the attached pool
-                * instance and pass over the whole package data to get the right
-                * socket.
-                */
-               $socketResource = $listenerInstance->getPoolInstance()->getSocketFromPackageData($packageData, $connectionType);
-
-               // Debug message
-               if (is_resource($socketResource)) {
-                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('socketResource[' . gettype($socketResource) . ']=' . $socketResource . ',error=' . socket_strerror(socket_last_error($socketResource)) . ',packageData=' . print_r($packageData, TRUE));
-               } else {
-                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('socketResource[' . gettype($socketResource) . ']=' . $socketResource . ',packageData=' . print_r($packageData, TRUE));
-               }
-
-               // Is it FALSE, the recipient isn't known to us and we have no connection to it
-               if (($socketResource === FALSE) || (!is_resource($socketResource)) || (socket_last_error($socketResource) > 0)) {
-                       // Try to create a new socket resource
-                       try {
-                               // Possibly noisy debug message
-                               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Trying to establish a ' . strtoupper($protocolName) . ' connection to ' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ' ...');
-
-                               // Get a socket resource from our factory (if succeeded)
-                               $socketResource = SocketFactory::createSocketFromPackageData($packageData, $protocolName);
-                       } catch (SocketConnectionException $e) {
-                               // The connection fails of being established, so log it away
-                               self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Caught ' . $e->__toString() . ',message=' . $e->getMessage());
-                       }
-               } // END - if
-
-               // Try to resolve the socket resource
-               try {
-                       // Get the helper instance from registry
-                       $helperInstance = Registry::getRegistry()->getInstance('connection');
-
-                       // Possibly noisy debug message
-                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Going to resolve socket from peer state and given package data ...');
-
-                       // Resolve the peer's state (but ignore return value)
-                       PeerStateResolver::resolveStateByPackage($helperInstance, $packageData, $socketResource);
-               } catch (InvalidSocketException $e) {
-                       // This cannot be fixed, so log it away
-                       self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: Cannot discover socket resource for recipient ' . $packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT] . ': ' . $e->getMessage());
-
-                       // Make any failed attempts to 'FALSE'
-                       $socketResource = FALSE;
-               }
-
-               // And return it
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-DISCOVERY[' . __METHOD__ . ':' . __LINE__ . ']: socketResource=' . $socketResource . ',packageData=' . print_r($packageData, TRUE));
-               return $socketResource;
-       }
-}
-
-// [EOF]
-?>
index 3debbe0bd973dfcbab62ac47ca64acae8add53b7..c3b1805a68ec113c1041388045b3157e486438fd 100644 (file)
@@ -42,7 +42,7 @@ class RecipientList extends BaseList implements Listable, Registerable {
                $listInstance = new RecipientList();
 
                // Add groups:
-               // 1.) universal node locators
+               // 1.) Universal Node Locators
                $listInstance->addGroup('unl');
 
                // 2.) Session ids
index 08746675e1db898d2c5dde09f0ce4f5f01580f60..3e0538d177a37a75bc84ec80c7ad0370238c0d3b 100644 (file)
@@ -686,28 +686,33 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
        }
 
        /**
-        * Determines the universal node locator
+        * Determines the Universal Node Locator
         *
-        * @return      $unl    A an universal node locator for this node
+        * @return      $unl    A an Universal Node Locator for this node
         */
-       public final function determineUniversalNodeLocator () {
-               // Get IP and port
-               $unl = $this->getConfigInstance()->detectServerAddress() . ':' . $this->getConfigInstance()->getConfigEntry('node_listen_port');
+       public function determineUniversalNodeLocator () {
+               // Determine UNL based on this node:
+               // 1) Get discovery class
+               $discoveryInstance = ObjectFactory::createObjectByConfiguredName('unl_discovery_class');
+
+               // 1) "Determine it
+               $unl = $discoveryInstance->discoverUniversalNodeLocatorByNode($this);
 
                // Return it
                return $unl;
        }
 
        /**
-        * "Getter" for universal node locator array
+        * "Getter" for Universal Node Locator array
         *
-        * @return      $unlArray       An array of the universal node locator for this node
+        * @return      $unlArray       An array of the Universal Node Locator for this node
         */
        public final function getUniversalNodeLocatorArray () {
-               // Get IP and port
+               // Get Universal Node Locator (UNL)
+               $unl = $this->determineUniversalNodeLocator();
+
                // @TODO Unfinished
-               die(__METHOD__ . ':' . print_r($this, TRUE));
-               $unlArray = explode(':', $this->determineUniversalNodeLocator());
+               die(__METHOD__ . ':' . print_r($unl, TRUE));
 
                // Return it
                return $unlArray;
index 8f3e2a1f5ee80ec058f289087ad103eb9528ace4..39ffea7c4a0cd7e10fc0d1aecdf0786c2dcdf19c 100644 (file)
@@ -223,7 +223,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer {
                // Temporary resolve recipient field
                $recipientIpArray = explode(':', HubTools::resolveSessionId($packageData[NetworkPackage::PACKAGE_DATA_RECIPIENT]));
 
-               // Make sure it is a valid universal node locator array (3 elements)
+               // Make sure it is a valid Universal Node Locator array (3 elements)
                assert(count($recipientIpArray) == 3);
 
                // Debug message
index c5a6f2e4e4436697481d26e773f816c38ea1b18a..3d9449c3534eafbfb5f801c5654f43f937f9d989 100644 (file)
@@ -46,7 +46,7 @@ class ???Recipient extends BaseRecipient implements Recipient {
        }
 
        /**
-        * Tries to resolve given recipient into session ids or universal node locator
+        * Tries to resolve given recipient into session ids or Universal Node Locator
         * depending on implementation (hint: Template Method Pattern)
         *
         * @param       $recipient              Recipient to resolve (e.g. could be a virtual recipient or direct session id)
index 40daab4a4861c5a8a1fc085c55bff6b55f887cfc..e4a7d7f422c328cc856e8ed0a7fd089aab44c990 100644 (file)
@@ -46,7 +46,7 @@ class DhtRecipient extends BaseRecipient implements Recipient {
        }
 
        /**
-        * Tries to resolve given recipient into session ids or universal node locator
+        * Tries to resolve given recipient into session ids or Universal Node Locator
         * depending on implementation (hint: Template Method Pattern). This
         * implementation will add more than one recipient to the list as a DHT is
         * distributed and the package might go to more than one recipient.
index 71e61d392256bcf24b0df1dd0a67e802be3d04a3..014809cfeadc604a39ca16ff387f4822ecad10a1 100644 (file)
@@ -46,7 +46,7 @@ class DirectRecipient extends BaseRecipient implements Recipient {
        }
 
        /**
-        * Tries to resolve given recipient into session ids or universal node locator
+        * Tries to resolve given recipient into session ids or Universal Node Locator
         * depending on implementation (hint: Template Method Pattern)
         *
         * @param       $recipient              Recipient to resolve (e.g. could be a virtual recipient or direct session id)
index f0a0c89e5f8de276a69d63559321664d630fcb0b..6693e6b656a4e30524b6330c486c3bba227e5ca4 100644 (file)
@@ -46,7 +46,7 @@ class SelfRecipient extends BaseRecipient implements Recipient {
        }
 
        /**
-        * Tries to resolve given recipient into session ids or universal node locator
+        * Tries to resolve given recipient into session ids or Universal Node Locator
         * depending on implementation (hint: Template Method Pattern)
         *
         * @param       $recipient              Recipient to resolve (e.g. could be a virtual recipient or direct session id)
index f391d8faee07be4645eab01c1ddde72198d2f30f..d6532029a2247dc9dcc84ac22481ffd9c2f1ea22 100644 (file)
@@ -46,7 +46,7 @@ class UpperRecipient extends BaseRecipient implements Recipient {
        }
 
        /**
-        * Tries to resolve given recipient into session ids or universal node locator
+        * Tries to resolve given recipient into session ids or Universal Node Locator
         * depending on implementation (hint: Template Method Pattern)
         *
         * @param       $recipient              Recipient to resolve (e.g. could be a virtual recipient or direct session id)
index c41aa047e6b47e306b499c04196e85ef8eeaa483..c154b553282a07d482310ff1d85b8608214245d0 100644 (file)
@@ -86,17 +86,17 @@ class HubTools extends BaseHubSystem {
        }
 
        /**
-        * Resolves a session id into an universal node locator. The opposite method
+        * Resolves a session id into an Universal Node Locator. The opposite method
         * is resolveSessionIdByUniversalNodeLocator()
         *
         * @param       $sessionId                      A valid session id
-        * @return      $recipientUniversalNodeLocator  Recipient as universal node locator
+        * @return      $recipientUniversalNodeLocator  Recipient as Universal Node Locator
         */
        protected function resolveUniversalNodeLocatorBySessionId ($sessionId) {
                // Init variable
                $recipientUniversalNodeLocator = 'invalid:invalid';
 
-               // And ask it for universal node locator by given session id
+               // And ask it for Universal Node Locator by given session id
                $recipient = $this->getDhtInstance()->findNodeLocalBySessionId($sessionId);
 
                // Is the recipient valid?
@@ -109,7 +109,7 @@ class HubTools extends BaseHubSystem {
 
                        // Is the session id the same?
                        if ($nodeInstance->getSessionId() == $sessionId) {
-                               // Then get the universal node locator from it, assume TCP by default
+                               // Then get the Universal Node Locator from it, assume TCP by default
                                $recipientUniversalNodeLocator = self::determineOwnExternalIp() . ':' . $nodeInstance->getConfigInstance()->getConfigEntry('node_listen_port');
                        } // END - if
                }
@@ -119,17 +119,17 @@ class HubTools extends BaseHubSystem {
        }
 
        /**
-        * Resolves a universal node locator into a session id. The "opposite" method
+        * Resolves a Universal Node Locator into a session id. The "opposite" method
         * is resolveUniversalNodeLocatorBySessionId().
         *
-        * @param       $unl            Universal node locator
+        * @param       $unl            Universal Node Locator
         * @return      $sessionId      Valid session id
         */
        public static function resolveSessionIdByUniversalNodeLocator ($unl) {
                // Get an own instance
                $selfInstance = self::getSelfInstance();
 
-               // And ask it for session id by given universal node locator
+               // And ask it for session id by given Universal Node Locator
                $recipient = $selfInstance->getDhtInstance()->findNodeByUniversalNodeLocator($unl);
                die(__METHOD__.':recipient=<pre>'.print_r($recipient, TRUE).'</pre>' . PHP_EOL);
 
@@ -138,25 +138,25 @@ class HubTools extends BaseHubSystem {
        }
 
        /**
-        * Resolves given session id into an universal node locator, if universal node locator is set, it won't be translated
+        * Resolves given session id into an Universal Node Locator, if Universal Node Locator is set, it won't be translated
         *
-        * @param       $address        Session id or universal node locator
-        * @return      $recipient      Recipient as universal node locator
-        * @throws      InvalidSessionIdException       If the provided session id is invalid (and no universal node locator)
+        * @param       $address        Session id or Universal Node Locator
+        * @return      $recipient      Recipient as Universal Node Locator
+        * @throws      InvalidSessionIdException       If the provided session id is invalid (and no Universal Node Locator)
         * @throws      NoValidHostnameException        If the provided hostname cannot be resolved into an IP address
         */
        public static function resolveSessionId ($address) {
                // Get an own instance
                $selfInstance = self::getSelfInstance();
 
-               // Default is direct universal node locator
+               // Default is direct Universal Node Locator
                $recipient = $address;
 
-               // Does it match a direct universal node locator? (hint: see www.regexlib.com for the regular expression)
+               // Does it match a direct Universal Node Locator? (hint: see www.regexlib.com for the regular expression)
                if (preg_match('/([a-z0-9]{3,10})\/\/:([a-z0-9\.]{5,})/', $address)) {
                        // @TODO ((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])):([0-9]{3,5})
-                       // Direct universal node locator found
-                       self::createDebugInstance(__CLASS__)->debugOutput('HUB-TOOLS[' . __METHOD__ . ':' . __LINE__ . ']: Direct universal node locator ' . $address . ' detected.');
+                       // Direct Universal Node Locator found
+                       self::createDebugInstance(__CLASS__)->debugOutput('HUB-TOOLS[' . __METHOD__ . ':' . __LINE__ . ']: Direct Universal Node Locator ' . $address . ' detected.');
                } elseif (isset($selfInstance->sessionIdCache[$address])) {
                        // Debug message
                        self::createDebugInstance(__CLASS__)->debugOutput('HUB-TOOLS[' . __METHOD__ . ':' . __LINE__ . ']: Using entry from sessionIdCache[] array.');
@@ -170,7 +170,7 @@ class HubTools extends BaseHubSystem {
                        // Debug message
                        self::createDebugInstance(__CLASS__)->debugOutput('HUB-TOOLS[' . __METHOD__ . ':' . __LINE__ . ']: Using internal session id resolver.');
 
-                       // Resolve session id into an universal node locator
+                       // Resolve session id into an Universal Node Locator
                        $recipient = $selfInstance->resolveUniversalNodeLocatorBySessionId($address);
 
                        // Debug message
index 34b0b63fabe3475ac9d69c75cbaec6ec10336e3c..9dafd9f35b80dfbf5b4851c5cdf2a93cd1b863cb 100644 (file)
@@ -146,7 +146,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem
                // Set the primary key
                $dataSetInstance->setUniqueKey(self::DB_COLUMN_NODE_ID);
 
-               // Get universal node locator and "explode" it
+               // Get Universal Node Locator and "explode" it
                $unl = $nodeInstance->getUniversalNodeLocatorArray();
 
                // Make sure both is valid
@@ -187,7 +187,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem
                // Get node instance
                $nodeInstance = NodeObjectFactory::createNodeInstance();
 
-               // Get universal node locator and "explode" it
+               // Get Universal Node Locator and "explode" it
                $unl = $nodeInstance->getUniversalNodeLocatorArray();
 
                /*
@@ -196,7 +196,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem
                 */
                assert(($unl[0] !== 'invalid') && ($unl[1] !== 'invalid') && ($unl[2] !== 'invalid'));
 
-               // Add universal node locator/node id as criteria
+               // Add Universal Node Locator/node id as criteria
                $searchInstance->addCriteria(self::DB_COLUMN_EXTERNAL_IP, $unl[0]);
                $searchInstance->addCriteria(self::DB_COLUMN_LISTEN_PORT, $unl[1]);
                $searchInstance->addCriteria(self::DB_COLUMN_NODE_ID    , $nodeInstance->getNodeId());
diff --git a/core b/core
index 584f44fab69cbffea39a99f0b169e3bdbb98b385..1613679bba663e7d92c2194fd14a047770befe2c 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit 584f44fab69cbffea39a99f0b169e3bdbb98b385
+Subproject commit 1613679bba663e7d92c2194fd14a047770befe2c