12 #include <sys/socket.h>
13 #include <arpa/inet.h>
20 #define HAT_SOCKET_SUCCESS 0
21 #define HAT_SOCKET_ERROR (-1)
23 #define HAT_SOCKET_TYPE_IP4_TCP 0
24 #define HAT_SOCKET_TYPE_IP4_UDP 1
int hat_socket_listen(hat_socket_t *s, int backlog)
uint16_t hat_socket_port_t
Definition: socket.h:31
int hat_socket_send_to(hat_socket_t *s, hat_buff_t *data, hat_socket_ip4_addr_t host, hat_socket_port_t port)
int hat_socket_bind(hat_socket_t *s, hat_socket_ip4_addr_t host, hat_socket_port_t port)
int hat_socket_receive(hat_socket_t *s, hat_buff_t *data)
int hat_socket_open(hat_socket_t *s, int type)
int hat_socket_addr_convert(char *addr, hat_socket_ip4_addr_t *host)
uint32_t hat_socket_ip4_addr_t
Definition: socket.h:30
int hat_socket_connect(hat_socket_t *s, hat_socket_ip4_addr_t host, hat_socket_port_t port)
int hat_socket_send(hat_socket_t *s, hat_buff_t *data)
int hat_socket_addr_resolve(char *name, hat_socket_ip4_addr_t *host)
int hat_socket_accept(hat_socket_t *s, hat_socket_t *client)
int hat_socket_receive_from(hat_socket_t *s, hat_buff_t *data, hat_socket_ip4_addr_t host, hat_socket_port_t port)
void hat_socket_cleanup()
int hat_socket_close(hat_socket_t *s)
int hat_socket_set_blocking(hat_socket_t *s, bool blocking)
Data buffer.
Definition: buff.h:28
hat_socket_port_t remote_port
Definition: socket.h:38
hat_socket_ip4_addr_t remote_host
Definition: socket.h:37
int socket
Definition: socket.h:44
hat_socket_ip4_addr_t local_host
Definition: socket.h:35
hat_socket_port_t local_port
Definition: socket.h:36
int type
Definition: socket.h:34