+ // Return it
+ return $hasAnnounced;
+ }
+
+ /**
+ * Checks whether this node has attempted to announce itself and completed it
+ *
+ * @return $hasAnnouncementCompleted Whether this node has attempted to announce itself and completed it
+ * @todo Add checking if this node has been announced to the sender node
+ */
+ public function ifNodeHasAnnouncementCompleted () {
+ // Debug message
+ /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE: ifNodeHasAnnouncementCompleted(): state=' . $this->getStateInstance()->getStateName());
+
+ // Simply check the state of this node
+ $hasAnnouncementCompleted = ($this->getStateInstance() instanceof NodeAnnouncementCompletedState);
+
+ // Debug message
+ /* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE: ifNodeHasAnnouncementCompleted(): hasAnnouncementCompleted=' . intval($hasAnnouncementCompleted));
+
+ // Return it
+ return $hasAnnouncementCompleted;
+ }
+
+ /**
+ * Enables whether this node accepts announcements
+ *
+ * @param $acceptAnnouncements Whether this node accepts announcements (default: true)
+ * @return void
+ */
+ protected final function enableAcceptingAnnouncements ($acceptAnnouncements = true) {
+ $this->acceptAnnouncements = $acceptAnnouncements;
+ }
+
+ /**
+ * Checks wether this node is accepting node-list requests
+ *
+ * @return $acceptsRequest Wether this node accepts node-list requests
+ */
+ public function isAcceptingNodeListRequests () {
+ /*
+ * Only 'regular' nodes does not accept such requests, checking
+ * HubRegularNode is faster, but if e.g. HubRegularI2PNode will be
+ * added then the next check will be true.
+ */
+ $acceptsRequest = ((!$this instanceof HubRegularNode) && ($this->getRequestInstance()->getRequestElement('mode') != self::NODE_TYPE_REGULAR));
+
+ // Return it
+ return $acceptsRequest;
+ }
+
+ /**
+ * "Getter" for address:port combination
+ *
+ * @param $handlerInstance An instance of a Networkable class
+ * @return $addressPort A address:port combination for this node
+ */
+ public final function getAddressPort (Networkable $handlerInstance) {
+ // Construct config entry
+ $configEntry = 'node_' . $handlerInstance->getHandlerName() . '_listen_port';
+
+ // Get IP and port
+ $addressPort = $this->getConfigInstance()->detectServerAddress() . ':' . $this->getConfigInstance()->getConfigEntry($configEntry);
+
+ // Return it
+ return $addressPort;
+ }
+
+ /**
+ * Updates/refreshes node data (e.g. status).
+ *
+ * @return void
+ * @todo Find more to do here
+ */
+ public function updateNodeData () {
+ // Set some dummy configuration entries, e.g. node_status
+ $this->getConfigInstance()->setConfigEntry('node_status', $this->getStateInstance()->getStateName());
+ }
+
+ /**
+ * Handles message answer by given data array
+ *
+ * @param $messageData A valid answer message data array
+ * @param $packageInstance An instance of a Receivable class
+ * @return void
+ * @todo Handle thrown exception
+ */
+ public function handleAnswerStatusByMessageData (array $messageData, Receivable $packageInstance) {
+ // Is it not empty?
+ assert(!empty($messageData[NetworkPackage::MESSAGE_DATA_ANSWER_STATUS]));
+
+ // Construct configuration entry for handling class' name
+ $classConfigEntry = strtolower($messageData[NetworkPackage::MESSAGE_ARRAY_TYPE] . '_status_' . $messageData[NetworkPackage::MESSAGE_DATA_ANSWER_STATUS]) . '_handler_class';
+
+ // Try to get a class
+ $handlerInstance = ObjectFactory::createObjectByConfiguredName($classConfigEntry);
+
+ // Handle it there
+ $handlerInstance->handleAnswerMessageData($messageData, $packageInstance);
+ }
+
+ /**
+ * "Getter" for an array of all accepted object types
+ *
+ * @return $objectList Array of all accepted object types
+ */
+ public function getListFromAcceptedObjectTypes () {
+ // Get registry instance
+ $objectRegistryInstance = ObjectTypeRegistryFactory::createObjectTypeRegistryInstance();
+
+ // Get all entries
+ $objectList = $objectRegistryInstance->getEntries(XmlObjectRegistryTemplateEngine::OBJECT_TYPE_DATA_NAME);