rtxStreamCtxtBuf.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 rtxStreamCtxtBuf.h
00026  * Stream functions that work directly with the context buffer.
00027  */
00028 #ifndef _RTXSTREAMCTXTBUF_H_
00029 #define _RTXSTREAMCTXTBUF_H_
00030 
00031 #ifndef _NO_STREAM
00032 
00033 #include "rtxsrc/osSysTypes.h"
00034 #include "rtxsrc/rtxExternDefs.h"
00035 #include "rtxsrc/rtxStream.h"
00036 
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040 
00041 /*
00042  * This function create and initializes a context-buffered stream. This
00043  * function should be called first before any operation with the stream.
00044  *
00045  * @param pctxt        Pointer to context structure variable.
00046  * @return             Completion status of operation: 0 (0) = success,
00047  *                       negative return value is error.
00048  */
00049 EXTERNRT int rtxStreamCtxtBufCreate (OSCTXT* pctxt);
00050 
00051 /*
00052  * This function pre-reads a 'size' number of octets of data from the input
00053  * stream into the internal stream buffer. This functions blocks until all
00054  * necessary data is read, end of file is detected, or another error
00055  * occurs. This function guarantees that the internal buffer will contain at
00056  * least the 'size' number of octets. Thus, it is possible to obtain direct
00057  * access to the memory buffer with pre-read data by using the 'buffer' field
00058  * of the OSCTXT context block.
00059  *
00060  * @param pctxt        Pointer to a context structure variable that has
00061  *                       been initialized for stream operations.
00062  * @param size         Number of octets to be pre-read.
00063  * @return             Completion status of operation: 0 (0) = success,
00064  *                       negative return value is error.
00065  */
00066 EXTERNRT int rtxStreamCtxtBufPreRead (OSCTXT* pctxt, size_t size);
00067 
00068 /*
00069  * This function checks if the stream is already context-buffered or not.
00070  * If not, the stream will be created above the existing stream.
00071  * If the stream cannot be opened, an error code is returned.
00072  *
00073  * @param pctxt        Pointer to a context structure variable that has
00074  *                       been initialized for stream operations.
00075  * @return             Completion status of operation: 0 (0) = success,
00076  *                       negative return value is error.
00077  */
00078 EXTERNRT int rtxStreamCtxtBufCheck (OSCTXT* pctxt);
00079 
00080 /*
00081  * This function frees a context-buffered stream and restores the underlying stream.
00082  *
00083  * @param pctxt        Pointer to context structure variable.
00084  * @return             Completion status of operation: 0 (0) = success,
00085  *                       negative return value is error.
00086  */
00087 EXTERNRT int rtxStreamCtxtBufFree (OSCTXT* pctxt);
00088 
00089 #ifdef __cplusplus
00090 }
00091 #endif
00092 
00093 #endif /* _NO_STREAM */
00094 #endif /* _RTXSTREAMCTXTBUF_H_ */
00095