#include "lwip/opt.h"
#include "lwip/sys.h"
#include "lwip/mem.h"
#include "lwip/pbuf.h"
#include "lwip/ip.h"
#include "lwip/icmp.h"
#include "lwip/err.h"
Classes | |
struct | tcp_pcb |
struct | tcp_pcb_listen |
Defines | |
#define | DEF_ACCEPT_CALLBACK tcp_accept_fn accept; |
#define | TCP_PCB_COMMON(type) |
members common to struct tcp_pcb and struct tcp_listen_pcb | |
#define | TF_ACK_DELAY ((u8_t)0x01U) |
#define | TF_ACK_NOW ((u8_t)0x02U) |
#define | TF_INFR ((u8_t)0x04U) |
#define | TF_TIMESTAMP ((u8_t)0x08U) |
#define | TF_RXCLOSED ((u8_t)0x10U) |
#define | TF_FIN ((u8_t)0x20U) |
#define | TF_NODELAY ((u8_t)0x40U) |
#define | TF_NAGLEMEMERR ((u8_t)0x80U) |
#define | TCP_SNDQUEUELEN_OVERFLOW (0xffffU-3) |
#define | tcp_mss(pcb) (((pcb)->flags & TF_TIMESTAMP) ? ((pcb)->mss - 12) : (pcb)->mss) |
#define | tcp_sndbuf(pcb) ((pcb)->snd_buf) |
#define | tcp_sndqueuelen(pcb) ((pcb)->snd_queuelen) |
#define | tcp_nagle_disable(pcb) ((pcb)->flags |= TF_NODELAY) |
#define | tcp_nagle_enable(pcb) ((pcb)->flags &= ~TF_NODELAY) |
#define | tcp_nagle_disabled(pcb) (((pcb)->flags & TF_NODELAY) != 0) |
#define | tcp_accepted(pcb) |
#define | tcp_listen(pcb) tcp_listen_with_backlog(pcb, TCP_DEFAULT_LISTEN_BACKLOG) |
#define | TCP_WRITE_FLAG_COPY 0x01 |
#define | TCP_WRITE_FLAG_MORE 0x02 |
#define | TCP_PRIO_MIN 1 |
#define | TCP_PRIO_NORMAL 64 |
#define | TCP_PRIO_MAX 127 |
Typedefs | |
typedef err_t(* | tcp_accept_fn )(void *arg, struct tcp_pcb *newpcb, err_t err) |
Function prototype for tcp accept callback functions. | |
typedef err_t(* | tcp_recv_fn )(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err) |
Function prototype for tcp receive callback functions. | |
typedef err_t(* | tcp_sent_fn )(void *arg, struct tcp_pcb *tpcb, u16_t len) |
Function prototype for tcp sent callback functions. | |
typedef err_t(* | tcp_poll_fn )(void *arg, struct tcp_pcb *tpcb) |
Function prototype for tcp poll callback functions. | |
typedef void(* | tcp_err_fn )(void *arg, err_t err) |
Function prototype for tcp error callback functions. | |
typedef err_t(* | tcp_connected_fn )(void *arg, struct tcp_pcb *tpcb, err_t err) |
Function prototype for tcp connected callback functions. | |
Enumerations | |
enum | tcp_state { CLOSED = 0, LISTEN = 1, SYN_SENT = 2, SYN_RCVD = 3, ESTABLISHED = 4, FIN_WAIT_1 = 5, FIN_WAIT_2 = 6, CLOSE_WAIT = 7, CLOSING = 8, LAST_ACK = 9, TIME_WAIT = 10 } |
Functions | |
struct tcp_pcb * | tcp_new (void) |
void | tcp_arg (struct tcp_pcb *pcb, void *arg) |
void | tcp_accept (struct tcp_pcb *pcb, tcp_accept_fn accept) |
void | tcp_recv (struct tcp_pcb *pcb, tcp_recv_fn recv) |
void | tcp_sent (struct tcp_pcb *pcb, tcp_sent_fn sent) |
void | tcp_poll (struct tcp_pcb *pcb, tcp_poll_fn poll, u8_t interval) |
void | tcp_err (struct tcp_pcb *pcb, tcp_err_fn err) |
void | tcp_recved (struct tcp_pcb *pcb, u16_t len) |
err_t | tcp_bind (struct tcp_pcb *pcb, ip_addr_t *ipaddr, u16_t port) |
err_t | tcp_connect (struct tcp_pcb *pcb, ip_addr_t *ipaddr, u16_t port, tcp_connected_fn connected) |
struct tcp_pcb * | tcp_listen_with_backlog (struct tcp_pcb *pcb, u8_t backlog) |
void | tcp_abort (struct tcp_pcb *pcb) |
err_t | tcp_close (struct tcp_pcb *pcb) |
err_t | tcp_shutdown (struct tcp_pcb *pcb, int shut_rx, int shut_tx) |
err_t | tcp_write (struct tcp_pcb *pcb, const void *dataptr, u16_t len, u8_t apiflags) |
void | tcp_setprio (struct tcp_pcb *pcb, u8_t prio) |
err_t | tcp_output (struct tcp_pcb *pcb) |
const char * | tcp_debug_state_str (enum tcp_state s) |
#define DEF_ACCEPT_CALLBACK tcp_accept_fn accept; |
#define tcp_accepted | ( | pcb | ) |
LWIP_ASSERT("pcb->state == LISTEN (called for wrong pcb?)", \ pcb->state == LISTEN)
#define tcp_listen | ( | pcb | ) | tcp_listen_with_backlog(pcb, TCP_DEFAULT_LISTEN_BACKLOG) |
#define tcp_mss | ( | pcb | ) | (((pcb)->flags & TF_TIMESTAMP) ? ((pcb)->mss - 12) : (pcb)->mss) |
#define tcp_nagle_disable | ( | pcb | ) | ((pcb)->flags |= TF_NODELAY) |
#define tcp_nagle_disabled | ( | pcb | ) | (((pcb)->flags & TF_NODELAY) != 0) |
#define tcp_nagle_enable | ( | pcb | ) | ((pcb)->flags &= ~TF_NODELAY) |
#define TCP_PCB_COMMON | ( | type | ) |
type *next; /* for the linked list */ \ enum tcp_state state; /* TCP state */ \ u8_t prio; \ void *callback_arg; \ /* the accept callback for listen- and normal pcbs, if LWIP_CALLBACK_API */ \ DEF_ACCEPT_CALLBACK \ /* ports are in host byte order */ \ u16_t local_port
members common to struct tcp_pcb and struct tcp_listen_pcb
#define TCP_PRIO_MAX 127 |
#define TCP_PRIO_MIN 1 |
#define TCP_PRIO_NORMAL 64 |
#define tcp_sndbuf | ( | pcb | ) | ((pcb)->snd_buf) |
#define tcp_sndqueuelen | ( | pcb | ) | ((pcb)->snd_queuelen) |
#define TCP_SNDQUEUELEN_OVERFLOW (0xffffU-3) |
#define TCP_WRITE_FLAG_COPY 0x01 |
#define TCP_WRITE_FLAG_MORE 0x02 |
#define TF_ACK_DELAY ((u8_t)0x01U) |
#define TF_ACK_NOW ((u8_t)0x02U) |
#define TF_FIN ((u8_t)0x20U) |
#define TF_INFR ((u8_t)0x04U) |
#define TF_NAGLEMEMERR ((u8_t)0x80U) |
#define TF_NODELAY ((u8_t)0x40U) |
#define TF_RXCLOSED ((u8_t)0x10U) |
#define TF_TIMESTAMP ((u8_t)0x08U) |
typedef err_t(* tcp_accept_fn)(void *arg, struct tcp_pcb *newpcb, err_t err) |
Function prototype for tcp accept callback functions.
Called when a new connection can be accepted on a listening pcb.
arg | Additional argument to pass to the callback function ( |
newpcb | The new connection pcb | |
err | An error code if there has been an error accepting. Only return ERR_ABRT if you have called tcp_abort from within the callback function! |
typedef err_t(* tcp_connected_fn)(void *arg, struct tcp_pcb *tpcb, err_t err) |
Function prototype for tcp connected callback functions.
Called when a pcb is connected to the remote side after initiating a connection attempt by calling tcp_connect().
arg | Additional argument to pass to the callback function ( |
tpcb | The connection pcb which is connected | |
err | An unused error code, always ERR_OK currently ;-) TODO! Only return ERR_ABRT if you have called tcp_abort from within the callback function! |
typedef void(* tcp_err_fn)(void *arg, err_t err) |
Function prototype for tcp error callback functions.
Called when the pcb receives a RST or is unexpectedly closed for any other reason.
arg | Additional argument to pass to the callback function ( |
err | Error code to indicate why the pcb has been closed ERR_ABRT: aborted through tcp_abort or by a TCP timer ERR_RST: the connection was reset by the remote host |
typedef err_t(* tcp_poll_fn)(void *arg, struct tcp_pcb *tpcb) |
Function prototype for tcp poll callback functions.
Called periodically as specified by
arg | Additional argument to pass to the callback function ( |
tpcb | tcp pcb |
Function prototype for tcp receive callback functions.
Called when data has been received.
arg | Additional argument to pass to the callback function ( |
tpcb | The connection pcb which received data | |
p | The received data (or NULL when the connection has been closed!) | |
err | An error code if there has been an error receiving Only return ERR_ABRT if you have called tcp_abort from within the callback function! |
Function prototype for tcp sent callback functions.
Called when sent data has been acknowledged by the remote side. Use it to free corresponding resources. This also means that the pcb has now space available to send new data.
arg | Additional argument to pass to the callback function ( |
tpcb | The connection pcb for which data has been acknowledged | |
len | The amount of bytes acknowledged |
enum tcp_state |
void tcp_abort | ( | struct tcp_pcb * | pcb | ) |
void tcp_accept | ( | struct tcp_pcb * | pcb, | |
tcp_accept_fn | accept | |||
) |
void tcp_arg | ( | struct tcp_pcb * | pcb, | |
void * | arg | |||
) |
err_t tcp_connect | ( | struct tcp_pcb * | pcb, | |
ip_addr_t * | ipaddr, | |||
u16_t | port, | |||
tcp_connected_fn | connected | |||
) |
const char* tcp_debug_state_str | ( | enum tcp_state | s | ) |
void tcp_err | ( | struct tcp_pcb * | pcb, | |
tcp_err_fn | err | |||
) |
struct tcp_pcb* tcp_new | ( | void | ) | [read] |
void tcp_poll | ( | struct tcp_pcb * | pcb, | |
tcp_poll_fn | poll, | |||
u8_t | interval | |||
) |
void tcp_recv | ( | struct tcp_pcb * | pcb, | |
tcp_recv_fn | recv | |||
) |
void tcp_sent | ( | struct tcp_pcb * | pcb, | |
tcp_sent_fn | sent | |||
) |