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

Google


Objective Systems, Inc.

rtxMemBuf.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  *****************************************************************************/
00024 
00041 /* memory buffer */
00042 
00043 #ifndef _RTXMEMBUF_H_
00044 #define _RTXMEMBUF_H_
00045 
00046 #include "rtxsrc/rtxCommon.h"
00047 
00048 typedef struct OSMemBuf {
00049    OSCTXT*      pctxt;
00050    OSUINT32     segsize;        /* segment size                     */
00051    OSUINT32     startidx;       /* start index of useful info       */
00052    OSUINT32     usedcnt;        /* used byte count                  */
00053    OSUINT32     bufsize;        /* buffer size                      */
00054    OSUINT32     bitOffset;      /* bit offset                       */
00055    OSOCTET*     buffer;         /* memory buffer                    */
00056    OSBOOL       isDynamic;      /* is buffer allocated dynamically? */
00057 } OSMemBuf;
00058 
00059 #define OSMBDFLTSEGSIZE 1024
00060 
00061 #define OSMEMBUFPTR(pmb)    ((pmb)->buffer + (pmb)->startidx)
00062 #define OSMEMBUFENDPTR(pmb) ((pmb)->buffer + (pmb)->startidx + (pmb)->usedcnt)
00063 #define OSMEMBUFUSEDSIZE(pmb) ((size_t)(pmb)->usedcnt)
00064 
00065 #define OSMBAPPENDSTR(pmb,str) \
00066 rtxMemBufAppend(pmb,(OSOCTET*)str,strlen(str))
00067 
00068 #define OSMBAPPENDUTF8(pmb,str) \
00069 rtxMemBufAppend(pmb,(OSOCTET*)str,rtxUTF8LenBytes(str))
00070 
00071 #ifdef __cplusplus
00072 extern "C" {
00073 #endif
00074 
00075 /* Memory buffer functions */
00076 
00091 EXTERNRTX int rtxMemBufAppend 
00092 (OSMemBuf* pMemBuf, const OSOCTET* pdata, OSUINT32 nbytes);
00093 
00108 EXTERNRTX int rtxMemBufCut (OSMemBuf* pMemBuf, OSUINT32 fromOffset, OSUINT32 nbytes);
00109 
00117 EXTERNRTX void rtxMemBufFree (OSMemBuf* pMemBuf);
00118 
00127 EXTERNRTX OSOCTET* rtxMemBufGetData (OSMemBuf* pMemBuf, int* length);
00128 
00135 EXTERNRTX int rtxMemBufGetDataLen (OSMemBuf* pMemBuf); 
00136 
00149 EXTERNRTX void rtxMemBufInit (OSCTXT* pCtxt, OSMemBuf* pMemBuf, 
00150                               OSUINT32 segsize);
00151 
00169 EXTERNRTX void rtxMemBufInitBuffer (OSCTXT* pCtxt, OSMemBuf* pMemBuf, 
00170                                     OSOCTET* buf, OSUINT32 bufsize, 
00171                                     OSUINT32 segsize);
00172 
00182 EXTERNRTX int rtxMemBufPreAllocate (OSMemBuf* pMemBuf, OSUINT32 nbytes);
00183 
00190 EXTERNRTX void rtxMemBufReset (OSMemBuf* pMemBuf);
00191 
00207 EXTERNRTX int rtxMemBufSet (OSMemBuf* pMemBuf, OSOCTET value, OSUINT32 nbytes);
00208 
00217 EXTERNRTX int rtxMemBufTrimW (OSMemBuf* pMemBuf); 
00218 
00222 #ifdef __cplusplus
00223 }
00224 #endif
00225 
00226 #endif

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