include: Add definitions related to WSAPoll().
[wine.git] / include / msasn1.h
blob89a6255a5feb6f5ad7f101129258b7d9df4ff485
1 /*
2 * Copyright (C) 2015 Austin English
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 #ifndef __MS_ASN1_H__
19 #define __MS_ASN1_H__
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
25 typedef char ASN1char_t;
26 typedef signed char ASN1int8_t;
27 typedef unsigned char ASN1uint8_t;
28 typedef unsigned short ASN1uint16_t;
29 typedef signed short ASN1int16_t;
30 typedef ULONG ASN1uint32_t;
31 typedef LONG ASN1int32_t;
33 typedef ASN1uint16_t ASN1char16_t;
34 typedef ASN1uint32_t ASN1char32_t;
36 typedef ASN1char_t *ASN1ztcharstring_t;
37 typedef ASN1char16_t *ASN1ztchar16string_t;
38 typedef ASN1char32_t *ASN1ztchar32string_t;
39 typedef ASN1int32_t ASN1enum_t;
40 typedef ASN1uint8_t ASN1octet_t;
41 typedef ASN1uint8_t ASN1bool_t;
42 typedef ASN1uint16_t ASN1choice_t;
43 typedef ASN1uint32_t ASN1magic_t;
44 typedef ASN1ztcharstring_t ASN1objectdescriptor_t;
46 typedef void (WINAPI *ASN1FreeFun_t)(void *data);
47 typedef void (WINAPI *ASN1GenericFun_t)(void);
49 typedef struct ASN1encoding_s *ASN1encoding_t;
50 typedef struct ASN1decoding_s *ASN1decoding_t;
51 typedef ASN1int32_t (WINAPI *ASN1PerEncFun_t)(ASN1encoding_t enc,void *data);
52 typedef ASN1int32_t (WINAPI *ASN1PerDecFun_t)(ASN1decoding_t enc,void *data);
54 typedef struct tagASN1PerFunArr_t {
55 const ASN1PerEncFun_t *apfnEncoder;
56 const ASN1PerDecFun_t *apfnDecoder;
57 } ASN1PerFunArr_t;
59 typedef ASN1int32_t (WINAPI *ASN1BerEncFun_t)(ASN1encoding_t enc,ASN1uint32_t tag,void *data);
60 typedef ASN1int32_t (WINAPI *ASN1BerDecFun_t)(ASN1decoding_t enc,ASN1uint32_t tag,void *data);
62 typedef struct tagASN1BerFunArr_t {
63 const ASN1BerEncFun_t *apfnEncoder;
64 const ASN1BerDecFun_t *apfnDecoder;
65 } ASN1BerFunArr_t;
67 typedef struct tagASN1bitstring_t
69 ASN1uint32_t length;
70 ASN1octet_t *value;
71 } ASN1bitstring_t;
73 typedef enum tagASN1blocktype_e
75 ASN1_DER_SET_OF_BLOCK,
76 } ASN1blocktype_e;
78 typedef struct tagASN1charstring_t
80 ASN1uint32_t length;
81 ASN1char_t *value;
82 } ASN1charstring_t;
84 typedef struct tagASN1char16string_t
86 ASN1uint32_t length;
87 ASN1char16_t *value;
88 } ASN1char16string_t;
90 typedef struct tagASN1char32string_t
92 ASN1uint32_t length;
93 ASN1char32_t *value;
94 } ASN1char32string_t;
96 typedef struct tagASN1encodedOID_t
98 ASN1uint16_t length;
99 ASN1octet_t *value;
100 } ASN1encodedOID_t;
102 typedef enum {
103 ASN1_PER_RULE_ALIGNED = 0x0001,ASN1_PER_RULE_UNALIGNED = 0x0002,ASN1_PER_RULE = ASN1_PER_RULE_ALIGNED | ASN1_PER_RULE_UNALIGNED,
104 ASN1_BER_RULE_BER = 0x0100,ASN1_BER_RULE_CER = 0x0200,ASN1_BER_RULE_DER = 0x0400,
105 ASN1_BER_RULE = ASN1_BER_RULE_BER | ASN1_BER_RULE_CER | ASN1_BER_RULE_DER
106 } ASN1encodingrule_e;
108 typedef enum tagASN1error_e
110 ASN1_SUCCESS = 0,
111 ASN1_ERR_INTERNAL = -1001,
112 ASN1_ERR_EOD = -1002,
113 ASN1_ERR_CORRUPT = -1003,
114 ASN1_ERR_LARGE = -1004,
115 ASN1_ERR_CONSTRAINT = -1005,
116 ASN1_ERR_MEMORY = -1006,
117 ASN1_ERR_OVERFLOW = -1007,
118 ASN1_ERR_BADPDU = -1008,
119 ASN1_ERR_BADARGS = -1009,
120 ASN1_ERR_BADREAL = -1010,
121 ASN1_ERR_BADTAG = -1011,
122 ASN1_ERR_CHOICE = -1012,
123 ASN1_ERR_RULE = -1013,
124 ASN1_ERR_UTF8 = -1014,
125 ASN1_ERR_PDU_TYPE = -1051,
126 ASN1_ERR_NYI = -1052,
127 ASN1_WRN_EXTENDED = 1001,
128 ASN1_WRN_NOEOD = 1002,
129 } ASN1error_e;
131 typedef struct tagASN1generalizedtime_t
133 ASN1uint16_t year;
134 ASN1uint8_t month;
135 ASN1uint8_t day;
136 ASN1uint8_t hour;
137 ASN1uint8_t minute;
138 ASN1uint8_t second;
139 ASN1uint16_t millisecond;
140 ASN1bool_t universal;
141 ASN1int16_t diff;
142 } ASN1generalizedtime_t;
144 typedef struct tagASN1intx_t
146 ASN1uint32_t length;
147 ASN1octet_t *value;
148 } ASN1intx_t;
150 typedef struct tagASN1module_t {
151 ASN1magic_t nModuleName;
152 ASN1encodingrule_e eRule;
153 ASN1uint32_t dwFlags;
154 ASN1uint32_t cPDUs;
155 const ASN1FreeFun_t *apfnFreeMemory;
156 const ASN1uint32_t *acbStructSize;
157 union {
158 ASN1PerFunArr_t PER;
159 ASN1BerFunArr_t BER;
161 } *ASN1module_t;
163 typedef struct ASN1objectidentifier_s
165 struct ASN1objectidentifier_s *next;
166 ASN1uint32_t value;
167 } *ASN1objectidentifier_t;
169 typedef struct tagASN1objectidentifier2_t
171 ASN1uint16_t count;
172 ASN1uint32_t value[16];
173 } ASN1objectidentifier2_t;
175 typedef struct tagASN1octetstring_t
177 ASN1uint32_t length;
178 ASN1octet_t *value;
179 } ASN1octetstring_t;
181 typedef struct tagASN1open_t
183 ASN1uint32_t length;
184 union
186 void *encoded;
187 void *value;
189 } ASN1open_t;
191 typedef enum tagASN1option_e
193 ASN1OPT_CHANGE_RULE = 0x101,
194 ASN1OPT_GET_RULE = 0x201,
195 ASN1OPT_NOT_REUSE_BUFFER = 0x301,
196 ASN1OPT_REWIND_BUFFER = 0x302,
197 ASN1OPT_SET_DECODED_BUFFER = 0x501,
198 ASN1OPT_DEL_DECODED_BUFFER = 0x502,
199 ASN1OPT_GET_DECODED_BUFFER_SIZE = 0x601,
200 } ASN1option_e;
202 typedef struct tagASN1optionparam_t {
203 ASN1option_e eOption;
204 union
206 ASN1encodingrule_e eRule;
207 ASN1uint32_t cbRequiredDecodedBufSize;
208 struct
210 ASN1octet_t* pbBuf;
211 ASN1uint32_t cbBufSize;
212 } Buffer;
214 } ASN1optionparam_t, ASN1optionparam_s;
216 typedef struct tagASN1utctime_t
218 ASN1uint8_t year;
219 ASN1uint8_t month;
220 ASN1uint8_t day;
221 ASN1uint8_t hour;
222 ASN1uint8_t minute;
223 ASN1uint8_t second;
224 ASN1bool_t universal;
225 ASN1int16_t diff;
226 } ASN1utctime_t;
228 typedef struct tagASN1wstring_t
230 ASN1uint32_t length;
231 WCHAR *value;
232 } ASN1wstring_t;
234 void WINAPI ASN1_CloseDecoder(ASN1decoding_t);
235 void WINAPI ASN1_CloseEncoder(ASN1encoding_t);
236 void WINAPI ASN1_CloseEncoder2(ASN1encoding_t);
237 void WINAPI ASN1_CloseModule(ASN1module_t);
238 ASN1error_e WINAPI ASN1_CreateDecoder(ASN1module_t, ASN1decoding_t*,ASN1octet_t*, ASN1uint32_t, ASN1decoding_t);
239 ASN1error_e WINAPI ASN1_CreateEncoder(ASN1module_t, ASN1encoding_t*, ASN1octet_t*, ASN1uint32_t, ASN1encoding_t);
240 ASN1module_t WINAPI ASN1_CreateModule(ASN1uint32_t,ASN1encodingrule_e,ASN1uint32_t,ASN1uint32_t,const ASN1GenericFun_t [],const ASN1GenericFun_t [],const ASN1FreeFun_t [],const ASN1uint32_t [],ASN1magic_t);
241 ASN1error_e WINAPI ASN1_Decode(ASN1decoding_t, void** , ASN1uint32_t, ASN1uint32_t, ASN1octet_t*, ASN1uint32_t);
242 ASN1error_e WINAPI ASN1_Encode(ASN1encoding_t, void*, ASN1uint32_t, ASN1uint32_t, ASN1octet_t*, ASN1uint32_t);
243 void WINAPI ASN1_FreeDecoded(ASN1decoding_t, void*, ASN1uint32_t);
244 void WINAPI ASN1_FreeEncoded(ASN1encoding_t, void*);
245 ASN1error_e WINAPI ASN1_GetDecoderOption(ASN1decoding_t, ASN1optionparam_t*);
246 ASN1error_e WINAPI ASN1_GetEncoderOption(ASN1encoding_t, ASN1optionparam_t*);
247 ASN1error_e WINAPI ASN1_SetDecoderOption(ASN1decoding_t, ASN1optionparam_t*);
248 ASN1error_e WINAPI ASN1_SetEncoderOption(ASN1encoding_t, ASN1optionparam_t*);
249 int WINAPI ASN1bitstring_cmp(ASN1bitstring_t*,ASN1bitstring_t*);
250 void WINAPI ASN1bitstring_free(ASN1bitstring_t*);
251 int WINAPI ASN1char16string_cmp(ASN1char16string_t*,ASN1char16string_t*);
252 void WINAPI ASN1char16string_free(ASN1char16string_t*);
253 int WINAPI ASN1char32string_cmp(ASN1char32string_t*,ASN1char32string_t*);
254 void WINAPI ASN1char32string_free(ASN1char32string_t*);
255 int WINAPI ASN1charstring_cmp(ASN1charstring_t*,ASN1charstring_t*);
256 void WINAPI ASN1charstring_free(ASN1charstring_t*);
257 LPVOID WINAPI ASN1DecAlloc(ASN1decoding_t,ASN1uint32_t);
258 LPVOID WINAPI ASN1DecRealloc(ASN1decoding_t,LPVOID,ASN1uint32_t);
259 ASN1error_e WINAPI ASN1DecSetError(ASN1decoding_t,ASN1error_e);
260 ASN1error_e WINAPI ASN1EncSetError(ASN1encoding_t,ASN1error_e);
261 void WINAPI ASN1Free(LPVOID);
262 int WINAPI ASN1generalizedtime_cmp(ASN1generalizedtime_t*,ASN1generalizedtime_t*);
263 int WINAPI ASN1intx_cmp(ASN1intx_t*,ASN1intx_t*);
264 void WINAPI ASN1intx_free(ASN1intx_t*);
265 void WINAPI ASN1intx_setuint32(ASN1intx_t*,ASN1uint32_t);
266 ASN1uint32_t WINAPI ASN1intx_uoctets(ASN1intx_t*);
267 ASN1int32_t WINAPI ASN1intx2int32(ASN1intx_t*);
268 ASN1uint32_t WINAPI ASN1intx2uint32(ASN1intx_t*);
269 int WINAPI ASN1intxisuint32(ASN1intx_t*);
270 int WINAPI ASN1objectidentifier_cmp(ASN1objectidentifier_t*,ASN1objectidentifier_t*);
271 void WINAPI ASN1objectidentifier_free(ASN1objectidentifier_t*);
272 int WINAPI ASN1objectidentifier2_cmp(ASN1objectidentifier2_t*,ASN1objectidentifier2_t*);
273 int WINAPI ASN1octetstring_cmp(ASN1octetstring_t*,ASN1octetstring_t*);
274 void WINAPI ASN1octetstring_free(ASN1octetstring_t*);
275 int WINAPI ASN1open_cmp(ASN1open_t*,ASN1open_t*);
276 void WINAPI ASN1open_free(ASN1open_t*);
277 ASN1uint32_t WINAPI ASN1uint32_uoctets(ASN1uint32_t);
278 void WINAPI ASN1utf8string_free(ASN1wstring_t*);
279 int WINAPI ASN1utctime_cmp(ASN1utctime_t*,ASN1utctime_t*);
280 int WINAPI ASN1ztchar16string_cmp(ASN1ztchar16string_t*,ASN1ztchar16string_t*);
281 void WINAPI ASN1ztchar16string_free(ASN1ztchar16string_t*);
282 void WINAPI ASN1ztchar32string_free(ASN1ztchar32string_t*);
283 int WINAPI ASN1ztcharstring_cmp(ASN1ztcharstring_t*,ASN1ztcharstring_t*);
284 void WINAPI ASN1ztcharstring_free(ASN1charstring_t*);
286 #ifdef __cplusplus
288 #endif
290 #endif /* __MS_ASN1_H__ */