|
typedef cidr | cidr_t |
|
typedef struct hostaddr_internet | host_t |
|
int | blocking (bool enable) |
| Set socket blocking I/O mode.
|
|
int | broadcast (bool enable) |
| Set socket for unicast mode broadcasts.
|
|
void | cancel (void) |
| Cancel pending i/o by shutting down the socket.
|
|
bool | ccid (uint8_t id) |
| Set ccid of dccp socket.
|
|
bool | connected (void) const |
| Test if socket is connected.
|
|
int | connectto (struct addrinfo *list) |
| Connect our socket to a remote host from an address list.
|
|
int | disconnect (void) |
| Disconnect a connected socket.
|
|
int | drop (const struct addrinfo *list, const int ifindex=0) |
| Drop socket from multicast group.
|
|
int | err (void) const |
| Get error code.
|
|
int | getError (void) const |
| Get socket error code.
|
|
bool | is_pending (unsigned value) |
| See the number of bytes in the receive queue.
|
|
int | join (const struct addrinfo *list, const int ifindex=0) |
| Join socket to multicast group.
|
|
int | keepalive (bool enable) |
| Set socket for keepalive packets.
|
|
int | loopback (bool enable) |
| Set loopback to read multicast packets we broadcast.
|
|
int | multicast (unsigned ttl=1) |
| Set multicast mode and multicast broadcast range.
|
|
int | nodelay (void) const |
| Set nodelay option for tcp socket.
|
|
| operator bool () const |
| Test if socket is valid.
|
|
| operator socket_t () const |
| Get the socket descriptor by casting.
|
|
bool | operator! () const |
| Test if socket is invalid.
|
|
socket_t | operator* () const |
| Get the socket descriptor by pointer reference.
|
|
Socket & | operator= (socket_t socket) |
| Assign socket from a socket descriptor.
|
|
size_t | peek (void *data, size_t number) const |
| Peek at data waiting in the socket receive buffer.
|
|
unsigned | pending (void) const |
| Get the number of bytes of data in the socket receive buffer.
|
|
size_t | printf (const char *format,...) |
| Print formatted string to socket.
|
|
int | priority (int scheduling) |
| Set packet priority, 0 to 6 unless privileged.
|
|
size_t | readfrom (void *data, size_t number, struct sockaddr_storage *address=NULL) |
| Read data from the socket receive buffer.
|
|
size_t | readline (char *data, size_t size) |
| Read a newline of text data from the socket and save in NULL terminated string.
|
|
stringref_t | readline (size_t maxsize) |
|
size_t | readline (String &buffer) |
| Read a string of input from the socket and strip trailing newline.
|
|
int | recvsize (unsigned size) |
| Set the size of the socket receive buffer.
|
|
void | release (void) |
| Shutdown and close the socket.
|
|
unsigned | segsize (unsigned size) |
| Set segment size and get mtu of a socket.
|
|
int | sendsize (unsigned size) |
| Set the size of the socket send buffer.
|
|
int | sendwait (unsigned size) |
| Set the size to wait before sending.
|
|
void | shutdown (void) |
| Shutdown the socket communication channel.
|
|
| Socket () |
| Create a socket object for use.
|
|
| Socket (const char *address, const char *port, int family=0, int type=0, int protocol=0) |
| Create a bound socket.
|
|
| Socket (const Socket &existing) |
| Create socket as duped handle of existing socket.
|
|
| Socket (const struct addrinfo *address) |
| Create and connect a socket to an address from an address list.
|
|
| Socket (int family, int type, int protocol=0) |
| Create an unbound socket of a specific type.
|
|
| Socket (socket_t socket) |
| Create socket from existing socket descriptor.
|
|
int | tos (int type) |
| Set the type of service field of outgoing packets.
|
|
int | ttl (uint8_t time) |
| Set the time to live before packets expire.
|
|
int | type (void) const |
| Get the type of a socket.
|
|
bool | wait (timeout_t timeout=0) const |
| Test for pending input data.
|
|
int | wait (timeout_t timeout=Timer::inf) |
| Socket i/o timer setting.
|
|
bool | waitSending (timeout_t timeout=0) const |
| Test for output data sent.
|
|
size_t | writes (const char *string) |
| Write a null terminated string to the socket.
|
|
size_t | writeto (const void *data, size_t number, const struct sockaddr *address=NULL) |
| Write data to the socket send buffer.
|
|
virtual | ~Socket () |
| Shutdown, close, and destroy socket.
|
|
static socket_t | acceptfrom (socket_t socket, struct sockaddr_storage *address=NULL) |
| Accept a socket connection from a remote host.
|
|
static int | bindto (socket_t socket, const char *address, const char *service, int protocol=0) |
| Bind the socket descriptor to a known interface and service port.
|
|
static int | bindto (socket_t socket, const struct sockaddr *address) |
| Bind the socket descriptor to a known interface.
|
|
static int | blocking (socket_t socket, bool enable) |
| Set socket blocking I/O mode of socket descriptor.
|
|
static int | broadcast (socket_t socket, bool enable) |
| Set socket for unicast mode broadcasts on socket descriptor.
|
|
static void | cancel (socket_t socket) |
| Cancel pending i/o by shutting down the socket.
|
|
static bool | ccid (socket_t socket, uint8_t id) |
| Set congestion control id.
|
|
static int | connectto (socket_t socket, struct addrinfo *list) |
| Connect socket descriptor to a remote host from an address list.
|
|
static unsigned | copy (struct sockaddr *target, const struct sockaddr *origin) |
| Copy a socket address.
|
|
static socket_t | create (const char *iface, const char *service, int family=0, int type=0, int protocol=0) |
| Create a bound socket for a service.
|
|
static socket_t | create (const Socket::address &address) |
| Create a connected socket for a service.
|
|
static socket_t | create (const struct addrinfo *address, int type, int protocol) |
| Create a connected socket.
|
|
static socket_t | create (int family, int type, int protocol) |
| Create a socket object unbound.
|
|
static int | disconnect (socket_t socket) |
| Disconnect a connected socket descriptor.
|
|
static int | drop (socket_t socket, const struct addrinfo *list, const int ifindex=0) |
| Drop socket descriptor from multicast group.
|
|
static bool | eq_from (const struct sockaddr_storage *address1, const struct sockaddr_storage *address2) |
| Compare socket addresses.
|
|
static bool | eq_host (const struct sockaddr *address1, const struct sockaddr *address2) |
| Compare socket host addresses.
|
|
static bool | eq_inet (const struct sockaddr_internet *address1, const struct sockaddr_internet *address2) |
| Compare socket addresses.
|
|
static bool | eq_subnet (const struct sockaddr *address1, const struct sockaddr *address2) |
| See if both addresses are in the same subnet.
|
|
static bool | equal (const struct sockaddr *address1, const struct sockaddr *address2) |
| Compare socket addresses.
|
|
static int | error (const socket_t socket) |
| Get socket error code of socket descriptor.
|
|
static int | error (void) |
| Return error code of last socket operation,.
|
|
static int | family (const struct sockaddr_internet &address) |
| Get the address family of an internet socket address object.
|
|
static int | family (const struct sockaddr_storage &address) |
| Get the address family of a socket address object.
|
|
static int | family (socket_t socket) |
| Get the address family of the socket descriptor.
|
|
static struct addrinfo * | hinting (socket_t socket, struct addrinfo *hint) |
| Create an address info lookup hint based on the family and type properties of a socket descriptor.
|
|
static char * | hostname (const struct sockaddr *address, char *buffer, size_t size) |
| Lookup and return the host name associated with a socket address.
|
|
static void | init (void) |
| Initialize socket subsystem.
|
|
static bool | is_null (const char *string) |
| Simple function to validate that a given IP address string is a "zero" address.
|
|
static bool | is_numeric (const char *string) |
| Simple function to validate that a given IP address string is a numeric address.
|
|
static int | join (socket_t socket, const struct addrinfo *list, const int ifindex=0) |
| Join socket descriptor to multicast group.
|
|
static int | keepalive (socket_t socket, bool enable) |
| Set socket for keepalive packets for socket descriptor.
|
|
static unsigned | keyhost (const struct sockaddr *address, unsigned size) |
| Convert a socket host address into a hash map index.
|
|
static unsigned | keyindex (const struct sockaddr *address, unsigned size) |
| Convert a socket address and service into a hash map index.
|
|
static socklen_t | len (const struct sockaddr *address) |
| Get the size of a socket address.
|
|
static int | listento (socket_t socket, const struct sockaddr *address, int backlog=5) |
| Bind the socket descriptor to a known interface listen on service port.
|
|
static int | local (socket_t socket, struct sockaddr_storage *address) |
| Get local address to which the socket is bound.
|
|
static int | loopback (socket_t socket, bool enable) |
| Set loopback to read multicast packets socket descriptor broadcasts.
|
|
static int | multicast (socket_t socket, unsigned ttl=1) |
| Set multicast mode and multicast broadcast range for socket descriptor.
|
|
static int | nodelay (socket_t socket) |
| Set tcp nodelay option on socket descriptor.
|
|
static unsigned | pending (socket_t socket) |
| Get the number of bytes pending in the receive buffer of a socket descriptor.
|
|
static in_port_t | port (const struct sockaddr *address) |
| Get the service port of a socket.
|
|
static in_port_t | port (const struct sockaddr_internet *address) |
| Get the service port of an inet socket.
|
|
static ssize_t | printf (socket_t socket, const char *format,...) |
| Print formatted string to socket.
|
|
static int | priority (socket_t socket, int scheduling) |
| Set packet priority of socket descriptor.
|
|
static struct addrinfo * | query (const char *host, const char *service, int type=SOCK_STREAM, int protocol=0) |
| Get an address list directly.
|
|
static char * | query (const struct sockaddr *address, char *buffer, socklen_t size) |
| Get the hostname of a socket address.
|
|
static void | query (int family) |
| Set default socket family preference for query options when the socket type is otherwise not specified.
|
|
static socklen_t | query (socket_t socket, struct sockaddr_storage *address, const char *hostname, const char *service) |
| Lookup a host name and service address based on the addressing family and socket type of a socket descriptor.
|
|
static ssize_t | readline (socket_t socket, char *data, size_t size, timeout_t timeout=Timer::inf) |
| Read a newline of text data from the socket and save in NULL terminated string.
|
|
static ssize_t | recvfrom (socket_t socket, void *buffer, size_t size, int flags=0, struct sockaddr_storage *address=NULL) |
| Get data waiting in receive queue.
|
|
static int | recvsize (socket_t socket, unsigned size) |
| Set the receive size of a socket descriptor.
|
|
static void | release (socket_t socket) |
| Release (close) a socket.
|
|
static void | release (struct addrinfo *list) |
| Release an address list directly.
|
|
static int | remote (socket_t socket, struct sockaddr_storage *address) |
| Get remote address to which the socket is connected.
|
|
static ssize_t | replyto (socket_t socket, const void *buffer, size_t size, int flags, const struct sockaddr_storage *address) |
| Send reply on socket.
|
|
static unsigned | segsize (socket_t socket, unsigned size=0) |
| Set segment size and get MTU.
|
|
static int | sendsize (socket_t socket, unsigned size) |
| Set the send size of a socket descriptor.
|
|
static ssize_t | sendto (socket_t socket, const void *buffer, size_t size, int flags=0, const struct sockaddr *address=NULL) |
| Send data on socket.
|
|
static int | sendwait (socket_t socket, unsigned size) |
| Set the size to wait before sending.
|
|
static unsigned | store (struct sockaddr_internet *storage, const struct sockaddr *address) |
| Store an address into an internet address object.
|
|
static unsigned | store (struct sockaddr_storage *storage, const struct sockaddr *address) |
| Store an address into an address object.
|
|
static int | tos (socket_t socket, int type) |
| Set type of service of socket descriptor.
|
|
static int | ttl (socket_t socket, uint8_t time) |
| Set the time to live for the socket descriptor.
|
|
static int | type (const socket_t socket) |
| Get the type of a socket.
|
|
static void | v4mapping (bool enable) |
| Set the default socket behavior for v6-v4 mapping.
|
|
static int | via (struct sockaddr *address, const struct sockaddr *target, socklen_t size=0) |
| Get the socket address of the interface needed to reach a destination address.
|
|
static bool | wait (socket_t socket, timeout_t timeout=0) |
| Test for pending input data.
|
|
int | ioerr |
|
timeout_t | iowait |
|
socket_t | so |
|