]> git.mxchange.org Git - hub.git/blobdiff - application/hub/interfaces/handler/chunks/class_HandleableChunks.php
Changed all true/false to TRUE/FALSE respectively as PHP constants are better than...
[hub.git] / application / hub / interfaces / handler / chunks / class_HandleableChunks.php
index f19ee14c208a6a8799d70fc0af693e20adb58450..16691f2ddb419ada62817297ebe2b75b00cec818 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Hub Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
@@ -31,6 +31,21 @@ interface HandleableChunks extends Handleable {
         */
        function addAllChunksWithFinal (array $chunks);
 
+       /**
+        * Adds all chunks and wait for more (e.g. incomplete transmission)
+        *
+        * @param       $chunks         An array with chunks, the last one should be a 'final'
+        * @return      void
+        */
+       function addAllChunksWait (array $chunks);
+
+       /**
+        * Checks whether unhandled chunks are available
+        *
+        * @return      $unhandledChunks        Whether unhandled chunks are left
+        */
+       function ifUnhandledChunksWithFinalAvailable ();
+
        /**
         * Handles available chunks by processing one-by-one (not all together,
         * this would slow-down the whole application) with the help of an
@@ -38,7 +53,48 @@ interface HandleableChunks extends Handleable {
         *
         * @return      void
         */
-       function handleAvailableChunks ();
+       function handleAvailableChunksWithFinal ();
+
+       /**
+        * Checks whether unassembled chunks are available (ready) in final array
+        *
+        * @return      $unassembledChunksAvailable             Whether unassembled chunks are available
+        */
+       function ifUnassembledChunksAvailable ();
+
+       /**
+        * Assembles all chunks (except EOP and "hash chunk") back together to the original package data.
+        *
+        * This is done by the following steps:
+        *
+        * 1) Sort the final array with ksort(). This will bring the "hash
+        *    chunk" up to the last array index and the EOP chunk to the
+        *    pre-last array index
+        * 2) Assemble all chunks except two last (see above step)
+        * 3) While so, do the final check on all hashes
+        * 4) If the package is assembled back together, hash it again for
+        *    the very final verification.
+        *
+        * @return      void
+        */
+       function assembleChunksFromFinalArray ();
+
+       /**
+        * Checks whether the raw package data has been assembled back together.
+        * This can be safely assumed when rawPackageData is not empty and the
+        * collection of all chunks is FALSE (because initHandler() will reset it).
+        *
+        * @return      $isRawPackageDataAvailable      Whether raw package data is available
+        */
+       function ifRawPackageDataIsAvailable ();
+
+       /**
+        * Handles the finally assembled raw package data by feeding it into another
+        * stacker for further decoding/processing.
+        *
+        * @return      void
+        */
+       function handledAssembledRawPackageData ();
 }
 
 // [EOF]