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

Google


Objective Systems, Inc.

rtxContext.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  *****************************************************************************/
00025 /* generic run-time context structure */
00026 
00027 #ifndef _RTXCONTEXT_H_
00028 #define _RTXCONTEXT_H_
00029 
00030 #include "rtxsrc/rtxSysTypes.h"
00031 #include "rtxsrc/rtxDList.h"
00032 
00033 /* run-time message buffer structure */
00034 
00035 #ifndef OSENCBUFSIZ
00036 #define OSENCBUFSIZ 16*1024    /* dynamic encode buffer extent size     */
00037 #endif
00038 
00051 typedef struct {
00052    OSOCTET*     data;           /* pointer to start of data buffer      */
00053    size_t       byteIndex;      /* byte index                           */
00054    size_t       size;           /* current buffer size                  */
00055    OSBOOL       dynamic;        /* is buffer dynamic?                   */
00056 } OSBuffer;
00057 
00058 /* run-time error info structures */
00059 
00060 #define OSERRSTKSIZ     8       /* error stack size                     */
00061 #define OSMAXERRPRM     5       /* maximum error parameters             */
00062 
00070 typedef struct {
00071    const OSUTF8CHAR* module;
00072    OSINT32      lineno;
00073 } OSErrLocn;
00074 
00085 typedef struct {
00086    OSErrLocn    stack[OSERRSTKSIZ];
00087    OSINT16      status;
00088    OSUINT8      stkx;
00089    OSUINT8      parmcnt;
00090    OSUTF8CHAR* parms[OSMAXERRPRM];
00091 } OSErrInfo;
00092 
00093 typedef struct OSErrInfoList {
00094    OSRTDList list;              /* list of errors */
00095    OSErrInfo reserved;          /* error info elem, used if nomem to alloc */
00096    OSRTDListNode reservedNode;  /* node placeholder for errInfo elem       */
00097 } OSErrInfoList;
00098 
00105 typedef struct {
00106    size_t      byteIndex;      /* byte index                           */
00107    OSINT16     bitOffset;      /* current bit offset (8 - 1)           */
00108    OSUINT16    flags;          /* flag bits                            */
00109 } OSBufSave;
00110 
00111 typedef OSUINT16 OSRTFLAGS;
00112 
00120 typedef struct OSCTXT {          /* run-time context block               */
00121    void*         pMsgMemHeap;    /* internal message memory heap         */
00122    void*         pTypeMemHeap;   /* memory heap                          */
00123    OSBuffer      buffer;         /* data buffer                          */
00124    OSBufSave     savedInfo;      /* saved buffer info                    */
00125    OSErrInfoList errInfo;        /* run-time error info                  */
00126    OSUINT32      initCode;       /* code double word to indicate init    */
00127    OSRTFLAGS     flags;          /* flag bits                            */
00128    OSOCTET       level;          /* nesting level                        */
00129    OSOCTET       state;          /* encode/decode process state          */
00130    struct OSRTStream* pStream;   /* Stream                               */
00131    OSVoidPtr     pAppInfo;        /* Application specific info            */
00132 #ifdef _RT_ALLOC_FUNC_WITH_CONTEXT
00133    OSVoidPtr     pUserData;       /* User specific context pointer        */
00134 #endif
00135 } OSCTXT;
00136 
00137 #define OS_GET_FIRST_ERROR_INFO(pctxt) \
00138 (((pctxt)->errInfo.list.head == 0) ? (OSErrInfo*)0 : \
00139 (OSErrInfo*)((pctxt)->errInfo.list.head->data))
00140 
00141 #define OS_GET_LAST_ERROR_INFO(pctxt) \
00142 (((pctxt)->errInfo.list.tail == 0) ? (OSErrInfo*)0 : \
00143 (OSErrInfo*)((pctxt)->errInfo.list.tail->data))
00144 
00145 /*
00146  * OSFreeCtxtAppInfoPtr is a pointer to pctxt->pAppInfo free function,
00147  * The pctxt->pAppInfo should contain the pointer to a structure and its first
00148  * member should be a pointer to appInfo free function. 
00149  */
00150 typedef int (*OSFreeCtxtAppInfoPtr)(OSCTXT* pctxt);
00151 
00152 /*
00153  * OSResetCtxtAppInfoPtr is a pointer to pctxt->pAppInfo reset function,
00154  * The pctxt->pAppInfo should contain the pointer to a structure and its second
00155  * member should be a pointer to appInfo reset function.
00156  */
00157 typedef int (*OSResetCtxtAppInfoPtr)(OSCTXT* pctxt);
00158 
00162 #define OSRTISSTREAM(pctxt) \
00163 ((pctxt)->pStream != 0 && !((pctxt)->flags & OSDISSTRM))
00164 
00165 #define OSRTBUFSAVE(pctxt) { \
00166 (pctxt)->savedInfo.byteIndex = (pctxt)->buffer.byteIndex; \
00167 (pctxt)->savedInfo.flags = (pctxt)->flags; }
00168 
00169 #define OSRTBUFRESTORE(pctxt) { \
00170 (pctxt)->buffer.byteIndex = (pctxt)->savedInfo.byteIndex; \
00171 (pctxt)->flags = (pctxt)->savedInfo.flags; }
00172 
00173 /* OSCTXT flag mask values */
00174 
00175 #define OSDIAG          0x8000  /* diagnostic tracing enabled           */
00176 #define OSTRACE         0x4000  /* tracing enabled                      */
00177 #define OSASN1INDEF     0x2000  /* ASN.1 indef len message              */
00178 #define OSASN1LASTEOC   0x1000  /* Last EOC detected in ASN.1 message   */
00179 #define OSFASTCOPY      0x0800  /* turns on "fast copy" mode            */
00180 #define OSASN1CONSTAG   0x0400  /* form of last parsed ASN.1 tag        */
00181 #define OSDISSTRM       0x0200  /* disable encode/decode to/from stream */
00182 #define OSSAVEBUF       0x0100  /* do not free dynamic encode buffer    */
00183 #define OSUPCASE        0x0080  /* convert characters to upper case     */
00184 
00185 #endif

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