151 |
|
|
152 |
#define TCP_MSL 60000 /* The maximum segment lifetime in microseconds */ |
#define TCP_MSL 60000 /* The maximum segment lifetime in microseconds */ |
153 |
|
|
154 |
|
/* |
155 |
|
* User-settable options (used with setsockopt). |
156 |
|
*/ |
157 |
|
#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */ |
158 |
|
#define TCP_KEEPALIVE 0x02 /* send KEEPALIVE probes when idle for pcb->keepalive miliseconds */ |
159 |
|
|
160 |
|
/* Keepalive values */ |
161 |
|
#define TCP_KEEPDEFAULT 7200000 /* KEEPALIVE timer in miliseconds */ |
162 |
|
#define TCP_KEEPINTVL 75000 /* Time between KEEPALIVE probes in miliseconds */ |
163 |
|
#define TCP_KEEPCNT 9 /* Counter for KEEPALIVE probes */ |
164 |
|
#define TCP_MAXIDLE TCP_KEEPCNT * TCP_KEEPINTVL /* Maximum KEEPALIVE probe time */ |
165 |
|
|
166 |
|
|
167 |
#ifdef PACK_STRUCT_USE_INCLUDES |
#ifdef PACK_STRUCT_USE_INCLUDES |
168 |
# include "arch/bpstruct.h" |
# include "arch/bpstruct.h" |
169 |
#endif |
#endif |
213 |
|
|
214 |
/* the TCP protocol control block */ |
/* the TCP protocol control block */ |
215 |
struct tcp_pcb { |
struct tcp_pcb { |
216 |
|
/* Common members of all PCB types */ |
217 |
|
IP_PCB; |
218 |
|
|
219 |
|
/* Protocol specific PCB members */ |
220 |
|
|
221 |
struct tcp_pcb *next; /* for the linked list */ |
struct tcp_pcb *next; /* for the linked list */ |
222 |
|
|
223 |
|
enum tcp_state state; /* TCP state */ |
224 |
|
|
225 |
u8_t prio; |
u8_t prio; |
226 |
void *callback_arg; |
void *callback_arg; |
227 |
|
|
|
struct ip_addr local_ip; |
|
228 |
u16_t local_port; |
u16_t local_port; |
|
enum tcp_state state; /* TCP state */ |
|
|
|
|
|
struct ip_addr remote_ip; |
|
229 |
u16_t remote_port; |
u16_t remote_port; |
230 |
|
|
231 |
|
u8_t flags; |
232 |
|
#define TF_ACK_DELAY (u8_t)0x01U /* Delayed ACK. */ |
233 |
|
#define TF_ACK_NOW (u8_t)0x02U /* Immediate ACK. */ |
234 |
|
#define TF_INFR (u8_t)0x04U /* In fast recovery. */ |
235 |
|
#define TF_RESET (u8_t)0x08U /* Connection was reset. */ |
236 |
|
#define TF_CLOSED (u8_t)0x10U /* Connection was sucessfully closed. */ |
237 |
|
#define TF_GOT_FIN (u8_t)0x20U /* Connection was closed by the remote end. */ |
238 |
|
#define TF_NODELAY (u8_t)0x40U /* Disable Nagle algorithm */ |
239 |
|
|
240 |
/* receiver varables */ |
/* receiver varables */ |
241 |
u32_t rcv_nxt; /* next seqno expected */ |
u32_t rcv_nxt; /* next seqno expected */ |
242 |
u16_t rcv_wnd; /* receiver window */ |
u16_t rcv_wnd; /* receiver window */ |
249 |
u16_t rtime; |
u16_t rtime; |
250 |
|
|
251 |
u16_t mss; /* maximum segment size */ |
u16_t mss; /* maximum segment size */ |
|
|
|
|
u8_t flags; |
|
|
#define TF_ACK_DELAY (u8_t)0x01U /* Delayed ACK. */ |
|
|
#define TF_ACK_NOW (u8_t)0x02U /* Immediate ACK. */ |
|
|
#define TF_INFR (u8_t)0x04U /* In fast recovery. */ |
|
|
#define TF_RESET (u8_t)0x08U /* Connection was reset. */ |
|
|
#define TF_CLOSED (u8_t)0x10U /* Connection was sucessfully closed. */ |
|
|
#define TF_GOT_FIN (u8_t)0x20U /* Connection was closed by the remote end. */ |
|
252 |
|
|
253 |
/* RTT estimation variables. */ |
/* RTT estimation variables. */ |
254 |
u16_t rttest; /* RTT estimate in 500ms ticks */ |
u16_t rttest; /* RTT estimate in 500ms ticks */ |
306 |
/* Function to be called whenever a fatal error occurs. */ |
/* Function to be called whenever a fatal error occurs. */ |
307 |
void (* errf)(void *arg, err_t err); |
void (* errf)(void *arg, err_t err); |
308 |
#endif /* LWIP_CALLBACK_API */ |
#endif /* LWIP_CALLBACK_API */ |
309 |
|
|
310 |
|
/* idle time before KEEPALIVE is sent */ |
311 |
|
u32_t keepalive; |
312 |
|
|
313 |
|
/* KEEPALIVE counter */ |
314 |
|
u8_t keep_cnt; |
315 |
}; |
}; |
316 |
|
|
317 |
struct tcp_pcb_listen { |
struct tcp_pcb_listen { |
318 |
|
/* Common members of all PCB types */ |
319 |
|
IP_PCB; |
320 |
|
|
321 |
|
/* Protocol specific PCB members */ |
322 |
struct tcp_pcb_listen *next; /* for the linked list */ |
struct tcp_pcb_listen *next; /* for the linked list */ |
|
u8_t prio; |
|
|
void *callback_arg; |
|
323 |
|
|
|
struct ip_addr local_ip; |
|
|
u16_t local_port; |
|
324 |
/* Even if state is obviously LISTEN this is here for |
/* Even if state is obviously LISTEN this is here for |
325 |
* field compatibility with tpc_pcb to which it is cast sometimes |
* field compatibility with tpc_pcb to which it is cast sometimes |
326 |
* Until a cleaner solution emerges this is here.FIXME |
* Until a cleaner solution emerges this is here.FIXME |
327 |
*/ |
*/ |
328 |
enum tcp_state state; /* TCP state */ |
enum tcp_state state; /* TCP state */ |
329 |
|
|
330 |
|
u8_t prio; |
331 |
|
void *callback_arg; |
332 |
|
|
333 |
|
u16_t local_port; |
334 |
|
|
335 |
#if LWIP_CALLBACK_API |
#if LWIP_CALLBACK_API |
336 |
/* Function to call when a listener has been connected. */ |
/* Function to call when a listener has been connected. */ |
337 |
err_t (* accept)(void *arg, struct tcp_pcb *newpcb, err_t err); |
err_t (* accept)(void *arg, struct tcp_pcb *newpcb, err_t err); |
431 |
|
|
432 |
u32_t tcp_next_iss(void); |
u32_t tcp_next_iss(void); |
433 |
|
|
434 |
|
void tcp_keepalive(struct tcp_pcb *pcb); |
435 |
|
|
436 |
extern struct tcp_pcb *tcp_input_pcb; |
extern struct tcp_pcb *tcp_input_pcb; |
437 |
extern u32_t tcp_ticks; |
extern u32_t tcp_ticks; |
438 |
|
|