Any of the following strings are accepted: 8080 (just the port number) www.apache.org (just the hostname) www.apache.org:8080 (hostname and port number) [fe80::1]:80 (IPv6 numeric address string only) [fe80::1eth0] (IPv6 numeric address string and scope id)
The new buffer containing just the hostname. On output, *addr will be NULL if no hostname/IP address was specfied.
scope_id
The new buffer containing just the scope id. On output, *scope_id will be NULL if no scope id was specified.
port
The port number. On output, *port will be 0 if no port was specified. ### FIXME: 0 is a legal port (per RFC 1700). this should ### return something besides zero if the port is missing.
str
The input string to be parsed.
p
The pool from which *addr and *scope_id are allocated.
Remarks:
If scope id shouldn't be allowed, check for scope_id != NULL in addition to checking the return code. If addr/hostname should be required, check for addr == NULL in addition to checking the return code.
See if the IP addresses in two APR socket addresses are equivalent. Appropriate logic is present for comparing IPv4-mapped IPv6 addresses with IPv4 addresses.
Parameters:
addr1
One of the APR socket addresses.
addr2
The other APR socket address.
Remarks:
The return value will be non-zero if the addresses are equivalent.
The hostname or numeric address string to resolve/parse, or NULL to build an address that corresponds to 0.0.0.0 or ::
family
The address family to use, or APR_UNSPEC if the system should decide.
port
The port number.
flags
Special processing flags:
APR_IPV4_ADDR_OK first query for IPv4 addresses; only look
for IPv6 addresses if the first query failed;
only valid if family is APR_UNSPEC and hostname
isn't NULL; mutually exclusive with
APR_IPV6_ADDR_OK
APR_IPV6_ADDR_OK first query for IPv6 addresses; only look
for IPv4 addresses if the first query failed;
only valid if family is APR_UNSPEC and hostname
isn't NULL and APR_HAVE_IPV6; mutually exclusive
with APR_IPV4_ADDR_OK
Return the IP address (in numeric address string format) in an APR socket address. APR will allocate storage for the IP address string from the pool of the apr_sockaddr_t.
A copy of the socket that is connected to the socket that made the connection request. This is the socket which should be used for all future communication.
Return an address associated with a socket; either the address to which the socket is bound locally or the the address of the peer to which the socket is connected.
Determine whether the receive part of the socket has been closed by the peer (such that a subsequent call to apr_socket_read would return APR_EOF), if the socket's receive buffer is empty. This function does not block waiting for I/O.
Parameters:
sock
The socket to check
atreadeof
If APR_SUCCESS is returned, *atreadeof is set to non-zero if a subsequent read would return APR_EOF
Returns:
an error is returned if it was not possible to determine the status, in which case *atreadeof is not changed.
APR_SO_DEBUG -- turn on debugging information
APR_SO_KEEPALIVE -- keep connections active
APR_SO_LINGER -- lingers on close if data is present
APR_SO_NONBLOCK -- Turns blocking on/off for socket
APR_SO_REUSEADDR -- The rules used in validating addresses
supplied to bind should allow reuse
of local addresses.
APR_SO_SNDBUF -- Set the SendBufferSize
APR_SO_RCVBUF -- Set the ReceiveBufferSize
APR_SO_DISCONNECTED -- Query the disconnected state of the socket.
(Currently only used on Windows)
APR_SO_DEBUG -- turn on debugging information
APR_SO_KEEPALIVE -- keep connections active
APR_SO_LINGER -- lingers on close if data is present
APR_SO_NONBLOCK -- Turns blocking on/off for socket
When this option is enabled, use
the APR_STATUS_IS_EAGAIN() macro to
see if a send or receive function
could not transfer data without
blocking.
APR_SO_REUSEADDR -- The rules used in validating addresses
supplied to bind should allow reuse
of local addresses.
APR_SO_SNDBUF -- Set the SendBufferSize
APR_SO_RCVBUF -- Set the ReceiveBufferSize
On entry, the number of bytes to receive; on exit, the number of bytes received.
Remarks:
This functions acts like a blocking read by default. To change
this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
socket option.
The number of bytes actually received is stored in argument 3.
It is possible for both bytes to be received and an APR_EOF or other error to be returned.
Read data from a socket. On success, the address of the peer from which the data was sent is copied into the from parameter, and the len parameter is updated to give the number of bytes written to buf.
Parameters:
from
Updated with the address from which the data was received
Send a file from an open file descriptor to a socket, along with optional headers and trailers
Parameters:
sock
The socket to which we're writing
file
The open file from which to read
hdtr
A structure containing the headers and trailers to send
offset
Offset into the file where we should begin writing
len
(input) - Number of bytes to send from the file (output) - Number of bytes actually sent, including headers, file, and trailers
flags
APR flags that are mapped to OS specific flags
Remarks:
This functions acts like a blocking write by default. To change this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK socket option. The number of bytes actually sent is stored in the len parameter. The offset parameter is passed by reference for no reason; its value will never be modified by the apr_socket_sendfile() function.
The array of iovec structs containing the data to send
nvec
The number of iovec structs in the array
len
Receives the number of bytes actually written
Remarks:
This functions acts like a blocking write by default. To change
this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
socket option.
The number of bytes actually sent is stored in argument 3.
It is possible for both bytes to be sent and an error to be returned.
Shutdown either reading, writing, or both sides of a socket.
Parameters:
thesocket
The socket to close
how
How to shutdown the socket. One of:
APR_SHUTDOWN_READ no longer allow read requests
APR_SHUTDOWN_WRITE no longer allow write requests
APR_SHUTDOWN_READWRITE no longer allow read or write requests
t > 0 -- read and write calls return APR_TIMEUP if specified time
elapsess with no data read or written
t == 0 -- read and write calls never block
t < 0 -- read and write calls block