2016-02-04 14:37:35 +01:00
|
|
|
/*
|
2017-02-06 18:26:45 +01:00
|
|
|
* Copyright (C) 2015-2017 Simon Brummer
|
2016-02-04 14:37:35 +01:00
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2019-07-07 12:07:56 +02:00
|
|
|
* @ingroup net_gnrc_tcp
|
2016-02-04 14:37:35 +01:00
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
2017-03-06 08:47:06 +01:00
|
|
|
* @brief GNRC TCP transmission control block (TCB)
|
2016-02-04 14:37:35 +01:00
|
|
|
*
|
2017-02-01 16:33:31 +01:00
|
|
|
* @author Simon Brummer <simon.brummer@posteo.de>
|
2016-02-04 14:37:35 +01:00
|
|
|
*/
|
|
|
|
|
2017-05-23 18:19:52 +02:00
|
|
|
#ifndef NET_GNRC_TCP_TCB_H
|
|
|
|
#define NET_GNRC_TCP_TCB_H
|
2016-02-04 14:37:35 +01:00
|
|
|
|
|
|
|
#include <stdint.h>
|
2017-02-26 17:31:23 +01:00
|
|
|
#include "kernel_types.h"
|
|
|
|
#include "ringbuffer.h"
|
|
|
|
#include "xtimer.h"
|
|
|
|
#include "mutex.h"
|
|
|
|
#include "msg.h"
|
2017-02-25 18:40:37 +01:00
|
|
|
#include "mbox.h"
|
2017-02-26 17:31:23 +01:00
|
|
|
#include "net/gnrc/pkt.h"
|
2016-02-04 14:37:35 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#ifdef MODULE_GNRC_IPV6
|
|
|
|
#include "net/gnrc/ipv6.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2017-02-01 15:09:46 +01:00
|
|
|
/**
|
2017-02-25 18:40:37 +01:00
|
|
|
* @brief Size of the TCB mbox
|
2017-02-01 15:09:46 +01:00
|
|
|
*/
|
2017-02-25 18:40:37 +01:00
|
|
|
#define GNRC_TCP_TCB_MBOX_SIZE (8U)
|
2017-02-01 15:09:46 +01:00
|
|
|
|
2016-02-04 14:37:35 +01:00
|
|
|
/**
|
2017-03-06 08:47:06 +01:00
|
|
|
* @brief Transmission control block of GNRC TCP.
|
2016-02-04 14:37:35 +01:00
|
|
|
*/
|
|
|
|
typedef struct _transmission_control_block {
|
2017-03-06 08:47:06 +01:00
|
|
|
uint8_t address_family; /**< Address Family of local_addr / peer_addr */
|
2016-02-04 14:37:35 +01:00
|
|
|
#ifdef MODULE_GNRC_IPV6
|
2017-03-06 08:47:06 +01:00
|
|
|
uint8_t local_addr[sizeof(ipv6_addr_t)]; /**< Local IP address */
|
|
|
|
uint8_t peer_addr[sizeof(ipv6_addr_t)]; /**< Peer IP address */
|
2018-05-11 10:06:14 +02:00
|
|
|
int8_t ll_iface; /**< Link layer interface id to use. */
|
2016-02-04 14:37:35 +01:00
|
|
|
#endif
|
2017-03-06 08:47:06 +01:00
|
|
|
uint16_t local_port; /**< Local connections port number */
|
|
|
|
uint16_t peer_port; /**< Peer connections port number */
|
2017-02-02 08:28:10 +01:00
|
|
|
uint8_t state; /**< Connections state */
|
|
|
|
uint8_t status; /**< A connections status flags */
|
2017-03-06 08:47:06 +01:00
|
|
|
uint32_t snd_una; /**< Send unacknowledged */
|
|
|
|
uint32_t snd_nxt; /**< Send next */
|
|
|
|
uint16_t snd_wnd; /**< Send window */
|
|
|
|
uint32_t snd_wl1; /**< SeqNo. from last window update */
|
|
|
|
uint32_t snd_wl2; /**< AckNo. from last window update */
|
|
|
|
uint32_t rcv_nxt; /**< Receive next */
|
|
|
|
uint16_t rcv_wnd; /**< Receive window */
|
|
|
|
uint32_t iss; /**< Initial sequence sumber */
|
|
|
|
uint32_t irs; /**< Initial received sequence number */
|
2017-02-02 08:28:10 +01:00
|
|
|
uint16_t mss; /**< The peers MSS */
|
|
|
|
uint32_t rtt_start; /**< Timer value for rtt estimation */
|
2017-03-06 08:47:06 +01:00
|
|
|
int32_t rtt_var; /**< Round trip time variance */
|
|
|
|
int32_t srtt; /**< Smoothed round trip time */
|
|
|
|
int32_t rto; /**< Retransmission timeout duration */
|
|
|
|
uint8_t retries; /**< Number of retransmissions */
|
2017-02-02 08:28:10 +01:00
|
|
|
xtimer_t tim_tout; /**< Timer struct for timeouts */
|
|
|
|
msg_t msg_tout; /**< Message, sent on timeouts */
|
2017-03-06 08:47:06 +01:00
|
|
|
gnrc_pktsnip_t *pkt_retransmit; /**< Pointer to packet in "retransmit queue" */
|
2017-02-25 18:40:37 +01:00
|
|
|
msg_t mbox_raw[GNRC_TCP_TCB_MBOX_SIZE]; /**< Msg queue for mbox */
|
|
|
|
mbox_t mbox; /**< TCB mbox for synchronization */
|
2017-02-02 08:28:10 +01:00
|
|
|
uint8_t *rcv_buf_raw; /**< Pointer to the receive buffer */
|
2017-03-06 08:47:06 +01:00
|
|
|
ringbuffer_t rcv_buf; /**< Receive buffer data structure */
|
2017-02-02 08:28:10 +01:00
|
|
|
mutex_t fsm_lock; /**< Mutex for FSM access synchronization */
|
2017-03-06 08:47:06 +01:00
|
|
|
mutex_t function_lock; /**< Mutex for function call synchronization */
|
|
|
|
struct _transmission_control_block *next; /**< Pointer next TCB */
|
2016-02-04 14:37:35 +01:00
|
|
|
} gnrc_tcp_tcb_t;
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2017-05-23 18:19:52 +02:00
|
|
|
#endif /* NET_GNRC_TCP_TCB_H */
|
2016-02-04 14:37:35 +01:00
|
|
|
/** @} */
|