1b077aed3SPierre Pronchery/* 2b077aed3SPierre Pronchery * {- join("\n * ", @autowarntext) -} 3b077aed3SPierre Pronchery * 4b077aed3SPierre Pronchery * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved. 5b077aed3SPierre Pronchery * 6b077aed3SPierre Pronchery * Licensed under the Apache License 2.0 (the "License"). You may not use 7b077aed3SPierre Pronchery * this file except in compliance with the License. You can obtain a copy 8b077aed3SPierre Pronchery * in the file LICENSE in the source distribution or at 9b077aed3SPierre Pronchery * https://www.openssl.org/source/license.html 10b077aed3SPierre Pronchery */ 11b077aed3SPierre Pronchery{- 12b077aed3SPierre Proncheryuse OpenSSL::stackhash qw(generate_stack_macros); 13b077aed3SPierre Pronchery-} 14b077aed3SPierre Pronchery 15b077aed3SPierre Pronchery#ifndef OPENSSL_BIO_H 16b077aed3SPierre Pronchery# define OPENSSL_BIO_H 17b077aed3SPierre Pronchery# pragma once 18b077aed3SPierre Pronchery 19b077aed3SPierre Pronchery# include <openssl/macros.h> 20b077aed3SPierre Pronchery# ifndef OPENSSL_NO_DEPRECATED_3_0 21b077aed3SPierre Pronchery# define HEADER_BIO_H 22b077aed3SPierre Pronchery# endif 23b077aed3SPierre Pronchery 24b077aed3SPierre Pronchery# include <openssl/e_os2.h> 25b077aed3SPierre Pronchery 26b077aed3SPierre Pronchery# ifndef OPENSSL_NO_STDIO 27b077aed3SPierre Pronchery# include <stdio.h> 28b077aed3SPierre Pronchery# endif 29b077aed3SPierre Pronchery# include <stdarg.h> 30b077aed3SPierre Pronchery 31b077aed3SPierre Pronchery# include <openssl/crypto.h> 32b077aed3SPierre Pronchery# include <openssl/bioerr.h> 33b077aed3SPierre Pronchery# include <openssl/core.h> 34b077aed3SPierre Pronchery 35b077aed3SPierre Pronchery#ifdef __cplusplus 36b077aed3SPierre Proncheryextern "C" { 37b077aed3SPierre Pronchery#endif 38b077aed3SPierre Pronchery 39b077aed3SPierre Pronchery/* There are the classes of BIOs */ 40b077aed3SPierre Pronchery# define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */ 41b077aed3SPierre Pronchery# define BIO_TYPE_FILTER 0x0200 42b077aed3SPierre Pronchery# define BIO_TYPE_SOURCE_SINK 0x0400 43b077aed3SPierre Pronchery 44b077aed3SPierre Pronchery/* These are the 'types' of BIOs */ 45b077aed3SPierre Pronchery# define BIO_TYPE_NONE 0 46b077aed3SPierre Pronchery# define BIO_TYPE_MEM ( 1|BIO_TYPE_SOURCE_SINK) 47b077aed3SPierre Pronchery# define BIO_TYPE_FILE ( 2|BIO_TYPE_SOURCE_SINK) 48b077aed3SPierre Pronchery 49b077aed3SPierre Pronchery# define BIO_TYPE_FD ( 4|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) 50b077aed3SPierre Pronchery# define BIO_TYPE_SOCKET ( 5|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) 51b077aed3SPierre Pronchery# define BIO_TYPE_NULL ( 6|BIO_TYPE_SOURCE_SINK) 52b077aed3SPierre Pronchery# define BIO_TYPE_SSL ( 7|BIO_TYPE_FILTER) 53b077aed3SPierre Pronchery# define BIO_TYPE_MD ( 8|BIO_TYPE_FILTER) 54b077aed3SPierre Pronchery# define BIO_TYPE_BUFFER ( 9|BIO_TYPE_FILTER) 55b077aed3SPierre Pronchery# define BIO_TYPE_CIPHER (10|BIO_TYPE_FILTER) 56b077aed3SPierre Pronchery# define BIO_TYPE_BASE64 (11|BIO_TYPE_FILTER) 57b077aed3SPierre Pronchery# define BIO_TYPE_CONNECT (12|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) 58b077aed3SPierre Pronchery# define BIO_TYPE_ACCEPT (13|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) 59b077aed3SPierre Pronchery 60b077aed3SPierre Pronchery# define BIO_TYPE_NBIO_TEST (16|BIO_TYPE_FILTER)/* server proxy BIO */ 61b077aed3SPierre Pronchery# define BIO_TYPE_NULL_FILTER (17|BIO_TYPE_FILTER) 62b077aed3SPierre Pronchery# define BIO_TYPE_BIO (19|BIO_TYPE_SOURCE_SINK)/* half a BIO pair */ 63b077aed3SPierre Pronchery# define BIO_TYPE_LINEBUFFER (20|BIO_TYPE_FILTER) 64b077aed3SPierre Pronchery# define BIO_TYPE_DGRAM (21|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) 65b077aed3SPierre Pronchery# define BIO_TYPE_ASN1 (22|BIO_TYPE_FILTER) 66b077aed3SPierre Pronchery# define BIO_TYPE_COMP (23|BIO_TYPE_FILTER) 67b077aed3SPierre Pronchery# ifndef OPENSSL_NO_SCTP 68b077aed3SPierre Pronchery# define BIO_TYPE_DGRAM_SCTP (24|BIO_TYPE_SOURCE_SINK|BIO_TYPE_DESCRIPTOR) 69b077aed3SPierre Pronchery# endif 70b077aed3SPierre Pronchery# define BIO_TYPE_CORE_TO_PROV (25|BIO_TYPE_SOURCE_SINK) 71b077aed3SPierre Pronchery 72b077aed3SPierre Pronchery#define BIO_TYPE_START 128 73b077aed3SPierre Pronchery 74b077aed3SPierre Pronchery/* 75b077aed3SPierre Pronchery * BIO_FILENAME_READ|BIO_CLOSE to open or close on free. 76b077aed3SPierre Pronchery * BIO_set_fp(in,stdin,BIO_NOCLOSE); 77b077aed3SPierre Pronchery */ 78b077aed3SPierre Pronchery# define BIO_NOCLOSE 0x00 79b077aed3SPierre Pronchery# define BIO_CLOSE 0x01 80b077aed3SPierre Pronchery 81b077aed3SPierre Pronchery/* 82b077aed3SPierre Pronchery * These are used in the following macros and are passed to BIO_ctrl() 83b077aed3SPierre Pronchery */ 84b077aed3SPierre Pronchery# define BIO_CTRL_RESET 1/* opt - rewind/zero etc */ 85b077aed3SPierre Pronchery# define BIO_CTRL_EOF 2/* opt - are we at the eof */ 86b077aed3SPierre Pronchery# define BIO_CTRL_INFO 3/* opt - extra tit-bits */ 87b077aed3SPierre Pronchery# define BIO_CTRL_SET 4/* man - set the 'IO' type */ 88b077aed3SPierre Pronchery# define BIO_CTRL_GET 5/* man - get the 'IO' type */ 89b077aed3SPierre Pronchery# define BIO_CTRL_PUSH 6/* opt - internal, used to signify change */ 90b077aed3SPierre Pronchery# define BIO_CTRL_POP 7/* opt - internal, used to signify change */ 91b077aed3SPierre Pronchery# define BIO_CTRL_GET_CLOSE 8/* man - set the 'close' on free */ 92b077aed3SPierre Pronchery# define BIO_CTRL_SET_CLOSE 9/* man - set the 'close' on free */ 93b077aed3SPierre Pronchery# define BIO_CTRL_PENDING 10/* opt - is their more data buffered */ 94b077aed3SPierre Pronchery# define BIO_CTRL_FLUSH 11/* opt - 'flush' buffered output */ 95b077aed3SPierre Pronchery# define BIO_CTRL_DUP 12/* man - extra stuff for 'duped' BIO */ 96b077aed3SPierre Pronchery# define BIO_CTRL_WPENDING 13/* opt - number of bytes still to write */ 97b077aed3SPierre Pronchery# define BIO_CTRL_SET_CALLBACK 14/* opt - set callback function */ 98b077aed3SPierre Pronchery# define BIO_CTRL_GET_CALLBACK 15/* opt - set callback function */ 99b077aed3SPierre Pronchery 100b077aed3SPierre Pronchery# define BIO_CTRL_PEEK 29/* BIO_f_buffer special */ 101b077aed3SPierre Pronchery# define BIO_CTRL_SET_FILENAME 30/* BIO_s_file special */ 102b077aed3SPierre Pronchery 103b077aed3SPierre Pronchery/* dgram BIO stuff */ 104b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_CONNECT 31/* BIO dgram special */ 105b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_SET_CONNECTED 32/* allow for an externally connected 106b077aed3SPierre Pronchery * socket to be passed in */ 107b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33/* setsockopt, essentially */ 108b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34/* getsockopt, essentially */ 109b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35/* setsockopt, essentially */ 110b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36/* getsockopt, essentially */ 111b077aed3SPierre Pronchery 112b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37/* flag whether the last */ 113b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38/* I/O operation timed out */ 114b077aed3SPierre Pronchery 115b077aed3SPierre Pronchery/* #ifdef IP_MTU_DISCOVER */ 116b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_MTU_DISCOVER 39/* set DF bit on egress packets */ 117b077aed3SPierre Pronchery/* #endif */ 118b077aed3SPierre Pronchery 119b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_QUERY_MTU 40/* as kernel for current MTU */ 120b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_GET_FALLBACK_MTU 47 121b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_GET_MTU 41/* get cached value for MTU */ 122b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_SET_MTU 42/* set cached value for MTU. 123b077aed3SPierre Pronchery * want to use this if asking 124b077aed3SPierre Pronchery * the kernel fails */ 125b077aed3SPierre Pronchery 126b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_MTU_EXCEEDED 43/* check whether the MTU was 127b077aed3SPierre Pronchery * exceed in the previous write 128b077aed3SPierre Pronchery * operation */ 129b077aed3SPierre Pronchery 130b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_GET_PEER 46 131b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_SET_PEER 44/* Destination for the data */ 132b077aed3SPierre Pronchery 133b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT 45/* Next DTLS handshake timeout 134b077aed3SPierre Pronchery * to adjust socket timeouts */ 135b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_SET_DONT_FRAG 48 136b077aed3SPierre Pronchery 137b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_GET_MTU_OVERHEAD 49 138b077aed3SPierre Pronchery 139b077aed3SPierre Pronchery/* Deliberately outside of OPENSSL_NO_SCTP - used in bss_dgram.c */ 140b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_SCTP_SET_IN_HANDSHAKE 50 141b077aed3SPierre Pronchery# ifndef OPENSSL_NO_SCTP 142b077aed3SPierre Pronchery/* SCTP stuff */ 143b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY 51 144b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_SCTP_NEXT_AUTH_KEY 52 145b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_SCTP_AUTH_CCS_RCVD 53 146b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_SCTP_GET_SNDINFO 60 147b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_SCTP_SET_SNDINFO 61 148b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_SCTP_GET_RCVINFO 62 149b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_SCTP_SET_RCVINFO 63 150b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_SCTP_GET_PRINFO 64 151b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_SCTP_SET_PRINFO 65 152b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN 70 153b077aed3SPierre Pronchery# endif 154b077aed3SPierre Pronchery 155b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_SET_PEEK_MODE 71 156b077aed3SPierre Pronchery 157b077aed3SPierre Pronchery/* 158b077aed3SPierre Pronchery * internal BIO: 159b077aed3SPierre Pronchery * # define BIO_CTRL_SET_KTLS_SEND 72 160b077aed3SPierre Pronchery * # define BIO_CTRL_SET_KTLS_SEND_CTRL_MSG 74 161b077aed3SPierre Pronchery * # define BIO_CTRL_CLEAR_KTLS_CTRL_MSG 75 162b077aed3SPierre Pronchery */ 163b077aed3SPierre Pronchery 164b077aed3SPierre Pronchery# define BIO_CTRL_GET_KTLS_SEND 73 165b077aed3SPierre Pronchery# define BIO_CTRL_GET_KTLS_RECV 76 166b077aed3SPierre Pronchery 167b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_SCTP_WAIT_FOR_DRY 77 168b077aed3SPierre Pronchery# define BIO_CTRL_DGRAM_SCTP_MSG_WAITING 78 169b077aed3SPierre Pronchery 170b077aed3SPierre Pronchery/* BIO_f_prefix controls */ 171b077aed3SPierre Pronchery# define BIO_CTRL_SET_PREFIX 79 172b077aed3SPierre Pronchery# define BIO_CTRL_SET_INDENT 80 173b077aed3SPierre Pronchery# define BIO_CTRL_GET_INDENT 81 174b077aed3SPierre Pronchery 175b077aed3SPierre Pronchery# ifndef OPENSSL_NO_KTLS 176b077aed3SPierre Pronchery# define BIO_get_ktls_send(b) \ 177b077aed3SPierre Pronchery (BIO_ctrl(b, BIO_CTRL_GET_KTLS_SEND, 0, NULL) > 0) 178b077aed3SPierre Pronchery# define BIO_get_ktls_recv(b) \ 179b077aed3SPierre Pronchery (BIO_ctrl(b, BIO_CTRL_GET_KTLS_RECV, 0, NULL) > 0) 180b077aed3SPierre Pronchery# else 181b077aed3SPierre Pronchery# define BIO_get_ktls_send(b) (0) 182b077aed3SPierre Pronchery# define BIO_get_ktls_recv(b) (0) 183b077aed3SPierre Pronchery# endif 184b077aed3SPierre Pronchery 185b077aed3SPierre Pronchery/* modifiers */ 186b077aed3SPierre Pronchery# define BIO_FP_READ 0x02 187b077aed3SPierre Pronchery# define BIO_FP_WRITE 0x04 188b077aed3SPierre Pronchery# define BIO_FP_APPEND 0x08 189b077aed3SPierre Pronchery# define BIO_FP_TEXT 0x10 190b077aed3SPierre Pronchery 191b077aed3SPierre Pronchery# define BIO_FLAGS_READ 0x01 192b077aed3SPierre Pronchery# define BIO_FLAGS_WRITE 0x02 193b077aed3SPierre Pronchery# define BIO_FLAGS_IO_SPECIAL 0x04 194b077aed3SPierre Pronchery# define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) 195b077aed3SPierre Pronchery# define BIO_FLAGS_SHOULD_RETRY 0x08 196b077aed3SPierre Pronchery# ifndef OPENSSL_NO_DEPRECATED_3_0 197b077aed3SPierre Pronchery/* This #define was replaced by an internal constant and should not be used. */ 198b077aed3SPierre Pronchery# define BIO_FLAGS_UPLINK 0 199b077aed3SPierre Pronchery# endif 200b077aed3SPierre Pronchery 201b077aed3SPierre Pronchery# define BIO_FLAGS_BASE64_NO_NL 0x100 202b077aed3SPierre Pronchery 203b077aed3SPierre Pronchery/* 204b077aed3SPierre Pronchery * This is used with memory BIOs: 205b077aed3SPierre Pronchery * BIO_FLAGS_MEM_RDONLY means we shouldn't free up or change the data in any way; 206b077aed3SPierre Pronchery * BIO_FLAGS_NONCLEAR_RST means we shouldn't clear data on reset. 207b077aed3SPierre Pronchery */ 208b077aed3SPierre Pronchery# define BIO_FLAGS_MEM_RDONLY 0x200 209b077aed3SPierre Pronchery# define BIO_FLAGS_NONCLEAR_RST 0x400 210b077aed3SPierre Pronchery# define BIO_FLAGS_IN_EOF 0x800 211b077aed3SPierre Pronchery 212b077aed3SPierre Pronchery/* the BIO FLAGS values 0x1000 to 0x4000 are reserved for internal KTLS flags */ 213b077aed3SPierre Pronchery 214b077aed3SPierre Proncherytypedef union bio_addr_st BIO_ADDR; 215b077aed3SPierre Proncherytypedef struct bio_addrinfo_st BIO_ADDRINFO; 216b077aed3SPierre Pronchery 217b077aed3SPierre Proncheryint BIO_get_new_index(void); 218b077aed3SPierre Proncheryvoid BIO_set_flags(BIO *b, int flags); 219b077aed3SPierre Proncheryint BIO_test_flags(const BIO *b, int flags); 220b077aed3SPierre Proncheryvoid BIO_clear_flags(BIO *b, int flags); 221b077aed3SPierre Pronchery 222b077aed3SPierre Pronchery# define BIO_get_flags(b) BIO_test_flags(b, ~(0x0)) 223b077aed3SPierre Pronchery# define BIO_set_retry_special(b) \ 224b077aed3SPierre Pronchery BIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY)) 225b077aed3SPierre Pronchery# define BIO_set_retry_read(b) \ 226b077aed3SPierre Pronchery BIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY)) 227b077aed3SPierre Pronchery# define BIO_set_retry_write(b) \ 228b077aed3SPierre Pronchery BIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY)) 229b077aed3SPierre Pronchery 230b077aed3SPierre Pronchery/* These are normally used internally in BIOs */ 231b077aed3SPierre Pronchery# define BIO_clear_retry_flags(b) \ 232b077aed3SPierre Pronchery BIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) 233b077aed3SPierre Pronchery# define BIO_get_retry_flags(b) \ 234b077aed3SPierre Pronchery BIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY)) 235b077aed3SPierre Pronchery 236b077aed3SPierre Pronchery/* These should be used by the application to tell why we should retry */ 237b077aed3SPierre Pronchery# define BIO_should_read(a) BIO_test_flags(a, BIO_FLAGS_READ) 238b077aed3SPierre Pronchery# define BIO_should_write(a) BIO_test_flags(a, BIO_FLAGS_WRITE) 239b077aed3SPierre Pronchery# define BIO_should_io_special(a) BIO_test_flags(a, BIO_FLAGS_IO_SPECIAL) 240b077aed3SPierre Pronchery# define BIO_retry_type(a) BIO_test_flags(a, BIO_FLAGS_RWS) 241b077aed3SPierre Pronchery# define BIO_should_retry(a) BIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY) 242b077aed3SPierre Pronchery 243b077aed3SPierre Pronchery/* 244b077aed3SPierre Pronchery * The next three are used in conjunction with the BIO_should_io_special() 245b077aed3SPierre Pronchery * condition. After this returns true, BIO *BIO_get_retry_BIO(BIO *bio, int 246b077aed3SPierre Pronchery * *reason); will walk the BIO stack and return the 'reason' for the special 247b077aed3SPierre Pronchery * and the offending BIO. Given a BIO, BIO_get_retry_reason(bio) will return 248b077aed3SPierre Pronchery * the code. 249b077aed3SPierre Pronchery */ 250b077aed3SPierre Pronchery/* 251b077aed3SPierre Pronchery * Returned from the SSL bio when the certificate retrieval code had an error 252b077aed3SPierre Pronchery */ 253b077aed3SPierre Pronchery# define BIO_RR_SSL_X509_LOOKUP 0x01 254b077aed3SPierre Pronchery/* Returned from the connect BIO when a connect would have blocked */ 255b077aed3SPierre Pronchery# define BIO_RR_CONNECT 0x02 256b077aed3SPierre Pronchery/* Returned from the accept BIO when an accept would have blocked */ 257b077aed3SPierre Pronchery# define BIO_RR_ACCEPT 0x03 258b077aed3SPierre Pronchery 259b077aed3SPierre Pronchery/* These are passed by the BIO callback */ 260b077aed3SPierre Pronchery# define BIO_CB_FREE 0x01 261b077aed3SPierre Pronchery# define BIO_CB_READ 0x02 262b077aed3SPierre Pronchery# define BIO_CB_WRITE 0x03 263b077aed3SPierre Pronchery# define BIO_CB_PUTS 0x04 264b077aed3SPierre Pronchery# define BIO_CB_GETS 0x05 265b077aed3SPierre Pronchery# define BIO_CB_CTRL 0x06 266b077aed3SPierre Pronchery 267b077aed3SPierre Pronchery/* 268b077aed3SPierre Pronchery * The callback is called before and after the underling operation, The 269b077aed3SPierre Pronchery * BIO_CB_RETURN flag indicates if it is after the call 270b077aed3SPierre Pronchery */ 271b077aed3SPierre Pronchery# define BIO_CB_RETURN 0x80 272b077aed3SPierre Pronchery# define BIO_CB_return(a) ((a)|BIO_CB_RETURN) 273b077aed3SPierre Pronchery# define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN)) 274b077aed3SPierre Pronchery# define BIO_cb_post(a) ((a)&BIO_CB_RETURN) 275b077aed3SPierre Pronchery 276b077aed3SPierre Pronchery# ifndef OPENSSL_NO_DEPRECATED_3_0 277b077aed3SPierre Proncherytypedef long (*BIO_callback_fn)(BIO *b, int oper, const char *argp, int argi, 278b077aed3SPierre Pronchery long argl, long ret); 279b077aed3SPierre ProncheryOSSL_DEPRECATEDIN_3_0 BIO_callback_fn BIO_get_callback(const BIO *b); 280b077aed3SPierre ProncheryOSSL_DEPRECATEDIN_3_0 void BIO_set_callback(BIO *b, BIO_callback_fn callback); 281b077aed3SPierre ProncheryOSSL_DEPRECATEDIN_3_0 long BIO_debug_callback(BIO *bio, int cmd, 282b077aed3SPierre Pronchery const char *argp, int argi, 283b077aed3SPierre Pronchery long argl, long ret); 284b077aed3SPierre Pronchery# endif 285b077aed3SPierre Pronchery 286b077aed3SPierre Proncherytypedef long (*BIO_callback_fn_ex)(BIO *b, int oper, const char *argp, 287b077aed3SPierre Pronchery size_t len, int argi, 288b077aed3SPierre Pronchery long argl, int ret, size_t *processed); 289b077aed3SPierre ProncheryBIO_callback_fn_ex BIO_get_callback_ex(const BIO *b); 290b077aed3SPierre Proncheryvoid BIO_set_callback_ex(BIO *b, BIO_callback_fn_ex callback); 291b077aed3SPierre Proncherylong BIO_debug_callback_ex(BIO *bio, int oper, const char *argp, size_t len, 292b077aed3SPierre Pronchery int argi, long argl, int ret, size_t *processed); 293b077aed3SPierre Pronchery 294b077aed3SPierre Proncherychar *BIO_get_callback_arg(const BIO *b); 295b077aed3SPierre Proncheryvoid BIO_set_callback_arg(BIO *b, char *arg); 296b077aed3SPierre Pronchery 297b077aed3SPierre Proncherytypedef struct bio_method_st BIO_METHOD; 298b077aed3SPierre Pronchery 299b077aed3SPierre Proncheryconst char *BIO_method_name(const BIO *b); 300b077aed3SPierre Proncheryint BIO_method_type(const BIO *b); 301b077aed3SPierre Pronchery 302b077aed3SPierre Proncherytypedef int BIO_info_cb(BIO *, int, int); 303b077aed3SPierre Proncherytypedef BIO_info_cb bio_info_cb; /* backward compatibility */ 304b077aed3SPierre Pronchery 305b077aed3SPierre Pronchery{- 306b077aed3SPierre Pronchery generate_stack_macros("BIO"); 307b077aed3SPierre Pronchery-} 308b077aed3SPierre Pronchery 309b077aed3SPierre Pronchery 310b077aed3SPierre Pronchery/* Prefix and suffix callback in ASN1 BIO */ 311b077aed3SPierre Proncherytypedef int asn1_ps_func (BIO *b, unsigned char **pbuf, int *plen, 312b077aed3SPierre Pronchery void *parg); 313b077aed3SPierre Pronchery 314b077aed3SPierre Proncherytypedef void (*BIO_dgram_sctp_notification_handler_fn) (BIO *b, 315b077aed3SPierre Pronchery void *context, 316b077aed3SPierre Pronchery void *buf); 317b077aed3SPierre Pronchery# ifndef OPENSSL_NO_SCTP 318b077aed3SPierre Pronchery/* SCTP parameter structs */ 319b077aed3SPierre Proncherystruct bio_dgram_sctp_sndinfo { 320b077aed3SPierre Pronchery uint16_t snd_sid; 321b077aed3SPierre Pronchery uint16_t snd_flags; 322b077aed3SPierre Pronchery uint32_t snd_ppid; 323b077aed3SPierre Pronchery uint32_t snd_context; 324b077aed3SPierre Pronchery}; 325b077aed3SPierre Pronchery 326b077aed3SPierre Proncherystruct bio_dgram_sctp_rcvinfo { 327b077aed3SPierre Pronchery uint16_t rcv_sid; 328b077aed3SPierre Pronchery uint16_t rcv_ssn; 329b077aed3SPierre Pronchery uint16_t rcv_flags; 330b077aed3SPierre Pronchery uint32_t rcv_ppid; 331b077aed3SPierre Pronchery uint32_t rcv_tsn; 332b077aed3SPierre Pronchery uint32_t rcv_cumtsn; 333b077aed3SPierre Pronchery uint32_t rcv_context; 334b077aed3SPierre Pronchery}; 335b077aed3SPierre Pronchery 336b077aed3SPierre Proncherystruct bio_dgram_sctp_prinfo { 337b077aed3SPierre Pronchery uint16_t pr_policy; 338b077aed3SPierre Pronchery uint32_t pr_value; 339b077aed3SPierre Pronchery}; 340b077aed3SPierre Pronchery# endif 341b077aed3SPierre Pronchery 342b077aed3SPierre Pronchery/* 343b077aed3SPierre Pronchery * #define BIO_CONN_get_param_hostname BIO_ctrl 344b077aed3SPierre Pronchery */ 345b077aed3SPierre Pronchery 346b077aed3SPierre Pronchery# define BIO_C_SET_CONNECT 100 347b077aed3SPierre Pronchery# define BIO_C_DO_STATE_MACHINE 101 348b077aed3SPierre Pronchery# define BIO_C_SET_NBIO 102 349b077aed3SPierre Pronchery/* # define BIO_C_SET_PROXY_PARAM 103 */ 350b077aed3SPierre Pronchery# define BIO_C_SET_FD 104 351b077aed3SPierre Pronchery# define BIO_C_GET_FD 105 352b077aed3SPierre Pronchery# define BIO_C_SET_FILE_PTR 106 353b077aed3SPierre Pronchery# define BIO_C_GET_FILE_PTR 107 354b077aed3SPierre Pronchery# define BIO_C_SET_FILENAME 108 355b077aed3SPierre Pronchery# define BIO_C_SET_SSL 109 356b077aed3SPierre Pronchery# define BIO_C_GET_SSL 110 357b077aed3SPierre Pronchery# define BIO_C_SET_MD 111 358b077aed3SPierre Pronchery# define BIO_C_GET_MD 112 359b077aed3SPierre Pronchery# define BIO_C_GET_CIPHER_STATUS 113 360b077aed3SPierre Pronchery# define BIO_C_SET_BUF_MEM 114 361b077aed3SPierre Pronchery# define BIO_C_GET_BUF_MEM_PTR 115 362b077aed3SPierre Pronchery# define BIO_C_GET_BUFF_NUM_LINES 116 363b077aed3SPierre Pronchery# define BIO_C_SET_BUFF_SIZE 117 364b077aed3SPierre Pronchery# define BIO_C_SET_ACCEPT 118 365b077aed3SPierre Pronchery# define BIO_C_SSL_MODE 119 366b077aed3SPierre Pronchery# define BIO_C_GET_MD_CTX 120 367b077aed3SPierre Pronchery/* # define BIO_C_GET_PROXY_PARAM 121 */ 368b077aed3SPierre Pronchery# define BIO_C_SET_BUFF_READ_DATA 122/* data to read first */ 369b077aed3SPierre Pronchery# define BIO_C_GET_CONNECT 123 370b077aed3SPierre Pronchery# define BIO_C_GET_ACCEPT 124 371b077aed3SPierre Pronchery# define BIO_C_SET_SSL_RENEGOTIATE_BYTES 125 372b077aed3SPierre Pronchery# define BIO_C_GET_SSL_NUM_RENEGOTIATES 126 373b077aed3SPierre Pronchery# define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT 127 374b077aed3SPierre Pronchery# define BIO_C_FILE_SEEK 128 375b077aed3SPierre Pronchery# define BIO_C_GET_CIPHER_CTX 129 376b077aed3SPierre Pronchery# define BIO_C_SET_BUF_MEM_EOF_RETURN 130/* return end of input 377b077aed3SPierre Pronchery * value */ 378b077aed3SPierre Pronchery# define BIO_C_SET_BIND_MODE 131 379b077aed3SPierre Pronchery# define BIO_C_GET_BIND_MODE 132 380b077aed3SPierre Pronchery# define BIO_C_FILE_TELL 133 381b077aed3SPierre Pronchery# define BIO_C_GET_SOCKS 134 382b077aed3SPierre Pronchery# define BIO_C_SET_SOCKS 135 383b077aed3SPierre Pronchery 384b077aed3SPierre Pronchery# define BIO_C_SET_WRITE_BUF_SIZE 136/* for BIO_s_bio */ 385b077aed3SPierre Pronchery# define BIO_C_GET_WRITE_BUF_SIZE 137 386b077aed3SPierre Pronchery# define BIO_C_MAKE_BIO_PAIR 138 387b077aed3SPierre Pronchery# define BIO_C_DESTROY_BIO_PAIR 139 388b077aed3SPierre Pronchery# define BIO_C_GET_WRITE_GUARANTEE 140 389b077aed3SPierre Pronchery# define BIO_C_GET_READ_REQUEST 141 390b077aed3SPierre Pronchery# define BIO_C_SHUTDOWN_WR 142 391b077aed3SPierre Pronchery# define BIO_C_NREAD0 143 392b077aed3SPierre Pronchery# define BIO_C_NREAD 144 393b077aed3SPierre Pronchery# define BIO_C_NWRITE0 145 394b077aed3SPierre Pronchery# define BIO_C_NWRITE 146 395b077aed3SPierre Pronchery# define BIO_C_RESET_READ_REQUEST 147 396b077aed3SPierre Pronchery# define BIO_C_SET_MD_CTX 148 397b077aed3SPierre Pronchery 398b077aed3SPierre Pronchery# define BIO_C_SET_PREFIX 149 399b077aed3SPierre Pronchery# define BIO_C_GET_PREFIX 150 400b077aed3SPierre Pronchery# define BIO_C_SET_SUFFIX 151 401b077aed3SPierre Pronchery# define BIO_C_GET_SUFFIX 152 402b077aed3SPierre Pronchery 403b077aed3SPierre Pronchery# define BIO_C_SET_EX_ARG 153 404b077aed3SPierre Pronchery# define BIO_C_GET_EX_ARG 154 405b077aed3SPierre Pronchery 406b077aed3SPierre Pronchery# define BIO_C_SET_CONNECT_MODE 155 407b077aed3SPierre Pronchery 408b077aed3SPierre Pronchery# define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg) 409b077aed3SPierre Pronchery# define BIO_get_app_data(s) BIO_get_ex_data(s,0) 410b077aed3SPierre Pronchery 411b077aed3SPierre Pronchery# define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) 412b077aed3SPierre Pronchery 413b077aed3SPierre Pronchery# ifndef OPENSSL_NO_SOCK 414b077aed3SPierre Pronchery/* IP families we support, for BIO_s_connect() and BIO_s_accept() */ 415b077aed3SPierre Pronchery/* Note: the underlying operating system may not support some of them */ 416b077aed3SPierre Pronchery# define BIO_FAMILY_IPV4 4 417b077aed3SPierre Pronchery# define BIO_FAMILY_IPV6 6 418b077aed3SPierre Pronchery# define BIO_FAMILY_IPANY 256 419b077aed3SPierre Pronchery 420b077aed3SPierre Pronchery/* BIO_s_connect() */ 421b077aed3SPierre Pronchery# define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0, \ 422b077aed3SPierre Pronchery (char *)(name)) 423b077aed3SPierre Pronchery# define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1, \ 424b077aed3SPierre Pronchery (char *)(port)) 425b077aed3SPierre Pronchery# define BIO_set_conn_address(b,addr) BIO_ctrl(b,BIO_C_SET_CONNECT,2, \ 426b077aed3SPierre Pronchery (char *)(addr)) 427b077aed3SPierre Pronchery# define BIO_set_conn_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_CONNECT,3,f) 428b077aed3SPierre Pronchery# define BIO_get_conn_hostname(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0)) 429b077aed3SPierre Pronchery# define BIO_get_conn_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1)) 430b077aed3SPierre Pronchery# define BIO_get_conn_address(b) ((const BIO_ADDR *)BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2)) 431b077aed3SPierre Pronchery# define BIO_get_conn_ip_family(b) BIO_ctrl(b,BIO_C_GET_CONNECT,3,NULL) 432b077aed3SPierre Pronchery# define BIO_set_conn_mode(b,n) BIO_ctrl(b,BIO_C_SET_CONNECT_MODE,(n),NULL) 433b077aed3SPierre Pronchery 434b077aed3SPierre Pronchery/* BIO_s_accept() */ 435b077aed3SPierre Pronchery# define BIO_set_accept_name(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0, \ 436b077aed3SPierre Pronchery (char *)(name)) 437b077aed3SPierre Pronchery# define BIO_set_accept_port(b,port) BIO_ctrl(b,BIO_C_SET_ACCEPT,1, \ 438b077aed3SPierre Pronchery (char *)(port)) 439b077aed3SPierre Pronchery# define BIO_get_accept_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0)) 440b077aed3SPierre Pronchery# define BIO_get_accept_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,1)) 441b077aed3SPierre Pronchery# define BIO_get_peer_name(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,2)) 442b077aed3SPierre Pronchery# define BIO_get_peer_port(b) ((const char *)BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,3)) 443b077aed3SPierre Pronchery/* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */ 444b077aed3SPierre Pronchery# define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(n)?(void *)"a":NULL) 445b077aed3SPierre Pronchery# define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,3, \ 446b077aed3SPierre Pronchery (char *)(bio)) 447b077aed3SPierre Pronchery# define BIO_set_accept_ip_family(b,f) BIO_int_ctrl(b,BIO_C_SET_ACCEPT,4,f) 448b077aed3SPierre Pronchery# define BIO_get_accept_ip_family(b) BIO_ctrl(b,BIO_C_GET_ACCEPT,4,NULL) 449b077aed3SPierre Pronchery 450b077aed3SPierre Pronchery/* Aliases kept for backward compatibility */ 451b077aed3SPierre Pronchery# define BIO_BIND_NORMAL 0 452b077aed3SPierre Pronchery# define BIO_BIND_REUSEADDR BIO_SOCK_REUSEADDR 453b077aed3SPierre Pronchery# define BIO_BIND_REUSEADDR_IF_UNUSED BIO_SOCK_REUSEADDR 454b077aed3SPierre Pronchery# define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL) 455b077aed3SPierre Pronchery# define BIO_get_bind_mode(b) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL) 456b077aed3SPierre Pronchery# endif /* OPENSSL_NO_SOCK */ 457b077aed3SPierre Pronchery 458b077aed3SPierre Pronchery# define BIO_do_connect(b) BIO_do_handshake(b) 459b077aed3SPierre Pronchery# define BIO_do_accept(b) BIO_do_handshake(b) 460b077aed3SPierre Pronchery 461b077aed3SPierre Pronchery# define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) 462b077aed3SPierre Pronchery 463b077aed3SPierre Pronchery/* BIO_s_datagram(), BIO_s_fd(), BIO_s_socket(), BIO_s_accept() and BIO_s_connect() */ 464b077aed3SPierre Pronchery# define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) 465b077aed3SPierre Pronchery# define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)(c)) 466b077aed3SPierre Pronchery 467b077aed3SPierre Pronchery/* BIO_s_file() */ 468b077aed3SPierre Pronchery# define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)(fp)) 469b077aed3SPierre Pronchery# define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)(fpp)) 470b077aed3SPierre Pronchery 471b077aed3SPierre Pronchery/* BIO_s_fd() and BIO_s_file() */ 472b077aed3SPierre Pronchery# define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL) 473b077aed3SPierre Pronchery# define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL) 474b077aed3SPierre Pronchery 475b077aed3SPierre Pronchery/* 476b077aed3SPierre Pronchery * name is cast to lose const, but might be better to route through a 477b077aed3SPierre Pronchery * function so we can do it safely 478b077aed3SPierre Pronchery */ 479b077aed3SPierre Pronchery# ifdef CONST_STRICT 480b077aed3SPierre Pronchery/* 481b077aed3SPierre Pronchery * If you are wondering why this isn't defined, its because CONST_STRICT is 482b077aed3SPierre Pronchery * purely a compile-time kludge to allow const to be checked. 483b077aed3SPierre Pronchery */ 484b077aed3SPierre Proncheryint BIO_read_filename(BIO *b, const char *name); 485b077aed3SPierre Pronchery# else 486b077aed3SPierre Pronchery# define BIO_read_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ 487b077aed3SPierre Pronchery BIO_CLOSE|BIO_FP_READ,(char *)(name)) 488b077aed3SPierre Pronchery# endif 489b077aed3SPierre Pronchery# define BIO_write_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ 490b077aed3SPierre Pronchery BIO_CLOSE|BIO_FP_WRITE,name) 491b077aed3SPierre Pronchery# define BIO_append_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ 492b077aed3SPierre Pronchery BIO_CLOSE|BIO_FP_APPEND,name) 493b077aed3SPierre Pronchery# define BIO_rw_filename(b,name) (int)BIO_ctrl(b,BIO_C_SET_FILENAME, \ 494b077aed3SPierre Pronchery BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name) 495b077aed3SPierre Pronchery 496b077aed3SPierre Pronchery/* 497b077aed3SPierre Pronchery * WARNING WARNING, this ups the reference count on the read bio of the SSL 498b077aed3SPierre Pronchery * structure. This is because the ssl read BIO is now pointed to by the 499b077aed3SPierre Pronchery * next_bio field in the bio. So when you free the BIO, make sure you are 500b077aed3SPierre Pronchery * doing a BIO_free_all() to catch the underlying BIO. 501b077aed3SPierre Pronchery */ 502b077aed3SPierre Pronchery# define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)(ssl)) 503b077aed3SPierre Pronchery# define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)(sslp)) 504b077aed3SPierre Pronchery# define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL) 505b077aed3SPierre Pronchery# define BIO_set_ssl_renegotiate_bytes(b,num) \ 506b077aed3SPierre Pronchery BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL) 507b077aed3SPierre Pronchery# define BIO_get_num_renegotiates(b) \ 508b077aed3SPierre Pronchery BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL) 509b077aed3SPierre Pronchery# define BIO_set_ssl_renegotiate_timeout(b,seconds) \ 510b077aed3SPierre Pronchery BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL) 511b077aed3SPierre Pronchery 512b077aed3SPierre Pronchery/* defined in evp.h */ 513b077aed3SPierre Pronchery/* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)(md)) */ 514b077aed3SPierre Pronchery 515b077aed3SPierre Pronchery# define BIO_get_mem_data(b,pp) BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)(pp)) 516b077aed3SPierre Pronchery# define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)(bm)) 517b077aed3SPierre Pronchery# define BIO_get_mem_ptr(b,pp) BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0, \ 518b077aed3SPierre Pronchery (char *)(pp)) 519b077aed3SPierre Pronchery# define BIO_set_mem_eof_return(b,v) \ 520b077aed3SPierre Pronchery BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL) 521b077aed3SPierre Pronchery 522b077aed3SPierre Pronchery/* For the BIO_f_buffer() type */ 523b077aed3SPierre Pronchery# define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL) 524b077aed3SPierre Pronchery# define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL) 525b077aed3SPierre Pronchery# define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0) 526b077aed3SPierre Pronchery# define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1) 527b077aed3SPierre Pronchery# define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf) 528b077aed3SPierre Pronchery 529b077aed3SPierre Pronchery/* Don't use the next one unless you know what you are doing :-) */ 530b077aed3SPierre Pronchery# define BIO_dup_state(b,ret) BIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret)) 531b077aed3SPierre Pronchery 532b077aed3SPierre Pronchery# define BIO_reset(b) (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL) 533b077aed3SPierre Pronchery# define BIO_eof(b) (int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL) 534b077aed3SPierre Pronchery# define BIO_set_close(b,c) (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL) 535b077aed3SPierre Pronchery# define BIO_get_close(b) (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL) 536b077aed3SPierre Pronchery# define BIO_pending(b) (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL) 537b077aed3SPierre Pronchery# define BIO_wpending(b) (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL) 538b077aed3SPierre Pronchery/* ...pending macros have inappropriate return type */ 539b077aed3SPierre Proncherysize_t BIO_ctrl_pending(BIO *b); 540b077aed3SPierre Proncherysize_t BIO_ctrl_wpending(BIO *b); 541b077aed3SPierre Pronchery# define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL) 542b077aed3SPierre Pronchery# define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \ 543b077aed3SPierre Pronchery cbp) 544b077aed3SPierre Pronchery# define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb) 545b077aed3SPierre Pronchery 546b077aed3SPierre Pronchery/* For the BIO_f_buffer() type */ 547b077aed3SPierre Pronchery# define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL) 548b077aed3SPierre Pronchery# define BIO_buffer_peek(b,s,l) BIO_ctrl(b,BIO_CTRL_PEEK,(l),(s)) 549b077aed3SPierre Pronchery 550b077aed3SPierre Pronchery/* For BIO_s_bio() */ 551b077aed3SPierre Pronchery# define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL) 552b077aed3SPierre Pronchery# define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL) 553b077aed3SPierre Pronchery# define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2) 554b077aed3SPierre Pronchery# define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL) 555b077aed3SPierre Pronchery# define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL) 556b077aed3SPierre Pronchery/* macros with inappropriate type -- but ...pending macros use int too: */ 557b077aed3SPierre Pronchery# define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL) 558b077aed3SPierre Pronchery# define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL) 559b077aed3SPierre Proncherysize_t BIO_ctrl_get_write_guarantee(BIO *b); 560b077aed3SPierre Proncherysize_t BIO_ctrl_get_read_request(BIO *b); 561b077aed3SPierre Proncheryint BIO_ctrl_reset_read_request(BIO *b); 562b077aed3SPierre Pronchery 563b077aed3SPierre Pronchery/* ctrl macros for dgram */ 564b077aed3SPierre Pronchery# define BIO_ctrl_dgram_connect(b,peer) \ 565b077aed3SPierre Pronchery (int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)(peer)) 566b077aed3SPierre Pronchery# define BIO_ctrl_set_connected(b,peer) \ 567b077aed3SPierre Pronchery (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, 0, (char *)(peer)) 568b077aed3SPierre Pronchery# define BIO_dgram_recv_timedout(b) \ 569b077aed3SPierre Pronchery (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL) 570b077aed3SPierre Pronchery# define BIO_dgram_send_timedout(b) \ 571b077aed3SPierre Pronchery (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL) 572b077aed3SPierre Pronchery# define BIO_dgram_get_peer(b,peer) \ 573b077aed3SPierre Pronchery (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)(peer)) 574b077aed3SPierre Pronchery# define BIO_dgram_set_peer(b,peer) \ 575b077aed3SPierre Pronchery (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)(peer)) 576b077aed3SPierre Pronchery# define BIO_dgram_get_mtu_overhead(b) \ 577b077aed3SPierre Pronchery (unsigned int)BIO_ctrl((b), BIO_CTRL_DGRAM_GET_MTU_OVERHEAD, 0, NULL) 578b077aed3SPierre Pronchery 579b077aed3SPierre Pronchery/* ctrl macros for BIO_f_prefix */ 580b077aed3SPierre Pronchery# define BIO_set_prefix(b,p) BIO_ctrl((b), BIO_CTRL_SET_PREFIX, 0, (void *)(p)) 581b077aed3SPierre Pronchery# define BIO_set_indent(b,i) BIO_ctrl((b), BIO_CTRL_SET_INDENT, (i), NULL) 582b077aed3SPierre Pronchery# define BIO_get_indent(b) BIO_ctrl((b), BIO_CTRL_GET_INDENT, 0, NULL) 583b077aed3SPierre Pronchery 584b077aed3SPierre Pronchery#define BIO_get_ex_new_index(l, p, newf, dupf, freef) \ 585b077aed3SPierre Pronchery CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_BIO, l, p, newf, dupf, freef) 586b077aed3SPierre Proncheryint BIO_set_ex_data(BIO *bio, int idx, void *data); 587b077aed3SPierre Proncheryvoid *BIO_get_ex_data(const BIO *bio, int idx); 588b077aed3SPierre Proncheryuint64_t BIO_number_read(BIO *bio); 589b077aed3SPierre Proncheryuint64_t BIO_number_written(BIO *bio); 590b077aed3SPierre Pronchery 591b077aed3SPierre Pronchery/* For BIO_f_asn1() */ 592b077aed3SPierre Proncheryint BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix, 593b077aed3SPierre Pronchery asn1_ps_func *prefix_free); 594b077aed3SPierre Proncheryint BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix, 595b077aed3SPierre Pronchery asn1_ps_func **pprefix_free); 596b077aed3SPierre Proncheryint BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix, 597b077aed3SPierre Pronchery asn1_ps_func *suffix_free); 598b077aed3SPierre Proncheryint BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, 599b077aed3SPierre Pronchery asn1_ps_func **psuffix_free); 600b077aed3SPierre Pronchery 601b077aed3SPierre Proncheryconst BIO_METHOD *BIO_s_file(void); 602b077aed3SPierre ProncheryBIO *BIO_new_file(const char *filename, const char *mode); 603b077aed3SPierre ProncheryBIO *BIO_new_from_core_bio(OSSL_LIB_CTX *libctx, OSSL_CORE_BIO *corebio); 604b077aed3SPierre Pronchery# ifndef OPENSSL_NO_STDIO 605b077aed3SPierre ProncheryBIO *BIO_new_fp(FILE *stream, int close_flag); 606b077aed3SPierre Pronchery# endif 607b077aed3SPierre ProncheryBIO *BIO_new_ex(OSSL_LIB_CTX *libctx, const BIO_METHOD *method); 608b077aed3SPierre ProncheryBIO *BIO_new(const BIO_METHOD *type); 609b077aed3SPierre Proncheryint BIO_free(BIO *a); 610b077aed3SPierre Proncheryvoid BIO_set_data(BIO *a, void *ptr); 611b077aed3SPierre Proncheryvoid *BIO_get_data(BIO *a); 612b077aed3SPierre Proncheryvoid BIO_set_init(BIO *a, int init); 613b077aed3SPierre Proncheryint BIO_get_init(BIO *a); 614b077aed3SPierre Proncheryvoid BIO_set_shutdown(BIO *a, int shut); 615b077aed3SPierre Proncheryint BIO_get_shutdown(BIO *a); 616b077aed3SPierre Proncheryvoid BIO_vfree(BIO *a); 617b077aed3SPierre Proncheryint BIO_up_ref(BIO *a); 618b077aed3SPierre Proncheryint BIO_read(BIO *b, void *data, int dlen); 619b077aed3SPierre Proncheryint BIO_read_ex(BIO *b, void *data, size_t dlen, size_t *readbytes); 620b077aed3SPierre Proncheryint BIO_gets(BIO *bp, char *buf, int size); 621b077aed3SPierre Proncheryint BIO_get_line(BIO *bio, char *buf, int size); 622b077aed3SPierre Proncheryint BIO_write(BIO *b, const void *data, int dlen); 623b077aed3SPierre Proncheryint BIO_write_ex(BIO *b, const void *data, size_t dlen, size_t *written); 624b077aed3SPierre Proncheryint BIO_puts(BIO *bp, const char *buf); 625b077aed3SPierre Proncheryint BIO_indent(BIO *b, int indent, int max); 626b077aed3SPierre Proncherylong BIO_ctrl(BIO *bp, int cmd, long larg, void *parg); 627b077aed3SPierre Proncherylong BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp); 628b077aed3SPierre Proncheryvoid *BIO_ptr_ctrl(BIO *bp, int cmd, long larg); 629b077aed3SPierre Proncherylong BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg); 630b077aed3SPierre ProncheryBIO *BIO_push(BIO *b, BIO *append); 631b077aed3SPierre ProncheryBIO *BIO_pop(BIO *b); 632b077aed3SPierre Proncheryvoid BIO_free_all(BIO *a); 633b077aed3SPierre ProncheryBIO *BIO_find_type(BIO *b, int bio_type); 634b077aed3SPierre ProncheryBIO *BIO_next(BIO *b); 635b077aed3SPierre Proncheryvoid BIO_set_next(BIO *b, BIO *next); 636b077aed3SPierre ProncheryBIO *BIO_get_retry_BIO(BIO *bio, int *reason); 637b077aed3SPierre Proncheryint BIO_get_retry_reason(BIO *bio); 638b077aed3SPierre Proncheryvoid BIO_set_retry_reason(BIO *bio, int reason); 639b077aed3SPierre ProncheryBIO *BIO_dup_chain(BIO *in); 640b077aed3SPierre Pronchery 641b077aed3SPierre Proncheryint BIO_nread0(BIO *bio, char **buf); 642b077aed3SPierre Proncheryint BIO_nread(BIO *bio, char **buf, int num); 643b077aed3SPierre Proncheryint BIO_nwrite0(BIO *bio, char **buf); 644b077aed3SPierre Proncheryint BIO_nwrite(BIO *bio, char **buf, int num); 645b077aed3SPierre Pronchery 646b077aed3SPierre Proncheryconst BIO_METHOD *BIO_s_mem(void); 647b077aed3SPierre Proncheryconst BIO_METHOD *BIO_s_secmem(void); 648b077aed3SPierre ProncheryBIO *BIO_new_mem_buf(const void *buf, int len); 649b077aed3SPierre Pronchery# ifndef OPENSSL_NO_SOCK 650b077aed3SPierre Proncheryconst BIO_METHOD *BIO_s_socket(void); 651b077aed3SPierre Proncheryconst BIO_METHOD *BIO_s_connect(void); 652b077aed3SPierre Proncheryconst BIO_METHOD *BIO_s_accept(void); 653b077aed3SPierre Pronchery# endif 654b077aed3SPierre Proncheryconst BIO_METHOD *BIO_s_fd(void); 655b077aed3SPierre Proncheryconst BIO_METHOD *BIO_s_log(void); 656b077aed3SPierre Proncheryconst BIO_METHOD *BIO_s_bio(void); 657b077aed3SPierre Proncheryconst BIO_METHOD *BIO_s_null(void); 658b077aed3SPierre Proncheryconst BIO_METHOD *BIO_f_null(void); 659b077aed3SPierre Proncheryconst BIO_METHOD *BIO_f_buffer(void); 660b077aed3SPierre Proncheryconst BIO_METHOD *BIO_f_readbuffer(void); 661b077aed3SPierre Proncheryconst BIO_METHOD *BIO_f_linebuffer(void); 662b077aed3SPierre Proncheryconst BIO_METHOD *BIO_f_nbio_test(void); 663b077aed3SPierre Proncheryconst BIO_METHOD *BIO_f_prefix(void); 664b077aed3SPierre Proncheryconst BIO_METHOD *BIO_s_core(void); 665b077aed3SPierre Pronchery# ifndef OPENSSL_NO_DGRAM 666b077aed3SPierre Proncheryconst BIO_METHOD *BIO_s_datagram(void); 667b077aed3SPierre Proncheryint BIO_dgram_non_fatal_error(int error); 668b077aed3SPierre ProncheryBIO *BIO_new_dgram(int fd, int close_flag); 669b077aed3SPierre Pronchery# ifndef OPENSSL_NO_SCTP 670b077aed3SPierre Proncheryconst BIO_METHOD *BIO_s_datagram_sctp(void); 671b077aed3SPierre ProncheryBIO *BIO_new_dgram_sctp(int fd, int close_flag); 672b077aed3SPierre Proncheryint BIO_dgram_is_sctp(BIO *bio); 673b077aed3SPierre Proncheryint BIO_dgram_sctp_notification_cb(BIO *b, 674b077aed3SPierre Pronchery BIO_dgram_sctp_notification_handler_fn handle_notifications, 675b077aed3SPierre Pronchery void *context); 676b077aed3SPierre Proncheryint BIO_dgram_sctp_wait_for_dry(BIO *b); 677b077aed3SPierre Proncheryint BIO_dgram_sctp_msg_waiting(BIO *b); 678b077aed3SPierre Pronchery# endif 679b077aed3SPierre Pronchery# endif 680b077aed3SPierre Pronchery 681b077aed3SPierre Pronchery# ifndef OPENSSL_NO_SOCK 682b077aed3SPierre Proncheryint BIO_sock_should_retry(int i); 683b077aed3SPierre Proncheryint BIO_sock_non_fatal_error(int error); 684b077aed3SPierre Proncheryint BIO_socket_wait(int fd, int for_read, time_t max_time); 685b077aed3SPierre Pronchery# endif 686b077aed3SPierre Proncheryint BIO_wait(BIO *bio, time_t max_time, unsigned int nap_milliseconds); 687b077aed3SPierre Proncheryint BIO_do_connect_retry(BIO *bio, int timeout, int nap_milliseconds); 688b077aed3SPierre Pronchery 689b077aed3SPierre Proncheryint BIO_fd_should_retry(int i); 690b077aed3SPierre Proncheryint BIO_fd_non_fatal_error(int error); 691b077aed3SPierre Proncheryint BIO_dump_cb(int (*cb) (const void *data, size_t len, void *u), 692b077aed3SPierre Pronchery void *u, const void *s, int len); 693b077aed3SPierre Proncheryint BIO_dump_indent_cb(int (*cb) (const void *data, size_t len, void *u), 694b077aed3SPierre Pronchery void *u, const void *s, int len, int indent); 695b077aed3SPierre Proncheryint BIO_dump(BIO *b, const void *bytes, int len); 696b077aed3SPierre Proncheryint BIO_dump_indent(BIO *b, const void *bytes, int len, int indent); 697b077aed3SPierre Pronchery# ifndef OPENSSL_NO_STDIO 698b077aed3SPierre Proncheryint BIO_dump_fp(FILE *fp, const void *s, int len); 699b077aed3SPierre Proncheryint BIO_dump_indent_fp(FILE *fp, const void *s, int len, int indent); 700b077aed3SPierre Pronchery# endif 701b077aed3SPierre Proncheryint BIO_hex_string(BIO *out, int indent, int width, const void *data, 702b077aed3SPierre Pronchery int datalen); 703b077aed3SPierre Pronchery 704b077aed3SPierre Pronchery# ifndef OPENSSL_NO_SOCK 705b077aed3SPierre ProncheryBIO_ADDR *BIO_ADDR_new(void); 706b077aed3SPierre Proncheryint BIO_ADDR_rawmake(BIO_ADDR *ap, int family, 707b077aed3SPierre Pronchery const void *where, size_t wherelen, unsigned short port); 708b077aed3SPierre Proncheryvoid BIO_ADDR_free(BIO_ADDR *); 709b077aed3SPierre Proncheryvoid BIO_ADDR_clear(BIO_ADDR *ap); 710b077aed3SPierre Proncheryint BIO_ADDR_family(const BIO_ADDR *ap); 711b077aed3SPierre Proncheryint BIO_ADDR_rawaddress(const BIO_ADDR *ap, void *p, size_t *l); 712b077aed3SPierre Proncheryunsigned short BIO_ADDR_rawport(const BIO_ADDR *ap); 713b077aed3SPierre Proncherychar *BIO_ADDR_hostname_string(const BIO_ADDR *ap, int numeric); 714b077aed3SPierre Proncherychar *BIO_ADDR_service_string(const BIO_ADDR *ap, int numeric); 715b077aed3SPierre Proncherychar *BIO_ADDR_path_string(const BIO_ADDR *ap); 716b077aed3SPierre Pronchery 717b077aed3SPierre Proncheryconst BIO_ADDRINFO *BIO_ADDRINFO_next(const BIO_ADDRINFO *bai); 718b077aed3SPierre Proncheryint BIO_ADDRINFO_family(const BIO_ADDRINFO *bai); 719b077aed3SPierre Proncheryint BIO_ADDRINFO_socktype(const BIO_ADDRINFO *bai); 720b077aed3SPierre Proncheryint BIO_ADDRINFO_protocol(const BIO_ADDRINFO *bai); 721b077aed3SPierre Proncheryconst BIO_ADDR *BIO_ADDRINFO_address(const BIO_ADDRINFO *bai); 722b077aed3SPierre Proncheryvoid BIO_ADDRINFO_free(BIO_ADDRINFO *bai); 723b077aed3SPierre Pronchery 724b077aed3SPierre Proncheryenum BIO_hostserv_priorities { 725b077aed3SPierre Pronchery BIO_PARSE_PRIO_HOST, BIO_PARSE_PRIO_SERV 726b077aed3SPierre Pronchery}; 727b077aed3SPierre Proncheryint BIO_parse_hostserv(const char *hostserv, char **host, char **service, 728b077aed3SPierre Pronchery enum BIO_hostserv_priorities hostserv_prio); 729b077aed3SPierre Proncheryenum BIO_lookup_type { 730b077aed3SPierre Pronchery BIO_LOOKUP_CLIENT, BIO_LOOKUP_SERVER 731b077aed3SPierre Pronchery}; 732b077aed3SPierre Proncheryint BIO_lookup(const char *host, const char *service, 733b077aed3SPierre Pronchery enum BIO_lookup_type lookup_type, 734b077aed3SPierre Pronchery int family, int socktype, BIO_ADDRINFO **res); 735b077aed3SPierre Proncheryint BIO_lookup_ex(const char *host, const char *service, 736b077aed3SPierre Pronchery int lookup_type, int family, int socktype, int protocol, 737b077aed3SPierre Pronchery BIO_ADDRINFO **res); 738b077aed3SPierre Proncheryint BIO_sock_error(int sock); 739b077aed3SPierre Proncheryint BIO_socket_ioctl(int fd, long type, void *arg); 740b077aed3SPierre Proncheryint BIO_socket_nbio(int fd, int mode); 741b077aed3SPierre Proncheryint BIO_sock_init(void); 742b077aed3SPierre Pronchery# ifndef OPENSSL_NO_DEPRECATED_1_1_0 743b077aed3SPierre Pronchery# define BIO_sock_cleanup() while(0) continue 744b077aed3SPierre Pronchery# endif 745b077aed3SPierre Proncheryint BIO_set_tcp_ndelay(int sock, int turn_on); 746b077aed3SPierre Pronchery# ifndef OPENSSL_NO_DEPRECATED_1_1_0 747b077aed3SPierre ProncheryOSSL_DEPRECATEDIN_1_1_0 struct hostent *BIO_gethostbyname(const char *name); 748b077aed3SPierre ProncheryOSSL_DEPRECATEDIN_1_1_0 int BIO_get_port(const char *str, unsigned short *port_ptr); 749b077aed3SPierre ProncheryOSSL_DEPRECATEDIN_1_1_0 int BIO_get_host_ip(const char *str, unsigned char *ip); 750b077aed3SPierre ProncheryOSSL_DEPRECATEDIN_1_1_0 int BIO_get_accept_socket(char *host_port, int mode); 751b077aed3SPierre ProncheryOSSL_DEPRECATEDIN_1_1_0 int BIO_accept(int sock, char **ip_port); 752b077aed3SPierre Pronchery# endif 753b077aed3SPierre Pronchery 754b077aed3SPierre Proncheryunion BIO_sock_info_u { 755b077aed3SPierre Pronchery BIO_ADDR *addr; 756b077aed3SPierre Pronchery}; 757b077aed3SPierre Proncheryenum BIO_sock_info_type { 758b077aed3SPierre Pronchery BIO_SOCK_INFO_ADDRESS 759b077aed3SPierre Pronchery}; 760b077aed3SPierre Proncheryint BIO_sock_info(int sock, 761b077aed3SPierre Pronchery enum BIO_sock_info_type type, union BIO_sock_info_u *info); 762b077aed3SPierre Pronchery 763b077aed3SPierre Pronchery# define BIO_SOCK_REUSEADDR 0x01 764b077aed3SPierre Pronchery# define BIO_SOCK_V6_ONLY 0x02 765b077aed3SPierre Pronchery# define BIO_SOCK_KEEPALIVE 0x04 766b077aed3SPierre Pronchery# define BIO_SOCK_NONBLOCK 0x08 767b077aed3SPierre Pronchery# define BIO_SOCK_NODELAY 0x10 768b077aed3SPierre Pronchery 769b077aed3SPierre Proncheryint BIO_socket(int domain, int socktype, int protocol, int options); 770b077aed3SPierre Proncheryint BIO_connect(int sock, const BIO_ADDR *addr, int options); 771b077aed3SPierre Proncheryint BIO_bind(int sock, const BIO_ADDR *addr, int options); 772b077aed3SPierre Proncheryint BIO_listen(int sock, const BIO_ADDR *addr, int options); 773b077aed3SPierre Proncheryint BIO_accept_ex(int accept_sock, BIO_ADDR *addr, int options); 774b077aed3SPierre Proncheryint BIO_closesocket(int sock); 775b077aed3SPierre Pronchery 776b077aed3SPierre ProncheryBIO *BIO_new_socket(int sock, int close_flag); 777b077aed3SPierre ProncheryBIO *BIO_new_connect(const char *host_port); 778b077aed3SPierre ProncheryBIO *BIO_new_accept(const char *host_port); 779b077aed3SPierre Pronchery# endif /* OPENSSL_NO_SOCK*/ 780b077aed3SPierre Pronchery 781b077aed3SPierre ProncheryBIO *BIO_new_fd(int fd, int close_flag); 782b077aed3SPierre Pronchery 783b077aed3SPierre Proncheryint BIO_new_bio_pair(BIO **bio1, size_t writebuf1, 784b077aed3SPierre Pronchery BIO **bio2, size_t writebuf2); 785b077aed3SPierre Pronchery/* 786b077aed3SPierre Pronchery * If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints. 787b077aed3SPierre Pronchery * Otherwise returns 0 and sets *bio1 and *bio2 to NULL. Size 0 uses default 788b077aed3SPierre Pronchery * value. 789b077aed3SPierre Pronchery */ 790b077aed3SPierre Pronchery 791b077aed3SPierre Proncheryvoid BIO_copy_next_retry(BIO *b); 792b077aed3SPierre Pronchery 793b077aed3SPierre Pronchery/* 794b077aed3SPierre Pronchery * long BIO_ghbn_ctrl(int cmd,int iarg,char *parg); 795b077aed3SPierre Pronchery */ 796b077aed3SPierre Pronchery 797b077aed3SPierre Pronchery# define ossl_bio__attr__(x) 798b077aed3SPierre Pronchery# if defined(__GNUC__) && defined(__STDC_VERSION__) \ 799b077aed3SPierre Pronchery && !defined(__MINGW32__) && !defined(__MINGW64__) \ 800b077aed3SPierre Pronchery && !defined(__APPLE__) 801b077aed3SPierre Pronchery /* 802b077aed3SPierre Pronchery * Because we support the 'z' modifier, which made its appearance in C99, 803b077aed3SPierre Pronchery * we can't use __attribute__ with pre C99 dialects. 804b077aed3SPierre Pronchery */ 805b077aed3SPierre Pronchery# if __STDC_VERSION__ >= 199901L 806b077aed3SPierre Pronchery# undef ossl_bio__attr__ 807b077aed3SPierre Pronchery# define ossl_bio__attr__ __attribute__ 808b077aed3SPierre Pronchery# if __GNUC__*10 + __GNUC_MINOR__ >= 44 809b077aed3SPierre Pronchery# define ossl_bio__printf__ __gnu_printf__ 810b077aed3SPierre Pronchery# else 811b077aed3SPierre Pronchery# define ossl_bio__printf__ __printf__ 812b077aed3SPierre Pronchery# endif 813b077aed3SPierre Pronchery# endif 814b077aed3SPierre Pronchery# endif 815b077aed3SPierre Proncheryint BIO_printf(BIO *bio, const char *format, ...) 816b077aed3SPierre Proncheryossl_bio__attr__((__format__(ossl_bio__printf__, 2, 3))); 817b077aed3SPierre Proncheryint BIO_vprintf(BIO *bio, const char *format, va_list args) 818b077aed3SPierre Proncheryossl_bio__attr__((__format__(ossl_bio__printf__, 2, 0))); 819b077aed3SPierre Proncheryint BIO_snprintf(char *buf, size_t n, const char *format, ...) 820b077aed3SPierre Proncheryossl_bio__attr__((__format__(ossl_bio__printf__, 3, 4))); 821b077aed3SPierre Proncheryint BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) 822b077aed3SPierre Proncheryossl_bio__attr__((__format__(ossl_bio__printf__, 3, 0))); 823b077aed3SPierre Pronchery# undef ossl_bio__attr__ 824b077aed3SPierre Pronchery# undef ossl_bio__printf__ 825b077aed3SPierre Pronchery 826b077aed3SPierre Pronchery 827b077aed3SPierre ProncheryBIO_METHOD *BIO_meth_new(int type, const char *name); 828b077aed3SPierre Proncheryvoid BIO_meth_free(BIO_METHOD *biom); 829b077aed3SPierre Proncheryint (*BIO_meth_get_write(const BIO_METHOD *biom)) (BIO *, const char *, int); 830b077aed3SPierre Proncheryint (*BIO_meth_get_write_ex(const BIO_METHOD *biom)) (BIO *, const char *, size_t, 831b077aed3SPierre Pronchery size_t *); 832b077aed3SPierre Proncheryint BIO_meth_set_write(BIO_METHOD *biom, 833b077aed3SPierre Pronchery int (*write) (BIO *, const char *, int)); 834b077aed3SPierre Proncheryint BIO_meth_set_write_ex(BIO_METHOD *biom, 835b077aed3SPierre Pronchery int (*bwrite) (BIO *, const char *, size_t, size_t *)); 836b077aed3SPierre Proncheryint (*BIO_meth_get_read(const BIO_METHOD *biom)) (BIO *, char *, int); 837b077aed3SPierre Proncheryint (*BIO_meth_get_read_ex(const BIO_METHOD *biom)) (BIO *, char *, size_t, size_t *); 838b077aed3SPierre Proncheryint BIO_meth_set_read(BIO_METHOD *biom, 839b077aed3SPierre Pronchery int (*read) (BIO *, char *, int)); 840b077aed3SPierre Proncheryint BIO_meth_set_read_ex(BIO_METHOD *biom, 841b077aed3SPierre Pronchery int (*bread) (BIO *, char *, size_t, size_t *)); 842b077aed3SPierre Proncheryint (*BIO_meth_get_puts(const BIO_METHOD *biom)) (BIO *, const char *); 843b077aed3SPierre Proncheryint BIO_meth_set_puts(BIO_METHOD *biom, 844b077aed3SPierre Pronchery int (*puts) (BIO *, const char *)); 845b077aed3SPierre Proncheryint (*BIO_meth_get_gets(const BIO_METHOD *biom)) (BIO *, char *, int); 846b077aed3SPierre Proncheryint BIO_meth_set_gets(BIO_METHOD *biom, 847*e0c4386eSCy Schubert int (*ossl_gets) (BIO *, char *, int)); 848b077aed3SPierre Proncherylong (*BIO_meth_get_ctrl(const BIO_METHOD *biom)) (BIO *, int, long, void *); 849b077aed3SPierre Proncheryint BIO_meth_set_ctrl(BIO_METHOD *biom, 850b077aed3SPierre Pronchery long (*ctrl) (BIO *, int, long, void *)); 851b077aed3SPierre Proncheryint (*BIO_meth_get_create(const BIO_METHOD *bion)) (BIO *); 852b077aed3SPierre Proncheryint BIO_meth_set_create(BIO_METHOD *biom, int (*create) (BIO *)); 853b077aed3SPierre Proncheryint (*BIO_meth_get_destroy(const BIO_METHOD *biom)) (BIO *); 854b077aed3SPierre Proncheryint BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy) (BIO *)); 855b077aed3SPierre Proncherylong (*BIO_meth_get_callback_ctrl(const BIO_METHOD *biom)) 856b077aed3SPierre Pronchery (BIO *, int, BIO_info_cb *); 857b077aed3SPierre Proncheryint BIO_meth_set_callback_ctrl(BIO_METHOD *biom, 858b077aed3SPierre Pronchery long (*callback_ctrl) (BIO *, int, 859b077aed3SPierre Pronchery BIO_info_cb *)); 860b077aed3SPierre Pronchery 861b077aed3SPierre Pronchery# ifdef __cplusplus 862b077aed3SPierre Pronchery} 863b077aed3SPierre Pronchery# endif 864b077aed3SPierre Pronchery#endif 865