diff options
Diffstat (limited to 'secure/lib/libcrypto/man/BIO_s_accept.3')
-rw-r--r-- | secure/lib/libcrypto/man/BIO_s_accept.3 | 129 |
1 files changed, 81 insertions, 48 deletions
diff --git a/secure/lib/libcrypto/man/BIO_s_accept.3 b/secure/lib/libcrypto/man/BIO_s_accept.3 index 3cc7f81b5eb82..0821758edc4f5 100644 --- a/secure/lib/libcrypto/man/BIO_s_accept.3 +++ b/secure/lib/libcrypto/man/BIO_s_accept.3 @@ -128,24 +128,25 @@ .rm #[ #] #H #V #F C .\" ======================================================================== .\" -.IX Title "BIO_s_accept 3" -.TH BIO_s_accept 3 "2018-08-14" "1.0.2p" "OpenSSL" +.IX Title "BIO_S_ACCEPT 3" +.TH BIO_S_ACCEPT 3 "2018-09-11" "1.1.1" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" -BIO_s_accept, BIO_set_accept_port, BIO_get_accept_port, BIO_new_accept, -BIO_set_nbio_accept, BIO_set_accept_bios, BIO_set_bind_mode, -BIO_get_bind_mode, BIO_do_accept \- accept BIO +BIO_s_accept, BIO_set_accept_name, BIO_set_accept_port, BIO_get_accept_name, BIO_get_accept_port, BIO_new_accept, BIO_set_nbio_accept, BIO_set_accept_bios, BIO_get_peer_name, BIO_get_peer_port, BIO_get_accept_ip_family, BIO_set_accept_ip_family, BIO_set_bind_mode, BIO_get_bind_mode, BIO_do_accept \- accept BIO .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& #include <openssl/bio.h> \& -\& BIO_METHOD *BIO_s_accept(void); +\& const BIO_METHOD *BIO_s_accept(void); \& -\& long BIO_set_accept_port(BIO *b, char *name); +\& long BIO_set_accept_name(BIO *b, char *name); +\& char *BIO_get_accept_name(BIO *b); +\& +\& long BIO_set_accept_port(BIO *b, char *port); \& char *BIO_get_accept_port(BIO *b); \& \& BIO *BIO_new_accept(char *host_port); @@ -153,12 +154,13 @@ BIO_get_bind_mode, BIO_do_accept \- accept BIO \& long BIO_set_nbio_accept(BIO *b, int n); \& long BIO_set_accept_bios(BIO *b, char *bio); \& -\& long BIO_set_bind_mode(BIO *b, long mode); -\& long BIO_get_bind_mode(BIO *b, long dummy); +\& char *BIO_get_peer_name(BIO *b); +\& char *BIO_get_peer_port(BIO *b); +\& long BIO_get_accept_ip_family(BIO *b); +\& long BIO_set_accept_ip_family(BIO *b, long family); \& -\& #define BIO_BIND_NORMAL 0 -\& #define BIO_BIND_REUSEADDR_IF_UNUSED 1 -\& #define BIO_BIND_REUSEADDR 2 +\& long BIO_set_bind_mode(BIO *b, long mode); +\& long BIO_get_bind_mode(BIO *b); \& \& int BIO_do_accept(BIO *b); .Ve @@ -182,23 +184,30 @@ If the close flag is set on an accept \s-1BIO\s0 then any active connection on that chain is shutdown and the socket closed when the \s-1BIO\s0 is freed. .PP -Calling \fIBIO_reset()\fR on a accept \s-1BIO\s0 will close any active +Calling \fIBIO_reset()\fR on an accept \s-1BIO\s0 will close any active connection and reset the \s-1BIO\s0 into a state where it awaits another incoming connection. .PP \&\fIBIO_get_fd()\fR and \fIBIO_set_fd()\fR can be called to retrieve or set the accept socket. See \fIBIO_s_fd\fR\|(3) .PP -\&\fIBIO_set_accept_port()\fR uses the string \fBname\fR to set the accept -port. The port is represented as a string of the form \*(L"host:port\*(R", +\&\fIBIO_set_accept_name()\fR uses the string \fBname\fR to set the accept +name. The name is represented as a string of the form \*(L"host:port\*(R", where \*(L"host\*(R" is the interface to use and \*(L"port\*(R" is the port. -The host can be can be \*(L"*\*(R" which is interpreted as meaning -any interface; \*(L"port\*(R" has the same syntax -as the port specified in \fIBIO_set_conn_port()\fR for connect BIOs, -that is it can be a numerical port string or a string to lookup -using \fIgetservbyname()\fR and a string table. +The host can be \*(L"*\*(R" or empty which is interpreted as meaning +any interface. If the host is an IPv6 address, it has to be +enclosed in brackets, for example \*(L"[::1]:https\*(R". \*(L"port\*(R" has the +same syntax as the port specified in \fIBIO_set_conn_port()\fR for +connect BIOs, that is it can be a numerical port string or a +string to lookup using \fIgetservbyname()\fR and a string table. +.PP +\&\fIBIO_set_accept_port()\fR uses the string \fBport\fR to set the accept +port. \*(L"port\*(R" has the same syntax as the port specified in +\&\fIBIO_set_conn_port()\fR for connect BIOs, that is it can be a numerical +port string or a string to lookup using \fIgetservbyname()\fR and a string +table. .PP -\&\fIBIO_new_accept()\fR combines \fIBIO_new()\fR and \fIBIO_set_accept_port()\fR into +\&\fIBIO_new_accept()\fR combines \fIBIO_new()\fR and \fIBIO_set_accept_name()\fR into a single call: that is it creates a new accept \s-1BIO\s0 with port \&\fBhost_port\fR. .PP @@ -207,19 +216,19 @@ a single call: that is it creates a new accept \s-1BIO\s0 with port .PP \&\fIBIO_set_accept_bios()\fR can be used to set a chain of BIOs which will be duplicated and prepended to the chain when an incoming -connection is received. This is useful if, for example, a +connection is received. This is useful if, for example, a buffering or \s-1SSL BIO\s0 is required for each connection. The chain of BIOs must not be freed after this call, they will be automatically freed when the accept \s-1BIO\s0 is freed. .PP \&\fIBIO_set_bind_mode()\fR and \fIBIO_get_bind_mode()\fR set and retrieve -the current bind mode. If \s-1BIO_BIND_NORMAL\s0 (the default) is set +the current bind mode. If \fB\s-1BIO_BIND_NORMAL\s0\fR (the default) is set then another socket cannot be bound to the same port. If -\&\s-1BIO_BIND_REUSEADDR\s0 is set then other sockets can bind to the -same port. If \s-1BIO_BIND_REUSEADDR_IF_UNUSED\s0 is set then and +\&\fB\s-1BIO_BIND_REUSEADDR\s0\fR is set then other sockets can bind to the +same port. If \fB\s-1BIO_BIND_REUSEADDR_IF_UNUSED\s0\fR is set then and attempt is first made to use \s-1BIO_BIN_NORMAL,\s0 if this fails and the port is not in use then a second attempt is made -using \s-1BIO_BIND_REUSEADDR.\s0 +using \fB\s-1BIO_BIND_REUSEADDR\s0\fR. .PP \&\fIBIO_do_accept()\fR serves two functions. When it is first called, after the accept \s-1BIO\s0 has been setup, it will attempt @@ -271,47 +280,65 @@ then it is an indication that an accept attempt would block: the application should take appropriate action to wait until the underlying socket has accepted a connection and retry the call. .PP -\&\fIBIO_set_accept_port()\fR, \fIBIO_get_accept_port()\fR, \fIBIO_set_nbio_accept()\fR, -\&\fIBIO_set_accept_bios()\fR, \fIBIO_set_bind_mode()\fR, \fIBIO_get_bind_mode()\fR and -\&\fIBIO_do_accept()\fR are macros. +\&\fIBIO_set_accept_name()\fR, \fIBIO_get_accept_name()\fR, \fIBIO_set_accept_port()\fR, +\&\fIBIO_get_accept_port()\fR, \fIBIO_set_nbio_accept()\fR, \fIBIO_set_accept_bios()\fR, +\&\fIBIO_get_peer_name()\fR, \fIBIO_get_peer_port()\fR, +\&\fIBIO_get_accept_ip_family()\fR, \fIBIO_set_accept_ip_family()\fR, +\&\fIBIO_set_bind_mode()\fR, \fIBIO_get_bind_mode()\fR and \fIBIO_do_accept()\fR are macros. .SH "RETURN VALUES" .IX Header "RETURN VALUES" -\&\s-1TBA\s0 +\&\fIBIO_do_accept()\fR, +\&\fIBIO_set_accept_name()\fR, \fIBIO_set_accept_port()\fR, \fIBIO_set_nbio_accept()\fR, +\&\fIBIO_set_accept_bios()\fR, \fIBIO_set_accept_ip_family()\fR, and \fIBIO_set_bind_mode()\fR +return 1 for success and 0 or \-1 for failure. +.PP +\&\fIBIO_get_accept_name()\fR returns the accept name or \s-1NULL\s0 on error. +\&\fIBIO_get_peer_name()\fR returns the peer name or \s-1NULL\s0 on error. +.PP +\&\fIBIO_get_accept_port()\fR returns the accept port as a string or \s-1NULL\s0 on error. +\&\fIBIO_get_peer_port()\fR returns the peer port as a string or \s-1NULL\s0 on error. +\&\fIBIO_get_accept_ip_family()\fR returns the \s-1IP\s0 family or \-1 on error. +.PP +\&\fIBIO_get_bind_mode()\fR returns the set of \fB\s-1BIO_BIND\s0\fR flags, or \-1 on failure. +.PP +\&\fIBIO_new_accept()\fR returns a \s-1BIO\s0 or \s-1NULL\s0 on error. .SH "EXAMPLE" .IX Header "EXAMPLE" This example accepts two connections on port 4444, sends messages down each and finally closes both down. .PP -.Vb 3 +.Vb 1 \& BIO *abio, *cbio, *cbio2; -\& ERR_load_crypto_strings(); -\& abio = BIO_new_accept("4444"); \& \& /* First call to BIO_accept() sets up accept BIO */ -\& if(BIO_do_accept(abio) <= 0) { -\& fprintf(stderr, "Error setting up accept\en"); -\& ERR_print_errors_fp(stderr); -\& exit(0); +\& abio = BIO_new_accept("4444"); +\& if (BIO_do_accept(abio) <= 0) { +\& fprintf(stderr, "Error setting up accept\en"); +\& ERR_print_errors_fp(stderr); +\& exit(1); \& } \& \& /* Wait for incoming connection */ -\& if(BIO_do_accept(abio) <= 0) { -\& fprintf(stderr, "Error accepting connection\en"); -\& ERR_print_errors_fp(stderr); -\& exit(0); +\& if (BIO_do_accept(abio) <= 0) { +\& fprintf(stderr, "Error accepting connection\en"); +\& ERR_print_errors_fp(stderr); +\& exit(1); \& } \& fprintf(stderr, "Connection 1 established\en"); +\& \& /* Retrieve BIO for connection */ \& cbio = BIO_pop(abio); \& BIO_puts(cbio, "Connection 1: Sending out Data on initial connection\en"); \& fprintf(stderr, "Sent out data on connection 1\en"); +\& \& /* Wait for another connection */ -\& if(BIO_do_accept(abio) <= 0) { -\& fprintf(stderr, "Error accepting connection\en"); -\& ERR_print_errors_fp(stderr); -\& exit(0); +\& if (BIO_do_accept(abio) <= 0) { +\& fprintf(stderr, "Error accepting connection\en"); +\& ERR_print_errors_fp(stderr); +\& exit(1); \& } \& fprintf(stderr, "Connection 2 established\en"); +\& \& /* Close accept BIO to refuse further connections */ \& cbio2 = BIO_pop(abio); \& BIO_free(abio); @@ -319,10 +346,16 @@ down each and finally closes both down. \& fprintf(stderr, "Sent out data on connection 2\en"); \& \& BIO_puts(cbio, "Connection 1: Second connection established\en"); +\& \& /* Close the two established connections */ \& BIO_free(cbio); \& BIO_free(cbio2); .Ve -.SH "SEE ALSO" -.IX Header "SEE ALSO" -\&\s-1TBA\s0 +.SH "COPYRIGHT" +.IX Header "COPYRIGHT" +Copyright 2000\-2018 The OpenSSL Project Authors. All Rights Reserved. +.PP +Licensed under the OpenSSL license (the \*(L"License\*(R"). You may not use +this file except in compliance with the License. You can obtain a copy +in the file \s-1LICENSE\s0 in the source distribution or at +<https://www.openssl.org/source/license.html>. |