Spaces:
Running
Running
/* | |
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. | |
* | |
* Licensed under the OpenSSL license (the "License"). You may not use | |
* this file except in compliance with the License. You can obtain a copy | |
* in the file LICENSE in the source distribution or at | |
* https://www.openssl.org/source/license.html | |
*/ | |
extern "C" { | |
/* There are the classes of BIOs */ | |
/* These are the 'types' of BIOs */ | |
/* | |
* BIO_FILENAME_READ|BIO_CLOSE to open or close on free. | |
* BIO_set_fp(in,stdin,BIO_NOCLOSE); | |
*/ | |
/* | |
* These are used in the following macros and are passed to BIO_ctrl() | |
*/ | |
/* dgram BIO stuff */ | |
/* #ifdef IP_MTU_DISCOVER */ | |
/* #endif */ | |
/* Deliberately outside of OPENSSL_NO_SCTP - used in bss_dgram.c */ | |
/* SCTP stuff */ | |
/* modifiers */ | |
/* | |
* "UPLINK" flag denotes file descriptors provided by application. It | |
* defaults to 0, as most platforms don't require UPLINK interface. | |
*/ | |
/* | |
* This is used with memory BIOs: | |
* BIO_FLAGS_MEM_RDONLY means we shouldn't free up or change the data in any way; | |
* BIO_FLAGS_NONCLEAR_RST means we shouldn't clear data on reset. | |
*/ | |
typedef union bio_addr_st BIO_ADDR; | |
typedef struct bio_addrinfo_st BIO_ADDRINFO; | |
int BIO_get_new_index(void); | |
void BIO_set_flags(BIO *b, int flags); | |
int BIO_test_flags(const BIO *b, int flags); | |
void BIO_clear_flags(BIO *b, int flags); | |
/* These are normally used internally in BIOs */ | |
/* These should be used by the application to tell why we should retry */ | |
/* | |
* The next three are used in conjunction with the BIO_should_io_special() | |
* condition. After this returns true, BIO *BIO_get_retry_BIO(BIO *bio, int | |
* *reason); will walk the BIO stack and return the 'reason' for the special | |
* and the offending BIO. Given a BIO, BIO_get_retry_reason(bio) will return | |
* the code. | |
*/ | |
/* | |
* Returned from the SSL bio when the certificate retrieval code had an error | |
*/ | |
/* Returned from the connect BIO when a connect would have blocked */ | |
/* Returned from the accept BIO when an accept would have blocked */ | |
/* These are passed by the BIO callback */ | |
/* | |
* The callback is called before and after the underling operation, The | |
* BIO_CB_RETURN flag indicates if it is after the call | |
*/ | |
typedef long (*BIO_callback_fn)(BIO *b, int oper, const char *argp, int argi, | |
long argl, long ret); | |
typedef long (*BIO_callback_fn_ex)(BIO *b, int oper, const char *argp, | |
size_t len, int argi, | |
long argl, int ret, size_t *processed); | |
BIO_callback_fn BIO_get_callback(const BIO *b); | |
void BIO_set_callback(BIO *b, BIO_callback_fn callback); | |
BIO_callback_fn_ex BIO_get_callback_ex(const BIO *b); | |
void BIO_set_callback_ex(BIO *b, BIO_callback_fn_ex callback); | |
char *BIO_get_callback_arg(const BIO *b); | |
void BIO_set_callback_arg(BIO *b, char *arg); | |
typedef struct bio_method_st BIO_METHOD; | |
const char *BIO_method_name(const BIO *b); | |
int BIO_method_type(const BIO *b); | |
typedef int BIO_info_cb(BIO *, int, int); | |
typedef BIO_info_cb bio_info_cb; /* backward compatibility */ | |
DEFINE_STACK_OF(BIO) | |
/* Prefix and suffix callback in ASN1 BIO */ | |
typedef int asn1_ps_func (BIO *b, unsigned char **pbuf, int *plen, | |
void *parg); | |
/* SCTP parameter structs */ | |
struct bio_dgram_sctp_sndinfo { | |
uint16_t snd_sid; | |
uint16_t snd_flags; | |
uint32_t snd_ppid; | |
uint32_t snd_context; | |
}; | |
struct bio_dgram_sctp_rcvinfo { | |
uint16_t rcv_sid; | |
uint16_t rcv_ssn; | |
uint16_t rcv_flags; | |
uint32_t rcv_ppid; | |
uint32_t rcv_tsn; | |
uint32_t rcv_cumtsn; | |
uint32_t rcv_context; | |
}; | |
struct bio_dgram_sctp_prinfo { | |
uint16_t pr_policy; | |
uint32_t pr_value; | |
}; | |
/* | |
* #define BIO_CONN_get_param_hostname BIO_ctrl | |
*/ | |
/* # define BIO_C_SET_PROXY_PARAM 103 */ | |
/* # define BIO_C_GET_PROXY_PARAM 121 */ | |
/* IP families we support, for BIO_s_connect() and BIO_s_accept() */ | |
/* Note: the underlying operating system may not support some of them */ | |
/* BIO_s_connect() */ | |
/* BIO_s_accept() */ | |
/* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */ | |
/* Aliases kept for backward compatibility */ | |
/* BIO_s_accept() and BIO_s_connect() */ | |
/* BIO_s_datagram(), BIO_s_fd(), BIO_s_socket(), BIO_s_accept() and BIO_s_connect() */ | |
/* BIO_s_file() */ | |
/* BIO_s_fd() and BIO_s_file() */ | |
/* | |
* name is cast to lose const, but might be better to route through a | |
* function so we can do it safely | |
*/ | |
/* | |
* If you are wondering why this isn't defined, its because CONST_STRICT is | |
* purely a compile-time kludge to allow const to be checked. | |
*/ | |
int BIO_read_filename(BIO *b, const char *name); | |
/* | |
* WARNING WARNING, this ups the reference count on the read bio of the SSL | |
* structure. This is because the ssl read BIO is now pointed to by the | |
* next_bio field in the bio. So when you free the BIO, make sure you are | |
* doing a BIO_free_all() to catch the underlying BIO. | |
*/ | |
/* defined in evp.h */ | |
/* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)(md)) */ | |
/* For the BIO_f_buffer() type */ | |
/* Don't use the next one unless you know what you are doing :-) */ | |
/* ...pending macros have inappropriate return type */ | |
size_t BIO_ctrl_pending(BIO *b); | |
size_t BIO_ctrl_wpending(BIO *b); | |
/* For the BIO_f_buffer() type */ | |
/* For BIO_s_bio() */ | |
/* macros with inappropriate type -- but ...pending macros use int too: */ | |
size_t BIO_ctrl_get_write_guarantee(BIO *b); | |
size_t BIO_ctrl_get_read_request(BIO *b); | |
int BIO_ctrl_reset_read_request(BIO *b); | |
/* ctrl macros for dgram */ | |
int BIO_set_ex_data(BIO *bio, int idx, void *data); | |
void *BIO_get_ex_data(BIO *bio, int idx); | |
uint64_t BIO_number_read(BIO *bio); | |
uint64_t BIO_number_written(BIO *bio); | |
/* For BIO_f_asn1() */ | |
int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, | |
asn1_ps_func *prefix_free); | |
int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix, | |
asn1_ps_func **pprefix_free); | |
int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, | |
asn1_ps_func *suffix_free); | |
int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, | |
asn1_ps_func **psuffix_free); | |
const BIO_METHOD *BIO_s_file(void); | |
BIO *BIO_new_file(const char *filename, const char *mode); | |
BIO *BIO_new_fp(FILE *stream, int close_flag); | |
BIO *BIO_new(const BIO_METHOD *type); | |
int BIO_free(BIO *a); | |
void BIO_set_data(BIO *a, void *ptr); | |
void *BIO_get_data(BIO *a); | |
void BIO_set_init(BIO *a, int init); | |
int BIO_get_init(BIO *a); | |
void BIO_set_shutdown(BIO *a, int shut); | |
int BIO_get_shutdown(BIO *a); | |
void BIO_vfree(BIO *a); | |
int BIO_up_ref(BIO *a); | |
int BIO_read(BIO *b, void *data, int dlen); | |
int BIO_read_ex(BIO *b, void *data, size_t dlen, size_t *readbytes); | |
int BIO_gets(BIO *bp, char *buf, int size); | |
int BIO_write(BIO *b, const void *data, int dlen); | |
int BIO_write_ex(BIO *b, const void *data, size_t dlen, size_t *written); | |
int BIO_puts(BIO *bp, const char *buf); | |
int BIO_indent(BIO *b, int indent, int max); | |
long BIO_ctrl(BIO *bp, int cmd, long larg, void *parg); | |
long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp); | |
void *BIO_ptr_ctrl(BIO *bp, int cmd, long larg); | |
long BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg); | |
BIO *BIO_push(BIO *b, BIO *append); | |
BIO *BIO_pop(BIO *b); | |
void BIO_free_all(BIO *a); | |
BIO *BIO_find_type(BIO *b, int bio_type); | |
BIO *BIO_next(BIO *b); | |
void BIO_set_next(BIO *b, BIO *next); | |
BIO *BIO_get_retry_BIO(BIO *bio, int *reason); | |
int BIO_get_retry_reason(BIO *bio); | |
void BIO_set_retry_reason(BIO *bio, int reason); | |
BIO *BIO_dup_chain(BIO *in); | |
int BIO_nread0(BIO *bio, char **buf); | |
int BIO_nread(BIO *bio, char **buf, int num); | |
int BIO_nwrite0(BIO *bio, char **buf); | |
int BIO_nwrite(BIO *bio, char **buf, int num); | |
long BIO_debug_callback(BIO *bio, int cmd, const char *argp, int argi, | |
long argl, long ret); | |
const BIO_METHOD *BIO_s_mem(void); | |
const BIO_METHOD *BIO_s_secmem(void); | |
BIO *BIO_new_mem_buf(const void *buf, int len); | |
const BIO_METHOD *BIO_s_socket(void); | |
const BIO_METHOD *BIO_s_connect(void); | |
const BIO_METHOD *BIO_s_accept(void); | |
const BIO_METHOD *BIO_s_fd(void); | |
const BIO_METHOD *BIO_s_log(void); | |
const BIO_METHOD *BIO_s_bio(void); | |
const BIO_METHOD *BIO_s_null(void); | |
const BIO_METHOD *BIO_f_null(void); | |
const BIO_METHOD *BIO_f_buffer(void); | |
const BIO_METHOD *BIO_f_linebuffer(void); | |
const BIO_METHOD *BIO_f_nbio_test(void); | |
const BIO_METHOD *BIO_s_datagram(void); | |
int BIO_dgram_non_fatal_error(int error); | |
BIO *BIO_new_dgram(int fd, int close_flag); | |
const BIO_METHOD *BIO_s_datagram_sctp(void); | |
BIO *BIO_new_dgram_sctp(int fd, int close_flag); | |
int BIO_dgram_is_sctp(BIO *bio); | |
int BIO_dgram_sctp_notification_cb(BIO *b, | |
void (*handle_notifications) (BIO *bio, | |
void *context, | |
void *buf), | |
void *context); | |
int BIO_dgram_sctp_wait_for_dry(BIO *b); | |
int BIO_dgram_sctp_msg_waiting(BIO *b); | |
int BIO_sock_should_retry(int i); | |
int BIO_sock_non_fatal_error(int error); | |
int BIO_fd_should_retry(int i); | |
int BIO_fd_non_fatal_error(int error); | |
int BIO_dump_cb(int (*cb) (const void *data, size_t len, void *u), | |
void *u, const char *s, int len); | |
int BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u), | |
void *u, const char *s, int len, int indent); | |
int BIO_dump(BIO *b, const char *bytes, int len); | |
int BIO_dump_indent(BIO *b, const char *bytes, int len, int indent); | |
int BIO_dump_fp(FILE *fp, const char *s, int len); | |
int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent); | |
int BIO_hex_string(BIO *out, int indent, int width, unsigned char *data, | |
int datalen); | |
BIO_ADDR *BIO_ADDR_new(void); | |
int BIO_ADDR_rawmake(BIO_ADDR *ap, int family, | |
const void *where, size_t wherelen, unsigned short port); | |
void BIO_ADDR_free(BIO_ADDR *); | |
void BIO_ADDR_clear(BIO_ADDR *ap); | |
int BIO_ADDR_family(const BIO_ADDR *ap); | |
int BIO_ADDR_rawaddress(const BIO_ADDR *ap, void *p, size_t *l); | |
unsigned short BIO_ADDR_rawport(const BIO_ADDR *ap); | |
char *BIO_ADDR_hostname_string(const BIO_ADDR *ap, int numeric); | |
char *BIO_ADDR_service_string(const BIO_ADDR *ap, int numeric); | |
char *BIO_ADDR_path_string(const BIO_ADDR *ap); | |
const BIO_ADDRINFO *BIO_ADDRINFO_next(const BIO_ADDRINFO *bai); | |
int BIO_ADDRINFO_family(const BIO_ADDRINFO *bai); | |
int BIO_ADDRINFO_socktype(const BIO_ADDRINFO *bai); | |
int BIO_ADDRINFO_protocol(const BIO_ADDRINFO *bai); | |
const BIO_ADDR *BIO_ADDRINFO_address(const BIO_ADDRINFO *bai); | |
void BIO_ADDRINFO_free(BIO_ADDRINFO *bai); | |
enum BIO_hostserv_priorities { | |
BIO_PARSE_PRIO_HOST, BIO_PARSE_PRIO_SERV | |
}; | |
int BIO_parse_hostserv(const char *hostserv, char **host, char **service, | |
enum BIO_hostserv_priorities hostserv_prio); | |
enum BIO_lookup_type { | |
BIO_LOOKUP_CLIENT, BIO_LOOKUP_SERVER | |
}; | |
int BIO_lookup(const char *host, const char *service, | |
enum BIO_lookup_type lookup_type, | |
int family, int socktype, BIO_ADDRINFO **res); | |
int BIO_lookup_ex(const char *host, const char *service, | |
int lookup_type, int family, int socktype, int protocol, | |
BIO_ADDRINFO **res); | |
int BIO_sock_error(int sock); | |
int BIO_socket_ioctl(int fd, long type, void *arg); | |
int BIO_socket_nbio(int fd, int mode); | |
int BIO_sock_init(void); | |
int BIO_set_tcp_ndelay(int sock, int turn_on); | |
DEPRECATEDIN_1_1_0(struct hostent *BIO_gethostbyname(const char *name)) | |
DEPRECATEDIN_1_1_0(int BIO_get_port(const char *str, unsigned short *port_ptr)) | |
DEPRECATEDIN_1_1_0(int BIO_get_host_ip(const char *str, unsigned char *ip)) | |
DEPRECATEDIN_1_1_0(int BIO_get_accept_socket(char *host_port, int mode)) | |
DEPRECATEDIN_1_1_0(int BIO_accept(int sock, char **ip_port)) | |
union BIO_sock_info_u { | |
BIO_ADDR *addr; | |
}; | |
enum BIO_sock_info_type { | |
BIO_SOCK_INFO_ADDRESS | |
}; | |
int BIO_sock_info(int sock, | |
enum BIO_sock_info_type type, union BIO_sock_info_u *info); | |
int BIO_socket(int domain, int socktype, int protocol, int options); | |
int BIO_connect(int sock, const BIO_ADDR *addr, int options); | |
int BIO_bind(int sock, const BIO_ADDR *addr, int options); | |
int BIO_listen(int sock, const BIO_ADDR *addr, int options); | |
int BIO_accept_ex(int accept_sock, BIO_ADDR *addr, int options); | |
int BIO_closesocket(int sock); | |
BIO *BIO_new_socket(int sock, int close_flag); | |
BIO *BIO_new_connect(const char *host_port); | |
BIO *BIO_new_accept(const char *host_port); | |
BIO *BIO_new_fd(int fd, int close_flag); | |
int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, | |
BIO **bio2, size_t writebuf2); | |
/* | |
* If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints. | |
* Otherwise returns 0 and sets *bio1 and *bio2 to NULL. Size 0 uses default | |
* value. | |
*/ | |
void BIO_copy_next_retry(BIO *b); | |
/* | |
* long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); | |
*/ | |
/* | |
* Because we support the 'z' modifier, which made its appearance in C99, | |
* we can't use __attribute__ with pre C99 dialects. | |
*/ | |
int BIO_printf(BIO *bio, const char *format, ...) | |
ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 3))); | |
int BIO_vprintf(BIO *bio, const char *format, va_list args) | |
ossl_bio__attr__((__format__(ossl_bio__printf__, 2, 0))); | |
int BIO_snprintf(char *buf, size_t n, const char *format, ...) | |
ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 4))); | |
int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) | |
ossl_bio__attr__((__format__(ossl_bio__printf__, 3, 0))); | |
BIO_METHOD *BIO_meth_new(int type, const char *name); | |
void BIO_meth_free(BIO_METHOD *biom); | |
int (*BIO_meth_get_write(const BIO_METHOD *biom)) (BIO *, const char *, int); | |
int (*BIO_meth_get_write_ex(const BIO_METHOD *biom)) (BIO *, const char *, size_t, | |
size_t *); | |
int BIO_meth_set_write(BIO_METHOD *biom, | |
int (*write) (BIO *, const char *, int)); | |
int BIO_meth_set_write_ex(BIO_METHOD *biom, | |
int (*bwrite) (BIO *, const char *, size_t, size_t *)); | |
int (*BIO_meth_get_read(const BIO_METHOD *biom)) (BIO *, char *, int); | |
int (*BIO_meth_get_read_ex(const BIO_METHOD *biom)) (BIO *, char *, size_t, size_t *); | |
int BIO_meth_set_read(BIO_METHOD *biom, | |
int (*read) (BIO *, char *, int)); | |
int BIO_meth_set_read_ex(BIO_METHOD *biom, | |
int (*bread) (BIO *, char *, size_t, size_t *)); | |
int (*BIO_meth_get_puts(const BIO_METHOD *biom)) (BIO *, const char *); | |
int BIO_meth_set_puts(BIO_METHOD *biom, | |
int (*puts) (BIO *, const char *)); | |
int (*BIO_meth_get_gets(const BIO_METHOD *biom)) (BIO *, char *, int); | |
int BIO_meth_set_gets(BIO_METHOD *biom, | |
int (*gets) (BIO *, char *, int)); | |
long (*BIO_meth_get_ctrl(const BIO_METHOD *biom)) (BIO *, int, long, void *); | |
int BIO_meth_set_ctrl(BIO_METHOD *biom, | |
long (*ctrl) (BIO *, int, long, void *)); | |
int (*BIO_meth_get_create(const BIO_METHOD *bion)) (BIO *); | |
int BIO_meth_set_create(BIO_METHOD *biom, int (*create) (BIO *)); | |
int (*BIO_meth_get_destroy(const BIO_METHOD *biom)) (BIO *); | |
int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy) (BIO *)); | |
long (*BIO_meth_get_callback_ctrl(const BIO_METHOD *biom)) | |
(BIO *, int, BIO_info_cb *); | |
int BIO_meth_set_callback_ctrl(BIO_METHOD *biom, | |
long (*callback_ctrl) (BIO *, int, | |
BIO_info_cb *)); | |
} | |