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