Enumerations | |
enum | tcp_event { TCP_EVT_NONE, TCP_EVT_ERROR, TCP_EVT_RESET, TCP_EVT_TIMEOUT, TCP_EVT_CONN_ESTABLISHED, TCP_EVT_CONN_INCOMING, TCP_EVT_CONN_CLOSED, TCP_EVT_CONN_IDLE, TCP_EVT_DATA_RECEIVED, TCP_EVT_DATA_SENT } |
Events generated by a TCP socket. More... | |
Functions | |
void | tcp_init () |
Initializes the TCP layer. | |
bool | tcp_handle_packet (const uint8_t *ip, const struct tcp_header *packet, uint16_t packet_len) |
Forwards incoming packets to the appropriate TCP socket. | |
int | tcp_socket_alloc (tcp_callback callback) |
Allocates a TCP socket. | |
bool | tcp_socket_free (int socket) |
Deallocates a TCP socket. | |
bool | tcp_connect (int socket, const uint8_t *ip, uint16_t port) |
Actively opens a connection to the given remote host and port. | |
bool | tcp_disconnect (int socket) |
Actively closes a connection. | |
bool | tcp_listen (int socket, uint16_t port) |
Starts listening on a local port for incoming connections. | |
bool | tcp_accept (int socket, tcp_callback callback) |
Accepts an incoming connection. | |
int16_t | tcp_write (int socket, const uint8_t *data, uint16_t data_len) |
Writes data for transmission to the socket. | |
int16_t | tcp_write_string_P (int socket, PGM_P str) |
Writes a string from flash memory space to the socket. | |
int16_t | tcp_read (int socket, uint8_t *buffer, uint16_t buffer_len) |
Reads data which was received over a socket. | |
int16_t | tcp_peek (int socket, uint8_t *buffer, uint16_t offset, uint16_t buffer_len) |
Reads data which was received over a socket, without actually removing it from the input buffer. | |
int16_t | tcp_skip (int socket, uint16_t len) |
Removes data from the receive buffer of a socket without reading it. | |
int16_t | tcp_reserve (int socket, uint16_t len) |
Declares unused transmit buffer space of a socket as valid. | |
uint8_t * | tcp_buffer_rx (int socket) |
Retrieves a pointer to the occupied part of the receive buffer space of a socket. | |
uint8_t * | tcp_buffer_tx (int socket) |
Retrieves a pointer to the empty part of the transmit buffer space of a socket. | |
int16_t | tcp_buffer_used_rx (int socket) |
Retrieves the number of available data bytes waiting to be read from the socket. | |
int16_t | tcp_buffer_space_rx (int socket) |
Retrieves the number of data bytes which currently can be received until the receive buffer of the socket is full. | |
int16_t | tcp_buffer_used_tx (int socket) |
Retrieves the number of data bytes which have been written to the socket but which have not been sent to the remote host or which have not been acknowledged yet. | |
int16_t | tcp_buffer_space_tx (int socket) |
Retrieves the number of data bytes which currently can be written to the socket. |