Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

222 lines
6.4 KiB

  1. /*****************************************************************************/
  2. /* Copyright (C) 1989-1999 Open Systems Solutions, Inc. All rights reserved.*/
  3. /*****************************************************************************/
  4. /* THIS FILE IS PROPRIETARY MATERIAL OF OPEN SYSTEMS SOLUTIONS, INC.
  5. * AND MAY BE USED ONLY BY DIRECT LICENSEES OF OPEN SYSTEMS SOLUTIONS, INC.
  6. * THIS FILE MAY NOT BE DISTRIBUTED. */
  7. /**************************************************************************/
  8. /* FILE: @(#)asn1util.h 5.22.1.3 97/06/19 */
  9. /* */
  10. /* function: Support routines definitions for the optimized */
  11. /* encoder/decoder generated by the OSS ASN.1 Compiler */
  12. /* */
  13. /* */
  14. /* changes: */
  15. /* 11/16/90 pet created */
  16. /* */
  17. /**************************************************************************/
  18. #if _MSC_VER > 1000
  19. #pragma once
  20. #endif
  21. #include "ossdll.h"
  22. #if defined(_MSC_VER) && (defined(_WIN32) || defined(WIN32))
  23. #pragma pack(push, ossPacking, 4)
  24. #elif defined(_MSC_VER) && (defined(_WINDOWS) || defined(_MSDOS))
  25. #pragma pack(1)
  26. #elif defined(__BORLANDC__) && defined(__MSDOS__)
  27. #ifdef _BC31
  28. #pragma option -a-
  29. #else
  30. #pragma option -a1
  31. #endif /* _BC31 */
  32. #elif defined(__BORLANDC__) && defined(__WIN32__)
  33. #pragma option -a4
  34. #elif defined(__IBMC__)
  35. #pragma pack(4)
  36. #elif defined(__WATCOMC__) && defined(__NT__)
  37. #pragma pack(push, 4)
  38. #elif defined(__WATCOMC__) && (defined(__WINDOWS__) || defined(__DOS__))
  39. #pragma pack(push, 1)
  40. #endif /* _MSC_VER && _WIN32 */
  41. #ifdef macintosh
  42. #pragma options align=mac68k
  43. #endif
  44. /* The _MEM_ARRAY_SIZE size should be such that the size of the encDecVar
  45. * field be equal or greater than that of the world->c structure */
  46. #ifdef __hp9000s300
  47. #define _MEM_ARRAY_SIZE 34
  48. #endif
  49. #ifdef __alpha
  50. #ifdef __osf__
  51. #define _MEM_ARRAY_SIZE 43
  52. #endif /* __osf__ */
  53. #endif /* __alpha */
  54. #ifdef _AIX
  55. #define _MEM_ARRAY_SIZE 52
  56. #endif
  57. #ifdef __hp9000s700
  58. #define _MEM_ARRAY_SIZE 60
  59. #endif
  60. #ifdef __NeXT__
  61. #define _MEM_ARRAY_SIZE 66
  62. #endif
  63. #ifdef VAXC
  64. #define _MEM_ARRAY_SIZE 78
  65. #endif
  66. #ifdef __TANDEM
  67. # ifdef __XMEM
  68. # ifdef __INT32
  69. # define _MEM_ARRAY_SIZE 83
  70. # else /* INT32 */
  71. # define _MEM_ARRAY_SIZE 84
  72. # endif /* INT32 */
  73. # else /* XMEM */
  74. # define _MEM_ARRAY_SIZE 136
  75. # endif /* XMEM */
  76. #endif /* TANDEM */
  77. #ifdef __mips
  78. # define _MEM_ARRAY_SIZE 70
  79. #endif /* __mips */
  80. #ifdef _FTX /* Stratus's Fault-Tolerant Unix */
  81. #define _MEM_ARRAY_SIZE 84
  82. #endif
  83. #ifdef __HIGHC__
  84. #define _MEM_ARRAY_SIZE 52
  85. #endif /* __HIGHC__ */
  86. #if defined(_WIN32) || defined(_WINDOWS) || defined(__OS2__)
  87. #define _MEM_ARRAY_SIZE 52
  88. #endif /* _WIN32 || _WINDOWS || __OS2__ */
  89. #ifndef _MEM_ARRAY_SIZE
  90. #define _MEM_ARRAY_SIZE 60
  91. #endif
  92. typedef struct _mem_array_ {
  93. short _used; /* Next available entry */
  94. void *_entry[_MEM_ARRAY_SIZE]; /* Pointers to allocated
  95. * memory */
  96. struct _mem_array_ *_next; /* Pointer to additional mem_array */
  97. } _mem_array;
  98. #ifndef OSS_BOOL
  99. #define OSS_BOOL
  100. typedef char _Bool;
  101. #endif
  102. #ifndef OSSDEBUG
  103. #define OSSDEBUG 0
  104. #endif /* OSSDEBUG */
  105. typedef struct _encoding_ {
  106. long length; /* length of the encoding */
  107. char *value; /* pointer to encoding octets */
  108. } _encoding;
  109. typedef struct _enc_block_ {
  110. struct _enc_block_ *next; /* nested setofs form a list of these */
  111. long size; /* size of the encodings array */
  112. long used; /* number of items used in the array */
  113. _encoding *enc; /* pointer to array of encodings */
  114. _mem_array mem; /* previous encoding saved*/
  115. _mem_array *mem_tail;
  116. char *pos;
  117. long max_len;
  118. _Bool buffer_provided;
  119. long _encoding_length;
  120. } _enc_block;
  121. #ifndef _OSSNOANSI
  122. #ifdef __cplusplus
  123. extern "C"
  124. {
  125. #endif
  126. extern void *DLL_ENTRY _oss_enc_getmem(struct ossGlobal *g,_Bool _userbuf);
  127. extern void *DLL_ENTRY _oss_dec_getmem(struct ossGlobal *g,long _size,_Bool _userbuf);
  128. extern void DLL_ENTRY _oss_enc_push(struct ossGlobal *g,void *_p);
  129. extern void *DLL_ENTRY _oss_enc_pop(struct ossGlobal *g);
  130. extern void DLL_ENTRY _oss_freeMem(struct ossGlobal *g,_mem_array *_p);
  131. extern void DLL_ENTRY _oss_releaseMem(struct ossGlobal *g,_mem_array *_p);
  132. #define _oss_freeTempMem _oss_releaseMem
  133. extern void DLL_ENTRY _oss_set_outmem_d(struct ossGlobal *g, long _final_max_len,
  134. long *_totalsize, char **_outbuf);
  135. extern void DLL_ENTRY _oss_set_outmem_i(struct ossGlobal *g,long _final_max_len,
  136. long *_totalsize,char **_outbuf);
  137. extern void DLL_ENTRY _oss_set_outmem_p(struct ossGlobal *g,
  138. long *_totalsize,char **_outbuf);
  139. extern void DLL_ENTRY _oss_set_outmem_pb(struct ossGlobal *g,
  140. long *_totalsize, char **_outbuf, unsigned flags);
  141. extern void _oss_hdl_signal(int _signal);
  142. extern void DLL_ENTRY _oss_free_creal(struct ossGlobal *g, char *p);
  143. extern int DLL_ENTRY ossMinit(struct ossGlobal *g);
  144. extern void DLL_ENTRY _oss_beginBlock(struct ossGlobal *g, long count,
  145. char **pos, long *max_len);
  146. extern void DLL_ENTRY _oss_nextItem(struct ossGlobal *g, long *max_len);
  147. extern void DLL_ENTRY _oss_endBlock(struct ossGlobal *g, char **pos, long *max_len,
  148. unsigned char ct);
  149. extern void DLL_ENTRY _oss_freeDerBlocks(struct ossGlobal *g);
  150. extern void DLL_ENTRY _oss_freeGlobals(struct ossGlobal *g);
  151. #ifdef __cplusplus
  152. }
  153. #endif
  154. #else
  155. extern void *_oss_enc_getmem();
  156. extern void *_oss_dec_getmem();
  157. extern void _oss_enc_push();
  158. extern void *_oss_enc_pop();
  159. extern void _oss_freeMem();
  160. extern void _oss_releaseMem();
  161. #define _oss_freeTempMem _oss_releaseMem
  162. extern void _oss_set_outmem_d();
  163. extern void _oss_set_outmem_i();
  164. extern void _oss_set_outmem_p();
  165. extern void _oss_set_outmem_pb();
  166. extern void _oss_free_creal();
  167. extern void _oss_hdl_signal(); /* signal handler */
  168. extern void _oss_beginBlock();
  169. extern void _oss_nextItem();
  170. extern void _oss_endBlock();
  171. extern void _oss_freeDerBlocks();
  172. extern void _oss_freeGlobals();
  173. #endif /* _OSSNOANSI */
  174. #if defined(_MSC_VER) && (defined(_WIN32) || defined(WIN32))
  175. #pragma pack(pop, ossPacking)
  176. #elif defined(_MSC_VER) && (defined(_WINDOWS) || defined(_MSDOS))
  177. #pragma pack()
  178. #elif defined(__BORLANDC__) && (defined(__WIN32__) || defined(__MSDOS__))
  179. #pragma option -a.
  180. #elif defined(__IBMC__)
  181. #pragma pack()
  182. #elif defined(__WATCOMC__)
  183. #pragma pack(pop)
  184. #endif /* _MSC_VER && _WIN32 */
  185. #ifdef macintosh
  186. #pragma options align=reset
  187. #endif