📄 apr_network_io.h
字号:
* don't wait at all. * APR_SO_SNDBUF -- Set the SendBufferSize * APR_SO_RCVBUF -- Set the ReceiveBufferSize * </PRE> * @param on Value for the option. * @deffunc apr_status_t apr_setsocketopt(apr_socket_t *sock, apr_int32_t opt, apr_int32_t on) */APR_DECLARE(apr_status_t) apr_setsocketopt(apr_socket_t *sock, apr_int32_t opt, apr_int32_t on);/** * Query socket options for the specified socket * @param sock The socket to query * @param opt The option we would like to query. One of: * <PRE> * 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_TIMEOUT -- Set the timeout value in microseconds. * values < 0 mean wait forever. 0 means * don't wait at all. * 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) * </PRE> * @param on Socket option returned on the call. * @deffunc apr_status_t apr_getsocketopt(apr_socket_t *sock, apr_int32_t opt, apr_int32_t *on) */APR_DECLARE(apr_status_t) apr_getsocketopt(apr_socket_t *sock, apr_int32_t opt, apr_int32_t *on);/** * Return an apr_sockaddr_t from an apr_socket_t * @param sa The returned apr_sockaddr_t. * @param which Which interface do we want the apr_sockaddr_t for? * @param sock The socket to use * @deffunc apr_status_t apr_socket_addr_get(apr_sockaddr_t **sa, apr_interface_e which, apr_socket_t *sock) */APR_DECLARE(apr_status_t) apr_socket_addr_get(apr_sockaddr_t **sa, apr_interface_e which, apr_socket_t *sock); /** * Set the port in an APR socket address. * @param sockaddr The socket address to set. * @param port The port to be stored in the socket address. * @deffunc apr_status_t apr_sockaddr_port_set(apr_sockaddr_t *sockaddr, apr_port_t port) */APR_DECLARE(apr_status_t) apr_sockaddr_port_set(apr_sockaddr_t *sockaddr, apr_port_t port);/** * Return the port in an APR socket address. * @param port The port from the socket address. * @param sockaddr The socket address to reference. * @deffunc apr_status_t apr_sockaddr_port_get(apr_port_t *port, apr_sockaddr_t *sockaddr) */APR_DECLARE(apr_status_t) apr_sockaddr_port_get(apr_port_t *port, apr_sockaddr_t *sockaddr);/** * Set the IP address in an APR socket address. * @param sockaddr The socket address to use * @param addr The IP address to attach to the socket. * Use APR_ANYADDR to use any IP addr on the machine. * @deffunc apr_status_t apr_sockaddr_ip_set(apr_sockaddr_t *sockaddr, const char *addr) */APR_DECLARE(apr_status_t) apr_sockaddr_ip_set(apr_sockaddr_t *sockaddr, const char *addr);/** * Return the IP address (in numeric address string format) in * an APR socket address. * @param addr The IP address. * @param sockaddr The socket address to reference. * @deffunc apr_status_t apr_sockaddr_ip_get(char **addr, apr_sockaddr_t *sockaddr) */APR_DECLARE(apr_status_t) apr_sockaddr_ip_get(char **addr, apr_sockaddr_t *sockaddr);/** * Setup the memory required for poll to operate properly * @param new_poll The poll structure to be used. * @param num The number of socket descriptors to be polled. * @param cont The pool to operate on. * @deffunc apr_status_t apr_poll_setup(apr_pollfd_t **new_poll, apr_int32_t num, apr_pool_t *cont) */APR_DECLARE(apr_status_t) apr_poll_setup(apr_pollfd_t **new_poll, apr_int32_t num, apr_pool_t *cont);/** * Poll the sockets in the poll structure * @param aprset The poll structure we will be using. * @param nsds The number of sockets we are polling. * @param timeout The amount of time in microseconds to wait. This is * a maximum, not a minimum. If a socket is signalled, we * will wake up before this time. A negative number means * wait until a socket is signalled. * @tip * <PRE> * The number of sockets signalled is returned in the second argument. * * This is a blocking call, and it will not return until either a * socket has been signalled, or the timeout has expired. * </PRE> * @deffunc apr_status_t apr_poll(apr_pollfd_t *aprset, apr_int32_t *nsds, apr_interval_time_t timeout) */APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t *nsds, apr_interval_time_t timeout);/** * Add a socket to the poll structure. * @param aprset The poll structure we will be using. * @param socket The socket to add to the current poll structure. * @param event The events to look for when we do the poll. One of: * <PRE> * APR_POLLIN signal if read will not block * APR_POLLPRI signal if prioirty data is availble to be read * APR_POLLOUT signal if write will not block * </PRE> * @deffunc apr_status_t apr_poll_socket_add(apr_pollfd_t *aprset, apr_socket_t *sock, apr_int16_t event) */APR_DECLARE(apr_status_t) apr_poll_socket_add(apr_pollfd_t *aprset, apr_socket_t *sock, apr_int16_t event);/** * Modify a socket in the poll structure with mask. * @param aprset The poll structure we will be using. * @param sock The socket to modify in poll structure. * @param events The events to stop looking for during the poll. One of: * <PRE> * APR_POLLIN signal if read will not block * APR_POLLPRI signal if prioirty data is availble to be read * APR_POLLOUT signal if write will not block * </PRE> * @deffunc apr_status_t apr_poll_socket_mask(apr_pollfd_t *aprset, apr_socket_t *sock, apr_int16_t events) */APR_DECLARE(apr_status_t) apr_poll_socket_mask(apr_pollfd_t *aprset, apr_socket_t *sock, apr_int16_t events);/** * Remove a socket from the poll structure. * @param aprset The poll structure we will be using. * @param sock The socket to remove from the current poll structure. * @deffunc apr_status_t apr_poll_socket_remove(apr_pollfd_t *aprset, apr_socket_t *sock) */APR_DECLARE(apr_status_t) apr_poll_socket_remove(apr_pollfd_t *aprset, apr_socket_t *sock);/** * Remove all sockets from the poll structure. * @param aprset The poll structure we will be using. * @param events The events to clear from all sockets. One of: * <PRE> * APR_POLLIN signal if read will not block * APR_POLLPRI signal if prioirty data is availble to be read * APR_POLLOUT signal if write will not block * </PRE> * @deffunc apr_status_t apr_poll_socket_clear(apr_pollfd_t *aprset, apr_int16_t events) */APR_DECLARE(apr_status_t) apr_poll_socket_clear(apr_pollfd_t *aprset, apr_int16_t events);/** * Get the return events for the specified socket. * @param event The returned events for the socket. One of: * <PRE> * APR_POLLIN Data is available to be read * APR_POLLPRI Prioirty data is availble to be read * APR_POLLOUT Write will succeed * APR_POLLERR An error occurred on the socket * APR_POLLHUP The connection has been terminated * APR_POLLNVAL This is an invalid socket to poll on. * Socket not open. * </PRE> * @param sock The socket we wish to get information about. * @param aprset The poll structure we will be using. * @deffunc apr_status_t apr_poll_revents_get(apr_int16_t *event, apr_socket_t *sock, apr_pollfd_t *aprset) */APR_DECLARE(apr_status_t) apr_poll_revents_get(apr_int16_t *event, apr_socket_t *sock, apr_pollfd_t *aprset);/** * Return the data associated with the current poll. * @param pollfd The currently open pollfd. * @param key The key to use for retreiving data associated with a poll struct. * @param data The user data associated with the pollfd. * @deffunc apr_status_t apr_poll_data_get(apr_pollfd_t *pollfd, const char *key, void *data) */APR_DECLARE(apr_status_t) apr_poll_data_get(apr_pollfd_t *pollfd, const char *key, void *data);/** * Set the data associated with the current poll. * @param pollfd The currently open pollfd. * @param data The key to associate with the data. * @param key The user data to associate with the pollfd. * @param cleanup The cleanup function * @deffunc apr_status_t apr_poll_data_set(apr_pollfd_t *pollfd, void *data, const char *key, apr_status_t (*cleanup)(void *)) */APR_DECLARE(apr_status_t) apr_poll_data_set(apr_pollfd_t *pollfd, void *data, const char *key, apr_status_t (*cleanup)(void *));#if APR_FILES_AS_SOCKETS/** * Convert a File type to a socket so that it can be used in a poll operation. * @param newsock the newly created socket which represents a file. * @param file the file to mask as a socket. * @deffunc apr_status_t apr_socket_from_file(apr_socket_t **newsock, apr_file_t *file) * @warning This is not available on all platforms. Platforms that have the * ability to poll files for data to be read/written/exceptions will * have the APR_FILES_AS_SOCKETS macro defined as true. */APR_DECLARE(apr_status_t) apr_socket_from_file(apr_socket_t **newsock, apr_file_t *file);#endif /* APR_FILES_AS_SOCKETS *//** * Given an apr_sockaddr_t and a service name, set the port for the service * @param sockaddr The apr_sockaddr_t that will have it's port set * @param servname The name of the service you wish to use * @deffunc apr_status_t apr_getservbyname(apr_sockaddr_t *sockaddr, const char *servname) */APR_DECLARE(apr_status_t) apr_getservbyname(apr_sockaddr_t *sockaddr, const char *servname);/** * Build an ip-subnet representation from an IP address and optional netmask or * number-of-bits. * @param ipsub The new ip-subnet representation * @param ipstr The input IP address string * @param mask_or_numbits The input netmask or number-of-bits string, or NULL * @param p The pool to allocate from */APR_DECLARE(apr_status_t) apr_ipsubnet_create(apr_ipsubnet_t **ipsub, const char *ipstr, const char *mask_or_numbits, apr_pool_t *p);/** * Test the IP address in an apr_sockaddr_t against a pre-built ip-subnet * representation. * @param ipsub The ip-subnet representation * @param sa The socket address to test * @return non-zero if the socket address is within the subnet, 0 otherwise */APR_DECLARE(int) apr_ipsubnet_test(apr_ipsubnet_t *ipsub, apr_sockaddr_t *sa);#ifdef __cplusplus}#endif#endif /* ! APR_NETWORK_IO_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -