]> git.mxchange.org Git - hub.git/commitdiff
Network package handling added (unfinished)
authorRoland Häder <roland@mxchange.org>
Sat, 8 Aug 2009 21:25:15 +0000 (21:25 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 8 Aug 2009 21:25:15 +0000 (21:25 +0000)
- Interfaces for handling of network packages (Networkable) added
- Base classes and first TCP network package handler added
- Prefix gos- removed from ZIP file name (package.sh)

22 files changed:
.gitattributes
application/hub/config.php
application/hub/interfaces/handler/.htaccess [new file with mode: 0644]
application/hub/interfaces/handler/class_Handleable.php [new file with mode: 0644]
application/hub/interfaces/handler/network/.htaccess [new file with mode: 0644]
application/hub/interfaces/handler/network/class_Networkable.php [new file with mode: 0644]
application/hub/main/class_
application/hub/main/class_Base
application/hub/main/handler/.htaccess [new file with mode: 0644]
application/hub/main/handler/class_ [new file with mode: 0644]
application/hub/main/handler/class_BaseHandler.php [new file with mode: 0644]
application/hub/main/handler/network/.htaccess [new file with mode: 0644]
application/hub/main/handler/network/class_ [new file with mode: 0644]
application/hub/main/handler/network/class_BaseNetworkPackageHandler.php [new file with mode: 0644]
application/hub/main/handler/network/tcp/.htaccess [new file with mode: 0644]
application/hub/main/handler/network/tcp/class_TcpNetworkPackageHandler.php [new file with mode: 0644]
application/hub/main/handler/network/udp/.htaccess [new file with mode: 0644]
application/hub/main/handler/network/udp/class_UdpNetworkPackageHandler.php [new file with mode: 0644]
application/hub/main/iterator/class_
application/hub/main/listener/class_BaseListener.php
application/hub/main/listener/tcp/class_TcpListener.php
package.sh

index eda6bd36020ac6c8e41c73a24e3c6af31374539e..338447b5de3c36cd3c0573db648226ed0a709e8b 100644 (file)
@@ -16,6 +16,10 @@ application/hub/init.php -text
 application/hub/interfaces/.htaccess -text
 application/hub/interfaces/connectors/.htaccess -text
 application/hub/interfaces/connectors/class_Connectable.php -text
+application/hub/interfaces/handler/.htaccess -text
+application/hub/interfaces/handler/class_Handleable.php -text
+application/hub/interfaces/handler/network/.htaccess -text
+application/hub/interfaces/handler/network/class_Networkable.php -text
 application/hub/interfaces/listener/.htaccess -text
 application/hub/interfaces/listener/class_Listenable.php -text
 application/hub/interfaces/lists/.htaccess -text
@@ -97,6 +101,16 @@ application/hub/main/filter/shutdown/class_HubShutdownDeinitQueuesFilter.php -te
 application/hub/main/filter/shutdown/class_HubShutdownFlushNodeListFilter.php -text
 application/hub/main/filter/shutdown/class_HubShutdownListenerPoolFilter.php -text
 application/hub/main/filter/shutdown/class_HubShutdownNodeFilter.php -text
+application/hub/main/handler/.htaccess -text
+application/hub/main/handler/class_ -text
+application/hub/main/handler/class_BaseHandler.php -text
+application/hub/main/handler/network/.htaccess -text
+application/hub/main/handler/network/class_ -text
+application/hub/main/handler/network/class_BaseNetworkPackageHandler.php -text
+application/hub/main/handler/network/tcp/.htaccess -text
+application/hub/main/handler/network/tcp/class_TcpNetworkPackageHandler.php -text
+application/hub/main/handler/network/udp/.htaccess -text
+application/hub/main/handler/network/udp/class_UdpNetworkPackageHandler.php -text
 application/hub/main/iterator/.htaccess -text
 application/hub/main/iterator/class_ -text
 application/hub/main/iterator/class_BaseIterator.php -text
index 2f9a39e84dba0c0b05520c736a364ab7506a2c6e..ddf8b6fd43b66d2142a3b0affd1b70ac7a60494f 100644 (file)
@@ -102,6 +102,9 @@ $cfg->setConfigEntry('handler_pool_iterator_class', 'HandlerPoolIterator');
 // CFG: NETWORK-LISTEN-ITERATOR-CLASS
 $cfg->setConfigEntry('network_listen_iterator_class', 'NetworkListenIterator');
 
+// CFG: NETWORK-PACKAGE-HANDLER-CLASS
+$cfg->setConfigEntry('tcp_network_package_handler_class', 'TcpNetworkPackageHandler');
+
 // CFG: LIST-GROUP-CLASS
 $cfg->setConfigEntry('list_group_class', 'ListGroupList');
 
diff --git a/application/hub/interfaces/handler/.htaccess b/application/hub/interfaces/handler/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/interfaces/handler/class_Handleable.php b/application/hub/interfaces/handler/class_Handleable.php
new file mode 100644 (file)
index 0000000..a143bce
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ * A Handleable interface
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Core 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 Handleable extends FrameworkInterface {
+}
+
+//
+?>
diff --git a/application/hub/interfaces/handler/network/.htaccess b/application/hub/interfaces/handler/network/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/interfaces/handler/network/class_Networkable.php b/application/hub/interfaces/handler/network/class_Networkable.php
new file mode 100644 (file)
index 0000000..bb4ce50
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ * A Networkable interface
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Core 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 Networkable extends Handleable {
+}
+
+//
+?>
index 2afb25d1d83f6076a4030bcc14e6eb88c3d8e0d5..9f2dcb69606a525ba25c57d74e3bfd15cfcf59a7 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * 
+ * A ???
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
@@ -21,7 +21,7 @@
  * 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 ??? extends BaseHubSystem {
+class ??? extends BaseFrameworkSystem {
        /**
         * Protected constructor
         *
@@ -31,6 +31,19 @@ class ??? extends BaseHubSystem {
                // Call parent constructor
                parent::__construct(__CLASS__);
        }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $!!!Instance            An instance of a === class
+        */
+       public final static function create??? () {
+               // Get new instance
+               $!!!Instance = new ???();
+
+               // Return the prepared instance
+               return $!!!Instance;
+       }
 }
 
 // [EOF]
index 6e9a679eb742edb4090303199843c93e3e6292e7..d0122d6156f2964ebf73bca81d9f3d988ae52a2f 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * A general 
+ * A general ???
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
diff --git a/application/hub/main/handler/.htaccess b/application/hub/main/handler/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/handler/class_ b/application/hub/main/handler/class_
new file mode 100644 (file)
index 0000000..e8c9d36
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/**
+ * A ??? handler
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 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/>.
+ */
+class ???Handler extends BaseHandler {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $handlerInstance                An instance of a !!! class
+        */
+       public final static function create???Handler () {
+               // Get new instance
+               $handlerInstance = new ???Handler();
+
+               // Return the prepared instance
+               return $handlerInstance;
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/handler/class_BaseHandler.php b/application/hub/main/handler/class_BaseHandler.php
new file mode 100644 (file)
index 0000000..ca40234
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+/**
+ * A general Handler
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 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/>.
+ */
+class BaseHandler extends BaseHubSystem {
+       /**
+        * Protected constructor
+        *
+        * @param       $className      Name of the class
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/handler/network/.htaccess b/application/hub/main/handler/network/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/handler/network/class_ b/application/hub/main/handler/network/class_
new file mode 100644 (file)
index 0000000..57d7a75
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/**
+ * A ??? network package handler
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 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/>.
+ */
+class ???NetworkPackageHandler extends BaseNetworkPackageHandler implements !!! {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $handlerInstance                An instance of a !!! class
+        */
+       public final static function create???NetworkPackageHandler () {
+               // Get new instance
+               $handlerInstance = new ???NetworkPackageHandler();
+
+               // Return the prepared instance
+               return $handlerInstance;
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/handler/network/class_BaseNetworkPackageHandler.php b/application/hub/main/handler/network/class_BaseNetworkPackageHandler.php
new file mode 100644 (file)
index 0000000..b9762e3
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+/**
+ * A general Handler
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 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/>.
+ */
+class BaseNetworkPackageHandler extends BaseHandler {
+       /**
+        * Protected constructor
+        *
+        * @param       $className      Name of the class
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/handler/network/tcp/.htaccess b/application/hub/main/handler/network/tcp/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/handler/network/tcp/class_TcpNetworkPackageHandler.php b/application/hub/main/handler/network/tcp/class_TcpNetworkPackageHandler.php
new file mode 100644 (file)
index 0000000..805c762
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/**
+ * A TCP network package handler
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 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/>.
+ */
+class TcpNetworkPackageHandler extends BaseNetworkPackageHandler implements Networkable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $handlerInstance                An instance of a !!! class
+        */
+       public final static function createTcpNetworkPackageHandler () {
+               // Get new instance
+               $handlerInstance = new TcpNetworkPackageHandler();
+
+               // Return the prepared instance
+               return $handlerInstance;
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/handler/network/udp/.htaccess b/application/hub/main/handler/network/udp/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/handler/network/udp/class_UdpNetworkPackageHandler.php b/application/hub/main/handler/network/udp/class_UdpNetworkPackageHandler.php
new file mode 100644 (file)
index 0000000..ce6489d
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/**
+ * A UDP network package handler
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 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/>.
+ */
+class UdpNetworkPackageHandler extends BaseNetworkPackageHandler implements Networkable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $handlerInstance                An instance of a !!! class
+        */
+       public final static function createUdpNetworkPackageHandler () {
+               // Get new instance
+               $handlerInstance = new UdpNetworkPackageHandler();
+
+               // Return the prepared instance
+               return $handlerInstance;
+       }
+}
+
+// [EOF]
+?>
index a259cea5c3b2d5260a7881cc554fa152c71df2e2..0a44b5d6e2dd14067c72f176db716e7cbf0ed944 100644 (file)
@@ -35,7 +35,7 @@ class ???Iterator extends BaseIterator implements Iterator {
        /**
         * Creates an instance of this class
         *
-        * @return      $iteratorInstance               An instance a Iterator class
+        * @return      $iteratorInstance               An instance of a Iterator class
         */
        public final static function create???Iterator () {
                // Get new instance
index c53d81e91569f522f90bd6dd9212bdbaebf33166..8b28acd0c16b4fc2c252463792c0b093c7c57de5 100644 (file)
@@ -55,6 +55,11 @@ class BaseListener extends BaseHubSystem implements Visitable {
         */
        private $poolInstance = null;
 
+       /**
+        * A network package handler instance
+        */
+       private $packageInstance = null;
+
        /**
         * Protected constructor
         *
@@ -200,6 +205,25 @@ class BaseListener extends BaseHubSystem implements Visitable {
                return $this->poolInstance;
        }
 
+       /**
+        * Setter for network package handler instance
+        *
+        * @param       $packageInstance        The network package handler instance we shall set
+        * @return      void
+        */
+       protected final function setPackageInstance (Networkable $packageInstance) {
+               $this->packageInstance = $packageInstance;
+       }
+
+       /**
+        * Getter for network package handler instance
+        *
+        * @return      $packageInstance        The network package handler instance we shall set
+        */
+       protected final function getPackageInstance () {
+               return $this->packageInstance;
+       }
+
        /**
         * Accepts the visitor to rpocess the visit "request"
         *
index d7d3de766a59e83fba57d87269b83170f3a94914..df8b0111d1812133db023bb80043a169baedb4f6 100644 (file)
@@ -143,6 +143,12 @@ class TcpListener extends BaseListener implements Listenable {
                $iteratorInstance->rewind();
                $this->setIteratorInstance($iteratorInstance);
 
+               // Initialize the network package handler
+               $packageInstance = ObjectFactory::createObjectByConfiguredName('tcp_network_package_handler_class');
+
+               // Set it in this class
+               $this->setPackageInstance($packageInstance);
+
                // Output message
                $this->debugOutput('LISTENER: TCP listener now ready on IP ' . $this->getListenAddress() . ', port ' . $this->getListenPort() . ' for service.');
        }
@@ -185,11 +191,10 @@ class TcpListener extends BaseListener implements Listenable {
                $current = $this->getIteratorInstance()->current();
 
                // Handle it here
-               $this->partialStub('current['.gettype($current).']='.$current);
+               $this->getPackageInstance()->processPackage($current);
 
                // Advance to next entry. This should be the last line
                $this->getIteratorInstance()->next();
-               die("OK!\n");
        }
 }
 
index c7d12c053abccb8912baddf8ac23ce0bf8d56e71..efb23331713544e215418f5e8e6285879e47f8bc 100755 (executable)
@@ -3,14 +3,14 @@
 sh ./clear-cache.sh
 
 echo -n "$0: Packaging... "
-zip -9 gos-hub_dev.zip docs/* Doxyfile *.php *.sh > /dev/null 2>&1
+zip -9 hub_dev.zip docs/* Doxyfile *.php *.sh > /dev/null 2>&1
 echo -n "."
-zip -9r gos-hub_dev.zip application/ db/ devel/ Doxyfile inc/ templates/ tests/ > /dev/null 2>&1
+zip -9r hub_dev.zip application/ db/ devel/ Doxyfile inc/ templates/ tests/ > /dev/null 2>&1
 echo -n "."
-zip -d gos-hub_dev.zip docs/warn.log db/*/*.serialized > /dev/null 2>&1
+zip -d hub_dev.zip docs/warn.log db/*/*.serialized > /dev/null 2>&1
 echo ". done"
 
 echo "$0: Renaming..."
-mv gos-hub_dev.zip gos-hub_dev_`date +%Y%m%d_%H%M%S`.zip
+mv hub_dev.zip hub_dev_`date +%Y%m%d_%H%M%S`.zip
 
 echo "$0: All done."