rtxStreamZlib.h

00001 /*
00002  * Copyright (c) 2003-2010 Objective Systems, Inc.
00003  *
00004  * This software is furnished under a license and may be used and copied
00005  * only in accordance with the terms of such license and with the
00006  * inclusion of the above copyright notice. This software or any other
00007  * copies thereof may not be provided or otherwise made available to any
00008  * other person. No title to and ownership of the software is hereby
00009  * transferred.
00010  *
00011  * The information in this software is subject to change without notice
00012  * and should not be construed as a commitment by Objective Systems, Inc.
00013  *
00014  * PROPRIETARY NOTICE
00015  *
00016  * This software is an unpublished work subject to a confidentiality agreement
00017  * and is protected by copyright and trade secret law.  Unauthorized copying,
00018  * redistribution or other use of this work is prohibited.
00019  *
00020  * The above notice of copyright on this source code product does not indicate
00021  * any actual or intended publication of such source code.
00022  *
00023  *****************************************************************************/
00024 /*
00025  * @file rtxStreamZlib.h
00026  */
00027 #ifndef _RTXSTREAMZLIB_H_
00028 #define _RTXSTREAMZLIB_H_
00029 
00030 #ifndef _NO_STREAM
00031 
00032 #include "rtxsrc/osSysTypes.h"
00033 #include "rtxsrc/rtxExternDefs.h"
00034 #include "rtxsrc/rtxStream.h"
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 /*
00041  * This function initializes a zlib compressed stream. This function should
00042  *  be called first before any operation with a zlib compressed stream.
00043  *
00044  * @param pctxt        Pointer to context structure variable.
00045  * @param flags        Specifies the access mode for the stream:
00046  *                       - OSRTSTRMF_INPUT = input (reading) stream;
00047  *                       - OSRTSTRMF_OUTPUT = output (writing) stream.
00048  * @return             Completion status of operation: 0 (0) = success,
00049  *                       negative return value is error.
00050  */
00051 EXTERNRT int rtxStreamZlibAttach (OSCTXT* pctxt, OSUINT16 flags);
00052 
00053 /*
00054  * This function finish compressed block. Stream switched to transparent mode.
00055  *
00056  * @param pctxt        Pointer to context structure variable.
00057  * @return             Completion status of operation: 0 (0) = success,
00058  *                       negative return value is error.
00059  */
00060 EXTERNRT int rtxStreamZlibEnd (OSCTXT* pctxt);
00061 
00062 /*
00063  * This function free a zlib compressed stream and restore underlying stream.
00064  *
00065  * @param pctxt        Pointer to context structure variable.
00066  * @return             Completion status of operation: 0 (0) = success,
00067  *                       negative return value is error.
00068  */
00069 EXTERNRT int rtxStreamZlibFree (OSCTXT* pctxt);
00070 
00071 /*
00072  * This function finish compressed block and start new block.
00073  * Stream remained in compressed mode.
00074  *
00075  * @param pctxt        Pointer to context structure variable.
00076  * @return             Completion status of operation: 0 (0) = success,
00077  *                       negative return value is error.
00078  */
00079 EXTERNRT int rtxStreamZlibReset (OSCTXT* pctxt);
00080 
00081 /*
00082  * This function start compression parameters.
00083  *
00084  * @param pctxt        Pointer to context structure variable.
00085  * @param level        Set compression level 0..9.
00086  *                       0 - Z_NO_COMPRESSION
00087  *                       1 - Z_BEST_SPEED
00088  *                       9 - Z_BEST_COMPRESSION
00089  *                      -1 - Z_DEFAULT_COMPRESSION - like level 6
00090  * @param windowBits   Set decompression window size.
00091  *                       8..15 - ZLIB header (RFC 1950)
00092  *                       -8..-15 - header is absent (RFC 1951)
00093  *                       (8..15) + 16 - GZIP header (RFC 1952)
00094  * @param memLevel     Set memory usage level 1..9.
00095  *                       1 - use minimum memory
00096  *                       9 - use maximum memory
00097  * @param strategy     Set copression algorithm.
00098  *                       0 - Z_DEFAULT_STRATEGY - common method any data
00099  *                       other possible values defined in zlib.h
00100  * @return             Completion status of operation: 0 (0) = success,
00101  *                       negative return value is error.
00102  */
00103 EXTERNRT int rtxStreamZlibSetDeflateParams
00104 (OSCTXT* pctxt, int level, int windowBits, int memLevel, int strategy);
00105 
00106 /*
00107  * This function start decompression parameter.
00108  *
00109  * @param pctxt        Pointer to context structure variable.
00110  * @param windowBits   Set decompression window size.
00111  *                       8..15 - ZLIB header (RFC 1950)
00112  *                       -8..-15 - header is absent (RFC 1951)
00113  *                       (8..15) + 16 - GZIP header (RFC 1952)
00114  * @return             Completion status of operation: 0 (0) = success,
00115  *                       negative return value is error.
00116  */
00117 EXTERNRT int rtxStreamZlibSetInflateParams
00118 (OSCTXT* pctxt, int windowBits);
00119 
00120 /*
00121  * This function start compressed block.
00122  *
00123  * @param pctxt        Pointer to context structure variable.
00124  * @return             Completion status of operation: 0 (0) = success,
00125  *                       negative return value is error.
00126  */
00127 EXTERNRT int rtxStreamZlibStart (OSCTXT* pctxt);
00128 
00129 #ifdef __cplusplus
00130 }
00131 #endif
00132 
00133 #endif /* _NO_STREAM */
00134 #endif /* _RTXSTREAMZLIB_H_ */
00135