summaryrefslogtreecommitdiffstats
path: root/public/sdk/inc/asn1util.h
blob: 443e91a625478a03e244f76568e4bfaa920e875a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/*****************************************************************************/
/* 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 */