From 61eb130218eec38b4356bbe68ff206b164cda22b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 19 May 2017 19:29:00 +0200 Subject: [PATCH] Next wave: - imported ConnectionHelper (now possible) - imported UniversalNodeLocator - imported SubRegistry - imported Deliverable, Networkable, NetworkPackage - imported SocketTag - imported Poolable(Listener|Peer) instead of Poolable and used them - added namespaces to configuration entries - added PoolablePeer interface (from master branch) - added PoolableListener interface (reborn!) - created namespaces MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../hub/classes/class_BaseHubSystem.php | 1 + .../socket/class_SocketContainer.php | 2 + ...odeDistributedHashTableDatabaseWrapper.php | 1 + .../class_PeerStateLookupDatabaseWrapper.php | 1 + .../decoder/package/class_PackageDecoder.php | 3 + .../protocol/class_ProtocolDiscovery.php | 1 + .../class_PackageRecipientDiscovery.php | 1 + .../socket/class_PackageSocketDiscovery.php | 1 + .../factories/socket/class_SocketFactory.php | 3 + .../classes/filter/class_BaseHubFilter.php | 1 + .../socket/class_SocketRawDataHandler.php | 6 ++ .../network/tcp/class_TcpRawDataHandler.php | 3 +- .../network/udp/class_UdpRawDataHandler.php | 1 + .../protocol/class_BaseProtocolHandler.php | 3 +- .../ipv4/class_BaseIpV4ProtocolHandler.php | 7 ++ .../hub/classes/handler/raw_data/class_ | 6 ++ .../raw_data/class_BaseDataHandler.php | 3 + .../classes/handler/raw_data/network/class_ | 3 + .../network/class_BaseRawDataHandler.php | 3 + application/hub/classes/helper/class_ | 1 + .../connection/class_BaseConnectionHelper.php | 1 + .../ipv4/class_BaseIpV4ConnectionHelper.php | 1 + .../ipv4/tcp/class_TcpConnectionHelper.php | 2 + .../helper/dht/class_DhtBootstrapHelper.php | 1 + .../dht/class_DhtPublishEntryHelper.php | 1 + .../class_NodeAnnouncementHelper.php | 1 + application/hub/classes/helper/node/class_ | 1 + .../class_NodeSelfConnectHelper.php | 1 + .../class_NodeRequestNodeListHelper.php | 1 + .../info/connection/class_ConnectionInfo.php | 2 + .../classes/listener/class_BaseListener.php | 7 +- .../listener/class_BaseListenerDecorator.php | 3 + .../hub/classes/nodes/class_BaseHubNode.php | 1 + .../assembler/class_PackageAssembler.php | 1 + .../classes/package/class_NetworkPackage.php | 2 + .../fragmenter/class_PackageFragmenter.php | 1 + .../listener/class_DefaultListenerPool.php | 4 +- .../pools/peer/class_DefaultPeerPool.php | 6 +- .../recipient/dht/class_DhtRecipient.php | 3 + .../direct/class_DirectRecipient.php | 1 + .../recipient/self/class_SelfRecipient.php | 1 + .../recipient/upper/class_UpperRecipient.php | 1 + .../registry/socket/class_SocketRegistry.php | 4 +- .../tags/package/class_PackageTags.php | 1 + .../class_RawDataPoolMonitorVisitor.php | 1 + .../class_HalfShutdownSocketVisitor.php | 1 + .../socket/class_ShutdownSocketVisitor.php | 1 + application/hub/config.php | 6 +- .../class_InvalidDataChecksumException.php | 6 ++ ...class_UnexpectedPackageStatusException.php | 6 ++ .../class_PeerAlreadyRegisteredException.php | 6 ++ .../socket/class_SocketShutdownException.php | 3 + .../unl/class_InvalidUnlException.php | 6 ++ .../handler/network/class_Networkable.php | 3 + .../interfaces/package/class_Receivable.php | 3 + .../hub/interfaces/pool/class_Poolable.php | 9 --- .../hub/interfaces/pool/listener/.htaccess | 1 + .../pool/listener/class_PoolableListener.php | 43 ++++++++++++ .../hub/interfaces/pool/peer/.htaccess | 1 + .../pool/peer/class_PoolablePeer.php | 66 +++++++++++++++++++ .../resolver/state/class_StateResolver.php | 3 + .../shareable/info/class_ShareableInfo.php | 3 + .../hub/interfaces/socket/class_SocketTag.php | 4 +- 63 files changed, 246 insertions(+), 25 deletions(-) create mode 100644 application/hub/interfaces/pool/listener/.htaccess create mode 100644 application/hub/interfaces/pool/listener/class_PoolableListener.php create mode 100644 application/hub/interfaces/pool/peer/.htaccess create mode 100644 application/hub/interfaces/pool/peer/class_PoolablePeer.php diff --git a/application/hub/classes/class_BaseHubSystem.php b/application/hub/classes/class_BaseHubSystem.php index a84e33833..b00acce39 100644 --- a/application/hub/classes/class_BaseHubSystem.php +++ b/application/hub/classes/class_BaseHubSystem.php @@ -4,6 +4,7 @@ namespace Hub\Generic; // Import application-specific stuff use Hub\Information\ShareableInfo; +use Hub\Network\Deliver\Deliverable; use Hub\Network\Receive\Receivable; use Hub\Pool\Poolable; diff --git a/application/hub/classes/container/socket/class_SocketContainer.php b/application/hub/classes/container/socket/class_SocketContainer.php index f59d6fa8e..f304700c6 100644 --- a/application/hub/classes/container/socket/class_SocketContainer.php +++ b/application/hub/classes/container/socket/class_SocketContainer.php @@ -4,8 +4,10 @@ namespace Hub\Container\Socket; // Import application-specific stuff use Hub\Information\ShareableInfo; +use Hub\Network\Package\NetworkPackage; // Import framework stuff +use CoreFramework\Container\BaseContainer; use CoreFramework\Listener\Listenable; use CoreFramework\Registry\Registerable; diff --git a/application/hub/classes/database/frontend/node/class_NodeDistributedHashTableDatabaseWrapper.php b/application/hub/classes/database/frontend/node/class_NodeDistributedHashTableDatabaseWrapper.php index 5815b6525..ca13acd87 100644 --- a/application/hub/classes/database/frontend/node/class_NodeDistributedHashTableDatabaseWrapper.php +++ b/application/hub/classes/database/frontend/node/class_NodeDistributedHashTableDatabaseWrapper.php @@ -5,6 +5,7 @@ namespace Hub\Database\Frontend\Node\Dht; // Import application-specific stuff use Hub\Database\Frontend\Node\Information\NodeInformationDatabaseWrapper; use Hub\Factory\Node\NodeObjectFactory; +use Hub\Network\Package\NetworkPackage; use Hub\Node\BaseHubNode; // Import framework stuff diff --git a/application/hub/classes/database/frontend/states/class_PeerStateLookupDatabaseWrapper.php b/application/hub/classes/database/frontend/states/class_PeerStateLookupDatabaseWrapper.php index 929d02cb6..c2cadb773 100644 --- a/application/hub/classes/database/frontend/states/class_PeerStateLookupDatabaseWrapper.php +++ b/application/hub/classes/database/frontend/states/class_PeerStateLookupDatabaseWrapper.php @@ -4,6 +4,7 @@ namespace Hub\Database\Frontend\Node\PeerState; // Import application-specific sutff use Hub\Helper\Connection\ConnectionHelper; +use Hub\Network\Package\NetworkPackage; use Hub\Tools\HubTools; // Import framework stuff diff --git a/application/hub/classes/decoder/package/class_PackageDecoder.php b/application/hub/classes/decoder/package/class_PackageDecoder.php index 13e6396f3..7cf35191d 100644 --- a/application/hub/classes/decoder/package/class_PackageDecoder.php +++ b/application/hub/classes/decoder/package/class_PackageDecoder.php @@ -2,6 +2,9 @@ // Own namespace namespace Hub\Decoder; +// Import application-specific stuff +use Hub\Network\Package\NetworkPackage; + // Import framework stuff use CoreFramework\Registry\Registerable; diff --git a/application/hub/classes/discovery/protocol/class_ProtocolDiscovery.php b/application/hub/classes/discovery/protocol/class_ProtocolDiscovery.php index ca5a64852..acae4da49 100644 --- a/application/hub/classes/discovery/protocol/class_ProtocolDiscovery.php +++ b/application/hub/classes/discovery/protocol/class_ProtocolDiscovery.php @@ -4,6 +4,7 @@ namespace Hub\Discovery\Protocol; // Import application-specific stuff use Hub\Discovery\Node\BaseNodeDiscovery; +use Hub\Network\Package\NetworkPackage; // Import framework stuff use CoreFramework\Registry\Registerable; diff --git a/application/hub/classes/discovery/recipient/package/class_PackageRecipientDiscovery.php b/application/hub/classes/discovery/recipient/package/class_PackageRecipientDiscovery.php index c500bf673..9c7143470 100644 --- a/application/hub/classes/discovery/recipient/package/class_PackageRecipientDiscovery.php +++ b/application/hub/classes/discovery/recipient/package/class_PackageRecipientDiscovery.php @@ -3,6 +3,7 @@ namespace Hub\Discovery\Network\Recipient; // Import hub-specific sutff +use Hub\Network\Package\NetworkPackage; use Hub\Tools\HubTools; // Import framework stuff diff --git a/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php b/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php index 2701189d0..9dedb5c7d 100644 --- a/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php +++ b/application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php @@ -6,6 +6,7 @@ namespace Hub\Network\Discovery\Socket; use Hub\Factory\Node\NodeObjectFactory; use Hub\Generic\BaseHubSystem; use Hub\Helper\Connection\BaseConnectionHelper; +use Hub\Network\Package\NetworkPackage; // Import framework stuff use CoreFramework\Listener\Listenable; diff --git a/application/hub/classes/factories/socket/class_SocketFactory.php b/application/hub/classes/factories/socket/class_SocketFactory.php index e070f0ef3..2a8510f13 100644 --- a/application/hub/classes/factories/socket/class_SocketFactory.php +++ b/application/hub/classes/factories/socket/class_SocketFactory.php @@ -2,6 +2,9 @@ // Own namespace namespace Hub\Factory\Socket; +// Import application-specific stuff +use Hub\Network\Package\NetworkPackage; + // Import framework stuff use CoreFramework\Configuration\FrameworkConfiguration; use CoreFramework\Factory\ObjectFactory; diff --git a/application/hub/classes/filter/class_BaseHubFilter.php b/application/hub/classes/filter/class_BaseHubFilter.php index c6a11ffd4..0ce246bac 100644 --- a/application/hub/classes/filter/class_BaseHubFilter.php +++ b/application/hub/classes/filter/class_BaseHubFilter.php @@ -3,6 +3,7 @@ namespace Hub\Filter; // Import application-specific stuff +use Hub\Network\Package\NetworkPackage; use Hub\Network\Receive\Receivable; // Import framework stuff diff --git a/application/hub/classes/handler/network/socket/class_SocketRawDataHandler.php b/application/hub/classes/handler/network/socket/class_SocketRawDataHandler.php index 79abf4390..6da72152b 100644 --- a/application/hub/classes/handler/network/socket/class_SocketRawDataHandler.php +++ b/application/hub/classes/handler/network/socket/class_SocketRawDataHandler.php @@ -1,4 +1,10 @@ poolInstance; diff --git a/application/hub/classes/listener/class_BaseListenerDecorator.php b/application/hub/classes/listener/class_BaseListenerDecorator.php index 1cb1d15da..1a31e49cb 100644 --- a/application/hub/classes/listener/class_BaseListenerDecorator.php +++ b/application/hub/classes/listener/class_BaseListenerDecorator.php @@ -2,6 +2,9 @@ // Own namespace namespace Hub\Listener; +// Import application-specific stuff +use Hub\Network\Networkable; + // Import framework stuff use CoreFramework\Generic\BaseDecorator; use CoreFramework\Visitor\Visitable; diff --git a/application/hub/classes/nodes/class_BaseHubNode.php b/application/hub/classes/nodes/class_BaseHubNode.php index 678d493de..dd19fc13b 100644 --- a/application/hub/classes/nodes/class_BaseHubNode.php +++ b/application/hub/classes/nodes/class_BaseHubNode.php @@ -7,6 +7,7 @@ use Hub\Database\Frontend\Node\Information\NodeInformationDatabaseWrapper; use Hub\Factory\State\Node\NodeStateFactory; use Hub\Locator\Node\LocateableNode; use Hub\Generic\BaseHubSystem; +use Hub\Network\Package\NetworkPackage; use Hub\Network\Receive\Receivable; use Hub\Tools\HubTools; diff --git a/application/hub/classes/package/assembler/class_PackageAssembler.php b/application/hub/classes/package/assembler/class_PackageAssembler.php index 15c2028ca..f82e66d36 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\Network\Package\NetworkPackage; use Hub\Network\Receive\Receivable; // Import framework stuff diff --git a/application/hub/classes/package/class_NetworkPackage.php b/application/hub/classes/package/class_NetworkPackage.php index 4437bf296..849862745 100644 --- a/application/hub/classes/package/class_NetworkPackage.php +++ b/application/hub/classes/package/class_NetworkPackage.php @@ -11,6 +11,8 @@ use Hub\Helper\Connection\BaseConnectionHelper; use Hub\Helper\Connection\ConnectionHelper; use Hub\Helper\HubHelper; use Hub\Information\ShareableInfo; +use Hub\Network\Deliver\Deliverable; +use Hub\Network\Networkable; use Hub\Network\Receive\Receivable; use Hub\Tools\HubTools; diff --git a/application/hub/classes/package/fragmenter/class_PackageFragmenter.php b/application/hub/classes/package/fragmenter/class_PackageFragmenter.php index e48e92374..37d0018e1 100644 --- a/application/hub/classes/package/fragmenter/class_PackageFragmenter.php +++ b/application/hub/classes/package/fragmenter/class_PackageFragmenter.php @@ -5,6 +5,7 @@ namespace Hub\Network\Package\Fragment; // Import application-specific stuff use Hub\Generic\BaseHubSystem; use Hub\Helper\Connection\ConnectionHelper; +use Hub\Network\Package\NetworkPackage; // Import framework stuff use CoreFramework\Factory\ObjectFactory; diff --git a/application/hub/classes/pools/listener/class_DefaultListenerPool.php b/application/hub/classes/pools/listener/class_DefaultListenerPool.php index 5772d3983..d7e2c56ed 100644 --- a/application/hub/classes/pools/listener/class_DefaultListenerPool.php +++ b/application/hub/classes/pools/listener/class_DefaultListenerPool.php @@ -5,7 +5,7 @@ namespace Hub\Pool\Listener; // Import application-specific stuff use Hub\Helper\Node\NodeHelper; use Hub\Pool\BasePool; -use Hub\Pool\Poolable; +use Hub\Pool\Listener\PoolableListener; // Import framework stuff use CoreFramework\Factory\ObjectFactory; @@ -33,7 +33,7 @@ use CoreFramework\Listener\Listenable; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class DefaultListenerPool extends BasePool implements Poolable { +class DefaultListenerPool extends BasePool implements PoolableListener { /** * Protected constructor * diff --git a/application/hub/classes/pools/peer/class_DefaultPeerPool.php b/application/hub/classes/pools/peer/class_DefaultPeerPool.php index 2239f6aef..27a95a48a 100644 --- a/application/hub/classes/pools/peer/class_DefaultPeerPool.php +++ b/application/hub/classes/pools/peer/class_DefaultPeerPool.php @@ -3,8 +3,10 @@ namespace Hub\Pool\Peer; // Import application-specific stuff +use Hub\Locator\Node\UniversalNodeLocator; +use Hub\Network\Package\NetworkPackage; use Hub\Pool\BasePool; -use Hub\Pool\Poolable; +use Hub\Pool\Peer\PoolablePeer; // Import framework stuff use CoreFramework\Listener\Listenable; @@ -46,7 +48,7 @@ class DefaultPeerPool extends BasePool implements PoolablePeer { * Creates an instance of this class * * @param $listenerInstance A Listenable instance - * @return $poolInstance An instance a Poolable class + * @return $poolInstance An instance a PoolablePeer class */ public static final function createDefaultPeerPool (Listenable $listenerInstance) { // Get new instance diff --git a/application/hub/classes/recipient/dht/class_DhtRecipient.php b/application/hub/classes/recipient/dht/class_DhtRecipient.php index 8fe4535e5..09b161c35 100644 --- a/application/hub/classes/recipient/dht/class_DhtRecipient.php +++ b/application/hub/classes/recipient/dht/class_DhtRecipient.php @@ -2,6 +2,9 @@ // Own namespace namespace Hub\Recipient\Dht; +// Import application-specific stuff +use Hub\Network\Package\NetworkPackage; + // Import framework stuff use CoreFramework\Factory\ObjectFactory; use CoreFramework\Lists\Listable; diff --git a/application/hub/classes/recipient/direct/class_DirectRecipient.php b/application/hub/classes/recipient/direct/class_DirectRecipient.php index c60311554..754742f1a 100644 --- a/application/hub/classes/recipient/direct/class_DirectRecipient.php +++ b/application/hub/classes/recipient/direct/class_DirectRecipient.php @@ -3,6 +3,7 @@ namespace Hub\Network\Recipient\Direct; // Import hub-specific sutff +use Hub\Network\Package\NetworkPackage; use Hub\Tools\HubTools; // Import framework stuff diff --git a/application/hub/classes/recipient/self/class_SelfRecipient.php b/application/hub/classes/recipient/self/class_SelfRecipient.php index 838c9fd88..ea924a1d5 100644 --- a/application/hub/classes/recipient/self/class_SelfRecipient.php +++ b/application/hub/classes/recipient/self/class_SelfRecipient.php @@ -3,6 +3,7 @@ namespace Hub\Network\Recipient\Self; // Import hub-specific sutff +use Hub\Network\Package\NetworkPackage; use Hub\Tools\HubTools; // Import framework stuff diff --git a/application/hub/classes/recipient/upper/class_UpperRecipient.php b/application/hub/classes/recipient/upper/class_UpperRecipient.php index 1b24135f4..5fd5db3d9 100644 --- a/application/hub/classes/recipient/upper/class_UpperRecipient.php +++ b/application/hub/classes/recipient/upper/class_UpperRecipient.php @@ -4,6 +4,7 @@ namespace Hub\Network\Receipt\Upper; // Import hub-specific stuff use Hub\Generic\BaseHubSystem; +use Hub\Network\Package\NetworkPackage; // Import framework stuff use CoreFramework\Lists\Listable; diff --git a/application/hub/classes/registry/socket/class_SocketRegistry.php b/application/hub/classes/registry/socket/class_SocketRegistry.php index b60fb2d9e..d6e03a6aa 100644 --- a/application/hub/classes/registry/socket/class_SocketRegistry.php +++ b/application/hub/classes/registry/socket/class_SocketRegistry.php @@ -4,13 +4,15 @@ namespace Hub\Registry\Socket; // Import application-specific stuff use Hub\Information\ShareableInfo; +use Hub\Network\Package\NetworkPackage; +use Hub\Registry\Socket\RegisterableSocket; // Import framework stuff use CoreFramework\Factory\ObjectFactory; use CoreFramework\Listener\Listenable; use CoreFramework\Registry\BaseRegistry; use CoreFramework\Registry\Register; -use Hub\Registry\Socket\RegisterableSocket; +use CoreFramework\Registry\Sub\SubRegistry; /** * A Socket registry diff --git a/application/hub/classes/tags/package/class_PackageTags.php b/application/hub/classes/tags/package/class_PackageTags.php index 0fe8ad47b..9cb6e22d6 100644 --- a/application/hub/classes/tags/package/class_PackageTags.php +++ b/application/hub/classes/tags/package/class_PackageTags.php @@ -3,6 +3,7 @@ namespace Hub\Tag\Network; // Import application-specific stuff +use Hub\Network\Package\NetworkPackage; // Import framework stuff use CoreFramework\Listener\Listenable; diff --git a/application/hub/classes/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php b/application/hub/classes/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php index a3db3b3b9..d044ae8ac 100644 --- a/application/hub/classes/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php +++ b/application/hub/classes/visitor/pool/monitor/class_RawDataPoolMonitorVisitor.php @@ -65,6 +65,7 @@ class RawDataPoolMonitorVisitor extends BaseVisitor implements PoolVisitor, List * * @param $poolInstance A Poolable instance * @return void + * @todo Maybe throw UnsupportedOperationException? */ public function visitPool (Poolable $poolInstance) { // A pool doesn't normally have any raw data waiting diff --git a/application/hub/classes/visitor/socket/class_HalfShutdownSocketVisitor.php b/application/hub/classes/visitor/socket/class_HalfShutdownSocketVisitor.php index 1bd535e5e..a26d5ac8e 100644 --- a/application/hub/classes/visitor/socket/class_HalfShutdownSocketVisitor.php +++ b/application/hub/classes/visitor/socket/class_HalfShutdownSocketVisitor.php @@ -4,6 +4,7 @@ namespace Hub\Visitor\Shutdown\Socket; // Import application-specific stuff use Hub\Helper\Connection\ConnectionHelper; +use Hub\Network\Deliver\Deliverable; // Import framework stuff use CoreFramework\Visitor\BaseVisitor; diff --git a/application/hub/classes/visitor/socket/class_ShutdownSocketVisitor.php b/application/hub/classes/visitor/socket/class_ShutdownSocketVisitor.php index 103cb9d18..873460e17 100644 --- a/application/hub/classes/visitor/socket/class_ShutdownSocketVisitor.php +++ b/application/hub/classes/visitor/socket/class_ShutdownSocketVisitor.php @@ -4,6 +4,7 @@ namespace Hub\Visitor\Shutdown\Socket; // Import application-specific stuff use Hub\Helper\Connection\ConnectionHelper; +use Hub\Network\Deliver\Deliverable; // Import framework stuff use CoreFramework\Visitor\BaseVisitor; diff --git a/application/hub/config.php b/application/hub/config.php index 987919206..cdee06da2 100644 --- a/application/hub/config.php +++ b/application/hub/config.php @@ -94,10 +94,10 @@ $cfg->setConfigEntry('client_tcp_listener_class', 'ClientTcpListenerDecorator'); $cfg->setConfigEntry('client_udp_listener_class', 'ClientUdpListenerDecorator'); // CFG: NODE-POOL-CLASS -$cfg->setConfigEntry('node_pool_class', 'DefaultPeerPool'); +$cfg->setConfigEntry('node_pool_class', 'Hub\Pool\Peer\DefaultPeerPool'); // CFG: APPLICATION-POOL-CLASS -$cfg->setConfigEntry('application_pool_class', 'DefaultPeerPool'); +$cfg->setConfigEntry('application_pool_class', 'Hub\Pool\Peer\DefaultPeerPool'); // CFG: POOL-ENTRIES-LIST-CLASS $cfg->setConfigEntry('pool_entries_list_class', 'Hub\Lists\Pool\PoolEntriesList'); @@ -709,7 +709,7 @@ $cfg->setConfigEntry('raw_package_compressor_class', 'ZlibCompressor'); $cfg->setConfigEntry('socket_registry_class', 'Hub\Registry\Socket\SocketRegistry'); // CFG: SOCKET-CONTAINER-CLASS -$cfg->setConfigEntry('socket_container_class', 'SocketContainer'); +$cfg->setConfigEntry('socket_container_class', 'Hub\Container\Socket\SocketContainer'); // CFG: IPC-SOCKET-FILE-NAME $cfg->setConfigEntry('ipc_socket_file_name', 'php_hub_ipc_socket'); diff --git a/application/hub/exceptions/package/class_InvalidDataChecksumException.php b/application/hub/exceptions/package/class_InvalidDataChecksumException.php index 3730d9317..b0b691b63 100644 --- a/application/hub/exceptions/package/class_InvalidDataChecksumException.php +++ b/application/hub/exceptions/package/class_InvalidDataChecksumException.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.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 PoolableListener extends Poolable { + + /** + * Adds a listener instance to this pool + * + * @param $poolInstance An instance of a Listenable class + * @return void + */ + function addListener (Listenable $poolInstance); + +} diff --git a/application/hub/interfaces/pool/peer/.htaccess b/application/hub/interfaces/pool/peer/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/interfaces/pool/peer/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/interfaces/pool/peer/class_PoolablePeer.php b/application/hub/interfaces/pool/peer/class_PoolablePeer.php new file mode 100644 index 000000000..737df9fbb --- /dev/null +++ b/application/hub/interfaces/pool/peer/class_PoolablePeer.php @@ -0,0 +1,66 @@ + + * @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 PoolablePeer extends Poolable, SocketTag { + /** + * Adds a socket resource to the peer pool + * + * @param $socketResource A valid (must be!) socket resource + * @param $connectionType Type of connection, can only be 'incoming', 'outgoing' or 'server' + * @return void + * @throws InvalidSocketException If the given resource is invalid or errorous + * @throws InvalidConnectionTypeException If the provided connection type is not valid + */ + function addPeer ($socketResource, $connectionType); + + /** + * Getter for array of all socket resource arrays + * + * @return $sockets An array with all socket arrays + */ + function getAllSockets (); + + /** + * Getter for array of all socket resources + * + * @return $sockets An array with all sockets + */ + function getAllSingleSockets (); + + /** + * "Getter" for all sockets of specified type + * + * @param $connectionType Type of connection, can only be 'incoming', 'outgoing' or 'server' + * @return $sockets An array with sockets of given type + * @throws InvalidConnectionTypeException If the provided connection type is not valid + */ + function getSocketsByConnectionType ($connectionType); + +} diff --git a/application/hub/interfaces/resolver/state/class_StateResolver.php b/application/hub/interfaces/resolver/state/class_StateResolver.php index ea4236d19..dabe7930d 100644 --- a/application/hub/interfaces/resolver/state/class_StateResolver.php +++ b/application/hub/interfaces/resolver/state/class_StateResolver.php @@ -2,6 +2,9 @@ // Own namespace namespace Hub\Resolver\State; +// Import application-specific stuff +use Hub\Helper\Connection\ConnectionHelper; + // Import framework stuff use CoreFramework\Resolver\Resolver; diff --git a/application/hub/interfaces/shareable/info/class_ShareableInfo.php b/application/hub/interfaces/shareable/info/class_ShareableInfo.php index 44121242a..203bbda03 100644 --- a/application/hub/interfaces/shareable/info/class_ShareableInfo.php +++ b/application/hub/interfaces/shareable/info/class_ShareableInfo.php @@ -2,6 +2,9 @@ // Own namespace namespace Hub\Information; +// Import application-specific stuff +use Hub\Helper\Connection\ConnectionHelper; + // Import framework stuff use CoreFramework\Generic\FrameworkInterface; use CoreFramework\Listener\Listenable; diff --git a/application/hub/interfaces/socket/class_SocketTag.php b/application/hub/interfaces/socket/class_SocketTag.php index a31d7eadb..b488b6444 100644 --- a/application/hub/interfaces/socket/class_SocketTag.php +++ b/application/hub/interfaces/socket/class_SocketTag.php @@ -37,7 +37,5 @@ interface SocketTag extends FrameworkInterface { * @throws InvalidConnectionTypeException If the provided connection type is not valid */ function getSocketFromPackageData (array $packageData, $connectionType = NULL); -} -// [EOF] -?> +} -- 2.39.5