]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/class_BaseHubSystem.php
Continued with hub:
[hub.git] / application / hub / main / class_BaseHubSystem.php
index a14384e1cfa5d9db6e036d168645a412dedb38c5..c924c4e17c863e2d632e6fc4877a51489598eea3 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Hub Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  *
@@ -31,7 +31,9 @@ class BaseHubSystem extends BaseFrameworkSystem {
        const EXCEPTION_BASE64_ENCODING_NOT_MODULO_4  = 0x905;
        const EXCEPTION_NODE_SESSION_ID_NOT_VERIFYING = 0x906;
        const EXCEPTION_REQUEST_NOT_ACCEPTED          = 0x907;
-       const SOCKET_ERROR_CONNECTION_RESET_BY_PEER   = 0x908;
+       const EXCEPTION_DHT_BOOTSTRAP_NOT_ACCEPTED    = 0x908;
+       const EXCEPTION_MULTIPLE_MESSAGE_SENT         = 0x909;
+       const EXCEPTION_DHT_BOOTSTRAP_NOT_ATTEMPTED   = 0x90a;
 
        // Message status codes
        const MESSAGE_STATUS_CODE_OKAY = 'OKAY';
@@ -46,11 +48,26 @@ class BaseHubSystem extends BaseFrameworkSystem {
         */
        private $nodeInstance = NULL;
 
+       /**
+        * An instance of a communicator
+        */
+       private $communicatorInstance = NULL;
+
+       /**
+        * An instance of a crawler
+        */
+       private $crawlerInstance = NULL;
+
        /**
         * An instance of a cruncher
         */
        private $cruncherInstance = NULL;
 
+       /**
+        * An instance of a miner
+        */
+       private $minerInstance = NULL;
+
        /**
         * Listener instance
         */
@@ -91,6 +108,11 @@ class BaseHubSystem extends BaseFrameworkSystem {
         */
        private $assemblerInstance = NULL;
 
+       /**
+        * Name of used protocol
+        */
+       private $protocolName = 'invalid';
+
        /**
         * Protected constructor
         *
@@ -121,6 +143,44 @@ class BaseHubSystem extends BaseFrameworkSystem {
                $this->nodeInstance = $nodeInstance;
        }
 
+       /**
+        * Getter for communicator instance
+        *
+        * @return      $communicatorInstance   An instance of a Communicator class
+        */
+       public final function getCommunicatorInstance () {
+               return $this->communicatorInstance;
+       }
+
+       /**
+        * Setter for communicator instance
+        *
+        * @param       $communicatorInstance   An instance of a Communicator class
+        * @return      void
+        */
+       protected final function setCommunicatorInstance (Communicator $communicatorInstance) {
+               $this->communicatorInstance = $communicatorInstance;
+       }
+
+       /**
+        * Getter for crawler instance
+        *
+        * @return      $crawlerInstance        An instance of a Crawler class
+        */
+       public final function getCrawlerInstance () {
+               return $this->crawlerInstance;
+       }
+
+       /**
+        * Setter for crawler instance
+        *
+        * @param       $crawlerInstance        An instance of a Crawler class
+        * @return      void
+        */
+       protected final function setCrawlerInstance (Crawler $crawlerInstance) {
+               $this->crawlerInstance = $crawlerInstance;
+       }
+
        /**
         * Getter for cruncher instance
         *
@@ -140,6 +200,25 @@ class BaseHubSystem extends BaseFrameworkSystem {
                $this->cruncherInstance = $cruncherInstance;
        }
 
+       /**
+        * Getter for miner instance
+        *
+        * @return      $minerInstance  An instance of a miner miner
+        */
+       public final function getMinerInstance () {
+               return $this->minerInstance;
+       }
+
+       /**
+        * Setter for miner instance
+        *
+        * @param       $minerInstance  An instance of a miner miner
+        * @return      void
+        */
+       protected final function setMinerInstance (MinerHelper $minerInstance) {
+               $this->minerInstance = $minerInstance;
+       }
+
        /**
         * Setter for listener instance
         *
@@ -489,6 +568,10 @@ class BaseHubSystem extends BaseFrameworkSystem {
                                $errorName = BaseRawDataHandler::SOCKET_ERROR_RESOURCE_UNAVAILABLE;
                                break;
 
+                       case 32:  // "Broken pipe"
+                               $errorName = BaseRawDataHandler::SOCKET_ERROR_BROKEN_PIPE;
+                               break;
+
                        case 104: // "Connection reset by peer"
                                $errorName = BaseRawDataHandler::SOCKET_ERROR_CONNECTION_RESET_BY_PEER;
                                break;
@@ -521,7 +604,7 @@ class BaseHubSystem extends BaseFrameworkSystem {
 
                        default: // Everything else <> 0
                                // Unhandled error code detected, so first debug it because we may want to handle it like the others
-                               self::createDebugInstance(__CLASS__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . '] UNKNOWN ERROR CODE = ' . $errorCode . ', MESSAGE = ' . socket_strerror($errorCode));
+                               self::createDebugInstance(__CLASS__)->debugOutput('BASE-HUB[' . __METHOD__ . ':' . __LINE__ . '] UNKNOWN ERROR CODE = ' . $errorCode . ', MESSAGE = ' . socket_strerror($errorCode));
 
                                // Change it only in this class
                                $errorName = BaseRawDataHandler::SOCKET_ERROR_UNKNOWN;
@@ -601,6 +684,25 @@ class BaseHubSystem extends BaseFrameworkSystem {
                // Return result
                return $stateName;
        }
+
+       /**
+        * Getter for protocol name
+        *
+        * @return      $protocolName   Name of used protocol
+        */
+       public final function getProtocolName () {
+               return $this->protocolName;
+       }
+
+       /**
+        * Setter for protocol name
+        *
+        * @param       $protocolName   Name of used protocol
+        * @return      void
+        */
+       protected final function setProtocolName ($protocolName) {
+               $this->protocolName = $protocolName;
+       }
 }
 
 // [EOF]