/**
* An AnnouncementAnswer template engine class for XML templates
*
- * @author Roland Haeder <webmaster@ship-simu.org>
+ * @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team
* @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
+ * @link http://www.shipsimu.org
* @todo This template engine does not make use of setTemplateType()
*
* This program is free software: you can redistribute it and/or modify
* 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 XmlAnnouncementAnswerTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
+class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine implements CompileableTemplate, Registerable {
/**
* Some XML nodes must be available for later data extraction
*/
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_TCP_PORT = 'my-tcp-port';
- const ANNOUNCEMENT_DATA_UDP_PORT = 'my-udp-port';
+ const ANNOUNCEMENT_DATA_LISTEN_PORT = 'my-listen-port';
/**
* Protected constructor
// Data from *this* node
self::ANNOUNCEMENT_DATA_EXTERNAL_IP,
self::ANNOUNCEMENT_DATA_INTERNAL_IP,
- self::ANNOUNCEMENT_DATA_TCP_PORT,
- self::ANNOUNCEMENT_DATA_UDP_PORT,
+ self::ANNOUNCEMENT_DATA_LISTEN_PORT,
self::ANNOUNCEMENT_DATA_NODE_STATUS,
self::ANNOUNCEMENT_DATA_SESSION_ID,
// Data from other node
'your-external-ip',
'your-internal-ip',
'your-session-id',
+ // Answer status (generic field)
+ self::ANSWER_STATUS,
);
}
// Is this string empty?
if (empty($characters)) {
// Then skip it silently
- return false;
+ return;
} // END - if
/*
* Assign the found characters to variable and use the last entry from
* stack as the name.
*/
- parent::assignVariable($this->getStackerInstance()->getNamed('node_announcement_answer'), $characters);
+ parent::assignVariable($this->getStackInstance()->getNamed('node_announcement_answer'), $characters);
}
/**
*/
protected function startAnnouncementAnswer () {
// Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_announcement_answer', 'announcement-answer');
+ $this->getStackInstance()->pushNamed('node_announcement_answer', 'announcement-answer');
}
/**
*/
protected function startMyData () {
// Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_announcement_answer', 'my-data');
+ $this->getStackInstance()->pushNamed('node_announcement_answer', 'my-data');
}
/**
*/
protected function startMyExternalIp () {
// Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_EXTERNAL_IP);
+ $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_EXTERNAL_IP);
}
/**
*/
protected function startMyInternalIp () {
// Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_INTERNAL_IP);
+ $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_INTERNAL_IP);
}
/**
*
* @return void
*/
- protected function startMyTcpPort () {
+ protected function startMyListenPort () {
// Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_TCP_PORT);
- }
-
- /**
- * Starts the my-udp-port
- *
- * @return void
- */
- protected function startMyUdpPort () {
- // Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_UDP_PORT);
+ $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_LISTEN_PORT);
}
/**
*/
protected function startMySessionId () {
// Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_SESSION_ID);
+ $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_SESSION_ID);
}
/**
*/
protected function startMyStatus () {
// Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_NODE_STATUS);
+ $this->getStackInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_NODE_STATUS);
}
/**
*/
protected function finishMyStatus () {
// Pop the last entry
- $this->getStackerInstance()->popNamed('node_announcement_answer');
+ $this->getStackInstance()->popNamed('node_announcement_answer');
}
/**
*/
protected function finishMySessionId () {
// Pop the last entry
- $this->getStackerInstance()->popNamed('node_announcement_answer');
- }
-
- /**
- * Finishes the my-udp-port
- *
- * @return void
- */
- protected function finishMyUdpPort () {
- // Pop the last entry
- $this->getStackerInstance()->popNamed('node_announcement_answer');
+ $this->getStackInstance()->popNamed('node_announcement_answer');
}
/**
*
* @return void
*/
- protected function finishMyTcpPort () {
+ protected function finishMyListenPort () {
// Pop the last entry
- $this->getStackerInstance()->popNamed('node_announcement_answer');
+ $this->getStackInstance()->popNamed('node_announcement_answer');
}
/**
*/
protected function finishMyInternalIp () {
// Pop the last entry
- $this->getStackerInstance()->popNamed('node_announcement_answer');
+ $this->getStackInstance()->popNamed('node_announcement_answer');
}
/**
*/
protected function finishMyExternalIp () {
// Pop the last entry
- $this->getStackerInstance()->popNamed('node_announcement_answer');
+ $this->getStackInstance()->popNamed('node_announcement_answer');
}
/**
*/
protected function finishMyData () {
// Pop the last entry
- $this->getStackerInstance()->popNamed('node_announcement_answer');
+ $this->getStackInstance()->popNamed('node_announcement_answer');
}
/**
*/
protected function startYourData () {
// Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_announcement_answer', 'your-data');
+ $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-data');
}
/**
*/
protected function startYourExternalIp () {
// Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_announcement_answer', 'your-external-ip');
+ $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-external-ip');
}
/**
*/
protected function startYourInternalIp () {
// Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_announcement_answer', 'your-internal-ip');
+ $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-internal-ip');
}
/**
*/
protected function startYourSessionId () {
// Push the node name on the stacker
- $this->getStackerInstance()->pushNamed('node_announcement_answer', 'your-session-id');
+ $this->getStackInstance()->pushNamed('node_announcement_answer', 'your-session-id');
}
/**
*/
protected function finishYourSessionId () {
// Pop the last entry
- $this->getStackerInstance()->popNamed('node_announcement_answer');
+ $this->getStackInstance()->popNamed('node_announcement_answer');
}
/**
*/
protected function finishYourInternalIp () {
// Pop the last entry
- $this->getStackerInstance()->popNamed('node_announcement_answer');
+ $this->getStackInstance()->popNamed('node_announcement_answer');
}
/**
*/
protected function finishYourExternalIp () {
// Pop the last entry
- $this->getStackerInstance()->popNamed('node_announcement_answer');
+ $this->getStackInstance()->popNamed('node_announcement_answer');
}
/**
*/
protected function finishYourData () {
// Pop the last entry
- $this->getStackerInstance()->popNamed('node_announcement_answer');
+ $this->getStackInstance()->popNamed('node_announcement_answer');
}
/**
*/
protected function finishAnnouncementAnswer () {
// Pop the last entry
- $this->getStackerInstance()->popNamed('node_announcement_answer');
+ $this->getStackInstance()->popNamed('node_announcement_answer');
}
}