// Import application-specific stuff
use Hub\Handler\Protocol\HandleableProtocol;
-use Hub\Handler\RawData\BaseRawDataHandler;
+use Hub\Handler\Network\RawData\BaseRawDataHandler;
use Hub\Information\ShareableInfo;
use Hub\Listener\BaseListener;
use Hub\Listener\Listenable;
namespace Hub\Container\Socket;
// Import application-specific stuff
-use Hub\Handler\RawData\BaseRawDataHandler;
+use Hub\Handler\Network\RawData\BaseRawDataHandler;
use Hub\Helper\Connection\BaseConnectionHelper;
use Hub\Information\ShareableInfo;
use Hub\Listener\BaseListener;
* @param $connectionType Type of connection, can be 'incoming', 'outgoing' or 'server'
* @return $isValid Whether the provided connection type is valid
*/
- private function isValidConnectionType ($connectionType) {
+ public function isValidConnectionType ($connectionType) {
// Is it valid?
$isValid = in_array($connectionType, $this->connectionTypes, TRUE);
// @TODO Unfinished: $this->getListInstance()->addEntry('unl', $decodedData[NetworkPackage::PACKAGE_DATA_RECIPIENT]);
}
}
-}
-// [EOF]
-?>
+}
use Hub\Generic\BaseHubSystem;
use Hub\Network\Receive\Receivable;
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
/**
* A general message handler, this class must be abstract to make the template
* method pattern working.
*/
$packageInstance->feedHashToMiner($messageData);
}
-}
-// [EOF]
-?>
+}
namespace Hub\Handler\Network\Socket\RawData;
// Import application-specific stuff
-use Hub\Handler\RawData\BaseRawDataHandler;
+use Hub\Handler\Network\RawData\BaseRawDataHandler;
use Hub\Network\Networkable;
/**
namespace Hub\Handler\Network\RawData\Tcp;
// Import application-specific stuff
-use Hub\Handler\RawData\BaseRawDataHandler;
+use Hub\Handler\Network\RawData\BaseRawDataHandler;
use Hub\Network\Networkable;
use Hub\Pool\Poolable;
<?php
// Own namespace
-namespace Hub\Handler\RawData\Udp;
+namespace Hub\Handler\Network\RawData\Udp;
// Import application-specific stuff
-use Hub\Handler\RawData\BaseRawDataHandler;
+use Hub\Handler\Network\RawData\BaseRawDataHandler;
use Hub\Network\Networkable;
use Hub\Pool\Poolable;
<?php
// Own namespace
-namespace Hub\Handler\RawData;
+namespace Hub\Handler\Network\RawData;
// Import application-specific stuff
-use Hub\Handler\RawData\BaseRawDataHandler;
+use Hub\Handler\Network\RawData\BaseRawDataHandler;
use Hub\Network\Networkable;
/**
<?php
// Own namespace
-namespace Hub\Handler\RawData;
+namespace Hub\Handler\Network\RawData;
// Import application-specific stuff
use Hub\Container\Socket\StorableSocket;
// Import hub-specific stuff
use Hub\Container\Socket\StorableSocket;
use Hub\Generic\BaseHubSystem;
-use Hub\Handler\RawData\BaseRawDataHandler;
+use Hub\Handler\Network\RawData\BaseRawDataHandler;
use Hub\Network\Package\NetworkPackage;
use Hub\Network\Receive\Receivable;
use Hub\Factory\Information\Connection\ConnectionInfoFactory;
use Hub\Factory\Node\NodeObjectFactory;
use Hub\Generic\BaseHubSystem;
-use Hub\Handler\RawData\BaseRawDataHandler;
+use Hub\Handler\Network\RawData\BaseRawDataHandler;
use Hub\Helper\Connection\ConnectionHelper;
use Hub\Helper\HubHelper;
use Hub\Information\ShareableInfo;
// Import application-specific stuff
use Hub\Container\Socket\StorableSocket;
+use Hub\Connection\InvalidConnectionTypeException;
use Hub\Listener\Listenable;
use Hub\Locator\Node\LocateableNode;
use Hub\Network\Package\NetworkPackage;
$this->validateSocket($socketInstance);
// Is the connection type valid?
- if (!$this->isValidConnectionType($connectionType)) {
+ if (!$socketInstance->isValidConnectionType($connectionType)) {
// Is not a valid connection type!
throw new InvalidConnectionTypeException(array($this, $connectionType), self::EXCEPTION_INVALID_CONNECTION_TYPE);
} // END - if
*
* @param $connectionType Type of connection, can only be 'incoming', 'outgoing' or 'server'
* @return $sockets An array with sockets of given type
- * @throws InvalidConnectionTypeException If the provided connection type is not valid
+ * @throws InvalidConnectionTypeException If the found connection type is not valid
*/
public function getSocketsByConnectionType ($connectionType) {
- // Is the connection type valid?
- if (!$this->isValidConnectionType($connectionType)) {
- // Is not a valid connection type!
- throw new InvalidConnectionTypeException(array($this, $connectionType), self::EXCEPTION_INVALID_CONNECTION_TYPE);
- } // END - if
-
// Get the array list
$socketArrays = $this->getArrayFromList('pool');
foreach ($socketArrays as $socketArray) {
// Does it match?
if ($socketArray[Poolable::SOCKET_ARRAY_CONN_TYPE] === $connectionType) {
+ // Is the connection type valid?
+ if (!$socketArray[Poolable::SOCKET_ARRAY_INSTANCE]->isValidConnectionType($connectionType)) {
+ // Is not a valid connection type!
+ throw new InvalidConnectionTypeException(array($this, $connectionType), self::EXCEPTION_INVALID_CONNECTION_TYPE);
+ } // END - if
+
// Add the socket
array_push($sockets, $socketArray[Poolable::SOCKET_ARRAY_INSTANCE]);
} // END - if
// Debug message
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-RECIPIENT: recipient=' . $recipient . ' - EXIT!');
}
-}
-// [EOF]
-?>
+}
$listInstance->addEntry('unl', $unlData);
} // END - foreach
}
-}
-// [EOF]
-?>
+}
$listInstance->addEntry('unl', $unl);
} // END - if
}
-}
-// [EOF]
-?>
+}
$listInstance->addEntry('unl', $unlData);
} // END - foreach
}
-}
-// [EOF]
-?>
+}
namespace Hub\Stream\Output\RawData;
// Import application-specific stuff
-use Hub\Handler\RawData\BaseRawDataHandler;
+use Hub\Handler\Network\RawData\BaseRawDataHandler;
/**
* A RawDataOutputStream class
<?php
+// Own namespace
+namespace Hub\Node\Announcement;
+
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
/**
* This exception is thrown when an announcement from other nodes was received
* but this node doesn't accept announcements.
<?php
+// Own namespace
+namespace Hub\Node\Announcement;
+
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
/**
* This exception is thrown when an announcement from other nodes was received
* but this node doesn't accept announcements.
<?php
+// Own namespace
+namespace Hub\Connection;
+
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
/**
* This exception is thrown when an invalid connection type is being detected
*
<?php
// Own namespace
-namespace Hub\Node\Bootstrap;
+namespace Hub\Dht\Bootstrap;
// Import application-specific stuff
use Hub\Factory\Node\NodeObjectFactory;
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
/**
* This exception is thrown when a DHT bootstrap request from other nodes was
* received but this node doesn't accept such requests.
<?php
+// Own namespace
+namespace Hub\Dht;
+
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
/**
* This exception is thrown when an DHT bootstrap answer comes but this node
* didn't send out such request.
// Call parent exception constructor
parent::__construct($message, $code);
}
-}
-// [EOF]
-?>
+}
<?php
+// Own namespace
+namespace Hub\Node\Data;
+
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
/**
* This exception is thrown when a hash is invalid
*
// Call parent exception constructor
parent::__construct($message, $code);
}
-}
-// [EOF]
-?>
+}
// Call parent exception constructor
parent::__construct($message, $code);
}
-}
-// [EOF]
-?>
+}
// Call parent exception constructor
parent::__construct($message, $code);
}
-}
-// [EOF]
-?>
+}
// Call parent exception constructor
parent::__construct($message, $code);
}
-}
-// [EOF]
-?>
+}
<?php
+// Own namespace
+namespace Hub\Node\Announcement;
+
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
/**
* This exception is thrown when *this* (local) node has already been announced.
*
<?php
+// Own namespace
+namespace Hub\Node\Verification;
+
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
/**
* This exception is thrown when a provided session id in a message cannot be
* verified. This can be the case when e.g. it doesn't match any records or the
<?php
+// Own namespace
+namespace Hub\Node\Network\Chunk;
+
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
/**
* This exception is thrown when the final (last) chunks does not contain the
* "End-Of-Package-Identifier".
// Call parent exception constructor
parent::__construct($message, $code);
}
-}
-// [EOF]
-?>
+}
// Import application-specific stuff
use Hub\Network\Package\NetworkPackage;
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
/**
* This exception is thrown when the checksum (sometimes called "hash") of the
* package data (aka "message" emcoded with BASE64) is not valid.
// Call parent exception constructor
parent::__construct($message, $code);
}
-}
-// [EOF]
-?>
+}
<?php
+// Own namespace
+namespace Hub\Node\Generic;
+
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
/**
* This exception is thrown when a private key's hash is invalid (e.g. empty).
*
// Call parent exception constructor
parent::__construct($message, $code);
}
-}
-// [EOF]
-?>
+}
// Import application-specific stuff
use Hub\Network\Package\NetworkPackage;
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
/**
* This exception is thrown when an unexpected package status was detected.
*
// Call parent exception constructor
parent::__construct($message, $code);
}
-}
-// [EOF]
-?>
+}
namespace Hub\Handler\Network\PackageCode;
// Import application-specific stuff
-use Hub\Handler\RawData\BaseRawDataHandler;
+use Hub\Handler\Network\RawData\BaseRawDataHandler;
+
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
/**
* This exception is thrown when an unexpected package status was detected.
// Call parent exception constructor
parent::__construct($message, $code);
}
-}
-// [EOF]
-?>
+}
// Import application-specific stuff
use Hub\Network\Package\NetworkPackage;
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
/**
* This exception is thrown when a peer is already registered
*
<?php
+// Own namespace
+namespace Hub\Node\Messaging;
+
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
/**
* This exception is thrown when
*
<?php
+// Own namespace
+namespace Hub\Node\Messaging;
+
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
/**
* This exception is thrown when an incoming request (e.g. node-list has been
* requested) is not accepted by this node. This may happen when such
// Call parent exception constructor
parent::__construct($message, $code);
}
-}
-// [EOF]
-?>
+}
// Call parent exception constructor
parent::__construct($message, $code);
}
-}
-// [EOF]
-?>
+}
<?php
+// Own namespace
+namespace Hub\Network\Message;
+
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
/**
* This exception is thrown when multiple messages are found in in-buffer.
*
// Call parent exception constructor
parent::__construct($message, $code);
}
-}
-// [EOF]
-?>
+}
<?php
+// Own namespace
+namespace Hub\Node\Tagging;
+
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
/**
* This exception is thrown when a tag is invalid
*
// Call parent exception constructor
parent::__construct($message, $code);
}
-}
-// [EOF]
-?>
+}
// Call parent exception constructor
parent::__construct($message, $code);
}
-}
-// [EOF]
-?>
+}
// Import application-specific stuff
use Hub\Network\Package\NetworkPackage;
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
/**
* This exception is thrown when a protocol handler cannot validate given package data's recipient (UNL).
*
// Call parent exception constructor
parent::__construct($message, $code);
}
-}
-// [EOF]
-?>
+}
<?php
+// Own namespace
+namespace Hub\Node\Registering;
+
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
/**
* This exception is thrown when a node is already registered and registerNode() has been called again
*
<?php
+// Own namespace
+namespace Hub\Node\Data;
+
+// Import framework stuff
+use CoreFramework\Generic\FrameworkException;
+
/**
* This exception is thrown when a node is not yet registered and updateNode() has been called
*
*/
function doShutdown ();
+ /**
+ * Checks whether the given connection type is valid
+ *
+ * @param $connectionType Type of connection, can be 'incoming', 'outgoing' or 'server'
+ * @return $isValid Whether the provided connection type is valid
+ */
+ function isValidConnectionType ($connectionType);
+
}
<?php
// Own namespace
-namespace Hub\Handler\RawData\Chunks;
+namespace Hub\Handler\Network\RawData\Chunks;
// Import framework stuff
use CoreFramework\Handler\Handleable;