Rtos API example

Embed: (wiki syntax)

« Back to documentation index

lwip_tcp_in.c File Reference

lwip_tcp_in.c File Reference

Transmission Control Protocol, incoming traffic. More...

Go to the source code of this file.

Functions

void tcp_input (struct pbuf *p, struct netif *inp)
 The initial input processing of TCP.

Detailed Description

Transmission Control Protocol, incoming traffic.

The input processing functions of the TCP layer.

These functions are generally called in the order (ip_input() ->) tcp_input() -> * tcp_process() -> tcp_receive() (-> application).

Definition in file lwip_tcp_in.c.


Function Documentation

void tcp_input ( struct pbuf p,
struct netif inp 
)

The initial input processing of TCP.

It verifies the TCP header, demultiplexes the segment between the PCBs and passes it on to tcp_process(), which implements the TCP finite state machine. This function is called by the IP layer (in ip_input()).

Parameters:
preceived TCP segment to process (p->payload pointing to the TCP header)
inpnetwork interface on which this segment was received

Called by tcp_input() when a segment arrives for a listening connection (from tcp_input()).

Parameters:
pcbthe tcp_pcb_listen for which a segment arrived
Note:
the segment which arrived is saved in global variables, therefore only the pcb involved is passed as a parameter to this function

Called by tcp_input() when a segment arrives for a connection in TIME_WAIT.

Parameters:
pcbthe tcp_pcb for which a segment arrived
Note:
the segment which arrived is saved in global variables, therefore only the pcb involved is passed as a parameter to this function

Implements the TCP state machine. Called by tcp_input. In some states tcp_receive() is called to receive data. The tcp_seg argument will be freed by the caller (tcp_input()) unless the recv_data pointer in the pcb is set.

Parameters:
pcbthe tcp_pcb for which a segment arrived
Note:
the segment which arrived is saved in global variables, therefore only the pcb involved is passed as a parameter to this function

Insert segment into the list (segments covered with new one will be deleted)

Called from tcp_receive()

Called by tcp_process. Checks if the given segment is an ACK for outstanding data, and if so frees the memory of the buffered data. Next, it places the segment on any of the receive queues (pcb->recved or pcb->ooseq). If the segment is buffered, the pbuf is referenced by pbuf_ref so that it will not be freed until it has been removed from the buffer.

If the incoming segment constitutes an ACK for a segment that was used for RTT estimation, the RTT is estimated here as well.

Called from tcp_process().

Parses the options contained in the incoming segment.

Called from tcp_listen_input() and tcp_process(). Currently, only the MSS option is supported!

Parameters:
pcbthe tcp_pcb for which a segment arrived

Definition at line 102 of file lwip_tcp_in.c.