NetServices Stack source

Dependents:   HelloWorld ServoInterfaceBoardExample1 4180_Lab4

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 void 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.
static void tcp_oos_insert_segment (struct tcp_seg *cseg, struct tcp_seg *next)
 Insert segment into the list (segments covered with new one will be deleted)

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 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 92 of file 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 441 of file tcp_in.c.

static void tcp_oos_insert_segment ( struct tcp_seg *  cseg,
struct tcp_seg *  next 
) [static]

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

Called from tcp_receive()

Definition at line 796 of file tcp_in.c.

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

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 1492 of file 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 571 of file tcp_in.c.

static void 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().

Definition at line 843 of file 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 525 of file tcp_in.c.