Leaked source code of windows server 2003
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.

740 lines
23 KiB

  1. /* Copyright (C) Boris Nikolaus, Germany, 1996-1997. All rights reserved. */
  2. /* Copyright (C) Microsoft Corporation 1997-1998, All rights reserved. */
  3. #ifndef __MS_ASN1_H__
  4. #define __MS_ASN1_H__
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. /* ------ Basic integer types ------ */
  9. typedef unsigned char ASN1uint8_t;
  10. typedef signed char ASN1int8_t;
  11. typedef unsigned short ASN1uint16_t;
  12. typedef signed short ASN1int16_t;
  13. typedef unsigned long ASN1uint32_t;
  14. typedef signed long ASN1int32_t;
  15. /* ------ Function modifiers ------ */
  16. #ifdef ASN1LIB
  17. #define ASN1_PUBLIC __declspec(dllexport)
  18. #elif defined(ASN1C)
  19. #define ASN1_PUBLIC
  20. #else
  21. #define ASN1_PUBLIC __declspec(dllimport)
  22. #endif
  23. #define ASN1API __stdcall
  24. #define ASN1CALL __stdcall
  25. /* ------ Basic ASN.1 types ------ */
  26. typedef ASN1uint8_t ASN1octet_t;
  27. typedef ASN1uint8_t ASN1bool_t;
  28. typedef struct tagASN1intx_t
  29. {
  30. ASN1uint32_t length;
  31. ASN1octet_t *value;
  32. }
  33. ASN1intx_t;
  34. typedef struct tagASN1octetstring_t
  35. {
  36. ASN1uint32_t length;
  37. ASN1octet_t *value;
  38. }
  39. ASN1octetstring_t;
  40. typedef struct tagASN1octetstring2_t
  41. {
  42. ASN1uint32_t length;
  43. ASN1octet_t value[1];
  44. }
  45. ASN1octetstring2_t;
  46. typedef struct ASN1iterator_s
  47. {
  48. struct ASN1iterator_s *next;
  49. void *value;
  50. }
  51. ASN1iterator_t;
  52. typedef struct tagASN1bitstring_t
  53. {
  54. ASN1uint32_t length;
  55. ASN1octet_t *value;
  56. }
  57. ASN1bitstring_t;
  58. typedef char ASN1char_t;
  59. typedef struct tagASN1charstring_t
  60. {
  61. ASN1uint32_t length;
  62. ASN1char_t *value;
  63. }
  64. ASN1charstring_t;
  65. typedef ASN1uint16_t ASN1char16_t;
  66. typedef struct tagASN1char16string_t
  67. {
  68. ASN1uint32_t length;
  69. ASN1char16_t *value;
  70. }
  71. ASN1char16string_t;
  72. typedef ASN1uint32_t ASN1char32_t;
  73. typedef struct tagASN1char32string_t
  74. {
  75. ASN1uint32_t length;
  76. ASN1char32_t *value;
  77. }
  78. ASN1char32string_t;
  79. typedef ASN1char_t *ASN1ztcharstring_t;
  80. typedef ASN1char16_t *ASN1ztchar16string_t;
  81. typedef ASN1char32_t *ASN1ztchar32string_t;
  82. typedef struct tagASN1wstring_t
  83. {
  84. ASN1uint32_t length;
  85. WCHAR *value;
  86. }
  87. ASN1wstring_t;
  88. typedef struct ASN1objectidentifier_s
  89. {
  90. struct ASN1objectidentifier_s *next;
  91. ASN1uint32_t value;
  92. }
  93. *ASN1objectidentifier_t;
  94. typedef struct tagASN1objectidentifier2_t
  95. {
  96. ASN1uint16_t count;
  97. ASN1uint32_t value[16];
  98. }
  99. ASN1objectidentifier2_t;
  100. typedef struct tagASN1encodedOID_t
  101. {
  102. ASN1uint16_t length;
  103. ASN1octet_t *value;
  104. }
  105. ASN1encodedOID_t;
  106. typedef struct tagASN1stringtableentry_t
  107. {
  108. ASN1char32_t lower;
  109. ASN1char32_t upper;
  110. ASN1uint32_t value;
  111. }
  112. ASN1stringtableentry_t;
  113. typedef struct tagASN1stringtable_t
  114. {
  115. ASN1uint32_t length;
  116. ASN1stringtableentry_t *values;
  117. }
  118. ASN1stringtable_t;
  119. typedef ASN1ztcharstring_t ASN1objectdescriptor_t;
  120. typedef struct tagASN1generalizedtime_t
  121. {
  122. ASN1uint16_t year;
  123. ASN1uint8_t month;
  124. ASN1uint8_t day;
  125. ASN1uint8_t hour;
  126. ASN1uint8_t minute;
  127. ASN1uint8_t second;
  128. ASN1uint16_t millisecond;
  129. ASN1bool_t universal;
  130. ASN1int16_t diff;
  131. }
  132. ASN1generalizedtime_t;
  133. typedef struct tagASN1utctime_t
  134. {
  135. ASN1uint8_t year;
  136. ASN1uint8_t month;
  137. ASN1uint8_t day;
  138. ASN1uint8_t hour;
  139. ASN1uint8_t minute;
  140. ASN1uint8_t second;
  141. ASN1bool_t universal;
  142. ASN1int16_t diff;
  143. }
  144. ASN1utctime_t;
  145. typedef struct tagASN1open_t
  146. {
  147. // encoded
  148. ASN1uint32_t length;
  149. union
  150. {
  151. void *encoded;
  152. void *value;
  153. };
  154. }
  155. ASN1open_t;
  156. typedef enum tagASN1blocktype_e
  157. {
  158. ASN1_DER_SET_OF_BLOCK,
  159. }
  160. ASN1blocktype_e;
  161. typedef ASN1int32_t ASN1enum_t; // enumerated type
  162. typedef ASN1uint16_t ASN1choice_t; // choice
  163. typedef ASN1uint32_t ASN1magic_t;
  164. /* ------ Current version of this ASN.1 software ------ */
  165. #define ASN1_MAKE_VERSION(major,minor) (((major) << 16) | (minor))
  166. #define ASN1_THIS_VERSION ASN1_MAKE_VERSION(1,0)
  167. enum
  168. {
  169. ASN1_CHOICE_BASE = 1,
  170. ASN1_CHOICE_INVALID = -1, // invalid choice
  171. ASN1_CHOICE_EXTENSION = 0, // extension choice
  172. };
  173. /*
  174. Error codes for decoding functions:
  175. - err == 0: data has been successfully decoded
  176. - err < 0: fatal error has occured, no data has been generated
  177. err contains the error number
  178. - err > 0: non-fatal event has occured, data has been generated
  179. err is a bit set of occured events
  180. */
  181. typedef enum tagASN1error_e
  182. {
  183. ASN1_SUCCESS = 0, /* success */
  184. // Teles specific error codes
  185. ASN1_ERR_INTERNAL = (-1001), /* internal error */
  186. ASN1_ERR_EOD = (-1002), /* unexpected end of data */
  187. ASN1_ERR_CORRUPT = (-1003), /* corrupted data */
  188. ASN1_ERR_LARGE = (-1004), /* value too large */
  189. ASN1_ERR_CONSTRAINT = (-1005), /* constraint violated */
  190. ASN1_ERR_MEMORY = (-1006), /* out of memory */
  191. ASN1_ERR_OVERFLOW = (-1007), /* buffer overflow */
  192. ASN1_ERR_BADPDU = (-1008), /* function not supported for this pdu*/
  193. ASN1_ERR_BADARGS = (-1009), /* bad arguments to function call */
  194. ASN1_ERR_BADREAL = (-1010), /* bad real value */
  195. ASN1_ERR_BADTAG = (-1011), /* bad tag value met */
  196. ASN1_ERR_CHOICE = (-1012), /* bad choice value */
  197. ASN1_ERR_RULE = (-1013), /* bad encoding rule */
  198. ASN1_ERR_UTF8 = (-1014), /* bad unicode (utf8) */
  199. // New error codes
  200. ASN1_ERR_PDU_TYPE = (-1051), /* bad pdu type */
  201. ASN1_ERR_NYI = (-1052), /* not yet implemented */
  202. // Teles specific warning codes
  203. ASN1_WRN_EXTENDED = 1001, /* skipped unknown extension(s) */
  204. ASN1_WRN_NOEOD = 1002, /* end of data expected */
  205. }
  206. ASN1error_e;
  207. #define ASN1_SUCCEEDED(ret) (((int) (ret)) >= 0)
  208. #define ASN1_FAILED(ret) (((int) (ret)) < 0)
  209. /* ------ Encoding rules ------ */
  210. typedef enum
  211. {
  212. ASN1_PER_RULE_ALIGNED = 0x0001,
  213. ASN1_PER_RULE_UNALIGNED = 0x0002, // not supported
  214. ASN1_PER_RULE = ASN1_PER_RULE_ALIGNED | ASN1_PER_RULE_UNALIGNED,
  215. ASN1_BER_RULE_BER = 0x0100,
  216. ASN1_BER_RULE_CER = 0x0200,
  217. ASN1_BER_RULE_DER = 0x0400,
  218. ASN1_BER_RULE = ASN1_BER_RULE_BER | ASN1_BER_RULE_CER | ASN1_BER_RULE_DER,
  219. }
  220. ASN1encodingrule_e;
  221. /* ------ public structures ------ */
  222. typedef struct ASN1encoding_s *ASN1encoding_t;
  223. typedef struct ASN1decoding_s *ASN1decoding_t;
  224. typedef ASN1int32_t (ASN1CALL *ASN1PerEncFun_t)(ASN1encoding_t enc, void *data);
  225. typedef ASN1int32_t (ASN1CALL *ASN1PerDecFun_t)(ASN1decoding_t enc, void *data);
  226. typedef struct tagASN1PerFunArr_t
  227. {
  228. const ASN1PerEncFun_t *apfnEncoder;
  229. const ASN1PerDecFun_t *apfnDecoder;
  230. }
  231. ASN1PerFunArr_t;
  232. typedef ASN1int32_t (ASN1CALL *ASN1BerEncFun_t)(ASN1encoding_t enc, ASN1uint32_t tag, void *data);
  233. typedef ASN1int32_t (ASN1CALL *ASN1BerDecFun_t)(ASN1decoding_t enc, ASN1uint32_t tag, void *data);
  234. typedef struct tagASN1BerFunArr_t
  235. {
  236. const ASN1BerEncFun_t *apfnEncoder;
  237. const ASN1BerDecFun_t *apfnDecoder;
  238. }
  239. ASN1BerFunArr_t;
  240. typedef void (ASN1CALL *ASN1GenericFun_t)(void);
  241. typedef void (ASN1CALL *ASN1FreeFun_t)(void *data);
  242. typedef struct tagASN1module_t
  243. {
  244. ASN1magic_t nModuleName;
  245. ASN1encodingrule_e eRule;
  246. ASN1uint32_t dwFlags;
  247. ASN1uint32_t cPDUs;
  248. const ASN1FreeFun_t *apfnFreeMemory;
  249. const ASN1uint32_t *acbStructSize;
  250. union
  251. {
  252. ASN1PerFunArr_t PER;
  253. ASN1BerFunArr_t BER;
  254. };
  255. }
  256. *ASN1module_t;
  257. struct ASN1encoding_s
  258. {
  259. ASN1magic_t magic; /* magic for this structure */
  260. ASN1uint32_t version;/* version number of this library */
  261. ASN1module_t module; /* module this encoding_t depends to */
  262. ASN1octet_t *buf; /* buffer to encode into */
  263. ASN1uint32_t size; /* current size of buffer */
  264. ASN1uint32_t len; /* len of encoded data in buffer */
  265. ASN1error_e err; /* error code for last encoding */
  266. ASN1uint32_t bit;
  267. ASN1octet_t *pos;
  268. ASN1uint32_t cbExtraHeader;
  269. ASN1encodingrule_e eRule;
  270. ASN1uint32_t dwFlags;
  271. };
  272. struct ASN1decoding_s
  273. {
  274. ASN1magic_t magic; /* magic for this structure */
  275. ASN1uint32_t version;/* version number of this library */
  276. ASN1module_t module; /* module this decoding_t depends to */
  277. ASN1octet_t *buf; /* buffer to decode from */
  278. ASN1uint32_t size; /* size of buffer */
  279. ASN1uint32_t len; /* len of decoded data in buffer */
  280. ASN1error_e err; /* error code for last decoding */
  281. ASN1uint32_t bit;
  282. ASN1octet_t *pos;
  283. ASN1encodingrule_e eRule;
  284. ASN1uint32_t dwFlags;
  285. };
  286. /* --- flags for functions --- */
  287. #define ASN1DECFREE_NON_PDU_ID ((ASN1uint32_t) -1)
  288. enum
  289. {
  290. ASN1FLAGS_NONE = 0x00000000L, /* no flags */
  291. ASN1FLAGS_NOASSERT = 0x00001000L, /* no asertion */
  292. };
  293. enum
  294. {
  295. ASN1ENCODE_APPEND = 0x00000001L, /* append to current buffer*/
  296. ASN1ENCODE_REUSEBUFFER = 0x00000004L, /* empty destination buffer */
  297. ASN1ENCODE_SETBUFFER = 0x00000008L, /* use a user-given destination buffer */
  298. ASN1ENCODE_ALLOCATEBUFFER = 0x00000010L, /* do not free/reuse buffer */
  299. ASN1ENCODE_NOASSERT = ASN1FLAGS_NOASSERT, /* no asertion */
  300. };
  301. enum
  302. {
  303. ASN1DECODE_APPENDED = 0x00000001L, /* continue behind last pdu*/
  304. ASN1DECODE_REWINDBUFFER = 0x00000004L, /* rescan from buffer start*/
  305. ASN1DECODE_SETBUFFER = 0x00000008L, /* use a user-given src buffer */
  306. ASN1DECODE_NOASSERT = ASN1FLAGS_NOASSERT, /* no asertion */
  307. };
  308. /* ------ public basic ASN.1 API ------ */
  309. extern ASN1_PUBLIC ASN1module_t ASN1API ASN1_CreateModule
  310. (
  311. ASN1uint32_t nVersion,
  312. ASN1encodingrule_e eRule,
  313. ASN1uint32_t dwFlags, /* ASN1FLAGS_NONE or ASN1FLAGS_NOASSERT */
  314. ASN1uint32_t cPDU,
  315. const ASN1GenericFun_t apfnEncoder[],
  316. const ASN1GenericFun_t apfnDecoder[],
  317. const ASN1FreeFun_t apfnFreeMemory[],
  318. const ASN1uint32_t acbStructSize[],
  319. ASN1magic_t nModuleName
  320. );
  321. extern ASN1_PUBLIC void ASN1API ASN1_CloseModule
  322. (
  323. ASN1module_t pModule
  324. );
  325. extern ASN1_PUBLIC ASN1error_e ASN1API ASN1_CreateEncoder
  326. (
  327. ASN1module_t pModule,
  328. ASN1encoding_t *ppEncoderInfo,
  329. ASN1octet_t *pbBuf,
  330. ASN1uint32_t cbBufSize,
  331. ASN1encoding_t pParent
  332. );
  333. extern ASN1_PUBLIC ASN1error_e ASN1API ASN1_Encode
  334. (
  335. ASN1encoding_t pEncoderInfo,
  336. void *pDataStruct,
  337. ASN1uint32_t nPduNum,
  338. ASN1uint32_t dwFlags,
  339. ASN1octet_t *pbBuf,
  340. ASN1uint32_t cbBufSize
  341. );
  342. extern ASN1_PUBLIC void ASN1API ASN1_CloseEncoder
  343. (
  344. ASN1encoding_t pEncoderInfo
  345. );
  346. extern ASN1_PUBLIC ASN1error_e ASN1API ASN1_CreateDecoder
  347. (
  348. ASN1module_t pModule,
  349. ASN1decoding_t *ppDecoderInfo,
  350. ASN1octet_t *pbBuf,
  351. ASN1uint32_t cbBufSize,
  352. ASN1decoding_t pParent
  353. );
  354. extern ASN1_PUBLIC ASN1error_e ASN1API ASN1_Decode
  355. (
  356. ASN1decoding_t pDecoderInfo,
  357. void **ppDataStruct,
  358. ASN1uint32_t nPduNum,
  359. ASN1uint32_t dwFlags,
  360. ASN1octet_t *pbBuf,
  361. ASN1uint32_t cbBufSize
  362. );
  363. extern ASN1_PUBLIC void ASN1API ASN1_CloseDecoder
  364. (
  365. ASN1decoding_t pDecoderInfo
  366. );
  367. extern ASN1_PUBLIC void ASN1API ASN1_FreeEncoded
  368. (
  369. ASN1encoding_t pEncoderInfo,
  370. void *pBuf
  371. );
  372. extern ASN1_PUBLIC void ASN1API ASN1_FreeDecoded
  373. (
  374. ASN1decoding_t pDecoderInfo,
  375. void *pDataStruct,
  376. ASN1uint32_t nPduNum
  377. );
  378. /* ------ public advanced ASN.1 API ------ */
  379. typedef enum
  380. {
  381. // common set option
  382. ASN1OPT_CHANGE_RULE = 0x101,
  383. // common get option
  384. ASN1OPT_GET_RULE = 0x201,
  385. // set encoder option
  386. ASN1OPT_NOT_REUSE_BUFFER = 0x301,
  387. ASN1OPT_REWIND_BUFFER = 0x302,
  388. // get encoder option
  389. // set decoder option
  390. ASN1OPT_SET_DECODED_BUFFER = 0x501,
  391. ASN1OPT_DEL_DECODED_BUFFER = 0x502,
  392. // get decoder option
  393. ASN1OPT_GET_DECODED_BUFFER_SIZE = 0x601,
  394. }
  395. ASN1option_e;
  396. typedef struct tagASN1optionparam_t
  397. {
  398. ASN1option_e eOption;
  399. union
  400. {
  401. ASN1encodingrule_e eRule;
  402. ASN1uint32_t cbRequiredDecodedBufSize;
  403. struct
  404. {
  405. ASN1octet_t *pbBuf;
  406. ASN1uint32_t cbBufSize;
  407. } Buffer;
  408. };
  409. }
  410. ASN1optionparam_t, ASN1optionparam_s;
  411. extern ASN1_PUBLIC ASN1error_e ASN1API ASN1_SetEncoderOption
  412. (
  413. ASN1encoding_t pEncoderInfo,
  414. ASN1optionparam_t *pOptParam
  415. );
  416. extern ASN1_PUBLIC ASN1error_e ASN1API ASN1_GetEncoderOption
  417. (
  418. ASN1encoding_t pEncoderInfo,
  419. ASN1optionparam_t *pOptParam
  420. );
  421. extern ASN1_PUBLIC ASN1error_e ASN1API ASN1_SetDecoderOption
  422. (
  423. ASN1decoding_t pDecoderInfo,
  424. ASN1optionparam_t *pOptParam
  425. );
  426. extern ASN1_PUBLIC ASN1error_e ASN1API ASN1_GetDecoderOption
  427. (
  428. ASN1decoding_t pDecoderInfo,
  429. ASN1optionparam_t *pOptParam
  430. );
  431. /* ------ internal ASN.1 API ------ */
  432. extern ASN1_PUBLIC void ASN1API ASN1bitstring_free(ASN1bitstring_t *);
  433. extern ASN1_PUBLIC void ASN1API ASN1octetstring_free(ASN1octetstring_t *);
  434. extern ASN1_PUBLIC void ASN1API ASN1objectidentifier_free(ASN1objectidentifier_t *);
  435. extern ASN1_PUBLIC void ASN1API ASN1charstring_free(ASN1charstring_t *);
  436. extern ASN1_PUBLIC void ASN1API ASN1char16string_free(ASN1char16string_t *);
  437. extern ASN1_PUBLIC void ASN1API ASN1char32string_free(ASN1char32string_t *);
  438. extern ASN1_PUBLIC void ASN1API ASN1ztcharstring_free(ASN1ztcharstring_t);
  439. extern ASN1_PUBLIC void ASN1API ASN1ztchar16string_free(ASN1ztchar16string_t);
  440. extern ASN1_PUBLIC void ASN1API ASN1ztchar32string_free(ASN1ztchar32string_t);
  441. extern ASN1_PUBLIC void ASN1API ASN1open_free(ASN1open_t *);
  442. extern ASN1_PUBLIC void ASN1API ASN1utf8string_free(ASN1wstring_t *);
  443. extern ASN1_PUBLIC void * ASN1API ASN1DecAlloc(ASN1decoding_t dec, ASN1uint32_t size);
  444. extern ASN1_PUBLIC void * ASN1API ASN1DecRealloc(ASN1decoding_t dec, void *ptr, ASN1uint32_t size);
  445. extern ASN1_PUBLIC void ASN1API ASN1Free(void *ptr);
  446. extern ASN1_PUBLIC ASN1error_e ASN1API ASN1EncSetError(ASN1encoding_t enc, ASN1error_e err);
  447. extern ASN1_PUBLIC ASN1error_e ASN1API ASN1DecSetError(ASN1decoding_t dec, ASN1error_e err);
  448. extern ASN1_PUBLIC void ASN1API ASN1intx_sub(ASN1intx_t *, ASN1intx_t *, ASN1intx_t *);
  449. extern ASN1_PUBLIC ASN1uint32_t ASN1API ASN1intx_uoctets(ASN1intx_t *);
  450. extern ASN1_PUBLIC void ASN1API ASN1intx_free(ASN1intx_t *);
  451. extern ASN1_PUBLIC void ASN1API ASN1intx_add(ASN1intx_t *, ASN1intx_t *, ASN1intx_t *);
  452. extern ASN1_PUBLIC void ASN1API ASN1DbgMemTrackDumpCurrent ( ASN1uint32_t nModuleName );
  453. extern ASN1_PUBLIC ASN1uint32_t ASN1API ASN1uint32_uoctets(ASN1uint32_t);
  454. extern ASN1_PUBLIC int ASN1API ASN1objectidentifier_cmp(ASN1objectidentifier_t *v1, ASN1objectidentifier_t *v2);
  455. extern ASN1_PUBLIC int ASN1API ASN1objectidentifier2_cmp(ASN1objectidentifier2_t *v1, ASN1objectidentifier2_t *v2);
  456. extern ASN1_PUBLIC int ASN1API ASN1bitstring_cmp(ASN1bitstring_t *, ASN1bitstring_t *, int);
  457. extern ASN1_PUBLIC int ASN1API ASN1octetstring_cmp(ASN1octetstring_t *, ASN1octetstring_t *);
  458. extern ASN1_PUBLIC int ASN1API ASN1objectidentifier_cmp(ASN1objectidentifier_t *, ASN1objectidentifier_t *);
  459. extern ASN1_PUBLIC int ASN1API ASN1charstring_cmp(ASN1charstring_t *, ASN1charstring_t *);
  460. extern ASN1_PUBLIC int ASN1API ASN1char16string_cmp(ASN1char16string_t *, ASN1char16string_t *);
  461. extern ASN1_PUBLIC int ASN1API ASN1char32string_cmp(ASN1char32string_t *, ASN1char32string_t *);
  462. extern ASN1_PUBLIC int ASN1API ASN1ztcharstring_cmp(ASN1ztcharstring_t, ASN1ztcharstring_t);
  463. extern ASN1_PUBLIC int ASN1API ASN1ztchar16string_cmp(ASN1ztchar16string_t, ASN1ztchar16string_t);
  464. extern ASN1_PUBLIC int ASN1API ASN1open_cmp(ASN1open_t *, ASN1open_t *);
  465. extern ASN1_PUBLIC int ASN1API ASN1generalizedtime_cmp(ASN1generalizedtime_t *, ASN1generalizedtime_t *);
  466. extern ASN1_PUBLIC int ASN1API ASN1utctime_cmp(ASN1utctime_t *, ASN1utctime_t *);
  467. /* --------------------------------------------------------- */
  468. /* The following is not supported. */
  469. /* --------------------------------------------------------- */
  470. typedef enum tagASN1real_e
  471. {
  472. eReal_Normal,
  473. eReal_PlusInfinity,
  474. eReal_MinusInfinity
  475. }
  476. ASN1real_e;
  477. typedef struct tagASN1real_t
  478. {
  479. ASN1real_e type;
  480. ASN1intx_t mantissa;
  481. ASN1uint32_t base;
  482. ASN1intx_t exponent;
  483. }
  484. ASN1real_t;
  485. typedef struct tagASN1external_t
  486. {
  487. # define ASN1external_data_value_descriptor_o 0
  488. ASN1octet_t o[1];
  489. struct ASN1external_identification_s
  490. {
  491. ASN1uint8_t o;
  492. union
  493. {
  494. # define ASN1external_identification_syntax_o 1
  495. ASN1objectidentifier_t syntax;
  496. # define ASN1external_identification_presentation_context_id_o 2
  497. ASN1uint32_t presentation_context_id;
  498. # define ASN1external_identification_context_negotiation_o 3
  499. struct ASN1external_identification_context_negotiation_s
  500. {
  501. ASN1uint32_t presentation_context_id;
  502. ASN1objectidentifier_t transfer_syntax;
  503. } context_negotiation;
  504. } u;
  505. } identification;
  506. ASN1objectdescriptor_t data_value_descriptor;
  507. struct ASN1external_data_value_s
  508. {
  509. ASN1uint8_t o;
  510. union
  511. {
  512. # define ASN1external_data_value_notation_o 0
  513. ASN1open_t notation;
  514. # define ASN1external_data_value_encoded_o 1
  515. ASN1bitstring_t encoded;
  516. } u;
  517. } data_value;
  518. }
  519. ASN1external_t;
  520. typedef struct ASN1external_identification_s ASN1external_identification_t;
  521. typedef struct ASN1external_identification_context_negotiation_s ASN1external_identification_context_negotiation_t;
  522. typedef struct ASN1external_data_value_s ASN1external_data_value_t;
  523. typedef struct tagASN1embeddedpdv_t
  524. {
  525. struct ASN1embeddedpdv_identification_s
  526. {
  527. ASN1uint8_t o;
  528. union
  529. {
  530. # define ASN1embeddedpdv_identification_syntaxes_o 0
  531. struct ASN1embeddedpdv_identification_syntaxes_s
  532. {
  533. ASN1objectidentifier_t abstract;
  534. ASN1objectidentifier_t transfer;
  535. } syntaxes;
  536. # define ASN1embeddedpdv_identification_syntax_o 1
  537. ASN1objectidentifier_t syntax;
  538. # define ASN1embeddedpdv_identification_presentation_context_id_o 2
  539. ASN1uint32_t presentation_context_id;
  540. # define ASN1embeddedpdv_identification_context_negotiation_o 3
  541. struct ASN1embeddedpdv_identification_context_negotiation_s
  542. {
  543. ASN1uint32_t presentation_context_id;
  544. ASN1objectidentifier_t transfer_syntax;
  545. } context_negotiation;
  546. # define ASN1embeddedpdv_identification_transfer_syntax_o 4
  547. ASN1objectidentifier_t transfer_syntax;
  548. # define ASN1embeddedpdv_identification_fixed_o 5
  549. } u;
  550. } identification;
  551. struct ASN1embeddedpdv_data_value_s
  552. {
  553. ASN1uint8_t o;
  554. union
  555. {
  556. # define ASN1embeddedpdv_data_value_notation_o 0
  557. ASN1open_t notation;
  558. # define ASN1embeddedpdv_data_value_encoded_o 1
  559. ASN1bitstring_t encoded;
  560. } u;
  561. } data_value;
  562. }
  563. ASN1embeddedpdv_t;
  564. typedef struct ASN1embeddedpdv_identification_s ASN1embeddedpdv_identification_t;
  565. typedef struct ASN1embeddedpdv_identification_syntaxes_s ASN1embeddedpdv_identification_syntaxes_t;
  566. typedef struct ASN1embeddedpdv_identification_context_negotiation_s ASN1embeddedpdv_identification_context_negotiation_t;
  567. typedef struct ASN1embeddedpdv_data_value_s ASN1embeddedpdv_data_value_t;
  568. typedef struct tagASN1characterstring_t
  569. {
  570. struct ASN1characterstring_identification_s
  571. {
  572. ASN1uint8_t o;
  573. union
  574. {
  575. # define ASN1characterstring_identification_syntaxes_o 0
  576. struct ASN1characterstring_identification_syntaxes_s
  577. {
  578. ASN1objectidentifier_t abstract;
  579. ASN1objectidentifier_t transfer;
  580. } syntaxes;
  581. # define ASN1characterstring_identification_syntax_o 1
  582. ASN1objectidentifier_t syntax;
  583. # define ASN1characterstring_identification_presentation_context_id_o 2
  584. ASN1uint32_t presentation_context_id;
  585. # define ASN1characterstring_identification_context_negotiation_o 3
  586. struct ASN1characterstring_identification_context_negotiation_s
  587. {
  588. ASN1uint32_t presentation_context_id;
  589. ASN1objectidentifier_t transfer_syntax;
  590. } context_negotiation;
  591. # define ASN1characterstring_identification_transfer_syntax_o 4
  592. ASN1objectidentifier_t transfer_syntax;
  593. # define ASN1characterstring_identification_fixed_o 5
  594. } u;
  595. } identification;
  596. struct ASN1characterstring_data_value_s
  597. {
  598. ASN1uint8_t o;
  599. union
  600. {
  601. # define ASN1characterstring_data_value_notation_o 0
  602. ASN1open_t notation;
  603. # define ASN1characterstring_data_value_encoded_o 1
  604. ASN1octetstring_t encoded;
  605. } u;
  606. } data_value;
  607. } ASN1characterstring_t;
  608. typedef struct ASN1characterstring_identification_s ASN1characterstring_identification_t;
  609. typedef struct ASN1characterstring_identification_syntaxes_s ASN1characterstring_identification_syntaxes_t;
  610. typedef struct ASN1characterstring_identification_context_negotiation_s ASN1characterstring_identification_context_negotiation_t;
  611. typedef struct ASN1characterstring_data_value_s ASN1characterstring_data_value_t;
  612. extern ASN1_PUBLIC void ASN1API ASN1real_free(ASN1real_t *);
  613. extern ASN1_PUBLIC void ASN1API ASN1external_free(ASN1external_t *);
  614. extern ASN1_PUBLIC void ASN1API ASN1embeddedpdv_free(ASN1embeddedpdv_t *);
  615. extern ASN1_PUBLIC void ASN1API ASN1characterstring_free(ASN1characterstring_t *);
  616. #ifdef __cplusplus
  617. }
  618. #endif
  619. #endif // __MS_ASN1_H__