]> git.mxchange.org Git - hub.git/commitdiff
Next wave:
authorRoland Häder <roland@mxchange.org>
Fri, 19 May 2017 18:58:20 +0000 (20:58 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 21 Aug 2020 16:50:03 +0000 (18:50 +0200)
- imported BaseRawDataHandler
- imported HandleableDataSet, Handleable
- re-added ifStartEndMarkersSet() from core, was not generic
- sorted members
- added namespaces
- renamed variables

Signed-off-by: Roland Häder <roland@mxchange.org>
32 files changed:
application/hub/classes/class_BaseHubSystem.php
application/hub/classes/database/frontend/node/class_NodeDistributedHashTableDatabaseWrapper.php
application/hub/classes/dht/node/class_NodeDhtFacade.php
application/hub/classes/handler/network/socket/class_SocketRawDataHandler.php
application/hub/classes/handler/network/tcp/class_TcpRawDataHandler.php
application/hub/classes/handler/network/udp/class_UdpRawDataHandler.php
application/hub/classes/handler/raw_data/network/class_
application/hub/classes/handler/raw_data/network/class_BaseRawDataHandler.php
application/hub/classes/listener/class_BaseListener.php
application/hub/classes/nodes/class_BaseHubNode.php
application/hub/classes/package/assembler/class_PackageAssembler.php
application/hub/classes/package/class_NetworkPackage.php
application/hub/classes/states/peer/class_
application/hub/classes/states/peer/errors/class_ConnectionRefusedPeerState.php
application/hub/classes/states/peer/errors/class_ConnectionTimedOutPeerState.php
application/hub/classes/states/peer/errors/class_NoRouteToHostPeerState.php
application/hub/classes/states/peer/errors/class_OperationAlreadyProgressPeerState.php
application/hub/classes/states/peer/errors/class_ProblemPeerState.php
application/hub/classes/states/peer/errors/class_TransportEndpointGonePeerState.php
application/hub/classes/streams/raw_data/input/class_RawDataInputStream.php
application/hub/classes/streams/raw_data/output/class_RawDataOutputStream.php
application/hub/config.php
application/hub/exceptions/package/class_UnsupportedPackageCodeHandlerException.php
application/hub/interfaces/database/frontend/class_NodeDhtWrapper.php
application/hub/interfaces/distributable/node/class_DistributableNode.php
application/hub/interfaces/handler/answer-status/class_HandleableAnswerStatus.php
application/hub/interfaces/handler/chunks/class_HandleableChunks.php
application/hub/interfaces/handler/message-types/class_HandleableMessage.php
application/hub/interfaces/handler/network/class_Networkable.php
application/hub/interfaces/handler/protocol/.htaccess [new file with mode: 0644]
application/hub/interfaces/handler/protocol/class_HandleableProtocol.php [new file with mode: 0644]
core

index 7154dba7a99ca430c53ff85861339c29100e7808..4450c1dbbe339ea21a79f4ff7b766da6caa842ed 100644 (file)
@@ -3,6 +3,7 @@
 namespace Hub\Generic;
 
 // Import application-specific stuff
+use Hub\Handler\RawData\BaseRawDataHandler;
 use Hub\Information\ShareableInfo;
 use Hub\Listener\BaseListener;
 use Hub\Network\Deliver\Deliverable;
@@ -109,6 +110,66 @@ class BaseHubSystem extends BaseFrameworkSystem {
                parent::__construct($className);
        }
 
+       /**
+        * Checks whether start/end marker are set
+        *
+        * @param       $data   Data to be checked
+        * @return      $isset  Whether start/end marker are set
+        */
+       public final function ifStartEndMarkersSet ($data) {
+               // Determine it
+               $isset = ((substr($data, 0, strlen(BaseRawDataHandler::STREAM_START_MARKER)) == BaseRawDataHandler::STREAM_START_MARKER) && (substr($data, -1 * strlen(BaseRawDataHandler::STREAM_END_MARKER), strlen(BaseRawDataHandler::STREAM_END_MARKER)) == BaseRawDataHandler::STREAM_END_MARKER));
+
+               // ... and return it
+               return $isset;
+       }
+
+       /**
+        * Handles socket error for given socket resource and peer data. This method
+        * validates $socketResource if it is a valid resource (see is_resource())
+        * but assumes valid data in array $recipientData, except that
+        * count($recipientData) is always 2.
+        *
+        * @param       $method                         Value of __METHOD__ from calling method
+        * @param       $line                           Value of __LINE__ from calling method
+        * @param       $socketResource         A valid socket resource
+        * @param       $socketData                     A valid socket data array (0 = IP/file name, 1 = port)
+        * @return      void
+        * @throws      InvalidSocketException  If $socketResource is no socket resource
+        * @throws      NoSocketErrorDetectedException  If socket_last_error() gives zero back
+        * @todo        Move all this socket-related stuff into own class, most of it resides in BaseListener
+        */
+       protected final function handleSocketError ($method, $line, $socketResource, array $socketData) {
+               // This method handles only socket resources
+               if (!is_resource($socketResource)) {
+                       // No resource, abort here
+                       throw new InvalidSocketException(array($this, $socketResource), BaseListener::EXCEPTION_INVALID_SOCKET);
+               } // END - if
+
+               // Check socket array, 1st element is mostly IP address (or file name), 2nd is port number
+               //* DEBUG-DIE: */ die(__METHOD__ . ':socketData=' . print_r($socketData, true));
+               assert(isset($socketData[0]));
+               assert(isset($socketData[1]));
+
+               // Get error code for first validation (0 is not an error)
+               $errorCode = socket_last_error($socketResource);
+
+               // If the error code is zero, someone called this method without an error
+               if ($errorCode == 0) {
+                       // No error detected (or previously cleared outside this method)
+                       throw new NoSocketErrorDetectedException(array($this, $socketResource), BaseListener::EXCEPTION_NO_SOCKET_ERROR);
+               } // END - if
+
+               // Get handler (method) name
+               $handlerName = $this->getSocketErrorHandlerFromCode($errorCode);
+
+               // Call-back the error handler method
+               call_user_func_array(array($this, $handlerName), array($socketResource, $socketData));
+
+               // Finally clear the error because it has been handled
+               socket_clear_error($socketResource);
+       }
+
        /**
         * Setter for network package handler instance
         *
@@ -324,50 +385,4 @@ class BaseHubSystem extends BaseFrameworkSystem {
                return $this->listenerInstance;
        }
 
-       /**
-        * Handles socket error for given socket resource and peer data. This method
-        * validates $socketResource if it is a valid resource (see is_resource())
-        * but assumes valid data in array $recipientData, except that
-        * count($recipientData) is always 2.
-        *
-        * @param       $method                         Value of __METHOD__ from calling method
-        * @param       $line                           Value of __LINE__ from calling method
-        * @param       $socketResource         A valid socket resource
-        * @param       $socketData                     A valid socket data array (0 = IP/file name, 1 = port)
-        * @return      void
-        * @throws      InvalidSocketException  If $socketResource is no socket resource
-        * @throws      NoSocketErrorDetectedException  If socket_last_error() gives zero back
-        * @todo        Move all this socket-related stuff into own class, most of it resides in BaseListener
-        */
-       protected final function handleSocketError ($method, $line, $socketResource, array $socketData) {
-               // This method handles only socket resources
-               if (!is_resource($socketResource)) {
-                       // No resource, abort here
-                       throw new InvalidSocketException(array($this, $socketResource), BaseListener::EXCEPTION_INVALID_SOCKET);
-               } // END - if
-
-               // Check socket array, 1st element is mostly IP address (or file name), 2nd is port number
-               //* DEBUG-DIE: */ die(__METHOD__ . ':socketData=' . print_r($socketData, true));
-               assert(isset($socketData[0]));
-               assert(isset($socketData[1]));
-
-               // Get error code for first validation (0 is not an error)
-               $errorCode = socket_last_error($socketResource);
-
-               // If the error code is zero, someone called this method without an error
-               if ($errorCode == 0) {
-                       // No error detected (or previously cleared outside this method)
-                       throw new NoSocketErrorDetectedException(array($this, $socketResource), BaseListener::EXCEPTION_NO_SOCKET_ERROR);
-               } // END - if
-
-               // Get handler (method) name
-               $handlerName = $this->getSocketErrorHandlerFromCode($errorCode);
-
-               // Call-back the error handler method
-               call_user_func_array(array($this, $handlerName), array($socketResource, $socketData));
-
-               // Finally clear the error because it has been handled
-               socket_clear_error($socketResource);
-       }
-
 }
index ca13acd879d80e58a01d0271f3625e551047a804..772fe05d3e3d6ffcb5b855b80ac59ddb0fa0b1bd 100644 (file)
@@ -14,6 +14,7 @@ use CoreFramework\Criteria\Local\LocalSearchCriteria;
 use CoreFramework\Criteria\Storing\StoreableCriteria;
 use CoreFramework\Database\Frontend\BaseDatabaseWrapper;
 use CoreFramework\Factory\ObjectFactory;
+use CoreFramework\Handler\DataSet\HandleableDataSet;
 use CoreFramework\Registry\Registerable;
 
 /**
index bdfaa4a221fd9ed46d40ec61cf0e6919d6a34c5f..91b0afed4266589a3d86e6034a36c061040ad15f 100644 (file)
@@ -8,6 +8,7 @@ use Hub\Generic\BaseHubSystem;
 // Import framework stuff
 use CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
 use CoreFramework\Factory\ObjectFactory;
+use CoreFramework\Handler\DataSet\HandleableDataSet;
 use CoreFramework\Registry\Registerable;
 
 /**
@@ -391,7 +392,5 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
                // Return filled array
                return $recipients;
        }
-}
 
-// [EOF]
-?>
+}
index 6da72152b20cb8c6012a071dd964800682278fa7..8ff54d60b8d19537718a8a6dd16e9bb1aeff2c23 100644 (file)
@@ -3,6 +3,7 @@
 namespace Hub\Handler\Network\Socket\RawData;
 
 // Import application-specific stuff
+use Hub\Handler\RawData\BaseRawDataHandler;
 use Hub\Network\Networkable;
 
 /**
index 453123d717a9c000de45f8964e7bb24bb4f3ca16..a516d9c9308e60f5498a3f2105dcb7ac6abceb8c 100644 (file)
@@ -3,6 +3,7 @@
 namespace Hub\Handler\Network\RawData\Tcp;
 
 // Import application-specific stuff
+use Hub\Handler\RawData\BaseRawDataHandler;
 use Hub\Network\Networkable;
 use Hub\Pool\BasePool;
 
index 42895f1df4d6eaeb4f33d495f641e70ae1ab42ea..d2b0d836cc3d99ff18cc78f30aff6e8dd1e69fd3 100644 (file)
@@ -3,6 +3,7 @@
 namespace Hub\Handler\RawData\Udp;
 
 // Import application-specific stuff
+use Hub\Handler\RawData\BaseRawDataHandler;
 use Hub\Network\Networkable;
 use Hub\Pool\BasePool;
 
index ca0fa5a2d3cf7ad5b9f599980798be26bb65a413..9a45b80ff0f4120967842a5cc783ce412a94dcd5 100644 (file)
@@ -3,6 +3,7 @@
 namespace Hub\Handler\RawData;
 
 // Import application-specific stuff
+use Hub\Handler\RawData\BaseRawDataHandler;
 use Hub\Network\Networkable;
 
 /**
index 8c4ce84922bfc4ee21723f927c09edd555152fed..2cdccd86557ac7bc0719894780c8aa0cfe9ba45b 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 // Own namespace
-namespace Hub\Handler\Raw;
+namespace Hub\Handler\RawData;
 
 // Import application-specific stuff
 use Hub\Network\Package\NetworkPackage;
index 61d634a20d4a1321cd016a8e0294d0d25ffe0c38..a36d55c91c9d60cbfe522f69045878814356b103 100644 (file)
@@ -3,6 +3,7 @@
 namespace Hub\Listener;
 
 // Import application-specific stuff
+use Hub\Handler\RawData\BaseRawDataHandler;
 use Hub\Helper\Connection\BaseConnectionHelper;
 use Hub\Network\Package\NetworkPackage;
 use Hub\Pool\Peer\PoolablePeer;
@@ -595,13 +596,13 @@ class BaseListener extends BaseFrameworkSystem implements Visitable {
                } // END - if
 
                // Get the current value
-               $currentSocket = $this->getIteratorInstance()->current();
+               $currentSocketData = $this->getIteratorInstance()->current();
 
                // Handle it here, if not main server socket
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: currentSocket=' . $currentSocket[BasePool::SOCKET_ARRAY_RESOURCE] . ',type=' . $currentSocket[BasePool::SOCKET_ARRAY_CONN_TYPE] . ',serverSocket=' . $this->getSocketResource());
-               if (($currentSocket[BasePool::SOCKET_ARRAY_CONN_TYPE] != BaseConnectionHelper::CONNECTION_TYPE_SERVER) && ($currentSocket[BasePool::SOCKET_ARRAY_RESOURCE] != $this->getSocketResource())) {
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TCP-LISTENER[' . __METHOD__ . ':' . __LINE__ . ']: currentSocketData=' . $currentSocketData[BasePool::SOCKET_ARRAY_RESOURCE] . ',type=' . $currentSocketData[BasePool::SOCKET_ARRAY_CONN_TYPE] . ',serverSocket=' . $this->getSocketResource());
+               if (($currentSocketData[BasePool::SOCKET_ARRAY_CONN_TYPE] != BaseConnectionHelper::CONNECTION_TYPE_SERVER) && ($currentSocketData[BasePool::SOCKET_ARRAY_RESOURCE] != $this->getSocketResource())) {
                        // ... or else it will raise warnings like 'Transport endpoint is not connected'
-                       $this->getHandlerInstance()->processRawDataFromResource($currentSocket);
+                       $this->getHandlerInstance()->processRawDataFromResource($currentSocketData);
                } // END - if
 
                // Advance to next entry. This should be the last line.
index dd19fc13b29129dbc044c9faf40c1045a8de98d2..3e2f7bb7c195376fd26494bf8295d5dfb72359dc 100644 (file)
@@ -866,4 +866,5 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria {
                        }
                } // END - foreac
        }
+
 }
index f82e66d362a18c382aff83085ebb6f5e9379f876..ed2e2b300218290e41ff22412dbb8a3c10a52146 100644 (file)
@@ -4,6 +4,7 @@ namespace Hub\Network\Package\Assembler;
 
 // Import hub-specific stuff
 use Hub\Generic\BaseHubSystem;
+use Hub\Handler\RawData\BaseRawDataHandler;
 use Hub\Network\Package\NetworkPackage;
 use Hub\Network\Receive\Receivable;
 
index 84986274502a66a26a0de0f8f0ae367b6bc63ea6..415c77533cfea3c9cd90765554cb49213d8774b1 100644 (file)
@@ -7,6 +7,7 @@ use Hub\Factory\Assembler\Package\PackageAssemblerFactory;
 use Hub\Factory\Dht\DhtObjectFactory;
 use Hub\Factory\Node\NodeObjectFactory;
 use Hub\Generic\BaseHubSystem;
+use Hub\Handler\RawData\BaseRawDataHandler;
 use Hub\Helper\Connection\BaseConnectionHelper;
 use Hub\Helper\Connection\ConnectionHelper;
 use Hub\Helper\HubHelper;
index 52b4de7de40fc88d6344e23dea62efc3f66ee5d8..1dbda959e408cad232233b5be126f3da9ebe16f9 100644 (file)
@@ -2,6 +2,9 @@
 // Own namespace
 namespace Hub\State\Peer;
 
+// Import application-specific stuff
+use Hub\Handler\RawData\BaseRawDataHandler;
+
 // Import framework stuff
 use CoreFramework\State\Stateable;
 
index 012916ada08f89048508a80101e2e890c435ab70..7f24ae5588f49eb45bbe45cdb510698a362d6f84 100644 (file)
@@ -2,6 +2,9 @@
 // Own namespace
 namespace Hub\State\Peer;
 
+// Import application-specific stuff
+use Hub\Handler\RawData\BaseRawDataHandler;
+
 // Import framework stuff
 use CoreFramework\State\Stateable;
 
index 41354bc7a714961cf2a9d49d80d2b2d47d0d4c89..c295b2b33c5f7db41df2d1f3d036558db2b3ec32 100644 (file)
@@ -2,6 +2,9 @@
 // Own namespace
 namespace Hub\State\Peer;
 
+// Import application-specific stuff
+use Hub\Handler\RawData\BaseRawDataHandler;
+
 // Import framework stuff
 use CoreFramework\State\Stateable;
 
index 9728a24df26debb910ce76204ac0618ffbc15851..29785850feaf0f71618283a92031823836febe21 100644 (file)
@@ -2,6 +2,9 @@
 // Own namespace
 namespace Hub\State\Peer;
 
+// Import application-specific stuff
+use Hub\Handler\RawData\BaseRawDataHandler;
+
 // Import framework stuff
 use CoreFramework\State\Stateable;
 
index ba3f7e86fd29e3ee5ad8290cc108a3aa8b0c5fb6..c7d7df8b8998eb626fa43536a90c57f5e3958f6c 100644 (file)
@@ -2,6 +2,9 @@
 // Own namespace
 namespace Hub\State\Peer;
 
+// Import application-specific stuff
+use Hub\Handler\RawData\BaseRawDataHandler;
+
 // Import framework stuff
 use CoreFramework\State\Stateable;
 
index d4c0c9bb8eb9d52f8b29e84a80ccca3e33fca81f..256cd86e2a7efae18ea12f92f4b1f9f45f59b38c 100644 (file)
@@ -2,6 +2,9 @@
 // Own namespace
 namespace Hub\State\Peer;
 
+// Import application-specific stuff
+use Hub\Handler\RawData\BaseRawDataHandler;
+
 // Import framework stuff
 use CoreFramework\State\Stateable;
 
index d9f0b12184233745f409d0b92704e2db384e688d..7308b68bafcded88e188d8dc237ee530be0f34ad 100644 (file)
@@ -2,6 +2,9 @@
 // Own namespace
 namespace Hub\State\Peer;
 
+// Import application-specific stuff
+use Hub\Handler\RawData\BaseRawDataHandler;
+
 // Import framework stuff
 use CoreFramework\State\Stateable;
 
index 04995b08b8c0a8c5622a00c0d4289b405728597e..31f2d84bfd50faba8e096e8ed9d8fe37cf4ae651 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 // Own namespace
-namespace Hub\Stream\Input\Raw;
+namespace Hub\Stream\Input\RawData;
 
 // Import hub-specific stuff
 use Hub\Generic\BaseHubSystem;
index e381b34d70686317c128c3d2b0584efa1cf8d863..72bc790c15c21f27fe20c76a204bd9be7482a897 100644 (file)
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Stream\Output\RawData;
+
+// Import application-specific stuff
+use Hub\Handler\RawData\BaseRawDataHandler;
+
 /**
  * A RawDataOutputStream class
  *
index cdee06da2539f9e6b3d1adc4b054d39ba4d2be93..4a857330f792aded49885e093e57e9f10d6cb135 100644 (file)
@@ -112,7 +112,7 @@ $cfg->setConfigEntry('handler_pool_iterator_class', 'HandlerPoolIterator');
 $cfg->setConfigEntry('network_listen_iterator_class', 'NetworkListenIterator');
 
 // CFG: SOCKET-LISTEN-ITERATOR-CLASS
-$cfg->setConfigEntry('socket_listen_iterator_class', 'DefaultIterator');
+$cfg->setConfigEntry('socket_listen_iterator_class', 'CoreFramework\Iterator\DefaultIterator');
 
 // CFG: TCP-RAW-DATA-HANDLER-CLASS
 $cfg->setConfigEntry('tcp_raw_data_handler_class', 'TcpRawDataHandler');
@@ -121,7 +121,7 @@ $cfg->setConfigEntry('tcp_raw_data_handler_class', 'TcpRawDataHandler');
 $cfg->setConfigEntry('udp_raw_data_handler_class', 'UdpRawDataHandler');
 
 // CFG: SOCKET-RAW-DATA-HANDLER-CLASS
-$cfg->setConfigEntry('socket_raw_data_handler_class', 'SocketRawDataHandler');
+$cfg->setConfigEntry('socket_raw_data_handler_class', 'Hub\Handler\Network\Socket\RawData\SocketRawDataHandler');
 
 // CFG: SHUTDOWN-LISTENER-POOL-VISITOR-CLASS
 $cfg->setConfigEntry('shutdown_listener_pool_visitor_class', 'ShutdownListenerPoolVisitor');
@@ -328,7 +328,7 @@ $cfg->setConfigEntry('dht_stacker_class', 'FiLoStacker');
 $cfg->setConfigEntry('raw_data_stacker_class', 'FiLoStacker');
 
 // CFG: MULTIPLE-MESSAGE-STACKER-CLASS
-$cfg->setConfigEntry('multiple_message_stacker_class', 'FiFoStacker');
+$cfg->setConfigEntry('multiple_message_stacker_class', 'CoreFramework\Stacker\FiFoStacker');
 
 // CFG: NODE-ANNOUNCEMENT-ANSWER-TEMPLATE-TYPE
 $cfg->setConfigEntry('node_announcement_answer_template_type', 'xml/answer/announcement');
@@ -379,25 +379,25 @@ $cfg->setConfigEntry('node_dht_publish_template_type', 'xml/dht_publish');
 $cfg->setConfigEntry('raw_template_extension', '.xml');
 
 // CFG: PACKAGE-STACKER-CLASS
-$cfg->setConfigEntry('network_package_stacker_class', 'FiFoStacker');
+$cfg->setConfigEntry('network_package_stacker_class', 'CoreFramework\Stacker\FiFoStacker');
 
 // CFG: NODE-RAW-DATA-STACKER-CLASS
-$cfg->setConfigEntry('node_raw_data_stacker_class', 'FiFoStacker');
+$cfg->setConfigEntry('node_raw_data_stacker_class', 'CoreFramework\Stacker\FiFoStacker');
 
 // CFG: CHUNK-HANDLER-STACKER-CLASS
-$cfg->setConfigEntry('chunk_handler_stacker_class', 'FiFoStacker');
+$cfg->setConfigEntry('chunk_handler_stacker_class', 'CoreFramework\Stacker\FiFoStacker');
 
 // CFG: DHT-BOOTSTRAP-STACKER-CLASS
-$cfg->setConfigEntry('dht_bootstrap_stacker_class', 'FiFoStacker');
+$cfg->setConfigEntry('dht_bootstrap_stacker_class', 'CoreFramework\Stacker\FiFoStacker');
 
 // CFG: DHT-PUBLISH-STACKER-CLASS
-$cfg->setConfigEntry('dht_publish_stacker_class', 'FiFoStacker');
+$cfg->setConfigEntry('dht_publish_stacker_class', 'CoreFramework\Stacker\FiFoStacker');
 
 // CFG: PRODUCER-OUTGOING-QUEUE
-$cfg->setConfigEntry('producer_outgoing_queue', 'FiFoStacker');
+$cfg->setConfigEntry('producer_outgoing_queue', 'CoreFramework\Stacker\FiFoStacker');
 
 // CFG: PRODUCER-INCOMING-QUEUE
-$cfg->setConfigEntry('producer_incoming_queue', 'FiFoStacker');
+$cfg->setConfigEntry('producer_incoming_queue', 'CoreFramework\Stacker\FiFoStacker');
 
 // CFG: STACKER-NODE-ANNOUNCEMENT-MAX-SIZE
 $cfg->setConfigEntry('stacker_node_announcement_max_size', 20);
@@ -688,7 +688,7 @@ $cfg->setConfigEntry('task_pool_iterator_class', 'TaskPoolIterator');
 $cfg->setConfigEntry('monitor_pool_iterator_class', 'MonitorPoolIterator');
 
 // CFG: QUERY-ITERATOR-CLASS
-$cfg->setConfigEntry('query_iterator_class', 'DefaultIterator');
+$cfg->setConfigEntry('query_iterator_class', 'CoreFramework\Iterator\DefaultIterator');
 
 // CFG: NODE-PING-ITERATOR-CLASS
 $cfg->setConfigEntry('node_ping_iterator_class', 'HubPingIterator');
@@ -939,7 +939,7 @@ $cfg->setConfigEntry('upper_recipient_class', 'UpperRecipient');
 $cfg->setConfigEntry('miner_default_mode', 'coin');
 
 // CFG: MINER-BUFFER-STACKER-CLASS
-$cfg->setConfigEntry('miner_buffer_stacker_class', 'FiFoStacker');
+$cfg->setConfigEntry('miner_buffer_stacker_class', 'CoreFramework\Stacker\FiFoStacker');
 
 // CFG: HUB-CONSOLE-CMD-CRUNCHER-RESOLVER-CLASS
 $cfg->setConfigEntry('hub_console_cmd_miner_resolver_class', 'Hub\Resolver\Command\HubConsoleCommandResolver');
@@ -1045,7 +1045,7 @@ $cfg->setConfigEntry('miner_real_hash_block_class', 'HashBlock');
 $cfg->setConfigEntry('cruncher_default_mode', 'mcrypt');
 
 // CFG: CRUNCHER-BUFFER-STACKER-CLASS
-$cfg->setConfigEntry('cruncher_buffer_stacker_class', 'FiFoStacker');
+$cfg->setConfigEntry('cruncher_buffer_stacker_class', 'CoreFramework\Stacker\FiFoStacker');
 
 // CFG: HUB-CONSOLE-CMD-CRUNCHER-RESOLVER-CLASS
 $cfg->setConfigEntry('hub_console_cmd_cruncher_resolver_class', 'Hub\Resolver\Command\HubConsoleCommandResolver');
@@ -1299,31 +1299,31 @@ $cfg->setConfigEntry('crawler_url_stacks', 'local_start:uploaded_list:rss_start:
 $cfg->setConfigEntry('crawler_node_communicator_task_class', 'CrawlerNodeCommunicatorTask');
 
 // CFG: CRAWLER-URL-LOCAL-START-STACK-CLASS
-$cfg->setConfigEntry('crawler_url_local_start_stack_class', 'FiFoFileStack');
+$cfg->setConfigEntry('crawler_url_local_start_stack_class', 'CoreFramework\Stack\Filesystem\FiFoFileStack');
 
 // CFG: CRAWLER-URL-UPLOADED-LIST-STACK-CLASS
-$cfg->setConfigEntry('crawler_url_uploaded_list_stack_class', 'FiFoFileStack');
+$cfg->setConfigEntry('crawler_url_uploaded_list_stack_class', 'CoreFramework\Stack\Filesystem\FiFoFileStack');
 
 // CFG: CRAWLER-URL-RSS-START-STACK-CLASS
-$cfg->setConfigEntry('crawler_url_rss_start_stack_class', 'FiFoFileStack');
+$cfg->setConfigEntry('crawler_url_rss_start_stack_class', 'CoreFramework\Stack\Filesystem\FiFoFileStack');
 
 // CFG: CRAWLER-URL-FOUND-RSS-STACK-CLASS
-$cfg->setConfigEntry('crawler_url_found_rss_stack_class', 'FiFoFileStack');
+$cfg->setConfigEntry('crawler_url_found_rss_stack_class', 'CoreFramework\Stack\Filesystem\FiFoFileStack');
 
 // CFG: CRAWLER-URL-LOCAL-START-FILE-STACK-INDEX-CLASS
-$cfg->setConfigEntry('crawler_url_local_start_file_stack_index_class', 'FileStackIndex');
+$cfg->setConfigEntry('crawler_url_local_start_file_stack_index_class', 'CoreFramework\Index\Stack\FileStackIndex');
 
 // CFG: CRAWLER-URL-UPLOADED-LIST-FILE-STACK-INDEX-CLASS
-$cfg->setConfigEntry('crawler_url_uploaded_list_file_stack_index_class', 'FileStackIndex');
+$cfg->setConfigEntry('crawler_url_uploaded_list_file_stack_index_class', 'CoreFramework\Index\Stack\FileStackIndex');
 
 // CFG: CRAWLER-URL-RSS-START-FILE-STACK-INDEX-CLASS
-$cfg->setConfigEntry('crawler_url_rss_start_file_stack_index_class', 'FileStackIndex');
+$cfg->setConfigEntry('crawler_url_rss_start_file_stack_index_class', 'CoreFramework\Index\Stack\FileStackIndex');
 
 // CFG: CRAWLER-URL-FOUND-RSS-FILE-STACK-INDEX-CLASS
-$cfg->setConfigEntry('crawler_url_found_rss_file_stack_index_class', 'FileStackIndex');
+$cfg->setConfigEntry('crawler_url_found_rss_file_stack_index_class', 'CoreFramework\Index\Stack\FileStackIndex');
 
 // CFG: CRAWLER-URL-UPLOADED-LIST-URL-SOURCE-STACK-CLASS
-$cfg->setConfigEntry('crawler_uploaded_list_url_source_stack_class', 'FiFoStacker');
+$cfg->setConfigEntry('crawler_uploaded_list_url_source_stack_class', 'CoreFramework\Stacker\FiFoStacker');
 
 // CFG: STACKER-CSV-FILE-MAX-SIZE
 $cfg->setConfigEntry('stacker_csv_file_max_size', 10);
index 346273c75d210f12f360546c97fe820d6dfc9e76..03008573edbc15b8b15c78ffdb428d3e3ac387b7 100644 (file)
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Handler\Network\PackageCode;
+
+// Import application-specific stuff
+use Hub\Handler\RawData\BaseRawDataHandler;
+
 /**
  * This exception is thrown when an unexpected package status was detected.
  *
index a2f5df0d29528eeee33deda1369833ab082862cb..e2341a66001bb5a48279b69f473638b010bdf177 100644 (file)
@@ -5,6 +5,7 @@ namespace Hub\Database\Frontend\Node\Dht;
 // Import framework stuff
 use CoreFramework\Criteria\Local\LocalSearchCriteria;
 use CoreFramework\Database\Frontend\DatabaseWrapper;
+use CoreFramework\Handler\DataSet\HandleableDataSet;
 
 /**
  * An interface for distributed hash tables for nodes
index 53d2719d5b47d580f920adb8d05a3a375213484f..6f5177e5c70fb327b613474615f5212a26704a7f 100644 (file)
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Dht\Node;
+
+// Import framework stuff
+use CoreFramework\Handler\DataSet\HandleableDataSet;
+
 /**
  * An interface for DHTs
  *
index 452a621702334a9985573cf12976405e061e0d79..b8e7c78f49e1d5be1e3ce6ba9bf1d301d47f97b4 100644 (file)
@@ -7,6 +7,7 @@ use Hub\Network\Receive\Receivable;
 
 // Import framework stuff
 use CoreFramework\Criteria\Storing\StoreableCriteria;
+use CoreFramework\Handler\DataSet\HandleableDataSet;
 
 /**
  * A HandleableAnswerStatus interface
index a2364669d76c86879cc3301c6823c1852f725d1f..18f256d6c5cd656bae02d09c4b3e8d37dcbd0cf6 100644 (file)
@@ -1,4 +1,10 @@
 <?php
+// Own namespace
+namespace Hub\Handler\RawData\Chunks;
+
+// Import framework stuff
+use CoreFramework\Handler\Handleable;
+
 /**
  * An interface for chunk handlers
  *
index c92805b042d00cb591e205bbcf7cd4f1f4ba5758..5ad7ee260f3a5d78b912abc3b738b73c382db507 100644 (file)
@@ -5,6 +5,9 @@ namespace Hub\Handler\Message;
 // Import application-specific stuff
 use Hub\Network\Receive\Receivable;
 
+// Import framework stuff
+use CoreFramework\Handler\DataSet\HandleableDataSet;
+
 /**
  * An interface for message handlers
  *
index 651bfef0f6c390fd6441a9db26aeeb09427a2f08..caf56cf9e141929813a933618bce35fd9dbafc47 100644 (file)
@@ -2,6 +2,9 @@
 // Own namespace
 namespace Hub\Network;
 
+// Import framework stuff
+use CoreFramework\Handler\DataSet\HandleableDataSet;
+
 /**
  * A Networkable interface
  *
@@ -29,11 +32,11 @@ interface Networkable extends HandleableDataSet {
         * Processes raw data from given resource. This is mostly useful for TCP
         * package handling and is implemented in the TcpListener class
         *
-        * @param       $resourceArray  A valid socket resource array
+        * @param       $socketData     A valid socket resource array
         * @return      void
         * @throws      InvalidResourceException        If the given resource is invalid
         */
-       function processRawDataFromResource (array $resourceArray);
+       function processRawDataFromResource (array $socketData);
 
        /**
         * Checks whether decoded data is pending for further processing.
diff --git a/application/hub/interfaces/handler/protocol/.htaccess b/application/hub/interfaces/handler/protocol/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/interfaces/handler/protocol/class_HandleableProtocol.php b/application/hub/interfaces/handler/protocol/class_HandleableProtocol.php
new file mode 100644 (file)
index 0000000..26327d5
--- /dev/null
@@ -0,0 +1,62 @@
+<?php
+// Own namespace
+namespace Hub\Handler\Protocol;
+
+// Import framework stuff
+use CoreFramework\Handler\Handleable;
+
+/**
+ * An interface for protocol handlers
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Hub 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 HandleableProtocol extends Handleable {
+       /**
+        * Getter for port number to satify HandleableProtocol
+        *
+        * @return      $port   The port number
+        */
+       function getPort ();
+
+       /**
+        * Getter for protocol name
+        *
+        * @return      $protocol       Name of used protocol
+        */
+       function getProtocolName ();
+
+       /**
+        * Validates given 'recipient' if it is a valid UNL. This means that the UNL
+        * can be parsed by the protocol handler.
+        *
+        * @param       $packageData    Valid raw package data
+        * @return      $isValid                Whether the UNL can be validated
+        */
+       function isValidUniversalNodeLocatorByPackageData (array $packageData);
+
+       /**
+        * If the found UNL (address) matches own external or internal address
+        *
+        * @param       $unl            UNL to test
+        * @return      $ifMatches      Whether the found UNL matches own addresss
+        */
+       function isOwnAddress ($unl);
+
+}
diff --git a/core b/core
index 197d364f62d39e6f731ff62001ac6cafccc0d9cc..001f7ff82c38dcd58d652ca8acf272716f3f0f04 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit 197d364f62d39e6f731ff62001ac6cafccc0d9cc
+Subproject commit 001f7ff82c38dcd58d652ca8acf272716f3f0f04