RetroArch
tcp.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without modification,
6  * are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  * 3. The name of the author may not be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
19  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
21  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
24  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
25  * OF SUCH DAMAGE.
26  *
27  * This file is part of the lwIP TCP/IP stack.
28  *
29  * Author: Adam Dunkels <adam@sics.se>
30  *
31  */
32 #ifndef __LWIP_TCP_H__
33 #define __LWIP_TCP_H__
34 
35 #include "lwip/sys.h"
36 #include "lwip/mem.h"
37 
38 #include "lwip/pbuf.h"
39 #include "lwip/opt.h"
40 #include "lwip/ip.h"
41 #include "lwip/icmp.h"
42 
43 #include "lwip/err.h"
44 
45 struct tcp_pcb;
46 
47 /* Functions for interfacing with TCP: */
48 
49 /* Lower layer interface to TCP: */
50 void tcp_init (void); /* Must be called first to
51  initialize TCP. */
52 void tcp_tmr (void); /* Must be called every
53  TCP_TMR_INTERVAL
54  ms. (Typically 250 ms). */
55 /* Application program's interface: */
56 struct tcp_pcb * tcp_new (void);
57 struct tcp_pcb * tcp_alloc (u8_t prio);
58 
59 void tcp_arg (struct tcp_pcb *pcb, void *arg);
60 void tcp_accept (struct tcp_pcb *pcb,
61  err_t (* accept)(void *arg, struct tcp_pcb *newpcb,
62  err_t err));
63 void tcp_recv (struct tcp_pcb *pcb,
64  err_t (* recv)(void *arg, struct tcp_pcb *tpcb,
65  struct pbuf *p, err_t err));
66 void tcp_sent (struct tcp_pcb *pcb,
67  err_t (* sent)(void *arg, struct tcp_pcb *tpcb,
68  u16_t len));
69 void tcp_poll (struct tcp_pcb *pcb,
70  err_t (* poll)(void *arg, struct tcp_pcb *tpcb),
71  u8_t interval);
72 void tcp_err (struct tcp_pcb *pcb,
73  void (* err)(void *arg, err_t err));
74 
75 #define tcp_mss(pcb) ((pcb)->mss)
76 #define tcp_sndbuf(pcb) ((pcb)->snd_buf)
77 
78 void tcp_recved (struct tcp_pcb *pcb, u16_t len);
79 err_t tcp_bind (struct tcp_pcb *pcb, struct ip_addr *ipaddr,
80  u16_t port);
81 err_t tcp_connect (struct tcp_pcb *pcb, struct ip_addr *ipaddr,
82  u16_t port, err_t (* connected)(void *arg,
83  struct tcp_pcb *tpcb,
84  err_t err));
85 struct tcp_pcb * tcp_listen (struct tcp_pcb *pcb);
86 void tcp_abort (struct tcp_pcb *pcb);
87 err_t tcp_close (struct tcp_pcb *pcb);
88 err_t tcp_write (struct tcp_pcb *pcb, const void *dataptr, u16_t len,
89  u8_t copy);
90 
91 void tcp_setprio (struct tcp_pcb *pcb, u8_t prio);
92 
93 #define TCP_PRIO_MIN 1
94 #define TCP_PRIO_NORMAL 64
95 #define TCP_PRIO_MAX 127
96 
97 /* It is also possible to call these two functions at the right
98  intervals (instead of calling tcp_tmr()). */
99 void tcp_slowtmr (void);
100 void tcp_fasttmr (void);
101 
102 
103 /* Only used by IP to pass a TCP segment to TCP: */
104 void tcp_input (struct pbuf *p, struct netif *inp);
105 /* Used within the TCP code only: */
106 err_t tcp_output (struct tcp_pcb *pcb);
107 void tcp_rexmit (struct tcp_pcb *pcb);
108 void tcp_rexmit_rto (struct tcp_pcb *pcb);
109 
110 
111 
112 #define TCP_SEQ_LT(a,b) ((s32_t)((a)-(b)) < 0)
113 #define TCP_SEQ_LEQ(a,b) ((s32_t)((a)-(b)) <= 0)
114 #define TCP_SEQ_GT(a,b) ((s32_t)((a)-(b)) > 0)
115 #define TCP_SEQ_GEQ(a,b) ((s32_t)((a)-(b)) >= 0)
116 /* is b<=a<=c? */
117 #if 0 /* see bug #10548 */
118 #define TCP_SEQ_BETWEEN(a,b,c) ((c)-(b) >= (a)-(b))
119 #endif
120 #define TCP_SEQ_BETWEEN(a,b,c) (TCP_SEQ_GEQ(a,b) && TCP_SEQ_LEQ(a,c))
121 #define TCP_FIN 0x01U
122 #define TCP_SYN 0x02U
123 #define TCP_RST 0x04U
124 #define TCP_PSH 0x08U
125 #define TCP_ACK 0x10U
126 #define TCP_URG 0x20U
127 #define TCP_ECE 0x40U
128 #define TCP_CWR 0x80U
129 
130 #define TCP_FLAGS 0x3fU
131 
132 /* Length of the TCP header, excluding options. */
133 #define TCP_HLEN 20
134 
135 #ifndef TCP_TMR_INTERVAL
136 #define TCP_TMR_INTERVAL 250 /* The TCP timer interval in
137  milliseconds. */
138 #endif /* TCP_TMR_INTERVAL */
139 
140 #ifndef TCP_FAST_INTERVAL
141 #define TCP_FAST_INTERVAL TCP_TMR_INTERVAL /* the fine grained timeout in
142  milliseconds */
143 #endif /* TCP_FAST_INTERVAL */
144 
145 #ifndef TCP_SLOW_INTERVAL
146 #define TCP_SLOW_INTERVAL (2*TCP_TMR_INTERVAL) /* the coarse grained timeout in
147  milliseconds */
148 #endif /* TCP_SLOW_INTERVAL */
149 
150 #define TCP_FIN_WAIT_TIMEOUT 20000 /* milliseconds */
151 #define TCP_SYN_RCVD_TIMEOUT 20000 /* milliseconds */
152 
153 #define TCP_OOSEQ_TIMEOUT 6 /* x RTO */
154 
155 #define TCP_MSL 60000 /* The maximum segment lifetime in microseconds */
156 
157 /*
158  * User-settable options (used with setsockopt).
159  */
160 #define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */
161 #define TCP_KEEPALIVE 0x02 /* send KEEPALIVE probes when idle for pcb->keepalive miliseconds */
162 
163 /* Keepalive values */
164 #define TCP_KEEPDEFAULT 7200000 /* KEEPALIVE timer in miliseconds */
165 #define TCP_KEEPINTVL 75000 /* Time between KEEPALIVE probes in miliseconds */
166 #define TCP_KEEPCNT 9 /* Counter for KEEPALIVE probes */
167 #define TCP_MAXIDLE TCP_KEEPCNT * TCP_KEEPINTVL /* Maximum KEEPALIVE probe time */
168 
169 
170 #ifdef PACK_STRUCT_USE_INCLUDES
171 # include "arch/bpstruct.h"
172 #endif
174 struct tcp_hdr {
176  PACK_STRUCT_FIELD(u16_t dest);
177  PACK_STRUCT_FIELD(u32_t seqno);
178  PACK_STRUCT_FIELD(u32_t ackno);
179  PACK_STRUCT_FIELD(u16_t _hdrlen_rsvd_flags);
182  PACK_STRUCT_FIELD(u16_t urgp);
185 #ifdef PACK_STRUCT_USE_INCLUDES
186 # include "arch/epstruct.h"
187 #endif
188 
189 #define TCPH_OFFSET(phdr) (ntohs((phdr)->_hdrlen_rsvd_flags) >> 8)
190 #define TCPH_HDRLEN(phdr) (ntohs((phdr)->_hdrlen_rsvd_flags) >> 12)
191 #define TCPH_FLAGS(phdr) (ntohs((phdr)->_hdrlen_rsvd_flags) & TCP_FLAGS)
192 
193 #define TCPH_OFFSET_SET(phdr, offset) (phdr)->_hdrlen_rsvd_flags = htons(((offset) << 8) | TCPH_FLAGS(phdr))
194 #define TCPH_HDRLEN_SET(phdr, len) (phdr)->_hdrlen_rsvd_flags = htons(((len) << 12) | TCPH_FLAGS(phdr))
195 #define TCPH_FLAGS_SET(phdr, flags) (phdr)->_hdrlen_rsvd_flags = htons((ntohs((phdr)->_hdrlen_rsvd_flags) & ~TCP_FLAGS) | (flags))
196 #define TCPH_SET_FLAG(phdr, flags ) (phdr)->_hdrlen_rsvd_flags = htons(ntohs((phdr)->_hdrlen_rsvd_flags) | (flags))
197 #define TCPH_UNSET_FLAG(phdr, flags) (phdr)->_hdrlen_rsvd_flags = htons(ntohs((phdr)->_hdrlen_rsvd_flags) | (TCPH_FLAGS(phdr) & ~(flags)) )
198 
199 #define TCP_TCPLEN(seg) ((seg)->len + ((TCPH_FLAGS((seg)->tcphdr) & TCP_FIN || \
200  TCPH_FLAGS((seg)->tcphdr) & TCP_SYN)? 1: 0))
201 
202 enum tcp_state {
203  CLOSED = 0,
204  LISTEN = 1,
205  SYN_SENT = 2,
206  SYN_RCVD = 3,
211  CLOSING = 8,
212  LAST_ACK = 9,
214 };
215 
216 /* the TCP protocol control block */
217 struct tcp_pcb {
221  struct tcp_pcb *next; /* for the linked list */
222  enum tcp_state state; /* TCP state */
225 
228 
230 #define TF_ACK_DELAY (u8_t)0x01U /* Delayed ACK. */
231 #define TF_ACK_NOW (u8_t)0x02U /* Immediate ACK. */
232 #define TF_INFR (u8_t)0x04U /* In fast recovery. */
233 #define TF_RESET (u8_t)0x08U /* Connection was reset. */
234 #define TF_CLOSED (u8_t)0x10U /* Connection was sucessfully closed. */
235 #define TF_GOT_FIN (u8_t)0x20U /* Connection was closed by the remote end. */
236 #define TF_NODELAY (u8_t)0x40U /* Disable Nagle algorithm */
237 
238  /* receiver variables */
239  u32_t rcv_nxt; /* next seqno expected */
240  u16_t rcv_wnd; /* receiver window */
241 
242  /* Timers */
245 
246  /* Retransmission timer. */
248 
249  u16_t mss; /* maximum segment size */
250 
251  /* RTT (round trip time) estimation variables */
252  u32_t rttest; /* RTT estimate in 500ms ticks */
253  u32_t rtseq; /* sequence number being timed */
254  s16_t sa, sv; /* @todo document this */
255 
256  u16_t rto; /* retransmission time-out */
257  u8_t nrtx; /* number of retransmissions */
258 
259  /* fast retransmit/recovery */
260  u32_t lastack; /* Highest acknowledged seqno. */
262 
263  /* congestion avoidance/control variables */
266 
267  /* sender variables */
268  u32_t snd_nxt, /* next seqno to be sent */
269  snd_max, /* Highest seqno sent. */
270  snd_wnd, /* sender window */
271  snd_wl1, snd_wl2, /* Sequence and acknowledgement numbers of last
272  window update. */
273  snd_lbb; /* Sequence number of next byte to be buffered. */
274 
276 
277  u16_t snd_buf; /* Available buffer space for sending (in bytes). */
278  u16_t snd_queuelen; /* Available buffer space for sending (in tcp_segs). */
279 
280 
281  /* These are ordered by sequence number: */
282  struct tcp_seg *unsent; /* Unsent (queued) segments. */
283  struct tcp_seg *unacked; /* Sent but unacknowledged segments. */
284 #if TCP_QUEUE_OOSEQ
285  struct tcp_seg *ooseq; /* Received out of sequence segments. */
286 #endif /* TCP_QUEUE_OOSEQ */
287 
288 #if LWIP_CALLBACK_API
289  /* Function to be called when more send buffer space is available. */
290  err_t (* sent)(void *arg, struct tcp_pcb *pcb, u16_t space);
291 
292  /* Function to be called when (in-sequence) data has arrived. */
293  err_t (* recv)(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err);
294 
295  /* Function to be called when a connection has been set up. */
296  err_t (* connected)(void *arg, struct tcp_pcb *pcb, err_t err);
297 
298  /* Function to call when a listener has been connected. */
299  err_t (* accept)(void *arg, struct tcp_pcb *newpcb, err_t err);
300 
301  /* Function which is called periodically. */
302  err_t (* poll)(void *arg, struct tcp_pcb *pcb);
303 
304  /* Function to be called whenever a fatal error occurs. */
305  void (* errf)(void *arg, err_t err);
306 #endif /* LWIP_CALLBACK_API */
307 
308  /* idle time before KEEPALIVE is sent */
310 
311  /* KEEPALIVE counter */
313 };
314 
316 /* Common members of all PCB types */
318 
319 /* Protocol specific PCB members */
320  struct tcp_pcb_listen *next; /* for the linked list */
321 
322  /* Even if state is obviously LISTEN this is here for
323  * field compatibility with tpc_pcb to which it is cast sometimes
324  * Until a cleaner solution emerges this is here.FIXME
325  */
326  enum tcp_state state; /* TCP state */
327 
330 
332 
333 #if LWIP_CALLBACK_API
334  /* Function to call when a listener has been connected. */
335  err_t (* accept)(void *arg, struct tcp_pcb *newpcb, err_t err);
336 #endif /* LWIP_CALLBACK_API */
337 };
338 
339 #if LWIP_EVENT_API
340 
341 enum lwip_event {
342  LWIP_EVENT_ACCEPT,
343  LWIP_EVENT_SENT,
344  LWIP_EVENT_RECV,
345  LWIP_EVENT_CONNECTED,
346  LWIP_EVENT_POLL,
347  LWIP_EVENT_ERR
348 };
349 
350 err_t lwip_tcp_event(void *arg, struct tcp_pcb *pcb,
351  enum lwip_event,
352  struct pbuf *p,
353  u16_t size,
354  err_t err);
355 
356 #define TCP_EVENT_ACCEPT(pcb,err,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
357  LWIP_EVENT_ACCEPT, NULL, 0, err)
358 #define TCP_EVENT_SENT(pcb,space,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
359  LWIP_EVENT_SENT, NULL, space, ERR_OK)
360 #define TCP_EVENT_RECV(pcb,p,err,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
361  LWIP_EVENT_RECV, (p), 0, (err))
362 #define TCP_EVENT_CONNECTED(pcb,err,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
363  LWIP_EVENT_CONNECTED, NULL, 0, (err))
364 #define TCP_EVENT_POLL(pcb,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
365  LWIP_EVENT_POLL, NULL, 0, ERR_OK)
366 #define TCP_EVENT_ERR(errf,arg,err) lwip_tcp_event((arg), NULL, \
367  LWIP_EVENT_ERR, NULL, 0, (err))
368 #else /* LWIP_EVENT_API */
369 #define TCP_EVENT_ACCEPT(pcb,err,ret) \
370  if((pcb)->accept != NULL) \
371  (ret = (pcb)->accept((pcb)->callback_arg,(pcb),(err)))
372 #define TCP_EVENT_SENT(pcb,space,ret) \
373  if((pcb)->sent != NULL) \
374  (ret = (pcb)->sent((pcb)->callback_arg,(pcb),(space)))
375 #define TCP_EVENT_RECV(pcb,p,err,ret) \
376  if((pcb)->recv != NULL) \
377  { ret = (pcb)->recv((pcb)->callback_arg,(pcb),(p),(err)); } else { \
378  if (p) pbuf_free(p); }
379 #define TCP_EVENT_CONNECTED(pcb,err,ret) \
380  if((pcb)->connected != NULL) \
381  (ret = (pcb)->connected((pcb)->callback_arg,(pcb),(err)))
382 #define TCP_EVENT_POLL(pcb,ret) \
383  if((pcb)->poll != NULL) \
384  (ret = (pcb)->poll((pcb)->callback_arg,(pcb)))
385 #define TCP_EVENT_ERR(errf,arg,err) \
386  if((errf) != NULL) \
387  (errf)((arg),(err))
388 #endif /* LWIP_EVENT_API */
389 
390 /* This structure represents a TCP segment on the unsent and unacked queues */
391 struct tcp_seg {
392  struct tcp_seg *next; /* used when putting segements on a queue */
393  struct pbuf *p; /* buffer containing data + TCP header */
394  void *dataptr; /* pointer to the TCP data in the pbuf */
395  u16_t len; /* the TCP length of this segment */
396  struct tcp_hdr *tcphdr; /* the TCP header */
397 };
398 
399 /* Internal functions and global variables: */
400 struct tcp_pcb *tcp_pcb_copy(struct tcp_pcb *pcb);
401 void tcp_pcb_purge(struct tcp_pcb *pcb);
402 void tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb);
403 
404 u8_t tcp_segs_free(struct tcp_seg *seg);
405 u8_t tcp_seg_free(struct tcp_seg *seg);
406 struct tcp_seg *tcp_seg_copy(struct tcp_seg *seg);
407 
408 #define tcp_ack(pcb) if((pcb)->flags & TF_ACK_DELAY) { \
409  (pcb)->flags &= ~TF_ACK_DELAY; \
410  (pcb)->flags |= TF_ACK_NOW; \
411  tcp_output(pcb); \
412  } else { \
413  (pcb)->flags |= TF_ACK_DELAY; \
414  }
415 
416 #define tcp_ack_now(pcb) (pcb)->flags |= TF_ACK_NOW; \
417  tcp_output(pcb)
418 
419 err_t tcp_send_ctrl(struct tcp_pcb *pcb, u8_t flags);
420 err_t tcp_enqueue(struct tcp_pcb *pcb, void *dataptr, u16_t len,
421  u8_t flags, u8_t copy,
422  u8_t *optdata, u8_t optlen);
423 
424 void tcp_rexmit_seg(struct tcp_pcb *pcb, struct tcp_seg *seg);
425 
426 void tcp_rst(u32_t seqno, u32_t ackno,
427  struct ip_addr *local_ip, struct ip_addr *remote_ip,
428  u16_t local_port, u16_t remote_port);
429 
430 u32_t tcp_next_iss(void);
431 
432 void tcp_keepalive(struct tcp_pcb *pcb);
433 
434 extern struct tcp_pcb *tcp_input_pcb;
435 extern u32_t tcp_ticks;
436 
437 #if TCP_DEBUG || TCP_INPUT_DEBUG || TCP_OUTPUT_DEBUG
438 void tcp_debug_print(struct tcp_hdr *tcphdr);
441 void tcp_debug_print_pcbs(void);
442 s16_t tcp_pcbs_sane(void);
443 #else
444 # define tcp_debug_print(tcphdr)
445 # define tcp_debug_print_flags(flags)
446 # define tcp_debug_print_state(s)
447 # define tcp_debug_print_pcbs()
448 # define tcp_pcbs_sane() 1
449 #endif /* TCP_DEBUG */
450 /*
451 #if NO_SYS
452 #define tcp_timer_needed()
453 #else
454 void tcp_timer_needed(void);
455 #endif
456 */
457 void tcp_timer_needed(void);
458 
459 /* The TCP PCB lists. */
460 union tcp_listen_pcbs_t { /* List of all TCP PCBs in LISTEN state. */
462  struct tcp_pcb *pcbs;
463 };
465 extern struct tcp_pcb *tcp_active_pcbs; /* List of all TCP PCBs that are in a
466  state in which they accept or send
467  data. */
468 extern struct tcp_pcb *tcp_tw_pcbs; /* List of all TCP PCBs in TIME-WAIT. */
469 
470 extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */
471 
472 /* Axioms about the above lists:
473  1) Every TCP PCB that is not CLOSED is in one of the lists.
474  2) A PCB is only in one of the lists.
475  3) All PCBs in the tcp_listen_pcbs list is in LISTEN state.
476  4) All PCBs in the tcp_tw_pcbs list is in TIME-WAIT state.
477 */
478 
479 /* Define two macros, TCP_REG and TCP_RMV that registers a TCP PCB
480  with a PCB list or removes a PCB from a list, respectively. */
481 #if 0
482 #define TCP_REG(pcbs, npcb) do {\
483  LWIP_DEBUGF(TCP_DEBUG, ("TCP_REG %p local port %d\n", npcb, npcb->local_port)); \
484  for(tcp_tmp_pcb = *pcbs; \
485  tcp_tmp_pcb != NULL; \
486  tcp_tmp_pcb = tcp_tmp_pcb->next) { \
487  LWIP_ASSERT("TCP_REG: already registered\n", tcp_tmp_pcb != npcb); \
488  } \
489  LWIP_ASSERT("TCP_REG: pcb->state != CLOSED", npcb->state != CLOSED); \
490  npcb->next = *pcbs; \
491  LWIP_ASSERT("TCP_REG: npcb->next != npcb", npcb->next != npcb); \
492  *(pcbs) = npcb; \
493  LWIP_ASSERT("TCP_RMV: tcp_pcbs sane", tcp_pcbs_sane()); \
494  tcp_timer_needed(); \
495  } while(0)
496 #define TCP_RMV(pcbs, npcb) do { \
497  LWIP_ASSERT("TCP_RMV: pcbs != NULL", *pcbs != NULL); \
498  LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removing %p from %p\n", npcb, *pcbs)); \
499  if(*pcbs == npcb) { \
500  *pcbs = (*pcbs)->next; \
501  } else for(tcp_tmp_pcb = *pcbs; tcp_tmp_pcb != NULL; tcp_tmp_pcb = tcp_tmp_pcb->next) { \
502  if(tcp_tmp_pcb->next != NULL && tcp_tmp_pcb->next == npcb) { \
503  tcp_tmp_pcb->next = npcb->next; \
504  break; \
505  } \
506  } \
507  npcb->next = NULL; \
508  LWIP_ASSERT("TCP_RMV: tcp_pcbs sane", tcp_pcbs_sane()); \
509  LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removed %p from %p\n", npcb, *pcbs)); \
510  } while(0)
511 
512 #else /* LWIP_DEBUG */
513 #define TCP_REG(pcbs, npcb) do { \
514  npcb->next = *pcbs; \
515  *(pcbs) = npcb; \
516  tcp_timer_needed(); \
517  } while(0)
518 #define TCP_RMV(pcbs, npcb) do { \
519  if(*(pcbs) == npcb) { \
520  (*(pcbs)) = (*pcbs)->next; \
521  } else for(tcp_tmp_pcb = *pcbs; tcp_tmp_pcb != NULL; tcp_tmp_pcb = tcp_tmp_pcb->next) { \
522  if(tcp_tmp_pcb->next != NULL && tcp_tmp_pcb->next == npcb) { \
523  tcp_tmp_pcb->next = npcb->next; \
524  break; \
525  } \
526  } \
527  npcb->next = NULL; \
528  } while(0)
529 #endif /* LWIP_DEBUG */
530 #endif /* __LWIP_TCP_H__ */
531 
532 
533 
Definition: tcp.h:207
u8_t polltmr
Definition: tcp.h:244
struct tcp_pcb_listen * listen_pcbs
Definition: tcp.h:461
err_t tcp_write(struct tcp_pcb *pcb, const void *dataptr, u16_t len, u8_t copy)
u8_t nrtx
Definition: tcp.h:257
static u32_t chksum(void *dataptr, u16_t len)
Definition: inet6.c:59
err_t tcp_output(struct tcp_pcb *pcb)
struct tcp_pcb * tcp_alloc(u8_t prio)
u8_t keep_cnt
Definition: tcp.h:312
int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
#define tcp_debug_print(tcphdr)
Definition: tcp.h:444
struct tcp_pcb_listen * next
Definition: tcp.h:320
s8_t err_t
Definition: err.h:39
u32_t snd_wnd
Definition: tcp.h:268
u32_t rttest
Definition: tcp.h:252
void tcp_input(struct pbuf *p, struct netif *inp)
#define tcp_pcbs_sane()
Definition: tcp.h:448
u32_t snd_wl1
Definition: tcp.h:268
u16_t snd_queuelen
Definition: tcp.h:278
Definition: tcp.h:315
Definition: ip_addr.h:41
void tcp_err(struct tcp_pcb *pcb, void(*err)(void *arg, err_t err))
struct tcp_pcb * tcp_tw_pcbs
err_t tcp_enqueue(struct tcp_pcb *pcb, void *dataptr, u16_t len, u8_t flags, u8_t copy, u8_t *optdata, u8_t optlen)
struct tcp_pcb * pcbs
Definition: tcp.h:462
void * callback_arg
Definition: tcp.h:224
struct tcp_seg * unacked
Definition: tcp.h:283
u32_t snd_max
Definition: tcp.h:268
void tcp_slowtmr(void)
Definition: tcp.h:213
#define PACK_STRUCT_BEGIN
Definition: arch.h:46
void tcp_tmr(void)
void * callback_arg
Definition: tcp.h:329
struct tcp_pcb * next
Definition: tcp.h:221
void tcp_rexmit_seg(struct tcp_pcb *pcb, struct tcp_seg *seg)
err_t tcp_send_ctrl(struct tcp_pcb *pcb, u8_t flags)
GLenum GLsizei len
Definition: glext.h:7389
void tcp_abort(struct tcp_pcb *pcb)
void tcp_rexmit(struct tcp_pcb *pcb)
u16_t rcv_wnd
Definition: tcp.h:240
GLsizeiptr size
Definition: glext.h:6559
includes all by default used to find thumbnails Please choose a single playlist first Add Entry Add Folder Select Files< multiple > Please fill out all required fields RetroArch updated successfully Please restart the application for the changes to take effect Contributors Move Down Load Remove Add Pass No shader passes Reset All Passes Download thumbnail Start on Download All Thumbnails This Playlist Configured in port
Definition: msg_hash_us.h:7699
Definition: tcp.h:460
u16_t remote_port
Definition: tcp.h:227
void tcp_pcb_purge(struct tcp_pcb *pcb)
GLdouble s
Definition: glext.h:6390
Definition: tcp.h:206
Definition: tcp.h:205
typedef void(__stdcall *PFN_DESTRUCTION_CALLBACK)(void *pData)
struct tcp_pcb * tcp_new(void)
void tcp_rexmit_rto(struct tcp_pcb *pcb)
void tcp_recv(struct tcp_pcb *pcb, err_t(*recv)(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err))
Definition: netif.h:72
struct tcp_pcb * tcp_active_pcbs
struct tcp_pcb * tcp_tmp_pcb
u8_t dupacks
Definition: tcp.h:261
ssize_t recv(int sockfd, void *buf, size_t len, int flags)
struct tcp_seg * next
Definition: tcp.h:392
u32_t rtseq
Definition: tcp.h:253
s16_t sa
Definition: tcp.h:254
u32_t keepalive
Definition: tcp.h:309
Definition: tcp.h:210
#define tcp_debug_print_state(s)
Definition: tcp.h:446
u32_t snd_wl2
Definition: tcp.h:268
void tcp_accept(struct tcp_pcb *pcb, err_t(*accept)(void *arg, struct tcp_pcb *newpcb, err_t err))
s16_t sv
Definition: tcp.h:254
void * dataptr
Definition: tcp.h:394
#define tcp_debug_print_pcbs()
Definition: tcp.h:447
struct tcp_pcb * tcp_pcb_copy(struct tcp_pcb *pcb)
void tcp_init(void)
u8_t pollinterval
Definition: tcp.h:244
Definition: tcp.h:204
u16_t rto
Definition: tcp.h:256
err_t tcp_close(struct tcp_pcb *pcb)
u32_t snd_lbb
Definition: tcp.h:268
#define tcp_debug_print_flags(flags)
Definition: tcp.h:445
u8_t prio
Definition: tcp.h:328
err_t tcp_bind(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
u16_t ssthresh
Definition: tcp.h:265
union tcp_listen_pcbs_t tcp_listen_pcbs
u16_t snd_buf
Definition: tcp.h:277
u16_t acked
Definition: tcp.h:275
struct tcp_pcb * tcp_listen(struct tcp_pcb *pcb)
void tcp_poll(struct tcp_pcb *pcb, err_t(*poll)(void *arg, struct tcp_pcb *tpcb), u8_t interval)
GLenum src
Definition: glext.h:6980
u8_t tcp_seg_free(struct tcp_seg *seg)
enum tcp_state state
Definition: tcp.h:326
u32_t tcp_next_iss(void)
u16_t local_port
Definition: tcp.h:331
GLfloat GLfloat p
Definition: glext.h:9809
#define PACK_STRUCT_END
Definition: arch.h:50
u32_t tcp_ticks
s16 s16_t
Definition: cc.h:46
PACK_STRUCT_BEGIN struct tcp_hdr PACK_STRUCT_STRUCT
IP_PCB
Definition: tcp.h:317
u32_t rcv_nxt
Definition: tcp.h:239
Definition: tcp.h:209
struct pbuf * p
Definition: tcp.h:393
u8 u8_t
Definition: cc.h:43
u16_t len
Definition: tcp.h:395
enum tcp_state state
Definition: tcp.h:222
u32_t tmr
Definition: tcp.h:243
PACK_STRUCT_FIELD(u16_t src)
u8_t tcp_segs_free(struct tcp_seg *seg)
Definition: tcp.h:217
Definition: tcp.h:212
u8_t prio
Definition: tcp.h:223
u16_t mss
Definition: tcp.h:249
void tcp_setprio(struct tcp_pcb *pcb, u8_t prio)
void tcp_timer_needed(void)
Definition: network.c:186
u32 u32_t
Definition: cc.h:47
void tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb)
void tcp_rst(u32_t seqno, u32_t ackno, struct ip_addr *local_ip, struct ip_addr *remote_ip, u16_t local_port, u16_t remote_port)
struct tcp_hdr * tcphdr
Definition: tcp.h:396
tcp_state
Definition: tcp.h:202
Definition: tcp.h:208
void tcp_recved(struct tcp_pcb *pcb, u16_t len)
u16_t local_port
Definition: tcp.h:226
u16_t cwnd
Definition: tcp.h:264
Definition: tcp.h:211
void tcp_arg(struct tcp_pcb *pcb, void *arg)
IP_PCB
Definition: tcp.h:219
u32_t lastack
Definition: tcp.h:260
void tcp_keepalive(struct tcp_pcb *pcb)
GLbitfield flags
Definition: glext.h:7828
u16_t rtime
Definition: tcp.h:247
u8_t flags
Definition: tcp.h:229
struct tcp_pcb * tcp_input_pcb
void tcp_fasttmr(void)
Definition: tcp.h:203
Definition: tcp.h:391
void tcp_sent(struct tcp_pcb *pcb, err_t(*sent)(void *arg, struct tcp_pcb *tpcb, u16_t len))
struct tcp_seg * tcp_seg_copy(struct tcp_seg *seg)
u16 u16_t
Definition: cc.h:45
u32_t snd_nxt
Definition: tcp.h:268
struct tcp_seg * unsent
Definition: tcp.h:282
Definition: pbuf.h:66
err_t tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port, err_t(*connected)(void *arg, struct tcp_pcb *tpcb, err_t err))
Definition: tcp.h:174