36 |
* |
* |
37 |
*/ |
*/ |
38 |
|
|
39 |
/*-----------------------------------------------------------------------------------*/ |
|
40 |
/* tcp_input.c |
/* tcp_input.c |
41 |
* |
* |
42 |
* The input processing functions of TCP. |
* The input processing functions of TCP. |
45 |
* tcp_process() -> tcp_receive() (-> application). |
* tcp_process() -> tcp_receive() (-> application). |
46 |
* |
* |
47 |
*/ |
*/ |
48 |
/*-----------------------------------------------------------------------------------*/ |
|
49 |
|
|
50 |
|
|
51 |
#include "lwip/def.h" |
#include "lwip/def.h" |
85 |
static err_t tcp_listen_input(struct tcp_pcb_listen *pcb); |
static err_t tcp_listen_input(struct tcp_pcb_listen *pcb); |
86 |
static err_t tcp_timewait_input(struct tcp_pcb *pcb); |
static err_t tcp_timewait_input(struct tcp_pcb *pcb); |
87 |
|
|
88 |
/*-----------------------------------------------------------------------------------*/ |
|
89 |
/* tcp_input: |
/* tcp_input: |
90 |
* |
* |
91 |
* The initial input processing of TCP. It verifies the TCP header, demultiplexes |
* The initial input processing of TCP. It verifies the TCP header, demultiplexes |
93 |
* the TCP finite state machine. This function is called by the IP layer (in |
* the TCP finite state machine. This function is called by the IP layer (in |
94 |
* ip_input()). |
* ip_input()). |
95 |
*/ |
*/ |
96 |
/*-----------------------------------------------------------------------------------*/ |
|
97 |
void |
void |
98 |
tcp_input(struct pbuf *p, struct netif *inp) |
tcp_input(struct pbuf *p, struct netif *inp) |
99 |
{ |
{ |
398 |
LWIP_ASSERT("tcp_input: tcp_pcbs_sane()", tcp_pcbs_sane()); |
LWIP_ASSERT("tcp_input: tcp_pcbs_sane()", tcp_pcbs_sane()); |
399 |
PERF_STOP("tcp_input"); |
PERF_STOP("tcp_input"); |
400 |
} |
} |
401 |
/*-----------------------------------------------------------------------------------*/ |
|
402 |
/* tcp_listen_input(): |
/* tcp_listen_input(): |
403 |
* |
* |
404 |
* Called by tcp_input() when a segment arrives for a listening |
* Called by tcp_input() when a segment arrives for a listening |
405 |
* connection. |
* connection. |
406 |
*/ |
*/ |
407 |
/*-----------------------------------------------------------------------------------*/ |
|
408 |
static err_t |
static err_t |
409 |
tcp_listen_input(struct tcp_pcb_listen *pcb) |
tcp_listen_input(struct tcp_pcb_listen *pcb) |
410 |
{ |
{ |
465 |
} |
} |
466 |
return ERR_OK; |
return ERR_OK; |
467 |
} |
} |
468 |
/*-----------------------------------------------------------------------------------*/ |
|
469 |
/* tcp_timewait_input(): |
/* tcp_timewait_input(): |
470 |
* |
* |
471 |
* Called by tcp_input() when a segment arrives for a connection in |
* Called by tcp_input() when a segment arrives for a connection in |
472 |
* TIME_WAIT. |
* TIME_WAIT. |
473 |
*/ |
*/ |
474 |
/*-----------------------------------------------------------------------------------*/ |
|
475 |
static err_t |
static err_t |
476 |
tcp_timewait_input(struct tcp_pcb *pcb) |
tcp_timewait_input(struct tcp_pcb *pcb) |
477 |
{ |
{ |
483 |
} |
} |
484 |
return tcp_output(pcb); |
return tcp_output(pcb); |
485 |
} |
} |
486 |
/*-----------------------------------------------------------------------------------*/ |
|
487 |
/* tcp_process |
/* tcp_process |
488 |
* |
* |
489 |
* Implements the TCP state machine. Called by tcp_input. In some |
* Implements the TCP state machine. Called by tcp_input. In some |
491 |
* argument will be freed by the caller (tcp_input()) unless the |
* argument will be freed by the caller (tcp_input()) unless the |
492 |
* recv_data pointer in the pcb is set. |
* recv_data pointer in the pcb is set. |
493 |
*/ |
*/ |
494 |
/*-----------------------------------------------------------------------------------*/ |
|
495 |
static err_t |
static err_t |
496 |
tcp_process(struct tcp_pcb *pcb) |
tcp_process(struct tcp_pcb *pcb) |
497 |
{ |
{ |
650 |
|
|
651 |
return ERR_OK; |
return ERR_OK; |
652 |
} |
} |
653 |
/*-----------------------------------------------------------------------------------*/ |
|
654 |
/* tcp_receive: |
/* tcp_receive: |
655 |
* |
* |
656 |
* Called by tcp_process. Checks if the given segment is an ACK for outstanding |
* Called by tcp_process. Checks if the given segment is an ACK for outstanding |
662 |
* If the incoming segment constitutes an ACK for a segment that was used for RTT |
* If the incoming segment constitutes an ACK for a segment that was used for RTT |
663 |
* estimation, the RTT is estimated here as well. |
* estimation, the RTT is estimated here as well. |
664 |
*/ |
*/ |
665 |
/*-----------------------------------------------------------------------------------*/ |
|
666 |
static void |
static void |
667 |
tcp_receive(struct tcp_pcb *pcb) |
tcp_receive(struct tcp_pcb *pcb) |
668 |
{ |
{ |
1158 |
} |
} |
1159 |
} |
} |
1160 |
} |
} |
1161 |
/*-----------------------------------------------------------------------------------*/ |
|
1162 |
/* |
/* |
1163 |
* tcp_parseopt: |
* tcp_parseopt: |
1164 |
* |
* |
1166 |
* from uIP with only small changes.) |
* from uIP with only small changes.) |
1167 |
* |
* |
1168 |
*/ |
*/ |
1169 |
/*-----------------------------------------------------------------------------------*/ |
|
1170 |
static void |
static void |
1171 |
tcp_parseopt(struct tcp_pcb *pcb) |
tcp_parseopt(struct tcp_pcb *pcb) |
1172 |
{ |
{ |
1208 |
} |
} |
1209 |
} |
} |
1210 |
#endif /* LWIP_TCP */ |
#endif /* LWIP_TCP */ |
1211 |
/*-----------------------------------------------------------------------------------*/ |
|
1212 |
|
|