#include <stdio.h>#include <stdlib.h>#include <arpa/inet.h>#include <unistd.h>#include <string.h>#include <sys/ioctl.h>#include <net/if.h>#include <errno.h>#include <fcntl.h>#include <limits.h>#include <tcp.h>#include <timer.h>#include "logging.h"
Data Structures | |
| struct | tcp_server |
| struct | tcp_client |
Macros | |
| #define | TCP_SERVER_LISTEN 20 |
| #define | TCP_CONNECT_TIMEOUT 1 |
Enumerations | |
| enum | tcp_client_state { TCP_DISCONNECTED = 0, TCP_CONNECTING, TCP_CONNECTED } |
Functions | |
| struct tcp_server * | tcp_server_create (struct tcp_conf *conf) |
| void | tcp_server_destroy (struct tcp_server *c) |
| int | tcp_server_get_fd (struct tcp_server *c) |
| int | tcp_server_accept (struct tcp_server *c, struct sockaddr_in *addr) |
| int | tcp_client_get_fd (struct tcp_client *c) |
| struct tcp_client * | tcp_client_create (struct tcp_conf *conf) |
| void | tcp_client_destroy (struct tcp_client *c) |
| ssize_t | tcp_client_send (struct tcp_client *c, const void *data, int size) |
| ssize_t | tcp_client_recv (struct tcp_client *c, void *data, int size) |
| void | tcp_client_set_data (struct tcp_client *c, void *data) |
| void * | tcp_client_get_data (struct tcp_client *c) |
| #define TCP_CONNECT_TIMEOUT 1 |
| #define TCP_SERVER_LISTEN 20 |
Referenced by tcp_server_create().
| enum tcp_client_state |
| struct tcp_client* tcp_client_create | ( | struct tcp_conf * | conf | ) |
References tcp_sock::conf, init_alarm(), and NULL.
Referenced by tcp_client_start().


| void tcp_client_destroy | ( | struct tcp_client * | c | ) |
References tcp_client::fd.
| void* tcp_client_get_data | ( | struct tcp_client * | c | ) |
References tcp_client::data.
| int tcp_client_get_fd | ( | struct tcp_client * | c | ) |
References tcp_client::fd.
Referenced by tcp_client_start().

| ssize_t tcp_client_recv | ( | struct tcp_client * | c, |
| void * | data, | ||
| int | size | ||
| ) |
References tcp_client::addr, tcp_client::fd, tcp_client::socklen, tcp_client::state, TCP_CONNECTED, TCP_CONNECTING, and TCP_DISCONNECTED.
| ssize_t tcp_client_send | ( | struct tcp_client * | c, |
| const void * | data, | ||
| int | size | ||
| ) |
References tcp_client::addr, tcp_client::fd, tcp_client::socklen, tcp_client::state, TCP_CONNECTED, TCP_CONNECTING, and TCP_DISCONNECTED.
| void tcp_client_set_data | ( | struct tcp_client * | c, |
| void * | data | ||
| ) |
References tcp_client::data, and data.
| int tcp_server_accept | ( | struct tcp_server * | c, |
| struct sockaddr_in * | addr | ||
| ) |
References tcp_server::fd.
| struct tcp_server* tcp_server_create | ( | struct tcp_conf * | conf | ) |
References tcp_server::addr, tcp_sock::addr, tcp_sock::conf, tcp_server::fd, tcp_sock::fd, tcp_conf::ipproto, tcp_conf::ipv4, tcp_server::ipv4, tcp_sock::ipv4, tcp_conf::ipv6, tcp_server::ipv6, tcp_sock::ipv6, NULL, tcp_conf::port, tcp_conf::rcvbuf, tcp_conf::server, SO_RCVBUFFORCE, tcp_sock::sockaddr_len, tcp_sock::state, TCP_SERVER_ACCEPTING, and TCP_SERVER_LISTEN.
Referenced by tcp_server_start().

| void tcp_server_destroy | ( | struct tcp_server * | c | ) |
References tcp_server::fd.
| int tcp_server_get_fd | ( | struct tcp_server * | c | ) |
References tcp_server::fd.
Referenced by tcp_server_start().
