Lely core libraries
2.3.4
|
Go to the documentation of this file.
22 #ifndef LELY_IO_SOCK_HPP_
23 #define LELY_IO_SOCK_HPP_
26 #error "include <lely/io/sock.h> for the C interface"
49 IOHandle::operator=(
sock);
55 IOHandle::operator=(::std::forward<IOSock>(
sock));
60 open(
int domain,
int type,
IOSock sock[2]) noexcept {
69 recv(
void* buf,
size_t nbytes,
io_addr_t* addr = 0,
int flags = 0) noexcept {
70 return io_recv(*
this, buf, nbytes, addr, flags);
74 send(
const void* buf,
size_t nbytes,
const io_addr_t* addr = 0,
75 int flags = 0) noexcept {
76 return io_send(*
this, buf, nbytes, addr, flags);
90 get_domain()
const noexcept {
94 get_type()
const noexcept {
104 listen(
int backlog = 0) noexcept {
109 shutdown(
int how) noexcept {
114 getSockname(
io_addr_t& addr)
const noexcept {
119 getPeername(
io_addr_t& addr)
const noexcept {
124 getMaxConn() noexcept {
129 getAcceptConn()
const noexcept {
134 getBroadcast()
const noexcept {
139 setBroadcast(
bool broadcast) noexcept {
144 getDebug()
const noexcept {
149 setDebug(
bool debug) noexcept {
154 getDontRoute()
const noexcept {
159 setDontRoute(
bool dontroute) noexcept {
164 getError(
int&
error) noexcept {
169 getKeepAlive()
const noexcept {
174 setKeepAlive(
bool keepalive,
int time = 0,
int interval = 0) noexcept {
179 getLinger()
const noexcept {
184 setLinger(
int time = 0) noexcept {
189 getOOBInline()
const noexcept {
194 setOOBInline(
bool oobinline) noexcept {
199 getRcvBuf()
const noexcept {
204 setRcvBuf(
int size) noexcept {
209 setRcvTimeo(
int timeout) noexcept {
214 getReuseAddr()
const noexcept {
219 setReuseAddr(
bool reuseaddr) noexcept {
224 getSndBuf()
const noexcept {
229 setSndBuf(
int size) noexcept {
234 setSndTimeo(
int timeout) noexcept {
239 getTCPNoDelay()
const noexcept {
244 setTCPNoDelay(
bool nodelay) noexcept {
249 getNRead()
const noexcept {
254 getMcastLoop()
const noexcept {
259 setMcastLoop(
bool loop) noexcept {
264 getMcastTTL()
const noexcept {
269 setMcastTTL(
int ttl) noexcept {
274 mcastJoinGroup(
unsigned int index,
const io_addr_t& group) noexcept {
279 mcastBlockSource(
unsigned int index,
const io_addr_t& group,
285 mcastUnblockSource(
unsigned int index,
const io_addr_t& group,
291 mcastLeaveGroup(
unsigned int index,
const io_addr_t& group) noexcept {
296 mcastJoinSourceGroup(
unsigned int index,
const io_addr_t& group,
302 mcastLeaveSourceGroup(
unsigned int index,
const io_addr_t& group,
313 #endif // !LELY_IO_SOCK_HPP_
The type of objects thrown as exceptions to report a failure to initialize an instantiation of a C ty...
int io_sock_mcast_block_source(io_handle_t handle, unsigned int index, const io_addr_t *group, const io_addr_t *source)
Blocks data from a given source to a given multicast group.
int io_sock_mcast_leave_group(io_handle_t handle, unsigned int index, const io_addr_t *group)
Leaves an any-source multicast group.
int io_sock_set_mcast_ttl(io_handle_t handle, int ttl)
Sets the TTL (time to live) value for IP multicast traffic on a socket (the default is 1).
io_handle_t io_accept(io_handle_t handle, io_addr_t *addr)
Accepts an incoming connection on a listening socket.
int io_sock_get_debug(io_handle_t handle)
Checks if debugging is enabled for a socket.
int io_sock_set_tcp_nodelay(io_handle_t handle, int nodelay)
Disables Nagle's algorithm for send coalescing if nodelay is non-zero, and enables it otherwise.
int io_sock_get_type(io_handle_t handle)
Obtains the type of a network socket (the second parameter in a call to io_open_socket() or io_open_s...
A sock I/O device handle.
int io_sock_set_reuseaddr(io_handle_t handle, int reuseaddr)
Enables a socket to be bound to an address that is already in use if reuseaddr is non-zero,...
int io_sock_get_tcp_nodelay(io_handle_t handle)
Checks if Nagle's algorithm for send coalescing is enabled for a socket.
int io_sock_get_sndbuf(io_handle_t handle)
Obtains the size (in bytes) of the send buffer of a socket.
int io_sock_get_acceptconn(io_handle_t handle)
Checks if a socket is currently listening for incoming connections.
int io_sock_set_rcvbuf(io_handle_t handle, int size)
Sets the size (in bytes) of the receive buffer of a socket.
An opaque network address type.
ssize_t io_sock_get_nread(io_handle_t handle)
Obtains the amount of data (in bytes) in the input buffer of a socket.
The type of objects thrown as exceptions to report a system error with an associated error code.
int io_sock_mcast_leave_source_group(io_handle_t handle, unsigned int index, const io_addr_t *group, const io_addr_t *source)
Leaves a source-specific multicast group.
int io_open_socketpair(int domain, int type, io_handle_t handle_vector[2])
Opens a pair of connected sockets.
int io_sock_set_dontroute(io_handle_t handle, int dontroute)
Bypasses normal routing for a socket if dontroute is non-zero, and disables this option otherwise (di...
int io_sock_get_peername(io_handle_t handle, io_addr_t *addr)
Obtains the peer address of a socket and stores the result in *addr.
int io_sock_get_mcast_loop(io_handle_t handle)
Checks if the loopback of outgoing multicast datagrams is enabled for a socket.
int io_sock_set_debug(io_handle_t handle, int debug)
Enables (platform dependent) debugging output for a socket if debug is non-zero, and disables this op...
int io_sock_set_oobinline(io_handle_t handle, int oobinline)
Requests that out-of-band data is placed into the normal data stream of socket if oobinline is non-ze...
int io_sock_get_linger(io_handle_t handle)
Obtains the linger time (in seconds) of a socket.
#define throw_or_abort(e)
If exceptions are disabled, aborts the process instead of throwing an exception.
int io_sock_set_broadcast(io_handle_t handle, int broadcast)
Enables a socket to send broadcast messages if broadcast is non-zero, and disables this option otherw...
int io_sock_set_sndbuf(io_handle_t handle, int size)
Sets the size (in bytes) of the send buffer of a socket.
int io_sock_set_sndtimeo(io_handle_t handle, int timeout)
Sets the timeout (in milliseconds) of a send operation on a socket.
int io_sock_get_reuseaddr(io_handle_t handle)
Checks if a socket is allowed to be bound to an address that is already in use.
int io_sock_get_dontroute(io_handle_t handle)
Checks if routing is disabled for a socket.
io_handle_t io_open_socket(int domain, int type)
Opens a network socket.
int io_sock_set_mcast_loop(io_handle_t handle, int loop)
Enables the loopback of outgoing multicast datagrams for a socket if loop is non-zero,...
int io_sock_mcast_unblock_source(io_handle_t handle, unsigned int index, const io_addr_t *group, const io_addr_t *source)
Unblocks data from a given source to a given multicast group.
int io_sock_set_keepalive(io_handle_t handle, int keepalive, int time, int interval)
Enables or disables the TCP keep-alive option for a socket (disabled by default).
int io_sock_set_linger(io_handle_t handle, int time)
Sets the time (in seconds) io_close() will wait for unsent messages to be sent.
int io_sock_get_domain(io_handle_t handle)
Obtains the domain of a socket (the first parameter in a call to io_open_socket() or io_open_socketpa...
int io_sock_get_oobinline(io_handle_t handle)
Checks if out-of-band data is received in the normal data stream of a socket.
int io_sock_get_rcvbuf(io_handle_t handle)
Obtains the size (in bytes) of the receive buffer of a socket.
int io_sock_get_broadcast(io_handle_t handle)
Checks if a socket is allowed to send broadcast messages.
int io_connect(io_handle_t handle, const io_addr_t *addr)
Connects a socket to a network address.
ssize_t io_send(io_handle_t handle, const void *buf, size_t nbytes, const io_addr_t *addr, int flags)
Performs a send operation on a network socket.
int io_sock_bind(io_handle_t handle, const io_addr_t *addr)
Binds a local network address to a socket.
int io_sock_get_keepalive(io_handle_t handle)
Checks if the TCP keep-alive option is enabled for a socket.
ssize_t io_recv(io_handle_t handle, void *buf, size_t nbytes, io_addr_t *addr, int flags)
Performs a receive operation on a network socket.
int io_sock_mcast_join_source_group(io_handle_t handle, unsigned int index, const io_addr_t *group, const io_addr_t *source)
Joins a source-specific multicast group.
int io_sock_get_error(io_handle_t handle, int *perror)
Obtains and clears the current error number of a socket, and stores the value in *perror.
int io_sock_listen(io_handle_t handle, int backlog)
Marks a connection-mode socket (IO_SOCK_STREAM) as accepting connections.
int io_sock_get_maxconn(void)
Returns the maximum queue length for pending connections.
int io_sock_mcast_join_group(io_handle_t handle, unsigned int index, const io_addr_t *group)
Joins an any-source multicast group.
int io_sock_get_sockname(io_handle_t handle, io_addr_t *addr)
Obtains the locally-bound name of a socket and stores the resulting address in *addr.
int io_sock_shutdown(io_handle_t handle, int how)
Causes all or part of a full-duplex connection on a socket to be shut down.
int io_sock_set_rcvtimeo(io_handle_t handle, int timeout)
Sets the timeout (in milliseconds) of a receive operation on a socket.
int io_sock_get_mcast_ttl(io_handle_t handle)
Obtains the TTL (time to live) value for IP multicast traffic on a socket.