#include <errno.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <avis/errors.h>
#include <avis/stdtypes.h>
#include <avis/defs.h>
Go to the source code of this file.
Defines | |
#define | pipe_read(socket, buff, length) read (socket, buff, length) |
#define | pipe_write(socket, buff, length) write (socket, buff, length) |
#define | close_socket(s) (shutdown ((s), SHUT_RDWR), close (s), (s) = -1) |
#define | sock_op_timed_out() (errno == EAGAIN || errno == EWOULDBLOCK) |
#define | elvin_error_from_pipe elvin_error_from_errno |
#define | elvin_error_from_socket elvin_error_from_errno |
Typedefs | |
typedef int | socket_t |
Functions | |
AVIS_PUBLIC socket_t | avis_open_socket (const char *host, uint16_t port, ElvinError *error) |
AVIS_PUBLIC socket_t | avis_select_ready (socket_t socket1, socket_t socket2, ElvinError *error) |
Select a socket ready for reading. | |
AVIS_PUBLIC bool | avis_open_socket_pair (socket_t *socket_read, socket_t *socket_write, ElvinError *error) |
Open a bi-directional control socket. | |
AVIS_PUBLIC void | avis_close_socket_pair (socket_t socket_read, socket_t socket_write) |
#define close_socket | ( | s | ) | (shutdown ((s), SHUT_RDWR), close (s), (s) = -1) |
#define elvin_error_from_pipe elvin_error_from_errno |
#define elvin_error_from_socket elvin_error_from_errno |
#define pipe_read | ( | socket, | |||
buff, | |||||
length | ) | read (socket, buff, length) |
#define pipe_write | ( | socket, | |||
buff, | |||||
length | ) | write (socket, buff, length) |
#define sock_op_timed_out | ( | ) | (errno == EAGAIN || errno == EWOULDBLOCK) |
typedef int socket_t |
AVIS_PUBLIC socket_t avis_open_socket | ( | const char * | host, | |
uint16_t | port, | |||
ElvinError * | error | |||
) |
AVIS_PUBLIC bool avis_open_socket_pair | ( | socket_t * | socket_read, | |
socket_t * | socket_write, | |||
ElvinError * | error | |||
) |
Open a bi-directional control socket.
AVIS_PUBLIC socket_t avis_select_ready | ( | socket_t | socket1, | |
socket_t | socket2, | |||
ElvinError * | error | |||
) |
Select a socket ready for reading.
If both are ready, return socket2.s