00001 /*00002 * Copyright (c) 2003-2006 Objective Systems, Inc.00003 *00004 * This software is furnished under a license and may be used and copied00005 * only in accordance with the terms of such license and with the00006 * inclusion of the above copyright notice. This software or any other00007 * copies thereof may not be provided or otherwise made available to any00008 * other person. No title to and ownership of the software is hereby00009 * transferred.00010 *00011 * The information in this software is subject to change without notice00012 * and should not be construed as a commitment by Objective Systems, Inc.00013 *00014 * PROPRIETARY NOTICE00015 *00016 * This software is an unpublished work subject to a confidentiality agreement00017 * 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 indicate00021 * 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 OSENCBUFSIZ00036#define OSENCBUFSIZ 16*1024 /* dynamic encode buffer extent size */00037 #endif00038
00051typedefstruct {
00052OSOCTET* data; /* pointer to start of data buffer */00053 size_t byteIndex; /* byte index */00054 size_t size; /* current buffer size */00055OSBOOL 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
00070typedefstruct {
00071constOSUTF8CHAR* module;
00072OSINT32 lineno;
00073 } OSErrLocn;
00074
00085typedefstruct {
00086OSErrLocn stack[OSERRSTKSIZ];
00087OSINT16 status;
00088OSUINT8 stkx;
00089OSUINT8 parmcnt;
00090OSUTF8CHAR* parms[OSMAXERRPRM];
00091 } OSErrInfo;
00092
00093typedefstruct OSErrInfoList {
00094OSRTDListlist; /* list of errors */00095OSErrInforeserved; /* error info elem, used if nomem to alloc */00096OSRTDListNodereservedNode; /* node placeholder for errInfo elem */00097 } OSErrInfoList;
00098
00105typedefstruct {
00106 size_t byteIndex; /* byte index */00107OSINT16 bitOffset; /* current bit offset (8 - 1) */00108OSUINT16 flags; /* flag bits */00109 } OSBufSave;
00110
00111typedefOSUINT16OSRTFLAGS;
00112
00120typedefstruct OSCTXT { /* run-time context block */00121void* pMsgMemHeap; /* internal message memory heap */00122void* pTypeMemHeap; /* memory heap */00123OSBufferbuffer; /* data buffer */00124OSBufSavesavedInfo; /* saved buffer info */00125OSErrInfoListerrInfo; /* run-time error info */00126OSUINT32initCode; /* code double word to indicate init */00127OSRTFLAGSflags; /* flag bits */00128OSOCTETlevel; /* nesting level */00129OSOCTETstate; /* encode/decode process state */00130struct OSRTStream* pStream; /* Stream */00131OSVoidPtrpAppInfo; /* Application specific info */00132 #ifdef _RT_ALLOC_FUNC_WITH_CONTEXT00133 OSVoidPtr pUserData; /* User specific context pointer */00134 #endif00135 } 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 first00148 * member should be a pointer to appInfo free function. 00149 */00150typedef 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 second00155 * member should be a pointer to appInfo reset function.00156 */00157typedef 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