]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/template/answer/announcement/class_XmlAnnouncementAnswerTemplateEngine.php
Also don't forget to add it here ....
[hub.git] / application / hub / main / template / answer / announcement / class_XmlAnnouncementAnswerTemplateEngine.php
index d4f0dc738feb5291a01b3d09437e84388d45e16f..87ed8fa545fe9274b04097ccc5b61448086431ac 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  * @todo               This template engine does not make use of setTemplateType()
@@ -26,11 +26,12 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
        /**
         * Some XML nodes must be available for later data extraction
         */
-       const ANNOUNCEMENT_DATA_SESSION_ID    = 'my-session-id';
-       const ANNOUNCEMENT_DATA_NODE_STATUS   = 'my-status';
-       const ANNOUNCEMENT_DATA_EXTERNAL_IP   = 'my-external-ip';
-       const ANNOUNCEMENT_DATA_INTERNAL_IP   = 'my-internal-ip';
-       const ANNOUNCEMENT_DATA_LISTEN_PORT      = 'my-listen-port';
+       const ANNOUNCEMENT_DATA_NODE_ID          = 'my-node-id';
+       const ANNOUNCEMENT_DATA_SESSION_ID       = 'my-session-id';
+       const ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH = 'my-private-key-hash';
+       const ANNOUNCEMENT_DATA_NODE_STATUS      = 'my-status';
+       const ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS = 'my-external-address';
+       const ANNOUNCEMENT_DATA_INTERNAL_ADDRESS = 'my-internal-address';
 
        /**
         * Protected constructor
@@ -42,23 +43,26 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
                parent::__construct(__CLASS__);
 
                // Init sub-nodes array
-               $this->subNodes = array(
+               $this->setSubNodes(array(
                        // These nodes don't contain any data
                        'my-data',
                        'your-data',
                        // Data from *this* node
-                       self::ANNOUNCEMENT_DATA_EXTERNAL_IP,
-                       self::ANNOUNCEMENT_DATA_INTERNAL_IP,
-                       self::ANNOUNCEMENT_DATA_LISTEN_PORT,
+                       self::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS,
+                       self::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS,
                        self::ANNOUNCEMENT_DATA_NODE_STATUS,
+                       self::ANNOUNCEMENT_DATA_NODE_ID,
                        self::ANNOUNCEMENT_DATA_SESSION_ID,
+                       self::ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH,
                        // Data from other node
-                       'your-external-ip',
-                       'your-internal-ip',
+                       'your-external-address',
+                       'your-internal-address',
+                       'your-node-id',
                        'your-session-id',
+                       'your-private-key-hash',
                        // Answer status (generic field)
                        self::ANSWER_STATUS,
-               );
+               ));
        }
 
        /**
@@ -138,33 +142,33 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
        }
 
        /**
-        * Starts the my-external-ip
+        * Starts the my-external-address
         *
         * @return      void
         */
-       protected function startMyExternalIp () {
+       protected function startMyExternalAddress () {
                // Push the node name on the stacker
-               $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_EXTERNAL_IP);
+               $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS);
        }
 
        /**
-        * Starts the my-internal-ip
+        * Starts the my-internal-address
         *
         * @return      void
         */
-       protected function startMyInternalIp () {
+       protected function startMyInternalAddress () {
                // Push the node name on the stacker
-               $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_INTERNAL_IP);
+               $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS);
        }
 
        /**
-        * Starts the my-tcp-port
+        * Starts the my-node-id
         *
         * @return      void
         */
-       protected function startMyListenPort () {
+       protected function startMyNodeId () {
                // Push the node name on the stacker
-               $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_LISTEN_PORT);
+               $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_NODE_ID);
        }
 
        /**
@@ -177,6 +181,16 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
                $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_SESSION_ID);
        }
 
+       /**
+        * Starts the my-private-key-hash
+        *
+        * @return      void
+        */
+       protected function startMyPrivateKeyHash () {
+               // Push the node name on the stacker
+               $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH);
+       }
+
        /**
         * Starts the my-status
         *
@@ -197,6 +211,16 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
                $this->getStackInstance()->popNamed('node_announcement_answer');
        }
 
+       /**
+        * Finishes the my-private-key-hash
+        *
+        * @return      void
+        */
+       protected function finishMyPrivateKeyhash () {
+               // Pop the last entry
+               $this->getStackInstance()->popNamed('node_announcement_answer');
+       }
+
        /**
         * Finishes the my-session-id
         *
@@ -208,31 +232,31 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
        }
 
        /**
-        * Finishes the my-tcp-port
+        * Finishes the my-node-id
         *
         * @return      void
         */
-       protected function finishMyListenPort () {
+       protected function finishMyNodeId () {
                // Pop the last entry
                $this->getStackInstance()->popNamed('node_announcement_answer');
        }
 
        /**
-        * Finishes the my-internal-ip
+        * Finishes the my-internal-address
         *
         * @return      void
         */
-       protected function finishMyInternalIp () {
+       protected function finishMyInternalAddress () {
                // Pop the last entry
                $this->getStackInstance()->popNamed('node_announcement_answer');
        }
 
        /**
-        * Finishes the my-external-ip
+        * Finishes the my-external-address
         *
         * @return      void
         */
-       protected function finishMyExternalIp () {
+       protected function finishMyExternalAddress () {
                // Pop the last entry
                $this->getStackInstance()->popNamed('node_announcement_answer');
        }
@@ -258,23 +282,23 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
        }
 
        /**
-        * Starts the your-external-ip
+        * Starts the your-external-address
         *
         * @return      void
         */
-       protected function startYourExternalIp () {
+       protected function startYourExternalAddress () {
                // Push the node name on the stacker
-               $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-external-ip');
+               $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-external-address');
        }
 
        /**
-        * Starts the your-internal-ip
+        * Starts the your-internal-address
         *
         * @return      void
         */
-       protected function startYourInternalIp () {
+       protected function startYourInternalAddress () {
                // Push the node name on the stacker
-               $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-internal-ip');
+               $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-internal-address');
        }
 
        /**
@@ -287,6 +311,46 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
                $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-session-id');
        }
 
+       /**
+        * Starts the your-node-id
+        *
+        * @return      void
+        */
+       protected function startYourNodeId () {
+               // Push the node name on the stacker
+               $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-node-id');
+       }
+
+       /**
+        * Starts the your-private-key-hash
+        *
+        * @return      void
+        */
+       protected function startYourPrivateKeyHash () {
+               // Push the node name on the stacker
+               $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-private-key-hash');
+       }
+
+       /**
+        * Finishes the your-private-key-hash
+        *
+        * @return      void
+        */
+       protected function finishYourPrivateKeyHash () {
+               // Pop the last entry
+               $this->getStackInstance()->popNamed('node_announcement_answer');
+       }
+
+       /**
+        * Finishes the your-node-id
+        *
+        * @return      void
+        */
+       protected function finishYourNodeId () {
+               // Pop the last entry
+               $this->getStackInstance()->popNamed('node_announcement_answer');
+       }
+
        /**
         * Finishes the your-session-id
         *
@@ -298,21 +362,21 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
        }
 
        /**
-        * Finishes the your-internal-ip
+        * Finishes the your-internal-address
         *
         * @return      void
         */
-       protected function finishYourInternalIp () {
+       protected function finishYourInternalAddress () {
                // Pop the last entry
                $this->getStackInstance()->popNamed('node_announcement_answer');
        }
 
        /**
-        * Finishes the your-external-ip
+        * Finishes the your-external-address
         *
         * @return      void
         */
-       protected function finishYourExternalIp () {
+       protected function finishYourExternalAddress () {
                // Pop the last entry
                $this->getStackInstance()->popNamed('node_announcement_answer');
        }