A version of LWIP, provided for backwards compatibility.

Dependents:   AA_DemoBoard DemoBoard HelloServerDemo DemoBoard_RangeIndicator ... more

Embed: (wiki syntax)

« Back to documentation index

tcp_in.c File Reference

tcp_in.c File Reference

Transmission Control Protocol, incoming traffic. More...

Go to the source code of this file.

Functions

static err_t tcp_process (struct tcp_pcb *pcb)
 Implements the TCP state machine.
static u8_t tcp_receive (struct tcp_pcb *pcb)
 Called by tcp_process.
static void tcp_parseopt (struct tcp_pcb *pcb)
 Parses the options contained in the incoming segment.
static err_t tcp_listen_input (struct tcp_pcb_listen *pcb)
 Called by tcp_input() when a segment arrives for a listening connection (from tcp_input()).
static err_t tcp_timewait_input (struct tcp_pcb *pcb)
 Called by tcp_input() when a segment arrives for a connection in TIME_WAIT.
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 tag/0.2/lwIP/core/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 IP header)
inpnetwork interface on which this segment was received

Definition at line 93 of file tag/0.2/lwIP/core/tcp_in.c.

static err_t tcp_listen_input ( struct tcp_pcb_listen *  pcb ) [static]

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
Returns:
ERR_OK if the segment was processed another err_t on error
Note:
the return value is not (yet?) used in tcp_input()
the segment which arrived is saved in global variables, therefore only the pcb involved is passed as a parameter to this function

Definition at line 397 of file tag/0.2/lwIP/core/tcp_in.c.

static void tcp_parseopt ( struct tcp_pcb *  pcb ) [static]

Parses the options contained in the incoming segment.

(Code taken from uIP with only small changes.)

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 1328 of file tag/0.2/lwIP/core/tcp_in.c.

static err_t tcp_process ( struct tcp_pcb *  pcb ) [static]

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

Definition at line 504 of file tag/0.2/lwIP/core/tcp_in.c.

static u8_t tcp_receive ( struct tcp_pcb *  pcb ) [static]

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, is 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 i 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().

Returns:
1 if the incoming segment is the next in sequence, 0 if not

Definition at line 728 of file tag/0.2/lwIP/core/tcp_in.c.

static err_t tcp_timewait_input ( struct tcp_pcb *  pcb ) [static]

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

Definition at line 481 of file tag/0.2/lwIP/core/tcp_in.c.