use Hub\Handler\RawData\BaseRawDataHandler;
use Hub\Information\ShareableInfo;
use Hub\Listener\BaseListener;
+use Hub\Listener\Listenable;
use Hub\Network\Deliver\Deliverable;
use Hub\Network\Receive\Receivable;
use Hub\Pool\Poolable;
// Import framework stuff
-use CoreFramework\Listener\Listenable;
use CoreFramework\Object\BaseFrameworkSystem;
use CoreFramework\Socket\InvalidSocketException;
use Hub\Helper\Connection\BaseConnectionHelper;
use Hub\Information\ShareableInfo;
use Hub\Listener\BaseListener;
+use Hub\Listener\Listenable;
use Hub\Network\Package\NetworkPackage;
// Import framework stuff
use CoreFramework\Container\BaseContainer;
use CoreFramework\Factory\ObjectFactory;
-use CoreFramework\Listener\Listenable;
use CoreFramework\Registry\Registerable;
use CoreFramework\Socket\InvalidSocketException;
use CoreFramework\Socket\NoSocketErrorDetectedException;
use Hub\Generic\BaseHubSystem;
use Hub\Handler\Protocol\HandleableProtocol;
use Hub\Helper\Connection\BaseConnectionHelper;
+use Hub\Listener\Listenable;
use Hub\Network\Package\NetworkPackage;
// Import framework stuff
-use CoreFramework\Listener\Listenable;
use CoreFramework\Registry\Registerable;
use CoreFramework\Registry\Registry;
use CoreFramework\Socket\InvalidSocketException;
/**
* Creates a client object for given protocol. This method uses the
- * registry pattern to cache those instances.
+ * registry pattern to cache those instances. Please note that on an
+ * existing instance, the provided socket instance is being set and
+ * overwrites the existing one.
*
* @param $protocolInstance An instance of a HandleableProtocol class to create a client object for (e.g. 'http' for a HTTP/1.1 client)
* @param $socketInstance An instance of a StorableSocket class (or NULL)
// Import application-specific stuff
use Hub\Handler\Protocol\HandleableProtocol;
use Hub\Listener\BaseListener;
+use Hub\Listener\Listenable;
use Hub\Network\Package\NetworkPackage;
// Import framework stuff
use CoreFramework\Bootstrap\FrameworkBootstrap;
use CoreFramework\Configuration\FrameworkConfiguration;
use CoreFramework\Factory\ObjectFactory;
-use CoreFramework\Listener\Listenable;
use CoreFramework\Registry\Registry;
use CoreFramework\Socket\InvalidSocketException;
// Import application-specific stuff
use Hub\Helper\Node\NodeHelper;
use Hub\Listener\BaseListener;
+use Hub\Listener\Listenable;
// Import framework stuff
-use CoreFramework\Listener\Listenable;
use CoreFramework\Visitor\Visitable;
<?php
use Hub\Helper\Connection\ConnectionHelper;
use Hub\Information\BaseInfo;
use Hub\Information\ShareableInfo;
+use Hub\Listener\Listenable;
use Hub\Locator\Node\LocateableNode;
// Import framework stuff
-use CoreFramework\Listener\Listenable;
use CoreFramework\Registry\Registerable;
/**
// Import application-specific stuff
use Hub\Listener\BaseListener;
+use Hub\Listener\Listenable;
// Import framework stuff
-use CoreFramework\Listener\Listenable;
/**
* A ??? listener
*/
private $poolInstance = NULL;
+ /**
+ * A StorableSocket instance
+ */
+ private $socketInstance = NULL;
+
/**
* Protected constructor
*
$this->getIteratorInstance()->next();
}
+ /**
+ * Setter for socket instance
+ *
+ * @param $socketInstance A StorableSocket instance
+ * @return void
+ */
+ public final function setSocketInstance (StorableSocket $socketInstance) {
+ $this->socketInstance = $socketInstance;
+ }
+
+ /**
+ * Getter for socket instance
+ *
+ * @return $socketInstance An instance of a StorableSocket class
+ */
+ public final function getSocketInstance () {
+ return $this->socketInstance;
+ }
+
}
use Hub\Factory\Socket\SocketFactory;
use Hub\Helper\Connection\BaseConnectionHelper;
use Hub\Listener\BaseListener;
+use Hub\Listener\Listenable;
// Import framework stuff
use CoreFramework\Bootstrap\FrameworkBootstrap;
use CoreFramework\Factory\ObjectFactory;
-use CoreFramework\Listener\Listenable;
/**
* A file-based socket listener
// Import application-specific stuff
use Hub\Listener\BaseListenerDecorator;
+use Hub\Listener\Listenable;
// Import framework stuff
-use CoreFramework\Listener\Listenable;
/**
* A decorator for the SocketFileListener to communicate to hubs
// Import application-specific stuff
use Hub\Helper\Node\NodeHelper;
use Hub\Listener\BaseListener;
+use Hub\Listener\Listenable;
// Import framework stuff
-use CoreFramework\Listener\Listenable;
use CoreFramework\Visitor\Visitable;
<?php
// Import application-specific stuff
use Hub\Helper\Connection\BaseConnectionHelper;
use Hub\Listener\BaseListener;
+use Hub\Listener\Listenable;
// Import framework stuff
use CoreFramework\Factory\ObjectFactory;
use CoreFramework\Generic\UnsupportedOperationException;
-use CoreFramework\Listener\Listenable;
/**
* A TCP connection listener
// Import application-specific stuff
use Hub\Listener\BaseListenerDecorator;
+use Hub\Listener\Listenable;
// Import framework stuff
-use CoreFramework\Listener\Listenable;
/**
* A decorator for the TcpListener to communicate to peers
// Import application-specific stuff
use Hub\Listener\BaseListenerDecorator;
+use Hub\Listener\Listenable;
// Import framework stuff
-use CoreFramework\Listener\Listenable;
/**
* A decorator for the TcpListener to communicate to hubs
// Import application-specific stuff
use Hub\Helper\Node\NodeHelper;
use Hub\Listener\BaseListener;
+use Hub\Listener\Listenable;
// Import framework stuff
-use CoreFramework\Listener\Listenable;
/**
* An UDP ??? listener
// Import application-specific stuff
use Hub\Listener\BaseListener;
+use Hub\Listener\Listenable;
// Import framework stuff
use CoreFramework\Factory\ObjectFactory;
-use CoreFramework\Listener\Listenable;
/**
* An UDP connection listener
// Import application-specific stuff
use Hub\Listener\BaseListenerDecorator;
+use Hub\Listener\Listenable;
// Import framework stuff
-use CoreFramework\Listener\Listenable;
/**
* A decorator for the UdpListener to communicate to peers
// Import application-specific stuff
use Hub\Listener\BaseListenerDecorator;
+use Hub\Listener\Listenable;
// Import framework stuff
-use CoreFramework\Listener\Listenable;
/**
* A decorator for the UdpListener to communicate to hubs
namespace Hub\Pool\;
// Import application-specific stuff
+use Hub\Listener\Listenable;
use Hub\Pool\BasePool;
use Hub\Pool\Poolable;
// Import framework stuff
-use CoreFramework\Listener\Listenable;
/**
*
// Import application-specific stuff
use Hub\Helper\Node\NodeHelper;
+use Hub\Listener\Listenable;
use Hub\Pool\BasePool;
use Hub\Pool\Listener\PoolableListener;
// Import framework stuff
use CoreFramework\Factory\ObjectFactory;
-use CoreFramework\Listener\Listenable;
/**
* A default listener pool
// Import application-specific stuff
use Hub\Container\Socket\StorableSocket;
+use Hub\Listener\Listenable;
use Hub\Locator\Node\LocateableNode;
use Hub\Network\Package\NetworkPackage;
use Hub\Pool\BasePool;
use Hub\Pool\Peer\PoolablePeer;
// Import framework stuff
-use CoreFramework\Listener\Listenable;
use CoreFramework\Socket\InvalidSocketException;
/**
use Hub\Factory\Information\Connection\ConnectionInfoFactory;
use Hub\Information\ShareableInfo;
use Hub\Listener\BaseListener;
+use Hub\Listener\Listenable;
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 CoreFramework\Registry\Sub\SubRegistry;
namespace Hub\Tag\Network;
// Import application-specific stuff
+use Hub\Listener\Listenable;
use Hub\Network\Package\NetworkPackage;
// Import framework stuff
-use CoreFramework\Listener\Listenable;
use CoreFramework\Registry\Registry;
/**
namespace Hub\Visitor\Monitor\Pool;
// Import application-specific stuff
+use Hub\Listener\Listenable;
use Hub\Network\Receive\Receivable;
use Hub\Pool\Poolable;
// Import framework stuff
-use CoreFramework\Listener\Listenable;
use CoreFramework\Visitor\BaseVisitor;
/**
namespace Hub\Visitor\Pool\Listener;
// Import application-specific stuff
+use Hub\Listener\Listenable;
use Hub\Pool\Poolable;
// Import framework stuff
-use CoreFramework\Listener\Listenable;
use CoreFramework\Visitor\BaseVisitor;
/**
namespace Hub\Visitor\Task\Active;
// Import application-specific stuff
+use Hub\Listener\Listenable;
use Hub\Pool\Poolable;
use Hub\Visitor\Pool\PoolVisitor;
// Import framework stuff
use CoreFramework\Generic\BaseDecorator;
-use CoreFramework\Listener\Listenable;
use CoreFramework\Task\Taskable;
use CoreFramework\Visitor\BaseVisitor;
use CoreFramework\Visitor\Decorator\DecoratorVisitor;
namespace Hub\Visitor\Task\Shutdown;
// Import application-specific stuff
+use Hub\Listener\Listenable;
use Hub\Pool\Poolable;
use Hub\Visitor\Pool\PoolVisitor;
// Import framework stuff
use CoreFramework\Generic\BaseDecorator;
-use CoreFramework\Listener\Listenable;
use CoreFramework\Task\Taskable;
use CoreFramework\Visitor\BaseVisitor;
use CoreFramework\Visitor\Decorator\DecoratorVisitor;
*/
function getSessionId ();
+ /**
+ * Setter for socket instance
+ *
+ * @param $socketInstance A StorableSocket instance
+ * @return void
+ */
+ function setSocketInstance (StorableSocket $socketInstance);
+
+ /**
+ * Getter for socket instance
+ *
+ * @return $socketInstance An instance of a StorableSocket class
+ */
+ function getSocketInstance ();
+
}
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+// Own namespace
+namespace Hub\Listener;
+
+// Import application-specific stuff
+use Hub\Generic\HubInterface;
+
+/**
+ * An interface for listeners
+ *
+ * @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 Listenable extends HubInterface {
+ /**
+ * Initializes the listener by setting up the required socket server
+ *
+ * @return void
+ */
+ function initListener();
+
+ /**
+ * "Listens" for incoming network packages
+ *
+ * @return void
+ */
+ function doListen();
+
+ /**
+ * Checks whether the listener would accept the given package data array
+ *
+ * @param $packageData Raw package data
+ * @return $accepts Whether this listener does accept
+ */
+ function ifListenerAcceptsPackageData (array $packageData);
+
+ /**
+ * Monitors incoming raw data from the handler and transfers it to the
+ * given receiver instance.
+ *
+ * @return void
+ */
+ function monitorIncomingRawData ();
+
+ /**
+ * Getter for listen address
+ *
+ * @return $listenAddress The address this listener should listen on
+ */
+ function getListenAddress ();
+
+ /**
+ * Getter for listen port
+ *
+ * @return $listenPort The port this listener should listen on
+ */
+ function getListenPort ();
+
+ /**
+ * Getter for connection type
+ *
+ * @return $connectionType Connection type for this listener
+ */
+ function getConnectionType ();
+
+ /**
+ * Getter for peer pool instance
+ *
+ * @return $poolInstance The peer pool instance we shall set
+ */
+ function getPoolInstance ();
+
+}
namespace Hub\Pool\Listener;
// Import application-specific stuff
+use Hub\Listener\Listenable;
use Hub\Pool\Poolable;
// Import framework stuff
-use CoreFramework\Listener\Listenable;
/**
* A Poolable interface for listener
// Import application-specific stuff
use Hub\Container\Socket\StorableSocket;
use Hub\Information\ShareableInfo;
+use Hub\Listener\Listenable;
// Import framework stuff
-use CoreFramework\Listener\Listenable;
use CoreFramework\Registry\Registerable;
/**
// Import application-specific stuff
use Hub\Helper\Connection\ConnectionHelper;
+use Hub\Listener\Listenable;
// Import application-specific stuff
use Hub\Generic\HubInterface;
// Import framework stuff
-use CoreFramework\Listener\Listenable;
/**
* An interface for shareable informations
// Import application-specific stuff
use Hub\Generic\HubInterface;
+use Hub\Listener\Listenable;
// Import framework stuff
-use CoreFramework\Listener\Listenable;
/**
* An interface for tags
// Own namespace
namespace Hub\Visitor\Pool\Listener;
+// Import application-specific stuff
+use Hub\Listener\Listenable;
+
// Import framework stuff
-use CoreFramework\Listener\Listenable;
/**
* An interface for the visitor implementation for pools
-Subproject commit 6751244349667c1165f05a319f3d66d3f6781b40
+Subproject commit ca40302a326b814bbd5273a0540e18d672cf2d70