* @version 0.0.0 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.shipsimu.org * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ interface HandleableChunks extends Handleable { /** * Adds all chunks if the last one verifies as a 'final chunk'. * * @param $chunks An array with chunks, the last one should be a 'final' * @return void * @throws FinalChunkVerificationException If the final chunk does not start with 'EOP:' */ 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 * iterator. * * @return void */ 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] ?>