1# This file is dual licensed under the terms of the Apache License, Version
2# 2.0, and the BSD License. See the LICENSE file in the root of this repository
3# for complete details.
4
5from __future__ import absolute_import, division, print_function
6
7INCLUDES = """
8#include <openssl/bio.h>
9"""
10
11TYPES = """
12typedef ... BIO;
13typedef ... BIO_METHOD;
14"""
15
16FUNCTIONS = """
17int BIO_free(BIO *);
18BIO *BIO_new_file(const char *, const char *);
19BIO *BIO_new_dgram(int, int);
20size_t BIO_ctrl_pending(BIO *);
21int BIO_read(BIO *, void *, int);
22int BIO_gets(BIO *, char *, int);
23int BIO_write(BIO *, const void *, int);
24/* Added in 1.1.0 */
25int BIO_up_ref(BIO *);
26
27BIO *BIO_new(BIO_METHOD *);
28BIO_METHOD *BIO_s_mem(void);
29BIO_METHOD *BIO_s_datagram(void);
30BIO *BIO_new_mem_buf(const void *, int);
31long BIO_set_mem_eof_return(BIO *, int);
32long BIO_get_mem_data(BIO *, char **);
33int BIO_should_read(BIO *);
34int BIO_should_write(BIO *);
35int BIO_should_io_special(BIO *);
36int BIO_should_retry(BIO *);
37int BIO_reset(BIO *);
38void BIO_set_retry_read(BIO *);
39void BIO_clear_retry_flags(BIO *);
40"""
41
42CUSTOMIZATIONS = """
43#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 && !CRYPTOGRAPHY_LIBRESSL_27_OR_GREATER
44int BIO_up_ref(BIO *b) {
45    CRYPTO_add(&b->references, 1, CRYPTO_LOCK_BIO);
46    return 1;
47}
48#endif
49"""
50