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-2004 by 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 
00037 struct OSRTStream;
00038 
00062 typedef long (*OSRTStreamReadProc)
00063    (struct OSRTStream* pStream, OSOCTET* pbuffer, size_t bufSize);
00064 
00070 typedef long (*OSRTStreamBlockingReadProc)
00071    (struct OSRTStream* pStream, OSOCTET* pbuffer, size_t toReadBytes);
00072 
00078 typedef long (*OSRTStreamWriteProc)(struct OSRTStream* pStream, 
00079                                    const OSOCTET* data, size_t numocts);
00080 
00086 typedef int (*OSRTStreamFlushProc)(struct OSRTStream* pStream);
00087 
00093 typedef int (*OSRTStreamCloseProc)(struct OSRTStream* pStream);
00094 
00100 typedef int (*OSRTStreamSkipProc) 
00101    (struct OSRTStream* pStream, size_t skipBytes);
00102 
00108 typedef int (*OSRTStreamMarkProc) 
00109    (struct OSRTStream* pStream, size_t readAheadLimit);
00110 
00116 typedef int (*OSRTStreamResetProc) (struct OSRTStream* pStream);
00117 
00118 #define OSRTSTRMF_INPUT      0x0001
00119 #define OSRTSTRMF_OUTPUT     0x0002
00120 #define OSRTSTRMF_BUFFERED   0x8000 /* direct-buffer stream    */
00121 #define OSRTSTRMF_UNBUFFERED 0x4000 /* force unbuffered stream */
00122 
00123 #define OSRTSTRMF_BUF_INPUT    (OSRTSTRMF_INPUT|OSRTSTRMF_BUFFERED)
00124 #define OSRTSTRMF_BUF_OUTPUT   (OSRTSTRMF_OUTPUT|OSRTSTRMF_BUFFERED)
00125 
00126 
00127 #define OSRTSTRMID_FILE      1
00128 #define OSRTSTRMID_SOCKET    2
00129 #define OSRTSTRMID_MEMORY    3
00130 #define OSRTSTRMID_BUFFERED  4
00131 #define OSRTSTRMID_DIRECTBUF 5
00132 #define OSRTSTRMID_USER   1000
00133 
00134 #define OSRTSTRM_K_BUFSIZE 1024
00135 
00136 #define OSRTSTRM_K_INVALIDMARK ((OSUINT32)-1)
00137 
00138 #define OSRTSTREAM_BYTEINDEX(pctxt) \
00139 ((pctxt)->pStream->bytesProcessed + (pctxt)->buffer.byteIndex)
00140 
00141 #define OSRTSTREAM_ID(pctxt) ((pctxt)->pStream->id)
00142 #define OSRTSTREAM_FLAGS(pctxt) ((pctxt)->pStream->flags)
00143 
00149 typedef struct OSRTStream {
00150    OSUINT32  id;             /*< id of stream (see OSRTSTRMID_* macros  */
00151    OSUINT16  flags;          /*< flags (see OSRTSTRMF_* macros          */
00152    size_t    bufsize;        /*< physical size of pctxt->buffer.data buf */
00153    size_t    readAheadLimit; /*< read ahead limit (used by ::rtxStreamMark/::rtxStreamReset */
00154    size_t    bytesProcessed; /*< the number of bytes already processed */
00155    size_t    markedBytesProcessed; /*< the marked number of bytes already processed */
00156    size_t    ioBytes;        /*< the actual number of bytes already read/written    */
00157    OSRTSOCKET socket;        /*< socket handle for socket streams     */
00158    void*     extra;          /*< pointer to stream-specific data      */
00159 
00160    OSRTStreamReadProc  read;   /*< pointer to read function  */
00161    OSRTStreamBlockingReadProc blockingRead;/*< pointer to blockingRead function*/
00162    OSRTStreamWriteProc write;  /*< pointer to write function */
00163    OSRTStreamFlushProc flush;  /*< pointer to flush function */
00164    OSRTStreamCloseProc close;  /*< pointer to close function */
00165    OSRTStreamSkipProc  skip;   /*< pointer to skip function  */
00166    OSRTStreamMarkProc  mark;   /*< pointer to mark function  */
00167    OSRTStreamResetProc reset;  /*< pointer to reset function  */
00168 } OSRTStream;
00169 
00179 EXTERNRTX int rtxStreamClose (OSCTXT* pctxt);
00180 
00191 EXTERNRTX int rtxStreamFlush (OSCTXT* pctxt);
00192 
00202 EXTERNRTX int rtxStreamInit (OSCTXT* pctxt);
00203 
00220 EXTERNRTX long rtxStreamRead 
00221    (OSCTXT* pctxt, OSOCTET* pbuffer, size_t bufSize);
00222 
00239 EXTERNRTX long rtxStreamBlockingRead 
00240    (OSCTXT* pctxt, OSOCTET* pbuffer, size_t readBytes);
00241 
00253 EXTERNRTX int rtxStreamSkip  (OSCTXT* pctxt, size_t skipBytes);
00254 
00267 EXTERNRTX long rtxStreamWrite (OSCTXT* pctxt, const OSOCTET* data, size_t numocts);
00268 
00283 EXTERNRTX int rtxStreamGetIOBytes (OSCTXT* pctxt, size_t* pPos);
00284 
00299 EXTERNRTX int rtxStreamMark (OSCTXT* pctxt, size_t readAheadLimit);
00300 
00310 EXTERNRTX int rtxStreamReset (OSCTXT* pctxt);
00311 
00322 EXTERNRTX OSBOOL rtxStreamMarkSupported (OSCTXT* pctxt);
00323 
00332 EXTERNRTX OSBOOL rtxStreamIsOpened (OSCTXT* pctxt);
00333 
00342 EXTERNRTX OSBOOL rtxStreamIsReadable (OSCTXT* pctxt);
00343 
00352 EXTERNRTX OSBOOL rtxStreamIsWritable (OSCTXT* pctxt);
00353 
00363 EXTERNRTX int    rtxStreamRelease (OSCTXT* pctxt);
00364 
00367 #ifdef __cplusplus
00368 }
00369 #endif
00370 
00371 #endif /* _RTXSTREAM_H_ */
00372 

This file was last modified on 1 Jun 2004.
XBinder, Version 1.0.0