From: Roland Häder Date: Fri, 19 May 2017 18:58:20 +0000 (+0200) Subject: Next wave: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a923eebc48949db216d18ea32159499f2b621b50;p=hub.git Next wave: - 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 --- diff --git a/application/hub/classes/class_BaseHubSystem.php b/application/hub/classes/class_BaseHubSystem.php index 7154dba7a..4450c1dbb 100644 --- a/application/hub/classes/class_BaseHubSystem.php +++ b/application/hub/classes/class_BaseHubSystem.php @@ -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); - } - } diff --git a/application/hub/classes/database/frontend/node/class_NodeDistributedHashTableDatabaseWrapper.php b/application/hub/classes/database/frontend/node/class_NodeDistributedHashTableDatabaseWrapper.php index ca13acd87..772fe05d3 100644 --- a/application/hub/classes/database/frontend/node/class_NodeDistributedHashTableDatabaseWrapper.php +++ b/application/hub/classes/database/frontend/node/class_NodeDistributedHashTableDatabaseWrapper.php @@ -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; /** diff --git a/application/hub/classes/dht/node/class_NodeDhtFacade.php b/application/hub/classes/dht/node/class_NodeDhtFacade.php index bdfaa4a22..91b0afed4 100644 --- a/application/hub/classes/dht/node/class_NodeDhtFacade.php +++ b/application/hub/classes/dht/node/class_NodeDhtFacade.php @@ -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] -?> +} diff --git a/application/hub/classes/handler/network/socket/class_SocketRawDataHandler.php b/application/hub/classes/handler/network/socket/class_SocketRawDataHandler.php index 6da72152b..8ff54d60b 100644 --- a/application/hub/classes/handler/network/socket/class_SocketRawDataHandler.php +++ b/application/hub/classes/handler/network/socket/class_SocketRawDataHandler.php @@ -3,6 +3,7 @@ namespace Hub\Handler\Network\Socket\RawData; // Import application-specific stuff +use Hub\Handler\RawData\BaseRawDataHandler; use Hub\Network\Networkable; /** diff --git a/application/hub/classes/handler/network/tcp/class_TcpRawDataHandler.php b/application/hub/classes/handler/network/tcp/class_TcpRawDataHandler.php index 453123d71..a516d9c93 100644 --- a/application/hub/classes/handler/network/tcp/class_TcpRawDataHandler.php +++ b/application/hub/classes/handler/network/tcp/class_TcpRawDataHandler.php @@ -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; diff --git a/application/hub/classes/handler/network/udp/class_UdpRawDataHandler.php b/application/hub/classes/handler/network/udp/class_UdpRawDataHandler.php index 42895f1df..d2b0d836c 100644 --- a/application/hub/classes/handler/network/udp/class_UdpRawDataHandler.php +++ b/application/hub/classes/handler/network/udp/class_UdpRawDataHandler.php @@ -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; diff --git a/application/hub/classes/handler/raw_data/network/class_ b/application/hub/classes/handler/raw_data/network/class_ index ca0fa5a2d..9a45b80ff 100644 --- a/application/hub/classes/handler/raw_data/network/class_ +++ b/application/hub/classes/handler/raw_data/network/class_ @@ -3,6 +3,7 @@ namespace Hub\Handler\RawData; // Import application-specific stuff +use Hub\Handler\RawData\BaseRawDataHandler; use Hub\Network\Networkable; /** diff --git a/application/hub/classes/handler/raw_data/network/class_BaseRawDataHandler.php b/application/hub/classes/handler/raw_data/network/class_BaseRawDataHandler.php index 8c4ce8492..2cdccd865 100644 --- a/application/hub/classes/handler/raw_data/network/class_BaseRawDataHandler.php +++ b/application/hub/classes/handler/raw_data/network/class_BaseRawDataHandler.php @@ -1,6 +1,6 @@ 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. diff --git a/application/hub/classes/nodes/class_BaseHubNode.php b/application/hub/classes/nodes/class_BaseHubNode.php index dd19fc13b..3e2f7bb7c 100644 --- a/application/hub/classes/nodes/class_BaseHubNode.php +++ b/application/hub/classes/nodes/class_BaseHubNode.php @@ -866,4 +866,5 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { } } // END - foreac } + } diff --git a/application/hub/classes/package/assembler/class_PackageAssembler.php b/application/hub/classes/package/assembler/class_PackageAssembler.php index f82e66d36..ed2e2b300 100644 --- a/application/hub/classes/package/assembler/class_PackageAssembler.php +++ b/application/hub/classes/package/assembler/class_PackageAssembler.php @@ -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; diff --git a/application/hub/classes/package/class_NetworkPackage.php b/application/hub/classes/package/class_NetworkPackage.php index 849862745..415c77533 100644 --- a/application/hub/classes/package/class_NetworkPackage.php +++ b/application/hub/classes/package/class_NetworkPackage.php @@ -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; diff --git a/application/hub/classes/states/peer/class_ b/application/hub/classes/states/peer/class_ index 52b4de7de..1dbda959e 100644 --- a/application/hub/classes/states/peer/class_ +++ b/application/hub/classes/states/peer/class_ @@ -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; diff --git a/application/hub/classes/states/peer/errors/class_ConnectionRefusedPeerState.php b/application/hub/classes/states/peer/errors/class_ConnectionRefusedPeerState.php index 012916ada..7f24ae558 100644 --- a/application/hub/classes/states/peer/errors/class_ConnectionRefusedPeerState.php +++ b/application/hub/classes/states/peer/errors/class_ConnectionRefusedPeerState.php @@ -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; diff --git a/application/hub/classes/states/peer/errors/class_ConnectionTimedOutPeerState.php b/application/hub/classes/states/peer/errors/class_ConnectionTimedOutPeerState.php index 41354bc7a..c295b2b33 100644 --- a/application/hub/classes/states/peer/errors/class_ConnectionTimedOutPeerState.php +++ b/application/hub/classes/states/peer/errors/class_ConnectionTimedOutPeerState.php @@ -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; diff --git a/application/hub/classes/states/peer/errors/class_NoRouteToHostPeerState.php b/application/hub/classes/states/peer/errors/class_NoRouteToHostPeerState.php index 9728a24df..29785850f 100644 --- a/application/hub/classes/states/peer/errors/class_NoRouteToHostPeerState.php +++ b/application/hub/classes/states/peer/errors/class_NoRouteToHostPeerState.php @@ -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; diff --git a/application/hub/classes/states/peer/errors/class_OperationAlreadyProgressPeerState.php b/application/hub/classes/states/peer/errors/class_OperationAlreadyProgressPeerState.php index ba3f7e86f..c7d7df8b8 100644 --- a/application/hub/classes/states/peer/errors/class_OperationAlreadyProgressPeerState.php +++ b/application/hub/classes/states/peer/errors/class_OperationAlreadyProgressPeerState.php @@ -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; diff --git a/application/hub/classes/states/peer/errors/class_ProblemPeerState.php b/application/hub/classes/states/peer/errors/class_ProblemPeerState.php index d4c0c9bb8..256cd86e2 100644 --- a/application/hub/classes/states/peer/errors/class_ProblemPeerState.php +++ b/application/hub/classes/states/peer/errors/class_ProblemPeerState.php @@ -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; diff --git a/application/hub/classes/states/peer/errors/class_TransportEndpointGonePeerState.php b/application/hub/classes/states/peer/errors/class_TransportEndpointGonePeerState.php index d9f0b1218..7308b68ba 100644 --- a/application/hub/classes/states/peer/errors/class_TransportEndpointGonePeerState.php +++ b/application/hub/classes/states/peer/errors/class_TransportEndpointGonePeerState.php @@ -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; diff --git a/application/hub/classes/streams/raw_data/input/class_RawDataInputStream.php b/application/hub/classes/streams/raw_data/input/class_RawDataInputStream.php index 04995b08b..31f2d84bf 100644 --- a/application/hub/classes/streams/raw_data/input/class_RawDataInputStream.php +++ b/application/hub/classes/streams/raw_data/input/class_RawDataInputStream.php @@ -1,6 +1,6 @@ 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); diff --git a/application/hub/exceptions/package/class_UnsupportedPackageCodeHandlerException.php b/application/hub/exceptions/package/class_UnsupportedPackageCodeHandlerException.php index 346273c75..03008573e 100644 --- a/application/hub/exceptions/package/class_UnsupportedPackageCodeHandlerException.php +++ b/application/hub/exceptions/package/class_UnsupportedPackageCodeHandlerException.php @@ -1,4 +1,10 @@ + * @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 . + */ +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 197d364f6..001f7ff82 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 197d364f62d39e6f731ff62001ac6cafccc0d9cc +Subproject commit 001f7ff82c38dcd58d652ca8acf272716f3f0f04