]> git.mxchange.org Git - hub.git/commitdiff
Added DHT recipient discovery interface (wrong computer :-( ).
authorRoland 'Quix0r' Haeder <roland@mxchange.org>
Tue, 11 Feb 2014 21:38:16 +0000 (22:38 +0100)
committerRoland 'Quix0r' Haeder <roland@mxchange.org>
Tue, 11 Feb 2014 21:38:16 +0000 (22:38 +0100)
Signed-off-by: Roland 'Quix0r' Haeder <roland@mxchange.org>
application/hub/config.php
application/hub/interfaces/discovery/class_DiscoverableDhtRecipient.php [new file with mode: 0644]
application/hub/interfaces/discovery/class_DiscoverableNodeRecipient.php [new file with mode: 0644]
application/hub/interfaces/discovery/class_DiscoverableRecipient.php [deleted file]
application/hub/main/discovery/dht/.htaccess [new file with mode: 0644]
application/hub/main/discovery/dht/class_DhtRecipientDiscovery.php [new file with mode: 0644]
application/hub/main/discovery/package/class_PackageRecipientDiscovery.php

index 7f734fe38e94fbe1c5b4bda8b225f6ee9273697f..316f6188d05a39932bdb54b832fb18ca70f36e6a 100644 (file)
@@ -660,12 +660,15 @@ $cfg->setConfigEntry('socket_registry_class', 'SocketRegistry');
 // CFG: SOCKET-CONTAINER-CLASS
 $cfg->setConfigEntry('socket_container_class', 'SocketContainer');
 
-// CFG: PACKAGE-RECIPIENT-DISCOVERY
+// CFG: PACKAGE-RECIPIENT-DISCOVERY-CLASS
 $cfg->setConfigEntry('package_recipient_discovery_class', 'PackageRecipientDiscovery');
 
-// CFG: SOCKET-DISCOVERY
+// CFG: SOCKET-DISCOVERY-CLASS
 $cfg->setConfigEntry('socket_discovery_class', 'PackageSocketDiscovery');
 
+// CFG: DHT-RECIPIENT-DISCOVERY-CLASS
+$cfg->setConfigEntry('dht_recipient_discovery_class', 'DhtRecipientDiscovery');
+
 // CFG: RECIPIENT-LIST-CLASS
 $cfg->setConfigEntry('recipient_list_class', 'RecipientList');
 
diff --git a/application/hub/interfaces/discovery/class_DiscoverableDhtRecipient.php b/application/hub/interfaces/discovery/class_DiscoverableDhtRecipient.php
new file mode 100644 (file)
index 0000000..f1c6864
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+/**
+ * An interface for socket discovery
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 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 FrameworkInterface {
+       /**
+        * 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/class_DiscoverableNodeRecipient.php b/application/hub/interfaces/discovery/class_DiscoverableNodeRecipient.php
new file mode 100644 (file)
index 0000000..9ec8206
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+/**
+ * An interface for recipient discovery
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 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 FrameworkInterface, 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/class_DiscoverableRecipient.php b/application/hub/interfaces/discovery/class_DiscoverableRecipient.php
deleted file mode 100644 (file)
index d7c2e43..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 - 2012 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 FrameworkInterface, 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/main/discovery/dht/.htaccess b/application/hub/main/discovery/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/dht/class_DhtRecipientDiscovery.php b/application/hub/main/discovery/dht/class_DhtRecipientDiscovery.php
new file mode 100644 (file)
index 0000000..732e8ee
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/**
+ * A DhtRecipient discovery class
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 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 BaseHubDiscovery 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 createDhtRecipientDiscovery () {
+               // Get an instance of this class
+               $discoveryInstance = new DhtRecipientDiscovery();
+
+               // Return the prepared instance
+               return $discoveryInstance;
+       }
+}
+
+// [EOF]
+?>
index bea97ed0687249290820f821ec4f3be39bd573b7..3530eaaa302244daf7fc6c5132f26d57fea02aa1 100644 (file)
@@ -21,7 +21,7 @@
  * 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 BaseHubDiscovery implements DiscoverableRecipient, Registerable {
+class PackageRecipientDiscovery extends BaseHubDiscovery implements DiscoverableNodeRecipient, Registerable {
        /**
         * Protected constructor
         *