RIOT's TCP implementation for the GNRC network stack. More...

Detailed Description

Files

file  config.h
 GNRC TCP configuration.
 
file  tcb.h
 GNRC TCP transmission control block (TCB)
 
file  gnrc/tcp.h
 GNRC TCP API.
 
file  net/gnrc/transport_layer/tcp/internal/common.h
 Internally used defines, macros and variable declarations.
 
file  eventloop.h
 TCP event loop delarations.
 
file  fsm.h
 TCP finite state maschine declarations.
 
file  option.h
 TCP option handling declarations.
 
file  net/gnrc/transport_layer/tcp/internal/pkt.h
 TCP paket handling declarations.
 
file  rcvbuf.h
 Functions for allocating and freeing the receive buffer.
 

Data Structures

struct  _transmission_control_block
 Transmission control block of GNRC TCP. More...
 
struct  rcvbuf_entry
 Receive buffer entry. More...
 
struct  rcvbuf
 Stuct holding receive buffers. More...
 

Macros

#define GNRC_TCP_CONNECTION_TIMEOUT_DURATION   (120U * US_PER_SEC)
 Timeout duration for user calls. More...
 
#define GNRC_TCP_MSL   (30U * US_PER_SEC)
 Maximum segment lifetime (MSL). More...
 
#define GNRC_TCP_MSS   (1220U)
 Maximum Segement Size (MSS). More...
 
#define GNRC_TCP_MSS_MULTIPLICATOR   (1U)
 MSS Multiplicator = Number of MSS sized packets stored in receive buffer.
 
#define GNRC_TCP_DEFAULT_WINDOW   (GNRC_TCP_MSS * GNRC_TCP_MSS_MULTIPLICATOR)
 Default receive window size.
 
#define GNRC_TCP_RCV_BUFFERS   (1U)
 Number of preallocated receive buffers.
 
#define GNRC_TCP_RCV_BUF_SIZE   (GNRC_TCP_DEFAULT_WINDOW)
 Default receive buffer size.
 
#define GNRC_TCP_RTO_LOWER_BOUND   (1U * US_PER_SEC)
 Lower bound for RTO = 1 sec (see RFC 6298)
 
#define GNRC_TCP_RTO_UPPER_BOUND   (60U * US_PER_SEC)
 Upper bound for RTO = 60 sec (see RFC 6298)
 
#define GNRC_TCP_RTO_GRANULARITY   (10U * MS_PER_SEC)
 Assumes clock granularity for TCP of 10 ms (see RFC 6298)
 
#define GNRC_TCP_RTO_A_DIV   (8U)
 Alpha value for RTO calculation, default is 1/8.
 
#define GNRC_TCP_RTO_B_DIV   (4U)
 Beta value for RTO calculation, default is 1/4.
 
#define GNRC_TCP_RTO_K   (4U)
 K value for RTO calculation, default is 4.
 
#define GNRC_TCP_PROBE_LOWER_BOUND   (1U * US_PER_SEC)
 Lower bound for the duration between probes.
 
#define GNRC_TCP_PROBE_UPPER_BOUND   (60U * US_PER_SEC)
 Upper bound for the duration between probes.
 
#define GNRC_TCP_TCB_MBOX_SIZE   (8U)
 Size of the TCB mbox.
 
#define PORT_UNSPEC   (0)
 Port number unspecified. More...
 
#define RTO_UNINITIALIZED   (-1)
 Define for marking that time measurement is uninitialized.
 
#define INSIDE_WND(l_ed, seq_num, r_ed)   (LEQ_32_BIT(l_ed, seq_num) && LSS_32_BIT(seq_num, r_ed))
 Check if a given sequence number falls into receive window.
 
#define GET_OFFSET(x)   (((x) & MSK_OFFSET) >> 12)
 Extract offset value from "offctl" field in TCP header.
 

Typedefs

typedef struct _transmission_control_block gnrc_tcp_tcb_t
 Transmission control block of GNRC TCP.
 
typedef struct rcvbuf_entry rcvbuf_entry_t
 Receive buffer entry.
 
typedef struct rcvbuf rcvbuf_t
 Stuct holding receive buffers.
 

Enumerations

enum  fsm_state_t {
  FSM_STATE_CLOSED = 0, FSM_STATE_LISTEN, FSM_STATE_SYN_SENT, FSM_STATE_SYN_RCVD,
  FSM_STATE_ESTABLISHED, FSM_STATE_CLOSE_WAIT, FSM_STATE_LAST_ACK, FSM_STATE_FIN_WAIT_1,
  FSM_STATE_FIN_WAIT_2, FSM_STATE_CLOSING, FSM_STATE_TIME_WAIT
}
 The TCP FSM states.
 
enum  fsm_event_t {
  FSM_EVENT_CALL_OPEN, FSM_EVENT_CALL_SEND, FSM_EVENT_CALL_RECV, FSM_EVENT_CALL_CLOSE,
  FSM_EVENT_CALL_ABORT, FSM_EVENT_RCVD_PKT, FSM_EVENT_TIMEOUT_TIMEWAIT, FSM_EVENT_TIMEOUT_RETRANSMIT,
  FSM_EVENT_TIMEOUT_CONNECTION, FSM_EVENT_SEND_PROBE, FSM_EVENT_CLEAR_RETRANSMIT
}
 Events that trigger transitions in TCP FSM.
 

Functions

int gnrc_tcp_init (void)
 Initialize TCP. More...
 
void gnrc_tcp_tcb_init (gnrc_tcp_tcb_t *tcb)
 Initialize Transmission Control Block (TCB) More...
 
int gnrc_tcp_open_active (gnrc_tcp_tcb_t *tcb, const uint8_t address_family, const uint8_t *target_addr, const uint16_t target_port, const uint16_t local_port)
 Opens a connection actively. More...
 
int gnrc_tcp_open_passive (gnrc_tcp_tcb_t *tcb, const uint8_t address_family, const uint8_t *local_addr, const uint16_t local_port)
 Opens a connection passively, by waiting for an incomming request. More...
 
ssize_t gnrc_tcp_send (gnrc_tcp_tcb_t *tcb, const void *data, const size_t len, const uint32_t user_timeout_duration_us)
 Transmit data to connected peer. More...
 
ssize_t gnrc_tcp_recv (gnrc_tcp_tcb_t *tcb, void *data, const size_t max_len, const uint32_t user_timeout_duration_us)
 Receive Data from the peer. More...
 
void gnrc_tcp_close (gnrc_tcp_tcb_t *tcb)
 Close a TCP connection. More...
 
void gnrc_tcp_abort (gnrc_tcp_tcb_t *tcb)
 Abort a TCP connection. More...
 
int gnrc_tcp_calc_csum (const gnrc_pktsnip_t *hdr, const gnrc_pktsnip_t *pseudo_hdr)
 Calculate and set checksum in TCP header. More...
 
gnrc_pktsnip_tgnrc_tcp_hdr_build (gnrc_pktsnip_t *payload, uint16_t src, uint16_t dst)
 Adds a TCP header to a given payload. More...
 
void * _event_loop (void *arg)
 GNRC TCPs main processing thread. More...
 
int _fsm (gnrc_tcp_tcb_t *tcb, fsm_event_t event, gnrc_pktsnip_t *in_pkt, void *buf, size_t len)
 TCP finite state maschine. More...
 
static uint32_t _option_build_mss (uint16_t mss)
 Helper function to build the MSS option. More...
 
static uint16_t _option_build_offset_control (uint16_t nopts, uint16_t ctl)
 Helper function to build the combined option and control flag field. More...
 
int _option_parse (gnrc_tcp_tcb_t *tcb, tcp_hdr_t *hdr)
 Parses options of a given TCP header. More...
 
int _pkt_build_reset_from_pkt (gnrc_pktsnip_t **out_pkt, gnrc_pktsnip_t *in_pkt)
 Build a reset packet from an incomming packet. More...
 
int _pkt_build (gnrc_tcp_tcb_t *tcb, gnrc_pktsnip_t **out_pkt, uint16_t *seq_con, const uint16_t ctl, const uint32_t seq_num, const uint32_t ack_num, void *payload, const size_t payload_len)
 Build and allocate a TCB paket, TCB stores pointer to new paket. More...
 
int _pkt_send (gnrc_tcp_tcb_t *tcb, gnrc_pktsnip_t *out_pkt, const uint16_t seq_con, const bool retransmit)
 Sends packet to peer. More...
 
int _pkt_chk_seq_num (const gnrc_tcp_tcb_t *tcb, const uint32_t seq_num, const uint32_t seg_len)
 Verify sequence number. More...
 
uint32_t _pkt_get_seg_len (gnrc_pktsnip_t *pkt)
 Extracts the length of a segment. More...
 
uint32_t _pkt_get_pay_len (gnrc_pktsnip_t *pkt)
 Calculates a packets payload length. More...
 
int _pkt_setup_retransmit (gnrc_tcp_tcb_t *tcb, gnrc_pktsnip_t *pkt, const bool retransmit)
 Adds a packet to the retransmission mechanism. More...
 
int _pkt_acknowledge (gnrc_tcp_tcb_t *tcb, const uint32_t ack)
 Acknowledges and removes packet from the retransmission mechanism. More...
 
uint16_t _pkt_calc_csum (const gnrc_pktsnip_t *hdr, const gnrc_pktsnip_t *pseudo_hdr, const gnrc_pktsnip_t *payload)
 Calculates checksum over payload, TCP header and network layer header. More...
 
void _rcvbuf_init (void)
 Initializes global receive buffer.
 
int _rcvbuf_get_buffer (gnrc_tcp_tcb_t *tcb)
 Allocate receive buffer and assign it to TCB. More...
 
void _rcvbuf_release_buffer (gnrc_tcp_tcb_t *tcb)
 Release allocated receive buffer. More...
 

Variables

kernel_pid_t gnrc_tcp_pid
 PID of GNRC TCP event handling thread.
 
gnrc_tcp_tcb_t_list_tcb_head
 Head of linked TCB list.
 
mutex_t _list_tcb_lock
 Mutex to protect TCB list.
 
#define STATUS_PASSIVE   (1 << 0)
 TCB status flags.
 
#define STATUS_ALLOW_ANY_ADDR   (1 << 1)
 
#define STATUS_NOTIFY_USER   (1 << 2)
 
#define STATUS_WAIT_FOR_MSG   (1 << 3)
 
#define TCP_EVENTLOOP_MSG_QUEUE_SIZE   (8U)
 Defines for "eventloop" thread settings.
 
#define TCP_EVENTLOOP_PRIO   (THREAD_PRIORITY_MAIN - 2U)
 
#define TCP_EVENTLOOP_STACK_SIZE   (THREAD_STACKSIZE_DEFAULT)
 
#define MSK_FIN   (0x0001)
 Bitmasks for control bit field handling.
 
#define MSK_SYN   (0x0002)
 
#define MSK_RST   (0x0004)
 
#define MSK_PSH   (0x0008)
 
#define MSK_ACK   (0x0010)
 
#define MSK_URG   (0x0020)
 
#define MSK_FIN_ACK   (0x0011)
 
#define MSK_SYN_ACK   (0x0012)
 
#define MSK_RST_ACK   (0x0014)
 
#define MSK_SYN_FIN_ACK   (0x0013)
 
#define MSK_FIN_ACK_PSH   (0x0019)
 
#define MSK_CTL   (0x003F)
 
#define MSK_OFFSET   (0xF000)
 
#define MSG_TYPE_CONNECTION_TIMEOUT   (GNRC_NETAPI_MSG_TYPE_ACK + 101)
 Message types for GNRC TCPs internal message passing.
 
#define MSG_TYPE_PROBE_TIMEOUT   (GNRC_NETAPI_MSG_TYPE_ACK + 102)
 
#define MSG_TYPE_USER_SPEC_TIMEOUT   (GNRC_NETAPI_MSG_TYPE_ACK + 103)
 
#define MSG_TYPE_RETRANSMISSION   (GNRC_NETAPI_MSG_TYPE_ACK + 104)
 
#define MSG_TYPE_TIMEWAIT   (GNRC_NETAPI_MSG_TYPE_ACK + 105)
 
#define MSG_TYPE_NOTIFY_USER   (GNRC_NETAPI_MSG_TYPE_ACK + 106)
 
#define LSS_32_BIT(x, y)   (((int32_t) (x)) - ((int32_t) (y)) < 0)
 Overflow tolerant comparision operators for sequence and acknowledgement number comparison.
 
#define LEQ_32_BIT(x, y)   (((int32_t) (x)) - ((int32_t) (y)) <= 0)
 
#define GRT_32_BIT(x, y)   (!LEQ_32_BIT(x, y))
 
#define GEQ_32_BIT(x, y)   (!LSS_32_BOT(x, y))
 

Macro Definition Documentation

◆ GNRC_TCP_CONNECTION_TIMEOUT_DURATION

#define GNRC_TCP_CONNECTION_TIMEOUT_DURATION   (120U * US_PER_SEC)

Default is 2 minutes.

Definition at line 35 of file config.h.

◆ GNRC_TCP_MSL

#define GNRC_TCP_MSL   (30U * US_PER_SEC)

Default is 30 seconds.

Definition at line 42 of file config.h.

◆ GNRC_TCP_MSS

#define GNRC_TCP_MSS   (1220U)

If IPv6 is used. Get MSS = 1280 - IPv6 Hdr - TCP Hdr = 1220

Definition at line 50 of file config.h.

◆ PORT_UNSPEC

#define PORT_UNSPEC   (0)

Function Documentation

◆ _event_loop()

void* _event_loop ( void *  arg)
Parameters
[in]argThread arguments (unused).
Returns
Never, its an endless loop

◆ _fsm()

int _fsm ( gnrc_tcp_tcb_t tcb,
fsm_event_t  event,
gnrc_pktsnip_t in_pkt,
void *  buf,
size_t  len 
)
Parameters
[in,out]tcbTCB holding the connection information.
[in]eventCurrent event that triggers FSM transition.
[in]in_pktIncomming packet. Only not NULL in case of event RCVD_PKT.
[in,out]bufBuffer for send and receive functions.
[in]lenNumber of bytes to send or receive.
Returns
Zero on success Positive Number, number of bytes sent from or copied into buf. -ENOSYS if event is not implemented

◆ _option_build_mss()

static uint32_t _option_build_mss ( uint16_t  mss)
inlinestatic
Parameters
[in]mssMSS value that should be set.
Returns
MSS option value.

Definition at line 41 of file option.h.

◆ _option_build_offset_control()

static uint16_t _option_build_offset_control ( uint16_t  nopts,
uint16_t  ctl 
)
inlinestatic
Parameters
[in]noptsNumber of options.
[in]ctlControl flag field.
Returns
Bitfield with encoded control bits and number of options.

Definition at line 55 of file option.h.

◆ _option_parse()

int _option_parse ( gnrc_tcp_tcb_t tcb,
tcp_hdr_t hdr 
)
Parameters
[in,out]tcbTCB holding the connection information.
[in]hdrTCP header to be parsed.
Returns
Zero on success. Negative value on error.

◆ _pkt_acknowledge()

int _pkt_acknowledge ( gnrc_tcp_tcb_t tcb,
const uint32_t  ack 
)
Parameters
[in,out]tcbTCB holding the connection information.
[in]ackAcknowldegment number used to acknowledge packets.
Returns
Zero on success. -ENODATA if there is nothing to acknowledge.

◆ _pkt_build()

int _pkt_build ( gnrc_tcp_tcb_t tcb,
gnrc_pktsnip_t **  out_pkt,
uint16_t *  seq_con,
const uint16_t  ctl,
const uint32_t  seq_num,
const uint32_t  ack_num,
void *  payload,
const size_t  payload_len 
)
Parameters
[in,out]tcbTCB holding the connection information.
[out]out_pktPointer to paket to build.
[out]seq_conSequence number consumption of built packet.
[in]ctlControl bits to set in out_pkt.
[in]seq_numSequence number of the new packet.
[in]ack_numAcknowledgment number of the new packet.
[in]payloadPointer to payload buffer.
[in]payload_lenPayload size.
Returns
Zero on success. -ENOMEM if pktbuf is full.

◆ _pkt_build_reset_from_pkt()

int _pkt_build_reset_from_pkt ( gnrc_pktsnip_t **  out_pkt,
gnrc_pktsnip_t in_pkt 
)
Note
This function builds a reset from an incomming packet in cases where the connection has not been established.
Parameters
[out]out_pktOutgoing reset packet
[in]in_pktIncomming packet
Returns
Zero on success -ENOMEM if pktbuf is full.

◆ _pkt_calc_csum()

uint16_t _pkt_calc_csum ( const gnrc_pktsnip_t hdr,
const gnrc_pktsnip_t pseudo_hdr,
const gnrc_pktsnip_t payload 
)
Parameters
[in]hdrGnrc_pktsnip_t to TCP header.
[in]pseudo_hdrGnrc_pktsnip_t to network layer header.
[in]payloadGnrc_pktsnip_t to payload.
Returns
Non-zero checksum if given network layer is supported. Zero if given network layer is not supported.

◆ _pkt_chk_seq_num()

int _pkt_chk_seq_num ( const gnrc_tcp_tcb_t tcb,
const uint32_t  seq_num,
const uint32_t  seg_len 
)
Parameters
[in,out]tcbTCB holding the connection information.
[in]seq_numSequence number from the segment.
[in]seg_lenLength of a segments payload.
Returns
Zero if the sequence number is acceptable. Negative value if the sequence number is not acceptable.

◆ _pkt_get_pay_len()

uint32_t _pkt_get_pay_len ( gnrc_pktsnip_t pkt)
Parameters
[in]pktPacket to calculate payload length.
Returns
The packets payload length in bytes.

◆ _pkt_get_seg_len()

uint32_t _pkt_get_seg_len ( gnrc_pktsnip_t pkt)
Parameters
[in]pktPacket to calculate the segments length.
Returns
Segments length in bytes (== sequence number consumption).

◆ _pkt_send()

int _pkt_send ( gnrc_tcp_tcb_t tcb,
gnrc_pktsnip_t out_pkt,
const uint16_t  seq_con,
const bool  retransmit 
)
Parameters
[in,out]tcbTCB holding the connection information.
[in]out_pktPointer to paket to send.
[in]seq_conSequence number consumption of the packet to send.
[in]retransmitFlag so mark that packet this is a retransmission.
Returns
Zero on success. -EINVAL if out_pkt was NULL.

◆ _pkt_setup_retransmit()

int _pkt_setup_retransmit ( gnrc_tcp_tcb_t tcb,
gnrc_pktsnip_t pkt,
const bool  retransmit 
)
Parameters
[in,out]tcbTCB holding the connection information.
[in]pktPacket to add to the retransmission mechanism.
[in]retransmitFlag used to indicate that pkt is a retransmit.
Returns
Zero on success. -ENOMEM if the retransmission queue is full. -EINVAL if pkt is null.

◆ _rcvbuf_get_buffer()

int _rcvbuf_get_buffer ( gnrc_tcp_tcb_t tcb)
Parameters
[in,out]tcbTCB that aquires receive buffer.
Returns
Zero on success. -ENOMEM if all receive buffers are currently used.

◆ _rcvbuf_release_buffer()

void _rcvbuf_release_buffer ( gnrc_tcp_tcb_t tcb)
Parameters
[in,out]tcbTCB holding the receive buffer that should be released.

◆ gnrc_tcp_abort()

void gnrc_tcp_abort ( gnrc_tcp_tcb_t tcb)
Precondition
gnrc_tcp_tcb_init() must have been successfully called.
tcb must not be NULL.
Parameters
[in,out]tcbTCB holding the connection information.

◆ gnrc_tcp_calc_csum()

int gnrc_tcp_calc_csum ( const gnrc_pktsnip_t hdr,
const gnrc_pktsnip_t pseudo_hdr 
)
Parameters
[in]hdrGnrc_pktsnip that contains TCP header.
[in]pseudo_hdrGnrc_pktsnip that contains network layer header.
Returns
Zero on succeed. -EFAULT if hdr or pseudo_hdr were NULL -EBADMSG if hdr is not of type GNRC_NETTYPE_TCP -ENOENT if pseudo_hdr protocol is unsupported.

◆ gnrc_tcp_close()

void gnrc_tcp_close ( gnrc_tcp_tcb_t tcb)
Precondition
gnrc_tcp_tcb_init() must have been successfully called.
tcb must not be NULL.
Parameters
[in,out]tcbTCB holding the connection information.

◆ gnrc_tcp_hdr_build()

gnrc_pktsnip_t* gnrc_tcp_hdr_build ( gnrc_pktsnip_t payload,
uint16_t  src,
uint16_t  dst 
)
Parameters
[in]payloadPayload that follows the TCP header.
[in]srcSource port number.
[in]dstDestination port number.
Returns
Not NULL on success. NULL if TCP header was not allocated.

◆ gnrc_tcp_init()

int gnrc_tcp_init ( void  )
Returns
PID of TCP thread on success -1 if TCB is already running. -EINVAL, if priority is greater than or equal SCHED_PRIO_LEVELS -EOVERFLOW, if there are too many threads running.

◆ gnrc_tcp_open_active()

int gnrc_tcp_open_active ( gnrc_tcp_tcb_t tcb,
const uint8_t  address_family,
const uint8_t *  target_addr,
const uint16_t  target_port,
const uint16_t  local_port 
)
Precondition
gnrc_tcp_tcb_init() must have been successfully called.
tcb must not be NULL
target_addr must not be NULL.
target_port must not be 0.
Note
Blocks until a connection has been established or an error occured.
Parameters
[in,out]tcbTCB holding the connection information.
[in]address_familyAddress family of target_addr.
[in]target_addrPointer to target address.
[in]target_portTarget port number.
[in]local_portIf zero or PORT_UNSPEC, the connections source port is randomly chosen. If local_port is non-zero the local_port is used as source port.
Returns
Zero on success. -EAFNOSUPPORT if address_family is not supported. -EINVAL if address_family is not the same the address_family use by the TCB. -EISCONN if TCB is already in use. -ENOMEM if the receive buffer for the TCB could not be allocated. -EADDRINUSE if local_port is already used by another connection. -ETIMEDOUT if the connection could not be opened. -ECONNREFUSED if the connection was resetted by the peer.

◆ gnrc_tcp_open_passive()

int gnrc_tcp_open_passive ( gnrc_tcp_tcb_t tcb,
const uint8_t  address_family,
const uint8_t *  local_addr,
const uint16_t  local_port 
)
Precondition
gnrc_tcp_tcb_init() must have been successfully called.
tcb must not be NULL.
if local_addr is not NULL, local_addr must be assigned to a network interface.
if local_port is not zero.
Note
Blocks until a connection has been established (incomming connection request to local_port) or an error occured.
Parameters
[in,out]tcbTCB holding the connection information.
[in]address_familyAddress family of local_addr. If local_addr == NULL, address_family is ignored.
[in]local_addrIf not NULL the connection is bound to local_addr. If NULL a connection request to all local ip addresses is valied.
[in]local_portPort number to listen on.
Returns
Zero on success. -EAFNOSUPPORT if local_addr != NULL and address_family is not supported. -EINVAL if address_family is not the same the address_family used in TCB. -EISCONN if TCB is already in use. -ENOMEM if the receive buffer for the TCB could not be allocated. Hint: Increase "GNRC_TCP_RCV_BUFFERS".

◆ gnrc_tcp_recv()

ssize_t gnrc_tcp_recv ( gnrc_tcp_tcb_t tcb,
void *  data,
const size_t  max_len,
const uint32_t  user_timeout_duration_us 
)
Precondition
gnrc_tcp_tcb_init() must have been successfully called.
tcb must not be NULL.
data must not be NULL.
Note
Function blocks if user_timeout_duration_us is not zero.
Parameters
[in,out]tcbTCB holding the connection information.
[out]dataPointer to the buffer where the received data should be copied into.
[in]max_lenMaximum amount to bytes that should be read into data.
[in]user_timeout_duration_usTimeout for receive in microseconds. If zero and no data is available, the function returns immediately. If not zero the function blocks until data is available or user_timeout_duration_us microseconds passed.
Returns
The number of bytes read into data. -ENOTCONN if connection is not established. -EAGAIN if user_timeout_duration_us is zero and no data is available. -ECONNRESET if connection was resetted by the peer. -ECONNABORTED if the connection was aborted. -ETIMEDOUT if user_timeout_duration_us expired.

◆ gnrc_tcp_send()

ssize_t gnrc_tcp_send ( gnrc_tcp_tcb_t tcb,
const void *  data,
const size_t  len,
const uint32_t  user_timeout_duration_us 
)
Precondition
gnrc_tcp_tcb_init() must have been successfully called.
tcb must not be NULL.
data must not be NULL.
Note
Blocks until up to len bytes were transmitted or an error occured.
Parameters
[in,out]tcbTCB holding the connection information.
[in]dataPointer to the data that should be transmitted.
[in]lenNumber of bytes that should be transmitted.
[in]user_timeout_duration_usIf not zero and there was not data transmitted the function returns after user_timeout_duration_us. If zero, no timeout will be triggered.
Returns
The number of successfully transmitted bytes. -ENOTCONN if connection is not established. -ECONNRESET if connection was resetted by the peer. -ECONNABORTED if the connection was aborted. -ETIMEDOUT if user_timeout_duration_us expired.

◆ gnrc_tcp_tcb_init()

void gnrc_tcp_tcb_init ( gnrc_tcp_tcb_t tcb)
Precondition
tcb must not be NULL.
Parameters
[in,out]tcbTCB that should be initialized.