|
libcppwrap
A collection of C++ wrappers for native APIs
|
Classes | |
| struct | const_list_iterator |
| A forward iterator for linked lists. More... | |
| class | handle |
| An RAII handle type which owns an opaque resource of a specified type, and calls a designated function to close the resource upon destruction. More... | |
| struct | ipv4_address |
Wraps struct sockaddr_in, adding constructors for convenient initialization. More... | |
| struct | ipv6_address |
Wraps struct sockaddr_in6, adding constructors for convenient initialization. More... | |
| struct | memory_region |
| A structure holding details about a memory-mapped file or device. More... | |
| struct | unix_domain_address |
Wraps struct sockaddr_in, adding constructors for convenient initialization. More... | |
Typedefs | |
| typedef w::handle< int, -1, ::close > | fd |
| An RAII util::handle type for POSIX file descriptors. More... | |
Functions | |
| template<typename T > | |
| T | throw_if_eq (T value, T x, const char *message) |
Throw a std::system_error with errno if value == x, otherwise return value. More... | |
| template<typename T > | |
| T | throw_if_lt (T value, T x, const char *message) |
Throw a std::system_error with errno if value < x, otherwise return value. More... | |
| template<typename T > | |
| T | throw_if_ne (T value, T x, const char *message) |
Throw a std::system_error with errno if value != x, otherwise return value. More... | |
| template<typename T > | |
| T | throw_if_nz (T value, const char *message) |
Throw a std::system_error with errno if value != 0, otherwise return value. More... | |
| template<typename T > | |
| T | throw_if_z (T value, const char *message) |
Throw a std::system_error with errno if value == 0, otherwise return value. More... | |
| w::fd | epoll_create (int size=sizeof(nullptr)) |
| Creates an epoll instance. More... | |
| void | epoll_ctl (int epfd, int op, int fd, struct epoll_event *event=nullptr) |
| Manipulates an epoll instance. More... | |
| void | epoll_ctl (int epfd, int op, int fd, std::uint32_t events, void *user_data=nullptr) |
| Manipulates an epoll instance. More... | |
| void | epoll_ctl (int epfd, int op, int fd, std::uint32_t events, int user_data) |
| Manipulates an epoll instance. More... | |
| void | epoll_ctl (int epfd, int op, int fd, std::uint32_t events, std::uint32_t user_data) |
| Manipulates an epoll instance. More... | |
| void | epoll_ctl (int epfd, int op, int fd, std::uint32_t events, std::uint64_t user_data) |
| Manipulates an epoll instance. More... | |
| unsigned | epoll_wait (int epfd, struct epoll_event *events, int maxevents, std::chrono::milliseconds timeout=std::chrono::milliseconds(-1)) |
| Waits for events to occur on an epoll instance. More... | |
| w::fd | eventfd (unsigned initval=0, int flags=0) |
| Creates an event file descriptor. More... | |
| std::uint64_t | eventfd_read (int evfd) |
Reads the current counter value of an event file descriptor; see the man page of eventfd() for a description of the counter and blocking semantics. More... | |
| void | eventfd_write (int evfd, std::uint64_t value) |
Modifies the counter value of an event file descriptor; see the man page of eventfd() for a description of the counter semantics. More... | |
| w::fd | timerfd_create (int clockid, int flags=0) |
| Creates a timer file descriptor. More... | |
| void | timerfd_settime (int fd, int flags, const struct itimerspec *new_value, struct itimerspec *old_value) |
| Sets the timeout and repetition interval of a timer file descriptor. More... | |
| std::pair< std::chrono::nanoseconds, std::chrono::nanoseconds > | timerfd_settime (int fd, int flags, std::chrono::nanoseconds interval, std::chrono::nanoseconds initial) |
| Sets the timeout and repetition interval of a timer file descriptor. More... | |
| int | fcntl (int fd, int cmd) |
| Controls a file descriptor. More... | |
| template<typename Argument > | |
| int | fcntl (int fd, int cmd, const Argument &arg) |
| Controls a file descriptor. More... | |
| int | ioctl (int fd, unsigned long request, void *arg) |
| Controls a device. More... | |
| int | ioctl (int fd, unsigned long request, const void *arg) |
| Controls a device. More... | |
| template<typename Argument > | |
| int | ioctl (int fd, unsigned long request, Argument &arg) |
| Controls a device. More... | |
| template<typename Argument > | |
| int | ioctl (int fd, unsigned long request, const Argument &arg) |
| Controls a device. More... | |
| template<typename Argument > | |
| Argument | ioctl (int fd, unsigned long request) |
| Controls a device. More... | |
| std::size_t | lseek (int fd, off_t offset, int whence) |
| Sets the position of a file pointer for a file descriptor. More... | |
| w::fd | open (const char *pathname, int flags) |
| Opens and possibly creates a file. More... | |
| w::fd | open (const char *pathname, int flags, mode_t mode) |
| Opens and possibly creates a file. More... | |
| std::pair< w::fd, w::fd > | pipe () |
| Creates a pipe. More... | |
| std::size_t | read (int fd, void *buf, std::size_t count) |
| Reads data from a file descriptor. More... | |
| std::size_t | readv (int fd, const struct iovec *iov, int iovcnt) |
| Reads data from a file descriptor. More... | |
| std::size_t | write (int fd, const void *buf, std::size_t count) |
| Writes data to a file descriptor. More... | |
| std::size_t | writev (int fd, const struct iovec *iov, int iovcnt) |
| Writes data to a file descriptor. More... | |
| w::fd | accept (int sockfd, struct sockaddr *addr, socklen_t *addrlen) |
| Accepts a connection on a socket. More... | |
| template<typename Address > | |
| w::fd | accept (int sockfd, Address &addr) |
| Accepts a connection on a socket. More... | |
| void | bind (int sockfd, const struct sockaddr *addr, socklen_t addrlen) |
| Binds a socket to an address. More... | |
| template<typename Address > | |
| void | bind (int sockfd, const Address &addr) |
| Binds a socket. More... | |
| void | connect (int sockfd, const struct sockaddr *addr, socklen_t addrlen) |
| Connects a socket. More... | |
| template<typename Address > | |
| void | connect (int sockfd, const Address &addr) |
| Connects a socket. More... | |
| w::handle< struct ifaddrs *, nullptr, ::freeifaddrs > | getifaddrs () |
| Gets a pointer to the head of a linked list of the system's network interfaces. More... | |
| int | getsockopt (int sockfd, int level, int optname, void *optval=nullptr, socklen_t *optlen=nullptr) |
| Gets an option on a socket. More... | |
| template<typename Value > | |
| Value | getsockopt (int sockfd, int level, int optname) |
| Gets an option on a socket. More... | |
| unsigned | if_nametoindex (const char *ifname) |
| Returns the index of the specified network interface. More... | |
| char * | inet_ntop (int af, const void *src, char *dst, socklen_t size) |
| Converts an IPv4 or IPv6 address to a string. More... | |
| void * | inet_pton (int af, const char *src, void *dst) |
| Converts an IPv4 or IPv6 address from a string to a binary value. More... | |
| template<typename Address > | |
| Address & | inet_pton (int af, const char *src, Address &dst) |
| Converts an IPv4 or IPv6 address from a string to a binary value. More... | |
| void | listen (int sockfd, int backlog) |
| Puts a socket in a listening state. More... | |
| std::size_t | recv (int sockfd, void *buf, std::size_t len, int flags=0) |
| Receives a message from a socket. More... | |
| std::size_t | recvmsg (int sockfd, struct msghdr *msg, int flags=0) |
| Receives a message from a socket. More... | |
| std::size_t | recvfrom (int sockfd, void *buf, std::size_t len, int flags, struct sockaddr *src_addr=nullptr, socklen_t *addrlen=nullptr) |
| Receives a message from a socket. More... | |
| template<typename Address > | |
| std::size_t | recvfrom (int sockfd, void *buf, std::size_t len, int flags, Address &src_addr) |
| Receives a message from a socket. More... | |
| std::size_t | send (int sockfd, const void *buf, std::size_t len, int flags=0) |
| Sends a message on a socket. More... | |
| std::size_t | sendmsg (int sockfd, const struct msghdr *msg, int flags=0) |
| Sends a message on a socket. More... | |
| std::size_t | sendto (int sockfd, const void *buf, std::size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen) |
| Sends a message on a socket. More... | |
| template<typename Address > | |
| std::size_t | sendto (int sockfd, const void *buf, std::size_t len, int flags, const Address &dest_addr) |
| Sends a message on a socket. More... | |
| int | setsockopt (int sockfd, int level, int optname, const void *optval=nullptr, socklen_t optlen=0) |
| Sets an option on a socket. More... | |
| template<typename Value > | |
| void | setsockopt (int sockfd, int level, int optname, const Value &optval) |
| Sets an option on a socket. More... | |
| void | shutdown (int sockfd, int how) |
| Shuts down part of a full-duplex connection. More... | |
| w::fd | socket (int domain, int type, int protocol=0) |
| Creates a socket. More... | |
| w::fd w::accept | ( | int | sockfd, |
| Address & | addr | ||
| ) |
Accepts a connection on a socket.
| Address | The type of addr. |
| sockfd | The socket on which to accept a connection. |
| addr | A reference to the address of the remote endpoint. |
| std::system_error | An error occurred. |
| std::runtime_error | The structure referenced by addr is not the correct size to hold the remote address. |
| w::fd w::accept | ( | int | sockfd, |
| struct sockaddr * | addr, | ||
| socklen_t * | addrlen | ||
| ) |
Accepts a connection on a socket.
| sockfd | The socket on which to accept a connection. |
| addr | A pointer to the address of the remote endpoint. |
| addrlen | A pointer to the size of the structure pointed to by addr, in bytes. On return, the value holds the actual size of the source address. This might be larger than the input value, in which case the address was truncated. |
| std::system_error | An error occurred. |
| void w::bind | ( | int | sockfd, |
| const Address & | addr | ||
| ) |
Binds a socket.
| Address | The type of addr. |
| sockfd | The socket to bind. |
| addr | A reference to the address to bind to. |
| std::system_error | An error occurred. |
| void w::bind | ( | int | sockfd, |
| const struct sockaddr * | addr, | ||
| socklen_t | addrlen | ||
| ) |
Binds a socket to an address.
| sockfd | The socket to bind. |
| addr | A pointer to the address to bind to. |
| addrlen | The size of the structure pointed to by addr, in bytes. |
| std::system_error | An error occurred. |
| void w::connect | ( | int | sockfd, |
| const Address & | addr | ||
| ) |
Connects a socket.
| Address | The type of addr. |
| sockfd | The socket to connect. |
| addr | A reference to the address to connect to. |
| std::system_error | An error occurred. |
| void w::connect | ( | int | sockfd, |
| const struct sockaddr * | addr, | ||
| socklen_t | addrlen | ||
| ) |
Connects a socket.
| sockfd | The socket to connect. |
| addr | A pointer to the address to connect to. |
| addrlen | The size of the structure pointed to by addr, in bytes. |
| std::system_error | An error occurred. |
| w::fd w::epoll_create | ( | int | size = sizeof(nullptr) | ) |
Creates an epoll instance.
| size | This value is ignored, but must be nonzero (see the man page). |
| std::system_error | An error occurred. |
| void w::epoll_ctl | ( | int | epfd, |
| int | op, | ||
| int | fd, | ||
| std::uint32_t | events, | ||
| int | user_data | ||
| ) |
Manipulates an epoll instance.
| epfd | The epoll instance file descriptor. |
| op | The operation to perform. |
| fd | The file descriptor to add, modify or remove from the poll instance. |
| events | A bitwise combination of events of interest. |
| user_data | An opaque user data value. |
| std::system_error | An error occurred. |
| void w::epoll_ctl | ( | int | epfd, |
| int | op, | ||
| int | fd, | ||
| std::uint32_t | events, | ||
| std::uint32_t | user_data | ||
| ) |
Manipulates an epoll instance.
| epfd | The epoll instance file descriptor. |
| op | The operation to perform. |
| fd | The file descriptor to add, modify or remove from the poll instance. |
| events | A bitwise combination of events of interest. |
| user_data | An opaque user data value. |
| std::system_error | An error occurred. |
| void w::epoll_ctl | ( | int | epfd, |
| int | op, | ||
| int | fd, | ||
| std::uint32_t | events, | ||
| std::uint64_t | user_data | ||
| ) |
Manipulates an epoll instance.
| epfd | The epoll instance file descriptor. |
| op | The operation to perform. |
| fd | The file descriptor to add, modify or remove from the poll instance. |
| events | A bitwise combination of events of interest. |
| user_data | An opaque user data value. |
| std::system_error | An error occurred. |
| void w::epoll_ctl | ( | int | epfd, |
| int | op, | ||
| int | fd, | ||
| std::uint32_t | events, | ||
| void * | user_data = nullptr |
||
| ) |
Manipulates an epoll instance.
| epfd | The epoll instance file descriptor. |
| op | The operation to perform. |
| fd | The file descriptor to add, modify or remove from the poll instance. |
| events | A bitwise combination of events of interest. |
| user_data | An opaque user data value. |
| std::system_error | An error occurred. |
| void w::epoll_ctl | ( | int | epfd, |
| int | op, | ||
| int | fd, | ||
| struct epoll_event * | event = nullptr |
||
| ) |
Manipulates an epoll instance.
| epfd | The epoll instance file descriptor. |
| op | The operation to perform. |
| fd | The file descriptor to add, modify or remove from the poll instance. |
| event | A pointer to a structure specifying the events of interest. |
| std::system_error | An error occurred. |
| unsigned w::epoll_wait | ( | int | epfd, |
| struct epoll_event * | events, | ||
| int | maxevents, | ||
| std::chrono::milliseconds | timeout = std::chrono::milliseconds(-1) |
||
| ) |
Waits for events to occur on an epoll instance.
| epfd | The epoll instance file descriptor. |
| events | A pointer to an array of structures to receive information about events. |
| maxevents | The number of elements in the events array. |
| timeout | The number of milliseconds |
| std::invalid_argument | timeout is out of range. |
| std::system_error | An error occurred. |
| w::fd w::eventfd | ( | unsigned | initval = 0, |
| int | flags = 0 |
||
| ) |
Creates an event file descriptor.
| initval | The initial value of the eventfd counter. |
| flags | Flags that affect the created event file descriptor. |
| std::uint64_t w::eventfd_read | ( | int | evfd | ) |
Reads the current counter value of an event file descriptor; see the man page of eventfd() for a description of the counter and blocking semantics.
| evfd | The event file descriptor. |
| std::system_error | An error occurred. |
| void w::eventfd_write | ( | int | evfd, |
| std::uint64_t | value | ||
| ) |
Modifies the counter value of an event file descriptor; see the man page of eventfd() for a description of the counter semantics.
| evfd | The event file descriptor. |
| value | The event counter value. |
| std::system_error | An error occurred. |
| int w::fcntl | ( | int | fd, |
| int | cmd | ||
| ) |
Controls a file descriptor.
| fd | The file descriptor to control. |
| cmd | The control command code. |
| std:system_error | An error occurred. |
| int w::fcntl | ( | int | fd, |
| int | cmd, | ||
| const Argument & | arg | ||
| ) |
Controls a file descriptor.
| Argument | The type of the command-specific argument. |
| fd | The file descriptor to control. |
| cmd | The control command code. |
| arg | A reference to a command-specific input argument. |
| std:system_error | An error occurred. |
| w::handle< struct ifaddrs *, nullptr,::freeifaddrs > w::getifaddrs | ( | ) |
Gets a pointer to the head of a linked list of the system's network interfaces.
| std::system_error | An error occurred. |
| Value w::getsockopt | ( | int | sockfd, |
| int | level, | ||
| int | optname | ||
| ) |
Gets an option on a socket.
| sockfd | The socket on which to get the option. |
| level | The option level. |
| optname | The option to get. |
| std::system_error | An error occurred. |
| std::runtime_error | Value has the wrong size for this option. |
| int w::getsockopt | ( | int | sockfd, |
| int | level, | ||
| int | optname, | ||
| void * | optval = nullptr, |
||
| socklen_t * | optlen = nullptr |
||
| ) |
Gets an option on a socket.
| sockfd | The socket on which to get the option. |
| level | The option level. |
| optname | The option to get. |
| optval | A pointer to the value to be filled in. |
| optlen | A pointer to the size of the value pointed to by optval. On return, the value holds the actual size of the value. This might be larger than the input value, in which case the value was truncated. |
| std::system_error | An error occurred. |
| unsigned w::if_nametoindex | ( | const char * | ifname | ) |
Returns the index of the specified network interface.
| ifname | The name of the network interface. |
| std::system_error | An error occurred. |
| char * w::inet_ntop | ( | int | af, |
| const void * | src, | ||
| char * | dst, | ||
| socklen_t | size | ||
| ) |
Converts an IPv4 or IPv6 address to a string.
| af | The address family. |
| src | A pointer to the address. |
| dst | A pointer to a character buffer to be filled. |
| size | The size of the buffer pointed to by dst, in bytes. |
dst. | std::system_error | An error occurred. |
| Address & w::inet_pton | ( | int | af, |
| const char * | src, | ||
| Address & | dst | ||
| ) |
Converts an IPv4 or IPv6 address from a string to a binary value.
| af | The address family. |
| src | A pointer to the address string. |
| dst | A reference to a socket address structure to be filled. |
dst. | std::system_error | An error occurred. |
| void * w::inet_pton | ( | int | af, |
| const char * | src, | ||
| void * | dst | ||
| ) |
Converts an IPv4 or IPv6 address from a string to a binary value.
| af | The address family. |
| src | A pointer to the address string. |
| dst | A pointer to a socket address structure to be filled. |
dst. | std::system_error | An error occurred. |
| Argument w::ioctl | ( | int | fd, |
| unsigned long | request | ||
| ) |
Controls a device.
| Argument | The type of the request's output value. |
| fd | The file descriptor of the device to control. |
| request | The control request code. |
| std:system_error | An error occurred. |
| int w::ioctl | ( | int | fd, |
| unsigned long | request, | ||
| Argument & | arg | ||
| ) |
Controls a device.
| Argument | The type of arg. |
| fd | The file descriptor of the device to control. |
| request | The control request code. |
| arg | A pointer to a request-specific input argument. |
| std:system_error | An error occurred. |
| int w::ioctl | ( | int | fd, |
| unsigned long | request, | ||
| const Argument & | arg | ||
| ) |
Controls a device.
Note that the library cannot guarantee the underlying ioctl call will not modify its argument. Therefore, when using this overload, it is the caller's responsibility to somehow ensure the ioctl does not modify its argument, or the behavior is undefined.
| Argument | The type of arg. |
| fd | The file descriptor of the device to control. |
| request | The control request code. |
| arg | A pointer to a request-specific input argument. |
| std:system_error | An error occurred. |
| int w::ioctl | ( | int | fd, |
| unsigned long | request, | ||
| const void * | arg | ||
| ) |
Controls a device.
Note that the library cannot guarantee the underlying ioctl call will not modify its argument. Therefore, when using this overload, it is the caller's responsibility to somehow ensure the ioctl does not modify its argument, or the behavior is undefined.
| fd | The file descriptor of the device to control. |
| request | The control request code. |
| arg | A pointer to a request-specific input argument. |
| std:system_error | An error occurred. |
| int w::ioctl | ( | int | fd, |
| unsigned long | request, | ||
| void * | arg | ||
| ) |
Controls a device.
| fd | The file descriptor of the device to control. |
| request | The control request code. |
| arg | A pointer to a request-specific output argument. |
| std:system_error | An error occurred. |
| void w::listen | ( | int | sockfd, |
| int | backlog | ||
| ) |
Puts a socket in a listening state.
| sockfd | The socket to listen on. |
| backlog | The maximum number of pending connections to allow. |
| std::system_error | An error occurred. |
| std::size_t w::lseek | ( | int | fd, |
| off_t | offset, | ||
| int | whence | ||
| ) |
Sets the position of a file pointer for a file descriptor.
| fd | The file descriptor to seek in. |
| offset | The offset to seek to. |
| whence | SEEK_SET, SEEK_CUR or SEEK_END. |
| std::system_error | An error occurred. |
| w::fd w::open | ( | const char * | pathname, |
| int | flags | ||
| ) |
Opens and possibly creates a file.
| pathname | The path of the file to open and/or create. |
| flags | A bitwise combination of flags. |
| std:system_error | An error occurred. |
| w::fd w::open | ( | const char * | pathname, |
| int | flags, | ||
| mode_t | mode | ||
| ) |
Opens and possibly creates a file.
| pathname | The path of the file to open and/or create. |
| flags | A bitwise combination of flags. |
| mode | The access mode for the file. |
| std:system_error | An error occurred. |
Creates a pipe.
| std:system_error | An error occurred. |
| std::size_t w::read | ( | int | fd, |
| void * | buf, | ||
| std::size_t | count | ||
| ) |
Reads data from a file descriptor.
| fd | The file descriptor to read from. |
| buf | A pointer to an array where read data should be stored. |
| count | The maximum number of bytes to read. |
| std::system_error | An error occurred. This includes EAGAIN on non-blocking files. |
| std::size_t w::readv | ( | int | fd, |
| const struct iovec * | iov, | ||
| int | iovcnt | ||
| ) |
Reads data from a file descriptor.
| fd | The file descriptor to read from. |
| iov | A pointer to an array of iovec scatter-gather structures. |
| iovcnt | The number of structures in the array pointed to by iov. |
| std::system_error | An error occurred. This includes EAGAIN on non-blocking files. |
| std::size_t w::recv | ( | int | sockfd, |
| void * | buf, | ||
| std::size_t | len, | ||
| int | flags = 0 |
||
| ) |
Receives a message from a socket.
| sockfd | The socket to receive from. |
| buf | A pointer to an array where received data should be stored. |
| len | The maximum number of bytes to receive. |
| flags | A bitwise combination of flags. |
| std::system_error | An error occurred. This includes EAGAIN on non-blocking sockets. |
| std::size_t w::recvfrom | ( | int | sockfd, |
| void * | buf, | ||
| std::size_t | len, | ||
| int | flags, | ||
| Address & | src_addr | ||
| ) |
Receives a message from a socket.
| Address | The type of src_addr. |
| sockfd | The socket to receive from. |
| buf | A pointer to an array where received data should be stored. |
| len | The maximum number of bytes to receive. |
| flags | A bitwise combination of flags. |
| src_addr | A reference to the source address. |
| std::system_error | An error occurred. This includes EAGAIN on non-blocking sockets. |
| std::runtime_error | The structure referenced by src_addr is not the correct size to hold the source address. |
| std::size_t w::recvfrom | ( | int | sockfd, |
| void * | buf, | ||
| std::size_t | len, | ||
| int | flags, | ||
| struct sockaddr * | src_addr = nullptr, |
||
| socklen_t * | addrlen = nullptr |
||
| ) |
Receives a message from a socket.
| sockfd | The socket to receive from. |
| buf | A pointer to an array where received data should be stored. |
| len | The maximum number of bytes to receive. |
| flags | A bitwise combination of flags. |
| src_addr | A pointer to the source address. |
| addrlen | A pointer to the size of the structure pointed to by src_addr, in bytes. On return, the value holds the actual size of the source address. This might be larger than the input value, in which case the address was truncated. |
| std::system_error | An error occurred. This includes EAGAIN on non-blocking sockets. |
| std::runtime_error | The structure pointed to by src_addr is too small to hold the source address. |
| std::size_t w::recvmsg | ( | int | sockfd, |
| struct msghdr * | msg, | ||
| int | flags = 0 |
||
| ) |
Receives a message from a socket.
| sockfd | The socket to receive from. |
| msg | A pointer to a message structure to be filled in. |
| flags | A bitwise combination of flags. |
| std::system_error | An error occurred. This includes EAGAIN on non-blocking sockets. |
| std::size_t w::send | ( | int | sockfd, |
| const void * | buf, | ||
| std::size_t | len, | ||
| int | flags = 0 |
||
| ) |
Sends a message on a socket.
| sockfd | The socket to send from. |
| buf | A pointer to the data to send. |
| len | The maximum number of bytes to send. |
| flags | A bitwise combination of flags. |
| std::system_error | An error occurred. This includes EAGAIN on non-blocking sockets. |
| std::size_t w::sendmsg | ( | int | sockfd, |
| const struct msghdr * | msg, | ||
| int | flags = 0 |
||
| ) |
Sends a message on a socket.
| sockfd | The socket to send from. |
| msg | A pointer to a message structure describing the message to send. |
| flags | A bitwise combination of flags. |
| std::system_error | An error occurred. This includes EAGAIN on non-blocking sockets. |
| std::size_t w::sendto | ( | int | sockfd, |
| const void * | buf, | ||
| std::size_t | len, | ||
| int | flags, | ||
| const Address & | dest_addr | ||
| ) |
Sends a message on a socket.
| Address | The type of dest_addr. |
| sockfd | The socket to send from. |
| buf | A pointer to the data to send. |
| len | The number of bytes to send. |
| flags | A bitwise combination of flags. |
| dest_addr | A reference to the destination address. |
| std::system_error | An error occurred. This includes EAGAIN on non-blocking sockets. |
| std::size_t w::sendto | ( | int | sockfd, |
| const void * | buf, | ||
| std::size_t | len, | ||
| int | flags, | ||
| const struct sockaddr * | dest_addr, | ||
| socklen_t | addrlen | ||
| ) |
Sends a message on a socket.
| sockfd | The socket to send from. |
| buf | A pointer to the data to send. |
| len | The maximum number of bytes to send. |
| flags | A bitwise combination of flags. |
| dest_addr | A pointer to the destination address. |
| addrlen | The size of the structure pointed to by dest_addr, in bytes. |
| std::system_error | An error occurred. This includes EAGAIN on non-blocking sockets. |
| void w::setsockopt | ( | int | sockfd, |
| int | level, | ||
| int | optname, | ||
| const Value & | optval | ||
| ) |
Sets an option on a socket.
| Value | The type of optval. |
| sockfd | The socket on which to set the option. |
| level | The option level. |
| optname | The option to set. |
| optval | A reference to the value to set. |
| std::system_error | An error occurred. |
| int w::setsockopt | ( | int | sockfd, |
| int | level, | ||
| int | optname, | ||
| const void * | optval = nullptr, |
||
| socklen_t | optlen = 0 |
||
| ) |
Sets an option on a socket.
| sockfd | The socket on which to set the option. |
| level | The option level. |
| optname | The option to set. |
| optval | A pointer to the value to set. |
| optlen | The size of the value pointed to by optval, in bytes. |
| std::system_error | An error occurred. |
| void w::shutdown | ( | int | sockfd, |
| int | how | ||
| ) |
Shuts down part of a full-duplex connection.
| sockfd | The socket to shut down. |
| how | A flag specifying what to shut down. |
| std::system_error | An error occurred. |
| w::fd w::socket | ( | int | domain, |
| int | type, | ||
| int | protocol = 0 |
||
| ) |
Creates a socket.
| domain | The communication domain. |
| type | The type of socket. |
| protocol | The protocol on which to communicate. |
| std::system_error | An error occurred. |
| T w::throw_if_eq | ( | T | value, |
| T | x, | ||
| const char * | message | ||
| ) |
Throw a std::system_error with errno if value == x, otherwise return value.
| T | The type of value and x. |
| value | The value to check. |
| x | The value to test for. |
| message | The message to include in the exception. |
value. | std::system_error | value == x. The error code is set to errno. |
| T w::throw_if_lt | ( | T | value, |
| T | x, | ||
| const char * | message | ||
| ) |
Throw a std::system_error with errno if value < x, otherwise return value.
| T | The type of value and x. |
| value | The value to check. |
| x | The value to test for. |
| message | The message to include in the exception. |
value. | std::system_error | value < x. The error code is set to errno. |
| T w::throw_if_ne | ( | T | value, |
| T | x, | ||
| const char * | message | ||
| ) |
Throw a std::system_error with errno if value != x, otherwise return value.
| T | The type of value and x. |
| value | The value to check. |
| x | The value to test for. |
| message | The message to include in the exception. |
value. | std::system_error | value != x. The error code is set to errno. |
| T w::throw_if_nz | ( | T | value, |
| const char * | message | ||
| ) |
Throw a std::system_error with errno if value != 0, otherwise return value.
| T | The type of value. |
| value | The value to check. |
| message | The message to include in the exception. |
value. | std::system_error | value != 0. The error code is set to errno. |
| T w::throw_if_z | ( | T | value, |
| const char * | message | ||
| ) |
Throw a std::system_error with errno if value == 0, otherwise return value.
| T | The type of value. |
| value | The value to check. |
| message | The message to include in the exception. |
value. | std::system_error | value == 0. The error code is set to errno. |
| w::fd w::timerfd_create | ( | int | clockid, |
| int | flags = 0 |
||
| ) |
Creates a timer file descriptor.
| clockid | The identifier of the clock on which the timer should be based. |
| flags | A bitwise combination of flags. |
| std::system_error | An error occurred. |
| void w::timerfd_settime | ( | int | fd, |
| int | flags, | ||
| const struct itimerspec * | new_value, | ||
| struct itimerspec * | old_value | ||
| ) |
Sets the timeout and repetition interval of a timer file descriptor.
| fd | The timer file descriptor to adjust. |
| flags | A bitwise combination of flags. |
| new_value | A pointer to a structure containing the repetition interval and initial expiration time. |
| old_value | A pointer to a structure to be filled in with the previous repetition interval and expiration time. |
| std::system_error | An error occurred. |
| std::pair< std::chrono::nanoseconds, std::chrono::nanoseconds > w::timerfd_settime | ( | int | fd, |
| int | flags, | ||
| std::chrono::nanoseconds | interval, | ||
| std::chrono::nanoseconds | initial | ||
| ) |
Sets the timeout and repetition interval of a timer file descriptor.
| fd | The timer file descriptor to adjust. |
| flags | A bitwise combination of flags. |
| interval | The repetition interval. |
| initial | The initial expiration time. |
| std::system_error | An error occurred. |
| std::size_t w::write | ( | int | fd, |
| const void * | buf, | ||
| std::size_t | count | ||
| ) |
Writes data to a file descriptor.
| fd | The file descriptor to write to. |
| buf | A pointer to an array of data to write. |
| count | The maximum number of bytes to write. |
| std::system_error | An error occurred. This includes EAGAIN on non-blocking files. |
| std::size_t w::writev | ( | int | fd, |
| const struct iovec * | iov, | ||
| int | iovcnt | ||
| ) |
Writes data to a file descriptor.
| fd | The file descriptor to write to. |
| iov | A pointer to an array of iovec scatter-gather structures. |
| iovcnt | The number of structures in the array pointed to by iov. |
| std::system_error | An error occurred. This includes EAGAIN on non-blocking files. |