Integrating the ublox LISA C200 modem
Fork of SprintUSBModemHTTPClientTest by
SprintUSBModem/lwip/include/lwip/tcp_impl.h@5:3f93dd1d4cb3, 2013-09-26 (annotated)
- Committer:
- sam_grove
- Date:
- Thu Sep 26 00:44:20 2013 -0500
- Revision:
- 5:3f93dd1d4cb3
Exported program and replaced contents of the repo with the source
to build and debug using keil mdk. Libs NOT upto date are lwip, lwip-sys
and socket. these have newer versions under mbed_official but were starting
from a know working point
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sam_grove | 5:3f93dd1d4cb3 | 1 | /* |
sam_grove | 5:3f93dd1d4cb3 | 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. |
sam_grove | 5:3f93dd1d4cb3 | 3 | * All rights reserved. |
sam_grove | 5:3f93dd1d4cb3 | 4 | * |
sam_grove | 5:3f93dd1d4cb3 | 5 | * Redistribution and use in source and binary forms, with or without modification, |
sam_grove | 5:3f93dd1d4cb3 | 6 | * are permitted provided that the following conditions are met: |
sam_grove | 5:3f93dd1d4cb3 | 7 | * |
sam_grove | 5:3f93dd1d4cb3 | 8 | * 1. Redistributions of source code must retain the above copyright notice, |
sam_grove | 5:3f93dd1d4cb3 | 9 | * this list of conditions and the following disclaimer. |
sam_grove | 5:3f93dd1d4cb3 | 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
sam_grove | 5:3f93dd1d4cb3 | 11 | * this list of conditions and the following disclaimer in the documentation |
sam_grove | 5:3f93dd1d4cb3 | 12 | * and/or other materials provided with the distribution. |
sam_grove | 5:3f93dd1d4cb3 | 13 | * 3. The name of the author may not be used to endorse or promote products |
sam_grove | 5:3f93dd1d4cb3 | 14 | * derived from this software without specific prior written permission. |
sam_grove | 5:3f93dd1d4cb3 | 15 | * |
sam_grove | 5:3f93dd1d4cb3 | 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
sam_grove | 5:3f93dd1d4cb3 | 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
sam_grove | 5:3f93dd1d4cb3 | 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
sam_grove | 5:3f93dd1d4cb3 | 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
sam_grove | 5:3f93dd1d4cb3 | 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
sam_grove | 5:3f93dd1d4cb3 | 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
sam_grove | 5:3f93dd1d4cb3 | 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
sam_grove | 5:3f93dd1d4cb3 | 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
sam_grove | 5:3f93dd1d4cb3 | 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY |
sam_grove | 5:3f93dd1d4cb3 | 25 | * OF SUCH DAMAGE. |
sam_grove | 5:3f93dd1d4cb3 | 26 | * |
sam_grove | 5:3f93dd1d4cb3 | 27 | * This file is part of the lwIP TCP/IP stack. |
sam_grove | 5:3f93dd1d4cb3 | 28 | * |
sam_grove | 5:3f93dd1d4cb3 | 29 | * Author: Adam Dunkels <adam@sics.se> |
sam_grove | 5:3f93dd1d4cb3 | 30 | * |
sam_grove | 5:3f93dd1d4cb3 | 31 | */ |
sam_grove | 5:3f93dd1d4cb3 | 32 | #ifndef __LWIP_TCP_IMPL_H__ |
sam_grove | 5:3f93dd1d4cb3 | 33 | #define __LWIP_TCP_IMPL_H__ |
sam_grove | 5:3f93dd1d4cb3 | 34 | |
sam_grove | 5:3f93dd1d4cb3 | 35 | #include "lwip/opt.h" |
sam_grove | 5:3f93dd1d4cb3 | 36 | |
sam_grove | 5:3f93dd1d4cb3 | 37 | #if LWIP_TCP /* don't build if not configured for use in lwipopts.h */ |
sam_grove | 5:3f93dd1d4cb3 | 38 | |
sam_grove | 5:3f93dd1d4cb3 | 39 | #include "lwip/tcp.h" |
sam_grove | 5:3f93dd1d4cb3 | 40 | #include "lwip/sys.h" |
sam_grove | 5:3f93dd1d4cb3 | 41 | #include "lwip/mem.h" |
sam_grove | 5:3f93dd1d4cb3 | 42 | #include "lwip/pbuf.h" |
sam_grove | 5:3f93dd1d4cb3 | 43 | #include "lwip/ip.h" |
sam_grove | 5:3f93dd1d4cb3 | 44 | #include "lwip/icmp.h" |
sam_grove | 5:3f93dd1d4cb3 | 45 | #include "lwip/err.h" |
sam_grove | 5:3f93dd1d4cb3 | 46 | |
sam_grove | 5:3f93dd1d4cb3 | 47 | #ifdef __cplusplus |
sam_grove | 5:3f93dd1d4cb3 | 48 | extern "C" { |
sam_grove | 5:3f93dd1d4cb3 | 49 | #endif |
sam_grove | 5:3f93dd1d4cb3 | 50 | |
sam_grove | 5:3f93dd1d4cb3 | 51 | /* Functions for interfacing with TCP: */ |
sam_grove | 5:3f93dd1d4cb3 | 52 | |
sam_grove | 5:3f93dd1d4cb3 | 53 | /* Lower layer interface to TCP: */ |
sam_grove | 5:3f93dd1d4cb3 | 54 | #define tcp_init() /* Compatibility define, no init needed. */ |
sam_grove | 5:3f93dd1d4cb3 | 55 | void tcp_tmr (void); /* Must be called every |
sam_grove | 5:3f93dd1d4cb3 | 56 | TCP_TMR_INTERVAL |
sam_grove | 5:3f93dd1d4cb3 | 57 | ms. (Typically 250 ms). */ |
sam_grove | 5:3f93dd1d4cb3 | 58 | /* It is also possible to call these two functions at the right |
sam_grove | 5:3f93dd1d4cb3 | 59 | intervals (instead of calling tcp_tmr()). */ |
sam_grove | 5:3f93dd1d4cb3 | 60 | void tcp_slowtmr (void); |
sam_grove | 5:3f93dd1d4cb3 | 61 | void tcp_fasttmr (void); |
sam_grove | 5:3f93dd1d4cb3 | 62 | |
sam_grove | 5:3f93dd1d4cb3 | 63 | |
sam_grove | 5:3f93dd1d4cb3 | 64 | /* Only used by IP to pass a TCP segment to TCP: */ |
sam_grove | 5:3f93dd1d4cb3 | 65 | void tcp_input (struct pbuf *p, struct netif *inp); |
sam_grove | 5:3f93dd1d4cb3 | 66 | /* Used within the TCP code only: */ |
sam_grove | 5:3f93dd1d4cb3 | 67 | struct tcp_pcb * tcp_alloc (u8_t prio); |
sam_grove | 5:3f93dd1d4cb3 | 68 | void tcp_abandon (struct tcp_pcb *pcb, int reset); |
sam_grove | 5:3f93dd1d4cb3 | 69 | err_t tcp_send_empty_ack(struct tcp_pcb *pcb); |
sam_grove | 5:3f93dd1d4cb3 | 70 | void tcp_rexmit (struct tcp_pcb *pcb); |
sam_grove | 5:3f93dd1d4cb3 | 71 | void tcp_rexmit_rto (struct tcp_pcb *pcb); |
sam_grove | 5:3f93dd1d4cb3 | 72 | void tcp_rexmit_fast (struct tcp_pcb *pcb); |
sam_grove | 5:3f93dd1d4cb3 | 73 | u32_t tcp_update_rcv_ann_wnd(struct tcp_pcb *pcb); |
sam_grove | 5:3f93dd1d4cb3 | 74 | |
sam_grove | 5:3f93dd1d4cb3 | 75 | /** |
sam_grove | 5:3f93dd1d4cb3 | 76 | * This is the Nagle algorithm: try to combine user data to send as few TCP |
sam_grove | 5:3f93dd1d4cb3 | 77 | * segments as possible. Only send if |
sam_grove | 5:3f93dd1d4cb3 | 78 | * - no previously transmitted data on the connection remains unacknowledged or |
sam_grove | 5:3f93dd1d4cb3 | 79 | * - the TF_NODELAY flag is set (nagle algorithm turned off for this pcb) or |
sam_grove | 5:3f93dd1d4cb3 | 80 | * - the only unsent segment is at least pcb->mss bytes long (or there is more |
sam_grove | 5:3f93dd1d4cb3 | 81 | * than one unsent segment - with lwIP, this can happen although unsent->len < mss) |
sam_grove | 5:3f93dd1d4cb3 | 82 | * - or if we are in fast-retransmit (TF_INFR) |
sam_grove | 5:3f93dd1d4cb3 | 83 | */ |
sam_grove | 5:3f93dd1d4cb3 | 84 | #define tcp_do_output_nagle(tpcb) ((((tpcb)->unacked == NULL) || \ |
sam_grove | 5:3f93dd1d4cb3 | 85 | ((tpcb)->flags & (TF_NODELAY | TF_INFR)) || \ |
sam_grove | 5:3f93dd1d4cb3 | 86 | (((tpcb)->unsent != NULL) && (((tpcb)->unsent->next != NULL) || \ |
sam_grove | 5:3f93dd1d4cb3 | 87 | ((tpcb)->unsent->len >= (tpcb)->mss))) \ |
sam_grove | 5:3f93dd1d4cb3 | 88 | ) ? 1 : 0) |
sam_grove | 5:3f93dd1d4cb3 | 89 | #define tcp_output_nagle(tpcb) (tcp_do_output_nagle(tpcb) ? tcp_output(tpcb) : ERR_OK) |
sam_grove | 5:3f93dd1d4cb3 | 90 | |
sam_grove | 5:3f93dd1d4cb3 | 91 | |
sam_grove | 5:3f93dd1d4cb3 | 92 | #define TCP_SEQ_LT(a,b) ((s32_t)((a)-(b)) < 0) |
sam_grove | 5:3f93dd1d4cb3 | 93 | #define TCP_SEQ_LEQ(a,b) ((s32_t)((a)-(b)) <= 0) |
sam_grove | 5:3f93dd1d4cb3 | 94 | #define TCP_SEQ_GT(a,b) ((s32_t)((a)-(b)) > 0) |
sam_grove | 5:3f93dd1d4cb3 | 95 | #define TCP_SEQ_GEQ(a,b) ((s32_t)((a)-(b)) >= 0) |
sam_grove | 5:3f93dd1d4cb3 | 96 | /* is b<=a<=c? */ |
sam_grove | 5:3f93dd1d4cb3 | 97 | #if 0 /* see bug #10548 */ |
sam_grove | 5:3f93dd1d4cb3 | 98 | #define TCP_SEQ_BETWEEN(a,b,c) ((c)-(b) >= (a)-(b)) |
sam_grove | 5:3f93dd1d4cb3 | 99 | #endif |
sam_grove | 5:3f93dd1d4cb3 | 100 | #define TCP_SEQ_BETWEEN(a,b,c) (TCP_SEQ_GEQ(a,b) && TCP_SEQ_LEQ(a,c)) |
sam_grove | 5:3f93dd1d4cb3 | 101 | #define TCP_FIN 0x01U |
sam_grove | 5:3f93dd1d4cb3 | 102 | #define TCP_SYN 0x02U |
sam_grove | 5:3f93dd1d4cb3 | 103 | #define TCP_RST 0x04U |
sam_grove | 5:3f93dd1d4cb3 | 104 | #define TCP_PSH 0x08U |
sam_grove | 5:3f93dd1d4cb3 | 105 | #define TCP_ACK 0x10U |
sam_grove | 5:3f93dd1d4cb3 | 106 | #define TCP_URG 0x20U |
sam_grove | 5:3f93dd1d4cb3 | 107 | #define TCP_ECE 0x40U |
sam_grove | 5:3f93dd1d4cb3 | 108 | #define TCP_CWR 0x80U |
sam_grove | 5:3f93dd1d4cb3 | 109 | |
sam_grove | 5:3f93dd1d4cb3 | 110 | #define TCP_FLAGS 0x3fU |
sam_grove | 5:3f93dd1d4cb3 | 111 | |
sam_grove | 5:3f93dd1d4cb3 | 112 | /* Length of the TCP header, excluding options. */ |
sam_grove | 5:3f93dd1d4cb3 | 113 | #define TCP_HLEN 20 |
sam_grove | 5:3f93dd1d4cb3 | 114 | |
sam_grove | 5:3f93dd1d4cb3 | 115 | #ifndef TCP_TMR_INTERVAL |
sam_grove | 5:3f93dd1d4cb3 | 116 | #define TCP_TMR_INTERVAL 250 /* The TCP timer interval in milliseconds. */ |
sam_grove | 5:3f93dd1d4cb3 | 117 | #endif /* TCP_TMR_INTERVAL */ |
sam_grove | 5:3f93dd1d4cb3 | 118 | |
sam_grove | 5:3f93dd1d4cb3 | 119 | #ifndef TCP_FAST_INTERVAL |
sam_grove | 5:3f93dd1d4cb3 | 120 | #define TCP_FAST_INTERVAL TCP_TMR_INTERVAL /* the fine grained timeout in milliseconds */ |
sam_grove | 5:3f93dd1d4cb3 | 121 | #endif /* TCP_FAST_INTERVAL */ |
sam_grove | 5:3f93dd1d4cb3 | 122 | |
sam_grove | 5:3f93dd1d4cb3 | 123 | #ifndef TCP_SLOW_INTERVAL |
sam_grove | 5:3f93dd1d4cb3 | 124 | #define TCP_SLOW_INTERVAL (2*TCP_TMR_INTERVAL) /* the coarse grained timeout in milliseconds */ |
sam_grove | 5:3f93dd1d4cb3 | 125 | #endif /* TCP_SLOW_INTERVAL */ |
sam_grove | 5:3f93dd1d4cb3 | 126 | |
sam_grove | 5:3f93dd1d4cb3 | 127 | #define TCP_FIN_WAIT_TIMEOUT 20000 /* milliseconds */ |
sam_grove | 5:3f93dd1d4cb3 | 128 | #define TCP_SYN_RCVD_TIMEOUT 20000 /* milliseconds */ |
sam_grove | 5:3f93dd1d4cb3 | 129 | |
sam_grove | 5:3f93dd1d4cb3 | 130 | #define TCP_OOSEQ_TIMEOUT 6U /* x RTO */ |
sam_grove | 5:3f93dd1d4cb3 | 131 | |
sam_grove | 5:3f93dd1d4cb3 | 132 | #ifndef TCP_MSL |
sam_grove | 5:3f93dd1d4cb3 | 133 | #define TCP_MSL 60000UL /* The maximum segment lifetime in milliseconds */ |
sam_grove | 5:3f93dd1d4cb3 | 134 | #endif |
sam_grove | 5:3f93dd1d4cb3 | 135 | |
sam_grove | 5:3f93dd1d4cb3 | 136 | /* Keepalive values, compliant with RFC 1122. Don't change this unless you know what you're doing */ |
sam_grove | 5:3f93dd1d4cb3 | 137 | #ifndef TCP_KEEPIDLE_DEFAULT |
sam_grove | 5:3f93dd1d4cb3 | 138 | #define TCP_KEEPIDLE_DEFAULT 7200000UL /* Default KEEPALIVE timer in milliseconds */ |
sam_grove | 5:3f93dd1d4cb3 | 139 | #endif |
sam_grove | 5:3f93dd1d4cb3 | 140 | |
sam_grove | 5:3f93dd1d4cb3 | 141 | #ifndef TCP_KEEPINTVL_DEFAULT |
sam_grove | 5:3f93dd1d4cb3 | 142 | #define TCP_KEEPINTVL_DEFAULT 75000UL /* Default Time between KEEPALIVE probes in milliseconds */ |
sam_grove | 5:3f93dd1d4cb3 | 143 | #endif |
sam_grove | 5:3f93dd1d4cb3 | 144 | |
sam_grove | 5:3f93dd1d4cb3 | 145 | #ifndef TCP_KEEPCNT_DEFAULT |
sam_grove | 5:3f93dd1d4cb3 | 146 | #define TCP_KEEPCNT_DEFAULT 9U /* Default Counter for KEEPALIVE probes */ |
sam_grove | 5:3f93dd1d4cb3 | 147 | #endif |
sam_grove | 5:3f93dd1d4cb3 | 148 | |
sam_grove | 5:3f93dd1d4cb3 | 149 | #define TCP_MAXIDLE TCP_KEEPCNT_DEFAULT * TCP_KEEPINTVL_DEFAULT /* Maximum KEEPALIVE probe time */ |
sam_grove | 5:3f93dd1d4cb3 | 150 | |
sam_grove | 5:3f93dd1d4cb3 | 151 | /* Fields are (of course) in network byte order. |
sam_grove | 5:3f93dd1d4cb3 | 152 | * Some fields are converted to host byte order in tcp_input(). |
sam_grove | 5:3f93dd1d4cb3 | 153 | */ |
sam_grove | 5:3f93dd1d4cb3 | 154 | #ifdef PACK_STRUCT_USE_INCLUDES |
sam_grove | 5:3f93dd1d4cb3 | 155 | # include "arch/bpstruct.h" |
sam_grove | 5:3f93dd1d4cb3 | 156 | #endif |
sam_grove | 5:3f93dd1d4cb3 | 157 | PACK_STRUCT_BEGIN |
sam_grove | 5:3f93dd1d4cb3 | 158 | struct tcp_hdr { |
sam_grove | 5:3f93dd1d4cb3 | 159 | PACK_STRUCT_FIELD(u16_t src); |
sam_grove | 5:3f93dd1d4cb3 | 160 | PACK_STRUCT_FIELD(u16_t dest); |
sam_grove | 5:3f93dd1d4cb3 | 161 | PACK_STRUCT_FIELD(u32_t seqno); |
sam_grove | 5:3f93dd1d4cb3 | 162 | PACK_STRUCT_FIELD(u32_t ackno); |
sam_grove | 5:3f93dd1d4cb3 | 163 | PACK_STRUCT_FIELD(u16_t _hdrlen_rsvd_flags); |
sam_grove | 5:3f93dd1d4cb3 | 164 | PACK_STRUCT_FIELD(u16_t wnd); |
sam_grove | 5:3f93dd1d4cb3 | 165 | PACK_STRUCT_FIELD(u16_t chksum); |
sam_grove | 5:3f93dd1d4cb3 | 166 | PACK_STRUCT_FIELD(u16_t urgp); |
sam_grove | 5:3f93dd1d4cb3 | 167 | } PACK_STRUCT_STRUCT; |
sam_grove | 5:3f93dd1d4cb3 | 168 | PACK_STRUCT_END |
sam_grove | 5:3f93dd1d4cb3 | 169 | #ifdef PACK_STRUCT_USE_INCLUDES |
sam_grove | 5:3f93dd1d4cb3 | 170 | # include "arch/epstruct.h" |
sam_grove | 5:3f93dd1d4cb3 | 171 | #endif |
sam_grove | 5:3f93dd1d4cb3 | 172 | |
sam_grove | 5:3f93dd1d4cb3 | 173 | #define TCPH_OFFSET(phdr) (ntohs((phdr)->_hdrlen_rsvd_flags) >> 8) |
sam_grove | 5:3f93dd1d4cb3 | 174 | #define TCPH_HDRLEN(phdr) (ntohs((phdr)->_hdrlen_rsvd_flags) >> 12) |
sam_grove | 5:3f93dd1d4cb3 | 175 | #define TCPH_FLAGS(phdr) (ntohs((phdr)->_hdrlen_rsvd_flags) & TCP_FLAGS) |
sam_grove | 5:3f93dd1d4cb3 | 176 | |
sam_grove | 5:3f93dd1d4cb3 | 177 | #define TCPH_OFFSET_SET(phdr, offset) (phdr)->_hdrlen_rsvd_flags = htons(((offset) << 8) | TCPH_FLAGS(phdr)) |
sam_grove | 5:3f93dd1d4cb3 | 178 | #define TCPH_HDRLEN_SET(phdr, len) (phdr)->_hdrlen_rsvd_flags = htons(((len) << 12) | TCPH_FLAGS(phdr)) |
sam_grove | 5:3f93dd1d4cb3 | 179 | #define TCPH_FLAGS_SET(phdr, flags) (phdr)->_hdrlen_rsvd_flags = (((phdr)->_hdrlen_rsvd_flags & PP_HTONS((u16_t)(~(u16_t)(TCP_FLAGS)))) | htons(flags)) |
sam_grove | 5:3f93dd1d4cb3 | 180 | #define TCPH_HDRLEN_FLAGS_SET(phdr, len, flags) (phdr)->_hdrlen_rsvd_flags = htons(((len) << 12) | (flags)) |
sam_grove | 5:3f93dd1d4cb3 | 181 | |
sam_grove | 5:3f93dd1d4cb3 | 182 | #define TCPH_SET_FLAG(phdr, flags ) (phdr)->_hdrlen_rsvd_flags = ((phdr)->_hdrlen_rsvd_flags | htons(flags)) |
sam_grove | 5:3f93dd1d4cb3 | 183 | #define TCPH_UNSET_FLAG(phdr, flags) (phdr)->_hdrlen_rsvd_flags = htons(ntohs((phdr)->_hdrlen_rsvd_flags) | (TCPH_FLAGS(phdr) & ~(flags)) ) |
sam_grove | 5:3f93dd1d4cb3 | 184 | |
sam_grove | 5:3f93dd1d4cb3 | 185 | #define TCP_TCPLEN(seg) ((seg)->len + ((TCPH_FLAGS((seg)->tcphdr) & (TCP_FIN | TCP_SYN)) != 0)) |
sam_grove | 5:3f93dd1d4cb3 | 186 | |
sam_grove | 5:3f93dd1d4cb3 | 187 | /** Flags used on input processing, not on pcb->flags |
sam_grove | 5:3f93dd1d4cb3 | 188 | */ |
sam_grove | 5:3f93dd1d4cb3 | 189 | #define TF_RESET (u8_t)0x08U /* Connection was reset. */ |
sam_grove | 5:3f93dd1d4cb3 | 190 | #define TF_CLOSED (u8_t)0x10U /* Connection was sucessfully closed. */ |
sam_grove | 5:3f93dd1d4cb3 | 191 | #define TF_GOT_FIN (u8_t)0x20U /* Connection was closed by the remote end. */ |
sam_grove | 5:3f93dd1d4cb3 | 192 | |
sam_grove | 5:3f93dd1d4cb3 | 193 | |
sam_grove | 5:3f93dd1d4cb3 | 194 | #if LWIP_EVENT_API |
sam_grove | 5:3f93dd1d4cb3 | 195 | |
sam_grove | 5:3f93dd1d4cb3 | 196 | #define TCP_EVENT_ACCEPT(pcb,err,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\ |
sam_grove | 5:3f93dd1d4cb3 | 197 | LWIP_EVENT_ACCEPT, NULL, 0, err) |
sam_grove | 5:3f93dd1d4cb3 | 198 | #define TCP_EVENT_SENT(pcb,space,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\ |
sam_grove | 5:3f93dd1d4cb3 | 199 | LWIP_EVENT_SENT, NULL, space, ERR_OK) |
sam_grove | 5:3f93dd1d4cb3 | 200 | #define TCP_EVENT_RECV(pcb,p,err,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\ |
sam_grove | 5:3f93dd1d4cb3 | 201 | LWIP_EVENT_RECV, (p), 0, (err)) |
sam_grove | 5:3f93dd1d4cb3 | 202 | #define TCP_EVENT_CLOSED(pcb,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\ |
sam_grove | 5:3f93dd1d4cb3 | 203 | LWIP_EVENT_RECV, NULL, 0, ERR_OK) |
sam_grove | 5:3f93dd1d4cb3 | 204 | #define TCP_EVENT_CONNECTED(pcb,err,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\ |
sam_grove | 5:3f93dd1d4cb3 | 205 | LWIP_EVENT_CONNECTED, NULL, 0, (err)) |
sam_grove | 5:3f93dd1d4cb3 | 206 | #define TCP_EVENT_POLL(pcb,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\ |
sam_grove | 5:3f93dd1d4cb3 | 207 | LWIP_EVENT_POLL, NULL, 0, ERR_OK) |
sam_grove | 5:3f93dd1d4cb3 | 208 | #define TCP_EVENT_ERR(errf,arg,err) lwip_tcp_event((arg), NULL, \ |
sam_grove | 5:3f93dd1d4cb3 | 209 | LWIP_EVENT_ERR, NULL, 0, (err)) |
sam_grove | 5:3f93dd1d4cb3 | 210 | |
sam_grove | 5:3f93dd1d4cb3 | 211 | #else /* LWIP_EVENT_API */ |
sam_grove | 5:3f93dd1d4cb3 | 212 | |
sam_grove | 5:3f93dd1d4cb3 | 213 | #define TCP_EVENT_ACCEPT(pcb,err,ret) \ |
sam_grove | 5:3f93dd1d4cb3 | 214 | do { \ |
sam_grove | 5:3f93dd1d4cb3 | 215 | if((pcb)->accept != NULL) \ |
sam_grove | 5:3f93dd1d4cb3 | 216 | (ret) = (pcb)->accept((pcb)->callback_arg,(pcb),(err)); \ |
sam_grove | 5:3f93dd1d4cb3 | 217 | else (ret) = ERR_ARG; \ |
sam_grove | 5:3f93dd1d4cb3 | 218 | } while (0) |
sam_grove | 5:3f93dd1d4cb3 | 219 | |
sam_grove | 5:3f93dd1d4cb3 | 220 | #define TCP_EVENT_SENT(pcb,space,ret) \ |
sam_grove | 5:3f93dd1d4cb3 | 221 | do { \ |
sam_grove | 5:3f93dd1d4cb3 | 222 | if((pcb)->sent != NULL) \ |
sam_grove | 5:3f93dd1d4cb3 | 223 | (ret) = (pcb)->sent((pcb)->callback_arg,(pcb),(space)); \ |
sam_grove | 5:3f93dd1d4cb3 | 224 | else (ret) = ERR_OK; \ |
sam_grove | 5:3f93dd1d4cb3 | 225 | } while (0) |
sam_grove | 5:3f93dd1d4cb3 | 226 | |
sam_grove | 5:3f93dd1d4cb3 | 227 | #define TCP_EVENT_RECV(pcb,p,err,ret) \ |
sam_grove | 5:3f93dd1d4cb3 | 228 | do { \ |
sam_grove | 5:3f93dd1d4cb3 | 229 | if((pcb)->recv != NULL) { \ |
sam_grove | 5:3f93dd1d4cb3 | 230 | (ret) = (pcb)->recv((pcb)->callback_arg,(pcb),(p),(err));\ |
sam_grove | 5:3f93dd1d4cb3 | 231 | } else { \ |
sam_grove | 5:3f93dd1d4cb3 | 232 | (ret) = tcp_recv_null(NULL, (pcb), (p), (err)); \ |
sam_grove | 5:3f93dd1d4cb3 | 233 | } \ |
sam_grove | 5:3f93dd1d4cb3 | 234 | } while (0) |
sam_grove | 5:3f93dd1d4cb3 | 235 | |
sam_grove | 5:3f93dd1d4cb3 | 236 | #define TCP_EVENT_CLOSED(pcb,ret) \ |
sam_grove | 5:3f93dd1d4cb3 | 237 | do { \ |
sam_grove | 5:3f93dd1d4cb3 | 238 | if(((pcb)->recv != NULL)) { \ |
sam_grove | 5:3f93dd1d4cb3 | 239 | (ret) = (pcb)->recv((pcb)->callback_arg,(pcb),NULL,ERR_OK);\ |
sam_grove | 5:3f93dd1d4cb3 | 240 | } else { \ |
sam_grove | 5:3f93dd1d4cb3 | 241 | (ret) = ERR_OK; \ |
sam_grove | 5:3f93dd1d4cb3 | 242 | } \ |
sam_grove | 5:3f93dd1d4cb3 | 243 | } while (0) |
sam_grove | 5:3f93dd1d4cb3 | 244 | |
sam_grove | 5:3f93dd1d4cb3 | 245 | #define TCP_EVENT_CONNECTED(pcb,err,ret) \ |
sam_grove | 5:3f93dd1d4cb3 | 246 | do { \ |
sam_grove | 5:3f93dd1d4cb3 | 247 | if((pcb)->connected != NULL) \ |
sam_grove | 5:3f93dd1d4cb3 | 248 | (ret) = (pcb)->connected((pcb)->callback_arg,(pcb),(err)); \ |
sam_grove | 5:3f93dd1d4cb3 | 249 | else (ret) = ERR_OK; \ |
sam_grove | 5:3f93dd1d4cb3 | 250 | } while (0) |
sam_grove | 5:3f93dd1d4cb3 | 251 | |
sam_grove | 5:3f93dd1d4cb3 | 252 | #define TCP_EVENT_POLL(pcb,ret) \ |
sam_grove | 5:3f93dd1d4cb3 | 253 | do { \ |
sam_grove | 5:3f93dd1d4cb3 | 254 | if((pcb)->poll != NULL) \ |
sam_grove | 5:3f93dd1d4cb3 | 255 | (ret) = (pcb)->poll((pcb)->callback_arg,(pcb)); \ |
sam_grove | 5:3f93dd1d4cb3 | 256 | else (ret) = ERR_OK; \ |
sam_grove | 5:3f93dd1d4cb3 | 257 | } while (0) |
sam_grove | 5:3f93dd1d4cb3 | 258 | |
sam_grove | 5:3f93dd1d4cb3 | 259 | #define TCP_EVENT_ERR(errf,arg,err) \ |
sam_grove | 5:3f93dd1d4cb3 | 260 | do { \ |
sam_grove | 5:3f93dd1d4cb3 | 261 | if((errf) != NULL) \ |
sam_grove | 5:3f93dd1d4cb3 | 262 | (errf)((arg),(err)); \ |
sam_grove | 5:3f93dd1d4cb3 | 263 | } while (0) |
sam_grove | 5:3f93dd1d4cb3 | 264 | |
sam_grove | 5:3f93dd1d4cb3 | 265 | #endif /* LWIP_EVENT_API */ |
sam_grove | 5:3f93dd1d4cb3 | 266 | |
sam_grove | 5:3f93dd1d4cb3 | 267 | /** Enabled extra-check for TCP_OVERSIZE if LWIP_DEBUG is enabled */ |
sam_grove | 5:3f93dd1d4cb3 | 268 | #if TCP_OVERSIZE && defined(LWIP_DEBUG) |
sam_grove | 5:3f93dd1d4cb3 | 269 | #define TCP_OVERSIZE_DBGCHECK 1 |
sam_grove | 5:3f93dd1d4cb3 | 270 | #else |
sam_grove | 5:3f93dd1d4cb3 | 271 | #define TCP_OVERSIZE_DBGCHECK 0 |
sam_grove | 5:3f93dd1d4cb3 | 272 | #endif |
sam_grove | 5:3f93dd1d4cb3 | 273 | |
sam_grove | 5:3f93dd1d4cb3 | 274 | /** Don't generate checksum on copy if CHECKSUM_GEN_TCP is disabled */ |
sam_grove | 5:3f93dd1d4cb3 | 275 | #define TCP_CHECKSUM_ON_COPY (LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_TCP) |
sam_grove | 5:3f93dd1d4cb3 | 276 | |
sam_grove | 5:3f93dd1d4cb3 | 277 | /* This structure represents a TCP segment on the unsent, unacked and ooseq queues */ |
sam_grove | 5:3f93dd1d4cb3 | 278 | struct tcp_seg { |
sam_grove | 5:3f93dd1d4cb3 | 279 | struct tcp_seg *next; /* used when putting segements on a queue */ |
sam_grove | 5:3f93dd1d4cb3 | 280 | struct pbuf *p; /* buffer containing data + TCP header */ |
sam_grove | 5:3f93dd1d4cb3 | 281 | u16_t len; /* the TCP length of this segment */ |
sam_grove | 5:3f93dd1d4cb3 | 282 | #if TCP_OVERSIZE_DBGCHECK |
sam_grove | 5:3f93dd1d4cb3 | 283 | u16_t oversize_left; /* Extra bytes available at the end of the last |
sam_grove | 5:3f93dd1d4cb3 | 284 | pbuf in unsent (used for asserting vs. |
sam_grove | 5:3f93dd1d4cb3 | 285 | tcp_pcb.unsent_oversized only) */ |
sam_grove | 5:3f93dd1d4cb3 | 286 | #endif /* TCP_OVERSIZE_DBGCHECK */ |
sam_grove | 5:3f93dd1d4cb3 | 287 | #if TCP_CHECKSUM_ON_COPY |
sam_grove | 5:3f93dd1d4cb3 | 288 | u16_t chksum; |
sam_grove | 5:3f93dd1d4cb3 | 289 | u8_t chksum_swapped; |
sam_grove | 5:3f93dd1d4cb3 | 290 | #endif /* TCP_CHECKSUM_ON_COPY */ |
sam_grove | 5:3f93dd1d4cb3 | 291 | u8_t flags; |
sam_grove | 5:3f93dd1d4cb3 | 292 | #define TF_SEG_OPTS_MSS (u8_t)0x01U /* Include MSS option. */ |
sam_grove | 5:3f93dd1d4cb3 | 293 | #define TF_SEG_OPTS_TS (u8_t)0x02U /* Include timestamp option. */ |
sam_grove | 5:3f93dd1d4cb3 | 294 | #define TF_SEG_DATA_CHECKSUMMED (u8_t)0x04U /* ALL data (not the header) is |
sam_grove | 5:3f93dd1d4cb3 | 295 | checksummed into 'chksum' */ |
sam_grove | 5:3f93dd1d4cb3 | 296 | struct tcp_hdr *tcphdr; /* the TCP header */ |
sam_grove | 5:3f93dd1d4cb3 | 297 | }; |
sam_grove | 5:3f93dd1d4cb3 | 298 | |
sam_grove | 5:3f93dd1d4cb3 | 299 | #define LWIP_TCP_OPT_LENGTH(flags) \ |
sam_grove | 5:3f93dd1d4cb3 | 300 | (flags & TF_SEG_OPTS_MSS ? 4 : 0) + \ |
sam_grove | 5:3f93dd1d4cb3 | 301 | (flags & TF_SEG_OPTS_TS ? 12 : 0) |
sam_grove | 5:3f93dd1d4cb3 | 302 | |
sam_grove | 5:3f93dd1d4cb3 | 303 | /** This returns a TCP header option for MSS in an u32_t */ |
sam_grove | 5:3f93dd1d4cb3 | 304 | #define TCP_BUILD_MSS_OPTION(x) (x) = PP_HTONL(((u32_t)2 << 24) | \ |
sam_grove | 5:3f93dd1d4cb3 | 305 | ((u32_t)4 << 16) | \ |
sam_grove | 5:3f93dd1d4cb3 | 306 | (((u32_t)TCP_MSS / 256) << 8) | \ |
sam_grove | 5:3f93dd1d4cb3 | 307 | (TCP_MSS & 255)) |
sam_grove | 5:3f93dd1d4cb3 | 308 | |
sam_grove | 5:3f93dd1d4cb3 | 309 | /* Global variables: */ |
sam_grove | 5:3f93dd1d4cb3 | 310 | extern struct tcp_pcb *tcp_input_pcb; |
sam_grove | 5:3f93dd1d4cb3 | 311 | extern u32_t tcp_ticks; |
sam_grove | 5:3f93dd1d4cb3 | 312 | |
sam_grove | 5:3f93dd1d4cb3 | 313 | /* The TCP PCB lists. */ |
sam_grove | 5:3f93dd1d4cb3 | 314 | union tcp_listen_pcbs_t { /* List of all TCP PCBs in LISTEN state. */ |
sam_grove | 5:3f93dd1d4cb3 | 315 | struct tcp_pcb_listen *listen_pcbs; |
sam_grove | 5:3f93dd1d4cb3 | 316 | struct tcp_pcb *pcbs; |
sam_grove | 5:3f93dd1d4cb3 | 317 | }; |
sam_grove | 5:3f93dd1d4cb3 | 318 | extern struct tcp_pcb *tcp_bound_pcbs; |
sam_grove | 5:3f93dd1d4cb3 | 319 | extern union tcp_listen_pcbs_t tcp_listen_pcbs; |
sam_grove | 5:3f93dd1d4cb3 | 320 | extern struct tcp_pcb *tcp_active_pcbs; /* List of all TCP PCBs that are in a |
sam_grove | 5:3f93dd1d4cb3 | 321 | state in which they accept or send |
sam_grove | 5:3f93dd1d4cb3 | 322 | data. */ |
sam_grove | 5:3f93dd1d4cb3 | 323 | extern struct tcp_pcb *tcp_tw_pcbs; /* List of all TCP PCBs in TIME-WAIT. */ |
sam_grove | 5:3f93dd1d4cb3 | 324 | |
sam_grove | 5:3f93dd1d4cb3 | 325 | extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */ |
sam_grove | 5:3f93dd1d4cb3 | 326 | |
sam_grove | 5:3f93dd1d4cb3 | 327 | /* Axioms about the above lists: |
sam_grove | 5:3f93dd1d4cb3 | 328 | 1) Every TCP PCB that is not CLOSED is in one of the lists. |
sam_grove | 5:3f93dd1d4cb3 | 329 | 2) A PCB is only in one of the lists. |
sam_grove | 5:3f93dd1d4cb3 | 330 | 3) All PCBs in the tcp_listen_pcbs list is in LISTEN state. |
sam_grove | 5:3f93dd1d4cb3 | 331 | 4) All PCBs in the tcp_tw_pcbs list is in TIME-WAIT state. |
sam_grove | 5:3f93dd1d4cb3 | 332 | */ |
sam_grove | 5:3f93dd1d4cb3 | 333 | /* Define two macros, TCP_REG and TCP_RMV that registers a TCP PCB |
sam_grove | 5:3f93dd1d4cb3 | 334 | with a PCB list or removes a PCB from a list, respectively. */ |
sam_grove | 5:3f93dd1d4cb3 | 335 | #ifndef TCP_DEBUG_PCB_LISTS |
sam_grove | 5:3f93dd1d4cb3 | 336 | #define TCP_DEBUG_PCB_LISTS 0 |
sam_grove | 5:3f93dd1d4cb3 | 337 | #endif |
sam_grove | 5:3f93dd1d4cb3 | 338 | #if TCP_DEBUG_PCB_LISTS |
sam_grove | 5:3f93dd1d4cb3 | 339 | #define TCP_REG(pcbs, npcb) do {\ |
sam_grove | 5:3f93dd1d4cb3 | 340 | LWIP_DEBUGF(TCP_DEBUG, ("TCP_REG %p local port %d\n", (npcb), (npcb)->local_port)); \ |
sam_grove | 5:3f93dd1d4cb3 | 341 | for(tcp_tmp_pcb = *(pcbs); \ |
sam_grove | 5:3f93dd1d4cb3 | 342 | tcp_tmp_pcb != NULL; \ |
sam_grove | 5:3f93dd1d4cb3 | 343 | tcp_tmp_pcb = tcp_tmp_pcb->next) { \ |
sam_grove | 5:3f93dd1d4cb3 | 344 | LWIP_ASSERT("TCP_REG: already registered\n", tcp_tmp_pcb != (npcb)); \ |
sam_grove | 5:3f93dd1d4cb3 | 345 | } \ |
sam_grove | 5:3f93dd1d4cb3 | 346 | LWIP_ASSERT("TCP_REG: pcb->state != CLOSED", ((pcbs) == &tcp_bound_pcbs) || ((npcb)->state != CLOSED)); \ |
sam_grove | 5:3f93dd1d4cb3 | 347 | (npcb)->next = *(pcbs); \ |
sam_grove | 5:3f93dd1d4cb3 | 348 | LWIP_ASSERT("TCP_REG: npcb->next != npcb", (npcb)->next != (npcb)); \ |
sam_grove | 5:3f93dd1d4cb3 | 349 | *(pcbs) = (npcb); \ |
sam_grove | 5:3f93dd1d4cb3 | 350 | LWIP_ASSERT("TCP_RMV: tcp_pcbs sane", tcp_pcbs_sane()); \ |
sam_grove | 5:3f93dd1d4cb3 | 351 | tcp_timer_needed(); \ |
sam_grove | 5:3f93dd1d4cb3 | 352 | } while(0) |
sam_grove | 5:3f93dd1d4cb3 | 353 | #define TCP_RMV(pcbs, npcb) do { \ |
sam_grove | 5:3f93dd1d4cb3 | 354 | LWIP_ASSERT("TCP_RMV: pcbs != NULL", *(pcbs) != NULL); \ |
sam_grove | 5:3f93dd1d4cb3 | 355 | LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removing %p from %p\n", (npcb), *(pcbs))); \ |
sam_grove | 5:3f93dd1d4cb3 | 356 | if(*(pcbs) == (npcb)) { \ |
sam_grove | 5:3f93dd1d4cb3 | 357 | *(pcbs) = (*pcbs)->next; \ |
sam_grove | 5:3f93dd1d4cb3 | 358 | } else for(tcp_tmp_pcb = *(pcbs); tcp_tmp_pcb != NULL; tcp_tmp_pcb = tcp_tmp_pcb->next) { \ |
sam_grove | 5:3f93dd1d4cb3 | 359 | if(tcp_tmp_pcb->next == (npcb)) { \ |
sam_grove | 5:3f93dd1d4cb3 | 360 | tcp_tmp_pcb->next = (npcb)->next; \ |
sam_grove | 5:3f93dd1d4cb3 | 361 | break; \ |
sam_grove | 5:3f93dd1d4cb3 | 362 | } \ |
sam_grove | 5:3f93dd1d4cb3 | 363 | } \ |
sam_grove | 5:3f93dd1d4cb3 | 364 | (npcb)->next = NULL; \ |
sam_grove | 5:3f93dd1d4cb3 | 365 | LWIP_ASSERT("TCP_RMV: tcp_pcbs sane", tcp_pcbs_sane()); \ |
sam_grove | 5:3f93dd1d4cb3 | 366 | LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removed %p from %p\n", (npcb), *(pcbs))); \ |
sam_grove | 5:3f93dd1d4cb3 | 367 | } while(0) |
sam_grove | 5:3f93dd1d4cb3 | 368 | |
sam_grove | 5:3f93dd1d4cb3 | 369 | #else /* LWIP_DEBUG */ |
sam_grove | 5:3f93dd1d4cb3 | 370 | |
sam_grove | 5:3f93dd1d4cb3 | 371 | #define TCP_REG(pcbs, npcb) \ |
sam_grove | 5:3f93dd1d4cb3 | 372 | do { \ |
sam_grove | 5:3f93dd1d4cb3 | 373 | (npcb)->next = *pcbs; \ |
sam_grove | 5:3f93dd1d4cb3 | 374 | *(pcbs) = (npcb); \ |
sam_grove | 5:3f93dd1d4cb3 | 375 | tcp_timer_needed(); \ |
sam_grove | 5:3f93dd1d4cb3 | 376 | } while (0) |
sam_grove | 5:3f93dd1d4cb3 | 377 | |
sam_grove | 5:3f93dd1d4cb3 | 378 | #define TCP_RMV(pcbs, npcb) \ |
sam_grove | 5:3f93dd1d4cb3 | 379 | do { \ |
sam_grove | 5:3f93dd1d4cb3 | 380 | if(*(pcbs) == (npcb)) { \ |
sam_grove | 5:3f93dd1d4cb3 | 381 | (*(pcbs)) = (*pcbs)->next; \ |
sam_grove | 5:3f93dd1d4cb3 | 382 | } \ |
sam_grove | 5:3f93dd1d4cb3 | 383 | else { \ |
sam_grove | 5:3f93dd1d4cb3 | 384 | for(tcp_tmp_pcb = *pcbs; \ |
sam_grove | 5:3f93dd1d4cb3 | 385 | tcp_tmp_pcb != NULL; \ |
sam_grove | 5:3f93dd1d4cb3 | 386 | tcp_tmp_pcb = tcp_tmp_pcb->next) { \ |
sam_grove | 5:3f93dd1d4cb3 | 387 | if(tcp_tmp_pcb->next == (npcb)) { \ |
sam_grove | 5:3f93dd1d4cb3 | 388 | tcp_tmp_pcb->next = (npcb)->next; \ |
sam_grove | 5:3f93dd1d4cb3 | 389 | break; \ |
sam_grove | 5:3f93dd1d4cb3 | 390 | } \ |
sam_grove | 5:3f93dd1d4cb3 | 391 | } \ |
sam_grove | 5:3f93dd1d4cb3 | 392 | } \ |
sam_grove | 5:3f93dd1d4cb3 | 393 | (npcb)->next = NULL; \ |
sam_grove | 5:3f93dd1d4cb3 | 394 | } while(0) |
sam_grove | 5:3f93dd1d4cb3 | 395 | |
sam_grove | 5:3f93dd1d4cb3 | 396 | #endif /* LWIP_DEBUG */ |
sam_grove | 5:3f93dd1d4cb3 | 397 | |
sam_grove | 5:3f93dd1d4cb3 | 398 | |
sam_grove | 5:3f93dd1d4cb3 | 399 | /* Internal functions: */ |
sam_grove | 5:3f93dd1d4cb3 | 400 | struct tcp_pcb *tcp_pcb_copy(struct tcp_pcb *pcb); |
sam_grove | 5:3f93dd1d4cb3 | 401 | void tcp_pcb_purge(struct tcp_pcb *pcb); |
sam_grove | 5:3f93dd1d4cb3 | 402 | void tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb); |
sam_grove | 5:3f93dd1d4cb3 | 403 | |
sam_grove | 5:3f93dd1d4cb3 | 404 | void tcp_segs_free(struct tcp_seg *seg); |
sam_grove | 5:3f93dd1d4cb3 | 405 | void tcp_seg_free(struct tcp_seg *seg); |
sam_grove | 5:3f93dd1d4cb3 | 406 | struct tcp_seg *tcp_seg_copy(struct tcp_seg *seg); |
sam_grove | 5:3f93dd1d4cb3 | 407 | |
sam_grove | 5:3f93dd1d4cb3 | 408 | #define tcp_ack(pcb) \ |
sam_grove | 5:3f93dd1d4cb3 | 409 | do { \ |
sam_grove | 5:3f93dd1d4cb3 | 410 | if((pcb)->flags & TF_ACK_DELAY) { \ |
sam_grove | 5:3f93dd1d4cb3 | 411 | (pcb)->flags &= ~TF_ACK_DELAY; \ |
sam_grove | 5:3f93dd1d4cb3 | 412 | (pcb)->flags |= TF_ACK_NOW; \ |
sam_grove | 5:3f93dd1d4cb3 | 413 | } \ |
sam_grove | 5:3f93dd1d4cb3 | 414 | else { \ |
sam_grove | 5:3f93dd1d4cb3 | 415 | (pcb)->flags |= TF_ACK_DELAY; \ |
sam_grove | 5:3f93dd1d4cb3 | 416 | } \ |
sam_grove | 5:3f93dd1d4cb3 | 417 | } while (0) |
sam_grove | 5:3f93dd1d4cb3 | 418 | |
sam_grove | 5:3f93dd1d4cb3 | 419 | #define tcp_ack_now(pcb) \ |
sam_grove | 5:3f93dd1d4cb3 | 420 | do { \ |
sam_grove | 5:3f93dd1d4cb3 | 421 | (pcb)->flags |= TF_ACK_NOW; \ |
sam_grove | 5:3f93dd1d4cb3 | 422 | } while (0) |
sam_grove | 5:3f93dd1d4cb3 | 423 | |
sam_grove | 5:3f93dd1d4cb3 | 424 | err_t tcp_send_fin(struct tcp_pcb *pcb); |
sam_grove | 5:3f93dd1d4cb3 | 425 | err_t tcp_enqueue_flags(struct tcp_pcb *pcb, u8_t flags); |
sam_grove | 5:3f93dd1d4cb3 | 426 | |
sam_grove | 5:3f93dd1d4cb3 | 427 | void tcp_rexmit_seg(struct tcp_pcb *pcb, struct tcp_seg *seg); |
sam_grove | 5:3f93dd1d4cb3 | 428 | |
sam_grove | 5:3f93dd1d4cb3 | 429 | void tcp_rst(u32_t seqno, u32_t ackno, |
sam_grove | 5:3f93dd1d4cb3 | 430 | ip_addr_t *local_ip, ip_addr_t *remote_ip, |
sam_grove | 5:3f93dd1d4cb3 | 431 | u16_t local_port, u16_t remote_port); |
sam_grove | 5:3f93dd1d4cb3 | 432 | |
sam_grove | 5:3f93dd1d4cb3 | 433 | u32_t tcp_next_iss(void); |
sam_grove | 5:3f93dd1d4cb3 | 434 | |
sam_grove | 5:3f93dd1d4cb3 | 435 | void tcp_keepalive(struct tcp_pcb *pcb); |
sam_grove | 5:3f93dd1d4cb3 | 436 | void tcp_zero_window_probe(struct tcp_pcb *pcb); |
sam_grove | 5:3f93dd1d4cb3 | 437 | |
sam_grove | 5:3f93dd1d4cb3 | 438 | #if TCP_CALCULATE_EFF_SEND_MSS |
sam_grove | 5:3f93dd1d4cb3 | 439 | u16_t tcp_eff_send_mss(u16_t sendmss, ip_addr_t *addr); |
sam_grove | 5:3f93dd1d4cb3 | 440 | #endif /* TCP_CALCULATE_EFF_SEND_MSS */ |
sam_grove | 5:3f93dd1d4cb3 | 441 | |
sam_grove | 5:3f93dd1d4cb3 | 442 | #if LWIP_CALLBACK_API |
sam_grove | 5:3f93dd1d4cb3 | 443 | err_t tcp_recv_null(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err); |
sam_grove | 5:3f93dd1d4cb3 | 444 | #endif /* LWIP_CALLBACK_API */ |
sam_grove | 5:3f93dd1d4cb3 | 445 | |
sam_grove | 5:3f93dd1d4cb3 | 446 | #if TCP_DEBUG || TCP_INPUT_DEBUG || TCP_OUTPUT_DEBUG |
sam_grove | 5:3f93dd1d4cb3 | 447 | void tcp_debug_print(struct tcp_hdr *tcphdr); |
sam_grove | 5:3f93dd1d4cb3 | 448 | void tcp_debug_print_flags(u8_t flags); |
sam_grove | 5:3f93dd1d4cb3 | 449 | void tcp_debug_print_state(enum tcp_state s); |
sam_grove | 5:3f93dd1d4cb3 | 450 | void tcp_debug_print_pcbs(void); |
sam_grove | 5:3f93dd1d4cb3 | 451 | s16_t tcp_pcbs_sane(void); |
sam_grove | 5:3f93dd1d4cb3 | 452 | #else |
sam_grove | 5:3f93dd1d4cb3 | 453 | # define tcp_debug_print(tcphdr) |
sam_grove | 5:3f93dd1d4cb3 | 454 | # define tcp_debug_print_flags(flags) |
sam_grove | 5:3f93dd1d4cb3 | 455 | # define tcp_debug_print_state(s) |
sam_grove | 5:3f93dd1d4cb3 | 456 | # define tcp_debug_print_pcbs() |
sam_grove | 5:3f93dd1d4cb3 | 457 | # define tcp_pcbs_sane() 1 |
sam_grove | 5:3f93dd1d4cb3 | 458 | #endif /* TCP_DEBUG */ |
sam_grove | 5:3f93dd1d4cb3 | 459 | |
sam_grove | 5:3f93dd1d4cb3 | 460 | /** External function (implemented in timers.c), called when TCP detects |
sam_grove | 5:3f93dd1d4cb3 | 461 | * that a timer is needed (i.e. active- or time-wait-pcb found). */ |
sam_grove | 5:3f93dd1d4cb3 | 462 | void tcp_timer_needed(void); |
sam_grove | 5:3f93dd1d4cb3 | 463 | |
sam_grove | 5:3f93dd1d4cb3 | 464 | |
sam_grove | 5:3f93dd1d4cb3 | 465 | #ifdef __cplusplus |
sam_grove | 5:3f93dd1d4cb3 | 466 | } |
sam_grove | 5:3f93dd1d4cb3 | 467 | #endif |
sam_grove | 5:3f93dd1d4cb3 | 468 | |
sam_grove | 5:3f93dd1d4cb3 | 469 | #endif /* LWIP_TCP */ |
sam_grove | 5:3f93dd1d4cb3 | 470 | |
sam_grove | 5:3f93dd1d4cb3 | 471 | #endif /* __LWIP_TCP_H__ */ |