1 module bindbc.gnutls.gnutls;
2 
3 import bindbc.gnutls.config;
4 import core.stdc.config;
5 import core.sys.posix.sys.select;
6 import core.sys.posix.sys.types;
7 import core.sys.posix.sys.uio;
8 
9 enum gnutls_cipher_algorithm
10 {
11     GNUTLS_CIPHER_UNKNOWN = 0,
12     GNUTLS_CIPHER_NULL = 1,
13     GNUTLS_CIPHER_ARCFOUR_128 = 2,
14     GNUTLS_CIPHER_3DES_CBC = 3,
15     GNUTLS_CIPHER_AES_128_CBC = 4,
16     GNUTLS_CIPHER_AES_256_CBC = 5,
17     GNUTLS_CIPHER_ARCFOUR_40 = 6,
18     GNUTLS_CIPHER_CAMELLIA_128_CBC = 7,
19     GNUTLS_CIPHER_CAMELLIA_256_CBC = 8,
20     GNUTLS_CIPHER_AES_192_CBC = 9,
21     GNUTLS_CIPHER_AES_128_GCM = 10,
22     GNUTLS_CIPHER_AES_256_GCM = 11,
23     GNUTLS_CIPHER_CAMELLIA_192_CBC = 12,
24     GNUTLS_CIPHER_SALSA20_256 = 13,
25     GNUTLS_CIPHER_ESTREAM_SALSA20_256 = 14,
26     GNUTLS_CIPHER_CAMELLIA_128_GCM = 15,
27     GNUTLS_CIPHER_CAMELLIA_256_GCM = 16,
28     GNUTLS_CIPHER_RC2_40_CBC = 17,
29     GNUTLS_CIPHER_DES_CBC = 18,
30     GNUTLS_CIPHER_AES_128_CCM = 19,
31     GNUTLS_CIPHER_AES_256_CCM = 20,
32     GNUTLS_CIPHER_AES_128_CCM_8 = 21,
33     GNUTLS_CIPHER_AES_256_CCM_8 = 22,
34     GNUTLS_CIPHER_CHACHA20_POLY1305 = 23,
35     GNUTLS_CIPHER_GOST28147_TC26Z_CFB = 24,
36     GNUTLS_CIPHER_GOST28147_CPA_CFB = 25,
37     GNUTLS_CIPHER_GOST28147_CPB_CFB = 26,
38     GNUTLS_CIPHER_GOST28147_CPC_CFB = 27,
39     GNUTLS_CIPHER_GOST28147_CPD_CFB = 28,
40     GNUTLS_CIPHER_AES_128_CFB8 = 29, /// Available from GnuTLS 3.6.5
41     GNUTLS_CIPHER_AES_192_CFB8 = 30, /// Available from GnuTLS 3.6.5
42     GNUTLS_CIPHER_AES_256_CFB8 = 31, /// Available from GnuTLS 3.6.5
43     GNUTLS_CIPHER_AES_128_XTS = 32,
44     GNUTLS_CIPHER_AES_256_XTS = 33,
45     GNUTLS_CIPHER_GOST28147_TC26Z_CNT = 34, /// Available from GnuTLS 3.6.10
46     GNUTLS_CIPHER_CHACHA20_64 = 35,
47     GNUTLS_CIPHER_CHACHA20_32 = 36,
48     GNUTLS_CIPHER_AES_128_SIV = 37, /// Available from GnuTLS 3.6.13
49     GNUTLS_CIPHER_AES_256_SIV = 38, /// Available from GnuTLS 3.6.13
50     GNUTLS_CIPHER_AES_192_GCM = 39, /// Available from GnuTLS 3.6.13
51 
52     GNUTLS_CIPHER_IDEA_PGP_CFB = 200,
53     GNUTLS_CIPHER_3DES_PGP_CFB = 201,
54     GNUTLS_CIPHER_CAST5_PGP_CFB = 202,
55     GNUTLS_CIPHER_BLOWFISH_PGP_CFB = 203,
56     GNUTLS_CIPHER_SAFER_SK128_PGP_CFB = 204,
57     GNUTLS_CIPHER_AES128_PGP_CFB = 205,
58     GNUTLS_CIPHER_AES192_PGP_CFB = 206,
59     GNUTLS_CIPHER_AES256_PGP_CFB = 207,
60     GNUTLS_CIPHER_TWOFISH_PGP_CFB = 208
61 }
62 
63 alias gnutls_cipher_algorithm_t = gnutls_cipher_algorithm;
64 
65 enum gnutls_kx_algorithm_t
66 {
67     GNUTLS_KX_UNKNOWN = 0,
68     GNUTLS_KX_RSA = 1,
69     GNUTLS_KX_DHE_DSS = 2,
70     GNUTLS_KX_DHE_RSA = 3,
71     GNUTLS_KX_ANON_DH = 4,
72     GNUTLS_KX_SRP = 5,
73     GNUTLS_KX_RSA_EXPORT = 6,
74     GNUTLS_KX_SRP_RSA = 7,
75     GNUTLS_KX_SRP_DSS = 8,
76     GNUTLS_KX_PSK = 9,
77     GNUTLS_KX_DHE_PSK = 10,
78     GNUTLS_KX_ANON_ECDH = 11,
79     GNUTLS_KX_ECDHE_RSA = 12,
80     GNUTLS_KX_ECDHE_ECDSA = 13,
81     GNUTLS_KX_ECDHE_PSK = 14,
82     GNUTLS_KX_RSA_PSK = 15,
83     GNUTLS_KX_VKO_GOST_12 = 16
84 }
85 
86 enum gnutls_params_type_t
87 {
88     GNUTLS_PARAMS_RSA_EXPORT = 1,
89     GNUTLS_PARAMS_DH = 2,
90     GNUTLS_PARAMS_ECDH = 3
91 }
92 
93 enum gnutls_credentials_type_t
94 {
95     GNUTLS_CRD_CERTIFICATE = 1,
96     GNUTLS_CRD_ANON = 2,
97     GNUTLS_CRD_SRP = 3,
98     GNUTLS_CRD_PSK = 4,
99     GNUTLS_CRD_IA = 5
100 }
101 
102 enum gnutls_mac_algorithm_t
103 {
104     GNUTLS_MAC_UNKNOWN = 0,
105     GNUTLS_MAC_NULL = 1,
106     GNUTLS_MAC_MD5 = 2,
107     GNUTLS_MAC_SHA1 = 3,
108     GNUTLS_MAC_RMD160 = 4,
109     GNUTLS_MAC_MD2 = 5,
110     GNUTLS_MAC_SHA256 = 6,
111     GNUTLS_MAC_SHA384 = 7,
112     GNUTLS_MAC_SHA512 = 8,
113     GNUTLS_MAC_SHA224 = 9,
114     GNUTLS_MAC_SHA3_224 = 10,
115     GNUTLS_MAC_SHA3_256 = 11,
116     GNUTLS_MAC_SHA3_384 = 12,
117     GNUTLS_MAC_SHA3_512 = 13,
118     GNUTLS_MAC_MD5_SHA1 = 14,
119     GNUTLS_MAC_GOSTR_94 = 15,
120     GNUTLS_MAC_STREEBOG_256 = 16,
121     GNUTLS_MAC_STREEBOG_512 = 17,
122 
123     GNUTLS_MAC_AEAD = 200,
124     GNUTLS_MAC_UMAC_96 = 201,
125     GNUTLS_MAC_UMAC_128 = 202,
126     GNUTLS_MAC_AES_CMAC_128 = 203, /// Available from GnuTLS 3.6.5
127     GNUTLS_MAC_AES_CMAC_256 = 204, /// Available from GnuTLS 3.6.5
128     GNUTLS_MAC_AES_GMAC_128 = 205, /// Available from GnuTLS 3.6.9
129     GNUTLS_MAC_AES_GMAC_192 = 206, /// Available from GnuTLS 3.6.9
130     GNUTLS_MAC_AES_GMAC_256 = 207, /// Available from GnuTLS 3.6.9
131     GNUTLS_MAC_GOST28147_TC26Z_IMIT = 208, /// Available from GnuTLS 3.6.10
132     GNUTLS_MAC_SHAKE_128 = 209,
133     GNUTLS_MAC_SHAKE_256 = 210
134 }
135 
136 enum gnutls_digest_algorithm_t
137 {
138     GNUTLS_DIG_UNKNOWN = gnutls_mac_algorithm_t.GNUTLS_MAC_UNKNOWN,
139     GNUTLS_DIG_NULL = gnutls_mac_algorithm_t.GNUTLS_MAC_NULL,
140     GNUTLS_DIG_MD5 = gnutls_mac_algorithm_t.GNUTLS_MAC_MD5,
141     GNUTLS_DIG_SHA1 = gnutls_mac_algorithm_t.GNUTLS_MAC_SHA1,
142     GNUTLS_DIG_RMD160 = gnutls_mac_algorithm_t.GNUTLS_MAC_RMD160,
143     GNUTLS_DIG_MD2 = gnutls_mac_algorithm_t.GNUTLS_MAC_MD2,
144     GNUTLS_DIG_SHA256 = gnutls_mac_algorithm_t.GNUTLS_MAC_SHA256,
145     GNUTLS_DIG_SHA384 = gnutls_mac_algorithm_t.GNUTLS_MAC_SHA384,
146     GNUTLS_DIG_SHA512 = gnutls_mac_algorithm_t.GNUTLS_MAC_SHA512,
147     GNUTLS_DIG_SHA224 = gnutls_mac_algorithm_t.GNUTLS_MAC_SHA224,
148     GNUTLS_DIG_SHA3_224 = gnutls_mac_algorithm_t.GNUTLS_MAC_SHA3_224,
149     GNUTLS_DIG_SHA3_256 = gnutls_mac_algorithm_t.GNUTLS_MAC_SHA3_256,
150     GNUTLS_DIG_SHA3_384 = gnutls_mac_algorithm_t.GNUTLS_MAC_SHA3_384,
151     GNUTLS_DIG_SHA3_512 = gnutls_mac_algorithm_t.GNUTLS_MAC_SHA3_512,
152     GNUTLS_DIG_MD5_SHA1 = gnutls_mac_algorithm_t.GNUTLS_MAC_MD5_SHA1,
153     GNUTLS_DIG_GOSTR_94 = gnutls_mac_algorithm_t.GNUTLS_MAC_GOSTR_94,
154     GNUTLS_DIG_STREEBOG_256 = gnutls_mac_algorithm_t.GNUTLS_MAC_STREEBOG_256,
155     GNUTLS_DIG_STREEBOG_512 = gnutls_mac_algorithm_t.GNUTLS_MAC_STREEBOG_512,
156     GNUTLS_DIG_SHAKE_128 = gnutls_mac_algorithm_t.GNUTLS_MAC_SHAKE_128,
157     GNUTLS_DIG_SHAKE_256 = gnutls_mac_algorithm_t.GNUTLS_MAC_SHAKE_256
158 }
159 
160 enum gnutls_compression_method_t
161 {
162     GNUTLS_COMP_UNKNOWN = 0,
163     GNUTLS_COMP_NULL = 1,
164     GNUTLS_COMP_DEFLATE = 2,
165     GNUTLS_COMP_ZLIB = GNUTLS_COMP_DEFLATE
166 }
167 
168 enum gnutls_init_flags_t
169 {
170     GNUTLS_SERVER = 1,
171     GNUTLS_CLIENT = 1 << 1,
172     GNUTLS_DATAGRAM = 1 << 2,
173     GNUTLS_NONBLOCK = 1 << 3,
174     GNUTLS_NO_EXTENSIONS = 1 << 4,
175     GNUTLS_NO_REPLAY_PROTECTION = 1 << 5,
176     GNUTLS_NO_SIGNAL = 1 << 6,
177     GNUTLS_ALLOW_ID_CHANGE = 1 << 7,
178     GNUTLS_ENABLE_FALSE_START = 1 << 8,
179     GNUTLS_FORCE_CLIENT_CERT = 1 << 9,
180     GNUTLS_NO_TICKETS = 1 << 10, /// Available from GnuTLS 3.5.6
181     GNUTLS_KEY_SHARE_TOP = 1 << 11,
182     GNUTLS_KEY_SHARE_TOP2 = 1 << 12,
183     GNUTLS_KEY_SHARE_TOP3 = 1 << 13,
184     GNUTLS_POST_HANDSHAKE_AUTH = 1 << 14,
185     GNUTLS_NO_AUTO_REKEY = 1 << 15,
186     GNUTLS_SAFE_PADDING_CHECK = 1 << 16,
187     GNUTLS_ENABLE_EARLY_START = 1 << 17, /// Available from GnuTLS 3.6.4
188     GNUTLS_ENABLE_RAWPK = 1 << 18, /// Available from GnuTLS 3.6.6
189     GNUTLS_AUTO_REAUTH = 1 << 19, /// Available from GnuTLS 3.6.5
190     GNUTLS_ENABLE_EARLY_DATA = 1 << 20,
191     GNUTLS_NO_AUTO_SEND_TICKET = 1 << 21 /// Available from GnuTLS 3.6.13
192 }
193 
194 enum gnutls_alert_level_t
195 {
196     GNUTLS_AL_WARNING = 1,
197     GNUTLS_AL_FATAL = 2
198 }
199 
200 enum gnutls_alert_description_t
201 {
202     GNUTLS_A_CLOSE_NOTIFY = 0,
203     GNUTLS_A_UNEXPECTED_MESSAGE = 10,
204     GNUTLS_A_BAD_RECORD_MAC = 20,
205     GNUTLS_A_DECRYPTION_FAILED = 21,
206     GNUTLS_A_RECORD_OVERFLOW = 22,
207     GNUTLS_A_DECOMPRESSION_FAILURE = 30,
208     GNUTLS_A_HANDSHAKE_FAILURE = 40,
209     GNUTLS_A_SSL3_NO_CERTIFICATE = 41,
210     GNUTLS_A_BAD_CERTIFICATE = 42,
211     GNUTLS_A_UNSUPPORTED_CERTIFICATE = 43,
212     GNUTLS_A_CERTIFICATE_REVOKED = 44,
213     GNUTLS_A_CERTIFICATE_EXPIRED = 45,
214     GNUTLS_A_CERTIFICATE_UNKNOWN = 46,
215     GNUTLS_A_ILLEGAL_PARAMETER = 47,
216     GNUTLS_A_UNKNOWN_CA = 48,
217     GNUTLS_A_ACCESS_DENIED = 49,
218     GNUTLS_A_DECODE_ERROR = 50,
219     GNUTLS_A_DECRYPT_ERROR = 51,
220     GNUTLS_A_EXPORT_RESTRICTION = 60,
221     GNUTLS_A_PROTOCOL_VERSION = 70,
222     GNUTLS_A_INSUFFICIENT_SECURITY = 71,
223     GNUTLS_A_INTERNAL_ERROR = 80,
224     GNUTLS_A_INAPPROPRIATE_FALLBACK = 86,
225     GNUTLS_A_USER_CANCELED = 90,
226     GNUTLS_A_NO_RENEGOTIATION = 100,
227     GNUTLS_A_MISSING_EXTENSION = 109,
228     GNUTLS_A_UNSUPPORTED_EXTENSION = 110,
229     GNUTLS_A_CERTIFICATE_UNOBTAINABLE = 111,
230     GNUTLS_A_UNRECOGNIZED_NAME = 112,
231     GNUTLS_A_UNKNOWN_PSK_IDENTITY = 115,
232     GNUTLS_A_CERTIFICATE_REQUIRED = 116,
233     GNUTLS_A_NO_APPLICATION_PROTOCOL = 120,
234     GNUTLS_A_MAX = GNUTLS_A_NO_APPLICATION_PROTOCOL
235 }
236 
237 enum gnutls_handshake_description_t
238 {
239     GNUTLS_HANDSHAKE_HELLO_REQUEST = 0,
240     GNUTLS_HANDSHAKE_CLIENT_HELLO = 1,
241     GNUTLS_HANDSHAKE_SERVER_HELLO = 2,
242     GNUTLS_HANDSHAKE_HELLO_VERIFY_REQUEST = 3,
243     GNUTLS_HANDSHAKE_NEW_SESSION_TICKET = 4,
244     GNUTLS_HANDSHAKE_END_OF_EARLY_DATA = 5,
245     GNUTLS_HANDSHAKE_ENCRYPTED_EXTENSIONS = 8,
246     GNUTLS_HANDSHAKE_CERTIFICATE_PKT = 11,
247     GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE = 12,
248     GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST = 13,
249     GNUTLS_HANDSHAKE_SERVER_HELLO_DONE = 14,
250     GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY = 15,
251     GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE = 16,
252     GNUTLS_HANDSHAKE_FINISHED = 20,
253     GNUTLS_HANDSHAKE_CERTIFICATE_STATUS = 22,
254     GNUTLS_HANDSHAKE_SUPPLEMENTAL = 23,
255     GNUTLS_HANDSHAKE_KEY_UPDATE = 24,
256     GNUTLS_HANDSHAKE_CHANGE_CIPHER_SPEC = 254,
257     GNUTLS_HANDSHAKE_CLIENT_HELLO_V2 = 1024,
258     GNUTLS_HANDSHAKE_HELLO_RETRY_REQUEST = 1025
259 }
260 
261 const(char)* gnutls_handshake_description_get_name (gnutls_handshake_description_t type);
262 
263 enum gnutls_certificate_status_t
264 {
265     GNUTLS_CERT_INVALID = 1 << 1,
266     GNUTLS_CERT_REVOKED = 1 << 5,
267     GNUTLS_CERT_SIGNER_NOT_FOUND = 1 << 6,
268     GNUTLS_CERT_SIGNER_NOT_CA = 1 << 7,
269     GNUTLS_CERT_INSECURE_ALGORITHM = 1 << 8,
270     GNUTLS_CERT_NOT_ACTIVATED = 1 << 9,
271     GNUTLS_CERT_EXPIRED = 1 << 10,
272     GNUTLS_CERT_SIGNATURE_FAILURE = 1 << 11,
273     GNUTLS_CERT_REVOCATION_DATA_SUPERSEDED = 1 << 12,
274     GNUTLS_CERT_UNEXPECTED_OWNER = 1 << 14,
275     GNUTLS_CERT_REVOCATION_DATA_ISSUED_IN_FUTURE = 1 << 15,
276     GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE = 1 << 16,
277     GNUTLS_CERT_MISMATCH = 1 << 17,
278     GNUTLS_CERT_PURPOSE_MISMATCH = 1 << 18,
279     GNUTLS_CERT_MISSING_OCSP_STATUS = 1 << 19,
280     GNUTLS_CERT_INVALID_OCSP_STATUS = 1 << 20, /// Available from GnuTLS 3.5.1
281     GNUTLS_CERT_UNKNOWN_CRIT_EXTENSIONS = 1 << 21 /// Available from GnuTLS 3.6.0
282 }
283 
284 enum gnutls_certificate_request_t
285 {
286     GNUTLS_CERT_IGNORE = 0,
287     GNUTLS_CERT_REQUEST = 1,
288     GNUTLS_CERT_REQUIRE = 2
289 }
290 
291 enum gnutls_openpgp_crt_status_t
292 {
293     GNUTLS_OPENPGP_CERT = 0,
294     GNUTLS_OPENPGP_CERT_FINGERPRINT = 1
295 }
296 
297 enum gnutls_close_request_t
298 {
299     GNUTLS_SHUT_RDWR = 0,
300     GNUTLS_SHUT_WR = 1
301 }
302 
303 enum gnutls_protocol_t
304 {
305     GNUTLS_SSL3 = 1,
306     GNUTLS_TLS1_0 = 2,
307     GNUTLS_TLS1 = GNUTLS_TLS1_0,
308     GNUTLS_TLS1_1 = 3,
309     GNUTLS_TLS1_2 = 4,
310     GNUTLS_TLS1_3 = 5,
311 
312     GNUTLS_DTLS0_9 = 200,
313     GNUTLS_DTLS1_0 = 201,
314     GNUTLS_DTLS1_2 = 202,
315     GNUTLS_DTLS_VERSION_MIN = GNUTLS_DTLS0_9,
316     GNUTLS_DTLS_VERSION_MAX = GNUTLS_DTLS1_2,
317     GNUTLS_TLS_VERSION_MAX = GNUTLS_TLS1_3,
318     GNUTLS_VERSION_UNKNOWN = 0xff
319 }
320 
321 enum gnutls_certificate_type_t
322 {
323     GNUTLS_CRT_UNKNOWN = 0,
324     GNUTLS_CRT_X509 = 1,
325     GNUTLS_CRT_OPENPGP = 2,
326     GNUTLS_CRT_RAWPK = 3,
327     GNUTLS_CRT_MAX = GNUTLS_CRT_RAWPK
328 }
329 
330 enum gnutls_x509_crt_fmt_t
331 {
332     GNUTLS_X509_FMT_DER = 0,
333     GNUTLS_X509_FMT_PEM = 1
334 }
335 
336 enum gnutls_certificate_print_formats
337 {
338     GNUTLS_CRT_PRINT_FULL = 0,
339     GNUTLS_CRT_PRINT_ONELINE = 1,
340     GNUTLS_CRT_PRINT_UNSIGNED_FULL = 2,
341     GNUTLS_CRT_PRINT_COMPACT = 3,
342     GNUTLS_CRT_PRINT_FULL_NUMBERS = 4
343 }
344 
345 alias gnutls_certificate_print_formats_t = gnutls_certificate_print_formats;
346 
347 enum gnutls_pk_algorithm_t
348 {
349     GNUTLS_PK_UNKNOWN = 0,
350     GNUTLS_PK_RSA = 1,
351     GNUTLS_PK_DSA = 2,
352     GNUTLS_PK_DH = 3,
353     GNUTLS_PK_ECDSA = 4,
354     GNUTLS_PK_ECDH_X25519 = 5,
355     GNUTLS_PK_RSA_PSS = 6,
356     GNUTLS_PK_EDDSA_ED25519 = 7,
357     GNUTLS_PK_GOST_01 = 8,
358     GNUTLS_PK_GOST_12_256 = 9,
359     GNUTLS_PK_GOST_12_512 = 10,
360     GNUTLS_PK_ECDH_X448 = 11,
361     GNUTLS_PK_EDDSA_ED448 = 12,
362     GNUTLS_PK_MAX = GNUTLS_PK_EDDSA_ED448
363 }
364 
365 
366 enum gnutls_sign_algorithm_t
367 {
368     GNUTLS_SIGN_UNKNOWN = 0,
369     GNUTLS_SIGN_RSA_SHA1 = 1,
370     GNUTLS_SIGN_RSA_SHA = GNUTLS_SIGN_RSA_SHA1,
371     GNUTLS_SIGN_DSA_SHA1 = 2,
372     GNUTLS_SIGN_DSA_SHA = GNUTLS_SIGN_DSA_SHA1,
373     GNUTLS_SIGN_RSA_MD5 = 3,
374     GNUTLS_SIGN_RSA_MD2 = 4,
375     GNUTLS_SIGN_RSA_RMD160 = 5,
376     GNUTLS_SIGN_RSA_SHA256 = 6,
377     GNUTLS_SIGN_RSA_SHA384 = 7,
378     GNUTLS_SIGN_RSA_SHA512 = 8,
379     GNUTLS_SIGN_RSA_SHA224 = 9,
380     GNUTLS_SIGN_DSA_SHA224 = 10,
381     GNUTLS_SIGN_DSA_SHA256 = 11,
382     GNUTLS_SIGN_ECDSA_SHA1 = 12,
383     GNUTLS_SIGN_ECDSA_SHA224 = 13,
384     GNUTLS_SIGN_ECDSA_SHA256 = 14,
385     GNUTLS_SIGN_ECDSA_SHA384 = 15,
386     GNUTLS_SIGN_ECDSA_SHA512 = 16,
387     GNUTLS_SIGN_DSA_SHA384 = 17,
388     GNUTLS_SIGN_DSA_SHA512 = 18,
389     GNUTLS_SIGN_ECDSA_SHA3_224 = 20,
390     GNUTLS_SIGN_ECDSA_SHA3_256 = 21,
391     GNUTLS_SIGN_ECDSA_SHA3_384 = 22,
392     GNUTLS_SIGN_ECDSA_SHA3_512 = 23,
393 
394     GNUTLS_SIGN_DSA_SHA3_224 = 24,
395     GNUTLS_SIGN_DSA_SHA3_256 = 25,
396     GNUTLS_SIGN_DSA_SHA3_384 = 26,
397     GNUTLS_SIGN_DSA_SHA3_512 = 27,
398     GNUTLS_SIGN_RSA_SHA3_224 = 28,
399     GNUTLS_SIGN_RSA_SHA3_256 = 29,
400     GNUTLS_SIGN_RSA_SHA3_384 = 30,
401     GNUTLS_SIGN_RSA_SHA3_512 = 31,
402 
403     GNUTLS_SIGN_RSA_PSS_SHA256 = 32,
404     GNUTLS_SIGN_RSA_PSS_SHA384 = 33,
405     GNUTLS_SIGN_RSA_PSS_SHA512 = 34,
406     GNUTLS_SIGN_EDDSA_ED25519 = 35,
407     GNUTLS_SIGN_RSA_RAW = 36,
408 
409     GNUTLS_SIGN_ECDSA_SECP256R1_SHA256 = 37,
410     GNUTLS_SIGN_ECDSA_SECP384R1_SHA384 = 38,
411     GNUTLS_SIGN_ECDSA_SECP521R1_SHA512 = 39,
412 
413     GNUTLS_SIGN_RSA_PSS_RSAE_SHA256 = 40,
414     GNUTLS_SIGN_RSA_PSS_RSAE_SHA384 = 41,
415     GNUTLS_SIGN_RSA_PSS_RSAE_SHA512 = 42,
416 
417     GNUTLS_SIGN_GOST_94 = 43,
418     GNUTLS_SIGN_GOST_256 = 44,
419     GNUTLS_SIGN_GOST_512 = 45,
420     GNUTLS_SIGN_EDDSA_ED448 = 46,
421     GNUTLS_SIGN_MAX = GNUTLS_SIGN_EDDSA_ED448
422 }
423 
424 enum gnutls_ecc_curve_t
425 {
426     GNUTLS_ECC_CURVE_INVALID = 0,
427     GNUTLS_ECC_CURVE_SECP224R1 = 1,
428     GNUTLS_ECC_CURVE_SECP256R1 = 2,
429     GNUTLS_ECC_CURVE_SECP384R1 = 3,
430     GNUTLS_ECC_CURVE_SECP521R1 = 4,
431     GNUTLS_ECC_CURVE_SECP192R1 = 5,
432     GNUTLS_ECC_CURVE_X25519 = 6,
433     GNUTLS_ECC_CURVE_ED25519 = 7,
434     GNUTLS_ECC_CURVE_GOST256CPA = 8,
435     GNUTLS_ECC_CURVE_GOST256CPB = 9,
436     GNUTLS_ECC_CURVE_GOST256CPC = 10,
437     GNUTLS_ECC_CURVE_GOST256CPXA = 11,
438     GNUTLS_ECC_CURVE_GOST256CPXB = 12,
439     GNUTLS_ECC_CURVE_GOST512A = 13,
440     GNUTLS_ECC_CURVE_GOST512B = 14,
441     GNUTLS_ECC_CURVE_GOST512C = 15,
442     GNUTLS_ECC_CURVE_GOST256A = 16,
443     GNUTLS_ECC_CURVE_GOST256B = 17,
444     GNUTLS_ECC_CURVE_GOST256C = 18,
445     GNUTLS_ECC_CURVE_GOST256D = 19,
446     GNUTLS_ECC_CURVE_X448 = 20,
447     GNUTLS_ECC_CURVE_ED448 = 21,
448     GNUTLS_ECC_CURVE_MAX = GNUTLS_ECC_CURVE_ED448
449 }
450 
451 enum gnutls_group_t
452 {
453     GNUTLS_GROUP_INVALID = 0,
454     GNUTLS_GROUP_SECP192R1 = gnutls_ecc_curve_t.GNUTLS_ECC_CURVE_SECP192R1,
455     GNUTLS_GROUP_SECP224R1 = gnutls_ecc_curve_t.GNUTLS_ECC_CURVE_SECP224R1,
456     GNUTLS_GROUP_SECP256R1 = gnutls_ecc_curve_t.GNUTLS_ECC_CURVE_SECP256R1,
457     GNUTLS_GROUP_SECP384R1 = gnutls_ecc_curve_t.GNUTLS_ECC_CURVE_SECP384R1,
458     GNUTLS_GROUP_SECP521R1 = gnutls_ecc_curve_t.GNUTLS_ECC_CURVE_SECP521R1,
459     GNUTLS_GROUP_X25519 = gnutls_ecc_curve_t.GNUTLS_ECC_CURVE_X25519,
460     GNUTLS_GROUP_X448 = gnutls_ecc_curve_t.GNUTLS_ECC_CURVE_X448,
461 
462     GNUTLS_GROUP_GC256A = gnutls_ecc_curve_t.GNUTLS_ECC_CURVE_GOST256A,
463     GNUTLS_GROUP_GC256B = gnutls_ecc_curve_t.GNUTLS_ECC_CURVE_GOST256B,
464     GNUTLS_GROUP_GC256C = gnutls_ecc_curve_t.GNUTLS_ECC_CURVE_GOST256C,
465     GNUTLS_GROUP_GC256D = gnutls_ecc_curve_t.GNUTLS_ECC_CURVE_GOST256D,
466     GNUTLS_GROUP_GC512A = gnutls_ecc_curve_t.GNUTLS_ECC_CURVE_GOST512A,
467     GNUTLS_GROUP_GC512B = gnutls_ecc_curve_t.GNUTLS_ECC_CURVE_GOST512B,
468     GNUTLS_GROUP_GC512C = gnutls_ecc_curve_t.GNUTLS_ECC_CURVE_GOST512C,
469 
470     GNUTLS_GROUP_FFDHE2048 = 256,
471     GNUTLS_GROUP_FFDHE3072 = 257,
472     GNUTLS_GROUP_FFDHE4096 = 258,
473     GNUTLS_GROUP_FFDHE8192 = 259,
474     GNUTLS_GROUP_FFDHE6144 = 260,
475     GNUTLS_GROUP_MAX = GNUTLS_GROUP_FFDHE6144
476 }
477 
478 enum gnutls_sec_param_t
479 {
480     GNUTLS_SEC_PARAM_UNKNOWN = 0,
481     GNUTLS_SEC_PARAM_INSECURE = 5,
482     GNUTLS_SEC_PARAM_EXPORT = 10,
483     GNUTLS_SEC_PARAM_VERY_WEAK = 15,
484     GNUTLS_SEC_PARAM_WEAK = 20,
485     GNUTLS_SEC_PARAM_LOW = 25,
486     GNUTLS_SEC_PARAM_LEGACY = 30,
487     GNUTLS_SEC_PARAM_MEDIUM = 35,
488     GNUTLS_SEC_PARAM_HIGH = 40,
489     GNUTLS_SEC_PARAM_ULTRA = 45,
490     GNUTLS_SEC_PARAM_FUTURE = 50,
491     GNUTLS_SEC_PARAM_MAX = GNUTLS_SEC_PARAM_FUTURE
492 }
493 
494 enum gnutls_channel_binding_t
495 {
496     GNUTLS_CB_TLS_UNIQUE = 0
497 }
498 
499 enum gnutls_gost_paramset_t
500 {
501     GNUTLS_GOST_PARAMSET_UNKNOWN = 0,
502     GNUTLS_GOST_PARAMSET_TC26_Z = 1,
503     GNUTLS_GOST_PARAMSET_CP_A = 2,
504     GNUTLS_GOST_PARAMSET_CP_B = 3,
505     GNUTLS_GOST_PARAMSET_CP_C = 4,
506     GNUTLS_GOST_PARAMSET_CP_D = 5
507 }
508 
509 static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_4)
510 {
511     enum gnutls_ctype_target_t
512     {
513         GNUTLS_CTYPE_CLIENT = 0,
514         GNUTLS_CTYPE_SERVER = 1,
515         GNUTLS_CTYPE_OURS = 2,
516         GNUTLS_CTYPE_PEERS = 3
517     }
518 }
519 
520 alias gnutls_transport_ptr_t = void*;
521 
522 struct gnutls_session_int;
523 alias gnutls_session_t = gnutls_session_int*;
524 
525 struct gnutls_dh_params_int;
526 alias gnutls_dh_params_t = gnutls_dh_params_int*;
527 
528 struct gnutls_x509_privkey_int;
529 alias gnutls_rsa_params_t = gnutls_x509_privkey_int*;
530 
531 struct gnutls_priority_st;
532 alias gnutls_priority_t = gnutls_priority_st*;
533 
534 struct gnutls_datum_t
535 {
536     ubyte* data;
537     uint size;
538 }
539 
540 struct gnutls_params_st
541 {
542     gnutls_params_type_t type;
543 
544     union params_t
545     {
546         gnutls_dh_params_t dh;
547         gnutls_rsa_params_t rsa_export;
548     }
549 
550     params_t params;
551     int deinit;
552 }
553 
554 struct gnutls_range_st
555 {
556     size_t low;
557     size_t high;
558 }
559 
560 struct mbuffer_st;
561 alias gnutls_packet_t = mbuffer_st*;
562 
563 enum gnutls_server_name_type_t
564 {
565     GNUTLS_NAME_DNS = 1
566 }
567 
568 enum gnutls_session_flags_t
569 {
570     GNUTLS_SFLAGS_SAFE_RENEGOTIATION = 1,
571     GNUTLS_SFLAGS_EXT_MASTER_SECRET = 1 << 1,
572     GNUTLS_SFLAGS_ETM = 1 << 2,
573     GNUTLS_SFLAGS_HB_LOCAL_SEND = 1 << 3,
574     GNUTLS_SFLAGS_HB_PEER_SEND = 1 << 4,
575     GNUTLS_SFLAGS_FALSE_START = 1 << 5,
576     GNUTLS_SFLAGS_RFC7919 = 1 << 6, /// Available from GnuTLS 3.6.0
577     GNUTLS_SFLAGS_SESSION_TICKET = 1 << 7,
578     GNUTLS_SFLAGS_POST_HANDSHAKE_AUTH = 1 << 8,
579     GNUTLS_SFLAGS_EARLY_START = 1 << 9,
580     GNUTLS_SFLAGS_EARLY_DATA = 1 << 10,
581     GNUTLS_SFLAGS_CLI_REQUESTED_OCSP = 1 << 11, /// Available from GnuTLS 3.6.12
582     GNUTLS_SFLAGS_SERV_REQUESTED_OCSP = 1 << 12 /// Available from GnuTLS 3.6.12
583 }
584 
585 enum gnutls_supplemental_data_format_type_t
586 {
587     GNUTLS_SUPPLEMENTAL_UNKNOWN = 0
588 }
589 
590 enum gnutls_srtp_profile_t
591 {
592     GNUTLS_SRTP_AES128_CM_HMAC_SHA1_80 = 0x0001,
593     GNUTLS_SRTP_AES128_CM_HMAC_SHA1_32 = 0x0002,
594     GNUTLS_SRTP_NULL_HMAC_SHA1_80 = 0x0005,
595     GNUTLS_SRTP_NULL_HMAC_SHA1_32 = 0x0006
596 }
597 
598 enum gnutls_alpn_flags_t
599 {
600     GNUTLS_ALPN_MANDATORY = 1,
601     GNUTLS_ALPN_SERVER_PRECEDENCE = 1 << 1
602 }
603 
604 enum gnutls_vdata_types_t
605 {
606     GNUTLS_DT_UNKNOWN = 0,
607     GNUTLS_DT_DNS_HOSTNAME = 1,
608     GNUTLS_DT_KEY_PURPOSE_OID = 2,
609     GNUTLS_DT_RFC822NAME = 3,
610     GNUTLS_DT_IP_ADDRESS = 4 /// Available from GnuTLS 3.6.0
611 }
612 
613 struct gnutls_typed_vdata_st
614 {
615     gnutls_vdata_types_t type;
616     ubyte* data;
617     uint size;
618 }
619 
620 struct gnutls_pubkey_st;
621 alias gnutls_pubkey_t = gnutls_pubkey_st*;
622 
623 struct gnutls_privkey_st;
624 alias gnutls_privkey_t = gnutls_privkey_st*;
625 
626 alias gnutls_x509_privkey_t = gnutls_x509_privkey_int*;
627 
628 struct gnutls_x509_crl_int;
629 alias gnutls_x509_crl_t = gnutls_x509_crl_int*;
630 
631 struct gnutls_x509_crt_int;
632 alias gnutls_x509_crt_t = gnutls_x509_crt_int*;
633 
634 struct gnutls_x509_crq_int;
635 alias gnutls_x509_crq_t = gnutls_x509_crq_int*;
636 
637 struct gnutls_openpgp_keyring_int;
638 alias gnutls_openpgp_keyring_t = gnutls_openpgp_keyring_int*;
639 
640 struct gnutls_certificate_credentials_st;
641 alias gnutls_certificate_credentials_t = gnutls_certificate_credentials_st*;
642 alias gnutls_certificate_server_credentials = gnutls_certificate_credentials_st*;
643 alias gnutls_certificate_client_credentials = gnutls_certificate_credentials_st*;
644 
645 struct gnutls_anon_server_credentials_st;
646 alias gnutls_anon_server_credentials_t = gnutls_anon_server_credentials_st*;
647 struct gnutls_anon_client_credentials_st;
648 alias gnutls_anon_client_credentials_t = gnutls_anon_client_credentials_st*;
649 
650 enum gnutls_certificate_flags
651 {
652     GNUTLS_CERTIFICATE_SKIP_KEY_CERT_MATCH = 1,
653     GNUTLS_CERTIFICATE_API_V2 = 1 << 1, /// Available from GnuTLS 3.5.6
654     GNUTLS_CERTIFICATE_SKIP_OCSP_RESPONSE_CHECK = 1 << 2,
655     GNUTLS_CERTIFICATE_VERIFY_CRLS = 1 << 3 /// Available from GnuTLS 3.6.4
656 }
657 
658 struct gnutls_ocsp_data_st
659 {
660     uint version_;
661     gnutls_datum_t response;
662     time_t exptime;
663     ubyte[32] padding;
664 }
665 
666 alias giovec_t = iovec;
667 
668 enum gnutls_random_art_
669 {
670     GNUTLS_RANDOM_ART_OPENSSH = 1
671 }
672 
673 alias gnutls_random_art_t = gnutls_random_art_;
674 
675 struct gnutls_srp_server_credentials_st;
676 alias gnutls_srp_server_credentials_t = gnutls_srp_server_credentials_st*;
677 struct gnutls_srp_client_credentials_st;
678 alias gnutls_srp_client_credentials_t = gnutls_srp_client_credentials_st*;
679 
680 struct gnutls_psk_server_credentials_st;
681 alias gnutls_psk_server_credentials_t = gnutls_psk_server_credentials_st*;
682 struct gnutls_psk_client_credentials_st;
683 alias gnutls_psk_client_credentials_t = gnutls_psk_client_credentials_st*;
684 
685 enum gnutls_psk_key_flags
686 {
687     GNUTLS_PSK_KEY_RAW = 0,
688     GNUTLS_PSK_KEY_HEX = 1
689 }
690 
691 enum gnutls_x509_subject_alt_name_t
692 {
693     GNUTLS_SAN_DNSNAME = 1,
694     GNUTLS_SAN_RFC822NAME = 2,
695     GNUTLS_SAN_URI = 3,
696     GNUTLS_SAN_IPADDRESS = 4,
697     GNUTLS_SAN_OTHERNAME = 5,
698     GNUTLS_SAN_DN = 6,
699     GNUTLS_SAN_REGISTERED_ID = 7, /// Available from GnuTLS 3.6.9
700     GNUTLS_SAN_MAX = GNUTLS_SAN_REGISTERED_ID,
701 
702     GNUTLS_SAN_OTHERNAME_XMPP = 1000,
703     GNUTLS_SAN_OTHERNAME_KRB5PRINCIPAL = 1001
704 }
705 
706 struct gnutls_openpgp_crt_int;
707 alias gnutls_openpgp_crt_t = gnutls_openpgp_crt_int*;
708 
709 struct gnutls_openpgp_privkey_int;
710 alias gnutls_openpgp_privkey_t = gnutls_openpgp_privkey_int*;
711 
712 struct gnutls_pkcs11_privkey_st;
713 alias gnutls_pkcs11_privkey_t = gnutls_pkcs11_privkey_st*;
714 
715 enum gnutls_privkey_type_t
716 {
717     GNUTLS_PRIVKEY_X509 = 0,
718     GNUTLS_PRIVKEY_OPENPGP = 1,
719     GNUTLS_PRIVKEY_PKCS11 = 2,
720     GNUTLS_PRIVKEY_EXT = 3
721 }
722 
723 struct gnutls_retr2_st
724 {
725     gnutls_certificate_type_t cert_type;
726     gnutls_privkey_type_t key_type;
727 
728     union _Anonymous_0
729     {
730         gnutls_x509_crt_t* x509;
731         gnutls_openpgp_crt_t pgp;
732     }
733 
734     _Anonymous_0 cert;
735     uint ncerts;
736 
737     union _Anonymous_1
738     {
739         gnutls_x509_privkey_t x509;
740         gnutls_openpgp_privkey_t pgp;
741         gnutls_pkcs11_privkey_t pkcs11;
742     }
743 
744     _Anonymous_1 key;
745 
746     uint deinit_all;
747 }
748 
749 struct gnutls_tdb_int;
750 alias gnutls_tdb_t = gnutls_tdb_int*;
751 
752 enum gnutls_pin_flag_t
753 {
754     GNUTLS_PIN_USER = 1 << 0,
755     GNUTLS_PIN_SO = 1 << 1,
756     GNUTLS_PIN_FINAL_TRY = 1 << 2,
757     GNUTLS_PIN_COUNT_LOW = 1 << 3,
758     GNUTLS_PIN_CONTEXT_SPECIFIC = 1 << 4,
759     GNUTLS_PIN_WRONG = 1 << 5
760 }
761 
762 struct gnutls_buffer_st;
763 alias gnutls_ext_priv_data_t = void*;
764 
765 enum gnutls_ext_parse_type_t
766 {
767     GNUTLS_EXT_ANY = 0,
768     GNUTLS_EXT_APPLICATION = 1,
769     GNUTLS_EXT_TLS = 2,
770     GNUTLS_EXT_MANDATORY = 3,
771     GNUTLS_EXT_NONE = 4,
772     GNUTLS_EXT_VERSION_NEG = 5
773 }
774 
775 enum gnutls_ext_flags_t
776 {
777     GNUTLS_EXT_FLAG_OVERRIDE_INTERNAL = 1,
778     GNUTLS_EXT_FLAG_CLIENT_HELLO = 1 << 1,
779     GNUTLS_EXT_FLAG_TLS12_SERVER_HELLO = 1 << 2,
780     GNUTLS_EXT_FLAG_TLS13_SERVER_HELLO = 1 << 3,
781     GNUTLS_EXT_FLAG_EE = 1 << 4,
782     GNUTLS_EXT_FLAG_HRR = 1 << 5,
783     GNUTLS_EXT_FLAG_IGNORE_CLIENT_REQUEST = 1 << 6,
784     GNUTLS_EXT_FLAG_TLS = 1 << 7,
785     GNUTLS_EXT_FLAG_DTLS = 1 << 8
786 }
787 
788 struct gnutls_anti_replay_st;
789 alias gnutls_anti_replay_t = gnutls_anti_replay_st*;
790 
791 enum gnutls_fips_mode_t
792 {
793     GNUTLS_FIPS140_DISABLED = 0,
794     GNUTLS_FIPS140_STRICT = 1,
795     GNUTLS_FIPS140_SELFTESTS = 2,
796     GNUTLS_FIPS140_LAX = 3,
797     GNUTLS_FIPS140_LOG = 4
798 }
799 enum GNUTLS_VERSION = "3.6.15";
800 enum GNUTLS_VERSION_MAJOR = 3;
801 enum GNUTLS_VERSION_MINOR = 6;
802 enum GNUTLS_VERSION_PATCH = 15;
803 enum GNUTLS_VERSION_NUMBER = 0x03060f;
804 enum GNUTLS_CIPHER_RIJNDAEL_128_CBC = gnutls_cipher_algorithm_t.GNUTLS_CIPHER_AES_128_CBC;
805 enum GNUTLS_CIPHER_RIJNDAEL_256_CBC = gnutls_cipher_algorithm_t.GNUTLS_CIPHER_AES_256_CBC;
806 enum GNUTLS_CIPHER_RIJNDAEL_CBC = gnutls_cipher_algorithm_t.GNUTLS_CIPHER_AES_128_CBC;
807 enum GNUTLS_CIPHER_ARCFOUR = gnutls_cipher_algorithm_t.GNUTLS_CIPHER_ARCFOUR_128;
808 enum GNUTLS_MAC_SHA = gnutls_mac_algorithm_t.GNUTLS_MAC_SHA1;
809 enum GNUTLS_DIG_SHA = gnutls_digest_algorithm_t.GNUTLS_DIG_SHA1;
810 enum GNUTLS_MAX_ALGORITHM_NUM = 64;
811 enum GNUTLS_MAX_SESSION_ID_SIZE = 32;
812 enum GNUTLS_SERVER = 1;
813 enum GNUTLS_CLIENT = 1 << 1;
814 enum GNUTLS_DATAGRAM = 1 << 2;
815 enum GNUTLS_NONBLOCK = 1 << 3;
816 enum GNUTLS_NO_EXTENSIONS = 1 << 4;
817 enum GNUTLS_NO_REPLAY_PROTECTION = 1 << 5;
818 enum GNUTLS_NO_SIGNAL = 1 << 6;
819 enum GNUTLS_ALLOW_ID_CHANGE = 1 << 7;
820 enum GNUTLS_ENABLE_FALSE_START = 1 << 8;
821 enum GNUTLS_FORCE_CLIENT_CERT = 1 << 9;
822 
823 static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_6)
824     enum GNUTLS_NO_TICKETS = 1 << 10;
825 
826 static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_4 && gnuTLSSupport < GnuTLSSupport.gnutls_3_6_6)
827     enum GNUTLS_ENABLE_CERT_TYPE_NEG = 0;
828 
829 enum GNUTLS_HANDSHAKE_ANY = cast(uint) -1;
830 enum GNUTLS_CRT_RAW = gnutls_certificate_type_t.GNUTLS_CRT_RAWPK;
831 enum GNUTLS_PK_ECC = gnutls_pk_algorithm_t.GNUTLS_PK_ECDSA;
832 enum GNUTLS_PK_EC = gnutls_pk_algorithm_t.GNUTLS_PK_ECDSA;
833 enum GNUTLS_PK_ECDHX = gnutls_pk_algorithm_t.GNUTLS_PK_ECDH_X25519;
834 
835 enum GNUTLS_SEC_PARAM_NORMAL = gnutls_sec_param_t.GNUTLS_SEC_PARAM_MEDIUM;
836 alias _gnutls_deinit = gnutls_deinit;
837 enum GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT = cast(uint) -1;
838 enum GNUTLS_INDEFINITE_TIMEOUT = cast(uint) -2;
839 enum GNUTLS_KU_PEER = 1;
840 enum GNUTLS_SIGN_FLAG_SECURE_FOR_CERTS = 1;
841 alias gnutls_sign_algorithm_get_name = gnutls_sign_get_name;
842 enum GNUTLS_HEARTBEAT_WAIT = 1;
843 enum GNUTLS_RECORD_WAIT = 1;
844 alias gnutls_read = gnutls_record_recv;
845 alias gnutls_write = gnutls_record_send;
846 enum GNUTLS_HB_PEER_ALLOWED_TO_SEND = 1;
847 enum GNUTLS_HB_PEER_NOT_ALLOWED_TO_SEND = 1 << 1;
848 enum GNUTLS_HB_LOCAL_ALLOWED_TO_SEND = 1 << 2;
849 enum GNUTLS_ALPN_MAND = gnutls_alpn_flags_t.GNUTLS_ALPN_MANDATORY;
850 enum GNUTLS_PRIORITY_INIT_DEF_APPEND = 1;
851 enum GNUTLS_PRIORITY_LIST_INIT_KEYWORDS = 1;
852 enum GNUTLS_PRIORITY_LIST_SPECIAL = 2;
853 enum GNUTLS_MAX_SESSION_ID = 32;
854 enum GNUTLS_HOOK_POST = 1;
855 enum GNUTLS_HOOK_PRE = 0;
856 enum GNUTLS_HOOK_BOTH = -1;
857 alias gnutls_handshake_post_client_hello_func = gnutls_handshake_simple_hook_func;
858 
859 alias gnutls_cred_set = gnutls_credentials_set;
860 enum GNUTLS_OCSP_SR_IS_AVAIL = 1;
861 
862 enum GNUTLS_IDNA_FORCE_2008 = 1 << 1;
863 alias gnutls_srp_base64_encode_alloc = gnutls_srp_base64_encode2;
864 alias gnutls_srp_base64_decode_alloc = gnutls_srp_base64_decode2;
865 alias gnutls_pem_base64_encode_alloc = gnutls_pem_base64_encode2;
866 alias gnutls_pem_base64_decode_alloc = gnutls_pem_base64_decode2;
867 enum GNUTLS_KEY_DIGITAL_SIGNATURE = 128;
868 enum GNUTLS_KEY_NON_REPUDIATION = 64;
869 enum GNUTLS_KEY_KEY_ENCIPHERMENT = 32;
870 enum GNUTLS_KEY_DATA_ENCIPHERMENT = 16;
871 enum GNUTLS_KEY_KEY_AGREEMENT = 8;
872 enum GNUTLS_KEY_KEY_CERT_SIGN = 4;
873 enum GNUTLS_KEY_CRL_SIGN = 2;
874 enum GNUTLS_KEY_ENCIPHER_ONLY = 1;
875 enum GNUTLS_KEY_DECIPHER_ONLY = 32768;
876 enum GNUTLS_SCOMMIT_FLAG_ALLOW_BROKEN = 1;
877 enum GNUTLS_PKCS11_PIN_USER = gnutls_pin_flag_t.GNUTLS_PIN_USER;
878 enum GNUTLS_PKCS11_PIN_SO = gnutls_pin_flag_t.GNUTLS_PIN_SO;
879 enum GNUTLS_PKCS11_PIN_FINAL_TRY = gnutls_pin_flag_t.GNUTLS_PIN_FINAL_TRY;
880 enum GNUTLS_PKCS11_PIN_COUNT_LOW = gnutls_pin_flag_t.GNUTLS_PIN_COUNT_LOW;
881 enum GNUTLS_PKCS11_PIN_CONTEXT_SPECIFIC = gnutls_pin_flag_t.GNUTLS_PIN_CONTEXT_SPECIFIC;
882 enum GNUTLS_PKCS11_PIN_WRONG = gnutls_pin_flag_t.GNUTLS_PIN_WRONG;
883 enum GNUTLS_UTF8_IGNORE_ERRS = 1;
884 enum GNUTLS_EXT_RAW_FLAG_TLS_CLIENT_HELLO = 1;
885 enum GNUTLS_EXT_RAW_FLAG_DTLS_CLIENT_HELLO = 1 << 1;
886 enum GNUTLS_FIPS140_SET_MODE_THREAD = 1;
887 
888 enum GNUTLS_E_SUCCESS = 0;
889 enum GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM = -3;
890 enum GNUTLS_E_UNKNOWN_CIPHER_TYPE = -6;
891 enum GNUTLS_E_LARGE_PACKET = -7;
892 enum GNUTLS_E_UNSUPPORTED_VERSION_PACKET = -8;
893 enum GNUTLS_E_TLS_PACKET_DECODING_ERROR = GNUTLS_E_UNEXPECTED_PACKET_LENGTH;
894 enum GNUTLS_E_UNEXPECTED_PACKET_LENGTH = -9;
895 enum GNUTLS_E_INVALID_SESSION = -10;
896 enum GNUTLS_E_FATAL_ALERT_RECEIVED = -12;
897 enum GNUTLS_E_UNEXPECTED_PACKET = -15;
898 enum GNUTLS_E_WARNING_ALERT_RECEIVED = -16;
899 enum GNUTLS_E_ERROR_IN_FINISHED_PACKET = -18;
900 enum GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET = -19;
901 enum GNUTLS_E_UNKNOWN_CIPHER_SUITE = -21;
902 enum GNUTLS_E_UNWANTED_ALGORITHM = -22;
903 enum GNUTLS_E_MPI_SCAN_FAILED = -23;
904 enum GNUTLS_E_DECRYPTION_FAILED = -24;
905 enum GNUTLS_E_MEMORY_ERROR = -25;
906 enum GNUTLS_E_DECOMPRESSION_FAILED = -26;
907 enum GNUTLS_E_COMPRESSION_FAILED = -27;
908 enum GNUTLS_E_AGAIN = -28;
909 enum GNUTLS_E_EXPIRED = -29;
910 enum GNUTLS_E_DB_ERROR = -30;
911 enum GNUTLS_E_SRP_PWD_ERROR = GNUTLS_E_KEYFILE_ERROR;
912 enum GNUTLS_E_KEYFILE_ERROR = -31;
913 enum GNUTLS_E_INSUFFICIENT_CREDENTIALS = -32;
914 enum GNUTLS_E_INSUFICIENT_CREDENTIALS = GNUTLS_E_INSUFFICIENT_CREDENTIALS;
915 enum GNUTLS_E_INSUFFICIENT_CRED = GNUTLS_E_INSUFFICIENT_CREDENTIALS;
916 enum GNUTLS_E_INSUFICIENT_CRED = GNUTLS_E_INSUFFICIENT_CREDENTIALS;
917 
918 enum GNUTLS_E_HASH_FAILED = -33;
919 enum GNUTLS_E_BASE64_DECODING_ERROR = -34;
920 
921 enum GNUTLS_E_MPI_PRINT_FAILED = -35;
922 enum GNUTLS_E_REHANDSHAKE = -37;
923 enum GNUTLS_E_GOT_APPLICATION_DATA = -38;
924 enum GNUTLS_E_RECORD_LIMIT_REACHED = -39;
925 enum GNUTLS_E_ENCRYPTION_FAILED = -40;
926 
927 enum GNUTLS_E_PK_ENCRYPTION_FAILED = -44;
928 enum GNUTLS_E_PK_DECRYPTION_FAILED = -45;
929 enum GNUTLS_E_PK_SIGN_FAILED = -46;
930 enum GNUTLS_E_X509_UNSUPPORTED_CRITICAL_EXTENSION = -47;
931 enum GNUTLS_E_KEY_USAGE_VIOLATION = -48;
932 enum GNUTLS_E_NO_CERTIFICATE_FOUND = -49;
933 enum GNUTLS_E_INVALID_REQUEST = -50;
934 enum GNUTLS_E_SHORT_MEMORY_BUFFER = -51;
935 enum GNUTLS_E_INTERRUPTED = -52;
936 enum GNUTLS_E_PUSH_ERROR = -53;
937 enum GNUTLS_E_PULL_ERROR = -54;
938 enum GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER = -55;
939 enum GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE = -56;
940 enum GNUTLS_E_PKCS1_WRONG_PAD = -57;
941 enum GNUTLS_E_RECEIVED_ILLEGAL_EXTENSION = -58;
942 enum GNUTLS_E_INTERNAL_ERROR = -59;
943 enum GNUTLS_E_DH_PRIME_UNACCEPTABLE = -63;
944 enum GNUTLS_E_FILE_ERROR = -64;
945 enum GNUTLS_E_TOO_MANY_EMPTY_PACKETS = -78;
946 enum GNUTLS_E_UNKNOWN_PK_ALGORITHM = -80;
947 enum GNUTLS_E_TOO_MANY_HANDSHAKE_PACKETS = -81;
948 enum GNUTLS_E_RECEIVED_DISALLOWED_NAME = -82;
949 enum GNUTLS_E_CERTIFICATE_REQUIRED = -112;
950 
951 enum GNUTLS_E_NO_TEMPORARY_RSA_PARAMS = -84;
952 
953 enum GNUTLS_E_NO_COMPRESSION_ALGORITHMS = -86;
954 enum GNUTLS_E_NO_CIPHER_SUITES = -87;
955 
956 enum GNUTLS_E_OPENPGP_GETKEY_FAILED = -88;
957 enum GNUTLS_E_PK_SIG_VERIFY_FAILED = -89;
958 
959 enum GNUTLS_E_ILLEGAL_SRP_USERNAME = -90;
960 enum GNUTLS_E_SRP_PWD_PARSING_ERROR = GNUTLS_E_KEYFILE_PARSING_ERROR;
961 enum GNUTLS_E_KEYFILE_PARSING_ERROR = -91;
962 enum GNUTLS_E_NO_TEMPORARY_DH_PARAMS = -93;
963 
964 enum GNUTLS_E_ASN1_ELEMENT_NOT_FOUND = -67;
965 enum GNUTLS_E_ASN1_IDENTIFIER_NOT_FOUND = -68;
966 enum GNUTLS_E_ASN1_DER_ERROR = -69;
967 enum GNUTLS_E_ASN1_VALUE_NOT_FOUND = -70;
968 enum GNUTLS_E_ASN1_GENERIC_ERROR = -71;
969 enum GNUTLS_E_ASN1_VALUE_NOT_VALID = -72;
970 enum GNUTLS_E_ASN1_TAG_ERROR = -73;
971 enum GNUTLS_E_ASN1_TAG_IMPLICIT = -74;
972 enum GNUTLS_E_ASN1_TYPE_ANY_ERROR = -75;
973 enum GNUTLS_E_ASN1_SYNTAX_ERROR = -76;
974 enum GNUTLS_E_ASN1_DER_OVERFLOW = -77;
975 enum GNUTLS_E_OPENPGP_UID_REVOKED = -79;
976 enum GNUTLS_E_CERTIFICATE_ERROR = -43;
977 enum GNUTLS_E_X509_CERTIFICATE_ERROR = GNUTLS_E_CERTIFICATE_ERROR;
978 enum GNUTLS_E_CERTIFICATE_KEY_MISMATCH = -60;
979 enum GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE = -61;
980 enum GNUTLS_E_X509_UNKNOWN_SAN = -62;
981 enum GNUTLS_E_OPENPGP_FINGERPRINT_UNSUPPORTED = -94;
982 enum GNUTLS_E_X509_UNSUPPORTED_ATTRIBUTE = -95;
983 enum GNUTLS_E_UNKNOWN_HASH_ALGORITHM = -96;
984 enum GNUTLS_E_UNKNOWN_PKCS_CONTENT_TYPE = -97;
985 enum GNUTLS_E_UNKNOWN_PKCS_BAG_TYPE = -98;
986 enum GNUTLS_E_INVALID_PASSWORD = -99;
987 enum GNUTLS_E_MAC_VERIFY_FAILED = -100;
988 enum GNUTLS_E_CONSTRAINT_ERROR = -101;
989 
990 enum GNUTLS_E_WARNING_IA_IPHF_RECEIVED = -102;
991 enum GNUTLS_E_WARNING_IA_FPHF_RECEIVED = -103;
992 
993 enum GNUTLS_E_IA_VERIFY_FAILED = -104;
994 enum GNUTLS_E_UNKNOWN_ALGORITHM = -105;
995 enum GNUTLS_E_UNSUPPORTED_SIGNATURE_ALGORITHM = -106;
996 enum GNUTLS_E_SAFE_RENEGOTIATION_FAILED = -107;
997 enum GNUTLS_E_UNSAFE_RENEGOTIATION_DENIED = -108;
998 enum GNUTLS_E_UNKNOWN_SRP_USERNAME = -109;
999 enum GNUTLS_E_PREMATURE_TERMINATION = -110;
1000 
1001 static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_4)
1002     enum GNUTLS_E_MALFORMED_CIDR = -111;
1003 
1004 enum GNUTLS_E_BASE64_ENCODING_ERROR = -201;
1005 enum GNUTLS_E_INCOMPATIBLE_GCRYPT_LIBRARY = -202;
1006 enum GNUTLS_E_INCOMPATIBLE_CRYPTO_LIBRARY = -202;
1007 enum GNUTLS_E_INCOMPATIBLE_LIBTASN1_LIBRARY = -203;
1008 
1009 enum GNUTLS_E_OPENPGP_KEYRING_ERROR = -204;
1010 enum GNUTLS_E_X509_UNSUPPORTED_OID = -205;
1011 
1012 enum GNUTLS_E_RANDOM_FAILED = -206;
1013 enum GNUTLS_E_BASE64_UNEXPECTED_HEADER_ERROR = -207;
1014 
1015 enum GNUTLS_E_OPENPGP_SUBKEY_ERROR = -208;
1016 
1017 enum GNUTLS_E_CRYPTO_ALREADY_REGISTERED = GNUTLS_E_ALREADY_REGISTERED;
1018 enum GNUTLS_E_ALREADY_REGISTERED = -209;
1019 
1020 enum GNUTLS_E_HANDSHAKE_TOO_LARGE = -210;
1021 
1022 enum GNUTLS_E_CRYPTODEV_IOCTL_ERROR = -211;
1023 enum GNUTLS_E_CRYPTODEV_DEVICE_ERROR = -212;
1024 
1025 enum GNUTLS_E_CHANNEL_BINDING_NOT_AVAILABLE = -213;
1026 enum GNUTLS_E_BAD_COOKIE = -214;
1027 enum GNUTLS_E_OPENPGP_PREFERRED_KEY_ERROR = -215;
1028 enum GNUTLS_E_INCOMPAT_DSA_KEY_WITH_TLS_PROTOCOL = -216;
1029 enum GNUTLS_E_INSUFFICIENT_SECURITY = -217;
1030 
1031 enum GNUTLS_E_HEARTBEAT_PONG_RECEIVED = -292;
1032 enum GNUTLS_E_HEARTBEAT_PING_RECEIVED = -293;
1033 
1034 enum GNUTLS_E_UNRECOGNIZED_NAME = -294;
1035 
1036 enum GNUTLS_E_PKCS11_ERROR = -300;
1037 enum GNUTLS_E_PKCS11_LOAD_ERROR = -301;
1038 enum GNUTLS_E_PARSING_ERROR = -302;
1039 enum GNUTLS_E_PKCS11_PIN_ERROR = -303;
1040 
1041 enum GNUTLS_E_PKCS11_SLOT_ERROR = -305;
1042 enum GNUTLS_E_LOCKING_ERROR = -306;
1043 enum GNUTLS_E_PKCS11_ATTRIBUTE_ERROR = -307;
1044 enum GNUTLS_E_PKCS11_DEVICE_ERROR = -308;
1045 enum GNUTLS_E_PKCS11_DATA_ERROR = -309;
1046 enum GNUTLS_E_PKCS11_UNSUPPORTED_FEATURE_ERROR = -310;
1047 enum GNUTLS_E_PKCS11_KEY_ERROR = -311;
1048 enum GNUTLS_E_PKCS11_PIN_EXPIRED = -312;
1049 enum GNUTLS_E_PKCS11_PIN_LOCKED = -313;
1050 enum GNUTLS_E_PKCS11_SESSION_ERROR = -314;
1051 enum GNUTLS_E_PKCS11_SIGNATURE_ERROR = -315;
1052 enum GNUTLS_E_PKCS11_TOKEN_ERROR = -316;
1053 enum GNUTLS_E_PKCS11_USER_ERROR = -317;
1054 
1055 enum GNUTLS_E_CRYPTO_INIT_FAILED = -318;
1056 enum GNUTLS_E_TIMEDOUT = -319;
1057 enum GNUTLS_E_USER_ERROR = -320;
1058 enum GNUTLS_E_ECC_NO_SUPPORTED_CURVES = -321;
1059 enum GNUTLS_E_ECC_UNSUPPORTED_CURVE = -322;
1060 enum GNUTLS_E_PKCS11_REQUESTED_OBJECT_NOT_AVAILBLE = -323;
1061 enum GNUTLS_E_CERTIFICATE_LIST_UNSORTED = -324;
1062 enum GNUTLS_E_ILLEGAL_PARAMETER = -325;
1063 enum GNUTLS_E_NO_PRIORITIES_WERE_SET = -326;
1064 enum GNUTLS_E_X509_UNSUPPORTED_EXTENSION = -327;
1065 enum GNUTLS_E_SESSION_EOF = -328;
1066 
1067 enum GNUTLS_E_TPM_ERROR = -329;
1068 enum GNUTLS_E_TPM_KEY_PASSWORD_ERROR = -330;
1069 enum GNUTLS_E_TPM_SRK_PASSWORD_ERROR = -331;
1070 enum GNUTLS_E_TPM_SESSION_ERROR = -332;
1071 enum GNUTLS_E_TPM_KEY_NOT_FOUND = -333;
1072 enum GNUTLS_E_TPM_UNINITIALIZED = -334;
1073 enum GNUTLS_E_TPM_NO_LIB = -335;
1074 
1075 enum GNUTLS_E_NO_CERTIFICATE_STATUS = -340;
1076 enum GNUTLS_E_OCSP_RESPONSE_ERROR = -341;
1077 enum GNUTLS_E_RANDOM_DEVICE_ERROR = -342;
1078 enum GNUTLS_E_AUTH_ERROR = -343;
1079 enum GNUTLS_E_NO_APPLICATION_PROTOCOL = -344;
1080 enum GNUTLS_E_SOCKETS_INIT_ERROR = -345;
1081 enum GNUTLS_E_KEY_IMPORT_FAILED = -346;
1082 enum GNUTLS_E_INAPPROPRIATE_FALLBACK = -347;
1083 enum GNUTLS_E_CERTIFICATE_VERIFICATION_ERROR = -348;
1084 enum GNUTLS_E_PRIVKEY_VERIFICATION_ERROR = -349;
1085 enum GNUTLS_E_UNEXPECTED_EXTENSIONS_LENGTH = -350;
1086 enum GNUTLS_E_ASN1_EMBEDDED_NULL_IN_STRING = -351;
1087 
1088 enum GNUTLS_E_SELF_TEST_ERROR = -400;
1089 enum GNUTLS_E_NO_SELF_TEST = -401;
1090 enum GNUTLS_E_LIB_IN_ERROR_STATE = -402;
1091 enum GNUTLS_E_PK_GENERATION_ERROR = -403;
1092 enum GNUTLS_E_IDNA_ERROR = -404;
1093 
1094 enum GNUTLS_E_NEED_FALLBACK = -405;
1095 enum GNUTLS_E_SESSION_USER_ID_CHANGED = -406;
1096 enum GNUTLS_E_HANDSHAKE_DURING_FALSE_START = -407;
1097 
1098 static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_3)
1099     enum GNUTLS_E_UNAVAILABLE_DURING_HANDSHAKE = -408;
1100 
1101 static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_5)
1102 {
1103     enum GNUTLS_E_PK_INVALID_PUBKEY = -409;
1104     enum GNUTLS_E_PK_INVALID_PRIVKEY = -410;
1105 }
1106 
1107 enum GNUTLS_E_NOT_YET_ACTIVATED = -411;
1108 enum GNUTLS_E_INVALID_UTF8_STRING = -412;
1109 enum GNUTLS_E_NO_EMBEDDED_DATA = -413;
1110 enum GNUTLS_E_INVALID_UTF8_EMAIL = -414;
1111 enum GNUTLS_E_INVALID_PASSWORD_STRING = -415;
1112 enum GNUTLS_E_CERTIFICATE_TIME_ERROR = -416;
1113 enum GNUTLS_E_RECORD_OVERFLOW = -417;
1114 enum GNUTLS_E_ASN1_TIME_ERROR = -418;
1115 enum GNUTLS_E_INCOMPATIBLE_SIG_WITH_KEY = -419;
1116 enum GNUTLS_E_PK_INVALID_PUBKEY_PARAMS = -420;
1117 enum GNUTLS_E_PK_NO_VALIDATION_PARAMS = -421;
1118 enum GNUTLS_E_OCSP_MISMATCH_WITH_CERTS = -422;
1119 
1120 enum GNUTLS_E_NO_COMMON_KEY_SHARE = -423;
1121 enum GNUTLS_E_REAUTH_REQUEST = -424;
1122 enum GNUTLS_E_TOO_MANY_MATCHES = -425;
1123 enum GNUTLS_E_CRL_VERIFICATION_ERROR = -426;
1124 enum GNUTLS_E_MISSING_EXTENSION = -427;
1125 enum GNUTLS_E_DB_ENTRY_EXISTS = -428;
1126 enum GNUTLS_E_EARLY_DATA_REJECTED = -429;
1127 enum GNUTLS_E_X509_DUPLICATE_EXTENSION = -430;
1128 
1129 enum GNUTLS_E_UNIMPLEMENTED_FEATURE = -1250;
1130 
1131 enum GNUTLS_E_INT_RET_0 = -1251;
1132 enum GNUTLS_E_INT_CHECK_AGAIN = -1252;
1133 
1134 enum GNUTLS_E_APPLICATION_ERROR_MAX = -65000;
1135 enum GNUTLS_E_APPLICATION_ERROR_MIN = -65500;
1136 
1137 extern(C) nothrow @nogc
1138 {
1139     alias gnutls_params_function = int function (gnutls_session_t, gnutls_params_type_t, gnutls_params_st*);
1140     alias gnutls_certificate_verify_function = int function (gnutls_session_t);
1141     alias gnutls_db_store_func = int function (void*, gnutls_datum_t key, gnutls_datum_t data);
1142     alias gnutls_db_remove_func = int function (void*, gnutls_datum_t key);
1143     alias gnutls_db_retr_func = gnutls_datum_t function (void*, gnutls_datum_t key);
1144     alias gnutls_handshake_hook_func = int function (gnutls_session_t, uint htype, uint when, uint incoming, const(gnutls_datum_t)* msg);
1145     alias gnutls_handshake_simple_hook_func = int function (gnutls_session_t);
1146     alias gnutls_status_request_ocsp_func = int function (gnutls_session_t session, void* ptr, gnutls_datum_t* ocsp_response);
1147     alias gnutls_time_func = c_long function (time_t* t);
1148     alias mutex_init_func = int function (void** mutex);
1149     alias mutex_lock_func = int function (void** mutex);
1150     alias mutex_unlock_func = int function (void** mutex);
1151     alias mutex_deinit_func = int function (void** mutex);
1152     alias gnutls_alloc_function = void* function (size_t);
1153     alias gnutls_calloc_function = void* function (size_t, size_t);
1154     alias gnutls_is_secure_function = int function (const(void)*);
1155     alias gnutls_free_function = void function (void*);
1156     alias gnutls_realloc_function = void* function (void*, size_t);
1157     alias gnutls_log_func = void function (int, const(char)*);
1158     alias gnutls_audit_log_func = void function (gnutls_session_t, const(char)*);
1159     alias gnutls_keylog_func = int function (gnutls_session_t session, const(char)* label, const(gnutls_datum_t)* secret);
1160     alias gnutls_pull_func = c_long function (gnutls_transport_ptr_t, void*, size_t);
1161     alias gnutls_push_func = c_long function (gnutls_transport_ptr_t, const(void)*, size_t);
1162     alias gnutls_pull_timeout_func = int function (gnutls_transport_ptr_t, uint ms);
1163     alias gnutls_vec_push_func = c_long function (gnutls_transport_ptr_t, const(giovec_t)* iov, int iovcnt);
1164     alias gnutls_errno_func = int function (gnutls_transport_ptr_t);
1165     alias gnutls_srp_server_credentials_function = int function (gnutls_session_t, const(char)* username, gnutls_datum_t* salt, gnutls_datum_t* verifier, gnutls_datum_t* generator, gnutls_datum_t* prime);
1166     alias gnutls_srp_client_credentials_function = int function (gnutls_session_t, char**, char**);
1167     alias gnutls_psk_server_credentials_function = int function (gnutls_session_t, const(char)* username, gnutls_datum_t* key);
1168     alias gnutls_psk_server_credentials_function2 = int function (gnutls_session_t, const(gnutls_datum_t)* username, gnutls_datum_t* key);
1169     alias gnutls_psk_client_credentials_function = int function (gnutls_session_t, char** username, gnutls_datum_t* key);
1170     alias gnutls_psk_client_credentials_function2 = int function (gnutls_session_t, gnutls_datum_t* username, gnutls_datum_t* key);
1171     alias gnutls_certificate_retrieve_function = int function (gnutls_session_t, const(gnutls_datum_t)* req_ca_rdn, int nreqs, const(gnutls_pk_algorithm_t)* pk_algos, int pk_algos_length, gnutls_retr2_st*);
1172     alias gnutls_tdb_store_func = int function (const(char)* db_name, const(char)* host, const(char)* service, time_t expiration, const(gnutls_datum_t)* pubkey);
1173     alias gnutls_tdb_store_commitment_func = int function (const(char)* db_name, const(char)* host, const(char)* service, time_t expiration, gnutls_digest_algorithm_t hash_algo, const(gnutls_datum_t)* hash);
1174     alias gnutls_tdb_verify_func = int function (const(char)* db_name, const(char)* host, const(char)* service, const(gnutls_datum_t)* pubkey);
1175     alias gnutls_pin_callback_t = int function (void* userdata, int attempt, const(char)* token_url, const(char)* token_label, uint flags, char* pin, size_t pin_max);
1176     alias gnutls_buffer_t = gnutls_buffer_st*;
1177     alias gnutls_ext_recv_func = int function (gnutls_session_t session, const(ubyte)* data, size_t len);
1178     alias gnutls_ext_send_func = int function (gnutls_session_t session, gnutls_buffer_t extdata);
1179     alias gnutls_ext_deinit_data_func = void function (gnutls_ext_priv_data_t data);
1180     alias gnutls_ext_pack_func = int function (gnutls_ext_priv_data_t data, gnutls_buffer_t packed_data);
1181     alias gnutls_ext_unpack_func = int function (gnutls_buffer_t packed_data, gnutls_ext_priv_data_t* data);
1182     alias gnutls_ext_raw_process_func = int function (void* ctx, uint tls_id, const(ubyte)* data, uint data_size);
1183     alias gnutls_supp_recv_func = int function (gnutls_session_t session, const(ubyte)* data, size_t data_size);
1184     alias gnutls_supp_send_func = int function (gnutls_session_t session, gnutls_buffer_t buf);
1185     alias gnutls_db_add_func = int function (void*, time_t exp_time, const(gnutls_datum_t)* key, const(gnutls_datum_t)* data);
1186 }
1187 
1188 extern (D) nothrow @nogc
1189 {
1190     uint GNUTLS_CURVE_TO_BITS(uint curve) @safe pure
1191     {
1192         return cast(uint) (cast(uint) 1 << 31) | (cast(uint) curve);
1193     }
1194 
1195     uint GNUTLS_BITS_TO_CURVE(uint bits) @safe pure
1196     {
1197         return (cast(uint) bits) & 0x7FFFFFFF;
1198     }
1199 
1200     uint GNUTLS_BITS_ARE_CURVE(uint bits) @safe pure
1201     {
1202         return (cast(uint) bits) & 0x80000000;
1203     }
1204 
1205     const(char)* gnutls_check_version_numeric(uint major, uint minor, uint patch)() @trusted
1206     {
1207         enum ver = major.stringof[0..$-1] ~ "." ~ minor.stringof[0..$-1] ~ "." ~ patch.stringof[0..$-1];
1208         return gnutls_check_version(ver);
1209     }
1210 
1211     void gnutls_transport_set_int(gnutls_session_t s, int i) @trusted
1212     {
1213         gnutls_transport_set_int2(s, i, i);
1214     }
1215 }
1216 
1217 version (BindGnuTLS_Static)
1218 {
1219     extern (System) extern __gshared
1220     {
1221         gnutls_alloc_function gnutls_malloc;
1222         gnutls_realloc_function gnutls_realloc;
1223         gnutls_calloc_function gnutls_calloc;
1224         gnutls_free_function gnutls_free;
1225         char* function (const(char)*) gnutls_strdup;
1226 
1227         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_2)
1228         {
1229             const gnutls_datum_t gnutls_srp_8192_group_prime;
1230             const gnutls_datum_t gnutls_srp_8192_group_generator;
1231         }
1232 
1233         const gnutls_datum_t gnutls_srp_4096_group_prime;
1234         const gnutls_datum_t gnutls_srp_4096_group_generator;
1235         const gnutls_datum_t gnutls_srp_3072_group_prime;
1236         const gnutls_datum_t gnutls_srp_3072_group_generator;
1237         const gnutls_datum_t gnutls_srp_2048_group_prime;
1238         const gnutls_datum_t gnutls_srp_2048_group_generator;
1239         const gnutls_datum_t gnutls_srp_1536_group_prime;
1240         const gnutls_datum_t gnutls_srp_1536_group_generator;
1241         const gnutls_datum_t gnutls_srp_1024_group_prime;
1242         const gnutls_datum_t gnutls_srp_1024_group_generator;
1243         const gnutls_datum_t gnutls_ffdhe_8192_group_prime;
1244         const gnutls_datum_t gnutls_ffdhe_8192_group_generator;
1245         const uint gnutls_ffdhe_8192_key_bits;
1246 
1247         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_4)
1248         {
1249             const gnutls_datum_t gnutls_ffdhe_6144_group_prime;
1250             const gnutls_datum_t gnutls_ffdhe_6144_group_generator;
1251             const uint gnutls_ffdhe_6144_key_bits;
1252         }
1253 
1254         const gnutls_datum_t gnutls_ffdhe_4096_group_prime;
1255         const gnutls_datum_t gnutls_ffdhe_4096_group_generator;
1256         const uint gnutls_ffdhe_4096_key_bits;
1257         const gnutls_datum_t gnutls_ffdhe_3072_group_prime;
1258         const gnutls_datum_t gnutls_ffdhe_3072_group_generator;
1259         const uint gnutls_ffdhe_3072_key_bits;
1260         const gnutls_datum_t gnutls_ffdhe_2048_group_prime;
1261 
1262         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_8)
1263         {
1264             const gnutls_datum_t gnutls_ffdhe_2048_group_q;
1265             const gnutls_datum_t gnutls_ffdhe_3072_group_q;
1266             const gnutls_datum_t gnutls_ffdhe_4096_group_q;
1267             const gnutls_datum_t gnutls_ffdhe_6144_group_q;
1268             const gnutls_datum_t gnutls_ffdhe_8192_group_q;
1269         }
1270 
1271         const gnutls_datum_t gnutls_ffdhe_2048_group_generator;
1272         const uint gnutls_ffdhe_2048_key_bits;
1273     }
1274 
1275     extern (System) @nogc nothrow @system:
1276 
1277     const(char)* gnutls_pk_algorithm_get_name (gnutls_pk_algorithm_t algorithm);
1278     int gnutls_init (gnutls_session_t* session, uint flags);
1279     void gnutls_deinit (gnutls_session_t session);
1280     int gnutls_bye (gnutls_session_t session, gnutls_close_request_t how);
1281     int gnutls_handshake (gnutls_session_t session);
1282 
1283     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
1284         int gnutls_reauth (gnutls_session_t session, uint flags);
1285 
1286     void gnutls_handshake_set_timeout (gnutls_session_t session, uint ms);
1287     int gnutls_rehandshake (gnutls_session_t session);
1288 
1289     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
1290         int gnutls_session_key_update (gnutls_session_t session, uint flags);
1291 
1292     gnutls_alert_description_t gnutls_alert_get (gnutls_session_t session);
1293     int gnutls_alert_send (gnutls_session_t session, gnutls_alert_level_t level, gnutls_alert_description_t desc);
1294     int gnutls_alert_send_appropriate (gnutls_session_t session, int err);
1295     const(char)* gnutls_alert_get_name (gnutls_alert_description_t alert);
1296     const(char)* gnutls_alert_get_strname (gnutls_alert_description_t alert);
1297     gnutls_sec_param_t gnutls_pk_bits_to_sec_param (gnutls_pk_algorithm_t algo, uint bits);
1298     const(char)* gnutls_sec_param_get_name (gnutls_sec_param_t param);
1299     uint gnutls_sec_param_to_pk_bits (gnutls_pk_algorithm_t algo, gnutls_sec_param_t param);
1300     uint gnutls_sec_param_to_symmetric_bits (gnutls_sec_param_t param);
1301     const(char)* gnutls_ecc_curve_get_name (gnutls_ecc_curve_t curve);
1302     const(char)* gnutls_ecc_curve_get_oid (gnutls_ecc_curve_t curve);
1303     const(char)* gnutls_group_get_name (gnutls_group_t group);
1304     int gnutls_ecc_curve_get_size (gnutls_ecc_curve_t curve);
1305     gnutls_ecc_curve_t gnutls_ecc_curve_get (gnutls_session_t session);
1306     gnutls_group_t gnutls_group_get (gnutls_session_t session);
1307     gnutls_cipher_algorithm_t gnutls_cipher_get (gnutls_session_t session);
1308     gnutls_kx_algorithm_t gnutls_kx_get (gnutls_session_t session);
1309     gnutls_mac_algorithm_t gnutls_mac_get (gnutls_session_t session);
1310 
1311     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_13)
1312         gnutls_digest_algorithm_t gnutls_prf_hash_get (const gnutls_session_t session);
1313 
1314     gnutls_certificate_type_t gnutls_certificate_type_get (gnutls_session_t session);
1315 
1316     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_4)
1317         gnutls_certificate_type_t gnutls_certificate_type_get2 (gnutls_session_t session, gnutls_ctype_target_t target);
1318 
1319     int gnutls_sign_algorithm_get (gnutls_session_t session);
1320     int gnutls_sign_algorithm_get_client (gnutls_session_t session);
1321     int gnutls_sign_algorithm_get_requested (gnutls_session_t session, size_t indx, gnutls_sign_algorithm_t* algo);
1322     const(char)* gnutls_cipher_get_name (gnutls_cipher_algorithm_t algorithm);
1323     const(char)* gnutls_mac_get_name (gnutls_mac_algorithm_t algorithm);
1324     const(char)* gnutls_digest_get_name (gnutls_digest_algorithm_t algorithm);
1325     const(char)* gnutls_digest_get_oid (gnutls_digest_algorithm_t algorithm);
1326     const(char)* gnutls_kx_get_name (gnutls_kx_algorithm_t algorithm);
1327     const(char)* gnutls_certificate_type_get_name (gnutls_certificate_type_t type);
1328     const(char)* gnutls_pk_get_name (gnutls_pk_algorithm_t algorithm);
1329     const(char)* gnutls_pk_get_oid (gnutls_pk_algorithm_t algorithm);
1330     const(char)* gnutls_sign_get_name (gnutls_sign_algorithm_t algorithm);
1331     const(char)* gnutls_sign_get_oid (gnutls_sign_algorithm_t sign);
1332 
1333     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
1334     {
1335         const(char)* gnutls_gost_paramset_get_name (gnutls_gost_paramset_t param);
1336         const(char)* gnutls_gost_paramset_get_oid (gnutls_gost_paramset_t param);
1337     }
1338 
1339     size_t gnutls_cipher_get_key_size (gnutls_cipher_algorithm_t algorithm);
1340     size_t gnutls_mac_get_key_size (gnutls_mac_algorithm_t algorithm);
1341     uint gnutls_sign_is_secure (gnutls_sign_algorithm_t algorithm);
1342     uint gnutls_sign_is_secure2 (gnutls_sign_algorithm_t algorithm, uint flags);
1343     gnutls_digest_algorithm_t gnutls_sign_get_hash_algorithm (gnutls_sign_algorithm_t sign);
1344     gnutls_pk_algorithm_t gnutls_sign_get_pk_algorithm (gnutls_sign_algorithm_t sign);
1345     gnutls_sign_algorithm_t gnutls_pk_to_sign (gnutls_pk_algorithm_t pk, gnutls_digest_algorithm_t hash);
1346     uint gnutls_sign_supports_pk_algorithm (gnutls_sign_algorithm_t sign, gnutls_pk_algorithm_t pk);
1347     gnutls_mac_algorithm_t gnutls_mac_get_id (const(char)* name);
1348     gnutls_digest_algorithm_t gnutls_digest_get_id (const(char)* name);
1349     gnutls_cipher_algorithm_t gnutls_cipher_get_id (const(char)* name);
1350     gnutls_kx_algorithm_t gnutls_kx_get_id (const(char)* name);
1351     gnutls_protocol_t gnutls_protocol_get_id (const(char)* name);
1352     gnutls_certificate_type_t gnutls_certificate_type_get_id (const(char)* name);
1353     gnutls_pk_algorithm_t gnutls_pk_get_id (const(char)* name);
1354     gnutls_sign_algorithm_t gnutls_sign_get_id (const(char)* name);
1355     gnutls_ecc_curve_t gnutls_ecc_curve_get_id (const(char)* name);
1356     gnutls_pk_algorithm_t gnutls_ecc_curve_get_pk (gnutls_ecc_curve_t curve);
1357     gnutls_group_t gnutls_group_get_id (const(char)* name);
1358     gnutls_digest_algorithm_t gnutls_oid_to_digest (const(char)* oid);
1359 
1360     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_4)
1361         gnutls_mac_algorithm_t gnutls_oid_to_mac (const(char)* oid);
1362 
1363     gnutls_pk_algorithm_t gnutls_oid_to_pk (const(char)* oid);
1364     gnutls_sign_algorithm_t gnutls_oid_to_sign (const(char)* oid);
1365     gnutls_ecc_curve_t gnutls_oid_to_ecc_curve (const(char)* oid);
1366 
1367     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
1368         gnutls_gost_paramset_t gnutls_oid_to_gost_paramset (const(char)* oid);
1369 
1370     const(gnutls_ecc_curve_t)* gnutls_ecc_curve_list ();
1371     const(gnutls_group_t)* gnutls_group_list ();
1372     const(gnutls_cipher_algorithm_t)* gnutls_cipher_list ();
1373     const(gnutls_mac_algorithm_t)* gnutls_mac_list ();
1374     const(gnutls_digest_algorithm_t)* gnutls_digest_list ();
1375     const(gnutls_protocol_t)* gnutls_protocol_list ();
1376     const(gnutls_certificate_type_t)* gnutls_certificate_type_list ();
1377     const(gnutls_kx_algorithm_t)* gnutls_kx_list ();
1378     const(gnutls_pk_algorithm_t)* gnutls_pk_list ();
1379     const(gnutls_sign_algorithm_t)* gnutls_sign_list ();
1380     const(char)* gnutls_cipher_suite_info (size_t idx, ubyte* cs_id, gnutls_kx_algorithm_t* kx, gnutls_cipher_algorithm_t* cipher, gnutls_mac_algorithm_t* mac, gnutls_protocol_t* min_version);
1381     int gnutls_error_is_fatal (int error);
1382     int gnutls_error_to_alert (int err, int* level);
1383     void gnutls_perror (int error);
1384     const(char)* gnutls_strerror (int error);
1385     const(char)* gnutls_strerror_name (int error);
1386     void gnutls_handshake_set_private_extensions (gnutls_session_t session, int allow);
1387     int gnutls_handshake_set_random (gnutls_session_t session, const(gnutls_datum_t)* random);
1388     gnutls_handshake_description_t gnutls_handshake_get_last_out (gnutls_session_t session);
1389     gnutls_handshake_description_t gnutls_handshake_get_last_in (gnutls_session_t session);
1390     int gnutls_heartbeat_ping (gnutls_session_t session, size_t data_size, uint max_tries, uint flags);
1391     int gnutls_heartbeat_pong (gnutls_session_t session, uint flags);
1392     void gnutls_record_set_timeout (gnutls_session_t session, uint ms);
1393     void gnutls_record_disable_padding (gnutls_session_t session);
1394     void gnutls_record_cork (gnutls_session_t session);
1395     int gnutls_record_uncork (gnutls_session_t session, uint flags);
1396     size_t gnutls_record_discard_queued (gnutls_session_t session);
1397     int gnutls_record_get_state (gnutls_session_t session, uint read, gnutls_datum_t* mac_key, gnutls_datum_t* IV, gnutls_datum_t* cipher_key, ref ubyte[8] seq_number);
1398     int gnutls_record_set_state (gnutls_session_t session, uint read, ref const(ubyte)[8] seq_number);
1399     int gnutls_range_split (gnutls_session_t session, const(gnutls_range_st)* orig, gnutls_range_st* small_range, gnutls_range_st* rem_range);
1400     ssize_t gnutls_record_send (gnutls_session_t session, const(void)* data, size_t data_size);
1401 
1402     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
1403         ssize_t gnutls_record_send2 (gnutls_session_t session, const(void)* data, size_t data_size, size_t pad, uint flags);
1404 
1405     ssize_t gnutls_record_send_range (gnutls_session_t session, const(void)* data, size_t data_size, const(gnutls_range_st)* range);
1406     ssize_t gnutls_record_recv (gnutls_session_t session, void* data, size_t data_size);
1407     ssize_t gnutls_record_recv_packet (gnutls_session_t session, gnutls_packet_t* packet);
1408     void gnutls_packet_get (gnutls_packet_t packet, gnutls_datum_t* data, ubyte* sequence);
1409     void gnutls_packet_deinit (gnutls_packet_t packet);
1410     ssize_t gnutls_record_recv_seq (gnutls_session_t session, void* data, size_t data_size, ubyte* seq);
1411     size_t gnutls_record_overhead_size (gnutls_session_t session);
1412     size_t gnutls_est_record_overhead_size (gnutls_protocol_t version_, gnutls_cipher_algorithm_t cipher, gnutls_mac_algorithm_t mac, gnutls_compression_method_t comp, uint flags);
1413     void gnutls_session_enable_compatibility_mode (gnutls_session_t session);
1414     uint gnutls_record_can_use_length_hiding (gnutls_session_t session);
1415     int gnutls_record_get_direction (gnutls_session_t session);
1416     size_t gnutls_record_get_max_size (gnutls_session_t session);
1417     ssize_t gnutls_record_set_max_size (gnutls_session_t session, size_t size);
1418 
1419     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_8)
1420         ssize_t gnutls_record_set_max_recv_size (gnutls_session_t session, size_t size);
1421 
1422     size_t gnutls_record_check_pending (gnutls_session_t session);
1423     size_t gnutls_record_check_corked (gnutls_session_t session);
1424 
1425 
1426     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_4)
1427         int gnutls_record_set_max_early_data_size (gnutls_session_t session, size_t size);
1428 
1429     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_5)
1430     {
1431         size_t gnutls_record_get_max_early_data_size (gnutls_session_t session);
1432         ssize_t gnutls_record_send_early_data (gnutls_session_t session, const(void)* data, size_t length);
1433         ssize_t gnutls_record_recv_early_data (gnutls_session_t session, void* data, size_t data_size);
1434     }
1435 
1436     void gnutls_session_force_valid (gnutls_session_t session);
1437     int gnutls_prf (gnutls_session_t session, size_t label_size, const(char)* label, int server_random_first, size_t extra_size, const(char)* extra, size_t outsize, char* out_);
1438     int gnutls_prf_rfc5705 (gnutls_session_t session, size_t label_size, const(char)* label, size_t context_size, const(char)* context, size_t outsize, char* out_);
1439 
1440     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_8)
1441         int gnutls_prf_early (gnutls_session_t session, size_t label_size, const(char)* label, size_t context_size, const(char)* context, size_t outsize, char* out_);
1442 
1443     int gnutls_prf_raw (gnutls_session_t session, size_t label_size, const(char)* label, size_t seed_size, const(char)* seed, size_t outsize, char* out_);
1444     int gnutls_server_name_set (gnutls_session_t session, gnutls_server_name_type_t type, const(void)* name, size_t name_length);
1445     int gnutls_server_name_get (gnutls_session_t session, void* data, size_t* data_length, uint* type, uint indx);
1446     uint gnutls_heartbeat_get_timeout (gnutls_session_t session);
1447     void gnutls_heartbeat_set_timeouts (gnutls_session_t session, uint retrans_timeout, uint total_timeout);
1448     void gnutls_heartbeat_enable (gnutls_session_t session, uint type);
1449     uint gnutls_heartbeat_allowed (gnutls_session_t session, uint type);
1450     uint gnutls_safe_renegotiation_status (gnutls_session_t session);
1451     uint gnutls_session_ext_master_secret_status (gnutls_session_t session);
1452     uint gnutls_session_etm_status (gnutls_session_t session);
1453     uint gnutls_session_get_flags (gnutls_session_t session);
1454     const(char)* gnutls_supplemental_get_name (gnutls_supplemental_data_format_type_t type);
1455     int gnutls_session_ticket_key_generate (gnutls_datum_t* key);
1456     int gnutls_session_ticket_enable_client (gnutls_session_t session);
1457     int gnutls_session_ticket_enable_server (gnutls_session_t session, const(gnutls_datum_t)* key);
1458 
1459     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
1460         int gnutls_session_ticket_send (gnutls_session_t session, uint nr, uint flags);
1461 
1462     int gnutls_srtp_set_profile (gnutls_session_t session, gnutls_srtp_profile_t profile);
1463     int gnutls_srtp_set_profile_direct (gnutls_session_t session, const(char)* profiles, const(char*)* err_pos);
1464     int gnutls_srtp_get_selected_profile (gnutls_session_t session, gnutls_srtp_profile_t* profile);
1465     const(char)* gnutls_srtp_get_profile_name (gnutls_srtp_profile_t profile);
1466     int gnutls_srtp_get_profile_id (const(char)* name, gnutls_srtp_profile_t* profile);
1467     int gnutls_srtp_get_keys (gnutls_session_t session, void* key_material, uint key_material_size, gnutls_datum_t* client_key, gnutls_datum_t* client_salt, gnutls_datum_t* server_key, gnutls_datum_t* server_salt);
1468     int gnutls_srtp_set_mki (gnutls_session_t session, const(gnutls_datum_t)* mki);
1469     int gnutls_srtp_get_mki (gnutls_session_t session, gnutls_datum_t* mki);
1470     int gnutls_alpn_get_selected_protocol (gnutls_session_t session, gnutls_datum_t* protocol);
1471     int gnutls_alpn_set_protocols (gnutls_session_t session, const(gnutls_datum_t)* protocols, uint protocols_size, uint flags);
1472     int gnutls_key_generate (gnutls_datum_t* key, uint key_size);
1473     int gnutls_priority_init (gnutls_priority_t* priority_cache, const(char)* priorities, const(char*)* err_pos);
1474 
1475     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
1476         int gnutls_priority_init2 (gnutls_priority_t* priority_cache, const(char)* priorities, const(char*)* err_pos, uint flags);
1477 
1478     void gnutls_priority_deinit (gnutls_priority_t priority_cache);
1479     int gnutls_priority_get_cipher_suite_index (gnutls_priority_t pcache, uint idx, uint* sidx);
1480     const(char)* gnutls_priority_string_list (uint iter, uint flags);
1481     int gnutls_priority_set (gnutls_session_t session, gnutls_priority_t priority);
1482     int gnutls_priority_set_direct (gnutls_session_t session, const(char)* priorities, const(char*)* err_pos);
1483     int gnutls_priority_certificate_type_list (gnutls_priority_t pcache, const(uint*)* list);
1484 
1485     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_4)
1486         int gnutls_priority_certificate_type_list2 (gnutls_priority_t pcache, const(uint*)* list, gnutls_ctype_target_t target);
1487 
1488     int gnutls_priority_sign_list (gnutls_priority_t pcache, const(uint*)* list);
1489     int gnutls_priority_protocol_list (gnutls_priority_t pcache, const(uint*)* list);
1490     int gnutls_priority_ecc_curve_list (gnutls_priority_t pcache, const(uint*)* list);
1491     int gnutls_priority_group_list (gnutls_priority_t pcache, const(uint*)* list);
1492     int gnutls_priority_kx_list (gnutls_priority_t pcache, const(uint*)* list);
1493     int gnutls_priority_cipher_list (gnutls_priority_t pcache, const(uint*)* list);
1494     int gnutls_priority_mac_list (gnutls_priority_t pcache, const(uint*)* list);
1495 
1496     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_9)
1497         const(char)* gnutls_get_system_config_file ();
1498 
1499     int gnutls_set_default_priority (gnutls_session_t session);
1500 
1501     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
1502         int gnutls_set_default_priority_append (gnutls_session_t session, const(char)* add_prio, const(char*)* err_pos, uint flags);
1503 
1504     const(char)* gnutls_cipher_suite_get_name (gnutls_kx_algorithm_t kx_algorithm, gnutls_cipher_algorithm_t cipher_algorithm, gnutls_mac_algorithm_t mac_algorithm);
1505     gnutls_protocol_t gnutls_protocol_get_version (gnutls_session_t session);
1506     const(char)* gnutls_protocol_get_name (gnutls_protocol_t version_);
1507     int gnutls_session_set_data (gnutls_session_t session, const(void)* session_data, size_t session_data_size);
1508     int gnutls_session_get_data (gnutls_session_t session, void* session_data, size_t* session_data_size);
1509     int gnutls_session_get_data2 (gnutls_session_t session, gnutls_datum_t* data);
1510     void gnutls_session_get_random (gnutls_session_t session, gnutls_datum_t* client, gnutls_datum_t* server);
1511     void gnutls_session_get_master_secret (gnutls_session_t session, gnutls_datum_t* secret);
1512     char* gnutls_session_get_desc (gnutls_session_t session);
1513     void gnutls_session_set_verify_function (gnutls_session_t session, int function () func);
1514     void gnutls_session_set_verify_cert (gnutls_session_t session, const(char)* hostname, uint flags);
1515     void gnutls_session_set_verify_cert2 (gnutls_session_t session, gnutls_typed_vdata_st* data, uint elements, uint flags);
1516     uint gnutls_session_get_verify_cert_status (gnutls_session_t);
1517     int gnutls_session_set_premaster (gnutls_session_t session, uint entity, gnutls_protocol_t version_, gnutls_kx_algorithm_t kx, gnutls_cipher_algorithm_t cipher, gnutls_mac_algorithm_t mac, gnutls_compression_method_t comp, const(gnutls_datum_t)* master, const(gnutls_datum_t)* session_id);
1518     int gnutls_session_get_id (gnutls_session_t session, void* session_id, size_t* session_id_size);
1519     int gnutls_session_get_id2 (gnutls_session_t session, gnutls_datum_t* session_id);
1520     int gnutls_session_set_id (gnutls_session_t session, const(gnutls_datum_t)* sid);
1521     int gnutls_session_channel_binding (gnutls_session_t session, gnutls_channel_binding_t cbtype, gnutls_datum_t* cb);
1522     int gnutls_session_is_resumed (gnutls_session_t session);
1523     int gnutls_session_resumption_requested (gnutls_session_t session);
1524     void gnutls_db_set_cache_expiration (gnutls_session_t session, int seconds);
1525     uint gnutls_db_get_default_cache_expiration ();
1526     void gnutls_db_remove_session (gnutls_session_t session);
1527     void gnutls_db_set_retrieve_function (gnutls_session_t session, gnutls_db_retr_func retr_func);
1528     void gnutls_db_set_remove_function (gnutls_session_t session, gnutls_db_remove_func rem_func);
1529     void gnutls_db_set_store_function (gnutls_session_t session, gnutls_db_store_func store_func);
1530     void gnutls_db_set_ptr (gnutls_session_t session, void* ptr);
1531     void* gnutls_db_get_ptr (gnutls_session_t session);
1532     int gnutls_db_check_entry (gnutls_session_t session, gnutls_datum_t session_entry);
1533     time_t gnutls_db_check_entry_time (gnutls_datum_t* entry);
1534 
1535     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_5)
1536         time_t gnutls_db_check_entry_expire_time (gnutls_datum_t* entry);
1537 
1538     void gnutls_handshake_set_hook_function (gnutls_session_t session, uint htype, int when, gnutls_handshake_hook_func func);
1539     void gnutls_handshake_set_post_client_hello_function (gnutls_session_t session, gnutls_handshake_simple_hook_func func);
1540     void gnutls_handshake_set_max_packet_length (gnutls_session_t session, size_t max);
1541     const(char)* gnutls_check_version (const(char)* req_version);
1542     void gnutls_credentials_clear (gnutls_session_t session);
1543     int gnutls_credentials_set (gnutls_session_t session, gnutls_credentials_type_t type, void* cred);
1544     int gnutls_credentials_get (gnutls_session_t session, gnutls_credentials_type_t type, void** cred);
1545     void gnutls_anon_free_server_credentials (gnutls_anon_server_credentials_t sc);
1546     int gnutls_anon_allocate_server_credentials (gnutls_anon_server_credentials_t* sc);
1547     void gnutls_anon_set_server_dh_params (gnutls_anon_server_credentials_t res, gnutls_dh_params_t dh_params);
1548 
1549     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_6)
1550         int gnutls_anon_set_server_known_dh_params (gnutls_anon_server_credentials_t res, gnutls_sec_param_t sec_param);
1551 
1552     void gnutls_anon_set_server_params_function (gnutls_anon_server_credentials_t res, int function () func);
1553     void gnutls_anon_free_client_credentials (gnutls_anon_client_credentials_t sc);
1554     int gnutls_anon_allocate_client_credentials (gnutls_anon_client_credentials_t* sc);
1555     void gnutls_certificate_free_credentials (gnutls_certificate_credentials_t sc);
1556     int gnutls_certificate_allocate_credentials (gnutls_certificate_credentials_t* res);
1557     int gnutls_certificate_get_issuer (gnutls_certificate_credentials_t sc, gnutls_x509_crt_t cert, gnutls_x509_crt_t* issuer, uint flags);
1558     int gnutls_certificate_get_crt_raw (gnutls_certificate_credentials_t sc, uint idx1, uint idx2, gnutls_datum_t* cert);
1559     void gnutls_certificate_free_keys (gnutls_certificate_credentials_t sc);
1560     void gnutls_certificate_free_cas (gnutls_certificate_credentials_t sc);
1561     void gnutls_certificate_free_ca_names (gnutls_certificate_credentials_t sc);
1562     void gnutls_certificate_free_crls (gnutls_certificate_credentials_t sc);
1563     void gnutls_certificate_set_dh_params (gnutls_certificate_credentials_t res, gnutls_dh_params_t dh_params);
1564 
1565     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_6)
1566         int gnutls_certificate_set_known_dh_params (gnutls_certificate_credentials_t res, gnutls_sec_param_t sec_param);
1567 
1568     void gnutls_certificate_set_verify_flags (gnutls_certificate_credentials_t res, uint flags);
1569     uint gnutls_certificate_get_verify_flags (gnutls_certificate_credentials_t res);
1570     void gnutls_certificate_set_flags (gnutls_certificate_credentials_t, uint flags);
1571     void gnutls_certificate_set_verify_limits (gnutls_certificate_credentials_t res, uint max_bits, uint max_depth);
1572     int gnutls_certificate_set_x509_system_trust (gnutls_certificate_credentials_t cred);
1573     int gnutls_certificate_set_x509_trust_file (gnutls_certificate_credentials_t cred, const(char)* cafile, gnutls_x509_crt_fmt_t type);
1574     int gnutls_certificate_set_x509_trust_dir (gnutls_certificate_credentials_t cred, const(char)* ca_dir, gnutls_x509_crt_fmt_t type);
1575     int gnutls_certificate_set_x509_trust_mem (gnutls_certificate_credentials_t res, const(gnutls_datum_t)* ca, gnutls_x509_crt_fmt_t type);
1576     int gnutls_certificate_set_x509_crl_file (gnutls_certificate_credentials_t res, const(char)* crlfile, gnutls_x509_crt_fmt_t type);
1577     int gnutls_certificate_set_x509_crl_mem (gnutls_certificate_credentials_t res, const(gnutls_datum_t)* CRL, gnutls_x509_crt_fmt_t type);
1578     int gnutls_certificate_set_x509_key_file (gnutls_certificate_credentials_t res, const(char)* certfile, const(char)* keyfile, gnutls_x509_crt_fmt_t type);
1579     int gnutls_certificate_set_x509_key_file2 (gnutls_certificate_credentials_t res, const(char)* certfile, const(char)* keyfile, gnutls_x509_crt_fmt_t type, const(char)* pass, uint flags);
1580     int gnutls_certificate_set_x509_key_mem (gnutls_certificate_credentials_t res, const(gnutls_datum_t)* cert, const(gnutls_datum_t)* key, gnutls_x509_crt_fmt_t type);
1581     int gnutls_certificate_set_x509_key_mem2 (gnutls_certificate_credentials_t res, const(gnutls_datum_t)* cert, const(gnutls_datum_t)* key, gnutls_x509_crt_fmt_t type, const(char)* pass, uint flags);
1582     void gnutls_certificate_send_x509_rdn_sequence (gnutls_session_t session, int status);
1583     int gnutls_certificate_set_x509_simple_pkcs12_file (gnutls_certificate_credentials_t res, const(char)* pkcs12file, gnutls_x509_crt_fmt_t type, const(char)* password);
1584     int gnutls_certificate_set_x509_simple_pkcs12_mem (gnutls_certificate_credentials_t res, const(gnutls_datum_t)* p12blob, gnutls_x509_crt_fmt_t type, const(char)* password);
1585     int gnutls_certificate_set_x509_key (gnutls_certificate_credentials_t res, gnutls_x509_crt_t* cert_list, int cert_list_size, gnutls_x509_privkey_t key);
1586     int gnutls_certificate_set_x509_trust (gnutls_certificate_credentials_t res, gnutls_x509_crt_t* ca_list, int ca_list_size);
1587     int gnutls_certificate_set_x509_crl (gnutls_certificate_credentials_t res, gnutls_x509_crl_t* crl_list, int crl_list_size);
1588     int gnutls_certificate_get_x509_key (gnutls_certificate_credentials_t res, uint index, gnutls_x509_privkey_t* key);
1589     int gnutls_certificate_get_x509_crt (gnutls_certificate_credentials_t res, uint index, gnutls_x509_crt_t** crt_list, uint* crt_list_size);
1590     void gnutls_certificate_set_ocsp_status_request_function (gnutls_certificate_credentials_t res, gnutls_status_request_ocsp_func ocsp_func, void* ptr);
1591 
1592     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_5)
1593         int gnutls_certificate_set_ocsp_status_request_function2 (gnutls_certificate_credentials_t res, uint idx, gnutls_status_request_ocsp_func ocsp_func, void* ptr);
1594 
1595     int gnutls_certificate_set_ocsp_status_request_file (gnutls_certificate_credentials_t res, const(char)* response_file, uint idx);
1596 
1597     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
1598     {
1599         int gnutls_certificate_set_ocsp_status_request_file2 (gnutls_certificate_credentials_t res, const(char)* response_file, uint idx, gnutls_x509_crt_fmt_t fmt);
1600         int gnutls_certificate_set_ocsp_status_request_mem (gnutls_certificate_credentials_t res, const(gnutls_datum_t)* resp, uint idx, gnutls_x509_crt_fmt_t fmt);
1601         time_t gnutls_certificate_get_ocsp_expiration (gnutls_certificate_credentials_t sc, uint idx, int oidx, uint flags);
1602     }
1603 
1604     int gnutls_ocsp_status_request_enable_client (gnutls_session_t session, gnutls_datum_t* responder_id, size_t responder_id_size, gnutls_datum_t* request_extensions);
1605     int gnutls_ocsp_status_request_get (gnutls_session_t session, gnutls_datum_t* response);
1606     uint gnutls_ocsp_status_request_is_checked (gnutls_session_t session, uint flags);
1607 
1608     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
1609         int gnutls_ocsp_status_request_get2 (gnutls_session_t session, uint idx, gnutls_datum_t* response);
1610 
1611     int gnutls_certificate_set_rawpk_key_mem (gnutls_certificate_credentials_t cred, const(gnutls_datum_t)* spki, const(gnutls_datum_t)* pkey, gnutls_x509_crt_fmt_t format, const(char)* pass, uint key_usage, const(char*)* names, uint names_length, uint flags);
1612     int gnutls_certificate_set_rawpk_key_file (gnutls_certificate_credentials_t cred, const(char)* rawpkfile, const(char)* privkeyfile, gnutls_x509_crt_fmt_t format, const(char)* pass, uint key_usage, const(char*)* names, uint names_length, uint privkey_flags, uint pkcs11_flags);
1613     int gnutls_global_init ();
1614     void gnutls_global_deinit ();
1615     void gnutls_global_set_mutex (mutex_init_func init, mutex_deinit_func deinit, mutex_lock_func lock, mutex_unlock_func unlock);
1616     void gnutls_global_set_time_function (gnutls_time_func time_func);
1617     void gnutls_memset (void* data, int c, size_t size);
1618     int gnutls_memcmp (const(void)* s1, const(void)* s2, size_t n);
1619     void gnutls_global_set_log_function (gnutls_log_func log_func);
1620     void gnutls_global_set_audit_log_function (gnutls_audit_log_func log_func);
1621     void gnutls_global_set_log_level (int level);
1622 
1623     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_13)
1624     {
1625         gnutls_keylog_func gnutls_session_get_keylog_function (const gnutls_session_t session);
1626         void gnutls_session_set_keylog_function (gnutls_session_t session, gnutls_keylog_func func);
1627     }
1628 
1629     int gnutls_dh_params_init (gnutls_dh_params_t* dh_params);
1630     void gnutls_dh_params_deinit (gnutls_dh_params_t dh_params);
1631     int gnutls_dh_params_import_raw (gnutls_dh_params_t dh_params, const(gnutls_datum_t)* prime, const(gnutls_datum_t)* generator);
1632     int gnutls_dh_params_import_dsa (gnutls_dh_params_t dh_params, gnutls_x509_privkey_t key);
1633     int gnutls_dh_params_import_raw2 (gnutls_dh_params_t dh_params, const(gnutls_datum_t)* prime, const(gnutls_datum_t)* generator, uint key_bits);
1634 
1635     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_8)
1636         int gnutls_dh_params_import_raw3 (gnutls_dh_params_t dh_params, const(gnutls_datum_t)* prime, const(gnutls_datum_t)* q, const(gnutls_datum_t)* generator);
1637 
1638     int gnutls_dh_params_import_pkcs3 (gnutls_dh_params_t params, const(gnutls_datum_t)* pkcs3_params, gnutls_x509_crt_fmt_t format);
1639     int gnutls_dh_params_generate2 (gnutls_dh_params_t params, uint bits);
1640     int gnutls_dh_params_export_pkcs3 (gnutls_dh_params_t params, gnutls_x509_crt_fmt_t format, ubyte* params_data, size_t* params_data_size);
1641     int gnutls_dh_params_export2_pkcs3 (gnutls_dh_params_t params, gnutls_x509_crt_fmt_t format, gnutls_datum_t* out_);
1642     int gnutls_dh_params_export_raw (gnutls_dh_params_t params, gnutls_datum_t* prime, gnutls_datum_t* generator, uint* bits);
1643     int gnutls_dh_params_cpy (gnutls_dh_params_t dst, gnutls_dh_params_t src);
1644     int gnutls_system_recv_timeout (gnutls_transport_ptr_t ptr, uint ms);
1645     void gnutls_transport_set_int2 (gnutls_session_t session, int r, int s);
1646     void gnutls_transport_get_int2 (gnutls_session_t session, int* r, int* s);
1647     int gnutls_transport_get_int (gnutls_session_t session);
1648     void gnutls_transport_set_ptr (gnutls_session_t session, gnutls_transport_ptr_t ptr);
1649     void gnutls_transport_set_ptr2 (gnutls_session_t session, gnutls_transport_ptr_t recv_ptr, gnutls_transport_ptr_t send_ptr);
1650     gnutls_transport_ptr_t gnutls_transport_get_ptr (gnutls_session_t session);
1651     void gnutls_transport_get_ptr2 (gnutls_session_t session, gnutls_transport_ptr_t* recv_ptr, gnutls_transport_ptr_t* send_ptr);
1652     void gnutls_transport_set_vec_push_function (gnutls_session_t session, gnutls_vec_push_func vec_func);
1653     void gnutls_transport_set_push_function (gnutls_session_t session, gnutls_push_func push_func);
1654     void gnutls_transport_set_pull_function (gnutls_session_t session, gnutls_pull_func pull_func);
1655     void gnutls_transport_set_pull_timeout_function (gnutls_session_t session, gnutls_pull_timeout_func func);
1656     void gnutls_transport_set_errno_function (gnutls_session_t session, gnutls_errno_func errno_func);
1657     void gnutls_transport_set_errno (gnutls_session_t session, int err);
1658     void gnutls_session_set_ptr (gnutls_session_t session, void* ptr);
1659     void* gnutls_session_get_ptr (gnutls_session_t session);
1660     void gnutls_openpgp_send_cert (gnutls_session_t session, gnutls_openpgp_crt_status_t status);
1661     int gnutls_fingerprint (gnutls_digest_algorithm_t algo, const(gnutls_datum_t)* data, void* result, size_t* result_size);
1662     int gnutls_random_art (gnutls_random_art_t type, const(char)* key_type, uint key_size, void* fpr, size_t fpr_size, gnutls_datum_t* art);
1663 
1664     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_9)
1665     {
1666         int gnutls_idna_map (const(char)* input, uint ilen, gnutls_datum_t* out_, uint flags);
1667         int gnutls_idna_reverse_map (const(char)* input, uint ilen, gnutls_datum_t* out_, uint flags);
1668     }
1669 
1670     void gnutls_srp_free_client_credentials (gnutls_srp_client_credentials_t sc);
1671     int gnutls_srp_allocate_client_credentials (gnutls_srp_client_credentials_t* sc);
1672     int gnutls_srp_set_client_credentials (gnutls_srp_client_credentials_t res, const(char)* username, const(char)* password);
1673     void gnutls_srp_free_server_credentials (gnutls_srp_server_credentials_t sc);
1674     int gnutls_srp_allocate_server_credentials (gnutls_srp_server_credentials_t* sc);
1675     int gnutls_srp_set_server_credentials_file (gnutls_srp_server_credentials_t res, const(char)* password_file, const(char)* password_conf_file);
1676     const(char)* gnutls_srp_server_get_username (gnutls_session_t session);
1677     void gnutls_srp_set_prime_bits (gnutls_session_t session, uint bits);
1678     int gnutls_srp_verifier (const(char)* username, const(char)* password, const(gnutls_datum_t)* salt, const(gnutls_datum_t)* generator, const(gnutls_datum_t)* prime, gnutls_datum_t* res);
1679     void gnutls_srp_set_server_credentials_function (gnutls_srp_server_credentials_t cred, int function () func);
1680     void gnutls_srp_set_client_credentials_function (gnutls_srp_client_credentials_t cred, int function () func);
1681     int gnutls_srp_base64_encode (const(gnutls_datum_t)* data, char* result, size_t* result_size);
1682     int gnutls_srp_base64_encode2 (const(gnutls_datum_t)* data, gnutls_datum_t* result);
1683     int gnutls_srp_base64_decode (const(gnutls_datum_t)* b64_data, char* result, size_t* result_size);
1684     int gnutls_srp_base64_decode2 (const(gnutls_datum_t)* b64_data, gnutls_datum_t* result);
1685     void gnutls_srp_set_server_fake_salt_seed (gnutls_srp_server_credentials_t sc, const(gnutls_datum_t)* seed, uint salt_length);
1686     void gnutls_psk_free_client_credentials (gnutls_psk_client_credentials_t sc);
1687     int gnutls_psk_allocate_client_credentials (gnutls_psk_client_credentials_t* sc);
1688     int gnutls_psk_set_client_credentials (gnutls_psk_client_credentials_t res, const(char)* username, const(gnutls_datum_t)* key, gnutls_psk_key_flags flags);
1689     void gnutls_psk_free_server_credentials (gnutls_psk_server_credentials_t sc);
1690     int gnutls_psk_allocate_server_credentials (gnutls_psk_server_credentials_t* sc);
1691     int gnutls_psk_set_server_credentials_file (gnutls_psk_server_credentials_t res, const(char)* password_file);
1692     int gnutls_psk_set_server_credentials_hint (gnutls_psk_server_credentials_t res, const(char)* hint);
1693     const(char)* gnutls_psk_server_get_username (gnutls_session_t session);
1694     const(char)* gnutls_psk_client_get_hint (gnutls_session_t session);
1695     void gnutls_psk_set_server_credentials_function (gnutls_psk_server_credentials_t cred, int function () func);
1696     void gnutls_psk_set_client_credentials_function (gnutls_psk_client_credentials_t cred, int function () func);
1697 
1698     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_13)
1699     {
1700         int gnutls_psk_set_client_credentials2 (gnutls_psk_client_credentials_t res, const(gnutls_datum_t)* username, const(gnutls_datum_t)* key, gnutls_psk_key_flags flags);
1701         int gnutls_psk_server_get_username2 (gnutls_session_t session, gnutls_datum_t* out_);
1702         void gnutls_psk_set_server_credentials_function2 (gnutls_psk_server_credentials_t cred, int function () func);
1703         void gnutls_psk_set_client_credentials_function2 (gnutls_psk_client_credentials_t cred, int function () func);
1704     }
1705 
1706     int gnutls_hex_encode (const(gnutls_datum_t)* data, char* result, size_t* result_size);
1707     int gnutls_hex_decode (const(gnutls_datum_t)* hex_data, void* result, size_t* result_size);
1708     int gnutls_hex_encode2 (const(gnutls_datum_t)* data, gnutls_datum_t* result);
1709     int gnutls_hex_decode2 (const(gnutls_datum_t)* data, gnutls_datum_t* result);
1710     void gnutls_psk_set_server_dh_params (gnutls_psk_server_credentials_t res, gnutls_dh_params_t dh_params);
1711 
1712     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_6)
1713         int gnutls_psk_set_server_known_dh_params (gnutls_psk_server_credentials_t res, gnutls_sec_param_t sec_param);
1714 
1715     void gnutls_psk_set_server_params_function (gnutls_psk_server_credentials_t res, int function () func);
1716     gnutls_credentials_type_t gnutls_auth_get_type (gnutls_session_t session);
1717     gnutls_credentials_type_t gnutls_auth_server_get_type (gnutls_session_t session);
1718     gnutls_credentials_type_t gnutls_auth_client_get_type (gnutls_session_t session);
1719     void gnutls_dh_set_prime_bits (gnutls_session_t session, uint bits);
1720     int gnutls_dh_get_secret_bits (gnutls_session_t session);
1721     int gnutls_dh_get_peers_public_bits (gnutls_session_t session);
1722     int gnutls_dh_get_prime_bits (gnutls_session_t session);
1723     int gnutls_dh_get_group (gnutls_session_t session, gnutls_datum_t* raw_gen, gnutls_datum_t* raw_prime);
1724     int gnutls_dh_get_pubkey (gnutls_session_t session, gnutls_datum_t* raw_key);
1725     void gnutls_certificate_set_retrieve_function (gnutls_certificate_credentials_t cred, int function () func);
1726     void gnutls_certificate_set_verify_function (gnutls_certificate_credentials_t cred, int function () func);
1727     void gnutls_certificate_server_set_request (gnutls_session_t session, gnutls_certificate_request_t req);
1728     const(gnutls_datum_t)* gnutls_certificate_get_peers (gnutls_session_t session, uint* list_size);
1729     const(gnutls_datum_t)* gnutls_certificate_get_ours (gnutls_session_t session);
1730     int gnutls_certificate_get_peers_subkey_id (gnutls_session_t session, gnutls_datum_t* id);
1731     time_t gnutls_certificate_activation_time_peers (gnutls_session_t session);
1732     time_t gnutls_certificate_expiration_time_peers (gnutls_session_t session);
1733     uint gnutls_certificate_client_get_request_status (gnutls_session_t session);
1734     int gnutls_certificate_verify_peers2 (gnutls_session_t session, uint* status);
1735     int gnutls_certificate_verify_peers3 (gnutls_session_t session, const(char)* hostname, uint* status);
1736     int gnutls_certificate_verify_peers (gnutls_session_t session, gnutls_typed_vdata_st* data, uint elements, uint* status);
1737     int gnutls_certificate_verification_status_print (uint status, gnutls_certificate_type_t type, gnutls_datum_t* out_, uint flags);
1738     int gnutls_pem_base64_encode (const(char)* msg, const(gnutls_datum_t)* data, char* result, size_t* result_size);
1739     int gnutls_pem_base64_decode (const(char)* header, const(gnutls_datum_t)* b64_data, ubyte* result, size_t* result_size);
1740     int gnutls_pem_base64_encode2 (const(char)* msg, const(gnutls_datum_t)* data, gnutls_datum_t* result);
1741     int gnutls_pem_base64_decode2 (const(char)* header, const(gnutls_datum_t)* b64_data, gnutls_datum_t* result);
1742 
1743     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_0)
1744     {
1745         int gnutls_base64_encode2 (const(gnutls_datum_t)* data, gnutls_datum_t* result);
1746         int gnutls_base64_decode2 (const(gnutls_datum_t)* b64_data, gnutls_datum_t* result);
1747     }
1748 
1749     void gnutls_certificate_set_params_function (gnutls_certificate_credentials_t res, int function () func);
1750     void gnutls_anon_set_params_function (gnutls_anon_server_credentials_t res, int function () func);
1751     void gnutls_psk_set_params_function (gnutls_psk_server_credentials_t res, int function () func);
1752     int gnutls_hex2bin (const(char)* hex_data, size_t hex_size, void* bin_data, size_t* bin_size);
1753     int gnutls_tdb_init (gnutls_tdb_t* tdb);
1754     void gnutls_tdb_set_store_func (gnutls_tdb_t tdb, gnutls_tdb_store_func store);
1755     void gnutls_tdb_set_store_commitment_func (gnutls_tdb_t tdb, gnutls_tdb_store_commitment_func cstore);
1756     void gnutls_tdb_set_verify_func (gnutls_tdb_t tdb, gnutls_tdb_verify_func verify);
1757     void gnutls_tdb_deinit (gnutls_tdb_t tdb);
1758     int gnutls_verify_stored_pubkey (const(char)* db_name, gnutls_tdb_t tdb, const(char)* host, const(char)* service, gnutls_certificate_type_t cert_type, const(gnutls_datum_t)* cert, uint flags);
1759     int gnutls_store_commitment (const(char)* db_name, gnutls_tdb_t tdb, const(char)* host, const(char)* service, gnutls_digest_algorithm_t hash_algo, const(gnutls_datum_t)* hash, time_t expiration, uint flags);
1760     int gnutls_store_pubkey (const(char)* db_name, gnutls_tdb_t tdb, const(char)* host, const(char)* service, gnutls_certificate_type_t cert_type, const(gnutls_datum_t)* cert, time_t expiration, uint flags);
1761     int gnutls_load_file (const(char)* filename, gnutls_datum_t* data);
1762     uint gnutls_url_is_supported (const(char)* url);
1763     void gnutls_certificate_set_pin_function (gnutls_certificate_credentials_t, gnutls_pin_callback_t fn, void* userdata);
1764     int gnutls_buffer_append_data (gnutls_buffer_t, const(void)* data, size_t data_size);
1765 
1766     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_7)
1767         int gnutls_utf8_password_normalize (const(ubyte)* password, uint password_len, gnutls_datum_t* out_, uint flags);
1768 
1769     void gnutls_ext_set_data (gnutls_session_t session, uint type, gnutls_ext_priv_data_t);
1770     int gnutls_ext_get_data (gnutls_session_t session, uint type, gnutls_ext_priv_data_t*);
1771 
1772     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
1773     {
1774         uint gnutls_ext_get_current_msg (gnutls_session_t session);
1775         int gnutls_ext_raw_parse (void* ctx, gnutls_ext_raw_process_func cb, const(gnutls_datum_t)* data, uint flags);
1776     }
1777 
1778     int gnutls_ext_register (const(char)* name, int type, gnutls_ext_parse_type_t parse_point, gnutls_ext_recv_func recv_func, gnutls_ext_send_func send_func, gnutls_ext_deinit_data_func deinit_func, gnutls_ext_pack_func pack_func, gnutls_ext_unpack_func unpack_func);
1779 
1780     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_5)
1781         int gnutls_session_ext_register (gnutls_session_t, const(char)* name, int type, gnutls_ext_parse_type_t parse_point, gnutls_ext_recv_func recv_func, gnutls_ext_send_func send_func, gnutls_ext_deinit_data_func deinit_func, gnutls_ext_pack_func pack_func, gnutls_ext_unpack_func unpack_func, uint flags);
1782 
1783     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_1)
1784         const(char)* gnutls_ext_get_name (uint ext);
1785 
1786     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_14)
1787         const(char)* gnutls_ext_get_name2 (gnutls_session_t session, uint tls_id, gnutls_ext_parse_type_t parse_point);
1788 
1789     int gnutls_supplemental_register (const(char)* name, gnutls_supplemental_data_format_type_t type, gnutls_supp_recv_func supp_recv_func, gnutls_supp_send_func supp_send_func);
1790 
1791     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_5)
1792         int gnutls_session_supplemental_register (gnutls_session_t session, const(char)* name, gnutls_supplemental_data_format_type_t type, gnutls_supp_recv_func supp_recv_func, gnutls_supp_send_func supp_send_func, uint flags);
1793 
1794     void gnutls_supplemental_recv (gnutls_session_t session, uint do_recv_supplemental);
1795     void gnutls_supplemental_send (gnutls_session_t session, uint do_send_supplemental);
1796 
1797     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_5)
1798     {
1799         int gnutls_anti_replay_init (gnutls_anti_replay_t* anti_replay);
1800         void gnutls_anti_replay_deinit (gnutls_anti_replay_t anti_replay);
1801         void gnutls_anti_replay_set_window (gnutls_anti_replay_t anti_replay, uint window);
1802         void gnutls_anti_replay_enable (gnutls_session_t session, gnutls_anti_replay_t anti_replay);
1803         void gnutls_anti_replay_set_add_function (gnutls_anti_replay_t, gnutls_db_add_func add_func);
1804     }
1805 
1806     void gnutls_anti_replay_set_ptr (gnutls_anti_replay_t, void* ptr);
1807     uint gnutls_fips140_mode_enabled ();
1808 
1809     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
1810         void gnutls_fips140_set_mode (gnutls_fips_mode_t mode, uint flags);
1811 }
1812 else
1813 {
1814     // external global symbols
1815     mixin externField!(gnutls_alloc_function,  "gnutls_malloc");
1816     mixin externField!(gnutls_realloc_function,  "gnutls_realloc");
1817     mixin externField!(gnutls_calloc_function,  "gnutls_calloc");
1818     mixin externField!(gnutls_free_function,  "gnutls_free");
1819     mixin externField!(char* function (const(char)*), "gnutls_strdup");
1820 
1821     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_2)
1822     {
1823         mixin externField!(const gnutls_datum_t, "gnutls_srp_8192_group_prime");
1824         mixin externField!(const gnutls_datum_t, "gnutls_srp_8192_group_generator");
1825     }
1826 
1827     mixin externField!(const gnutls_datum_t, "gnutls_srp_4096_group_prime");
1828     mixin externField!(const gnutls_datum_t, "gnutls_srp_4096_group_generator");
1829     mixin externField!(const gnutls_datum_t, "gnutls_srp_3072_group_prime");
1830     mixin externField!(const gnutls_datum_t, "gnutls_srp_3072_group_generator");
1831     mixin externField!(const gnutls_datum_t, "gnutls_srp_2048_group_prime");
1832     mixin externField!(const gnutls_datum_t, "gnutls_srp_2048_group_generator");
1833     mixin externField!(const gnutls_datum_t, "gnutls_srp_1536_group_prime");
1834     mixin externField!(const gnutls_datum_t, "gnutls_srp_1536_group_generator");
1835     mixin externField!(const gnutls_datum_t, "gnutls_srp_1024_group_prime");
1836     mixin externField!(const gnutls_datum_t, "gnutls_srp_1024_group_generator");
1837     mixin externField!(const gnutls_datum_t, "gnutls_ffdhe_8192_group_prime");
1838     mixin externField!(const gnutls_datum_t, "gnutls_ffdhe_8192_group_generator");
1839     mixin externField!(const uint, "gnutls_ffdhe_8192_key_bits");
1840 
1841     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_4)
1842     {
1843         mixin externField!(const gnutls_datum_t, "gnutls_ffdhe_6144_group_prime");
1844         mixin externField!(const gnutls_datum_t, "gnutls_ffdhe_6144_group_generator");
1845         mixin externField!(const uint, "gnutls_ffdhe_6144_key_bits");
1846     }
1847 
1848     mixin externField!(const gnutls_datum_t, "gnutls_ffdhe_4096_group_prime");
1849     mixin externField!(const gnutls_datum_t, "gnutls_ffdhe_4096_group_generator");
1850     mixin externField!(const uint, "gnutls_ffdhe_4096_key_bits");
1851     mixin externField!(const gnutls_datum_t, "gnutls_ffdhe_3072_group_prime");
1852     mixin externField!(const gnutls_datum_t, "gnutls_ffdhe_3072_group_generator");
1853     mixin externField!(const uint, "gnutls_ffdhe_3072_key_bits");
1854     mixin externField!(const gnutls_datum_t, "gnutls_ffdhe_2048_group_prime");
1855 
1856     static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_8)
1857     {
1858         mixin externField!(const gnutls_datum_t, "gnutls_ffdhe_2048_group_q");
1859         mixin externField!(const gnutls_datum_t, "gnutls_ffdhe_3072_group_q");
1860         mixin externField!(const gnutls_datum_t, "gnutls_ffdhe_4096_group_q");
1861         mixin externField!(const gnutls_datum_t, "gnutls_ffdhe_6144_group_q");
1862         mixin externField!(const gnutls_datum_t, "gnutls_ffdhe_8192_group_q");
1863     }
1864 
1865     mixin externField!(const gnutls_datum_t, "gnutls_ffdhe_2048_group_generator");
1866     mixin externField!(const uint, "gnutls_ffdhe_2048_key_bits");
1867 
1868     // functions
1869     extern (System) @nogc nothrow @system
1870     {
1871         alias pgnutls_pk_algorithm_get_name = const(char)* function (gnutls_pk_algorithm_t algorithm);
1872         alias pgnutls_init = int function (gnutls_session_t* session, uint flags);
1873         alias pgnutls_deinit = void function (gnutls_session_t session);
1874         alias pgnutls_bye = int function (gnutls_session_t session, gnutls_close_request_t how);
1875         alias pgnutls_handshake = int function (gnutls_session_t session);
1876 
1877         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
1878             alias pgnutls_reauth = int function (gnutls_session_t session, uint flags);
1879 
1880         alias pgnutls_handshake_set_timeout = void function (gnutls_session_t session, uint ms);
1881         alias pgnutls_rehandshake = int function (gnutls_session_t session);
1882 
1883         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
1884             alias pgnutls_session_key_update = int function (gnutls_session_t session, uint flags);
1885 
1886         alias pgnutls_alert_get = gnutls_alert_description_t function (gnutls_session_t session);
1887         alias pgnutls_alert_send = int function (gnutls_session_t session, gnutls_alert_level_t level, gnutls_alert_description_t desc);
1888         alias pgnutls_alert_send_appropriate = int function (gnutls_session_t session, int err);
1889         alias pgnutls_alert_get_name = const(char)* function (gnutls_alert_description_t alert);
1890         alias pgnutls_alert_get_strname = const(char)* function (gnutls_alert_description_t alert);
1891         alias pgnutls_pk_bits_to_sec_param = gnutls_sec_param_t function (gnutls_pk_algorithm_t algo, uint bits);
1892         alias pgnutls_sec_param_get_name = const(char)* function (gnutls_sec_param_t param);
1893         alias pgnutls_sec_param_to_pk_bits = uint function (gnutls_pk_algorithm_t algo, gnutls_sec_param_t param);
1894         alias pgnutls_sec_param_to_symmetric_bits = uint function (gnutls_sec_param_t param);
1895         alias pgnutls_ecc_curve_get_name = const(char)* function (gnutls_ecc_curve_t curve);
1896         alias pgnutls_ecc_curve_get_oid = const(char)* function (gnutls_ecc_curve_t curve);
1897         alias pgnutls_group_get_name = const(char)* function (gnutls_group_t group);
1898         alias pgnutls_ecc_curve_get_size = int function (gnutls_ecc_curve_t curve);
1899         alias pgnutls_ecc_curve_get = gnutls_ecc_curve_t function (gnutls_session_t session);
1900         alias pgnutls_group_get = gnutls_group_t function (gnutls_session_t session);
1901         alias pgnutls_cipher_get = gnutls_cipher_algorithm_t function (gnutls_session_t session);
1902         alias pgnutls_kx_get = gnutls_kx_algorithm_t function (gnutls_session_t session);
1903         alias pgnutls_mac_get = gnutls_mac_algorithm_t function (gnutls_session_t session);
1904 
1905         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_13)
1906             alias pgnutls_prf_hash_get = gnutls_digest_algorithm_t function (const gnutls_session_t session);
1907 
1908         alias pgnutls_certificate_type_get = gnutls_certificate_type_t function (gnutls_session_t session);
1909 
1910         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_4)
1911             alias pgnutls_certificate_type_get2 = gnutls_certificate_type_t function (gnutls_session_t session, gnutls_ctype_target_t target);
1912 
1913         alias pgnutls_sign_algorithm_get = int function (gnutls_session_t session);
1914         alias pgnutls_sign_algorithm_get_client = int function (gnutls_session_t session);
1915         alias pgnutls_sign_algorithm_get_requested = int function (gnutls_session_t session, size_t indx, gnutls_sign_algorithm_t* algo);
1916         alias pgnutls_cipher_get_name = const(char)* function (gnutls_cipher_algorithm_t algorithm);
1917         alias pgnutls_mac_get_name = const(char)* function (gnutls_mac_algorithm_t algorithm);
1918         alias pgnutls_digest_get_name = const(char)* function (gnutls_digest_algorithm_t algorithm);
1919         alias pgnutls_digest_get_oid = const(char)* function (gnutls_digest_algorithm_t algorithm);
1920         alias pgnutls_kx_get_name = const(char)* function (gnutls_kx_algorithm_t algorithm);
1921         alias pgnutls_certificate_type_get_name = const(char)* function (gnutls_certificate_type_t type);
1922         alias pgnutls_pk_get_name = const(char)* function (gnutls_pk_algorithm_t algorithm);
1923         alias pgnutls_pk_get_oid = const(char)* function (gnutls_pk_algorithm_t algorithm);
1924         alias pgnutls_sign_get_name = const(char)* function (gnutls_sign_algorithm_t algorithm);
1925         alias pgnutls_sign_get_oid = const(char)* function (gnutls_sign_algorithm_t sign);
1926 
1927         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
1928         {
1929             alias pgnutls_gost_paramset_get_name = const(char)* function (gnutls_gost_paramset_t param);
1930             alias pgnutls_gost_paramset_get_oid = const(char)* function (gnutls_gost_paramset_t param);
1931         }
1932 
1933         alias pgnutls_cipher_get_key_size = size_t function (gnutls_cipher_algorithm_t algorithm);
1934         alias pgnutls_mac_get_key_size = size_t function (gnutls_mac_algorithm_t algorithm);
1935         alias pgnutls_sign_is_secure = uint function (gnutls_sign_algorithm_t algorithm);
1936         alias pgnutls_sign_is_secure2 = uint function (gnutls_sign_algorithm_t algorithm, uint flags);
1937         alias pgnutls_sign_get_hash_algorithm = gnutls_digest_algorithm_t function (gnutls_sign_algorithm_t sign);
1938         alias pgnutls_sign_get_pk_algorithm = gnutls_pk_algorithm_t function (gnutls_sign_algorithm_t sign);
1939         alias pgnutls_pk_to_sign = gnutls_sign_algorithm_t function (gnutls_pk_algorithm_t pk, gnutls_digest_algorithm_t hash);
1940         alias pgnutls_sign_supports_pk_algorithm = uint function (gnutls_sign_algorithm_t sign, gnutls_pk_algorithm_t pk);
1941         alias pgnutls_mac_get_id = gnutls_mac_algorithm_t function (const(char)* name);
1942         alias pgnutls_digest_get_id = gnutls_digest_algorithm_t function (const(char)* name);
1943         alias pgnutls_cipher_get_id = gnutls_cipher_algorithm_t function (const(char)* name);
1944         alias pgnutls_kx_get_id = gnutls_kx_algorithm_t function (const(char)* name);
1945         alias pgnutls_protocol_get_id = gnutls_protocol_t function (const(char)* name);
1946         alias pgnutls_certificate_type_get_id = gnutls_certificate_type_t function (const(char)* name);
1947         alias pgnutls_pk_get_id = gnutls_pk_algorithm_t function (const(char)* name);
1948         alias pgnutls_sign_get_id = gnutls_sign_algorithm_t function (const(char)* name);
1949         alias pgnutls_ecc_curve_get_id = gnutls_ecc_curve_t function (const(char)* name);
1950         alias pgnutls_ecc_curve_get_pk = gnutls_pk_algorithm_t function (gnutls_ecc_curve_t curve);
1951         alias pgnutls_group_get_id = gnutls_group_t function (const(char)* name);
1952         alias pgnutls_oid_to_digest = gnutls_digest_algorithm_t function (const(char)* oid);
1953 
1954         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_4)
1955             alias pgnutls_oid_to_mac = gnutls_mac_algorithm_t function (const(char)* oid);
1956 
1957         alias pgnutls_oid_to_pk = gnutls_pk_algorithm_t function (const(char)* oid);
1958         alias pgnutls_oid_to_sign = gnutls_sign_algorithm_t function (const(char)* oid);
1959         alias pgnutls_oid_to_ecc_curve = gnutls_ecc_curve_t function (const(char)* oid);
1960 
1961         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
1962             alias pgnutls_oid_to_gost_paramset = gnutls_gost_paramset_t function (const(char)* oid);
1963 
1964         alias pgnutls_ecc_curve_list = const(gnutls_ecc_curve_t)* function ();
1965         alias pgnutls_group_list = const(gnutls_group_t)* function ();
1966         alias pgnutls_cipher_list = const(gnutls_cipher_algorithm_t)* function ();
1967         alias pgnutls_mac_list = const(gnutls_mac_algorithm_t)* function ();
1968         alias pgnutls_digest_list = const(gnutls_digest_algorithm_t)* function ();
1969         alias pgnutls_protocol_list = const(gnutls_protocol_t)* function ();
1970         alias pgnutls_certificate_type_list = const(gnutls_certificate_type_t)* function ();
1971         alias pgnutls_kx_list = const(gnutls_kx_algorithm_t)* function ();
1972         alias pgnutls_pk_list = const(gnutls_pk_algorithm_t)* function ();
1973         alias pgnutls_sign_list = const(gnutls_sign_algorithm_t)* function ();
1974         alias pgnutls_cipher_suite_info = const(char)* function (size_t idx, ubyte* cs_id, gnutls_kx_algorithm_t* kx, gnutls_cipher_algorithm_t* cipher, gnutls_mac_algorithm_t* mac, gnutls_protocol_t* min_version);
1975         alias pgnutls_error_is_fatal = int function (int error);
1976         alias pgnutls_error_to_alert = int function (int err, int* level);
1977         alias pgnutls_perror = void function (int error);
1978         alias pgnutls_strerror = const(char)* function (int error);
1979         alias pgnutls_strerror_name = const(char)* function (int error);
1980         alias pgnutls_handshake_set_private_extensions = void function (gnutls_session_t session, int allow);
1981         alias pgnutls_handshake_set_random = int function (gnutls_session_t session, const(gnutls_datum_t)* random);
1982         alias pgnutls_handshake_get_last_out = gnutls_handshake_description_t function (gnutls_session_t session);
1983         alias pgnutls_handshake_get_last_in = gnutls_handshake_description_t function (gnutls_session_t session);
1984         alias pgnutls_heartbeat_ping = int function (gnutls_session_t session, size_t data_size, uint max_tries, uint flags);
1985         alias pgnutls_heartbeat_pong = int function (gnutls_session_t session, uint flags);
1986         alias pgnutls_record_set_timeout = void function (gnutls_session_t session, uint ms);
1987         alias pgnutls_record_disable_padding = void function (gnutls_session_t session);
1988         alias pgnutls_record_cork = void function (gnutls_session_t session);
1989         alias pgnutls_record_uncork = int function (gnutls_session_t session, uint flags);
1990         alias pgnutls_record_discard_queued = size_t function (gnutls_session_t session);
1991         alias pgnutls_record_get_state = int function (gnutls_session_t session, uint read, gnutls_datum_t* mac_key, gnutls_datum_t* IV, gnutls_datum_t* cipher_key, ref ubyte[8] seq_number);
1992         alias pgnutls_record_set_state = int function (gnutls_session_t session, uint read, ref const(ubyte)[8] seq_number);
1993         alias pgnutls_range_split = int function (gnutls_session_t session, const(gnutls_range_st)* orig, gnutls_range_st* small_range, gnutls_range_st* rem_range);
1994         alias pgnutls_record_send = ssize_t function (gnutls_session_t session, const(void)* data, size_t data_size);
1995 
1996         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
1997             alias pgnutls_record_send2 = ssize_t function (gnutls_session_t session, const(void)* data, size_t data_size, size_t pad, uint flags);
1998 
1999         alias pgnutls_record_send_range = ssize_t function (gnutls_session_t session, const(void)* data, size_t data_size, const(gnutls_range_st)* range);
2000         alias pgnutls_record_recv = ssize_t function (gnutls_session_t session, void* data, size_t data_size);
2001         alias pgnutls_record_recv_packet = ssize_t function (gnutls_session_t session, gnutls_packet_t* packet);
2002         alias pgnutls_packet_get = void function (gnutls_packet_t packet, gnutls_datum_t* data, ubyte* sequence);
2003         alias pgnutls_packet_deinit = void function (gnutls_packet_t packet);
2004         alias pgnutls_record_recv_seq = ssize_t function (gnutls_session_t session, void* data, size_t data_size, ubyte* seq);
2005         alias pgnutls_record_overhead_size = size_t function (gnutls_session_t session);
2006         alias pgnutls_est_record_overhead_size = size_t function (gnutls_protocol_t version_, gnutls_cipher_algorithm_t cipher, gnutls_mac_algorithm_t mac, gnutls_compression_method_t comp, uint flags);
2007         alias pgnutls_session_enable_compatibility_mode = void function (gnutls_session_t session);
2008         alias pgnutls_record_can_use_length_hiding = uint function (gnutls_session_t session);
2009         alias pgnutls_record_get_direction = int function (gnutls_session_t session);
2010         alias pgnutls_record_get_max_size = size_t function (gnutls_session_t session);
2011         alias pgnutls_record_set_max_size = ssize_t function (gnutls_session_t session, size_t size);
2012 
2013         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_8)
2014             alias pgnutls_record_set_max_recv_size = ssize_t function (gnutls_session_t session, size_t size);
2015 
2016         alias pgnutls_record_check_pending = size_t function (gnutls_session_t session);
2017         alias pgnutls_record_check_corked = size_t function (gnutls_session_t session);
2018 
2019 
2020         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_4)
2021             alias pgnutls_record_set_max_early_data_size = int function (gnutls_session_t session, size_t size);
2022 
2023         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_5)
2024         {
2025             alias pgnutls_record_get_max_early_data_size = size_t function (gnutls_session_t session);
2026             alias pgnutls_record_send_early_data = ssize_t function (gnutls_session_t session, const(void)* data, size_t length);
2027             alias pgnutls_record_recv_early_data = ssize_t function (gnutls_session_t session, void* data, size_t data_size);
2028         }
2029 
2030         alias pgnutls_session_force_valid = void function (gnutls_session_t session);
2031         alias pgnutls_prf = int function (gnutls_session_t session, size_t label_size, const(char)* label, int server_random_first, size_t extra_size, const(char)* extra, size_t outsize, char* out_);
2032         alias pgnutls_prf_rfc5705 = int function (gnutls_session_t session, size_t label_size, const(char)* label, size_t context_size, const(char)* context, size_t outsize, char* out_);
2033 
2034         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_8)
2035             alias pgnutls_prf_early = int function (gnutls_session_t session, size_t label_size, const(char)* label, size_t context_size, const(char)* context, size_t outsize, char* out_);
2036 
2037         alias pgnutls_prf_raw = int function (gnutls_session_t session, size_t label_size, const(char)* label, size_t seed_size, const(char)* seed, size_t outsize, char* out_);
2038         alias pgnutls_server_name_set = int function (gnutls_session_t session, gnutls_server_name_type_t type, const(void)* name, size_t name_length);
2039         alias pgnutls_server_name_get = int function (gnutls_session_t session, void* data, size_t* data_length, uint* type, uint indx);
2040         alias pgnutls_heartbeat_get_timeout = uint function (gnutls_session_t session);
2041         alias pgnutls_heartbeat_set_timeouts = void function (gnutls_session_t session, uint retrans_timeout, uint total_timeout);
2042         alias pgnutls_heartbeat_enable = void function (gnutls_session_t session, uint type);
2043         alias pgnutls_heartbeat_allowed = uint function (gnutls_session_t session, uint type);
2044         alias pgnutls_safe_renegotiation_status = uint function (gnutls_session_t session);
2045         alias pgnutls_session_ext_master_secret_status = uint function (gnutls_session_t session);
2046         alias pgnutls_session_etm_status = uint function (gnutls_session_t session);
2047         alias pgnutls_session_get_flags = uint function (gnutls_session_t session);
2048         alias pgnutls_supplemental_get_name = const(char)* function (gnutls_supplemental_data_format_type_t type);
2049         alias pgnutls_session_ticket_key_generate = int function (gnutls_datum_t* key);
2050         alias pgnutls_session_ticket_enable_client = int function (gnutls_session_t session);
2051         alias pgnutls_session_ticket_enable_server = int function (gnutls_session_t session, const(gnutls_datum_t)* key);
2052 
2053         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
2054             alias pgnutls_session_ticket_send = int function (gnutls_session_t session, uint nr, uint flags);
2055 
2056         alias pgnutls_srtp_set_profile = int function (gnutls_session_t session, gnutls_srtp_profile_t profile);
2057         alias pgnutls_srtp_set_profile_direct = int function (gnutls_session_t session, const(char)* profiles, const(char*)* err_pos);
2058         alias pgnutls_srtp_get_selected_profile = int function (gnutls_session_t session, gnutls_srtp_profile_t* profile);
2059         alias pgnutls_srtp_get_profile_name = const(char)* function (gnutls_srtp_profile_t profile);
2060         alias pgnutls_srtp_get_profile_id = int function (const(char)* name, gnutls_srtp_profile_t* profile);
2061         alias pgnutls_srtp_get_keys = int function (gnutls_session_t session, void* key_material, uint key_material_size, gnutls_datum_t* client_key, gnutls_datum_t* client_salt, gnutls_datum_t* server_key, gnutls_datum_t* server_salt);
2062         alias pgnutls_srtp_set_mki = int function (gnutls_session_t session, const(gnutls_datum_t)* mki);
2063         alias pgnutls_srtp_get_mki = int function (gnutls_session_t session, gnutls_datum_t* mki);
2064         alias pgnutls_alpn_get_selected_protocol = int function (gnutls_session_t session, gnutls_datum_t* protocol);
2065         alias pgnutls_alpn_set_protocols = int function (gnutls_session_t session, const(gnutls_datum_t)* protocols, uint protocols_size, uint flags);
2066         alias pgnutls_key_generate = int function (gnutls_datum_t* key, uint key_size);
2067         alias pgnutls_priority_init = int function (gnutls_priority_t* priority_cache, const(char)* priorities, const(char*)* err_pos);
2068 
2069         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
2070             alias pgnutls_priority_init2 = int function (gnutls_priority_t* priority_cache, const(char)* priorities, const(char*)* err_pos, uint flags);
2071 
2072         alias pgnutls_priority_deinit = void function (gnutls_priority_t priority_cache);
2073         alias pgnutls_priority_get_cipher_suite_index = int function (gnutls_priority_t pcache, uint idx, uint* sidx);
2074         alias pgnutls_priority_string_list = const(char)* function (uint iter, uint flags);
2075         alias pgnutls_priority_set = int function (gnutls_session_t session, gnutls_priority_t priority);
2076         alias pgnutls_priority_set_direct = int function (gnutls_session_t session, const(char)* priorities, const(char*)* err_pos);
2077         alias pgnutls_priority_certificate_type_list = int function (gnutls_priority_t pcache, const(uint*)* list);
2078 
2079         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_4)
2080             alias pgnutls_priority_certificate_type_list2 = int function (gnutls_priority_t pcache, const(uint*)* list, gnutls_ctype_target_t target);
2081 
2082         alias pgnutls_priority_sign_list = int function (gnutls_priority_t pcache, const(uint*)* list);
2083         alias pgnutls_priority_protocol_list = int function (gnutls_priority_t pcache, const(uint*)* list);
2084         alias pgnutls_priority_ecc_curve_list = int function (gnutls_priority_t pcache, const(uint*)* list);
2085         alias pgnutls_priority_group_list = int function (gnutls_priority_t pcache, const(uint*)* list);
2086         alias pgnutls_priority_kx_list = int function (gnutls_priority_t pcache, const(uint*)* list);
2087         alias pgnutls_priority_cipher_list = int function (gnutls_priority_t pcache, const(uint*)* list);
2088         alias pgnutls_priority_mac_list = int function (gnutls_priority_t pcache, const(uint*)* list);
2089 
2090         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_9)
2091             alias pgnutls_get_system_config_file = const(char)* function ();
2092 
2093         alias pgnutls_set_default_priority = int function (gnutls_session_t session);
2094 
2095         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
2096             alias pgnutls_set_default_priority_append = int function (gnutls_session_t session, const(char)* add_prio, const(char*)* err_pos, uint flags);
2097 
2098         alias pgnutls_cipher_suite_get_name = const(char)* function (gnutls_kx_algorithm_t kx_algorithm, gnutls_cipher_algorithm_t cipher_algorithm, gnutls_mac_algorithm_t mac_algorithm);
2099         alias pgnutls_protocol_get_version = gnutls_protocol_t function (gnutls_session_t session);
2100         alias pgnutls_protocol_get_name = const(char)* function (gnutls_protocol_t version_);
2101         alias pgnutls_session_set_data = int function (gnutls_session_t session, const(void)* session_data, size_t session_data_size);
2102         alias pgnutls_session_get_data = int function (gnutls_session_t session, void* session_data, size_t* session_data_size);
2103         alias pgnutls_session_get_data2 = int function (gnutls_session_t session, gnutls_datum_t* data);
2104         alias pgnutls_session_get_random = void function (gnutls_session_t session, gnutls_datum_t* client, gnutls_datum_t* server);
2105         alias pgnutls_session_get_master_secret = void function (gnutls_session_t session, gnutls_datum_t* secret);
2106         alias pgnutls_session_get_desc = char* function (gnutls_session_t session);
2107         alias pgnutls_session_set_verify_function = void function (gnutls_session_t session, int function () func);
2108         alias pgnutls_session_set_verify_cert = void function (gnutls_session_t session, const(char)* hostname, uint flags);
2109         alias pgnutls_session_set_verify_cert2 = void function (gnutls_session_t session, gnutls_typed_vdata_st* data, uint elements, uint flags);
2110         alias pgnutls_session_get_verify_cert_status = uint function (gnutls_session_t);
2111         alias pgnutls_session_set_premaster = int function (gnutls_session_t session, uint entity, gnutls_protocol_t version_, gnutls_kx_algorithm_t kx, gnutls_cipher_algorithm_t cipher, gnutls_mac_algorithm_t mac, gnutls_compression_method_t comp, const(gnutls_datum_t)* master, const(gnutls_datum_t)* session_id);
2112         alias pgnutls_session_get_id = int function (gnutls_session_t session, void* session_id, size_t* session_id_size);
2113         alias pgnutls_session_get_id2 = int function (gnutls_session_t session, gnutls_datum_t* session_id);
2114         alias pgnutls_session_set_id = int function (gnutls_session_t session, const(gnutls_datum_t)* sid);
2115         alias pgnutls_session_channel_binding = int function (gnutls_session_t session, gnutls_channel_binding_t cbtype, gnutls_datum_t* cb);
2116         alias pgnutls_session_is_resumed = int function (gnutls_session_t session);
2117         alias pgnutls_session_resumption_requested = int function (gnutls_session_t session);
2118         alias pgnutls_db_set_cache_expiration = void function (gnutls_session_t session, int seconds);
2119         alias pgnutls_db_get_default_cache_expiration = uint function ();
2120         alias pgnutls_db_remove_session = void function (gnutls_session_t session);
2121         alias pgnutls_db_set_retrieve_function = void function (gnutls_session_t session, gnutls_db_retr_func retr_func);
2122         alias pgnutls_db_set_remove_function = void function (gnutls_session_t session, gnutls_db_remove_func rem_func);
2123         alias pgnutls_db_set_store_function = void function (gnutls_session_t session, gnutls_db_store_func store_func);
2124         alias pgnutls_db_set_ptr = void function (gnutls_session_t session, void* ptr);
2125         alias pgnutls_db_get_ptr = void* function (gnutls_session_t session);
2126         alias pgnutls_db_check_entry = int function (gnutls_session_t session, gnutls_datum_t session_entry);
2127         alias pgnutls_db_check_entry_time = time_t function (gnutls_datum_t* entry);
2128 
2129         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_5)
2130             alias pgnutls_db_check_entry_expire_time = time_t function (gnutls_datum_t* entry);
2131 
2132         alias pgnutls_handshake_set_hook_function = void function (gnutls_session_t session, uint htype, int when, gnutls_handshake_hook_func func);
2133         alias pgnutls_handshake_set_post_client_hello_function = void function (gnutls_session_t session, gnutls_handshake_simple_hook_func func);
2134         alias pgnutls_handshake_set_max_packet_length = void function (gnutls_session_t session, size_t max);
2135         alias pgnutls_check_version = const(char)* function (const(char)* req_version);
2136         alias pgnutls_credentials_clear = void function (gnutls_session_t session);
2137         alias pgnutls_credentials_set = int function (gnutls_session_t session, gnutls_credentials_type_t type, void* cred);
2138         alias pgnutls_credentials_get = int function (gnutls_session_t session, gnutls_credentials_type_t type, void** cred);
2139         alias pgnutls_anon_free_server_credentials = void function (gnutls_anon_server_credentials_t sc);
2140         alias pgnutls_anon_allocate_server_credentials = int function (gnutls_anon_server_credentials_t* sc);
2141         alias pgnutls_anon_set_server_dh_params = void function (gnutls_anon_server_credentials_t res, gnutls_dh_params_t dh_params);
2142 
2143         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_6)
2144             alias pgnutls_anon_set_server_known_dh_params = int function (gnutls_anon_server_credentials_t res, gnutls_sec_param_t sec_param);
2145 
2146         alias pgnutls_anon_set_server_params_function = void function (gnutls_anon_server_credentials_t res, int function () func);
2147         alias pgnutls_anon_free_client_credentials = void function (gnutls_anon_client_credentials_t sc);
2148         alias pgnutls_anon_allocate_client_credentials = int function (gnutls_anon_client_credentials_t* sc);
2149         alias pgnutls_certificate_free_credentials = void function (gnutls_certificate_credentials_t sc);
2150         alias pgnutls_certificate_allocate_credentials = int function (gnutls_certificate_credentials_t* res);
2151         alias pgnutls_certificate_get_issuer = int function (gnutls_certificate_credentials_t sc, gnutls_x509_crt_t cert, gnutls_x509_crt_t* issuer, uint flags);
2152         alias pgnutls_certificate_get_crt_raw = int function (gnutls_certificate_credentials_t sc, uint idx1, uint idx2, gnutls_datum_t* cert);
2153         alias pgnutls_certificate_free_keys = void function (gnutls_certificate_credentials_t sc);
2154         alias pgnutls_certificate_free_cas = void function (gnutls_certificate_credentials_t sc);
2155         alias pgnutls_certificate_free_ca_names = void function (gnutls_certificate_credentials_t sc);
2156         alias pgnutls_certificate_free_crls = void function (gnutls_certificate_credentials_t sc);
2157         alias pgnutls_certificate_set_dh_params = void function (gnutls_certificate_credentials_t res, gnutls_dh_params_t dh_params);
2158 
2159         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_6)
2160             alias pgnutls_certificate_set_known_dh_params = int function (gnutls_certificate_credentials_t res, gnutls_sec_param_t sec_param);
2161 
2162         alias pgnutls_certificate_set_verify_flags = void function (gnutls_certificate_credentials_t res, uint flags);
2163         alias pgnutls_certificate_get_verify_flags = uint function (gnutls_certificate_credentials_t res);
2164         alias pgnutls_certificate_set_flags = void function (gnutls_certificate_credentials_t, uint flags);
2165         alias pgnutls_certificate_set_verify_limits = void function (gnutls_certificate_credentials_t res, uint max_bits, uint max_depth);
2166         alias pgnutls_certificate_set_x509_system_trust = int function (gnutls_certificate_credentials_t cred);
2167         alias pgnutls_certificate_set_x509_trust_file = int function (gnutls_certificate_credentials_t cred, const(char)* cafile, gnutls_x509_crt_fmt_t type);
2168         alias pgnutls_certificate_set_x509_trust_dir = int function (gnutls_certificate_credentials_t cred, const(char)* ca_dir, gnutls_x509_crt_fmt_t type);
2169         alias pgnutls_certificate_set_x509_trust_mem = int function (gnutls_certificate_credentials_t res, const(gnutls_datum_t)* ca, gnutls_x509_crt_fmt_t type);
2170         alias pgnutls_certificate_set_x509_crl_file = int function (gnutls_certificate_credentials_t res, const(char)* crlfile, gnutls_x509_crt_fmt_t type);
2171         alias pgnutls_certificate_set_x509_crl_mem = int function (gnutls_certificate_credentials_t res, const(gnutls_datum_t)* CRL, gnutls_x509_crt_fmt_t type);
2172         alias pgnutls_certificate_set_x509_key_file = int function (gnutls_certificate_credentials_t res, const(char)* certfile, const(char)* keyfile, gnutls_x509_crt_fmt_t type);
2173         alias pgnutls_certificate_set_x509_key_file2 = int function (gnutls_certificate_credentials_t res, const(char)* certfile, const(char)* keyfile, gnutls_x509_crt_fmt_t type, const(char)* pass, uint flags);
2174         alias pgnutls_certificate_set_x509_key_mem = int function (gnutls_certificate_credentials_t res, const(gnutls_datum_t)* cert, const(gnutls_datum_t)* key, gnutls_x509_crt_fmt_t type);
2175         alias pgnutls_certificate_set_x509_key_mem2 = int function (gnutls_certificate_credentials_t res, const(gnutls_datum_t)* cert, const(gnutls_datum_t)* key, gnutls_x509_crt_fmt_t type, const(char)* pass, uint flags);
2176         alias pgnutls_certificate_send_x509_rdn_sequence = void function (gnutls_session_t session, int status);
2177         alias pgnutls_certificate_set_x509_simple_pkcs12_file = int function (gnutls_certificate_credentials_t res, const(char)* pkcs12file, gnutls_x509_crt_fmt_t type, const(char)* password);
2178         alias pgnutls_certificate_set_x509_simple_pkcs12_mem = int function (gnutls_certificate_credentials_t res, const(gnutls_datum_t)* p12blob, gnutls_x509_crt_fmt_t type, const(char)* password);
2179         alias pgnutls_certificate_set_x509_key = int function (gnutls_certificate_credentials_t res, gnutls_x509_crt_t* cert_list, int cert_list_size, gnutls_x509_privkey_t key);
2180         alias pgnutls_certificate_set_x509_trust = int function (gnutls_certificate_credentials_t res, gnutls_x509_crt_t* ca_list, int ca_list_size);
2181         alias pgnutls_certificate_set_x509_crl = int function (gnutls_certificate_credentials_t res, gnutls_x509_crl_t* crl_list, int crl_list_size);
2182         alias pgnutls_certificate_get_x509_key = int function (gnutls_certificate_credentials_t res, uint index, gnutls_x509_privkey_t* key);
2183         alias pgnutls_certificate_get_x509_crt = int function (gnutls_certificate_credentials_t res, uint index, gnutls_x509_crt_t** crt_list, uint* crt_list_size);
2184         alias pgnutls_certificate_set_ocsp_status_request_function = void function (gnutls_certificate_credentials_t res, gnutls_status_request_ocsp_func ocsp_func, void* ptr);
2185 
2186         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_5)
2187             alias pgnutls_certificate_set_ocsp_status_request_function2 = int function (gnutls_certificate_credentials_t res, uint idx, gnutls_status_request_ocsp_func ocsp_func, void* ptr);
2188 
2189         alias pgnutls_certificate_set_ocsp_status_request_file = int function (gnutls_certificate_credentials_t res, const(char)* response_file, uint idx);
2190 
2191         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
2192         {
2193             alias pgnutls_certificate_set_ocsp_status_request_file2 = int function (gnutls_certificate_credentials_t res, const(char)* response_file, uint idx, gnutls_x509_crt_fmt_t fmt);
2194             alias pgnutls_certificate_set_ocsp_status_request_mem = int function (gnutls_certificate_credentials_t res, const(gnutls_datum_t)* resp, uint idx, gnutls_x509_crt_fmt_t fmt);
2195             alias pgnutls_certificate_get_ocsp_expiration = time_t function (gnutls_certificate_credentials_t sc, uint idx, int oidx, uint flags);
2196         }
2197 
2198         alias pgnutls_ocsp_status_request_enable_client = int function (gnutls_session_t session, gnutls_datum_t* responder_id, size_t responder_id_size, gnutls_datum_t* request_extensions);
2199         alias pgnutls_ocsp_status_request_get = int function (gnutls_session_t session, gnutls_datum_t* response);
2200         alias pgnutls_ocsp_status_request_is_checked = uint function (gnutls_session_t session, uint flags);
2201 
2202         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
2203             alias pgnutls_ocsp_status_request_get2 = int function (gnutls_session_t session, uint idx, gnutls_datum_t* response);
2204 
2205         alias pgnutls_certificate_set_rawpk_key_mem = int function (gnutls_certificate_credentials_t cred, const(gnutls_datum_t)* spki, const(gnutls_datum_t)* pkey, gnutls_x509_crt_fmt_t format, const(char)* pass, uint key_usage, const(char*)* names, uint names_length, uint flags);
2206         alias pgnutls_certificate_set_rawpk_key_file = int function (gnutls_certificate_credentials_t cred, const(char)* rawpkfile, const(char)* privkeyfile, gnutls_x509_crt_fmt_t format, const(char)* pass, uint key_usage, const(char*)* names, uint names_length, uint privkey_flags, uint pkcs11_flags);
2207         alias pgnutls_global_init = int function ();
2208         alias pgnutls_global_deinit = void function ();
2209         alias pgnutls_global_set_mutex = void function (mutex_init_func init, mutex_deinit_func deinit, mutex_lock_func lock, mutex_unlock_func unlock);
2210         alias pgnutls_global_set_time_function = void function (gnutls_time_func time_func);
2211         alias pgnutls_memset = void function (void* data, int c, size_t size);
2212         alias pgnutls_memcmp = int function (const(void)* s1, const(void)* s2, size_t n);
2213         alias pgnutls_global_set_log_function = void function (gnutls_log_func log_func);
2214         alias pgnutls_global_set_audit_log_function = void function (gnutls_audit_log_func log_func);
2215         alias pgnutls_global_set_log_level = void function (int level);
2216 
2217         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_13)
2218         {
2219             alias pgnutls_session_get_keylog_function = gnutls_keylog_func function (const gnutls_session_t session);
2220             alias pgnutls_session_set_keylog_function = void function (gnutls_session_t session, gnutls_keylog_func func);
2221         }
2222 
2223         alias pgnutls_dh_params_init = int function (gnutls_dh_params_t* dh_params);
2224         alias pgnutls_dh_params_deinit = void function (gnutls_dh_params_t dh_params);
2225         alias pgnutls_dh_params_import_raw = int function (gnutls_dh_params_t dh_params, const(gnutls_datum_t)* prime, const(gnutls_datum_t)* generator);
2226         alias pgnutls_dh_params_import_dsa = int function (gnutls_dh_params_t dh_params, gnutls_x509_privkey_t key);
2227         alias pgnutls_dh_params_import_raw2 = int function (gnutls_dh_params_t dh_params, const(gnutls_datum_t)* prime, const(gnutls_datum_t)* generator, uint key_bits);
2228 
2229         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_8)
2230             alias pgnutls_dh_params_import_raw3 = int function (gnutls_dh_params_t dh_params, const(gnutls_datum_t)* prime, const(gnutls_datum_t)* q, const(gnutls_datum_t)* generator);
2231 
2232         alias pgnutls_dh_params_import_pkcs3 = int function (gnutls_dh_params_t params, const(gnutls_datum_t)* pkcs3_params, gnutls_x509_crt_fmt_t format);
2233         alias pgnutls_dh_params_generate2 = int function (gnutls_dh_params_t params, uint bits);
2234         alias pgnutls_dh_params_export_pkcs3 = int function (gnutls_dh_params_t params, gnutls_x509_crt_fmt_t format, ubyte* params_data, size_t* params_data_size);
2235         alias pgnutls_dh_params_export2_pkcs3 = int function (gnutls_dh_params_t params, gnutls_x509_crt_fmt_t format, gnutls_datum_t* out_);
2236         alias pgnutls_dh_params_export_raw = int function (gnutls_dh_params_t params, gnutls_datum_t* prime, gnutls_datum_t* generator, uint* bits);
2237         alias pgnutls_dh_params_cpy = int function (gnutls_dh_params_t dst, gnutls_dh_params_t src);
2238         alias pgnutls_system_recv_timeout = int function (gnutls_transport_ptr_t ptr, uint ms);
2239         alias pgnutls_transport_set_int2 = void function (gnutls_session_t session, int r, int s);
2240         alias pgnutls_transport_get_int2 = void function (gnutls_session_t session, int* r, int* s);
2241         alias pgnutls_transport_get_int = int function (gnutls_session_t session);
2242         alias pgnutls_transport_set_ptr = void function (gnutls_session_t session, gnutls_transport_ptr_t ptr);
2243         alias pgnutls_transport_set_ptr2 = void function (gnutls_session_t session, gnutls_transport_ptr_t recv_ptr, gnutls_transport_ptr_t send_ptr);
2244         alias pgnutls_transport_get_ptr = gnutls_transport_ptr_t function (gnutls_session_t session);
2245         alias pgnutls_transport_get_ptr2 = void function (gnutls_session_t session, gnutls_transport_ptr_t* recv_ptr, gnutls_transport_ptr_t* send_ptr);
2246         alias pgnutls_transport_set_vec_push_function = void function (gnutls_session_t session, gnutls_vec_push_func vec_func);
2247         alias pgnutls_transport_set_push_function = void function (gnutls_session_t session, gnutls_push_func push_func);
2248         alias pgnutls_transport_set_pull_function = void function (gnutls_session_t session, gnutls_pull_func pull_func);
2249         alias pgnutls_transport_set_pull_timeout_function = void function (gnutls_session_t session, gnutls_pull_timeout_func func);
2250         alias pgnutls_transport_set_errno_function = void function (gnutls_session_t session, gnutls_errno_func errno_func);
2251         alias pgnutls_transport_set_errno = void function (gnutls_session_t session, int err);
2252         alias pgnutls_session_set_ptr = void function (gnutls_session_t session, void* ptr);
2253         alias pgnutls_session_get_ptr = void* function (gnutls_session_t session);
2254         alias pgnutls_openpgp_send_cert = void function (gnutls_session_t session, gnutls_openpgp_crt_status_t status);
2255         alias pgnutls_fingerprint = int function (gnutls_digest_algorithm_t algo, const(gnutls_datum_t)* data, void* result, size_t* result_size);
2256         alias pgnutls_random_art = int function (gnutls_random_art_t type, const(char)* key_type, uint key_size, void* fpr, size_t fpr_size, gnutls_datum_t* art);
2257 
2258         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_9)
2259         {
2260             alias pgnutls_idna_map = int function (const(char)* input, uint ilen, gnutls_datum_t* out_, uint flags);
2261             alias pgnutls_idna_reverse_map = int function (const(char)* input, uint ilen, gnutls_datum_t* out_, uint flags);
2262         }
2263 
2264         alias pgnutls_srp_free_client_credentials = void function (gnutls_srp_client_credentials_t sc);
2265         alias pgnutls_srp_allocate_client_credentials = int function (gnutls_srp_client_credentials_t* sc);
2266         alias pgnutls_srp_set_client_credentials = int function (gnutls_srp_client_credentials_t res, const(char)* username, const(char)* password);
2267         alias pgnutls_srp_free_server_credentials = void function (gnutls_srp_server_credentials_t sc);
2268         alias pgnutls_srp_allocate_server_credentials = int function (gnutls_srp_server_credentials_t* sc);
2269         alias pgnutls_srp_set_server_credentials_file = int function (gnutls_srp_server_credentials_t res, const(char)* password_file, const(char)* password_conf_file);
2270         alias pgnutls_srp_server_get_username = const(char)* function (gnutls_session_t session);
2271         alias pgnutls_srp_set_prime_bits = void function (gnutls_session_t session, uint bits);
2272         alias pgnutls_srp_verifier = int function (const(char)* username, const(char)* password, const(gnutls_datum_t)* salt, const(gnutls_datum_t)* generator, const(gnutls_datum_t)* prime, gnutls_datum_t* res);
2273         alias pgnutls_srp_set_server_credentials_function = void function (gnutls_srp_server_credentials_t cred, int function () func);
2274         alias pgnutls_srp_set_client_credentials_function = void function (gnutls_srp_client_credentials_t cred, int function () func);
2275         alias pgnutls_srp_base64_encode = int function (const(gnutls_datum_t)* data, char* result, size_t* result_size);
2276         alias pgnutls_srp_base64_encode2 = int function (const(gnutls_datum_t)* data, gnutls_datum_t* result);
2277         alias pgnutls_srp_base64_decode = int function (const(gnutls_datum_t)* b64_data, char* result, size_t* result_size);
2278         alias pgnutls_srp_base64_decode2 = int function (const(gnutls_datum_t)* b64_data, gnutls_datum_t* result);
2279         alias pgnutls_srp_set_server_fake_salt_seed = void function (gnutls_srp_server_credentials_t sc, const(gnutls_datum_t)* seed, uint salt_length);
2280         alias pgnutls_psk_free_client_credentials = void function (gnutls_psk_client_credentials_t sc);
2281         alias pgnutls_psk_allocate_client_credentials = int function (gnutls_psk_client_credentials_t* sc);
2282         alias pgnutls_psk_set_client_credentials = int function (gnutls_psk_client_credentials_t res, const(char)* username, const(gnutls_datum_t)* key, gnutls_psk_key_flags flags);
2283         alias pgnutls_psk_free_server_credentials = void function (gnutls_psk_server_credentials_t sc);
2284         alias pgnutls_psk_allocate_server_credentials = int function (gnutls_psk_server_credentials_t* sc);
2285         alias pgnutls_psk_set_server_credentials_file = int function (gnutls_psk_server_credentials_t res, const(char)* password_file);
2286         alias pgnutls_psk_set_server_credentials_hint = int function (gnutls_psk_server_credentials_t res, const(char)* hint);
2287         alias pgnutls_psk_server_get_username = const(char)* function (gnutls_session_t session);
2288         alias pgnutls_psk_client_get_hint = const(char)* function (gnutls_session_t session);
2289         alias pgnutls_psk_set_server_credentials_function = void function (gnutls_psk_server_credentials_t cred, int function () func);
2290         alias pgnutls_psk_set_client_credentials_function = void function (gnutls_psk_client_credentials_t cred, int function () func);
2291 
2292         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_13)
2293         {
2294             alias pgnutls_psk_set_client_credentials2 = int function (gnutls_psk_client_credentials_t res, const(gnutls_datum_t)* username, const(gnutls_datum_t)* key, gnutls_psk_key_flags flags);
2295             alias pgnutls_psk_server_get_username2 = int function (gnutls_session_t session, gnutls_datum_t* out_);
2296             alias pgnutls_psk_set_server_credentials_function2 = void function (gnutls_psk_server_credentials_t cred, int function () func);
2297             alias pgnutls_psk_set_client_credentials_function2 = void function (gnutls_psk_client_credentials_t cred, int function () func);
2298         }
2299 
2300         alias pgnutls_hex_encode = int function (const(gnutls_datum_t)* data, char* result, size_t* result_size);
2301         alias pgnutls_hex_decode = int function (const(gnutls_datum_t)* hex_data, void* result, size_t* result_size);
2302         alias pgnutls_hex_encode2 = int function (const(gnutls_datum_t)* data, gnutls_datum_t* result);
2303         alias pgnutls_hex_decode2 = int function (const(gnutls_datum_t)* data, gnutls_datum_t* result);
2304         alias pgnutls_psk_set_server_dh_params = void function (gnutls_psk_server_credentials_t res, gnutls_dh_params_t dh_params);
2305 
2306         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_6)
2307             alias pgnutls_psk_set_server_known_dh_params = int function (gnutls_psk_server_credentials_t res, gnutls_sec_param_t sec_param);
2308 
2309         alias pgnutls_psk_set_server_params_function = void function (gnutls_psk_server_credentials_t res, int function () func);
2310         alias pgnutls_auth_get_type = gnutls_credentials_type_t function (gnutls_session_t session);
2311         alias pgnutls_auth_server_get_type = gnutls_credentials_type_t function (gnutls_session_t session);
2312         alias pgnutls_auth_client_get_type = gnutls_credentials_type_t function (gnutls_session_t session);
2313         alias pgnutls_dh_set_prime_bits = void function (gnutls_session_t session, uint bits);
2314         alias pgnutls_dh_get_secret_bits = int function (gnutls_session_t session);
2315         alias pgnutls_dh_get_peers_public_bits = int function (gnutls_session_t session);
2316         alias pgnutls_dh_get_prime_bits = int function (gnutls_session_t session);
2317         alias pgnutls_dh_get_group = int function (gnutls_session_t session, gnutls_datum_t* raw_gen, gnutls_datum_t* raw_prime);
2318         alias pgnutls_dh_get_pubkey = int function (gnutls_session_t session, gnutls_datum_t* raw_key);
2319         alias pgnutls_certificate_set_retrieve_function = void function (gnutls_certificate_credentials_t cred, int function () func);
2320         alias pgnutls_certificate_set_verify_function = void function (gnutls_certificate_credentials_t cred, int function () func);
2321         alias pgnutls_certificate_server_set_request = void function (gnutls_session_t session, gnutls_certificate_request_t req);
2322         alias pgnutls_certificate_get_peers = const(gnutls_datum_t)* function (gnutls_session_t session, uint* list_size);
2323         alias pgnutls_certificate_get_ours = const(gnutls_datum_t)* function (gnutls_session_t session);
2324         alias pgnutls_certificate_get_peers_subkey_id = int function (gnutls_session_t session, gnutls_datum_t* id);
2325         alias pgnutls_certificate_activation_time_peers = time_t function (gnutls_session_t session);
2326         alias pgnutls_certificate_expiration_time_peers = time_t function (gnutls_session_t session);
2327         alias pgnutls_certificate_client_get_request_status = uint function (gnutls_session_t session);
2328         alias pgnutls_certificate_verify_peers2 = int function (gnutls_session_t session, uint* status);
2329         alias pgnutls_certificate_verify_peers3 = int function (gnutls_session_t session, const(char)* hostname, uint* status);
2330         alias pgnutls_certificate_verify_peers = int function (gnutls_session_t session, gnutls_typed_vdata_st* data, uint elements, uint* status);
2331         alias pgnutls_certificate_verification_status_print = int function (uint status, gnutls_certificate_type_t type, gnutls_datum_t* out_, uint flags);
2332         alias pgnutls_pem_base64_encode = int function (const(char)* msg, const(gnutls_datum_t)* data, char* result, size_t* result_size);
2333         alias pgnutls_pem_base64_decode = int function (const(char)* header, const(gnutls_datum_t)* b64_data, ubyte* result, size_t* result_size);
2334         alias pgnutls_pem_base64_encode2 = int function (const(char)* msg, const(gnutls_datum_t)* data, gnutls_datum_t* result);
2335         alias pgnutls_pem_base64_decode2 = int function (const(char)* header, const(gnutls_datum_t)* b64_data, gnutls_datum_t* result);
2336 
2337         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_0)
2338         {
2339             alias pgnutls_base64_encode2 = int function (const(gnutls_datum_t)* data, gnutls_datum_t* result);
2340             alias pgnutls_base64_decode2 = int function (const(gnutls_datum_t)* b64_data, gnutls_datum_t* result);
2341         }
2342 
2343         alias pgnutls_certificate_set_params_function = void function (gnutls_certificate_credentials_t res, int function () func);
2344         alias pgnutls_anon_set_params_function = void function (gnutls_anon_server_credentials_t res, int function () func);
2345         alias pgnutls_psk_set_params_function = void function (gnutls_psk_server_credentials_t res, int function () func);
2346         alias pgnutls_hex2bin = int function (const(char)* hex_data, size_t hex_size, void* bin_data, size_t* bin_size);
2347         alias pgnutls_tdb_init = int function (gnutls_tdb_t* tdb);
2348         alias pgnutls_tdb_set_store_func = void function (gnutls_tdb_t tdb, gnutls_tdb_store_func store);
2349         alias pgnutls_tdb_set_store_commitment_func = void function (gnutls_tdb_t tdb, gnutls_tdb_store_commitment_func cstore);
2350         alias pgnutls_tdb_set_verify_func = void function (gnutls_tdb_t tdb, gnutls_tdb_verify_func verify);
2351         alias pgnutls_tdb_deinit = void function (gnutls_tdb_t tdb);
2352         alias pgnutls_verify_stored_pubkey = int function (const(char)* db_name, gnutls_tdb_t tdb, const(char)* host, const(char)* service, gnutls_certificate_type_t cert_type, const(gnutls_datum_t)* cert, uint flags);
2353         alias pgnutls_store_commitment = int function (const(char)* db_name, gnutls_tdb_t tdb, const(char)* host, const(char)* service, gnutls_digest_algorithm_t hash_algo, const(gnutls_datum_t)* hash, time_t expiration, uint flags);
2354         alias pgnutls_store_pubkey = int function (const(char)* db_name, gnutls_tdb_t tdb, const(char)* host, const(char)* service, gnutls_certificate_type_t cert_type, const(gnutls_datum_t)* cert, time_t expiration, uint flags);
2355         alias pgnutls_load_file = int function (const(char)* filename, gnutls_datum_t* data);
2356         alias pgnutls_url_is_supported = uint function (const(char)* url);
2357         alias pgnutls_certificate_set_pin_function = void function (gnutls_certificate_credentials_t, gnutls_pin_callback_t fn, void* userdata);
2358         alias pgnutls_buffer_append_data = int function (gnutls_buffer_t, const(void)* data, size_t data_size);
2359 
2360         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_7)
2361             alias pgnutls_utf8_password_normalize = int function (const(ubyte)* password, uint password_len, gnutls_datum_t* out_, uint flags);
2362 
2363         alias pgnutls_ext_set_data = void function (gnutls_session_t session, uint type, gnutls_ext_priv_data_t);
2364         alias pgnutls_ext_get_data = int function (gnutls_session_t session, uint type, gnutls_ext_priv_data_t*);
2365 
2366         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
2367         {
2368             alias pgnutls_ext_get_current_msg = uint function (gnutls_session_t session);
2369             alias pgnutls_ext_raw_parse = int function (void* ctx, gnutls_ext_raw_process_func cb, const(gnutls_datum_t)* data, uint flags);
2370         }
2371 
2372         alias pgnutls_ext_register = int function (const(char)* name, int type, gnutls_ext_parse_type_t parse_point, gnutls_ext_recv_func recv_func, gnutls_ext_send_func send_func, gnutls_ext_deinit_data_func deinit_func, gnutls_ext_pack_func pack_func, gnutls_ext_unpack_func unpack_func);
2373 
2374         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_5)
2375             alias pgnutls_session_ext_register = int function (gnutls_session_t, const(char)* name, int type, gnutls_ext_parse_type_t parse_point, gnutls_ext_recv_func recv_func, gnutls_ext_send_func send_func, gnutls_ext_deinit_data_func deinit_func, gnutls_ext_pack_func pack_func, gnutls_ext_unpack_func unpack_func, uint flags);
2376 
2377         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_1)
2378             alias pgnutls_ext_get_name = const(char)* function (uint ext);
2379 
2380         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_14)
2381             alias pgnutls_ext_get_name2 = const(char)* function (gnutls_session_t session, uint tls_id, gnutls_ext_parse_type_t parse_point);
2382 
2383         alias pgnutls_supplemental_register = int function (const(char)* name, gnutls_supplemental_data_format_type_t type, gnutls_supp_recv_func supp_recv_func, gnutls_supp_send_func supp_send_func);
2384 
2385         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_5)
2386             alias pgnutls_session_supplemental_register = int function (gnutls_session_t session, const(char)* name, gnutls_supplemental_data_format_type_t type, gnutls_supp_recv_func supp_recv_func, gnutls_supp_send_func supp_send_func, uint flags);
2387 
2388         alias pgnutls_supplemental_recv = void function (gnutls_session_t session, uint do_recv_supplemental);
2389         alias pgnutls_supplemental_send = void function (gnutls_session_t session, uint do_send_supplemental);
2390 
2391         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_5)
2392         {
2393             alias pgnutls_anti_replay_init = int function (gnutls_anti_replay_t* anti_replay);
2394             alias pgnutls_anti_replay_deinit = void function (gnutls_anti_replay_t anti_replay);
2395             alias pgnutls_anti_replay_set_window = void function (gnutls_anti_replay_t anti_replay, uint window);
2396             alias pgnutls_anti_replay_enable = void function (gnutls_session_t session, gnutls_anti_replay_t anti_replay);
2397             alias pgnutls_anti_replay_set_add_function = void function (gnutls_anti_replay_t, gnutls_db_add_func add_func);
2398         }
2399 
2400         alias pgnutls_anti_replay_set_ptr = void function (gnutls_anti_replay_t, void* ptr);
2401         alias pgnutls_fips140_mode_enabled = uint function ();
2402 
2403         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
2404             alias pgnutls_fips140_set_mode = void function (gnutls_fips_mode_t mode, uint flags);
2405     }
2406 
2407     __gshared
2408     {
2409         pgnutls_pk_algorithm_get_name gnutls_pk_algorithm_get_name;
2410         pgnutls_init gnutls_init;
2411         pgnutls_deinit gnutls_deinit;
2412         pgnutls_bye gnutls_bye;
2413         pgnutls_handshake gnutls_handshake;
2414 
2415         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
2416             pgnutls_reauth gnutls_reauth;
2417 
2418         pgnutls_handshake_set_timeout gnutls_handshake_set_timeout;
2419         pgnutls_rehandshake gnutls_rehandshake;
2420 
2421         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
2422             pgnutls_session_key_update gnutls_session_key_update;
2423 
2424         pgnutls_alert_get gnutls_alert_get;
2425         pgnutls_alert_send gnutls_alert_send;
2426         pgnutls_alert_send_appropriate gnutls_alert_send_appropriate;
2427         pgnutls_alert_get_name gnutls_alert_get_name;
2428         pgnutls_alert_get_strname gnutls_alert_get_strname;
2429         pgnutls_pk_bits_to_sec_param gnutls_pk_bits_to_sec_param;
2430         pgnutls_sec_param_get_name gnutls_sec_param_get_name;
2431         pgnutls_sec_param_to_pk_bits gnutls_sec_param_to_pk_bits;
2432         pgnutls_sec_param_to_symmetric_bits gnutls_sec_param_to_symmetric_bits;
2433         pgnutls_ecc_curve_get_name gnutls_ecc_curve_get_name;
2434         pgnutls_ecc_curve_get_oid gnutls_ecc_curve_get_oid;
2435         pgnutls_group_get_name gnutls_group_get_name;
2436         pgnutls_ecc_curve_get_size gnutls_ecc_curve_get_size;
2437         pgnutls_ecc_curve_get gnutls_ecc_curve_get;
2438         pgnutls_group_get gnutls_group_get;
2439         pgnutls_cipher_get gnutls_cipher_get;
2440         pgnutls_kx_get gnutls_kx_get;
2441         pgnutls_mac_get gnutls_mac_get;
2442 
2443         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_13)
2444             pgnutls_prf_hash_get gnutls_prf_hash_get;
2445 
2446         pgnutls_certificate_type_get gnutls_certificate_type_get;
2447 
2448         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_4)
2449             pgnutls_certificate_type_get2 gnutls_certificate_type_get2;
2450 
2451         pgnutls_sign_algorithm_get gnutls_sign_algorithm_get;
2452         pgnutls_sign_algorithm_get_client gnutls_sign_algorithm_get_client;
2453         pgnutls_sign_algorithm_get_requested gnutls_sign_algorithm_get_requested;
2454         pgnutls_cipher_get_name gnutls_cipher_get_name;
2455         pgnutls_mac_get_name gnutls_mac_get_name;
2456         pgnutls_digest_get_name gnutls_digest_get_name;
2457         pgnutls_digest_get_oid gnutls_digest_get_oid;
2458         pgnutls_kx_get_name gnutls_kx_get_name;
2459         pgnutls_certificate_type_get_name gnutls_certificate_type_get_name;
2460         pgnutls_pk_get_name gnutls_pk_get_name;
2461         pgnutls_pk_get_oid gnutls_pk_get_oid;
2462         pgnutls_sign_get_name gnutls_sign_get_name;
2463         pgnutls_sign_get_oid gnutls_sign_get_oid;
2464 
2465         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
2466         {
2467             pgnutls_gost_paramset_get_name gnutls_gost_paramset_get_name;
2468             pgnutls_gost_paramset_get_oid gnutls_gost_paramset_get_oid;
2469         }
2470 
2471         pgnutls_cipher_get_key_size gnutls_cipher_get_key_size;
2472         pgnutls_mac_get_key_size gnutls_mac_get_key_size;
2473         pgnutls_sign_is_secure gnutls_sign_is_secure;
2474         pgnutls_sign_is_secure2 gnutls_sign_is_secure2;
2475         pgnutls_sign_get_hash_algorithm gnutls_sign_get_hash_algorithm;
2476         pgnutls_sign_get_pk_algorithm gnutls_sign_get_pk_algorithm;
2477         pgnutls_pk_to_sign gnutls_pk_to_sign;
2478         pgnutls_sign_supports_pk_algorithm gnutls_sign_supports_pk_algorithm;
2479         pgnutls_mac_get_id gnutls_mac_get_id;
2480         pgnutls_digest_get_id gnutls_digest_get_id;
2481         pgnutls_cipher_get_id gnutls_cipher_get_id;
2482         pgnutls_kx_get_id gnutls_kx_get_id;
2483         pgnutls_protocol_get_id gnutls_protocol_get_id;
2484         pgnutls_certificate_type_get_id gnutls_certificate_type_get_id;
2485         pgnutls_pk_get_id gnutls_pk_get_id;
2486         pgnutls_sign_get_id gnutls_sign_get_id;
2487         pgnutls_ecc_curve_get_id gnutls_ecc_curve_get_id;
2488         pgnutls_ecc_curve_get_pk gnutls_ecc_curve_get_pk;
2489         pgnutls_group_get_id gnutls_group_get_id;
2490         pgnutls_oid_to_digest gnutls_oid_to_digest;
2491 
2492         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_4)
2493             pgnutls_oid_to_mac gnutls_oid_to_mac;
2494 
2495         pgnutls_oid_to_pk gnutls_oid_to_pk;
2496         pgnutls_oid_to_sign gnutls_oid_to_sign;
2497         pgnutls_oid_to_ecc_curve gnutls_oid_to_ecc_curve;
2498 
2499         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
2500             pgnutls_oid_to_gost_paramset gnutls_oid_to_gost_paramset;
2501 
2502         pgnutls_ecc_curve_list gnutls_ecc_curve_list;
2503         pgnutls_group_list gnutls_group_list;
2504         pgnutls_cipher_list gnutls_cipher_list;
2505         pgnutls_mac_list gnutls_mac_list;
2506         pgnutls_digest_list gnutls_digest_list;
2507         pgnutls_protocol_list gnutls_protocol_list;
2508         pgnutls_certificate_type_list gnutls_certificate_type_list;
2509         pgnutls_kx_list gnutls_kx_list;
2510         pgnutls_pk_list gnutls_pk_list;
2511         pgnutls_sign_list gnutls_sign_list;
2512         pgnutls_cipher_suite_info gnutls_cipher_suite_info;
2513         pgnutls_error_is_fatal gnutls_error_is_fatal;
2514         pgnutls_error_to_alert gnutls_error_to_alert;
2515         pgnutls_perror gnutls_perror;
2516         pgnutls_strerror gnutls_strerror;
2517         pgnutls_strerror_name gnutls_strerror_name;
2518         pgnutls_handshake_set_private_extensions gnutls_handshake_set_private_extensions;
2519         pgnutls_handshake_set_random gnutls_handshake_set_random;
2520         pgnutls_handshake_get_last_out gnutls_handshake_get_last_out;
2521         pgnutls_handshake_get_last_in gnutls_handshake_get_last_in;
2522         pgnutls_heartbeat_ping gnutls_heartbeat_ping;
2523         pgnutls_heartbeat_pong gnutls_heartbeat_pong;
2524         pgnutls_record_set_timeout gnutls_record_set_timeout;
2525         pgnutls_record_disable_padding gnutls_record_disable_padding;
2526         pgnutls_record_cork gnutls_record_cork;
2527         pgnutls_record_uncork gnutls_record_uncork;
2528         pgnutls_record_discard_queued gnutls_record_discard_queued;
2529         pgnutls_record_get_state gnutls_record_get_state;
2530         pgnutls_record_set_state gnutls_record_set_state;
2531         pgnutls_range_split gnutls_range_split;
2532         pgnutls_record_send gnutls_record_send;
2533 
2534         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
2535             pgnutls_record_send2 gnutls_record_send2;
2536 
2537         pgnutls_record_send_range gnutls_record_send_range;
2538         pgnutls_record_recv gnutls_record_recv;
2539         pgnutls_record_recv_packet gnutls_record_recv_packet;
2540         pgnutls_packet_get gnutls_packet_get;
2541         pgnutls_packet_deinit gnutls_packet_deinit;
2542         pgnutls_record_recv_seq gnutls_record_recv_seq;
2543         pgnutls_record_overhead_size gnutls_record_overhead_size;
2544         pgnutls_est_record_overhead_size gnutls_est_record_overhead_size;
2545         pgnutls_session_enable_compatibility_mode gnutls_session_enable_compatibility_mode;
2546         pgnutls_record_can_use_length_hiding gnutls_record_can_use_length_hiding;
2547         pgnutls_record_get_direction gnutls_record_get_direction;
2548         pgnutls_record_get_max_size gnutls_record_get_max_size;
2549         pgnutls_record_set_max_size gnutls_record_set_max_size;
2550 
2551         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_8)
2552             pgnutls_record_set_max_recv_size gnutls_record_set_max_recv_size;
2553 
2554         pgnutls_record_check_pending gnutls_record_check_pending;
2555         pgnutls_record_check_corked gnutls_record_check_corked;
2556 
2557 
2558         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_4)
2559             pgnutls_record_set_max_early_data_size gnutls_record_set_max_early_data_size;
2560 
2561         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_5)
2562         {
2563             pgnutls_record_get_max_early_data_size gnutls_record_get_max_early_data_size;
2564             pgnutls_record_send_early_data gnutls_record_send_early_data;
2565             pgnutls_record_recv_early_data gnutls_record_recv_early_data;
2566         }
2567 
2568         pgnutls_session_force_valid gnutls_session_force_valid;
2569         pgnutls_prf gnutls_prf;
2570         pgnutls_prf_rfc5705 gnutls_prf_rfc5705;
2571 
2572         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_8)
2573             pgnutls_prf_early gnutls_prf_early;
2574 
2575         pgnutls_prf_raw gnutls_prf_raw;
2576         pgnutls_server_name_set gnutls_server_name_set;
2577         pgnutls_server_name_get gnutls_server_name_get;
2578         pgnutls_heartbeat_get_timeout gnutls_heartbeat_get_timeout;
2579         pgnutls_heartbeat_set_timeouts gnutls_heartbeat_set_timeouts;
2580         pgnutls_heartbeat_enable gnutls_heartbeat_enable;
2581         pgnutls_heartbeat_allowed gnutls_heartbeat_allowed;
2582         pgnutls_safe_renegotiation_status gnutls_safe_renegotiation_status;
2583         pgnutls_session_ext_master_secret_status gnutls_session_ext_master_secret_status;
2584         pgnutls_session_etm_status gnutls_session_etm_status;
2585         pgnutls_session_get_flags gnutls_session_get_flags;
2586         pgnutls_supplemental_get_name gnutls_supplemental_get_name;
2587         pgnutls_session_ticket_key_generate gnutls_session_ticket_key_generate;
2588         pgnutls_session_ticket_enable_client gnutls_session_ticket_enable_client;
2589         pgnutls_session_ticket_enable_server gnutls_session_ticket_enable_server;
2590 
2591         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
2592             pgnutls_session_ticket_send gnutls_session_ticket_send;
2593 
2594         pgnutls_srtp_set_profile gnutls_srtp_set_profile;
2595         pgnutls_srtp_set_profile_direct gnutls_srtp_set_profile_direct;
2596         pgnutls_srtp_get_selected_profile gnutls_srtp_get_selected_profile;
2597         pgnutls_srtp_get_profile_name gnutls_srtp_get_profile_name;
2598         pgnutls_srtp_get_profile_id gnutls_srtp_get_profile_id;
2599         pgnutls_srtp_get_keys gnutls_srtp_get_keys;
2600         pgnutls_srtp_set_mki gnutls_srtp_set_mki;
2601         pgnutls_srtp_get_mki gnutls_srtp_get_mki;
2602         pgnutls_alpn_get_selected_protocol gnutls_alpn_get_selected_protocol;
2603         pgnutls_alpn_set_protocols gnutls_alpn_set_protocols;
2604         pgnutls_key_generate gnutls_key_generate;
2605         pgnutls_priority_init gnutls_priority_init;
2606 
2607         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
2608             pgnutls_priority_init2 gnutls_priority_init2;
2609 
2610         pgnutls_priority_deinit gnutls_priority_deinit;
2611         pgnutls_priority_get_cipher_suite_index gnutls_priority_get_cipher_suite_index;
2612         pgnutls_priority_string_list gnutls_priority_string_list;
2613         pgnutls_priority_set gnutls_priority_set;
2614         pgnutls_priority_set_direct gnutls_priority_set_direct;
2615         pgnutls_priority_certificate_type_list gnutls_priority_certificate_type_list;
2616 
2617         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_4)
2618             pgnutls_priority_certificate_type_list2 gnutls_priority_certificate_type_list2;
2619 
2620         pgnutls_priority_sign_list gnutls_priority_sign_list;
2621         pgnutls_priority_protocol_list gnutls_priority_protocol_list;
2622         pgnutls_priority_ecc_curve_list gnutls_priority_ecc_curve_list;
2623         pgnutls_priority_group_list gnutls_priority_group_list;
2624         pgnutls_priority_kx_list gnutls_priority_kx_list;
2625         pgnutls_priority_cipher_list gnutls_priority_cipher_list;
2626         pgnutls_priority_mac_list gnutls_priority_mac_list;
2627 
2628         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_9)
2629             pgnutls_get_system_config_file gnutls_get_system_config_file;
2630 
2631         pgnutls_set_default_priority gnutls_set_default_priority;
2632 
2633         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
2634             pgnutls_set_default_priority_append gnutls_set_default_priority_append;
2635 
2636         pgnutls_cipher_suite_get_name gnutls_cipher_suite_get_name;
2637         pgnutls_protocol_get_version gnutls_protocol_get_version;
2638         pgnutls_protocol_get_name gnutls_protocol_get_name;
2639         pgnutls_session_set_data gnutls_session_set_data;
2640         pgnutls_session_get_data gnutls_session_get_data;
2641         pgnutls_session_get_data2 gnutls_session_get_data2;
2642         pgnutls_session_get_random gnutls_session_get_random;
2643         pgnutls_session_get_master_secret gnutls_session_get_master_secret;
2644         pgnutls_session_get_desc gnutls_session_get_desc;
2645         pgnutls_session_set_verify_function gnutls_session_set_verify_function;
2646         pgnutls_session_set_verify_cert gnutls_session_set_verify_cert;
2647         pgnutls_session_set_verify_cert2 gnutls_session_set_verify_cert2;
2648         pgnutls_session_get_verify_cert_status gnutls_session_get_verify_cert_status;
2649         pgnutls_session_set_premaster gnutls_session_set_premaster;
2650         pgnutls_session_get_id gnutls_session_get_id;
2651         pgnutls_session_get_id2 gnutls_session_get_id2;
2652         pgnutls_session_set_id gnutls_session_set_id;
2653         pgnutls_session_channel_binding gnutls_session_channel_binding;
2654         pgnutls_session_is_resumed gnutls_session_is_resumed;
2655         pgnutls_session_resumption_requested gnutls_session_resumption_requested;
2656         pgnutls_db_set_cache_expiration gnutls_db_set_cache_expiration;
2657         pgnutls_db_get_default_cache_expiration gnutls_db_get_default_cache_expiration;
2658         pgnutls_db_remove_session gnutls_db_remove_session;
2659         pgnutls_db_set_retrieve_function gnutls_db_set_retrieve_function;
2660         pgnutls_db_set_remove_function gnutls_db_set_remove_function;
2661         pgnutls_db_set_store_function gnutls_db_set_store_function;
2662         pgnutls_db_set_ptr gnutls_db_set_ptr;
2663         pgnutls_db_get_ptr gnutls_db_get_ptr;
2664         pgnutls_db_check_entry gnutls_db_check_entry;
2665         pgnutls_db_check_entry_time gnutls_db_check_entry_time;
2666 
2667         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_5)
2668             pgnutls_db_check_entry_expire_time gnutls_db_check_entry_expire_time;
2669 
2670         pgnutls_handshake_set_hook_function gnutls_handshake_set_hook_function;
2671         pgnutls_handshake_set_post_client_hello_function gnutls_handshake_set_post_client_hello_function;
2672         pgnutls_handshake_set_max_packet_length gnutls_handshake_set_max_packet_length;
2673         pgnutls_check_version gnutls_check_version;
2674         pgnutls_credentials_clear gnutls_credentials_clear;
2675         pgnutls_credentials_set gnutls_credentials_set;
2676         pgnutls_credentials_get gnutls_credentials_get;
2677         pgnutls_anon_free_server_credentials gnutls_anon_free_server_credentials;
2678         pgnutls_anon_allocate_server_credentials gnutls_anon_allocate_server_credentials;
2679         pgnutls_anon_set_server_dh_params gnutls_anon_set_server_dh_params;
2680 
2681         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_6)
2682             pgnutls_anon_set_server_known_dh_params gnutls_anon_set_server_known_dh_params;
2683 
2684         pgnutls_anon_set_server_params_function gnutls_anon_set_server_params_function;
2685         pgnutls_anon_free_client_credentials gnutls_anon_free_client_credentials;
2686         pgnutls_anon_allocate_client_credentials gnutls_anon_allocate_client_credentials;
2687         pgnutls_certificate_free_credentials gnutls_certificate_free_credentials;
2688         pgnutls_certificate_allocate_credentials gnutls_certificate_allocate_credentials;
2689         pgnutls_certificate_get_issuer gnutls_certificate_get_issuer;
2690         pgnutls_certificate_get_crt_raw gnutls_certificate_get_crt_raw;
2691         pgnutls_certificate_free_keys gnutls_certificate_free_keys;
2692         pgnutls_certificate_free_cas gnutls_certificate_free_cas;
2693         pgnutls_certificate_free_ca_names gnutls_certificate_free_ca_names;
2694         pgnutls_certificate_free_crls gnutls_certificate_free_crls;
2695         pgnutls_certificate_set_dh_params gnutls_certificate_set_dh_params;
2696 
2697         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_6)
2698             pgnutls_certificate_set_known_dh_params gnutls_certificate_set_known_dh_params;
2699 
2700         pgnutls_certificate_set_verify_flags gnutls_certificate_set_verify_flags;
2701         pgnutls_certificate_get_verify_flags gnutls_certificate_get_verify_flags;
2702         pgnutls_certificate_set_flags gnutls_certificate_set_flags;
2703         pgnutls_certificate_set_verify_limits gnutls_certificate_set_verify_limits;
2704         pgnutls_certificate_set_x509_system_trust gnutls_certificate_set_x509_system_trust;
2705         pgnutls_certificate_set_x509_trust_file gnutls_certificate_set_x509_trust_file;
2706         pgnutls_certificate_set_x509_trust_dir gnutls_certificate_set_x509_trust_dir;
2707         pgnutls_certificate_set_x509_trust_mem gnutls_certificate_set_x509_trust_mem;
2708         pgnutls_certificate_set_x509_crl_file gnutls_certificate_set_x509_crl_file;
2709         pgnutls_certificate_set_x509_crl_mem gnutls_certificate_set_x509_crl_mem;
2710         pgnutls_certificate_set_x509_key_file gnutls_certificate_set_x509_key_file;
2711         pgnutls_certificate_set_x509_key_file2 gnutls_certificate_set_x509_key_file2;
2712         pgnutls_certificate_set_x509_key_mem gnutls_certificate_set_x509_key_mem;
2713         pgnutls_certificate_set_x509_key_mem2 gnutls_certificate_set_x509_key_mem2;
2714         pgnutls_certificate_send_x509_rdn_sequence gnutls_certificate_send_x509_rdn_sequence;
2715         pgnutls_certificate_set_x509_simple_pkcs12_file gnutls_certificate_set_x509_simple_pkcs12_file;
2716         pgnutls_certificate_set_x509_simple_pkcs12_mem gnutls_certificate_set_x509_simple_pkcs12_mem;
2717         pgnutls_certificate_set_x509_key gnutls_certificate_set_x509_key;
2718         pgnutls_certificate_set_x509_trust gnutls_certificate_set_x509_trust;
2719         pgnutls_certificate_set_x509_crl gnutls_certificate_set_x509_crl;
2720         pgnutls_certificate_get_x509_key gnutls_certificate_get_x509_key;
2721         pgnutls_certificate_get_x509_crt gnutls_certificate_get_x509_crt;
2722         pgnutls_certificate_set_ocsp_status_request_function gnutls_certificate_set_ocsp_status_request_function;
2723 
2724         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_5)
2725             pgnutls_certificate_set_ocsp_status_request_function2 gnutls_certificate_set_ocsp_status_request_function2;
2726 
2727         pgnutls_certificate_set_ocsp_status_request_file gnutls_certificate_set_ocsp_status_request_file;
2728 
2729         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
2730         {
2731             pgnutls_certificate_set_ocsp_status_request_file2 gnutls_certificate_set_ocsp_status_request_file2;
2732             pgnutls_certificate_set_ocsp_status_request_mem gnutls_certificate_set_ocsp_status_request_mem;
2733             pgnutls_certificate_get_ocsp_expiration gnutls_certificate_get_ocsp_expiration;
2734         }
2735 
2736         pgnutls_ocsp_status_request_enable_client gnutls_ocsp_status_request_enable_client;
2737         pgnutls_ocsp_status_request_get gnutls_ocsp_status_request_get;
2738         pgnutls_ocsp_status_request_is_checked gnutls_ocsp_status_request_is_checked;
2739 
2740         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
2741             pgnutls_ocsp_status_request_get2 gnutls_ocsp_status_request_get2;
2742 
2743         pgnutls_certificate_set_rawpk_key_mem gnutls_certificate_set_rawpk_key_mem;
2744         pgnutls_certificate_set_rawpk_key_file gnutls_certificate_set_rawpk_key_file;
2745         pgnutls_global_init gnutls_global_init;
2746         pgnutls_global_deinit gnutls_global_deinit;
2747         pgnutls_global_set_mutex gnutls_global_set_mutex;
2748         pgnutls_global_set_time_function gnutls_global_set_time_function;
2749         pgnutls_memset gnutls_memset;
2750         pgnutls_memcmp gnutls_memcmp;
2751         pgnutls_global_set_log_function gnutls_global_set_log_function;
2752         pgnutls_global_set_audit_log_function gnutls_global_set_audit_log_function;
2753         pgnutls_global_set_log_level gnutls_global_set_log_level;
2754 
2755         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_13)
2756         {
2757             pgnutls_session_get_keylog_function gnutls_session_get_keylog_function;
2758             pgnutls_session_set_keylog_function gnutls_session_set_keylog_function;
2759         }
2760 
2761         pgnutls_dh_params_init gnutls_dh_params_init;
2762         pgnutls_dh_params_deinit gnutls_dh_params_deinit;
2763         pgnutls_dh_params_import_raw gnutls_dh_params_import_raw;
2764         pgnutls_dh_params_import_dsa gnutls_dh_params_import_dsa;
2765         pgnutls_dh_params_import_raw2 gnutls_dh_params_import_raw2;
2766 
2767         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_8)
2768             pgnutls_dh_params_import_raw3 gnutls_dh_params_import_raw3;
2769 
2770         pgnutls_dh_params_import_pkcs3 gnutls_dh_params_import_pkcs3;
2771         pgnutls_dh_params_generate2 gnutls_dh_params_generate2;
2772         pgnutls_dh_params_export_pkcs3 gnutls_dh_params_export_pkcs3;
2773         pgnutls_dh_params_export2_pkcs3 gnutls_dh_params_export2_pkcs3;
2774         pgnutls_dh_params_export_raw gnutls_dh_params_export_raw;
2775         pgnutls_dh_params_cpy gnutls_dh_params_cpy;
2776         pgnutls_system_recv_timeout gnutls_system_recv_timeout;
2777         pgnutls_transport_set_int2 gnutls_transport_set_int2;
2778         pgnutls_transport_get_int2 gnutls_transport_get_int2;
2779         pgnutls_transport_get_int gnutls_transport_get_int;
2780         pgnutls_transport_set_ptr gnutls_transport_set_ptr;
2781         pgnutls_transport_set_ptr2 gnutls_transport_set_ptr2;
2782         pgnutls_transport_get_ptr gnutls_transport_get_ptr;
2783         pgnutls_transport_get_ptr2 gnutls_transport_get_ptr2;
2784         pgnutls_transport_set_vec_push_function gnutls_transport_set_vec_push_function;
2785         pgnutls_transport_set_push_function gnutls_transport_set_push_function;
2786         pgnutls_transport_set_pull_function gnutls_transport_set_pull_function;
2787         pgnutls_transport_set_pull_timeout_function gnutls_transport_set_pull_timeout_function;
2788         pgnutls_transport_set_errno_function gnutls_transport_set_errno_function;
2789         pgnutls_transport_set_errno gnutls_transport_set_errno;
2790         pgnutls_session_set_ptr gnutls_session_set_ptr;
2791         pgnutls_session_get_ptr gnutls_session_get_ptr;
2792         pgnutls_openpgp_send_cert gnutls_openpgp_send_cert;
2793         pgnutls_fingerprint gnutls_fingerprint;
2794         pgnutls_random_art gnutls_random_art;
2795 
2796         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_9)
2797         {
2798             pgnutls_idna_map gnutls_idna_map;
2799             pgnutls_idna_reverse_map gnutls_idna_reverse_map;
2800         }
2801 
2802         pgnutls_srp_free_client_credentials gnutls_srp_free_client_credentials;
2803         pgnutls_srp_allocate_client_credentials gnutls_srp_allocate_client_credentials;
2804         pgnutls_srp_set_client_credentials gnutls_srp_set_client_credentials;
2805         pgnutls_srp_free_server_credentials gnutls_srp_free_server_credentials;
2806         pgnutls_srp_allocate_server_credentials gnutls_srp_allocate_server_credentials;
2807         pgnutls_srp_set_server_credentials_file gnutls_srp_set_server_credentials_file;
2808         pgnutls_srp_server_get_username gnutls_srp_server_get_username;
2809         pgnutls_srp_set_prime_bits gnutls_srp_set_prime_bits;
2810         pgnutls_srp_verifier gnutls_srp_verifier;
2811         pgnutls_srp_set_server_credentials_function gnutls_srp_set_server_credentials_function;
2812         pgnutls_srp_set_client_credentials_function gnutls_srp_set_client_credentials_function;
2813         pgnutls_srp_base64_encode gnutls_srp_base64_encode;
2814         pgnutls_srp_base64_encode2 gnutls_srp_base64_encode2;
2815         pgnutls_srp_base64_decode gnutls_srp_base64_decode;
2816         pgnutls_srp_base64_decode2 gnutls_srp_base64_decode2;
2817         pgnutls_srp_set_server_fake_salt_seed gnutls_srp_set_server_fake_salt_seed;
2818         pgnutls_psk_free_client_credentials gnutls_psk_free_client_credentials;
2819         pgnutls_psk_allocate_client_credentials gnutls_psk_allocate_client_credentials;
2820         pgnutls_psk_set_client_credentials gnutls_psk_set_client_credentials;
2821         pgnutls_psk_free_server_credentials gnutls_psk_free_server_credentials;
2822         pgnutls_psk_allocate_server_credentials gnutls_psk_allocate_server_credentials;
2823         pgnutls_psk_set_server_credentials_file gnutls_psk_set_server_credentials_file;
2824         pgnutls_psk_set_server_credentials_hint gnutls_psk_set_server_credentials_hint;
2825         pgnutls_psk_server_get_username gnutls_psk_server_get_username;
2826         pgnutls_psk_client_get_hint gnutls_psk_client_get_hint;
2827         pgnutls_psk_set_server_credentials_function gnutls_psk_set_server_credentials_function;
2828         pgnutls_psk_set_client_credentials_function gnutls_psk_set_client_credentials_function;
2829 
2830         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_13)
2831         {
2832             pgnutls_psk_set_client_credentials2 gnutls_psk_set_client_credentials2;
2833             pgnutls_psk_server_get_username2 gnutls_psk_server_get_username2;
2834             pgnutls_psk_set_server_credentials_function2 gnutls_psk_set_server_credentials_function2;
2835             pgnutls_psk_set_client_credentials_function2 gnutls_psk_set_client_credentials_function2;
2836         }
2837 
2838         pgnutls_hex_encode gnutls_hex_encode;
2839         pgnutls_hex_decode gnutls_hex_decode;
2840         pgnutls_hex_encode2 gnutls_hex_encode2;
2841         pgnutls_hex_decode2 gnutls_hex_decode2;
2842         pgnutls_psk_set_server_dh_params gnutls_psk_set_server_dh_params;
2843 
2844         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_6)
2845             pgnutls_psk_set_server_known_dh_params gnutls_psk_set_server_known_dh_params;
2846 
2847         pgnutls_psk_set_server_params_function gnutls_psk_set_server_params_function;
2848         pgnutls_auth_get_type gnutls_auth_get_type;
2849         pgnutls_auth_server_get_type gnutls_auth_server_get_type;
2850         pgnutls_auth_client_get_type gnutls_auth_client_get_type;
2851         pgnutls_dh_set_prime_bits gnutls_dh_set_prime_bits;
2852         pgnutls_dh_get_secret_bits gnutls_dh_get_secret_bits;
2853         pgnutls_dh_get_peers_public_bits gnutls_dh_get_peers_public_bits;
2854         pgnutls_dh_get_prime_bits gnutls_dh_get_prime_bits;
2855         pgnutls_dh_get_group gnutls_dh_get_group;
2856         pgnutls_dh_get_pubkey gnutls_dh_get_pubkey;
2857         pgnutls_certificate_set_retrieve_function gnutls_certificate_set_retrieve_function;
2858         pgnutls_certificate_set_verify_function gnutls_certificate_set_verify_function;
2859         pgnutls_certificate_server_set_request gnutls_certificate_server_set_request;
2860         pgnutls_certificate_get_peers gnutls_certificate_get_peers;
2861         pgnutls_certificate_get_ours gnutls_certificate_get_ours;
2862         pgnutls_certificate_get_peers_subkey_id gnutls_certificate_get_peers_subkey_id;
2863         pgnutls_certificate_activation_time_peers gnutls_certificate_activation_time_peers;
2864         pgnutls_certificate_expiration_time_peers gnutls_certificate_expiration_time_peers;
2865         pgnutls_certificate_client_get_request_status gnutls_certificate_client_get_request_status;
2866         pgnutls_certificate_verify_peers2 gnutls_certificate_verify_peers2;
2867         pgnutls_certificate_verify_peers3 gnutls_certificate_verify_peers3;
2868         pgnutls_certificate_verify_peers gnutls_certificate_verify_peers;
2869         pgnutls_certificate_verification_status_print gnutls_certificate_verification_status_print;
2870         pgnutls_pem_base64_encode gnutls_pem_base64_encode;
2871         pgnutls_pem_base64_decode gnutls_pem_base64_decode;
2872         pgnutls_pem_base64_encode2 gnutls_pem_base64_encode2;
2873         pgnutls_pem_base64_decode2 gnutls_pem_base64_decode2;
2874 
2875         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_0)
2876         {
2877             pgnutls_base64_encode2 gnutls_base64_encode2;
2878             pgnutls_base64_decode2 gnutls_base64_decode2;
2879         }
2880 
2881         pgnutls_certificate_set_params_function gnutls_certificate_set_params_function;
2882         pgnutls_anon_set_params_function gnutls_anon_set_params_function;
2883         pgnutls_psk_set_params_function gnutls_psk_set_params_function;
2884         pgnutls_hex2bin gnutls_hex2bin;
2885         pgnutls_tdb_init gnutls_tdb_init;
2886         pgnutls_tdb_set_store_func gnutls_tdb_set_store_func;
2887         pgnutls_tdb_set_store_commitment_func gnutls_tdb_set_store_commitment_func;
2888         pgnutls_tdb_set_verify_func gnutls_tdb_set_verify_func;
2889         pgnutls_tdb_deinit gnutls_tdb_deinit;
2890         pgnutls_verify_stored_pubkey gnutls_verify_stored_pubkey;
2891         pgnutls_store_commitment gnutls_store_commitment;
2892         pgnutls_store_pubkey gnutls_store_pubkey;
2893         pgnutls_load_file gnutls_load_file;
2894         pgnutls_url_is_supported gnutls_url_is_supported;
2895         pgnutls_certificate_set_pin_function gnutls_certificate_set_pin_function;
2896         pgnutls_buffer_append_data gnutls_buffer_append_data;
2897 
2898         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_7)
2899             pgnutls_utf8_password_normalize gnutls_utf8_password_normalize;
2900 
2901         pgnutls_ext_set_data gnutls_ext_set_data;
2902         pgnutls_ext_get_data gnutls_ext_get_data;
2903 
2904         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
2905         {
2906             pgnutls_ext_get_current_msg gnutls_ext_get_current_msg;
2907             pgnutls_ext_raw_parse gnutls_ext_raw_parse;
2908         }
2909 
2910         pgnutls_ext_register gnutls_ext_register;
2911 
2912         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_5)
2913             pgnutls_session_ext_register gnutls_session_ext_register;
2914 
2915         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_1)
2916             pgnutls_ext_get_name gnutls_ext_get_name;
2917 
2918         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_14)
2919             pgnutls_ext_get_name2 gnutls_ext_get_name2;
2920 
2921         pgnutls_supplemental_register gnutls_supplemental_register;
2922 
2923         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_5)
2924             pgnutls_session_supplemental_register gnutls_session_supplemental_register;
2925 
2926         pgnutls_supplemental_recv gnutls_supplemental_recv;
2927         pgnutls_supplemental_send gnutls_supplemental_send;
2928 
2929         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_5)
2930         {
2931             pgnutls_anti_replay_init gnutls_anti_replay_init;
2932             pgnutls_anti_replay_deinit gnutls_anti_replay_deinit;
2933             pgnutls_anti_replay_set_window gnutls_anti_replay_set_window;
2934             pgnutls_anti_replay_enable gnutls_anti_replay_enable;
2935             pgnutls_anti_replay_set_add_function gnutls_anti_replay_set_add_function;
2936         }
2937 
2938         pgnutls_anti_replay_set_ptr gnutls_anti_replay_set_ptr;
2939         pgnutls_fips140_mode_enabled gnutls_fips140_mode_enabled;
2940 
2941         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
2942             pgnutls_fips140_set_mode gnutls_fips140_set_mode;
2943     }
2944 
2945     import bindbc.loader : SharedLib, bindSymbol, bindSymbol_stdcall;
2946     void bindGnutls(SharedLib lib)
2947     {
2948         // global symbols
2949         lib.bindSymbol_stdcall(gnutls_malloc_, "gnutls_malloc");
2950         lib.bindSymbol_stdcall(gnutls_realloc_, "gnutls_realloc");
2951         lib.bindSymbol_stdcall(gnutls_calloc_, "gnutls_calloc");
2952         lib.bindSymbol_stdcall(gnutls_free_, "gnutls_free");
2953         lib.bindSymbol_stdcall(gnutls_strdup_, "gnutls_strdup");
2954 
2955         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_2)
2956         {
2957             lib.bindSymbol_stdcall(gnutls_srp_8192_group_prime_, "gnutls_srp_8192_group_prime");
2958             lib.bindSymbol_stdcall(gnutls_srp_8192_group_generator_, "gnutls_srp_8192_group_generator");
2959         }
2960 
2961         lib.bindSymbol_stdcall(gnutls_srp_4096_group_prime_, "gnutls_srp_4096_group_prime");
2962         lib.bindSymbol_stdcall(gnutls_srp_4096_group_generator_, "gnutls_srp_4096_group_generator");
2963         lib.bindSymbol_stdcall(gnutls_srp_3072_group_prime_, "gnutls_srp_3072_group_prime");
2964         lib.bindSymbol_stdcall(gnutls_srp_3072_group_generator_, "gnutls_srp_3072_group_generator");
2965         lib.bindSymbol_stdcall(gnutls_srp_2048_group_prime_, "gnutls_srp_2048_group_prime");
2966         lib.bindSymbol_stdcall(gnutls_srp_2048_group_generator_, "gnutls_srp_2048_group_generator");
2967         lib.bindSymbol_stdcall(gnutls_srp_1536_group_prime_, "gnutls_srp_1536_group_prime");
2968         lib.bindSymbol_stdcall(gnutls_srp_1536_group_generator_, "gnutls_srp_1536_group_generator");
2969         lib.bindSymbol_stdcall(gnutls_srp_1024_group_prime_, "gnutls_srp_1024_group_prime");
2970         lib.bindSymbol_stdcall(gnutls_srp_1024_group_generator_, "gnutls_srp_1024_group_generator");
2971         lib.bindSymbol_stdcall(gnutls_ffdhe_8192_group_prime_, "gnutls_ffdhe_8192_group_prime");
2972         lib.bindSymbol_stdcall(gnutls_ffdhe_8192_group_generator_, "gnutls_ffdhe_8192_group_generator");
2973         lib.bindSymbol_stdcall(gnutls_ffdhe_8192_key_bits_, "gnutls_ffdhe_8192_key_bits");
2974 
2975         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_4)
2976         {
2977             lib.bindSymbol_stdcall(gnutls_ffdhe_6144_group_prime_, "gnutls_ffdhe_6144_group_prime");
2978             lib.bindSymbol_stdcall(gnutls_ffdhe_6144_group_generator_, "gnutls_ffdhe_6144_group_generator");
2979             lib.bindSymbol_stdcall(gnutls_ffdhe_6144_key_bits_, "gnutls_ffdhe_6144_key_bits");
2980         }
2981 
2982         lib.bindSymbol_stdcall(gnutls_ffdhe_4096_group_prime_, "gnutls_ffdhe_4096_group_prime");
2983         lib.bindSymbol_stdcall(gnutls_ffdhe_4096_group_generator_, "gnutls_ffdhe_4096_group_generator");
2984         lib.bindSymbol_stdcall(gnutls_ffdhe_4096_key_bits_, "gnutls_ffdhe_4096_key_bits");
2985         lib.bindSymbol_stdcall(gnutls_ffdhe_3072_group_prime_, "gnutls_ffdhe_3072_group_prime");
2986         lib.bindSymbol_stdcall(gnutls_ffdhe_3072_group_generator_, "gnutls_ffdhe_3072_group_generator");
2987         lib.bindSymbol_stdcall(gnutls_ffdhe_3072_key_bits_, "gnutls_ffdhe_3072_key_bits");
2988         lib.bindSymbol_stdcall(gnutls_ffdhe_2048_group_prime_, "gnutls_ffdhe_2048_group_prime");
2989 
2990         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_8)
2991         {
2992             lib.bindSymbol_stdcall(gnutls_ffdhe_2048_group_q_, "gnutls_ffdhe_2048_group_q");
2993             lib.bindSymbol_stdcall(gnutls_ffdhe_3072_group_q_, "gnutls_ffdhe_3072_group_q");
2994             lib.bindSymbol_stdcall(gnutls_ffdhe_4096_group_q_, "gnutls_ffdhe_4096_group_q");
2995             lib.bindSymbol_stdcall(gnutls_ffdhe_6144_group_q_, "gnutls_ffdhe_6144_group_q");
2996             lib.bindSymbol_stdcall(gnutls_ffdhe_8192_group_q_, "gnutls_ffdhe_8192_group_q");
2997         }
2998 
2999         lib.bindSymbol_stdcall(gnutls_ffdhe_2048_group_generator_, "gnutls_ffdhe_2048_group_generator");
3000         lib.bindSymbol_stdcall(gnutls_ffdhe_2048_key_bits_, "gnutls_ffdhe_2048_key_bits");
3001 
3002         // functions
3003         lib.bindSymbol_stdcall(gnutls_pk_algorithm_get_name, "gnutls_pk_algorithm_get_name");
3004         lib.bindSymbol_stdcall(gnutls_init, "gnutls_init");
3005         lib.bindSymbol_stdcall(gnutls_deinit, "gnutls_deinit");
3006         lib.bindSymbol_stdcall(gnutls_bye, "gnutls_bye");
3007         lib.bindSymbol_stdcall(gnutls_handshake, "gnutls_handshake");
3008 
3009         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
3010             lib.bindSymbol_stdcall(gnutls_reauth, "gnutls_reauth");
3011 
3012         lib.bindSymbol_stdcall(gnutls_handshake_set_timeout, "gnutls_handshake_set_timeout");
3013         lib.bindSymbol_stdcall(gnutls_rehandshake, "gnutls_rehandshake");
3014 
3015         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
3016             lib.bindSymbol_stdcall(gnutls_session_key_update, "gnutls_session_key_update");
3017 
3018         lib.bindSymbol_stdcall(gnutls_alert_get, "gnutls_alert_get");
3019         lib.bindSymbol_stdcall(gnutls_alert_send, "gnutls_alert_send");
3020         lib.bindSymbol_stdcall(gnutls_alert_send_appropriate, "gnutls_alert_send_appropriate");
3021         lib.bindSymbol_stdcall(gnutls_alert_get_name, "gnutls_alert_get_name");
3022         lib.bindSymbol_stdcall(gnutls_alert_get_strname, "gnutls_alert_get_strname");
3023         lib.bindSymbol_stdcall(gnutls_pk_bits_to_sec_param, "gnutls_pk_bits_to_sec_param");
3024         lib.bindSymbol_stdcall(gnutls_sec_param_get_name, "gnutls_sec_param_get_name");
3025         lib.bindSymbol_stdcall(gnutls_sec_param_to_pk_bits, "gnutls_sec_param_to_pk_bits");
3026         lib.bindSymbol_stdcall(gnutls_sec_param_to_symmetric_bits, "gnutls_sec_param_to_symmetric_bits");
3027         lib.bindSymbol_stdcall(gnutls_ecc_curve_get_name, "gnutls_ecc_curve_get_name");
3028         lib.bindSymbol_stdcall(gnutls_ecc_curve_get_oid, "gnutls_ecc_curve_get_oid");
3029         lib.bindSymbol_stdcall(gnutls_group_get_name, "gnutls_group_get_name");
3030         lib.bindSymbol_stdcall(gnutls_ecc_curve_get_size, "gnutls_ecc_curve_get_size");
3031         lib.bindSymbol_stdcall(gnutls_ecc_curve_get, "gnutls_ecc_curve_get");
3032         lib.bindSymbol_stdcall(gnutls_group_get, "gnutls_group_get");
3033         lib.bindSymbol_stdcall(gnutls_cipher_get, "gnutls_cipher_get");
3034         lib.bindSymbol_stdcall(gnutls_kx_get, "gnutls_kx_get");
3035         lib.bindSymbol_stdcall(gnutls_mac_get, "gnutls_mac_get");
3036 
3037         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_13)
3038             lib.bindSymbol_stdcall(gnutls_prf_hash_get, "gnutls_prf_hash_get");
3039 
3040         lib.bindSymbol_stdcall(gnutls_certificate_type_get, "gnutls_certificate_type_get");
3041 
3042         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_4)
3043             lib.bindSymbol_stdcall(gnutls_certificate_type_get2, "gnutls_certificate_type_get2");
3044 
3045         lib.bindSymbol_stdcall(gnutls_sign_algorithm_get, "gnutls_sign_algorithm_get");
3046         lib.bindSymbol_stdcall(gnutls_sign_algorithm_get_client, "gnutls_sign_algorithm_get_client");
3047         lib.bindSymbol_stdcall(gnutls_sign_algorithm_get_requested, "gnutls_sign_algorithm_get_requested");
3048         lib.bindSymbol_stdcall(gnutls_cipher_get_name, "gnutls_cipher_get_name");
3049         lib.bindSymbol_stdcall(gnutls_mac_get_name, "gnutls_mac_get_name");
3050         lib.bindSymbol_stdcall(gnutls_digest_get_name, "gnutls_digest_get_name");
3051         lib.bindSymbol_stdcall(gnutls_digest_get_oid, "gnutls_digest_get_oid");
3052         lib.bindSymbol_stdcall(gnutls_kx_get_name, "gnutls_kx_get_name");
3053         lib.bindSymbol_stdcall(gnutls_certificate_type_get_name, "gnutls_certificate_type_get_name");
3054         lib.bindSymbol_stdcall(gnutls_pk_get_name, "gnutls_pk_get_name");
3055         lib.bindSymbol_stdcall(gnutls_pk_get_oid, "gnutls_pk_get_oid");
3056         lib.bindSymbol_stdcall(gnutls_sign_get_name, "gnutls_sign_get_name");
3057         lib.bindSymbol_stdcall(gnutls_sign_get_oid, "gnutls_sign_get_oid");
3058 
3059         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
3060         {
3061             lib.bindSymbol_stdcall(gnutls_gost_paramset_get_name, "gnutls_gost_paramset_get_name");
3062             lib.bindSymbol_stdcall(gnutls_gost_paramset_get_oid, "gnutls_gost_paramset_get_oid");
3063         }
3064 
3065         lib.bindSymbol_stdcall(gnutls_cipher_get_key_size, "gnutls_cipher_get_key_size");
3066         lib.bindSymbol_stdcall(gnutls_mac_get_key_size, "gnutls_mac_get_key_size");
3067         lib.bindSymbol_stdcall(gnutls_sign_is_secure, "gnutls_sign_is_secure");
3068         lib.bindSymbol_stdcall(gnutls_sign_is_secure2, "gnutls_sign_is_secure2");
3069         lib.bindSymbol_stdcall(gnutls_sign_get_hash_algorithm, "gnutls_sign_get_hash_algorithm");
3070         lib.bindSymbol_stdcall(gnutls_sign_get_pk_algorithm, "gnutls_sign_get_pk_algorithm");
3071         lib.bindSymbol_stdcall(gnutls_pk_to_sign, "gnutls_pk_to_sign");
3072         lib.bindSymbol_stdcall(gnutls_sign_supports_pk_algorithm, "gnutls_sign_supports_pk_algorithm");
3073         lib.bindSymbol_stdcall(gnutls_mac_get_id, "gnutls_mac_get_id");
3074         lib.bindSymbol_stdcall(gnutls_digest_get_id, "gnutls_digest_get_id");
3075         lib.bindSymbol_stdcall(gnutls_cipher_get_id, "gnutls_cipher_get_id");
3076         lib.bindSymbol_stdcall(gnutls_kx_get_id, "gnutls_kx_get_id");
3077         lib.bindSymbol_stdcall(gnutls_protocol_get_id, "gnutls_protocol_get_id");
3078         lib.bindSymbol_stdcall(gnutls_certificate_type_get_id, "gnutls_certificate_type_get_id");
3079         lib.bindSymbol_stdcall(gnutls_pk_get_id, "gnutls_pk_get_id");
3080         lib.bindSymbol_stdcall(gnutls_sign_get_id, "gnutls_sign_get_id");
3081         lib.bindSymbol_stdcall(gnutls_ecc_curve_get_id, "gnutls_ecc_curve_get_id");
3082         lib.bindSymbol_stdcall(gnutls_ecc_curve_get_pk, "gnutls_ecc_curve_get_pk");
3083         lib.bindSymbol_stdcall(gnutls_group_get_id, "gnutls_group_get_id");
3084         lib.bindSymbol_stdcall(gnutls_oid_to_digest, "gnutls_oid_to_digest");
3085 
3086         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_4)
3087             lib.bindSymbol_stdcall(gnutls_oid_to_mac, "gnutls_oid_to_mac");
3088 
3089         lib.bindSymbol_stdcall(gnutls_oid_to_pk, "gnutls_oid_to_pk");
3090         lib.bindSymbol_stdcall(gnutls_oid_to_sign, "gnutls_oid_to_sign");
3091         lib.bindSymbol_stdcall(gnutls_oid_to_ecc_curve, "gnutls_oid_to_ecc_curve");
3092 
3093         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
3094             lib.bindSymbol_stdcall(gnutls_oid_to_gost_paramset, "gnutls_oid_to_gost_paramset");
3095 
3096         lib.bindSymbol_stdcall(gnutls_ecc_curve_list, "gnutls_ecc_curve_list");
3097         lib.bindSymbol_stdcall(gnutls_group_list, "gnutls_group_list");
3098         lib.bindSymbol_stdcall(gnutls_cipher_list, "gnutls_cipher_list");
3099         lib.bindSymbol_stdcall(gnutls_mac_list, "gnutls_mac_list");
3100         lib.bindSymbol_stdcall(gnutls_digest_list, "gnutls_digest_list");
3101         lib.bindSymbol_stdcall(gnutls_protocol_list, "gnutls_protocol_list");
3102         lib.bindSymbol_stdcall(gnutls_certificate_type_list, "gnutls_certificate_type_list");
3103         lib.bindSymbol_stdcall(gnutls_kx_list, "gnutls_kx_list");
3104         lib.bindSymbol_stdcall(gnutls_pk_list, "gnutls_pk_list");
3105         lib.bindSymbol_stdcall(gnutls_sign_list, "gnutls_sign_list");
3106         lib.bindSymbol_stdcall(gnutls_cipher_suite_info, "gnutls_cipher_suite_info");
3107         lib.bindSymbol_stdcall(gnutls_error_is_fatal, "gnutls_error_is_fatal");
3108         lib.bindSymbol_stdcall(gnutls_error_to_alert, "gnutls_error_to_alert");
3109         lib.bindSymbol_stdcall(gnutls_perror, "gnutls_perror");
3110         lib.bindSymbol_stdcall(gnutls_strerror, "gnutls_strerror");
3111         lib.bindSymbol_stdcall(gnutls_strerror_name, "gnutls_strerror_name");
3112         lib.bindSymbol_stdcall(gnutls_handshake_set_private_extensions, "gnutls_handshake_set_private_extensions");
3113         lib.bindSymbol_stdcall(gnutls_handshake_set_random, "gnutls_handshake_set_random");
3114         lib.bindSymbol_stdcall(gnutls_handshake_get_last_out, "gnutls_handshake_get_last_out");
3115         lib.bindSymbol_stdcall(gnutls_handshake_get_last_in, "gnutls_handshake_get_last_in");
3116         lib.bindSymbol_stdcall(gnutls_heartbeat_ping, "gnutls_heartbeat_ping");
3117         lib.bindSymbol_stdcall(gnutls_heartbeat_pong, "gnutls_heartbeat_pong");
3118         lib.bindSymbol_stdcall(gnutls_record_set_timeout, "gnutls_record_set_timeout");
3119         lib.bindSymbol_stdcall(gnutls_record_disable_padding, "gnutls_record_disable_padding");
3120         lib.bindSymbol_stdcall(gnutls_record_cork, "gnutls_record_cork");
3121         lib.bindSymbol_stdcall(gnutls_record_uncork, "gnutls_record_uncork");
3122         lib.bindSymbol_stdcall(gnutls_record_discard_queued, "gnutls_record_discard_queued");
3123         lib.bindSymbol_stdcall(gnutls_record_get_state, "gnutls_record_get_state");
3124         lib.bindSymbol_stdcall(gnutls_record_set_state, "gnutls_record_set_state");
3125         lib.bindSymbol_stdcall(gnutls_range_split, "gnutls_range_split");
3126         lib.bindSymbol_stdcall(gnutls_record_send, "gnutls_record_send");
3127 
3128         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
3129             lib.bindSymbol_stdcall(gnutls_record_send2, "gnutls_record_send2");
3130 
3131         lib.bindSymbol_stdcall(gnutls_record_send_range, "gnutls_record_send_range");
3132         lib.bindSymbol_stdcall(gnutls_record_recv, "gnutls_record_recv");
3133         lib.bindSymbol_stdcall(gnutls_record_recv_packet, "gnutls_record_recv_packet");
3134         lib.bindSymbol_stdcall(gnutls_packet_get, "gnutls_packet_get");
3135         lib.bindSymbol_stdcall(gnutls_packet_deinit, "gnutls_packet_deinit");
3136         lib.bindSymbol_stdcall(gnutls_record_recv_seq, "gnutls_record_recv_seq");
3137         lib.bindSymbol_stdcall(gnutls_record_overhead_size, "gnutls_record_overhead_size");
3138         lib.bindSymbol_stdcall(gnutls_est_record_overhead_size, "gnutls_est_record_overhead_size");
3139         lib.bindSymbol_stdcall(gnutls_session_enable_compatibility_mode, "gnutls_session_enable_compatibility_mode");
3140         lib.bindSymbol_stdcall(gnutls_record_can_use_length_hiding, "gnutls_record_can_use_length_hiding");
3141         lib.bindSymbol_stdcall(gnutls_record_get_direction, "gnutls_record_get_direction");
3142         lib.bindSymbol_stdcall(gnutls_record_get_max_size, "gnutls_record_get_max_size");
3143         lib.bindSymbol_stdcall(gnutls_record_set_max_size, "gnutls_record_set_max_size");
3144 
3145         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_8)
3146             lib.bindSymbol_stdcall(gnutls_record_set_max_recv_size, "gnutls_record_set_max_recv_size");
3147 
3148         lib.bindSymbol_stdcall(gnutls_record_check_pending, "gnutls_record_check_pending");
3149         lib.bindSymbol_stdcall(gnutls_record_check_corked, "gnutls_record_check_corked");
3150 
3151 
3152         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_4)
3153             lib.bindSymbol_stdcall(gnutls_record_set_max_early_data_size, "gnutls_record_set_max_early_data_size");
3154 
3155         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_5)
3156         {
3157             lib.bindSymbol_stdcall(gnutls_record_get_max_early_data_size, "gnutls_record_get_max_early_data_size");
3158             lib.bindSymbol_stdcall(gnutls_record_send_early_data, "gnutls_record_send_early_data");
3159             lib.bindSymbol_stdcall(gnutls_record_recv_early_data, "gnutls_record_recv_early_data");
3160         }
3161 
3162         lib.bindSymbol_stdcall(gnutls_session_force_valid, "gnutls_session_force_valid");
3163         lib.bindSymbol_stdcall(gnutls_prf, "gnutls_prf");
3164         lib.bindSymbol_stdcall(gnutls_prf_rfc5705, "gnutls_prf_rfc5705");
3165 
3166         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_8)
3167             lib.bindSymbol_stdcall(gnutls_prf_early, "gnutls_prf_early");
3168 
3169         lib.bindSymbol_stdcall(gnutls_prf_raw, "gnutls_prf_raw");
3170         lib.bindSymbol_stdcall(gnutls_server_name_set, "gnutls_server_name_set");
3171         lib.bindSymbol_stdcall(gnutls_server_name_get, "gnutls_server_name_get");
3172         lib.bindSymbol_stdcall(gnutls_heartbeat_get_timeout, "gnutls_heartbeat_get_timeout");
3173         lib.bindSymbol_stdcall(gnutls_heartbeat_set_timeouts, "gnutls_heartbeat_set_timeouts");
3174         lib.bindSymbol_stdcall(gnutls_heartbeat_enable, "gnutls_heartbeat_enable");
3175         lib.bindSymbol_stdcall(gnutls_heartbeat_allowed, "gnutls_heartbeat_allowed");
3176         lib.bindSymbol_stdcall(gnutls_safe_renegotiation_status, "gnutls_safe_renegotiation_status");
3177         lib.bindSymbol_stdcall(gnutls_session_ext_master_secret_status, "gnutls_session_ext_master_secret_status");
3178         lib.bindSymbol_stdcall(gnutls_session_etm_status, "gnutls_session_etm_status");
3179         lib.bindSymbol_stdcall(gnutls_session_get_flags, "gnutls_session_get_flags");
3180         lib.bindSymbol_stdcall(gnutls_supplemental_get_name, "gnutls_supplemental_get_name");
3181         lib.bindSymbol_stdcall(gnutls_session_ticket_key_generate, "gnutls_session_ticket_key_generate");
3182         lib.bindSymbol_stdcall(gnutls_session_ticket_enable_client, "gnutls_session_ticket_enable_client");
3183         lib.bindSymbol_stdcall(gnutls_session_ticket_enable_server, "gnutls_session_ticket_enable_server");
3184 
3185         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
3186             lib.bindSymbol_stdcall(gnutls_session_ticket_send, "gnutls_session_ticket_send");
3187 
3188         lib.bindSymbol_stdcall(gnutls_srtp_set_profile, "gnutls_srtp_set_profile");
3189         lib.bindSymbol_stdcall(gnutls_srtp_set_profile_direct, "gnutls_srtp_set_profile_direct");
3190         lib.bindSymbol_stdcall(gnutls_srtp_get_selected_profile, "gnutls_srtp_get_selected_profile");
3191         lib.bindSymbol_stdcall(gnutls_srtp_get_profile_name, "gnutls_srtp_get_profile_name");
3192         lib.bindSymbol_stdcall(gnutls_srtp_get_profile_id, "gnutls_srtp_get_profile_id");
3193         lib.bindSymbol_stdcall(gnutls_srtp_get_keys, "gnutls_srtp_get_keys");
3194         lib.bindSymbol_stdcall(gnutls_srtp_set_mki, "gnutls_srtp_set_mki");
3195         lib.bindSymbol_stdcall(gnutls_srtp_get_mki, "gnutls_srtp_get_mki");
3196         lib.bindSymbol_stdcall(gnutls_alpn_get_selected_protocol, "gnutls_alpn_get_selected_protocol");
3197         lib.bindSymbol_stdcall(gnutls_alpn_set_protocols, "gnutls_alpn_set_protocols");
3198         lib.bindSymbol_stdcall(gnutls_key_generate, "gnutls_key_generate");
3199         lib.bindSymbol_stdcall(gnutls_priority_init, "gnutls_priority_init");
3200 
3201         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
3202             lib.bindSymbol_stdcall(gnutls_priority_init2, "gnutls_priority_init2");
3203 
3204         lib.bindSymbol_stdcall(gnutls_priority_deinit, "gnutls_priority_deinit");
3205         lib.bindSymbol_stdcall(gnutls_priority_get_cipher_suite_index, "gnutls_priority_get_cipher_suite_index");
3206         lib.bindSymbol_stdcall(gnutls_priority_string_list, "gnutls_priority_string_list");
3207         lib.bindSymbol_stdcall(gnutls_priority_set, "gnutls_priority_set");
3208         lib.bindSymbol_stdcall(gnutls_priority_set_direct, "gnutls_priority_set_direct");
3209         lib.bindSymbol_stdcall(gnutls_priority_certificate_type_list, "gnutls_priority_certificate_type_list");
3210 
3211         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_4)
3212             lib.bindSymbol_stdcall(gnutls_priority_certificate_type_list2, "gnutls_priority_certificate_type_list2");
3213 
3214         lib.bindSymbol_stdcall(gnutls_priority_sign_list, "gnutls_priority_sign_list");
3215         lib.bindSymbol_stdcall(gnutls_priority_protocol_list, "gnutls_priority_protocol_list");
3216         lib.bindSymbol_stdcall(gnutls_priority_ecc_curve_list, "gnutls_priority_ecc_curve_list");
3217         lib.bindSymbol_stdcall(gnutls_priority_group_list, "gnutls_priority_group_list");
3218         lib.bindSymbol_stdcall(gnutls_priority_kx_list, "gnutls_priority_kx_list");
3219         lib.bindSymbol_stdcall(gnutls_priority_cipher_list, "gnutls_priority_cipher_list");
3220         lib.bindSymbol_stdcall(gnutls_priority_mac_list, "gnutls_priority_mac_list");
3221 
3222         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_9)
3223             lib.bindSymbol_stdcall(gnutls_get_system_config_file, "gnutls_get_system_config_file");
3224 
3225         lib.bindSymbol_stdcall(gnutls_set_default_priority, "gnutls_set_default_priority");
3226 
3227         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
3228             lib.bindSymbol_stdcall(gnutls_set_default_priority_append, "gnutls_set_default_priority_append");
3229 
3230         lib.bindSymbol_stdcall(gnutls_cipher_suite_get_name, "gnutls_cipher_suite_get_name");
3231         lib.bindSymbol_stdcall(gnutls_protocol_get_version, "gnutls_protocol_get_version");
3232         lib.bindSymbol_stdcall(gnutls_protocol_get_name, "gnutls_protocol_get_name");
3233         lib.bindSymbol_stdcall(gnutls_session_set_data, "gnutls_session_set_data");
3234         lib.bindSymbol_stdcall(gnutls_session_get_data, "gnutls_session_get_data");
3235         lib.bindSymbol_stdcall(gnutls_session_get_data2, "gnutls_session_get_data2");
3236         lib.bindSymbol_stdcall(gnutls_session_get_random, "gnutls_session_get_random");
3237         lib.bindSymbol_stdcall(gnutls_session_get_master_secret, "gnutls_session_get_master_secret");
3238         lib.bindSymbol_stdcall(gnutls_session_get_desc, "gnutls_session_get_desc");
3239         lib.bindSymbol_stdcall(gnutls_session_set_verify_function, "gnutls_session_set_verify_function");
3240         lib.bindSymbol_stdcall(gnutls_session_set_verify_cert, "gnutls_session_set_verify_cert");
3241         lib.bindSymbol_stdcall(gnutls_session_set_verify_cert2, "gnutls_session_set_verify_cert2");
3242         lib.bindSymbol_stdcall(gnutls_session_get_verify_cert_status, "gnutls_session_get_verify_cert_status");
3243         lib.bindSymbol_stdcall(gnutls_session_set_premaster, "gnutls_session_set_premaster");
3244         lib.bindSymbol_stdcall(gnutls_session_get_id, "gnutls_session_get_id");
3245         lib.bindSymbol_stdcall(gnutls_session_get_id2, "gnutls_session_get_id2");
3246         lib.bindSymbol_stdcall(gnutls_session_set_id, "gnutls_session_set_id");
3247         lib.bindSymbol_stdcall(gnutls_session_channel_binding, "gnutls_session_channel_binding");
3248         lib.bindSymbol_stdcall(gnutls_session_is_resumed, "gnutls_session_is_resumed");
3249         lib.bindSymbol_stdcall(gnutls_session_resumption_requested, "gnutls_session_resumption_requested");
3250         lib.bindSymbol_stdcall(gnutls_db_set_cache_expiration, "gnutls_db_set_cache_expiration");
3251         lib.bindSymbol_stdcall(gnutls_db_get_default_cache_expiration, "gnutls_db_get_default_cache_expiration");
3252         lib.bindSymbol_stdcall(gnutls_db_remove_session, "gnutls_db_remove_session");
3253         lib.bindSymbol_stdcall(gnutls_db_set_retrieve_function, "gnutls_db_set_retrieve_function");
3254         lib.bindSymbol_stdcall(gnutls_db_set_remove_function, "gnutls_db_set_remove_function");
3255         lib.bindSymbol_stdcall(gnutls_db_set_store_function, "gnutls_db_set_store_function");
3256         lib.bindSymbol_stdcall(gnutls_db_set_ptr, "gnutls_db_set_ptr");
3257         lib.bindSymbol_stdcall(gnutls_db_get_ptr, "gnutls_db_get_ptr");
3258         lib.bindSymbol_stdcall(gnutls_db_check_entry, "gnutls_db_check_entry");
3259         lib.bindSymbol_stdcall(gnutls_db_check_entry_time, "gnutls_db_check_entry_time");
3260 
3261         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_5)
3262             lib.bindSymbol_stdcall(gnutls_db_check_entry_expire_time, "gnutls_db_check_entry_expire_time");
3263 
3264         lib.bindSymbol_stdcall(gnutls_handshake_set_hook_function, "gnutls_handshake_set_hook_function");
3265         lib.bindSymbol_stdcall(gnutls_handshake_set_post_client_hello_function, "gnutls_handshake_set_post_client_hello_function");
3266         lib.bindSymbol_stdcall(gnutls_handshake_set_max_packet_length, "gnutls_handshake_set_max_packet_length");
3267         lib.bindSymbol_stdcall(gnutls_check_version, "gnutls_check_version");
3268         lib.bindSymbol_stdcall(gnutls_credentials_clear, "gnutls_credentials_clear");
3269         lib.bindSymbol_stdcall(gnutls_credentials_set, "gnutls_credentials_set");
3270         lib.bindSymbol_stdcall(gnutls_credentials_get, "gnutls_credentials_get");
3271         lib.bindSymbol_stdcall(gnutls_anon_free_server_credentials, "gnutls_anon_free_server_credentials");
3272         lib.bindSymbol_stdcall(gnutls_anon_allocate_server_credentials, "gnutls_anon_allocate_server_credentials");
3273         lib.bindSymbol_stdcall(gnutls_anon_set_server_dh_params, "gnutls_anon_set_server_dh_params");
3274 
3275         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_6)
3276             lib.bindSymbol_stdcall(gnutls_anon_set_server_known_dh_params, "gnutls_anon_set_server_known_dh_params");
3277 
3278         lib.bindSymbol_stdcall(gnutls_anon_set_server_params_function, "gnutls_anon_set_server_params_function");
3279         lib.bindSymbol_stdcall(gnutls_anon_free_client_credentials, "gnutls_anon_free_client_credentials");
3280         lib.bindSymbol_stdcall(gnutls_anon_allocate_client_credentials, "gnutls_anon_allocate_client_credentials");
3281         lib.bindSymbol_stdcall(gnutls_certificate_free_credentials, "gnutls_certificate_free_credentials");
3282         lib.bindSymbol_stdcall(gnutls_certificate_allocate_credentials, "gnutls_certificate_allocate_credentials");
3283         lib.bindSymbol_stdcall(gnutls_certificate_get_issuer, "gnutls_certificate_get_issuer");
3284         lib.bindSymbol_stdcall(gnutls_certificate_get_crt_raw, "gnutls_certificate_get_crt_raw");
3285         lib.bindSymbol_stdcall(gnutls_certificate_free_keys, "gnutls_certificate_free_keys");
3286         lib.bindSymbol_stdcall(gnutls_certificate_free_cas, "gnutls_certificate_free_cas");
3287         lib.bindSymbol_stdcall(gnutls_certificate_free_ca_names, "gnutls_certificate_free_ca_names");
3288         lib.bindSymbol_stdcall(gnutls_certificate_free_crls, "gnutls_certificate_free_crls");
3289         lib.bindSymbol_stdcall(gnutls_certificate_set_dh_params, "gnutls_certificate_set_dh_params");
3290 
3291         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_6)
3292             lib.bindSymbol_stdcall(gnutls_certificate_set_known_dh_params, "gnutls_certificate_set_known_dh_params");
3293 
3294         lib.bindSymbol_stdcall(gnutls_certificate_set_verify_flags, "gnutls_certificate_set_verify_flags");
3295         lib.bindSymbol_stdcall(gnutls_certificate_get_verify_flags, "gnutls_certificate_get_verify_flags");
3296         lib.bindSymbol_stdcall(gnutls_certificate_set_flags, "gnutls_certificate_set_flags");
3297         lib.bindSymbol_stdcall(gnutls_certificate_set_verify_limits, "gnutls_certificate_set_verify_limits");
3298         lib.bindSymbol_stdcall(gnutls_certificate_set_x509_system_trust, "gnutls_certificate_set_x509_system_trust");
3299         lib.bindSymbol_stdcall(gnutls_certificate_set_x509_trust_file, "gnutls_certificate_set_x509_trust_file");
3300         lib.bindSymbol_stdcall(gnutls_certificate_set_x509_trust_dir, "gnutls_certificate_set_x509_trust_dir");
3301         lib.bindSymbol_stdcall(gnutls_certificate_set_x509_trust_mem, "gnutls_certificate_set_x509_trust_mem");
3302         lib.bindSymbol_stdcall(gnutls_certificate_set_x509_crl_file, "gnutls_certificate_set_x509_crl_file");
3303         lib.bindSymbol_stdcall(gnutls_certificate_set_x509_crl_mem, "gnutls_certificate_set_x509_crl_mem");
3304         lib.bindSymbol_stdcall(gnutls_certificate_set_x509_key_file, "gnutls_certificate_set_x509_key_file");
3305         lib.bindSymbol_stdcall(gnutls_certificate_set_x509_key_file2, "gnutls_certificate_set_x509_key_file2");
3306         lib.bindSymbol_stdcall(gnutls_certificate_set_x509_key_mem, "gnutls_certificate_set_x509_key_mem");
3307         lib.bindSymbol_stdcall(gnutls_certificate_set_x509_key_mem2, "gnutls_certificate_set_x509_key_mem2");
3308         lib.bindSymbol_stdcall(gnutls_certificate_send_x509_rdn_sequence, "gnutls_certificate_send_x509_rdn_sequence");
3309         lib.bindSymbol_stdcall(gnutls_certificate_set_x509_simple_pkcs12_file, "gnutls_certificate_set_x509_simple_pkcs12_file");
3310         lib.bindSymbol_stdcall(gnutls_certificate_set_x509_simple_pkcs12_mem, "gnutls_certificate_set_x509_simple_pkcs12_mem");
3311         lib.bindSymbol_stdcall(gnutls_certificate_set_x509_key, "gnutls_certificate_set_x509_key");
3312         lib.bindSymbol_stdcall(gnutls_certificate_set_x509_trust, "gnutls_certificate_set_x509_trust");
3313         lib.bindSymbol_stdcall(gnutls_certificate_set_x509_crl, "gnutls_certificate_set_x509_crl");
3314         lib.bindSymbol_stdcall(gnutls_certificate_get_x509_key, "gnutls_certificate_get_x509_key");
3315         lib.bindSymbol_stdcall(gnutls_certificate_get_x509_crt, "gnutls_certificate_get_x509_crt");
3316         lib.bindSymbol_stdcall(gnutls_certificate_set_ocsp_status_request_function, "gnutls_certificate_set_ocsp_status_request_function");
3317 
3318         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_5)
3319             lib.bindSymbol_stdcall(gnutls_certificate_set_ocsp_status_request_function2, "gnutls_certificate_set_ocsp_status_request_function2");
3320 
3321         lib.bindSymbol_stdcall(gnutls_certificate_set_ocsp_status_request_file, "gnutls_certificate_set_ocsp_status_request_file");
3322 
3323         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
3324         {
3325             lib.bindSymbol_stdcall(gnutls_certificate_set_ocsp_status_request_file2, "gnutls_certificate_set_ocsp_status_request_file2");
3326             lib.bindSymbol_stdcall(gnutls_certificate_set_ocsp_status_request_mem, "gnutls_certificate_set_ocsp_status_request_mem");
3327             lib.bindSymbol_stdcall(gnutls_certificate_get_ocsp_expiration, "gnutls_certificate_get_ocsp_expiration");
3328         }
3329 
3330         lib.bindSymbol_stdcall(gnutls_ocsp_status_request_enable_client, "gnutls_ocsp_status_request_enable_client");
3331         lib.bindSymbol_stdcall(gnutls_ocsp_status_request_get, "gnutls_ocsp_status_request_get");
3332         lib.bindSymbol_stdcall(gnutls_ocsp_status_request_is_checked, "gnutls_ocsp_status_request_is_checked");
3333 
3334         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
3335             lib.bindSymbol_stdcall(gnutls_ocsp_status_request_get2, "gnutls_ocsp_status_request_get2");
3336 
3337         lib.bindSymbol_stdcall(gnutls_certificate_set_rawpk_key_mem, "gnutls_certificate_set_rawpk_key_mem");
3338         lib.bindSymbol_stdcall(gnutls_certificate_set_rawpk_key_file, "gnutls_certificate_set_rawpk_key_file");
3339         lib.bindSymbol_stdcall(gnutls_global_init, "gnutls_global_init");
3340         lib.bindSymbol_stdcall(gnutls_global_deinit, "gnutls_global_deinit");
3341         lib.bindSymbol_stdcall(gnutls_global_set_mutex, "gnutls_global_set_mutex");
3342         lib.bindSymbol_stdcall(gnutls_global_set_time_function, "gnutls_global_set_time_function");
3343         lib.bindSymbol_stdcall(gnutls_memset, "gnutls_memset");
3344         lib.bindSymbol_stdcall(gnutls_memcmp, "gnutls_memcmp");
3345         lib.bindSymbol_stdcall(gnutls_global_set_log_function, "gnutls_global_set_log_function");
3346         lib.bindSymbol_stdcall(gnutls_global_set_audit_log_function, "gnutls_global_set_audit_log_function");
3347         lib.bindSymbol_stdcall(gnutls_global_set_log_level, "gnutls_global_set_log_level");
3348 
3349         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_13)
3350         {
3351             lib.bindSymbol_stdcall(gnutls_session_get_keylog_function, "gnutls_session_get_keylog_function");
3352             lib.bindSymbol_stdcall(gnutls_session_set_keylog_function, "gnutls_session_set_keylog_function");
3353         }
3354 
3355         lib.bindSymbol_stdcall(gnutls_dh_params_init, "gnutls_dh_params_init");
3356         lib.bindSymbol_stdcall(gnutls_dh_params_deinit, "gnutls_dh_params_deinit");
3357         lib.bindSymbol_stdcall(gnutls_dh_params_import_raw, "gnutls_dh_params_import_raw");
3358         lib.bindSymbol_stdcall(gnutls_dh_params_import_dsa, "gnutls_dh_params_import_dsa");
3359         lib.bindSymbol_stdcall(gnutls_dh_params_import_raw2, "gnutls_dh_params_import_raw2");
3360 
3361         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_8)
3362             lib.bindSymbol_stdcall(gnutls_dh_params_import_raw3, "gnutls_dh_params_import_raw3");
3363 
3364         lib.bindSymbol_stdcall(gnutls_dh_params_import_pkcs3, "gnutls_dh_params_import_pkcs3");
3365         lib.bindSymbol_stdcall(gnutls_dh_params_generate2, "gnutls_dh_params_generate2");
3366         lib.bindSymbol_stdcall(gnutls_dh_params_export_pkcs3, "gnutls_dh_params_export_pkcs3");
3367         lib.bindSymbol_stdcall(gnutls_dh_params_export2_pkcs3, "gnutls_dh_params_export2_pkcs3");
3368         lib.bindSymbol_stdcall(gnutls_dh_params_export_raw, "gnutls_dh_params_export_raw");
3369         lib.bindSymbol_stdcall(gnutls_dh_params_cpy, "gnutls_dh_params_cpy");
3370         lib.bindSymbol_stdcall(gnutls_system_recv_timeout, "gnutls_system_recv_timeout");
3371         lib.bindSymbol_stdcall(gnutls_transport_set_int2, "gnutls_transport_set_int2");
3372         lib.bindSymbol_stdcall(gnutls_transport_get_int2, "gnutls_transport_get_int2");
3373         lib.bindSymbol_stdcall(gnutls_transport_get_int, "gnutls_transport_get_int");
3374         lib.bindSymbol_stdcall(gnutls_transport_set_ptr, "gnutls_transport_set_ptr");
3375         lib.bindSymbol_stdcall(gnutls_transport_set_ptr2, "gnutls_transport_set_ptr2");
3376         lib.bindSymbol_stdcall(gnutls_transport_get_ptr, "gnutls_transport_get_ptr");
3377         lib.bindSymbol_stdcall(gnutls_transport_get_ptr2, "gnutls_transport_get_ptr2");
3378         lib.bindSymbol_stdcall(gnutls_transport_set_vec_push_function, "gnutls_transport_set_vec_push_function");
3379         lib.bindSymbol_stdcall(gnutls_transport_set_push_function, "gnutls_transport_set_push_function");
3380         lib.bindSymbol_stdcall(gnutls_transport_set_pull_function, "gnutls_transport_set_pull_function");
3381         lib.bindSymbol_stdcall(gnutls_transport_set_pull_timeout_function, "gnutls_transport_set_pull_timeout_function");
3382         lib.bindSymbol_stdcall(gnutls_transport_set_errno_function, "gnutls_transport_set_errno_function");
3383         lib.bindSymbol_stdcall(gnutls_transport_set_errno, "gnutls_transport_set_errno");
3384         lib.bindSymbol_stdcall(gnutls_session_set_ptr, "gnutls_session_set_ptr");
3385         lib.bindSymbol_stdcall(gnutls_session_get_ptr, "gnutls_session_get_ptr");
3386         lib.bindSymbol_stdcall(gnutls_openpgp_send_cert, "gnutls_openpgp_send_cert");
3387         lib.bindSymbol_stdcall(gnutls_fingerprint, "gnutls_fingerprint");
3388         lib.bindSymbol_stdcall(gnutls_random_art, "gnutls_random_art");
3389 
3390         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_9)
3391         {
3392             lib.bindSymbol_stdcall(gnutls_idna_map, "gnutls_idna_map");
3393             lib.bindSymbol_stdcall(gnutls_idna_reverse_map, "gnutls_idna_reverse_map");
3394         }
3395 
3396         lib.bindSymbol_stdcall(gnutls_srp_free_client_credentials, "gnutls_srp_free_client_credentials");
3397         lib.bindSymbol_stdcall(gnutls_srp_allocate_client_credentials, "gnutls_srp_allocate_client_credentials");
3398         lib.bindSymbol_stdcall(gnutls_srp_set_client_credentials, "gnutls_srp_set_client_credentials");
3399         lib.bindSymbol_stdcall(gnutls_srp_free_server_credentials, "gnutls_srp_free_server_credentials");
3400         lib.bindSymbol_stdcall(gnutls_srp_allocate_server_credentials, "gnutls_srp_allocate_server_credentials");
3401         lib.bindSymbol_stdcall(gnutls_srp_set_server_credentials_file, "gnutls_srp_set_server_credentials_file");
3402         lib.bindSymbol_stdcall(gnutls_srp_server_get_username, "gnutls_srp_server_get_username");
3403         lib.bindSymbol_stdcall(gnutls_srp_set_prime_bits, "gnutls_srp_set_prime_bits");
3404         lib.bindSymbol_stdcall(gnutls_srp_verifier, "gnutls_srp_verifier");
3405         lib.bindSymbol_stdcall(gnutls_srp_set_server_credentials_function, "gnutls_srp_set_server_credentials_function");
3406         lib.bindSymbol_stdcall(gnutls_srp_set_client_credentials_function, "gnutls_srp_set_client_credentials_function");
3407         lib.bindSymbol_stdcall(gnutls_srp_base64_encode, "gnutls_srp_base64_encode");
3408         lib.bindSymbol_stdcall(gnutls_srp_base64_encode2, "gnutls_srp_base64_encode2");
3409         lib.bindSymbol_stdcall(gnutls_srp_base64_decode, "gnutls_srp_base64_decode");
3410         lib.bindSymbol_stdcall(gnutls_srp_base64_decode2, "gnutls_srp_base64_decode2");
3411         lib.bindSymbol_stdcall(gnutls_srp_set_server_fake_salt_seed, "gnutls_srp_set_server_fake_salt_seed");
3412         lib.bindSymbol_stdcall(gnutls_psk_free_client_credentials, "gnutls_psk_free_client_credentials");
3413         lib.bindSymbol_stdcall(gnutls_psk_allocate_client_credentials, "gnutls_psk_allocate_client_credentials");
3414         lib.bindSymbol_stdcall(gnutls_psk_set_client_credentials, "gnutls_psk_set_client_credentials");
3415         lib.bindSymbol_stdcall(gnutls_psk_free_server_credentials, "gnutls_psk_free_server_credentials");
3416         lib.bindSymbol_stdcall(gnutls_psk_allocate_server_credentials, "gnutls_psk_allocate_server_credentials");
3417         lib.bindSymbol_stdcall(gnutls_psk_set_server_credentials_file, "gnutls_psk_set_server_credentials_file");
3418         lib.bindSymbol_stdcall(gnutls_psk_set_server_credentials_hint, "gnutls_psk_set_server_credentials_hint");
3419         lib.bindSymbol_stdcall(gnutls_psk_server_get_username, "gnutls_psk_server_get_username");
3420         lib.bindSymbol_stdcall(gnutls_psk_client_get_hint, "gnutls_psk_client_get_hint");
3421         lib.bindSymbol_stdcall(gnutls_psk_set_server_credentials_function, "gnutls_psk_set_server_credentials_function");
3422         lib.bindSymbol_stdcall(gnutls_psk_set_client_credentials_function, "gnutls_psk_set_client_credentials_function");
3423 
3424         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_13)
3425         {
3426             lib.bindSymbol_stdcall(gnutls_psk_set_client_credentials2, "gnutls_psk_set_client_credentials2");
3427             lib.bindSymbol_stdcall(gnutls_psk_server_get_username2, "gnutls_psk_server_get_username2");
3428             lib.bindSymbol_stdcall(gnutls_psk_set_server_credentials_function2, "gnutls_psk_set_server_credentials_function2");
3429             lib.bindSymbol_stdcall(gnutls_psk_set_client_credentials_function2, "gnutls_psk_set_client_credentials_function2");
3430         }
3431 
3432         lib.bindSymbol_stdcall(gnutls_hex_encode, "gnutls_hex_encode");
3433         lib.bindSymbol_stdcall(gnutls_hex_decode, "gnutls_hex_decode");
3434         lib.bindSymbol_stdcall(gnutls_hex_encode2, "gnutls_hex_encode2");
3435         lib.bindSymbol_stdcall(gnutls_hex_decode2, "gnutls_hex_decode2");
3436         lib.bindSymbol_stdcall(gnutls_psk_set_server_dh_params, "gnutls_psk_set_server_dh_params");
3437 
3438         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_6)
3439             lib.bindSymbol_stdcall(gnutls_psk_set_server_known_dh_params, "gnutls_psk_set_server_known_dh_params");
3440 
3441         lib.bindSymbol_stdcall(gnutls_psk_set_server_params_function, "gnutls_psk_set_server_params_function");
3442         lib.bindSymbol_stdcall(gnutls_auth_get_type, "gnutls_auth_get_type");
3443         lib.bindSymbol_stdcall(gnutls_auth_server_get_type, "gnutls_auth_server_get_type");
3444         lib.bindSymbol_stdcall(gnutls_auth_client_get_type, "gnutls_auth_client_get_type");
3445         lib.bindSymbol_stdcall(gnutls_dh_set_prime_bits, "gnutls_dh_set_prime_bits");
3446         lib.bindSymbol_stdcall(gnutls_dh_get_secret_bits, "gnutls_dh_get_secret_bits");
3447         lib.bindSymbol_stdcall(gnutls_dh_get_peers_public_bits, "gnutls_dh_get_peers_public_bits");
3448         lib.bindSymbol_stdcall(gnutls_dh_get_prime_bits, "gnutls_dh_get_prime_bits");
3449         lib.bindSymbol_stdcall(gnutls_dh_get_group, "gnutls_dh_get_group");
3450         lib.bindSymbol_stdcall(gnutls_dh_get_pubkey, "gnutls_dh_get_pubkey");
3451         lib.bindSymbol_stdcall(gnutls_certificate_set_retrieve_function, "gnutls_certificate_set_retrieve_function");
3452         lib.bindSymbol_stdcall(gnutls_certificate_set_verify_function, "gnutls_certificate_set_verify_function");
3453         lib.bindSymbol_stdcall(gnutls_certificate_server_set_request, "gnutls_certificate_server_set_request");
3454         lib.bindSymbol_stdcall(gnutls_certificate_get_peers, "gnutls_certificate_get_peers");
3455         lib.bindSymbol_stdcall(gnutls_certificate_get_ours, "gnutls_certificate_get_ours");
3456         lib.bindSymbol_stdcall(gnutls_certificate_get_peers_subkey_id, "gnutls_certificate_get_peers_subkey_id");
3457         lib.bindSymbol_stdcall(gnutls_certificate_activation_time_peers, "gnutls_certificate_activation_time_peers");
3458         lib.bindSymbol_stdcall(gnutls_certificate_expiration_time_peers, "gnutls_certificate_expiration_time_peers");
3459         lib.bindSymbol_stdcall(gnutls_certificate_client_get_request_status, "gnutls_certificate_client_get_request_status");
3460         lib.bindSymbol_stdcall(gnutls_certificate_verify_peers2, "gnutls_certificate_verify_peers2");
3461         lib.bindSymbol_stdcall(gnutls_certificate_verify_peers3, "gnutls_certificate_verify_peers3");
3462         lib.bindSymbol_stdcall(gnutls_certificate_verify_peers, "gnutls_certificate_verify_peers");
3463         lib.bindSymbol_stdcall(gnutls_certificate_verification_status_print, "gnutls_certificate_verification_status_print");
3464         lib.bindSymbol_stdcall(gnutls_pem_base64_encode, "gnutls_pem_base64_encode");
3465         lib.bindSymbol_stdcall(gnutls_pem_base64_decode, "gnutls_pem_base64_decode");
3466         lib.bindSymbol_stdcall(gnutls_pem_base64_encode2, "gnutls_pem_base64_encode2");
3467         lib.bindSymbol_stdcall(gnutls_pem_base64_decode2, "gnutls_pem_base64_decode2");
3468 
3469         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_0)
3470         {
3471             lib.bindSymbol_stdcall(gnutls_base64_encode2, "gnutls_base64_encode2");
3472             lib.bindSymbol_stdcall(gnutls_base64_decode2, "gnutls_base64_decode2");
3473         }
3474 
3475         lib.bindSymbol_stdcall(gnutls_certificate_set_params_function, "gnutls_certificate_set_params_function");
3476         lib.bindSymbol_stdcall(gnutls_anon_set_params_function, "gnutls_anon_set_params_function");
3477         lib.bindSymbol_stdcall(gnutls_psk_set_params_function, "gnutls_psk_set_params_function");
3478         lib.bindSymbol_stdcall(gnutls_hex2bin, "gnutls_hex2bin");
3479         lib.bindSymbol_stdcall(gnutls_tdb_init, "gnutls_tdb_init");
3480         lib.bindSymbol_stdcall(gnutls_tdb_set_store_func, "gnutls_tdb_set_store_func");
3481         lib.bindSymbol_stdcall(gnutls_tdb_set_store_commitment_func, "gnutls_tdb_set_store_commitment_func");
3482         lib.bindSymbol_stdcall(gnutls_tdb_set_verify_func, "gnutls_tdb_set_verify_func");
3483         lib.bindSymbol_stdcall(gnutls_tdb_deinit, "gnutls_tdb_deinit");
3484         lib.bindSymbol_stdcall(gnutls_verify_stored_pubkey, "gnutls_verify_stored_pubkey");
3485         lib.bindSymbol_stdcall(gnutls_store_commitment, "gnutls_store_commitment");
3486         lib.bindSymbol_stdcall(gnutls_store_pubkey, "gnutls_store_pubkey");
3487         lib.bindSymbol_stdcall(gnutls_load_file, "gnutls_load_file");
3488         lib.bindSymbol_stdcall(gnutls_url_is_supported, "gnutls_url_is_supported");
3489         lib.bindSymbol_stdcall(gnutls_certificate_set_pin_function, "gnutls_certificate_set_pin_function");
3490         lib.bindSymbol_stdcall(gnutls_buffer_append_data, "gnutls_buffer_append_data");
3491 
3492         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_7)
3493             lib.bindSymbol_stdcall(gnutls_utf8_password_normalize, "gnutls_utf8_password_normalize");
3494 
3495         lib.bindSymbol_stdcall(gnutls_ext_set_data, "gnutls_ext_set_data");
3496         lib.bindSymbol_stdcall(gnutls_ext_get_data, "gnutls_ext_get_data");
3497 
3498         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
3499         {
3500             lib.bindSymbol_stdcall(gnutls_ext_get_current_msg, "gnutls_ext_get_current_msg");
3501             lib.bindSymbol_stdcall(gnutls_ext_raw_parse, "gnutls_ext_raw_parse");
3502         }
3503 
3504         lib.bindSymbol_stdcall(gnutls_ext_register, "gnutls_ext_register");
3505 
3506         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_5)
3507             lib.bindSymbol_stdcall(gnutls_session_ext_register, "gnutls_session_ext_register");
3508 
3509         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_1)
3510             lib.bindSymbol_stdcall(gnutls_ext_get_name, "gnutls_ext_get_name");
3511 
3512         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_14)
3513             lib.bindSymbol_stdcall(gnutls_ext_get_name2, "gnutls_ext_get_name2");
3514 
3515         lib.bindSymbol_stdcall(gnutls_supplemental_register, "gnutls_supplemental_register");
3516 
3517         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_5_5)
3518             lib.bindSymbol_stdcall(gnutls_session_supplemental_register, "gnutls_session_supplemental_register");
3519 
3520         lib.bindSymbol_stdcall(gnutls_supplemental_recv, "gnutls_supplemental_recv");
3521         lib.bindSymbol_stdcall(gnutls_supplemental_send, "gnutls_supplemental_send");
3522 
3523         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_5)
3524         {
3525             lib.bindSymbol_stdcall(gnutls_anti_replay_init, "gnutls_anti_replay_init");
3526             lib.bindSymbol_stdcall(gnutls_anti_replay_deinit, "gnutls_anti_replay_deinit");
3527             lib.bindSymbol_stdcall(gnutls_anti_replay_set_window, "gnutls_anti_replay_set_window");
3528             lib.bindSymbol_stdcall(gnutls_anti_replay_enable, "gnutls_anti_replay_enable");
3529             lib.bindSymbol_stdcall(gnutls_anti_replay_set_add_function, "gnutls_anti_replay_set_add_function");
3530         }
3531 
3532         lib.bindSymbol_stdcall(gnutls_anti_replay_set_ptr, "gnutls_anti_replay_set_ptr");
3533         lib.bindSymbol_stdcall(gnutls_fips140_mode_enabled, "gnutls_fips140_mode_enabled");
3534 
3535         static if (gnuTLSSupport >= GnuTLSSupport.gnutls_3_6_3)
3536             lib.bindSymbol_stdcall(gnutls_fips140_set_mode, "gnutls_fips140_set_mode");
3537 
3538     }
3539 
3540     private mixin template externField(T, string symbol)
3541     {
3542         import std.traits : isFunctionPointer, Parameters, ReturnType;
3543 
3544         mixin("private __gshared T* " ~ symbol ~ "_;");
3545         static if (isFunctionPointer!T)
3546             mixin("ReturnType!T " ~ symbol ~ "(Parameters!T params) { return (*" ~ symbol ~ "_)(params); }");
3547         else
3548             mixin("T " ~ symbol ~ "() { return *" ~ symbol ~ "_; }");
3549     }
3550 }