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

Google


Objective Systems, Inc.

rtStream.h

Go to the documentation of this file.
00001 /* 00002 * Copyright (C) 1997-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 *****************************************************************************/ 00029 #ifndef _RTSTREAM_H_ 00030 #define _RTSTREAM_H_ 00031 00032 #include "asn1type.h" 00033 #include "asn1intl.h" 00034 #include "rtSocket.h" 00035 00036 #ifdef __cplusplus 00037 extern "C" { 00038 #endif 00039 00040 struct OSRTStream; 00041 00051 typedef long (*OSRTStreamReadProc)(struct OSRTStream* pStream, 00052 ASN1OCTET* pbuffer, size_t bufsize); 00058 typedef long (*OSRTStreamBlockingReadProc) 00059 (struct OSRTStream* pStream, ASN1OCTET* pbuffer, size_t toReadBytes); 00060 00065 typedef int (*OSRTStreamFlushProc)(struct OSRTStream* pStream); 00066 00071 typedef int (*OSRTStreamCloseProc)(struct OSRTStream* pStream); 00072 00077 typedef long (*OSRTStreamWriteProc)(struct OSRTStream* pStream, 00078 const ASN1OCTET* data, size_t numocts); 00079 00085 typedef int (*OSRTStreamSkipProc) 00086 (struct OSRTStream* pStream, size_t skipBytes); 00087 00093 typedef int (*OSRTStreamMarkProc) 00094 (struct OSRTStream* pStream, size_t readAheadLimit); 00095 00101 typedef int (*OSRTStreamResetProc) (struct OSRTStream* pStream); 00102 00103 #define OSRTSTRMF_INPUT 0x0001 00104 #define OSRTSTRMF_OUTPUT 0x0002 00105 #define OSRTSTRMF_REQBUFFER 0x4000 00106 #define OSRTSTRMF_BUFFERED 0x8000 00107 00108 #define OSRTSTRMF_BUF_INPUT (OSRTSTRMF_INPUT|OSRTSTRMF_BUFFERED) 00109 #define OSRTSTRMF_BUF_OUTPUT (OSRTSTRMF_OUTPUT|OSRTSTRMF_BUFFERED) 00110 00111 00112 #define OSRTSTRMID_FILE 1 00113 #define OSRTSTRMID_SOCKET 2 00114 #define OSRTSTRMID_MEMORY 3 00115 #define OSRTSTRMID_BUFFERED 4 00116 #define OSRTSTRMID_DIRECTBUF 5 00117 #define OSRTSTRMID_USER 1000 00118 00119 #define OSRTSTRM_K_BUFSIZE 1024 00120 00121 #define OSRTSTRM_K_INVALIDMARK ((ASN1UINT)-1) 00122 00123 #define OSRTSTREAM_BYTEINDEX(pctxt) \ 00124 ((pctxt)->pStream->bytesProcessed + (pctxt)->buffer.byteIndex) 00125 00132 typedef struct OSRTStream { 00133 OSRTStreamReadProc read; 00134 OSRTStreamBlockingReadProc blockingRead;/*< pointer to blockingRead function*/ 00135 OSRTStreamWriteProc write; 00136 OSRTStreamFlushProc flush; 00137 OSRTStreamCloseProc close; 00138 OSRTStreamSkipProc skip; /*< pointer to skip function */ 00139 OSRTStreamMarkProc mark; /*< pointer to mark function */ 00140 OSRTStreamResetProc reset; /*< pointer to reset function */ 00141 void* extra; 00143 size_t bufsize; 00144 size_t readAheadLimit; 00145 size_t bytesProcessed; 00146 size_t markedBytesProcessed; 00147 size_t ioBytes; 00149 ASN1UINT id; 00150 ASN1USINT flags; 00152 } OSRTStream; 00153 00169 EXTERNRT int rtStreamRelease (ASN1CTXT* pctxt); 00170 00180 EXTERNRT int rtStreamClose (ASN1CTXT* pctxt); 00181 00196 EXTERNRT int rtStreamFlush (ASN1CTXT* pctxt); 00197 00207 EXTERNRT int rtStreamInit (ASN1CTXT* pctxt); 00208 00229 EXTERNRT long rtStreamRead 00230 (ASN1CTXT* pctxt, ASN1OCTET* pbuffer, size_t bufsize); 00231 00248 EXTERNRT long rtStreamBlockingRead 00249 (ASN1CTXT* pctxt, ASN1OCTET* pbuffer, size_t readBytes); 00250 00268 EXTERNRT int rtStreamSkip (ASN1CTXT* pctxt, size_t skipBytes); 00269 00287 EXTERNRT long rtStreamWrite 00288 (ASN1CTXT* pctxt, const ASN1OCTET* data, size_t numocts); 00289 00304 EXTERNRT int rtStreamGetIOBytes (ASN1CTXT* pctxt, size_t* pPos); 00305 00306 /* for compatibility with v.5.6 only */ 00307 EXTERNRT int rtStreamGetIOBytes56 (ASN1CTXT* pctxt); 00308 #if defined (ACVERSION) && ACVERSION <= 560 00309 #define rtStreamGetIOBytes(ctxt) rtStreamGetIOBytes56(ctxt) 00310 #endif 00311 00326 EXTERNRT int rtStreamMark (ASN1CTXT* pctxt, size_t readAheadLimit); 00327 00337 EXTERNRT int rtStreamReset (ASN1CTXT* pctxt); 00338 00349 EXTERNRT ASN1BOOL rtStreamMarkSupported (ASN1CTXT* pctxt); 00350 00359 EXTERNRT ASN1BOOL rtStreamIsOpened (ASN1CTXT* pctxt); 00360 00369 EXTERNRT ASN1BOOL rtStreamIsReadable (ASN1CTXT* pctxt); 00370 00379 EXTERNRT ASN1BOOL rtStreamIsWritable (ASN1CTXT* pctxt); 00380 00407 EXTERNRT int rtStreamBufClose (ASN1CTXT* pctxt); 00408 00423 EXTERNRT int rtStreamBufFlush (ASN1CTXT* pctxt); 00424 00434 EXTERNRT int rtStreamBufInit (ASN1CTXT* pctxt); 00435 00455 EXTERNRT int rtStreamBufMark (ASN1CTXT* pctxt, size_t readAheadLimit); 00456 00477 EXTERNRT int rtStreamBufPreRead (ASN1CTXT* pctxt, size_t size); 00478 00499 EXTERNRT int rtStreamBufRead (ASN1CTXT* pctxt, ASN1OCTET* pdata, size_t size); 00500 00518 EXTERNRT int rtStreamBufSkip (ASN1CTXT* pctxt, size_t skipBytes); 00519 00534 EXTERNRT int rtStreamBufReset (ASN1CTXT* pctxt); 00535 00556 EXTERNRT int rtStreamBufWrite (ASN1CTXT* pctxt, 00557 const ASN1OCTET* data, 00558 size_t numocts); 00559 00584 EXTERNRT int rtStreamFileAttach (ASN1CTXT* pctxt, 00585 FILE* pFile, ASN1USINT flags); 00586 00602 EXTERNRT int rtStreamFileOpen (ASN1CTXT* pctxt, 00603 const char* pFilename, ASN1USINT flags); 00604 00615 EXTERNRT int rtStreamFileCreateReader (ASN1CTXT* pctxt, const char* pFilename); 00616 00627 EXTERNRT int rtStreamFileCreateWriter (ASN1CTXT* pctxt, const char* pFilename); 00628 00646 EXTERNRT int rtStreamSocketAttach (ASN1CTXT* pctxt, 00647 OSRTSOCKET socket, ASN1USINT flags); 00648 00661 EXTERNRT int rtStreamSocketCreateReader (ASN1CTXT* pctxt, OSRTSOCKET socket); 00662 00674 EXTERNRT int rtStreamSocketCreateWriter (ASN1CTXT* pctxt, 00675 const char* host, int port); 00676 00686 EXTERNRT int rtStreamSocketCreateWriter2 (ASN1CTXT* pctxt, OSRTSOCKET socket); 00687 00697 EXTERNRT int rtStreamSocketSetOwnership (ASN1CTXT* pctxt, ASN1BOOL ownSocket); 00698 00699 /* memory streams */ 00715 EXTERNRT int rtStreamMemoryCreate (ASN1CTXT* pctxt, ASN1USINT flags); 00716 00733 EXTERNRT int rtStreamMemoryAttach (ASN1CTXT* pctxt, ASN1OCTET* pMemBuf, 00734 size_t bufSize, ASN1USINT flags); 00735 00746 EXTERNRT ASN1OCTET* rtStreamMemoryGetBuffer (ASN1CTXT* pctxt, size_t* pSize); 00747 00758 EXTERNRT int rtStreamMemoryCreateReader 00759 (ASN1CTXT* pctxt, ASN1OCTET* pMemBuf, size_t bufSize); 00760 00774 EXTERNRT int rtStreamMemoryCreateWriter 00775 (ASN1CTXT* pctxt, ASN1OCTET* pMemBuf, size_t bufSize); 00776 00779 #ifdef __cplusplus 00780 } 00781 #endif 00782 00783 #endif /* _RTSTREAM_H_ */ 00784

Copyright © 1997-2004 Objective Systems,Inc.
All Rights Reserved.
This document may be distributed in any form, electronic
or otherwise, provided that it is distributed in its entirety
and that the copyright and this notice are included.

This file was last modified on 1 Oct 2004.
ASN1C C/C++ Common Runtime, ASN1C v5.7x