diff options
author | Richard Levitte <levitte@openssl.org> | 2016-02-02 21:04:54 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2016-02-03 19:38:07 +0100 |
commit | d33b215b331116e50947ca7e75d210e1db39b78d (patch) | |
tree | e6ff0dbddd1ad7a894aa69712f916b13991789d7 /include | |
parent | 83be2778fe11ede4cd065a136c686fe664c212a2 (diff) |
Refactoring BIO: new socket-handling functions, deprecate older ones
Added functions:
BIO_socket
BIO_connect
BIO_listen
BIO_accept_ex
BIO_closesocket
BIO_sock_info
These get deprecated:
BIO_gethostbyname
BIO_get_port
BIO_get_host_ip
BIO_get_accept_socket
BIO_accept
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/openssl/bio.h | 44 | ||||
-rw-r--r-- | include/openssl/err.h | 3 |
2 files changed, 33 insertions, 14 deletions
diff --git a/include/openssl/bio.h b/include/openssl/bio.h index 82d48450f1..be659c7c7a 100644 --- a/include/openssl/bio.h +++ b/include/openssl/bio.h @@ -731,27 +731,43 @@ enum BIO_lookup_type { int BIO_lookup(const char *host, const char *service, enum BIO_lookup_type lookup_type, int family, int socktype, BIO_ADDRINFO **res); -struct hostent *BIO_gethostbyname(const char *name); -/*- - * We might want a thread-safe interface too: - * struct hostent *BIO_gethostbyname_r(const char *name, - * struct hostent *result, void *buffer, size_t buflen); - * or something similar (caller allocates a struct hostent, - * pointed to by "result", and additional buffer space for the various - * substructures; if the buffer does not suffice, NULL is returned - * and an appropriate error code is set). - */ 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_get_port(const char *str, unsigned short *port_ptr); -int BIO_get_host_ip(const char *str, unsigned char *ip); -int BIO_get_accept_socket(char *host_port, int mode); -int BIO_accept(int sock, char **ip_port); int BIO_sock_init(void); void BIO_sock_cleanup(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); + +# define BIO_SOCK_REUSEADDR 0x01 +# define BIO_SOCK_V6_ONLY 0x02 +# define BIO_SOCK_KEEPALIVE 0x04 +# define BIO_SOCK_NONBLOCK 0x08 +# define BIO_SOCK_NODELAY 0x10 + +int BIO_socket(int domain, int socktype, int protocol, int options); +int BIO_connect(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); +# if OPENSSL_API_COMPAT >= 0x10100000L +# define BIO_accept(as,s,a) BIO_accept_ex((as),(s),(a)) +# endif +int BIO_closesocket(int sock); + BIO *BIO_new_socket(int sock, int close_flag); BIO *BIO_new_dgram(int fd, int close_flag); # ifndef OPENSSL_NO_SCTP diff --git a/include/openssl/err.h b/include/openssl/err.h index 0214e68c87..370763c35f 100644 --- a/include/openssl/err.h +++ b/include/openssl/err.h @@ -259,6 +259,9 @@ typedef struct err_state_st { # define SYS_F_FREAD 11 # define SYS_F_GETADDRINFO 12 # define SYS_F_GETNAMEINFO 13 +# define SYS_F_SETSOCKOPT 14 +# define SYS_F_GETSOCKOPT 15 +# define SYS_F_GETSOCKNAME 16 /* reasons */ # define ERR_R_SYS_LIB ERR_LIB_SYS/* 2 */ |