32 #ifndef __LWIP_TCP_H__ 33 #define __LWIP_TCP_H__ 42 #include "lwip/icmp.h" 60 typedef err_t (*tcp_accept_fn)(
void *
arg,
struct tcp_pcb *newpcb,
err_t err);
72 typedef err_t (*tcp_recv_fn)(
void *
arg,
struct tcp_pcb *tpcb,
86 typedef err_t (*tcp_sent_fn)(
void *
arg,
struct tcp_pcb *tpcb,
98 typedef err_t (*tcp_poll_fn)(
void *
arg,
struct tcp_pcb *tpcb);
124 typedef err_t (*tcp_connected_fn)(
void *
arg,
struct tcp_pcb *tpcb,
err_t err);
140 #if LWIP_CALLBACK_API 148 #define DEF_ACCEPT_CALLBACK tcp_accept_fn accept; 150 #define DEF_ACCEPT_CALLBACK 156 #define TCP_PCB_COMMON(type) \ 158 void *callback_arg; \ 160 DEF_ACCEPT_CALLBACK \ 161 enum tcp_state state; \ 172 TCP_PCB_COMMON(
struct tcp_pcb);
178 #define TF_ACK_DELAY ((u8_t)0x01U) 179 #define TF_ACK_NOW ((u8_t)0x02U) 180 #define TF_INFR ((u8_t)0x04U) 181 #define TF_TIMESTAMP ((u8_t)0x08U) 182 #define TF_RXCLOSED ((u8_t)0x10U) 183 #define TF_FIN ((u8_t)0x20U) 184 #define TF_NODELAY ((u8_t)0x40U) 185 #define TF_NAGLEMEMERR ((u8_t)0x80U) 191 u8_t polltmr, pollinterval;
199 u32_t rcv_ann_right_edge;
224 u32_t snd_wl1, snd_wl2;
233 #define TCP_SNDQUEUELEN_OVERFLOW (0xffffU-3) 238 u16_t unsent_oversize;
242 struct tcp_seg *unsent;
243 struct tcp_seg *unacked;
245 struct tcp_seg *ooseq;
248 struct pbuf *refused_data;
250 #if LWIP_CALLBACK_API 263 #if LWIP_TCP_TIMESTAMPS 264 u32_t ts_lastacksent;
270 #if LWIP_TCP_KEEPALIVE 278 u8_t persist_backoff;
284 struct tcp_pcb_listen {
288 TCP_PCB_COMMON(
struct tcp_pcb_listen);
290 #if TCP_LISTEN_BACKLOG 292 u8_t accepts_pending;
302 LWIP_EVENT_CONNECTED,
307 err_t lwip_tcp_event(
void *
arg,
struct tcp_pcb *pcb,
316 struct tcp_pcb * tcp_new (
void);
318 void tcp_arg (
struct tcp_pcb *pcb,
void *
arg);
321 void tcp_sent (
struct tcp_pcb *pcb, tcp_sent_fn
sent);
323 void tcp_err (
struct tcp_pcb *pcb, tcp_err_fn
err);
325 #define tcp_mss(pcb) (((pcb)->flags & TF_TIMESTAMP) ? ((pcb)->mss - 12) : (pcb)->mss) 326 #define tcp_sndbuf(pcb) ((pcb)->snd_buf) 327 #define tcp_sndqueuelen(pcb) ((pcb)->snd_queuelen) 328 #define tcp_nagle_disable(pcb) ((pcb)->flags |= TF_NODELAY) 329 #define tcp_nagle_enable(pcb) ((pcb)->flags &= ~TF_NODELAY) 330 #define tcp_nagle_disabled(pcb) (((pcb)->flags & TF_NODELAY) != 0) 332 #if TCP_LISTEN_BACKLOG 333 #define tcp_accepted(pcb) do { \ 334 LWIP_ASSERT("pcb->state == LISTEN (called for wrong pcb?)", pcb->state == LISTEN); \ 335 (((struct tcp_pcb_listen *)(pcb))->accepts_pending--); } while(0) 337 #define tcp_accepted(pcb) LWIP_ASSERT("pcb->state == LISTEN (called for wrong pcb?)", \ 338 (pcb)->state == LISTEN) 341 void tcp_recved (
struct tcp_pcb *pcb,
u16_t len);
347 struct tcp_pcb * tcp_listen_with_backlog(
struct tcp_pcb *pcb,
u8_t backlog);
348 #define tcp_listen(pcb) tcp_listen_with_backlog(pcb, TCP_DEFAULT_LISTEN_BACKLOG) 350 void tcp_abort (
struct tcp_pcb *pcb);
355 #define TCP_WRITE_FLAG_COPY 0x01 356 #define TCP_WRITE_FLAG_MORE 0x02 361 void tcp_setprio (
struct tcp_pcb *pcb,
u8_t prio);
363 #define TCP_PRIO_MIN 1 364 #define TCP_PRIO_NORMAL 64 365 #define TCP_PRIO_MAX 127 367 err_t tcp_output (
struct tcp_pcb *pcb);
370 const char* tcp_debug_state_str(
enum tcp_state
s);
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
STREAM tcp_recv(STREAM s, uint32 length)
struct sock * tcp_accept(struct sock *sk, int flags, int *err)
typedefPACK_STRUCT_END struct ip_addr ip_addr_t
unsigned int tcp_poll(struct file *file, struct socket *sock, struct poll_table_struct *wait)
int poll(struct pollfd *ufds, int nfds, int timeout)
RD_BOOL tcp_connect(char *server)
void tcp_shutdown(struct sock *sk, int how)
void tcp_close(struct sock *sk, long timeout)
SOCKET WSAAPI accept(IN SOCKET s, OUT LPSOCKADDR addr, OUT INT FAR *addrlen)
int rtime(struct sockaddr_in *addrp, struct timeval *timep, struct timeval *timeout)
int const JOCTET * dataptr
INT WSAAPI recv(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags)
static struct sockaddr_in sa