]> git.mxchange.org Git - hub.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Mon, 29 May 2017 15:59:14 +0000 (17:59 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 21 Aug 2020 16:50:09 +0000 (18:50 +0200)
- imported HelpableNode
- imported SocketDiscoveryFactory, DiscoverableSocket
- imported ProtocolHandlerFactory
- imported BaseProtocolHandler and made it abstract
- imported BaseIpV4ProtocolHandler and it needs to be abstract
- need to implement setter/getter for protocolName
- added missing namespaces to configuration entries

Signed-off-by: Roland Häder <roland@mxchange.org>
24 files changed:
application/hub/classes/discovery/recipient/package/class_PackageRecipientDiscovery.php
application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php
application/hub/classes/factories/handler/class_ProtocolHandlerFactory.php
application/hub/classes/filter/tags/class_PackageSelfConnectTagFilter.php
application/hub/classes/handler/protocol/class_
application/hub/classes/handler/protocol/class_BaseProtocolHandler.php
application/hub/classes/handler/protocol/ipv4/class_BaseIpV4ProtocolHandler.php
application/hub/classes/handler/protocol/ipv4/tcp/class_TcpProtocolHandler.php
application/hub/classes/helper/connection/ipv4/tcp/class_TcpConnectionHelper.php
application/hub/classes/helper/node/announcement/class_NodeAnnouncementHelper.php
application/hub/classes/helper/node/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php
application/hub/classes/helper/node/answer/dht/class_NodeDhtBootstrapMessageAnswerHelper.php
application/hub/classes/helper/node/answer/requests/class_NodeRequestNodeListMessageAnswerHelper.php
application/hub/classes/helper/node/class_
application/hub/classes/helper/node/connection/class_NodeSelfConnectHelper.php
application/hub/classes/helper/node/requests/class_NodeRequestNodeListHelper.php
application/hub/classes/package/class_NetworkPackage.php
application/hub/classes/pools/peer/class_DefaultPeerPool.php
application/hub/classes/tags/class_BaseTag.php
application/hub/classes/tags/package/class_PackageTags.php
application/hub/classes/template/connect/class_XmlSelfConnectTemplateEngine.php
application/hub/config.php
application/hub/interfaces/helper/node/class_HelpableNode.php
application/hub/interfaces/tags/class_Tagable.php

index 918a1e4f05ae94504ea70cd070c77d1fdd0f3f5b..feb0bc4ee3e15eb4b81575860ad2c5ffc837058b 100644 (file)
@@ -5,6 +5,7 @@ namespace Hub\Discovery\Network\Recipient;
 // Import hub-specific sutff
 use Hub\Discovery\Recipient\BaseRecipientDiscovery;
 use Hub\Discovery\Recipient\Node\DiscoverableNodeRecipient;
+use Hub\Factory\Handler\Protocol\ProtocolHandlerFactory;
 use Hub\Network\Package\NetworkPackage;
 use Hub\Node\Data\InvalidSessionIdException;
 use Hub\Tools\HubTools;
index ed2fd132fb57a279d57851ab2e68140188762099..695a197fbe07d8836ef96befb43940ca7adc803f 100644 (file)
@@ -5,6 +5,8 @@ namespace Hub\Network\Discovery\Socket;
 // Import hub-specific stuff
 use Hub\Container\Socket\StorableSocket;
 use Hub\Discovery\Recipient\BaseRecipientDiscovery;
+use Hub\Discovery\Protocol\ProtocolDiscovery;
+use Hub\Discovery\Socket\DiscoverableSocket;
 use Hub\Factory\Node\NodeObjectFactory;
 use Hub\Factory\Socket\SocketFactory;
 use Hub\Generic\BaseHubSystem;
index 685d6acd7989dbb4bedce843a732db84fda7e478..392efe55ea382eeab7f0b99440c143a1b3ad7459 100644 (file)
@@ -3,6 +3,7 @@
 namespace Hub\Factory\Handler\Protocol;
 
 // Import application-specific stuff
+use Hub\Discovery\Protocol\ProtocolDiscovery;
 use Hub\Helper\HubHelper;
 
 // Import framework stuff
index 5c59c323cc726ff9e2a992e210acc5f5123e61f9..2d26960650312a96037245b8f2a20eb961a0f387 100644 (file)
@@ -110,7 +110,5 @@ class PackageSelfConnectTagFilter extends BaseNodeFilter implements FilterablePa
                // Please don't call this method
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
-}
 
-// [EOF]
-?>
+}
index beada8cf3eb7daa0682f62426377e065958206d0..e0af2a97aa9689dba68281e671afeddae26806c0 100644 (file)
@@ -3,6 +3,7 @@
 namespace Hub\Handler\Protocol\;
 
 // Import appplication-specific stuff
+use Hub\Handler\Protocol\BaseProtocolHandler;
 use Hub\Handler\Protocol\HandleableProtocol;
 
 // Import framework stuff
index 17a39d73dbb17ba2193750714f702a1ce5cd47c4..3e94c30dea62a650c6cf161e08d8966cd925866c 100644 (file)
@@ -32,12 +32,17 @@ use CoreFramework\Handler\BaseHandler;
  * 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 BaseProtocolHandler extends BaseHandler implements HandleableProtocol {
+abstract class BaseProtocolHandler extends BaseHandler implements HandleableProtocol {
        /**
         * Whole UNL instance
         */
        private $universalNodeLocatorInstance = NULL;
 
+       /**
+        * Name of used protocol
+        */
+       private $protocolName = 'invalid';
+
        /**
         * Protected constructor
         *
@@ -148,6 +153,25 @@ class BaseProtocolHandler extends BaseHandler implements HandleableProtocol {
                return $this->universalNodeLocatorData[$element];
        }
 
+       /**
+        * Getter for protocol name
+        *
+        * @return      $protocolName   Name of used protocol
+        */
+       public final function getProtocolName () {
+               return $this->protocolName;
+       }
+
+       /**
+        * Setter for protocol name
+        *
+        * @param       $protocolName   Name of used protocol
+        * @return      void
+        */
+       protected final function setProtocolName ($protocolName) {
+               $this->protocolName = $protocolName;
+       }
+
        /**
         * Getter for UNL instance
         *
index 70056e2633312654483bd1889c6198bdb9d92735..e00ebb10a487f4cf7ce9144035569f2eaf1d0b06 100644 (file)
@@ -3,6 +3,7 @@
 namespace Hub\Handler\Protocol\Network\IpV4;
 
 // Import application-specific stuff
+use Hub\Handler\Protocol\BaseProtocolHandler;
 use Hub\Locator\Node\LocateableNode;
 use Hub\Network\Package\NetworkPackage;
 
@@ -28,7 +29,7 @@ use Hub\Network\Package\NetworkPackage;
  * 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 BaseIpV4ProtocolHandler extends BaseProtocolHandler {
+abstract class BaseIpV4ProtocolHandler extends BaseProtocolHandler {
        /**
         * Port number
         */
index 332a995a93a7171179cb0a94c6beb4529a0522b9..a22706bee387c931342a0595b276c80c5ff7c3fe 100644 (file)
@@ -1,8 +1,9 @@
 <?php
 // Own namespace
-namespace Hub\Handler\Protocol\Tcp;
+namespace Hub\Handler\Protocol\Network\IpV4\Tcp;
 
 // Import application-specific stuff
+use Hub\Handler\Protocol\Network\IpV4\BaseIpV4ProtocolHandler;
 use Hub\Handler\Protocol\HandleableProtocol;
 
 // Import framework stuff
@@ -57,7 +58,5 @@ class TcpProtocolHandler extends BaseIpV4ProtocolHandler implements HandleablePr
                // Return the prepared instance
                return $handlerInstance;
        }
-}
 
-// [EOF]
-?>
+}
index da33a3f54983b27f64d7715a9b6034fc6bd0d7bf..f73a38a531701eeffa00ff248dce052c89e81d06 100644 (file)
@@ -4,6 +4,7 @@ namespace Hub\Helper\Connection\Tcp;
 
 // Import application-specific stuff
 use Hub\Container\Socket\StorableSocket;
+use Hub\Factory\Handler\Protocol\ProtocolHandlerFactory;
 use Hub\Factory\Socket\SocketFactory;
 use Hub\Helper\Connection\ConnectionHelper;
 use Hub\Locator\Node\LocateableNode;
index 003985fdbdba099b5911d4465c484de0d867d5a1..c5928ab3242a56145fe44d8f863bcab5a6201d1e 100644 (file)
@@ -7,6 +7,7 @@ use Hub\Factory\Network\NetworkPackageFactory;
 use Hub\Helper\Node\BaseNodeHelper;
 use Hub\Helper\Node\NodeHelper;
 use Hub\Network\Package\NetworkPackage;
+use Hub\Node\Helper\HelpableNode;
 
 // Import framework stuff
 use CoreFramework\Factory\Template\XmlTemplateEngineFactory;
index 0a879d50d85d3f32ceb786259ff5ac73ff62ae7e..b8308a5cb87c23cd52728d96c3d6e4cbc701739c 100644 (file)
@@ -5,6 +5,7 @@ namespace Hub\Node\Helper\Answer\Announcement;
 // Import application-specific stuff
 use Hub\Factory\Network\NetworkPackageFactory;
 use Hub\Helper\Node\NodeHelper;
+use Hub\Node\Helper\HelpableNode;
 
 // Import framework stuff
 use CoreFramework\Factory\Template\XmlTemplateEngineFactory;
index c39146760eb6f0b199b1ab134442a8670b2ad7eb..bd78c34a48e9ef9373d0990046a59b93500e42bb 100644 (file)
@@ -5,6 +5,7 @@ namespace Hub\Node\Helper\Answer\Dht\Bootstrap;
 // Import application-specific stuff
 use Hub\Factory\Network\NetworkPackageFactory;
 use Hub\Helper\Node\NodeHelper;
+use Hub\Node\Helper\HelpableNode;
 use Hub\Template\Engine\Xml\Dht\Bootstrap\XmlDhtBootstrapTemplateEngine;
 
 // Import framework stuff
index 16f662ec4303501e6148e9c8174c8d166882c24d..d7a2087415c82360b1567c43d41db87c083e3a92 100644 (file)
@@ -5,6 +5,7 @@ namespace Hub\Node\Helper\Answer\Request\NodeList;
 // Import application-specific stuff
 use Hub\Factory\Network\NetworkPackageFactory;
 use Hub\Helper\Node\NodeHelper;
+use Hub\Node\Helper\HelpableNode;
 
 // Import framework stuff
 use CoreFramework\Factory\Template\XmlTemplateEngineFactory;
index 87a2b3bbfab2148c89ed1d2f9595dfeb176679d9..908c32e610f41f45f61dab32b3d2d211b4862e2b 100644 (file)
@@ -7,6 +7,7 @@ use Hub\Factory\Network\NetworkPackageFactory;
 use Hub\Helper\Node\BaseNodeHelper;
 use Hub\Helper\Node\NodeHelper;
 use Hub\Network\Package\NetworkPackage;
+use Hub\Node\Helper\HelpableNode;
 
 /**
  * A ??? hub helper class
index 59bba147339e2a5e9c6ac101a9a6fa228fd947df..00dc7f0e6469154694fa2468bed22f6974193fb3 100644 (file)
@@ -7,6 +7,7 @@ use Hub\Factory\Network\NetworkPackageFactory;
 use Hub\Helper\Node\BaseNodeHelper;
 use Hub\Helper\Node\NodeHelper;
 use Hub\Network\Package\NetworkPackage;
+use Hub\Node\Helper\HelpableNode;
 use Hub\Tag\Tagable;
 
 // Import framework stuff
index f1ae9860da09775a19a1865c0f25193d65253d47..d3b0932b4f057b9daceff5361d817ee31c606aa2 100644 (file)
@@ -7,6 +7,7 @@ use Hub\Factory\Network\NetworkPackageFactory;
 use Hub\Helper\Node\BaseNodeHelper;
 use Hub\Helper\Node\NodeHelper;
 use Hub\Network\Package\NetworkPackage;
+use Hub\Node\Helper\HelpableNode;
 
 // Import framework stuff
 use CoreFramework\Factory\Template\XmlTemplateEngineFactory;
index 8c33927cb37faa7b40ef873bdaddc4d1d114cd04..115cfad7ae737a13f9a8ec40ceb1996159e31690 100644 (file)
@@ -8,6 +8,7 @@ use Hub\Database\Frontend\Node\Dht\NodeDistributedHashTableDatabaseWrapper;
 use Hub\Factory\Assembler\Package\PackageAssemblerFactory;
 use Hub\Factory\Dht\DhtObjectFactory;
 use Hub\Factory\Discovery\Package\PackageDiscoveryFactory;
+use Hub\Factory\Discovery\Socket\SocketDiscoveryFactory;
 use Hub\Factory\Information\Connection\ConnectionInfoFactory;
 use Hub\Factory\Node\NodeObjectFactory;
 use Hub\Generic\BaseHubSystem;
index 61c3309f1a2551e92a4c6ceca7eb58170d79b00f..8bcb688807e690dd2aed03debe9866128f6e0a2c 100644 (file)
@@ -5,6 +5,7 @@ namespace Hub\Pool\Peer;
 // Import application-specific stuff
 use Hub\Container\Socket\StorableSocket;
 use Hub\Connection\InvalidConnectionTypeException;
+use Hub\Factory\Handler\Protocol\ProtocolHandlerFactory;
 use Hub\Listener\Listenable;
 use Hub\Locator\Node\LocateableNode;
 use Hub\Network\Package\NetworkPackage;
index cdc33767eb6280e7f1a8bbca04089d2b78fb14bd..6de66a6803ebd31012396eff87bc85d02786660e 100644 (file)
@@ -31,12 +31,6 @@ use CoreFramework\Registry\Registerable;
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 class BaseTag extends BaseHubSystem implements Registerable {
-       /**
-        * Constants for tags
-        */
-       const TAG_SELF_CONNECT        = 'self_connect';
-       const TAG_CLAIM_MINING_REWARD = 'claim_reward';
-
        /**
         * An array with all tags
         */
index f85fc72495aa58842b54ebcf22ffff1ba8f7c84e..b2d24d840497969119353863ecbc2204618956df 100644 (file)
@@ -3,6 +3,7 @@
 namespace Hub\Tag\Package;
 
 // Import application-specific stuff
+use Hub\Factory\Handler\Protocol\ProtocolHandlerFactory;
 use Hub\Factory\Registry\Object\ObjectTypeRegistryFactory;
 use Hub\Listener\Listenable;
 use Hub\Network\Package\NetworkPackage;
index 711e6e3ec48e6e36bf3be9ac3b4c707cff5d6a6f..2854022fbb7245c79d0ed9c17eaf22b965321d7b 100644 (file)
@@ -192,7 +192,5 @@ class XmlSelfConnectTemplateEngine extends BaseXmlTemplateEngine implements Comp
                // Pop the last entry
                $this->getStackInstance()->popNamed('node_self_connect');
        }
-}
 
-// [EOF]
-?>
+}
index 89f6d8e528ee1fdab130fb178a1f27868cc08cc0..1d015adc9897018d41a8c49e3d93f450ecf61d24 100644 (file)
@@ -346,7 +346,7 @@ $cfg->setConfigEntry('node_dht_bootstrap_answer_template_type', 'xml/answer/dht_
 $cfg->setConfigEntry('node_request_node_list_answer_template_type', 'xml/answer/requests');
 
 // CFG: NODE-SELF-CONNECT-TEMPLATE-CLASS
-$cfg->setConfigEntry('node_self_connect_template_class', 'XmlSelfConnectTemplateEngine');
+$cfg->setConfigEntry('node_self_connect_template_class', 'Hub\Template\Engine\Xml\SelfConnect\XmlSelfConnectTemplateEngine');
 
 // CFG: NODE-SELF-CONNECT-TEMPLATE-TYPE
 $cfg->setConfigEntry('node_self_connect_template_type', 'xml/self_connect');
@@ -724,7 +724,7 @@ $cfg->setConfigEntry('ipc_socket_file_name', 'php_hub_ipc_socket');
 $cfg->setConfigEntry('package_recipient_discovery_class', 'Hub\Discovery\Network\Recipient\PackageRecipientDiscovery');
 
 // CFG: SOCKET-DISCOVERY-CLASS
-$cfg->setConfigEntry('socket_discovery_class', 'PackageSocketDiscovery');
+$cfg->setConfigEntry('socket_discovery_class', 'Hub\Network\Discovery\Socket\PackageSocketDiscovery');
 
 // CFG: DHT-RECIPIENT-DISCOVERY-CLASS
 $cfg->setConfigEntry('dht_recipient_discovery_class', 'Hub\Discovery\Recipient\Dht\DhtRecipientDiscovery');
@@ -733,7 +733,7 @@ $cfg->setConfigEntry('dht_recipient_discovery_class', 'Hub\Discovery\Recipient\D
 $cfg->setConfigEntry('unl_discovery_class', 'Hub\Discovery\Locator\UniversalNodeLocatorDiscovery');
 
 // CFG: TCP-PROTOCOL-HANDLER-CLASS
-$cfg->setConfigEntry('tcp_protocol_handler_class', 'TcpProtocolHandler');
+$cfg->setConfigEntry('tcp_protocol_handler_class', 'Hub\Handler\Protocol\Network\IpV4\Tcp\TcpProtocolHandler');
 
 // CFG: UNIVERSAL-NODE-LOCATOR-CLASS
 $cfg->setConfigEntry('universal_node_locator_class', 'Hub\Locator\Node\UniversalNodeLocator');
index 5ff2a0a496a45265a43a7dcc84ad84840c395942..9991399d69a1438c2e344f9b1a5b451d25374f1e 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 // Own namespace
-namespace Hub\Helper\Node;
+namespace Hub\Node\Helper;
 
 // Import application-specific stuff
 use Hub\Helper\HubHelper;
index f8e35b61b156e3e01294a6b592c5d3fc7edc5063..aea274c5c75bb7371c9bb10ea2715044bc9b901e 100644 (file)
@@ -31,6 +31,10 @@ use Hub\Listener\Listenable;
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 interface Tagable extends HubInterface {
+       // Constants for tags
+       const TAG_SELF_CONNECT        = 'self_connect';
+       const TAG_CLAIM_MINING_REWARD = 'claim_reward';
+
        /**
         * Chooses the right protocol from given package data
         *