Loading...
Searching...
No Matches
gnrc_tcp_common.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2015-2017 Simon Brummer
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
18
19#include <stdint.h>
20#include "mutex.h"
21#include "net/gnrc/netapi.h"
22#include "net/gnrc/tcp/tcb.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
33#define PORT_UNSPEC (0)
34
39#define STATUS_LISTENING (1 << 0)
40#define STATUS_ALLOW_ANY_ADDR (1 << 1)
41#define STATUS_NOTIFY_USER (1 << 2)
42#define STATUS_ACCEPTED (1 << 3)
43#define STATUS_LOCKED (1 << 4)
45
50#define TCP_EVENTLOOP_PRIO (THREAD_PRIORITY_MAIN - 2U)
51#define TCP_EVENTLOOP_STACK_SIZE (THREAD_STACKSIZE_DEFAULT)
53
58#define MSK_FIN (0x0001)
59#define MSK_SYN (0x0002)
60#define MSK_RST (0x0004)
61#define MSK_PSH (0x0008)
62#define MSK_ACK (0x0010)
63#define MSK_URG (0x0020)
64#define MSK_FIN_ACK (0x0011)
65#define MSK_SYN_ACK (0x0012)
66#define MSK_RST_ACK (0x0014)
67#define MSK_SYN_FIN_ACK (0x0013)
68#define MSK_FIN_ACK_PSH (0x0019)
69#define MSK_CTL (0x003F)
70#define MSK_OFFSET (0xF000)
72
77#define MSG_TYPE_CONNECTION_TIMEOUT (GNRC_NETAPI_MSG_TYPE_ACK + 101)
78#define MSG_TYPE_PROBE_TIMEOUT (GNRC_NETAPI_MSG_TYPE_ACK + 102)
79#define MSG_TYPE_USER_SPEC_TIMEOUT (GNRC_NETAPI_MSG_TYPE_ACK + 103)
80#define MSG_TYPE_RETRANSMISSION (GNRC_NETAPI_MSG_TYPE_ACK + 104)
81#define MSG_TYPE_TIMEWAIT (GNRC_NETAPI_MSG_TYPE_ACK + 105)
82#define MSG_TYPE_NOTIFY_USER (GNRC_NETAPI_MSG_TYPE_ACK + 106)
84
88#define RTO_UNINITIALIZED (-1)
89
95#define LSS_32_BIT(x, y) (((int32_t) (x)) - ((int32_t) (y)) < 0)
96#define LEQ_32_BIT(x, y) (((int32_t) (x)) - ((int32_t) (y)) <= 0)
97#define GRT_32_BIT(x, y) (!LEQ_32_BIT(x, y))
98#define GEQ_32_BIT(x, y) (!LSS_32_BOT(x, y))
100
104#define INSIDE_WND(l_ed, seq_num, r_ed) (LEQ_32_BIT(l_ed, seq_num) && LSS_32_BIT(seq_num, r_ed))
105
109#define GET_OFFSET( x ) (((x) & MSK_OFFSET) >> 12)
110
116#define TCP_DEBUG_ENTER DEBUG("GNRC_TCP: Enter \"%s\", File: %s(%d)\n", \
117 DEBUG_FUNC, __FILE__, __LINE__)
118
124#define TCP_DEBUG_LEAVE DEBUG("GNRC_TCP: Leave \"%s\", File: %s(%d)\n", \
125 DEBUG_FUNC, __FILE__, __LINE__)
126
132#define TCP_DEBUG_ERROR(msg) DEBUG("GNRC_TCP: Error: \"%s\", Func: %s, File: %s(%d)\n", \
133 msg, DEBUG_FUNC, __FILE__, __LINE__)
134
140#define TCP_DEBUG_INFO(msg) DEBUG("GNRC_TCP: Info: \"%s\", Func: %s, File: %s(%d)\n", \
141 msg, DEBUG_FUNC, __FILE__, __LINE__)
142
150
157
158#ifdef __cplusplus
159}
160#endif
161
_gnrc_tcp_common_tcb_list_t * _gnrc_tcp_common_get_tcb_list(void)
Function to access to TCB list.
Mutex for thread synchronization.
Generic interface to communicate with GNRC modules.
mutex_t lock
Lock of TCB list.
gnrc_tcp_tcb_t * head
Head of TCB list.
Mutex structure.
Definition mutex.h:36
GNRC TCP transmission control block (TCB)
struct sock_tcp gnrc_tcp_tcb_t
Transmission control block of GNRC TCP.