A version of LWIP, provided for backwards compatibility.

Dependents:   AA_DemoBoard DemoBoard HelloServerDemo DemoBoard_RangeIndicator ... more

Embed: (wiki syntax)

« Back to documentation index

tcp_out.c File Reference

tcp_out.c File Reference

Transmission Control Protocol, outgoing traffic. More...

Go to the source code of this file.

Functions

static void tcp_output_segment (struct tcp_seg *seg, struct tcp_pcb *pcb)
 Called by tcp_output() to actually send a TCP segment over IP.
err_t tcp_send_ctrl (struct tcp_pcb *pcb, u8_t flags)
 Called by tcp_close() to send a segment including flags but not data.
err_t tcp_write (struct tcp_pcb *pcb, const void *data, u16_t len, u8_t apiflags)
 Write data for sending (but does not send it immediately).
err_t tcp_enqueue (struct tcp_pcb *pcb, void *arg, u16_t len, u8_t flags, u8_t apiflags, u8_t *optdata, u8_t optlen)
 Enqueue either data or TCP options (but not both) for tranmission.
err_t tcp_output (struct tcp_pcb *pcb)
 Find out what we can send and send it.
void tcp_rst (u32_t seqno, u32_t ackno, struct ip_addr *local_ip, struct ip_addr *remote_ip, u16_t local_port, u16_t remote_port)
 Send a TCP RESET packet (empty segment with RST flag set) either to abort a connection or to show that there is no matching local connection for a received segment.
void tcp_rexmit_rto (struct tcp_pcb *pcb)
 Requeue all unacked segments for retransmission.
void tcp_rexmit (struct tcp_pcb *pcb)
 Requeue the first unacked segment for retransmission.
void tcp_keepalive (struct tcp_pcb *pcb)
 Send keepalive packets to keep a connection active although no data is sent over it.
void tcp_zero_window_probe (struct tcp_pcb *pcb)
 Send persist timer zero-window probes to keep a connection active when a window update is lost.

Detailed Description

Transmission Control Protocol, outgoing traffic.

The output functions of TCP.

Definition in file tag/0.5/lwIP/core/tcp_out.c.


Function Documentation

err_t tcp_enqueue ( struct tcp_pcb *  pcb,
void *  arg,
u16_t  len,
u8_t  flags,
u8_t  apiflags,
u8_t *  optdata,
u8_t  optlen 
)

Enqueue either data or TCP options (but not both) for tranmission.

Called by tcp_connect(), tcp_listen_input(), tcp_send_ctrl() and tcp_write().

Parameters:
pcbProtocol control block for the TCP connection to enqueue data for.
argPointer to the data to be enqueued for sending.
lenData length in bytes
flagstcp header flags to set in the outgoing segment
apiflagscombination of following flags :

  • TCP_WRITE_FLAG_COPY (0x01) data will be copied into memory belonging to the stack
  • TCP_WRITE_FLAG_MORE (0x02) for TCP connection, PSH flag will be set on last segment sent,
optdata
optlen

Definition at line 130 of file tag/0.5/lwIP/core/tcp_out.c.

void tcp_keepalive ( struct tcp_pcb *  pcb )

Send keepalive packets to keep a connection active although no data is sent over it.

Called by tcp_slowtmr()

Parameters:
pcbthe tcp_pcb for which to send a keepalive packet

Definition at line 806 of file tag/0.5/lwIP/core/tcp_out.c.

err_t tcp_output ( struct tcp_pcb *  pcb )

Find out what we can send and send it.

Parameters:
pcbProtocol control block for the TCP connection to send data
Returns:
ERR_OK if data has been sent or nothing to send another err_t on error

Definition at line 411 of file tag/0.5/lwIP/core/tcp_out.c.

static void tcp_output_segment ( struct tcp_seg *  seg,
struct tcp_pcb *  pcb 
) [static]

Called by tcp_output() to actually send a TCP segment over IP.

Parameters:
segthe tcp_seg to send
pcbthe tcp_pcb for the TCP connection used to send the segment

Definition at line 597 of file tag/0.5/lwIP/core/tcp_out.c.

void tcp_rexmit ( struct tcp_pcb *  pcb )

Requeue the first unacked segment for retransmission.

Called by tcp_receive() for fast retramsmit.

Parameters:
pcbthe tcp_pcb for which to retransmit the first unacked segment

Definition at line 771 of file tag/0.5/lwIP/core/tcp_out.c.

void tcp_rexmit_rto ( struct tcp_pcb *  pcb )

Requeue all unacked segments for retransmission.

Called by tcp_slowtmr() for slow retransmission.

Parameters:
pcbthe tcp_pcb for which to re-enqueue all unacked segments

Definition at line 735 of file tag/0.5/lwIP/core/tcp_out.c.

void tcp_rst ( u32_t  seqno,
u32_t  ackno,
struct ip_addr *  local_ip,
struct ip_addr *  remote_ip,
u16_t  local_port,
u16_t  remote_port 
)

Send a TCP RESET packet (empty segment with RST flag set) either to abort a connection or to show that there is no matching local connection for a received segment.

Called by tcp_abort() (to abort a local connection), tcp_input() (if no matching local pcb was found), tcp_listen_input() (if incoming segment has ACK flag set) and tcp_process() (received segment in the wrong state)

Since a RST segment is in most cases not sent for an active connection, tcp_rst() has a number of arguments that are taken from a tcp_pcb for most other segment output functions.

Parameters:
seqnothe sequence number to use for the outgoing segment
acknothe acknowledge number to use for the outgoing segment
local_ipthe local IP address to send the segment from
remote_ipthe remote IP address to send the segment to
local_portthe local TCP port to send the segment from
remote_portthe remote TCP port to send the segment to

Definition at line 690 of file tag/0.5/lwIP/core/tcp_out.c.

err_t tcp_send_ctrl ( struct tcp_pcb *  pcb,
u8_t  flags 
)

Called by tcp_close() to send a segment including flags but not data.

Parameters:
pcbthe tcp_pcb over which to send a segment
flagsthe flags to set in the segment header
Returns:
ERR_OK if sent, another err_t otherwise

Definition at line 70 of file tag/0.5/lwIP/core/tcp_out.c.

err_t tcp_write ( struct tcp_pcb *  pcb,
const void *  data,
u16_t  len,
u8_t  apiflags 
)

Write data for sending (but does not send it immediately).

It waits in the expectation of more data being sent soon (as it can send them more efficiently by combining them together). To prompt the system to send data now, call tcp_output() after calling tcp_write().

Parameters:
pcbProtocol control block of the TCP connection to enqueue data for.
datapointer to the data to send
lenlength (in bytes) of the data to send
apiflagscombination of following flags :

  • TCP_WRITE_FLAG_COPY (0x01) data will be copied into memory belonging to the stack
  • TCP_WRITE_FLAG_MORE (0x02) for TCP connection, PSH flag will be set on last segment sent,
Returns:
ERR_OK if enqueued, another err_t on error
See also:
tcp_write()

Definition at line 95 of file tag/0.5/lwIP/core/tcp_out.c.

void tcp_zero_window_probe ( struct tcp_pcb *  pcb )

Send persist timer zero-window probes to keep a connection active when a window update is lost.

Called by tcp_slowtmr()

Parameters:
pcbthe tcp_pcb for which to send a zero-window probe packet

Definition at line 877 of file tag/0.5/lwIP/core/tcp_out.c.