The Pedigree Project  0.1
tcp_priv.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
25 /*
26  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
27  * All rights reserved.
28  *
29  * Redistribution and use in source and binary forms, with or without modification,
30  * are permitted provided that the following conditions are met:
31  *
32  * 1. Redistributions of source code must retain the above copyright notice,
33  * this list of conditions and the following disclaimer.
34  * 2. Redistributions in binary form must reproduce the above copyright notice,
35  * this list of conditions and the following disclaimer in the documentation
36  * and/or other materials provided with the distribution.
37  * 3. The name of the author may not be used to endorse or promote products
38  * derived from this software without specific prior written permission.
39  *
40  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
41  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
42  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
43  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
44  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
45  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
46  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
47  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
48  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
49  * OF SUCH DAMAGE.
50  *
51  * This file is part of the lwIP TCP/IP stack.
52  *
53  * Author: Adam Dunkels <adam@sics.se>
54  *
55  */
56 #ifndef LWIP_HDR_TCP_PRIV_H
57 #define LWIP_HDR_TCP_PRIV_H
58 
59 #include "lwip/opt.h"
60 
61 #if LWIP_TCP /* don't build if not configured for use in lwipopts.h */
62 
63 #include "lwip/tcp.h"
64 #include "lwip/mem.h"
65 #include "lwip/pbuf.h"
66 #include "lwip/ip.h"
67 #include "lwip/icmp.h"
68 #include "lwip/err.h"
69 #include "lwip/ip6.h"
70 #include "lwip/ip6_addr.h"
71 #include "lwip/prot/tcp.h"
72 
73 #ifdef __cplusplus
74 extern "C" {
75 #endif
76 
77 /* Functions for interfacing with TCP: */
78 
79 /* Lower layer interface to TCP: */
80 void tcp_init (void); /* Initialize this module. */
81 void tcp_tmr (void); /* Must be called every
82  TCP_TMR_INTERVAL
83  ms. (Typically 250 ms). */
84 /* It is also possible to call these two functions at the right
85  intervals (instead of calling tcp_tmr()). */
86 void tcp_slowtmr (void);
87 void tcp_fasttmr (void);
88 
89 /* Call this from a netif driver (watch out for threading issues!) that has
90  returned a memory error on transmit and now has free buffers to send more.
91  This iterates all active pcbs that had an error and tries to call
92  tcp_output, so use this with care as it might slow down the system. */
93 void tcp_txnow (void);
94 
95 /* Only used by IP to pass a TCP segment to TCP: */
96 void tcp_input (struct pbuf *p, struct netif *inp);
97 /* Used within the TCP code only: */
98 struct tcp_pcb * tcp_alloc (u8_t prio);
99 void tcp_abandon (struct tcp_pcb *pcb, int reset);
100 err_t tcp_send_empty_ack(struct tcp_pcb *pcb);
101 void tcp_rexmit (struct tcp_pcb *pcb);
102 void tcp_rexmit_rto (struct tcp_pcb *pcb);
103 void tcp_rexmit_fast (struct tcp_pcb *pcb);
104 u32_t tcp_update_rcv_ann_wnd(struct tcp_pcb *pcb);
105 err_t tcp_process_refused_data(struct tcp_pcb *pcb);
106 
116 #define tcp_do_output_nagle(tpcb) ((((tpcb)->unacked == NULL) || \
117  ((tpcb)->flags & (TF_NODELAY | TF_INFR)) || \
118  (((tpcb)->unsent != NULL) && (((tpcb)->unsent->next != NULL) || \
119  ((tpcb)->unsent->len >= (tpcb)->mss))) || \
120  ((tcp_sndbuf(tpcb) == 0) || (tcp_sndqueuelen(tpcb) >= TCP_SND_QUEUELEN)) \
121  ) ? 1 : 0)
122 #define tcp_output_nagle(tpcb) (tcp_do_output_nagle(tpcb) ? tcp_output(tpcb) : ERR_OK)
123 
124 
125 #define TCP_SEQ_LT(a,b) ((s32_t)((u32_t)(a) - (u32_t)(b)) < 0)
126 #define TCP_SEQ_LEQ(a,b) ((s32_t)((u32_t)(a) - (u32_t)(b)) <= 0)
127 #define TCP_SEQ_GT(a,b) ((s32_t)((u32_t)(a) - (u32_t)(b)) > 0)
128 #define TCP_SEQ_GEQ(a,b) ((s32_t)((u32_t)(a) - (u32_t)(b)) >= 0)
129 /* is b<=a<=c? */
130 #if 0 /* see bug #10548 */
131 #define TCP_SEQ_BETWEEN(a,b,c) ((c)-(b) >= (a)-(b))
132 #endif
133 #define TCP_SEQ_BETWEEN(a,b,c) (TCP_SEQ_GEQ(a,b) && TCP_SEQ_LEQ(a,c))
134 
135 #ifndef TCP_TMR_INTERVAL
136 #define TCP_TMR_INTERVAL 250 /* The TCP timer interval in milliseconds. */
137 #endif /* TCP_TMR_INTERVAL */
138 
139 #ifndef TCP_FAST_INTERVAL
140 #define TCP_FAST_INTERVAL TCP_TMR_INTERVAL /* the fine grained timeout in milliseconds */
141 #endif /* TCP_FAST_INTERVAL */
142 
143 #ifndef TCP_SLOW_INTERVAL
144 #define TCP_SLOW_INTERVAL (2*TCP_TMR_INTERVAL) /* the coarse grained timeout in milliseconds */
145 #endif /* TCP_SLOW_INTERVAL */
146 
147 #define TCP_FIN_WAIT_TIMEOUT 20000 /* milliseconds */
148 #define TCP_SYN_RCVD_TIMEOUT 20000 /* milliseconds */
149 
150 #define TCP_OOSEQ_TIMEOUT 6U /* x RTO */
151 
152 #ifndef TCP_MSL
153 #define TCP_MSL 60000UL /* The maximum segment lifetime in milliseconds */
154 #endif
155 
156 /* Keepalive values, compliant with RFC 1122. Don't change this unless you know what you're doing */
157 #ifndef TCP_KEEPIDLE_DEFAULT
158 #define TCP_KEEPIDLE_DEFAULT 7200000UL /* Default KEEPALIVE timer in milliseconds */
159 #endif
160 
161 #ifndef TCP_KEEPINTVL_DEFAULT
162 #define TCP_KEEPINTVL_DEFAULT 75000UL /* Default Time between KEEPALIVE probes in milliseconds */
163 #endif
164 
165 #ifndef TCP_KEEPCNT_DEFAULT
166 #define TCP_KEEPCNT_DEFAULT 9U /* Default Counter for KEEPALIVE probes */
167 #endif
168 
169 #define TCP_MAXIDLE TCP_KEEPCNT_DEFAULT * TCP_KEEPINTVL_DEFAULT /* Maximum KEEPALIVE probe time */
170 
171 #define TCP_TCPLEN(seg) ((seg)->len + (((TCPH_FLAGS((seg)->tcphdr) & (TCP_FIN | TCP_SYN)) != 0) ? 1U : 0U))
172 
175 #define TF_RESET (u8_t)0x08U /* Connection was reset. */
176 #define TF_CLOSED (u8_t)0x10U /* Connection was successfully closed. */
177 #define TF_GOT_FIN (u8_t)0x20U /* Connection was closed by the remote end. */
178 
179 
180 #if LWIP_EVENT_API
181 
182 #define TCP_EVENT_ACCEPT(lpcb,pcb,arg,err,ret) ret = lwip_tcp_event(arg, (pcb),\
183  LWIP_EVENT_ACCEPT, NULL, 0, err)
184 #define TCP_EVENT_SENT(pcb,space,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
185  LWIP_EVENT_SENT, NULL, space, ERR_OK)
186 #define TCP_EVENT_RECV(pcb,p,err,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
187  LWIP_EVENT_RECV, (p), 0, (err))
188 #define TCP_EVENT_CLOSED(pcb,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
189  LWIP_EVENT_RECV, NULL, 0, ERR_OK)
190 #define TCP_EVENT_CONNECTED(pcb,err,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
191  LWIP_EVENT_CONNECTED, NULL, 0, (err))
192 #define TCP_EVENT_POLL(pcb,ret) do { if ((pcb)->state != SYN_RCVD) { \
193  ret = lwip_tcp_event((pcb)->callback_arg, (pcb), LWIP_EVENT_POLL, NULL, 0, ERR_OK); \
194  } else { \
195  ret = ERR_ARG; } } while(0)
196 #define TCP_EVENT_ERR(last_state,errf,arg,err) do { if (last_state != SYN_RCVD) { \
197  lwip_tcp_event((arg), NULL, LWIP_EVENT_ERR, NULL, 0, (err)); } } while(0)
198 
199 #else /* LWIP_EVENT_API */
200 
201 #define TCP_EVENT_ACCEPT(lpcb,pcb,arg,err,ret) \
202  do { \
203  if((lpcb)->accept != NULL) \
204  (ret) = (lpcb)->accept((arg),(pcb),(err)); \
205  else (ret) = ERR_ARG; \
206  } while (0)
207 
208 #define TCP_EVENT_SENT(pcb,space,ret) \
209  do { \
210  if((pcb)->sent != NULL) \
211  (ret) = (pcb)->sent((pcb)->callback_arg,(pcb),(space)); \
212  else (ret) = ERR_OK; \
213  } while (0)
214 
215 #define TCP_EVENT_RECV(pcb,p,err,ret) \
216  do { \
217  if((pcb)->recv != NULL) { \
218  (ret) = (pcb)->recv((pcb)->callback_arg,(pcb),(p),(err));\
219  } else { \
220  (ret) = tcp_recv_null(NULL, (pcb), (p), (err)); \
221  } \
222  } while (0)
223 
224 #define TCP_EVENT_CLOSED(pcb,ret) \
225  do { \
226  if(((pcb)->recv != NULL)) { \
227  (ret) = (pcb)->recv((pcb)->callback_arg,(pcb),NULL,ERR_OK);\
228  } else { \
229  (ret) = ERR_OK; \
230  } \
231  } while (0)
232 
233 #define TCP_EVENT_CONNECTED(pcb,err,ret) \
234  do { \
235  if((pcb)->connected != NULL) \
236  (ret) = (pcb)->connected((pcb)->callback_arg,(pcb),(err)); \
237  else (ret) = ERR_OK; \
238  } while (0)
239 
240 #define TCP_EVENT_POLL(pcb,ret) \
241  do { \
242  if((pcb)->poll != NULL) \
243  (ret) = (pcb)->poll((pcb)->callback_arg,(pcb)); \
244  else (ret) = ERR_OK; \
245  } while (0)
246 
247 #define TCP_EVENT_ERR(last_state,errf,arg,err) \
248  do { \
249  LWIP_UNUSED_ARG(last_state); \
250  if((errf) != NULL) \
251  (errf)((arg),(err)); \
252  } while (0)
253 
254 #endif /* LWIP_EVENT_API */
255 
257 #if TCP_OVERSIZE && defined(LWIP_DEBUG)
258 #define TCP_OVERSIZE_DBGCHECK 1
259 #else
260 #define TCP_OVERSIZE_DBGCHECK 0
261 #endif
262 
264 #define TCP_CHECKSUM_ON_COPY (LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_TCP)
265 
266 /* This structure represents a TCP segment on the unsent, unacked and ooseq queues */
267 struct tcp_seg {
268  struct tcp_seg *next; /* used when putting segments on a queue */
269  struct pbuf *p; /* buffer containing data + TCP header */
270  u16_t len; /* the TCP length of this segment */
271 #if TCP_OVERSIZE_DBGCHECK
272  u16_t oversize_left; /* Extra bytes available at the end of the last
273  pbuf in unsent (used for asserting vs.
274  tcp_pcb.unsent_oversize only) */
275 #endif /* TCP_OVERSIZE_DBGCHECK */
276 #if TCP_CHECKSUM_ON_COPY
277  u16_t chksum;
278  u8_t chksum_swapped;
279 #endif /* TCP_CHECKSUM_ON_COPY */
280  u8_t flags;
281 #define TF_SEG_OPTS_MSS (u8_t)0x01U /* Include MSS option. */
282 #define TF_SEG_OPTS_TS (u8_t)0x02U /* Include timestamp option. */
283 #define TF_SEG_DATA_CHECKSUMMED (u8_t)0x04U /* ALL data (not the header) is
284  checksummed into 'chksum' */
285 #define TF_SEG_OPTS_WND_SCALE (u8_t)0x08U /* Include WND SCALE option */
286  struct tcp_hdr *tcphdr; /* the TCP header */
287 };
288 
289 #define LWIP_TCP_OPT_EOL 0
290 #define LWIP_TCP_OPT_NOP 1
291 #define LWIP_TCP_OPT_MSS 2
292 #define LWIP_TCP_OPT_WS 3
293 #define LWIP_TCP_OPT_TS 8
294 
295 #define LWIP_TCP_OPT_LEN_MSS 4
296 #if LWIP_TCP_TIMESTAMPS
297 #define LWIP_TCP_OPT_LEN_TS 10
298 #define LWIP_TCP_OPT_LEN_TS_OUT 12 /* aligned for output (includes NOP padding) */
299 #else
300 #define LWIP_TCP_OPT_LEN_TS_OUT 0
301 #endif
302 #if LWIP_WND_SCALE
303 #define LWIP_TCP_OPT_LEN_WS 3
304 #define LWIP_TCP_OPT_LEN_WS_OUT 4 /* aligned for output (includes NOP padding) */
305 #else
306 #define LWIP_TCP_OPT_LEN_WS_OUT 0
307 #endif
308 
309 #define LWIP_TCP_OPT_LENGTH(flags) \
310  (flags & TF_SEG_OPTS_MSS ? LWIP_TCP_OPT_LEN_MSS : 0) + \
311  (flags & TF_SEG_OPTS_TS ? LWIP_TCP_OPT_LEN_TS_OUT : 0) + \
312  (flags & TF_SEG_OPTS_WND_SCALE ? LWIP_TCP_OPT_LEN_WS_OUT : 0)
313 
315 #define TCP_BUILD_MSS_OPTION(mss) lwip_htonl(0x02040000 | ((mss) & 0xFFFF))
316 
317 #if LWIP_WND_SCALE
318 #define TCPWNDSIZE_F U32_F
319 #define TCPWND_MAX 0xFFFFFFFFU
320 #define TCPWND_CHECK16(x) LWIP_ASSERT("window size > 0xFFFF", (x) <= 0xFFFF)
321 #define TCPWND_MIN16(x) ((u16_t)LWIP_MIN((x), 0xFFFF))
322 #else /* LWIP_WND_SCALE */
323 #define TCPWNDSIZE_F U16_F
324 #define TCPWND_MAX 0xFFFFU
325 #define TCPWND_CHECK16(x)
326 #define TCPWND_MIN16(x) x
327 #endif /* LWIP_WND_SCALE */
328 
329 /* Global variables: */
330 extern struct tcp_pcb *tcp_input_pcb;
331 extern u32_t tcp_ticks;
332 extern u8_t tcp_active_pcbs_changed;
333 
334 /* The TCP PCB lists. */
335 union tcp_listen_pcbs_t { /* List of all TCP PCBs in LISTEN state. */
336  struct tcp_pcb_listen *listen_pcbs;
337  struct tcp_pcb *pcbs;
338 };
339 extern struct tcp_pcb *tcp_bound_pcbs;
340 extern union tcp_listen_pcbs_t tcp_listen_pcbs;
341 extern struct tcp_pcb *tcp_active_pcbs; /* List of all TCP PCBs that are in a
342  state in which they accept or send
343  data. */
344 extern struct tcp_pcb *tcp_tw_pcbs; /* List of all TCP PCBs in TIME-WAIT. */
345 
346 #define NUM_TCP_PCB_LISTS_NO_TIME_WAIT 3
347 #define NUM_TCP_PCB_LISTS 4
348 extern struct tcp_pcb ** const tcp_pcb_lists[NUM_TCP_PCB_LISTS];
349 
350 /* Axioms about the above lists:
351  1) Every TCP PCB that is not CLOSED is in one of the lists.
352  2) A PCB is only in one of the lists.
353  3) All PCBs in the tcp_listen_pcbs list is in LISTEN state.
354  4) All PCBs in the tcp_tw_pcbs list is in TIME-WAIT state.
355 */
356 /* Define two macros, TCP_REG and TCP_RMV that registers a TCP PCB
357  with a PCB list or removes a PCB from a list, respectively. */
358 #ifndef TCP_DEBUG_PCB_LISTS
359 #define TCP_DEBUG_PCB_LISTS 0
360 #endif
361 #if TCP_DEBUG_PCB_LISTS
362 #define TCP_REG(pcbs, npcb) do {\
363  struct tcp_pcb *tcp_tmp_pcb; \
364  LWIP_DEBUGF(TCP_DEBUG, ("TCP_REG %p local port %d\n", (npcb), (npcb)->local_port)); \
365  for (tcp_tmp_pcb = *(pcbs); \
366  tcp_tmp_pcb != NULL; \
367  tcp_tmp_pcb = tcp_tmp_pcb->next) { \
368  LWIP_ASSERT("TCP_REG: already registered\n", tcp_tmp_pcb != (npcb)); \
369  } \
370  LWIP_ASSERT("TCP_REG: pcb->state != CLOSED", ((pcbs) == &tcp_bound_pcbs) || ((npcb)->state != CLOSED)); \
371  (npcb)->next = *(pcbs); \
372  LWIP_ASSERT("TCP_REG: npcb->next != npcb", (npcb)->next != (npcb)); \
373  *(pcbs) = (npcb); \
374  LWIP_ASSERT("TCP_RMV: tcp_pcbs sane", tcp_pcbs_sane()); \
375  tcp_timer_needed(); \
376  } while(0)
377 #define TCP_RMV(pcbs, npcb) do { \
378  struct tcp_pcb *tcp_tmp_pcb; \
379  LWIP_ASSERT("TCP_RMV: pcbs != NULL", *(pcbs) != NULL); \
380  LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removing %p from %p\n", (npcb), *(pcbs))); \
381  if(*(pcbs) == (npcb)) { \
382  *(pcbs) = (*pcbs)->next; \
383  } else for (tcp_tmp_pcb = *(pcbs); tcp_tmp_pcb != NULL; tcp_tmp_pcb = tcp_tmp_pcb->next) { \
384  if(tcp_tmp_pcb->next == (npcb)) { \
385  tcp_tmp_pcb->next = (npcb)->next; \
386  break; \
387  } \
388  } \
389  (npcb)->next = NULL; \
390  LWIP_ASSERT("TCP_RMV: tcp_pcbs sane", tcp_pcbs_sane()); \
391  LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removed %p from %p\n", (npcb), *(pcbs))); \
392  } while(0)
393 
394 #else /* LWIP_DEBUG */
395 
396 #define TCP_REG(pcbs, npcb) \
397  do { \
398  (npcb)->next = *pcbs; \
399  *(pcbs) = (npcb); \
400  tcp_timer_needed(); \
401  } while (0)
402 
403 #define TCP_RMV(pcbs, npcb) \
404  do { \
405  if(*(pcbs) == (npcb)) { \
406  (*(pcbs)) = (*pcbs)->next; \
407  } \
408  else { \
409  struct tcp_pcb *tcp_tmp_pcb; \
410  for (tcp_tmp_pcb = *pcbs; \
411  tcp_tmp_pcb != NULL; \
412  tcp_tmp_pcb = tcp_tmp_pcb->next) { \
413  if(tcp_tmp_pcb->next == (npcb)) { \
414  tcp_tmp_pcb->next = (npcb)->next; \
415  break; \
416  } \
417  } \
418  } \
419  (npcb)->next = NULL; \
420  } while(0)
421 
422 #endif /* LWIP_DEBUG */
423 
424 #define TCP_REG_ACTIVE(npcb) \
425  do { \
426  TCP_REG(&tcp_active_pcbs, npcb); \
427  tcp_active_pcbs_changed = 1; \
428  } while (0)
429 
430 #define TCP_RMV_ACTIVE(npcb) \
431  do { \
432  TCP_RMV(&tcp_active_pcbs, npcb); \
433  tcp_active_pcbs_changed = 1; \
434  } while (0)
435 
436 #define TCP_PCB_REMOVE_ACTIVE(pcb) \
437  do { \
438  tcp_pcb_remove(&tcp_active_pcbs, pcb); \
439  tcp_active_pcbs_changed = 1; \
440  } while (0)
441 
442 
443 /* Internal functions: */
444 struct tcp_pcb *tcp_pcb_copy(struct tcp_pcb *pcb);
445 void tcp_pcb_purge(struct tcp_pcb *pcb);
446 void tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb);
447 
448 void tcp_segs_free(struct tcp_seg *seg);
449 void tcp_seg_free(struct tcp_seg *seg);
450 struct tcp_seg *tcp_seg_copy(struct tcp_seg *seg);
451 
452 #define tcp_ack(pcb) \
453  do { \
454  if((pcb)->flags & TF_ACK_DELAY) { \
455  (pcb)->flags &= ~TF_ACK_DELAY; \
456  (pcb)->flags |= TF_ACK_NOW; \
457  } \
458  else { \
459  (pcb)->flags |= TF_ACK_DELAY; \
460  } \
461  } while (0)
462 
463 #define tcp_ack_now(pcb) \
464  do { \
465  (pcb)->flags |= TF_ACK_NOW; \
466  } while (0)
467 
468 err_t tcp_send_fin(struct tcp_pcb *pcb);
469 err_t tcp_enqueue_flags(struct tcp_pcb *pcb, u8_t flags);
470 
471 void tcp_rexmit_seg(struct tcp_pcb *pcb, struct tcp_seg *seg);
472 
473 void tcp_rst(u32_t seqno, u32_t ackno,
474  const ip_addr_t *local_ip, const ip_addr_t *remote_ip,
475  u16_t local_port, u16_t remote_port);
476 
477 u32_t tcp_next_iss(struct tcp_pcb *pcb);
478 
479 err_t tcp_keepalive(struct tcp_pcb *pcb);
480 err_t tcp_zero_window_probe(struct tcp_pcb *pcb);
481 void tcp_trigger_input_pcb_close(void);
482 
483 #if TCP_CALCULATE_EFF_SEND_MSS
484 u16_t tcp_eff_send_mss_impl(u16_t sendmss, const ip_addr_t *dest
485 #if LWIP_IPV6 || LWIP_IPV4_SRC_ROUTING
486  , const ip_addr_t *src
487 #endif /* LWIP_IPV6 || LWIP_IPV4_SRC_ROUTING */
488  );
489 #if LWIP_IPV6 || LWIP_IPV4_SRC_ROUTING
490 #define tcp_eff_send_mss(sendmss, src, dest) tcp_eff_send_mss_impl(sendmss, dest, src)
491 #else /* LWIP_IPV6 || LWIP_IPV4_SRC_ROUTING */
492 #define tcp_eff_send_mss(sendmss, src, dest) tcp_eff_send_mss_impl(sendmss, dest)
493 #endif /* LWIP_IPV6 || LWIP_IPV4_SRC_ROUTING */
494 #endif /* TCP_CALCULATE_EFF_SEND_MSS */
495 
496 #if LWIP_CALLBACK_API
497 err_t tcp_recv_null(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err);
498 #endif /* LWIP_CALLBACK_API */
499 
500 #if TCP_DEBUG || TCP_INPUT_DEBUG || TCP_OUTPUT_DEBUG
501 void tcp_debug_print(struct tcp_hdr *tcphdr);
502 void tcp_debug_print_flags(u8_t flags);
503 void tcp_debug_print_state(enum tcp_state s);
504 void tcp_debug_print_pcbs(void);
505 s16_t tcp_pcbs_sane(void);
506 #else
507 # define tcp_debug_print(tcphdr)
508 # define tcp_debug_print_flags(flags)
509 # define tcp_debug_print_state(s)
510 # define tcp_debug_print_pcbs()
511 # define tcp_pcbs_sane() 1
512 #endif /* TCP_DEBUG */
513 
516 void tcp_timer_needed(void);
517 
518 void tcp_netif_ip_addr_changed(const ip_addr_t* old_addr, const ip_addr_t* new_addr);
519 
520 #ifdef __cplusplus
521 }
522 #endif
523 
524 #endif /* LWIP_TCP */
525 
526 #endif /* LWIP_HDR_TCP_PRIV_H */
u16_t len
Definition: pbuf.h:178
u8_t flags
Definition: pbuf.h:184
Definition: pbuf.h:161
Definition: netif.h:244
s8_t err_t
Definition: err.h:76