<?php
/**
- * A NetworkPackage class. This class implements Deliverable because all network
- * packages should be deliverable to other nodes. It further provides methods
- * for reading raw content from template engines and feeding it to the stacker
- * for undeclared packages.
+ * A NetworkPackage class. This class implements Deliverable and Receivable
+ * because all network packages should be deliverable to other nodes and
+ * receivable from other nodes. It further provides methods for reading raw
+ * content from template engines and feeding it to the stacker for undeclared
+ * packages.
*
* The factory method requires you to provide a compressor class (which must
* implement the Compressor interface). If you don't want any compression (not
* 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 NetworkPackage extends BaseFrameworkSystem implements Deliverable, Registerable {
+class NetworkPackage extends BaseFrameworkSystem implements Deliverable, Receivable, Registerable {
/**
* Package mask for compressing package data:
* 0: Compressor extension
*/
const NETWORK_TARGET_SELF = 'self';
+ /**
+ * TCP package size in bytes
+ */
+ const TCP_PACKAGE_SIZE = 512;
+
/**
* Protected constructor
*
return $hash;
}
+ ///////////////////////////////////////////////////////////////////////////
+ // Delivering packages / raw data
+ ///////////////////////////////////////////////////////////////////////////
+
/**
* Delivers the given raw package data.
*
return;
} // END - if
- // Sent it away (we catch exceptions one method above
+ // Sent it away (we catch exceptions one method above)
$sentBytes = $connectionInstance->sendRawPackageData($packageData);
// Remember unsent raw bytes in back-buffer, if any
try {
// Now try to send it
$this->sendOutgoingRawPackageData($packageData);
- die("O!\n");
// And remove it finally
$this->getStackerInstance()->popNamed(self::STACKER_NAME_OUTGOING);
$this->debugOutput('PACKAGE: Package was not delivered: ' . $e->getMessage());
}
}
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Receiving packages / raw data
+ ///////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Checks wether new raw package data has arrived at a socket
+ *
+ * @return $hasArrived Wether new raw package data has arrived for processing
+ */
+ public function isNewRawDataPending () {
+ // @TODO Add some content here
+ }
+
+ /**
+ * Checks wether a new package has arrived
+ *
+ * @return $hasArrived Wether a new package has arrived for processing
+ */
+ public function isNewPackageArrived () {
+ // @TODO Add some content here
+ }
}
// [EOF]