From: Roland Haeder Date: Fri, 31 Oct 2014 22:43:41 +0000 (+0100) Subject: Continued on rewrite: X-Git-Url: https://git.mxchange.org/?p=hub.git;a=commitdiff_plain;h=d9442666cf3dee440aeca9ac1377880d3d01f3a3 Continued on rewrite: - Added new interface + first (completely unfinished) implementation for UNL discovery - - Made UNL upper-case Signed-off-by: Roland Haeder --- diff --git a/application/hub/config.php b/application/hub/config.php index 1e0180534..d66d1badf 100644 --- a/application/hub/config.php +++ b/application/hub/config.php @@ -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'); diff --git a/application/hub/interfaces/discovery/class_Discoverable.php b/application/hub/interfaces/discovery/class_Discoverable.php index edeba3578..8bb0dc9f0 100644 --- a/application/hub/interfaces/discovery/class_Discoverable.php +++ b/application/hub/interfaces/discovery/class_Discoverable.php @@ -22,26 +22,6 @@ * along with this program. If not, see . */ 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 index 3a4288278..000000000 --- a/application/hub/interfaces/discovery/dht/.htaccess +++ /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 index 0dd47fbfd..000000000 --- a/application/hub/interfaces/discovery/dht/class_DiscoverableDhtRecipient.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @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 . - */ -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 index 3a4288278..000000000 --- a/application/hub/interfaces/discovery/node/.htaccess +++ /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 index 5c6a48924..000000000 --- a/application/hub/interfaces/discovery/node/class_DiscoverableNodeRecipient.php +++ /dev/null @@ -1,57 +0,0 @@ - - * @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 . - */ -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 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/interfaces/discovery/recipient/.htaccess @@ -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 index 000000000..28f7db1e2 --- /dev/null +++ b/application/hub/interfaces/discovery/recipient/class_DiscoverableRecipient.php @@ -0,0 +1,48 @@ + + * @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 . + */ +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 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/interfaces/discovery/recipient/dht/.htaccess @@ -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 index 000000000..79e721c82 --- /dev/null +++ b/application/hub/interfaces/discovery/recipient/dht/class_DiscoverableDhtRecipient.php @@ -0,0 +1,35 @@ + + * @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 . + */ +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 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/interfaces/discovery/recipient/node/.htaccess @@ -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 index 000000000..a36d11948 --- /dev/null +++ b/application/hub/interfaces/discovery/recipient/node/class_DiscoverableNodeRecipient.php @@ -0,0 +1,43 @@ + + * @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 . + */ +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 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/interfaces/discovery/recipient/socket/.htaccess @@ -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 index 000000000..a94352633 --- /dev/null +++ b/application/hub/interfaces/discovery/recipient/socket/class_DiscoverableSocket.php @@ -0,0 +1,39 @@ + + * @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 . + */ +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 index 3a4288278..000000000 --- a/application/hub/interfaces/discovery/socket/.htaccess +++ /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 index d147d0a2f..000000000 --- a/application/hub/interfaces/discovery/socket/class_DiscoverableSocket.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @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 . - */ -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 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/interfaces/discovery/unl/.htaccess @@ -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 index 000000000..203ce429b --- /dev/null +++ b/application/hub/interfaces/discovery/unl/class_DiscoverableUniversalNodeLocator.php @@ -0,0 +1,28 @@ + + * @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 . + */ +interface DiscoverableUniversalNodeLocator extends Discoverable { +} + +// [EOF] +?> diff --git a/application/hub/interfaces/helper/nodes/class_NodeHelper.php b/application/hub/interfaces/helper/nodes/class_NodeHelper.php index 83d4fca5a..81d4a4000 100644 --- a/application/hub/interfaces/helper/nodes/class_NodeHelper.php +++ b/application/hub/interfaces/helper/nodes/class_NodeHelper.php @@ -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 (); diff --git a/application/hub/interfaces/recipient/class_Recipient.php b/application/hub/interfaces/recipient/class_Recipient.php index bf01e643f..eab4a6a69 100644 --- a/application/hub/interfaces/recipient/class_Recipient.php +++ b/application/hub/interfaces/recipient/class_Recipient.php @@ -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 index 000000000..95ee1f011 --- /dev/null +++ b/application/hub/main/discovery/class_ @@ -0,0 +1,50 @@ + + * @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 . + */ +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] +?> diff --git a/application/hub/main/discovery/class_BaseNodeDiscovery.php b/application/hub/main/discovery/class_BaseNodeDiscovery.php index 2e5ff6a52..9a8db0a27 100644 --- a/application/hub/main/discovery/class_BaseNodeDiscovery.php +++ b/application/hub/main/discovery/class_BaseNodeDiscovery.php @@ -1,6 +1,6 @@ * @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 index 3a4288278..000000000 --- a/application/hub/main/discovery/dht/.htaccess +++ /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 index 7a82c1c50..000000000 --- a/application/hub/main/discovery/dht/class_DhtRecipientDiscovery.php +++ /dev/null @@ -1,70 +0,0 @@ - - * @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 . - */ -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 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/discovery/node/.htaccess @@ -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 index 000000000..b5c3126b4 --- /dev/null +++ b/application/hub/main/discovery/node/class_UniversalNodeLocatorDiscovery.php @@ -0,0 +1,50 @@ + + * @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 . + */ +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 index 3a4288278..000000000 --- a/application/hub/main/discovery/package/.htaccess +++ /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 index ee4c3b1ae..000000000 --- a/application/hub/main/discovery/package/class_PackageRecipientDiscovery.php +++ /dev/null @@ -1,120 +0,0 @@ - - * @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 . - */ -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 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/discovery/recipient/.htaccess @@ -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 index 000000000..bd903423f --- /dev/null +++ b/application/hub/main/discovery/recipient/class_ @@ -0,0 +1,50 @@ + + * @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 . + */ +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 index 000000000..a9741d984 --- /dev/null +++ b/application/hub/main/discovery/recipient/class_BaseRecipientDiscovery.php @@ -0,0 +1,105 @@ + + * @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 . + */ +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 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/discovery/recipient/dht/.htaccess @@ -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 index 000000000..5fe1bee35 --- /dev/null +++ b/application/hub/main/discovery/recipient/dht/class_DhtRecipientDiscovery.php @@ -0,0 +1,70 @@ + + * @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 . + */ +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 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/discovery/recipient/package/.htaccess @@ -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 index 000000000..46325e9b4 --- /dev/null +++ b/application/hub/main/discovery/recipient/package/class_PackageRecipientDiscovery.php @@ -0,0 +1,120 @@ + + * @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 . + */ +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 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/discovery/recipient/socket/.htaccess @@ -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 index 000000000..dcb95dbc6 --- /dev/null +++ b/application/hub/main/discovery/recipient/socket/class_PackageSocketDiscovery.php @@ -0,0 +1,182 @@ + + * @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 . + */ +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 index 3a4288278..000000000 --- a/application/hub/main/discovery/socket/.htaccess +++ /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 index 156397a42..000000000 --- a/application/hub/main/discovery/socket/class_PackageSocketDiscovery.php +++ /dev/null @@ -1,182 +0,0 @@ - - * @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 . - */ -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] -?> diff --git a/application/hub/main/lists/recipient/class_RecipientList.php b/application/hub/main/lists/recipient/class_RecipientList.php index 3debbe0bd..c3b1805a6 100644 --- a/application/hub/main/lists/recipient/class_RecipientList.php +++ b/application/hub/main/lists/recipient/class_RecipientList.php @@ -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 diff --git a/application/hub/main/nodes/class_BaseHubNode.php b/application/hub/main/nodes/class_BaseHubNode.php index 08746675e..3e0538d17 100644 --- a/application/hub/main/nodes/class_BaseHubNode.php +++ b/application/hub/main/nodes/class_BaseHubNode.php @@ -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; diff --git a/application/hub/main/pools/peer/class_DefaultPeerPool.php b/application/hub/main/pools/peer/class_DefaultPeerPool.php index 8f3e2a1f5..39ffea7c4 100644 --- a/application/hub/main/pools/peer/class_DefaultPeerPool.php +++ b/application/hub/main/pools/peer/class_DefaultPeerPool.php @@ -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 diff --git a/application/hub/main/recipient/class_ b/application/hub/main/recipient/class_ index c5a6f2e4e..3d9449c35 100644 --- a/application/hub/main/recipient/class_ +++ b/application/hub/main/recipient/class_ @@ -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) diff --git a/application/hub/main/recipient/dht/class_DhtRecipient.php b/application/hub/main/recipient/dht/class_DhtRecipient.php index 40daab4a4..e4a7d7f42 100644 --- a/application/hub/main/recipient/dht/class_DhtRecipient.php +++ b/application/hub/main/recipient/dht/class_DhtRecipient.php @@ -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. diff --git a/application/hub/main/recipient/direct/class_DirectRecipient.php b/application/hub/main/recipient/direct/class_DirectRecipient.php index 71e61d392..014809cfe 100644 --- a/application/hub/main/recipient/direct/class_DirectRecipient.php +++ b/application/hub/main/recipient/direct/class_DirectRecipient.php @@ -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) diff --git a/application/hub/main/recipient/self/class_SelfRecipient.php b/application/hub/main/recipient/self/class_SelfRecipient.php index f0a0c89e5..6693e6b65 100644 --- a/application/hub/main/recipient/self/class_SelfRecipient.php +++ b/application/hub/main/recipient/self/class_SelfRecipient.php @@ -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) diff --git a/application/hub/main/recipient/upper/class_UpperRecipient.php b/application/hub/main/recipient/upper/class_UpperRecipient.php index f391d8fae..d6532029a 100644 --- a/application/hub/main/recipient/upper/class_UpperRecipient.php +++ b/application/hub/main/recipient/upper/class_UpperRecipient.php @@ -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) diff --git a/application/hub/main/tools/class_HubTools.php b/application/hub/main/tools/class_HubTools.php index c41aa047e..c154b5532 100644 --- a/application/hub/main/tools/class_HubTools.php +++ b/application/hub/main/tools/class_HubTools.php @@ -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=
'.print_r($recipient, TRUE).'
' . 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 diff --git a/application/hub/main/wrapper/node/class_NodeDistributedHashTableDatabaseWrapper.php b/application/hub/main/wrapper/node/class_NodeDistributedHashTableDatabaseWrapper.php index 34b0b63fa..9dafd9f35 100644 --- a/application/hub/main/wrapper/node/class_NodeDistributedHashTableDatabaseWrapper.php +++ b/application/hub/main/wrapper/node/class_NodeDistributedHashTableDatabaseWrapper.php @@ -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 584f44fab..1613679bb 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 584f44fab69cbffea39a99f0b169e3bdbb98b385 +Subproject commit 1613679bba663e7d92c2194fd14a047770befe2c