From b6a3a0c01eed0ccf1edba7f8f5441caf97e7ae64 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 27 Aug 2012 22:20:45 +0000 Subject: [PATCH] Added (unfinished) DHT class --- .gitattributes | 6 +++ application/hub/interfaces/dht/.htaccess | 1 + application/hub/interfaces/dht/class_Dht.php | 28 +++++++++++ application/hub/main/dht/.htaccess | 1 + application/hub/main/dht/class_ | 50 +++++++++++++++++++ application/hub/main/dht/class_BaseDht.php | 38 ++++++++++++++ application/hub/main/dht/node/.htaccess | 1 + .../hub/main/dht/node/class_NodeDhtFacade.php | 50 +++++++++++++++++++ .../fragmenter/class_PackageFragmenter.php | 2 +- 9 files changed, 176 insertions(+), 1 deletion(-) create mode 100644 application/hub/interfaces/dht/.htaccess create mode 100644 application/hub/interfaces/dht/class_Dht.php create mode 100644 application/hub/main/dht/.htaccess create mode 100644 application/hub/main/dht/class_ create mode 100644 application/hub/main/dht/class_BaseDht.php create mode 100644 application/hub/main/dht/node/.htaccess create mode 100644 application/hub/main/dht/node/class_NodeDhtFacade.php diff --git a/.gitattributes b/.gitattributes index 5779dcfc6..ef31572ab 100644 --- a/.gitattributes +++ b/.gitattributes @@ -55,6 +55,8 @@ application/hub/interfaces/cruncher/.htaccess svneol=native#text/plain application/hub/interfaces/cruncher/class_CruncherHelper.php svneol=native#text/plain application/hub/interfaces/decoder/.htaccess -text svneol=unset#text/plain application/hub/interfaces/decoder/class_Decodeable.php svneol=native#text/plain +application/hub/interfaces/dht/.htaccess -text svneol=unset#text/plain +application/hub/interfaces/dht/class_Dht.php svneol=native#text/plain application/hub/interfaces/discovery/.htaccess -text svneol=unset#text/plain application/hub/interfaces/discovery/class_DiscoverableRecipient.php svneol=native#text/plain application/hub/interfaces/discovery/class_DiscoverableSocket.php svneol=native#text/plain @@ -220,6 +222,10 @@ application/hub/main/decoder/class_ svneol=native#text/plain application/hub/main/decoder/package/.htaccess -text svneol=unset#text/plain application/hub/main/decoder/package/class_PackageDecoder.php svneol=native#text/plain application/hub/main/decorators/.htaccess -text svneol=unset#text/plain +application/hub/main/dht/.htaccess -text svneol=unset#text/plain +application/hub/main/dht/class_ svneol=native#text/plain +application/hub/main/dht/node/.htaccess -text svneol=unset#text/plain +application/hub/main/dht/node/class_NodeDhtFacade.php svneol=native#text/plain application/hub/main/discovery/.htaccess -text svneol=unset#text/plain application/hub/main/discovery/class_BaseHubDiscovery.php svneol=native#text/plain application/hub/main/discovery/package/.htaccess -text svneol=unset#text/plain diff --git a/application/hub/interfaces/dht/.htaccess b/application/hub/interfaces/dht/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/interfaces/dht/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/interfaces/dht/class_Dht.php b/application/hub/interfaces/dht/class_Dht.php new file mode 100644 index 000000000..758d39177 --- /dev/null +++ b/application/hub/interfaces/dht/class_Dht.php @@ -0,0 +1,28 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.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 Dht extends FrameworkInterface { +} + +// [EOF] +?> diff --git a/application/hub/main/dht/.htaccess b/application/hub/main/dht/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/dht/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/dht/class_ b/application/hub/main/dht/class_ new file mode 100644 index 000000000..0543b18cc --- /dev/null +++ b/application/hub/main/dht/class_ @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.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 ???DhtFacade extends BaseDht implements Dht { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $dhtInstance An instance of a Dht class + */ + public final static function create??? () { + // Get new instance + $dhtInstance = new ???DhtFacade(); + + // Return the prepared instance + return $dhtInstance; + } +} + +// [EOF] +?> diff --git a/application/hub/main/dht/class_BaseDht.php b/application/hub/main/dht/class_BaseDht.php new file mode 100644 index 000000000..f9dfa5fdf --- /dev/null +++ b/application/hub/main/dht/class_BaseDht.php @@ -0,0 +1,38 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.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 BaseDht extends BaseHubSystem { + /** + * Protected constructor + * + * @param $className Name of the class + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } +} + +// [EOF] +?> diff --git a/application/hub/main/dht/node/.htaccess b/application/hub/main/dht/node/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/dht/node/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/dht/node/class_NodeDhtFacade.php b/application/hub/main/dht/node/class_NodeDhtFacade.php new file mode 100644 index 000000000..a2666f69b --- /dev/null +++ b/application/hub/main/dht/node/class_NodeDhtFacade.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.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 NodeDhtFacade extends BaseDht implements Dht { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $dhtInstance An instance of a Dht class + */ + public final static function createNode () { + // Get new instance + $dhtInstance = new NodeDhtFacade(); + + // Return the prepared instance + return $dhtInstance; + } +} + +// [EOF] +?> diff --git a/application/hub/main/package/fragmenter/class_PackageFragmenter.php b/application/hub/main/package/fragmenter/class_PackageFragmenter.php index cbc5cc0ba..2debe34fa 100644 --- a/application/hub/main/package/fragmenter/class_PackageFragmenter.php +++ b/application/hub/main/package/fragmenter/class_PackageFragmenter.php @@ -118,7 +118,7 @@ class PackageFragmenter extends BaseHubSystem implements Fragmentable, Registera // Get new instance $fragmenterInstance = new PackageFragmenter(); - // And also a crypto instance (for our encrypted messages) + // Get a crypto instance and set it here $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class'); $fragmenterInstance->setCryptoInstance($cryptoInstance); -- 2.39.5