// Message status codes
const MESSAGE_STATUS_CODE_OKAY = 'OKAY';
- /**
- * Separator for all bootstrap node entries
- */
- const BOOTSTRAP_NODES_SEPARATOR = ';';
-
/**
* Protected constructor
*
self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BOOTSTRAP: UNL matches bootstrap node "%s".', $this->getBootUniversalNodeLocator()));
// Now, does the mode match
- if (FrameworkBootstrap::getRequestInstance()->getRequestElement('mode') == self::NODE_TYPE_BOOT) {
+ if (FrameworkBootstrap::getRequestInstance()->getRequestElement('mode') == Node::NODE_TYPE_BOOT) {
// Output debug message
self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BOOTSTRAP: Our node is a valid bootstrap node.');
} else {
use Org\Shipsimu\Hub\Handler\Package\NetworkPackageHandler;
use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
use Org\Shipsimu\Hub\Network\Receive\Receivable;
+use Org\Shipsimu\Hub\Node\Node;
use Org\Shipsimu\Hub\Pool\Poolable;
use Org\Shipsimu\Hub\Template\Engine\Xml\Network\Answer\BaseXmlAnswerTemplateEngine;
use Org\Shipsimu\Hub\Template\Engine\Xml\ObjectRegistry\XmlObjectRegistryTemplateEngine;
use DatabaseFrontendTrait;
use StateableTrait;
- /**
- * Node types
- */
- const NODE_TYPE_BOOT = 'boot';
- const NODE_TYPE_MASTER = 'master';
- const NODE_TYPE_LIST = 'list';
- const NODE_TYPE_REGULAR = 'regular';
-
// Exception constants
const EXCEPTION_HUB_ALREADY_ANNOUNCED = 0xe00;
$isFound = FALSE;
// Run through all configured IPs
- foreach (explode(BaseHubSystem::BOOTSTRAP_NODES_SEPARATOR, FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('hub_bootstrap_nodes')) as $unl) {
+ foreach (explode(Node::BOOTSTRAP_NODES_SEPARATOR, FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('hub_bootstrap_nodes')) as $unl) {
// Does it match?
if ($unl == $remoteAddr) {
// Found it!
* added then the next check will be TRUE.
*/
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: CALLED!');
- $acceptsRequest = ((!$this instanceof HubRegularNode) && (FrameworkBootstrap::getRequestInstance()->getRequestElement('mode') != self::NODE_TYPE_REGULAR));
+ $acceptsRequest = ((!$this instanceof HubRegularNode) && (FrameworkBootstrap::getRequestInstance()->getRequestElement('mode') != Node::NODE_TYPE_REGULAR));
// Return it
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: acceptsRequests=%d - EXIT!', intval($hasAnnouncementCompleted)));
namespace Org\Shipsimu\Hub\Network\Recipient\Upper;
// Import application-specific stuff
-use Org\Shipsimu\Hub\Generic\BaseHubSystem;
use Org\Shipsimu\Hub\Handler\Package\NetworkPackageHandler;
use Org\Shipsimu\Hub\Network\Package\DeliverablePackage;
use Org\Shipsimu\Hub\Network\Recipient\BaseRecipient;
use Org\Shipsimu\Hub\Network\Recipient\Recipient;
+use Org\Shipsimu\Hub\Node\Node;
// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
assert($recipientUnl == NetworkPackageHandler::RECIPIENT_TYPE_UPPER);
// Get all bootstrap nodes
- foreach (explode(BaseHubSystem::BOOTSTRAP_NODES_SEPARATOR, FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('hub_bootstrap_nodes')) as $unlData) {
+ foreach (explode(Node::BOOTSTRAP_NODES_SEPARATOR, FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('hub_bootstrap_nodes')) as $unlData) {
// Is maximum reached?
if ($listInstance->count() == FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('package_recipient_max_count')) {
// Then stop adding more
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface Node extends FrameworkInterface {
+ /**
+ * Separator for all bootstrap node entries
+ */
+ const BOOTSTRAP_NODES_SEPARATOR = ';';
+
+ /**
+ * Node types
+ */
+ const NODE_TYPE_BOOT = 'boot';
+ const NODE_TYPE_MASTER = 'master';
+ const NODE_TYPE_LIST = 'list';
+ const NODE_TYPE_REGULAR = 'regular';
+
/**
* Method to "bootstrap" the node. This step does also apply provided
* command-line arguments stored in the request instance. You should now