summaryrefslogblamecommitdiffstats
path: root/public/sdk/inc/asn1util.h
blob: 443e91a625478a03e244f76568e4bfaa920e875a (plain) (tree)




















































































































































































                                                                                      
/*****************************************************************************/
/* Copyright (C) 1989-1996 Open Systems Solutions, Inc.  All rights reserved.*/
/*****************************************************************************/

/* THIS FILE IS PROPRIETARY MATERIAL OF OPEN SYSTEMS SOLUTIONS, INC.
 * AND MAY ONLY BE USED BY DIRECT LICENSEES OF OPEN SYSTEM SOLUTIONS, INC.
 * THIS FILE MAY NOT BE DISTRIBUTED. */

/**************************************************************************/
/* FILE: @(#)asn1util.h	5.4  96/04/23			  */
/*							 		  */
/* function: Support routines definitions for the optimized		  */
/* encoder/decoder generated by the OSS ASN.1 Compiler			  */
/*									  */
/*									  */
/* changes:								  */
/*	11/16/90  pet	created						  */
/*									  */
/**************************************************************************/

#include "ossdll.h"

#if defined(_MSC_VER) && (defined(_WIN32) || defined(WIN32))
#pragma pack(push, ossPacking, 4)
#elif defined(_MSC_VER) && (defined(_WINDOWS) || defined(_MSDOS))
#pragma pack(1)
#elif defined(__BORLANDC__) && defined(__MSDOS__)
#pragma option -a1
#elif defined(__BORLANDC__) && defined(__WIN32__)
#pragma option -a4
#elif defined(__IBMC__)
#pragma pack(4)
#endif /* _MSC_VER && _WIN32 */

/* The _MEM_ARRAY_SIZE size should be such that the size of the encDecVar
 * field be equal or greater than that of the world->c structure */

#ifdef __hp9000s300
#define _MEM_ARRAY_SIZE	34
#endif

#ifdef __alpha
#ifdef __osf__
#define _MEM_ARRAY_SIZE	43
#endif	/* __osf__ */
#endif	/* __alpha */

#ifdef _AIX
#define _MEM_ARRAY_SIZE	52
#endif
#ifdef __hp9000s700
#define _MEM_ARRAY_SIZE	60
#endif

#ifdef __NeXT__
#define _MEM_ARRAY_SIZE	66
#endif

#ifdef VAXC
#define _MEM_ARRAY_SIZE	78
#endif

#ifdef __TANDEM
#	ifdef __XMEM
#	ifdef __INT32
#	define _MEM_ARRAY_SIZE	83
#	else	/* INT32 */
#	define _MEM_ARRAY_SIZE	84
#	endif	/* INT32 */
#	else	/* XMEM */
#	define _MEM_ARRAY_SIZE	136
#	endif	/* XMEM */
#endif	/* TANDEM */

#ifdef __mips
#	define _MEM_ARRAY_SIZE       70
#endif	/* __mips */

#ifdef _FTX	/* Stratus's Fault Tolerant Unix */
#define _MEM_ARRAY_SIZE  92
#endif
#ifndef _MEM_ARRAY_SIZE
#define _MEM_ARRAY_SIZE	80

#endif

typedef struct _mem_array_ {
    short           _used;	                /* Next available entry */
    void           *_entry[_MEM_ARRAY_SIZE];	/* Pointers to allocated
						 * memory */
    struct _mem_array_ *_next;	/* Pointer to additional mem_array */
} _mem_array;
#if defined(_WINDOWS) || defined(_WIN32)
	/*
	 * This structure is used as a node to build a linked list of
	 * the addresses of the ossGlobal structures for each copy of
	 * the encoder/decoder run under Windows 3.1 to make the decoder
	 * reentrant when floating point errors occur (see globlist.c)
	 */ 
struct globalInfo {
	/*
	 * It is very important that "next" come first in "globalInfo".
	 * See globlist.c for more info about the code itself
	 */
    struct globalInfo   *next;  /* pointer to the next node in the list */
    struct globalInfo   *prev;  /* pointer to the previous node */
    DWORD                task;  /* process id number */
    DWORD                thread;/* thread  id number */
    struct ossGlobal    *world; /* pointer to "ossGlobal" for current task */
};
extern BOOL globlist(struct ossGlobal *, struct globalInfo *,
		     struct globalInfo **);
extern BOOL serializeGlobalAccess(struct ossGlobal *, struct globalInfo *,
				  struct globalInfo **);
extern struct globalInfo *sigworld;
#else
extern struct ossGlobal *sigworld;
#endif /* _WINDOWS || _WIN32 */

#ifndef _BOOL
#define _BOOL
typedef char _Bool;
#endif

#ifndef _OSSNOANSI

#ifdef __cplusplus
extern "C"
{
#endif

extern void *DLL_ENTRY _oss_enc_getmem(struct ossGlobal *g,_Bool _userbuf);
extern void *DLL_ENTRY _oss_dec_getmem(struct ossGlobal *g,long _size,_Bool _userbuf);
extern void  DLL_ENTRY _oss_enc_push(struct ossGlobal *g,void *_p);
extern void *DLL_ENTRY _oss_enc_pop(struct ossGlobal *g);
extern void  DLL_ENTRY _oss_freeMem(struct ossGlobal *g,_mem_array *_p);
extern void  DLL_ENTRY _oss_releaseMem(struct ossGlobal *g,_mem_array *_p);
#define _oss_freeTempMem _oss_releaseMem
extern void DLL_ENTRY  _oss_set_outmem_d(struct ossGlobal *g, long _final_max_len,
					long *_totalsize, char **_outbuf);
extern void DLL_ENTRY  _oss_set_outmem_i(struct ossGlobal *g,long _final_max_len,
					long *_totalsize,char **_outbuf);
extern void DLL_ENTRY  _oss_set_outmem_p(struct ossGlobal *g,
					long *_totalsize,char **_outbuf);
extern void DLL_ENTRY  _oss_set_outmem_pb(struct ossGlobal *g,
			long *_totalsize, char **_outbuf, unsigned flags);
extern void     _oss_hdl_signal(int _signal);
extern void DLL_ENTRY _oss_free_creal(struct ossGlobal *g, char *p);
extern int  DLL_ENTRY ossMinit(struct ossGlobal *g);
#ifdef __cplusplus
}
#endif

#else
extern void    *_oss_enc_getmem();
extern void    *_oss_dec_getmem();
extern void     _oss_enc_push();
extern void    *_oss_enc_pop();
extern void     _oss_freeMem();
extern void     _oss_releaseMem();
#define _oss_freeTempMem _oss_releaseMem
extern void     _oss_set_outmem_d();
extern void     _oss_set_outmem_i();
extern void     _oss_set_outmem_p();
extern void     _oss_set_outmem_pb();
extern void     _oss_free_creal();

extern void     _oss_hdl_signal();	/* signal handler */

#endif /* _OSSNOANSI */

#if defined(_MSC_VER) && (defined(_WIN32) || defined(WIN32))
#pragma pack(pop, ossPacking)
#elif defined(_MSC_VER) && (defined(_WINDOWS) || defined(_MSDOS))
#pragma pack()
#elif defined(__BORLANDC__) && (defined(__WIN32__) || defined(__MSDOS__))
#pragma option -a.
#elif defined(__IBMC__)
#pragma pack()
#endif /* _MSC_VER && _WIN32 */