summaryrefslogtreecommitdiffstats
path: root/public/sdk/inc/ossper.h
blob: bc51675a47c50d67f838dd17e3bbf01144bea6fd (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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
/*****************************************************************************/
/* Copyright (C) 1989-1996 Open Systems Solutions, Inc.  All rights reserved.*/
/*****************************************************************************/
/**************************************************************************/
/*
/*  FILE:  @(#)ossper.h	1.5 96/02/27				  */
/*							 		  */
/* function: Define the interfaces to the routines in ossper.a for the    */
/* OSS optimized encoder and decoder.					  */
/*									  */
/*									  */
/**************************************************************************/

#ifndef ossper_hdr_file
#define ossper_hdr_file

#include <limits.h>
#include "asn1hdr.h"

#define Aligned   1
#define Unaligned 0

struct _enum_data {
	int      num;    /* number of enumerations */
	int     *enums;  /* pointer to sorted array of enumerations */
};

struct _char_data {
	int      num;    /* number of characters in PermittedAlphabet */
	void     *pa;  /* pointer to PermittedAlphabet char string */
	void     *ia;  /* pointer to inverted indices string */
};

extern void _oss_append(struct ossGlobal *g, unsigned char *field, unsigned long length,
			int align);

extern void _oss_penc_unconstr_int(struct ossGlobal *g,
	    LONG_LONG value);

extern void _oss_penc_semicon_int(struct ossGlobal *g,
	    LONG_LONG value, LONG_LONG lower_bound);

extern void _oss_penc_semicon_uint(struct ossGlobal *g,
	    ULONG_LONG value, ULONG_LONG lower_bound);

extern void _oss_penc_nonneg_int(struct ossGlobal *g,
	    ULONG_LONG value, ULONG_LONG range);

extern void _oss_penc_indeflen_int(struct ossGlobal *g,
	    ULONG_LONG value, ULONG_LONG range);

extern void _oss_penc_small_int(struct ossGlobal *g, ULONG_LONG value);

extern void _oss_penc_enum(struct ossGlobal *g, long data,
	 struct _enum_data *root,
	 struct _enum_data *extension);

extern void _oss_penc_uenum(struct ossGlobal *g, unsigned long data,
	 struct _enum_data *root,
	 struct _enum_data *extension);

extern void _oss_penc_real(struct ossGlobal *g, double value);
extern void _oss_penc_creal(struct ossGlobal *g, char *value);
extern void _oss_penc_mreal(struct ossGlobal *g, MixedReal value);

extern void _oss_penc_constr_bpbit(struct ossGlobal *g, void *value,
	ULONG_LONG lb, ULONG_LONG ub, _Bool NamedBits,
	_Bool Ext);

extern void _oss_penc_constr_pbit(struct ossGlobal *g, ULONG_LONG value,
	ULONG_LONG size, ULONG_LONG lb, ULONG_LONG ub, _Bool NamedBits,
	_Bool Ext);

extern void _oss_penc_constr_bit(struct ossGlobal *g, unsigned char *value,
	ULONG_LONG length, ULONG_LONG lb, ULONG_LONG ub, _Bool NamedBits,
	_Bool Ext);

extern void _oss_penc_unconstr_bit(struct ossGlobal *g, unsigned char *value,
	ULONG_LONG length, _Bool NamedBits);

extern void _oss_penc_unconstr_pbit(struct ossGlobal *g, ULONG_LONG value,
	ULONG_LONG length, ULONG_LONG size, _Bool NamedBits);

extern unsigned long _oss_penc_length(struct ossGlobal *g, ULONG_LONG length,
		  ULONG_LONG lb, ULONG_LONG ub, _Bool ext);

extern void _oss_penc_small_len(struct ossGlobal *g, ULONG_LONG length);

extern void _oss_penc_unconstr_oct(struct ossGlobal *g, unsigned char *value,
	 ULONG_LONG length);

extern void _oss_penc_constr_oct(struct ossGlobal *g, unsigned char *value,
	 ULONG_LONG length, ULONG_LONG lb, ULONG_LONG ub);

extern struct ossGlobal *_oss_push_global(struct ossGlobal *g);
extern struct ossGlobal *_oss_pop_global(struct ossGlobal *g);

extern void _oss_penc_objids(struct ossGlobal *g, unsigned short *value,
   unsigned long length);
extern void _oss_penc_objidi(struct ossGlobal *g, unsigned int *value,
   unsigned long length);
extern void _oss_penc_objidl(struct ossGlobal *g, unsigned long *value,
   unsigned long length);
extern void _oss_penc_link_objids(struct ossGlobal *g, void *value);
extern void _oss_penc_link_objidi(struct ossGlobal *g, void *value);
extern void _oss_penc_link_objidl(struct ossGlobal *g, void *value);

extern void _oss_penc_opentype(struct ossGlobal *g, void *value);
extern void _oss_penc_nkmstr(struct ossGlobal *g, char *value, ULONG_LONG length);
extern void _oss_penc_kmstr(struct ossGlobal *g, char *value, ULONG_LONG length,
     ULONG_LONG lb, ULONG_LONG ub, int bits, long index,
     _Bool ext);
extern void _oss_penc_bmpstr(struct ossGlobal *g, unsigned short *value,
     ULONG_LONG length, ULONG_LONG lb, ULONG_LONG ub, int bits, long index,
     _Bool ext);
#if INT_MAX == 2147483647
extern void _oss_penc_unistr(struct ossGlobal *g, int *value,
     ULONG_LONG length, ULONG_LONG lb, ULONG_LONG ub, int bits, long index,
     _Bool ext);
#else
extern void _oss_penc_unistr(struct ossGlobal *g, long *value,
     ULONG_LONG length, ULONG_LONG lb, ULONG_LONG ub, int bits, long index,
     _Bool ext);
#endif

extern void _oss_penc_gtime(struct ossGlobal *g, GeneralizedTime *time);
extern void _oss_penc_utime(struct ossGlobal *g, UTCTime *time);

void _oss_penc_uany(struct ossGlobal *g, void *data );

void _oss_penc_unconstr_huge(struct ossGlobal *g, void *data );

/* decoding functions */

extern unsigned char _oss_get_bit(struct ossGlobal *g, int align);

extern void _oss_get_bits(struct ossGlobal *g, unsigned char *field,
			unsigned long length, int align);

unsigned char _oss_get_octet(struct ossGlobal *g, int align);

extern LONG_LONG _oss_pdec_unconstr_int(struct ossGlobal *g);

extern LONG_LONG _oss_pdec_semicon_int(struct ossGlobal *g,
	    LONG_LONG lower_bound);

extern ULONG_LONG _oss_pdec_semicon_uint(struct ossGlobal *g,
	    ULONG_LONG lower_bound);

extern ULONG_LONG _oss_pdec_nonneg_int(struct ossGlobal *g,
	    ULONG_LONG range);

extern ULONG_LONG _oss_pdec_indeflen_int(struct ossGlobal *g,
	    ULONG_LONG range);

extern ULONG_LONG _oss_pdec_small_int(struct ossGlobal *g);

extern long _oss_pdec_enum(struct ossGlobal *g,
	 struct _enum_data *root,
	 struct _enum_data *extension);

extern unsigned long _oss_pdec_uenum(struct ossGlobal *g,
	 struct _enum_data *root,
	 struct _enum_data *extension);


double _oss_pdec_binreal(struct ossGlobal *g, unsigned char s, long len);
void _oss_pdec_chrreal(struct ossGlobal *g, unsigned char s, long len,
     double *num_out, unsigned char *str_out);

extern float     _oss_pdec_freal(struct ossGlobal *g);
extern double    _oss_pdec_real(struct ossGlobal *g);
extern char *    _oss_pdec_creal(struct ossGlobal *g);
extern MixedReal _oss_pdec_mreal(struct ossGlobal *g);

extern void _oss_pdec_length(struct ossGlobal *g, unsigned long *length,
		  ULONG_LONG lb, ULONG_LONG ub, _Bool *last);

void _oss_pdec_unconstr_ubit(struct ossGlobal *g, void *length,
	 unsigned char **value, int lengthsize);

void _oss_pdec_unconstr_vbit_ptr(struct ossGlobal *g, void **ptr,
	 int lengthsize);

void _oss_pdec_unconstr_vbit(struct ossGlobal *g, void *length,
	 unsigned char *value, int lengthsize, ULONG_LONG datasize);

void _oss_pdec_unconstr_pbit(struct ossGlobal *g, void *value,
	int size);

void _oss_pdec_unconstr_bpbit(struct ossGlobal *g, unsigned char *value,
	long size);

void _oss_pdec_constr_ubit(struct ossGlobal *g, void *length,
	 unsigned char **value, int lengthsize,
	 ULONG_LONG lb, ULONG_LONG ub);

void _oss_pdec_constr_vbit(struct ossGlobal *g, void *length,
	unsigned char  *value, int lengthsize,
	ULONG_LONG lb, ULONG_LONG ub);

void _oss_pdec_constr_pbit(struct ossGlobal *g, void *value,
	int size, ULONG_LONG lb, ULONG_LONG ub);

void _oss_pdec_constr_bpbit(struct ossGlobal *g, unsigned char *value,
	int size, ULONG_LONG lb, ULONG_LONG ub);

void _oss_pdec_unconstr_uoct(struct ossGlobal *g, void *length,
	 unsigned char **value, int lengthsize);

void _oss_pdec_unconstr_voct_ptr(struct ossGlobal *g, void **ptr,
	 int lengthsize);

void _oss_pdec_constr_voct_ptr(struct ossGlobal *g, void **ptr,
	 int lengthsize, ULONG_LONG lb, ULONG_LONG ub);

void _oss_pdec_constr_uoct(struct ossGlobal *g, void *length,
	unsigned char **value, int lengthsize, ULONG_LONG lb, ULONG_LONG ub);

void _oss_pdec_constr_voct(struct ossGlobal *g, void *length,
	unsigned char  *value, int lengthsize, ULONG_LONG lb, ULONG_LONG ub);

void _oss_pdec_unconstr_voct(struct ossGlobal *g, void *length,
	unsigned char  *value, int lengthsize, ULONG_LONG ub);

struct ossGlobal *_oss_pdec_push(struct ossGlobal *g);
struct ossGlobal *_oss_pdec_pop(struct ossGlobal *g);

unsigned long _oss_pdec_eap(struct ossGlobal *g, unsigned char **ext);
void _oss_pdec_eas(struct ossGlobal *g, unsigned char *ext,
	 unsigned long count, unsigned long ea_num);

void _oss_pdec_lsof(struct ossGlobal *g, unsigned long *count,
    ULONG_LONG lb, ULONG_LONG ub, unsigned char ext,
    _Bool *last);

void _oss_pdec_usof(struct ossGlobal *g, unsigned long *count,
    unsigned char **value, int lengthsize, long itemsize,
    ULONG_LONG lb, ULONG_LONG ub, unsigned char ext,
    _Bool *last);

void _oss_pdec_asof(struct ossGlobal *g, unsigned long *count,
    int lengthsize,
    ULONG_LONG lb, ULONG_LONG ub, unsigned char ext,
    _Bool *last);

void _oss_pdec_asof_ptr(struct ossGlobal *g, void **ptr,
    int lengthsize, long itemsize, long prefixsize,
    _Bool *last);

void _oss_pdec_aobjids(struct ossGlobal *g, unsigned short *value,
    unsigned short *count, unsigned short array_size);

void _oss_pdec_aobjidi(struct ossGlobal *g, unsigned int   *value,
    unsigned short *count, unsigned short array_size);

void _oss_pdec_aobjidl(struct ossGlobal *g, unsigned long  *value,
    unsigned short *count, unsigned short array_size);

void _oss_pdec_aobjids_ptr(struct ossGlobal *g, void **ptr);
void _oss_pdec_aobjidi_ptr(struct ossGlobal *g, void **ptr);
void _oss_pdec_aobjidl_ptr(struct ossGlobal *g, void **ptr);

void _oss_pdec_uobjids(struct ossGlobal *g, unsigned short **value,
	 unsigned short *count);
void _oss_pdec_uobjidi(struct ossGlobal *g, unsigned int **value,
	 unsigned short *count);
void _oss_pdec_uobjidl(struct ossGlobal *g, unsigned long **value,
	 unsigned short *count);

void _oss_pdec_link_objids(struct ossGlobal *g, void **ptr);
void _oss_pdec_link_objidi(struct ossGlobal *g, void **ptr);
void _oss_pdec_link_objidl(struct ossGlobal *g, void **ptr);

void _oss_pdec_ntp_kmstr(struct ossGlobal *g, char **ptr,
     ULONG_LONG lb, ULONG_LONG ub, int bits, long index,
     _Bool ext);

void _oss_pdec_nt_kmstr(struct ossGlobal *g, void *ptr,
     ULONG_LONG lb, ULONG_LONG ub, int bits, long index,
     _Bool ext);

void _oss_pdec_vap_kmstr(struct ossGlobal *g, void **ptr, int lengthsize,
     ULONG_LONG lb, ULONG_LONG ub, int bits, long index,
     _Bool ext);

void _oss_pdec_va_kmstr(struct ossGlobal *g, void *length, char *value,
     int lengthsize,
     ULONG_LONG lb, ULONG_LONG ub, int bits, long index,
     _Bool ext);

void _oss_pdec_ub_kmstr(struct ossGlobal *g, void *length, char **ptr,
     int lengthsize,
     ULONG_LONG lb, ULONG_LONG ub, int bits, long index,
     _Bool ext);

void _oss_pdec_bmpstr(struct ossGlobal *g, void *length, unsigned short **ptr,
     int lengthsize,
     ULONG_LONG lb, ULONG_LONG ub, int bits, long index,
     _Bool ext);

#if INT_MAX == 2147483647
void _oss_pdec_unistr(struct ossGlobal *g, void *length, int **ptr,
     int lengthsize,
     ULONG_LONG lb, ULONG_LONG ub, int bits, long index,
     _Bool ext);
#else
void _oss_pdec_unistr(struct ossGlobal *g, void *length, long **ptr,
     int lengthsize,
     ULONG_LONG lb, ULONG_LONG ub, int bits, long index,
     _Bool ext);
#endif

void _oss_pdec_ntp_nkmstr(struct ossGlobal *g, char **ptr);
void _oss_pdec_nt_nkmstr(struct ossGlobal *g, char *value, unsigned long ub);
void _oss_pdec_vap_nkmstr(struct ossGlobal *g, void **ptr, int lengthsize);
void _oss_pdec_va_nkmstr(struct ossGlobal *g, void *length, char *value,
	 int lengthsize, unsigned long ub);
void _oss_pdec_ub_nkmstr(struct ossGlobal *g, void *length, char **ptr,
     int lengthsize);

void _oss_pdec_pad_kmstr(struct ossGlobal *g, void *ptr,
     ULONG_LONG lb, ULONG_LONG ub, int bits, long index,
     _Bool ext);

void _oss_pdec_pad_kmstr_ptr(struct ossGlobal *g, char **ptr,
     ULONG_LONG lb, ULONG_LONG ub, int bits, long index,
     _Bool ext);

void _oss_pdec_opentype(struct ossGlobal *g, void *data );
void _oss_pdec_uany(struct ossGlobal *g, void *data );

void _oss_pdec_gtime(struct ossGlobal *g, GeneralizedTime *data);
void _oss_pdec_utime(struct ossGlobal *g, UTCTime *data);

struct _char_data *_oss_get_char_data(struct ossGlobal *g,
   int index);

void _oss_pdec_unconstr_huge(struct ossGlobal *g, void *data );

#endif /* ossper_hdr_file */