// Import application-specific stuff
use Hub\Information\ShareableInfo;
+use Hub\Network\Deliver\Deliverable;
use Hub\Network\Receive\Receivable;
use Hub\Pool\Poolable;
// 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;
// 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
// Import application-specific sutff
use Hub\Helper\Connection\ConnectionHelper;
+use Hub\Network\Package\NetworkPackage;
use Hub\Tools\HubTools;
// Import framework stuff
// Own namespace
namespace Hub\Decoder;
+// Import application-specific stuff
+use Hub\Network\Package\NetworkPackage;
+
// Import framework stuff
use CoreFramework\Registry\Registerable;
// Import application-specific stuff
use Hub\Discovery\Node\BaseNodeDiscovery;
+use Hub\Network\Package\NetworkPackage;
// Import framework stuff
use CoreFramework\Registry\Registerable;
namespace Hub\Discovery\Network\Recipient;
// Import hub-specific sutff
+use Hub\Network\Package\NetworkPackage;
use Hub\Tools\HubTools;
// Import framework stuff
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;
// 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;
namespace Hub\Filter;
// Import application-specific stuff
+use Hub\Network\Package\NetworkPackage;
use Hub\Network\Receive\Receivable;
// Import framework stuff
<?php
+// Own namespace
+namespace Hub\Handler\Network\Socket\RawData;
+
+// Import application-specific stuff
+use Hub\Network\Networkable;
+
/**
* A file-based socket raw data handler
*
<?php
// Own namespace
-namespace Hub\Handler\RawData\Tcp;
+namespace Hub\Handler\Network\RawData\Tcp;
// Import application-specific stuff
+use Hub\Network\Networkable;
use Hub\Pool\BasePool;
/**
namespace Hub\Handler\RawData\Udp;
// Import application-specific stuff
+use Hub\Network\Networkable;
use Hub\Pool\BasePool;
/**
// Own namespace
namespace Hub\Handler\Protocol;
-// Import hub-specific sutff
+// Import application-specific sutff
+use Hub\Locator\Node\UniversalNodeLocator;
use Hub\Tools\HubTools;
/**
<?php
+// Own namespace
+namespace Hub\Handler\Protocol\Network\IpV4;
+
+// Import application-specific stuff
+use Hub\Locator\Node\UniversalNodeLocator;
+use Hub\Network\Package\NetworkPackage;
+
/**
* A general handler for IPv4 protocols such as TCP, UDP and others.
*
<?php
+// Own namespace
+namespace Hub\Handler\Network\;
+
+// Import application-specific stuff
+use Hub\Network\Networkable;
+
/**
* A ??? network package handler
*
// Own namespace
namespace Hub\Handler\Data;
+// Import application-specific stuff
+use Hub\Network\Deliver\Deliverable;
+
// Import framework stuff
use CoreFramework\Factory\ObjectFactory;
use CoreFramework\Generic\FrameworkException;
// Own namespace
namespace Hub\Handler\RawData;
+// Import application-specific stuff
+use Hub\Network\Networkable;
+
/**
* A !!! raw data handler
*
// Own namespace
namespace Hub\Handler\Raw;
+// Import application-specific stuff
+use Hub\Network\Package\NetworkPackage;
+
// Import framework stuff
use CoreFramework\Factory\ObjectFactory;
use CoreFramework\Handler\BaseHandler;
// Import application-specific stuff
use Hub\Helper\BaseHubSystemHelper;
+use Hub\Network\Package\NetworkPackage;
/**
* A ??? !!! helper class
// Import application-specific stuff
use Hub\Factory\Fragmenter\FragmenterFactory;
use Hub\Helper\BaseHubSystemHelper;
+use Hub\Network\Package\NetworkPackage;
// Import framework stuff
use CoreFramework\Factory\ObjectFactory;
// Import application-specific stuff
use Hub\Helper\Connection\BaseConnectionHelper;
+use Hub\Locator\Node\UniversalNodeLocator;
/**
* A ??? connection helper class
// Import application-specific stuff
use Hub\Helper\Connection\ConnectionHelper;
+use Hub\Locator\Node\UniversalNodeLocator;
+use Hub\Network\Package\NetworkPackage;
use Hub\Tools\HubTools;
/**
// Import hub-specific stuff
use Hub\Generic\BaseHubSystem;
use Hub\Helper\BaseHubSystemHelper;
+use Hub\Network\Package\NetworkPackage;
/**
* A Bootstrap Dht helper class
// Import hub-specific stuff
use Hub\Generic\BaseHubSystem;
use Hub\Helper\BaseHubSystemHelper;
+use Hub\Network\Package\NetworkPackage;
/**
* A PublishingEntry Dht helper class
// Import application-specific stuff
use Hub\Helper\Node\NodeHelper;
+use Hub\Network\Package\NetworkPackage;
/**
* A helper class for announcing this node to other nodes
// Import application-specific stuff
use Hub\Helper\Node\NodeHelper;
+use Hub\Network\Package\NetworkPackage;
/**
* A ??? hub helper class
// Import application-specific stuff
use Hub\Helper\Node\NodeHelper;
+use Hub\Network\Package\NetworkPackage;
/**
* A SelfConnect hub helper class
// Import application-specific stuff
use Hub\Helper\Node\NodeHelper;
+use Hub\Network\Package\NetworkPackage;
/**
* A ??? hub helper class
namespace Hub\Information\Connection;
// Import application-specific stuff
+use Hub\Helper\Connection\ConnectionHelper;
use Hub\Information\BaseInfo;
use Hub\Information\ShareableInfo;
+use Hub\Locator\Node\UniversalNodeLocator;
// Import framework stuff
use CoreFramework\Listener\Listenable;
namespace Hub\Listener;
// Import application-specific stuff
-use Hub\Pool\Poolable;
+use Hub\Network\Package\NetworkPackage;
+use Hub\Pool\Peer\PoolablePeer;
// Import framework stuff
use CoreFramework\Factory\Connection\ConnectionInfoFactory;
/**
* Setter for peer pool instance
*
- * @param $poolInstance The peer pool instance we shall set
+ * @param $poolInstance An instance of a PoolablePeer class
* @return void
*/
protected final function setPoolInstance (PoolablePeer $poolInstance) {
/**
* Getter for peer pool instance
*
- * @return $poolInstance The peer pool instance we shall set
+ * @return $poolInstance An instance of a PoolablePeer class
*/
public final function getPoolInstance () {
return $this->poolInstance;
// Own namespace
namespace Hub\Listener;
+// Import application-specific stuff
+use Hub\Network\Networkable;
+
// Import framework stuff
use CoreFramework\Generic\BaseDecorator;
use CoreFramework\Visitor\Visitable;
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;
// Import hub-specific stuff
use Hub\Generic\BaseHubSystem;
+use Hub\Network\Package\NetworkPackage;
use Hub\Network\Receive\Receivable;
// Import framework stuff
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;
// 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;
// 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;
* 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 DefaultListenerPool extends BasePool implements Poolable {
+class DefaultListenerPool extends BasePool implements PoolableListener {
/**
* Protected constructor
*
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;
* 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
// 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;
namespace Hub\Network\Recipient\Direct;
// Import hub-specific sutff
+use Hub\Network\Package\NetworkPackage;
use Hub\Tools\HubTools;
// Import framework stuff
namespace Hub\Network\Recipient\Self;
// Import hub-specific sutff
+use Hub\Network\Package\NetworkPackage;
use Hub\Tools\HubTools;
// Import framework stuff
// Import hub-specific stuff
use Hub\Generic\BaseHubSystem;
+use Hub\Network\Package\NetworkPackage;
// Import framework stuff
use CoreFramework\Lists\Listable;
// 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
namespace Hub\Tag\Network;
// Import application-specific stuff
+use Hub\Network\Package\NetworkPackage;
// Import framework stuff
use CoreFramework\Listener\Listenable;
*
* @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
// Import application-specific stuff
use Hub\Helper\Connection\ConnectionHelper;
+use Hub\Network\Deliver\Deliverable;
// Import framework stuff
use CoreFramework\Visitor\BaseVisitor;
// Import application-specific stuff
use Hub\Helper\Connection\ConnectionHelper;
+use Hub\Network\Deliver\Deliverable;
// Import framework stuff
use CoreFramework\Visitor\BaseVisitor;
$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');
$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');
<?php
+// Own namespace
+namespace Hub\RawData;
+
+// Import application-specific stuff
+use Hub\Network\Package\NetworkPackage;
+
/**
* This exception is thrown when the checksum (sometimes called "hash") of the
* package data (aka "message" emcoded with BASE64) is not valid.
<?php
+// Own namespace
+namespace Hub\Status\Package;
+
+// Import application-specific stuff
+use Hub\Network\Package\NetworkPackage;
+
/**
* This exception is thrown when an unexpected package status was detected.
*
<?php
+// Own namespace
+namespace Hub\Peer;
+
+// Import application-specific stuff
+use Hub\Network\Package\NetworkPackage;
+
/**
* This exception is thrown when a peer is already registered
*
// Own namespace
namespace Hub\Socket;
+// Import application-specific stuff
+use Hub\Helper\Connection\ConnectionHelper;
+
/**
* This exception is thrown if the socket cannot be shut down is not error 107
* which is "Transport endpoint not connected".
<?php
+// Own namespace
+namespace Hub\Unl;
+
+// Import application-specific stuff
+use Hub\Network\Package\NetworkPackage;
+
/**
* This exception is thrown when a protocol handler cannot validate given package data's recipient (UNL).
*
<?php
+// Own namespace
+namespace Hub\Network;
+
/**
* A Networkable interface
*
// Own namespace
namespace Hub\Network\Receive;
+// Import application-specific stuff
+use Hub\Network\Networkable;
+
// Import framework stuff
use CoreFramework\Generic\FrameworkInterface;
// Import framework stuff
use CoreFramework\Generic\FrameworkInterface;
-use CoreFramework\Listener\Listenable;
/**
* A Poolable interface
*/
function preShutdown ();
- /**
- * Adds a listener instance to this pool
- *
- * @param $poolInstance An instance of a Listenable class
- * @return void
- */
- function addListener (Listenable $poolInstance);
-
}
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+// Own namespace
+namespace Hub\Pool\Listener;
+
+// Import application-specific stuff
+use Hub\Pool\Poolable;
+
+// Import framework stuff
+use CoreFramework\Listener\Listenable;
+
+/**
+ * A Poolable interface for listener
+ *
+ * @author Roland Haeder <webmaster@ship-simu.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.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 <http://www.gnu.org/licenses/>.
+ */
+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);
+
+}
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+// Own namespace
+namespace Hub\Pool\Peer;
+
+// Import application-specific stuff
+use Hub\Pool\Poolable;
+use Hub\Tag\Socket\SocketTag;
+
+/**
+ * An interface for peer pools
+ *
+ * @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 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);
+
+}
// Own namespace
namespace Hub\Resolver\State;
+// Import application-specific stuff
+use Hub\Helper\Connection\ConnectionHelper;
+
// Import framework stuff
use CoreFramework\Resolver\Resolver;
// 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;
* @throws InvalidConnectionTypeException If the provided connection type is not valid
*/
function getSocketFromPackageData (array $packageData, $connectionType = NULL);
-}
-// [EOF]
-?>
+}