Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

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 from tcp_input to check for TF_CLOSED flag. This results in closing and deallocating a pcb at the correct place to ensure noone references it any more.

Returns:
1 if the pcb has been closed and deallocated, 0 otherwise

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()

Remove segments from a list if the incoming ACK acknowledges them

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

Called by tcp_receive() to add new SACK entry.

The new SACK entry will be placed at the beginning of rcv_sacks[], as the newest one. Existing SACK entries will be "pushed back", to preserve their order. This is the behavior described in RFC 2018, section 4.

Parameters:
pcbthe tcp_pcb for which a segment arrived
leftthe left side of the SACK (the first sequence number)
rightthe right side of the SACK (the first sequence number past this SACK)

Called to remove a range of SACKs.

SACK entries will be removed or adjusted to not acknowledge any sequence numbers that are less than 'seq' passed. It not only invalidates entries, but also moves all entries that are still valid to the beginning.

Parameters:
pcbthe tcp_pcb to modify
seqthe lowest sequence number to keep in SACK entries

Called to remove a range of SACKs.

SACK entries will be removed or adjusted to not acknowledge any sequence numbers that are greater than (or equal to) 'seq' passed. It not only invalidates entries, but also moves all entries that are still valid to the beginning.

Parameters:
pcbthe tcp_pcb to modify
seqthe highest sequence number to keep in SACK entries

Definition at line 118 of file lwip_tcp_in.c.