Objective Systems, Inc.  
Home
About ASN.1
Products
Free Software
Documents
Services
Resources
Resellers
Customers
Careers
About Us
Contact Us
 

Google


Objective Systems, Inc.

rtxStream.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2003-2006 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  *****************************************************************************/
00027 #ifndef _RTXSTREAM_H_
00028 #define _RTXSTREAM_H_
00029 
00030 #include "rtxsrc/rtxCommon.h"
00031 #include "rtxsrc/rtxSocket.h"
00032 
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036 
00056 struct OSRTStream;
00057 
00063 typedef long (*OSRTStreamReadProc)
00064    (struct OSRTStream* pStream, OSOCTET* pbuffer, size_t bufSize);
00065 
00071 typedef long (*OSRTStreamBlockingReadProc)
00072    (struct OSRTStream* pStream, OSOCTET* pbuffer, size_t toReadBytes);
00073 
00079 typedef long (*OSRTStreamWriteProc)(struct OSRTStream* pStream, 
00080                                    const OSOCTET* data, size_t numocts);
00081 
00087 typedef int (*OSRTStreamFlushProc)(struct OSRTStream* pStream);
00088 
00094 typedef int (*OSRTStreamCloseProc)(struct OSRTStream* pStream);
00095 
00101 typedef int (*OSRTStreamSkipProc) 
00102    (struct OSRTStream* pStream, size_t skipBytes);
00103 
00109 typedef int (*OSRTStreamMarkProc) 
00110    (struct OSRTStream* pStream, size_t readAheadLimit);
00111 
00117 typedef int (*OSRTStreamResetProc) (struct OSRTStream* pStream);
00118 
00119 #define OSRTSTRMF_INPUT      0x0001
00120 #define OSRTSTRMF_OUTPUT     0x0002
00121 #define OSRTSTRMF_BUFFERED   0x8000 /* direct-buffer stream    */
00122 #define OSRTSTRMF_UNBUFFERED 0x4000 /* force unbuffered stream */
00123 
00124 #define OSRTSTRMF_BUF_INPUT    (OSRTSTRMF_INPUT|OSRTSTRMF_BUFFERED)
00125 #define OSRTSTRMF_BUF_OUTPUT   (OSRTSTRMF_OUTPUT|OSRTSTRMF_BUFFERED)
00126 
00127 
00128 #define OSRTSTRMID_FILE      1
00129 #define OSRTSTRMID_SOCKET    2
00130 #define OSRTSTRMID_MEMORY    3
00131 #define OSRTSTRMID_BUFFERED  4
00132 #define OSRTSTRMID_DIRECTBUF 5
00133 #define OSRTSTRMID_USER   1000
00134 
00135 #define OSRTSTRM_K_BUFSIZE 1024
00136 
00137 #define OSRTSTRM_K_INVALIDMARK ((size_t)-1)
00138 
00139 #define OSRTSTREAM_BYTEINDEX(pctxt) \
00140 ((pctxt)->pStream->bytesProcessed + (pctxt)->buffer.byteIndex)
00141 
00142 #define OSRTSTREAM_ID(pctxt) ((pctxt)->pStream->id)
00143 #define OSRTSTREAM_FLAGS(pctxt) ((pctxt)->pStream->flags)
00144 
00150 typedef struct OSRTStream {
00151    OSRTStreamReadProc  read;   /*< pointer to read function  */
00152    OSRTStreamBlockingReadProc blockingRead;/*< pointer to blockingRead function*/
00153    OSRTStreamWriteProc write;  /*< pointer to write function */
00154    OSRTStreamFlushProc flush;  /*< pointer to flush function */
00155    OSRTStreamCloseProc close;  /*< pointer to close function */
00156    OSRTStreamSkipProc  skip;   /*< pointer to skip function  */
00157    OSRTStreamMarkProc  mark;   /*< pointer to mark function  */
00158    OSRTStreamResetProc reset;  /*< pointer to reset function  */
00159 
00160    void*     extra;          /*< pointer to stream-specific data      */
00161 
00162    size_t    bufsize;        /*< physical size of pctxt->buffer.data buf */
00163    size_t    readAheadLimit; /*< read ahead limit (used by ::rtxStreamMark/::rtxStreamReset */
00164    size_t    bytesProcessed; /*< the number of bytes already processed */
00165    size_t    markedBytesProcessed; /*< the marked number of bytes already processed */
00166    size_t    ioBytes;        /*< the actual number of bytes already read/written    */
00167 
00168    OSUINT32  id;             /*< id of stream (see OSRTSTRMID_* macros  */
00169    OSRTSOCKET socket;        /*< socket handle for socket streams     */
00170    OSUINT16  flags;          /*< flags (see OSRTSTRMF_* macros          */
00171 } OSRTStream;
00172 
00182 EXTERNRTX int rtxStreamClose (OSCTXT* pctxt);
00183 
00194 EXTERNRTX int rtxStreamFlush (OSCTXT* pctxt);
00195 
00205 EXTERNRTX int rtxStreamInit (OSCTXT* pctxt);
00206 
00223 EXTERNRTX long rtxStreamRead 
00224    (OSCTXT* pctxt, OSOCTET* pbuffer, size_t bufSize);
00225 
00242 EXTERNRTX long rtxStreamBlockingRead 
00243    (OSCTXT* pctxt, OSOCTET* pbuffer, size_t readBytes);
00244 
00256 EXTERNRTX int rtxStreamSkip  (OSCTXT* pctxt, size_t skipBytes);
00257 
00270 EXTERNRTX long rtxStreamWrite 
00271    (OSCTXT* pctxt, const OSOCTET* data, size_t numocts);
00272 
00287 EXTERNRTX int rtxStreamGetIOBytes (OSCTXT* pctxt, size_t* pPos);
00288 
00303 EXTERNRTX int rtxStreamMark (OSCTXT* pctxt, size_t readAheadLimit);
00304 
00314 EXTERNRTX int rtxStreamReset (OSCTXT* pctxt);
00315 
00326 EXTERNRTX OSBOOL rtxStreamMarkSupported (OSCTXT* pctxt);
00327 
00336 EXTERNRTX OSBOOL rtxStreamIsOpened (OSCTXT* pctxt);
00337 
00346 EXTERNRTX OSBOOL rtxStreamIsReadable (OSCTXT* pctxt);
00347 
00356 EXTERNRTX OSBOOL rtxStreamIsWritable (OSCTXT* pctxt);
00357 
00367 EXTERNRTX int    rtxStreamRelease (OSCTXT* pctxt);
00368 
00371 #ifdef __cplusplus
00372 }
00373 #endif
00374 
00375 #endif /* _RTXSTREAM_H_ */
00376 

This file was last modified on 8 Jan 2007.
XBinder, Version 1.1.9