|
libusual
0.1
|
Socket compat, few utils. More...
Defines | |
| #define | INADDR_NONE |
| Compat: Some systems (Solaris) does not define INADDR_NONE. | |
Functions | |
| bool | socket_setup (int sock, bool non_block) |
| Usual socket setup. | |
| bool | socket_set_nonblocking (int sock, bool non_block) |
| Flip sockets non-blocking flag. | |
| bool | socket_set_keepalive (int fd, int onoff, int keepidle, int keepintvl, int keepcnt) |
| Set sockets keepalive flags. | |
| const char * | sa2str (const struct sockaddr *sa, char *buf, int buflen) |
| Convert struct sockaddr to stirng. | |
| const char * | inet_ntop (int af, const void *src, char *dst, int cnt) |
| Compat: inet_ntop() | |
| int | inet_pton (int af, const char *src, void *dst) |
| Compat: inet_pton() | |
| int | getpeereid (int fd, uid_t *uid_p, gid_t *gid_p) |
| Get user id of UNIX socket peer. | |
| int | getpeercreds (int fd, uid_t *uid_p, gid_t *gid_p, pid_t *pid_p) |
| Get info of UNIX socket peer. | |
| int | poll (struct pollfd *fds, nfds_t nfds, int timeout_ms) |
| Compat: select-based poll() | |
Socket compat, few utils.
Socket headers included:
| #define INADDR_NONE |
Compat: Some systems (Solaris) does not define INADDR_NONE.
| bool socket_setup | ( | int | sock, |
| bool | non_block | ||
| ) |
Usual socket setup.
| bool socket_set_nonblocking | ( | int | sock, |
| bool | non_block | ||
| ) |
Flip sockets non-blocking flag.
| bool socket_set_keepalive | ( | int | fd, |
| int | onoff, | ||
| int | keepidle, | ||
| int | keepintvl, | ||
| int | keepcnt | ||
| ) |
Set sockets keepalive flags.
| fd | TCP socket |
| onoff | Whether to set keepalive on or off. |
| keepidle | How long the socket must be idle before keepalive packets are sent |
| keepintvl | How big period between consecutive keepalive packets. |
| keepcnt | How many keepalive packets to send before considering socket dead. |
| const char* sa2str | ( | const struct sockaddr * | sa, |
| char * | buf, | ||
| int | buflen | ||
| ) |
Convert struct sockaddr to stirng.
Supports: ipv4, ipv5, unix sockets.
| const char* inet_ntop | ( | int | af, |
| const void * | src, | ||
| char * | dst, | ||
| int | cnt | ||
| ) |
Compat: inet_ntop()
| int inet_pton | ( | int | af, |
| const char * | src, | ||
| void * | dst | ||
| ) |
Compat: inet_pton()
| int getpeereid | ( | int | fd, |
| uid_t * | uid_p, | ||
| gid_t * | gid_p | ||
| ) |
Get user id of UNIX socket peer.
| int getpeercreds | ( | int | fd, |
| uid_t * | uid_p, | ||
| gid_t * | gid_p, | ||
| pid_t * | pid_p | ||
| ) |
Get info of UNIX socket peer.
1.7.6.1