Sortix nightly manual
This manual documents Sortix nightly, a development build that has not been officially released. You can instead view this document in the latest official manual.
NAME
BIO_get_host_ip, BIO_get_port, BIO_get_accept_socket, BIO_accept, BIO_sock_error, BIO_sock_non_fatal_error, BIO_sock_should_retry, BIO_socket_nbio, BIO_set_tcp_ndelay — wrappers for socket operationsSYNOPSIS
#include <openssl/bio.h>BIO_get_host_ip(const char *hostname, unsigned char *in_addr_buffer);
BIO_get_port(const char *servname, unsigned short *port);
BIO_get_accept_socket(char *host_port, int bind_mode);
BIO_accept(int socket, char **addr);
BIO_sock_error(int socket);
BIO_sock_non_fatal_error(int errnum);
BIO_sock_should_retry(int retval);
BIO_socket_nbio(int socket, int mode);
BIO_set_tcp_ndelay(int socket, int on);
DESCRIPTION
BIO_get_host_ip() looks up one IPv4 address for the given hostname using getaddrinfo(3) and writes the first returned IPv4 address into *in_addr_buffer. The caller is responsible for providing a buffer that is at least sizeof(in_addr_t) bytes long. After a successful call, the caller needs to cast in_addr_buffer to (in_addr_t *).RETURN VALUES
BIO_get_host_ip(), BIO_get_port(), and BIO_socket_nbio() return 1 on success or 0 on failure.ERRORS
If BIO_get_host_ip(), BIO_get_port(), or BIO_get_accept_socket() fail or BIO_accept() fails fatally, the following diagnostics can be retrieved with ERR_get_error(3), ERR_GET_REASON(3), and ERR_reason_error_string(3):- BIO_R_ACCEPT_ERROR “accept error”
- accept(2) failed fatally in BIO_accept().
- BIO_R_BAD_HOSTNAME_LOOKUP “bad hostname lookup”
- getaddrinfo(3) failed or hostname was NULL in BIO_get_host_ip(), or getaddrinfo(3) failed in BIO_get_accept_socket().
- BIO_R_INVALID_ARGUMENT “invalid argument”
- getaddrinfo(3) failed in BIO_get_port().
- ERR_R_MALLOC_FAILURE “malloc failure”
- Memory allocation failed in BIO_get_accept_socket(), or BIO_accept() succeeded but was unable to allocate memory for *addr. For BIO_accept(), the returned file descriptor is valid, and communication with the peer can be attempted using it.
- BIO_R_NO_PORT_SPECIFIED “no port specified”
- The servname argument was NULL in BIO_get_port(), or host_port was NULL or ended after the first colon in BIO_get_accept_socket().
- BIO_R_NULL_PARAMETER “null parameter”
- The addr argument was NULL in BIO_accept().
- BIO_R_UNABLE_TO_BIND_SOCKET “unable to bind socket”
- bind(2) failed in BIO_get_accept_socket().
- BIO_R_UNABLE_TO_CREATE_SOCKET “unable to create socket”
- socket(2) failed in BIO_get_accept_socket().
- BIO_R_UNABLE_TO_LISTEN_SOCKET “unable to listen socket”
- listen(2) failed in BIO_get_accept_socket().