Loading...
Searching...
No Matches
gnrc_tcp_common.h File Reference

Internally used defines, macros and variable declarations. More...

Detailed Description

Internally used defines, macros and variable declarations.

Author
Simon Brummer simon.nosp@m..bru.nosp@m.mmer@.nosp@m.post.nosp@m.eo.de

Definition in file gnrc_tcp_common.h.

#include <stdint.h>
#include "thread.h"
#include "mutex.h"
#include "evtimer.h"
#include "net/gnrc/netapi.h"
#include "net/gnrc/tcp/tcb.h"
+ Include dependency graph for gnrc_tcp_common.h:

Go to the source code of this file.

Data Structures

struct  _gnrc_tcp_common_tcb_list_t
 TCB list type. More...
 

Macros

#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.
 
#define TCP_DEBUG_ENTER
 Helper macro used to create debug message on function entry.
 
#define TCP_DEBUG_LEAVE
 Helper macro used to create debug message on function exit.
 
#define TCP_DEBUG_ERROR(msg)
 Helper macro used to create debug message on error.
 
#define TCP_DEBUG_INFO(msg)
 Helper macro used to create informational debug message.
 

Functions

_gnrc_tcp_common_tcb_list_t_gnrc_tcp_common_get_tcb_list (void)
 Function to access to TCB list.
 
#define PORT_UNSPEC   (0)
 Port number unspecified.
 
#define STATUS_LISTENING   (1 << 0)
 TCB status flags.
 
#define STATUS_ALLOW_ANY_ADDR   (1 << 1)
 Internal: Status bitmask ALLOW_ANY_ADDR.
 
#define STATUS_NOTIFY_USER   (1 << 2)
 Internal: Status bitmask NOTIFY_USER.
 
#define STATUS_ACCEPTED   (1 << 3)
 Internal: Status bitmask ACCEPTED.
 
#define STATUS_LOCKED   (1 << 4)
 Internal: Status bitmask LOCKED.
 
#define TCP_EVENTLOOP_PRIO   (THREAD_PRIORITY_MAIN - 2U)
 Defines for "eventloop" thread settings.
 
#define TCP_EVENTLOOP_STACK_SIZE   (THREAD_STACKSIZE_DEFAULT)
 Internal: Handler stack size.
 
#define MSK_FIN   (0x0001)
 Bitmasks for control bit field handling.
 
#define MSK_SYN   (0x0002)
 Internal: Packet bitmask SYN.
 
#define MSK_RST   (0x0004)
 Internal: Packet bitmask RST.
 
#define MSK_PSH   (0x0008)
 Internal: Packet bitmask PSH.
 
#define MSK_ACK   (0x0010)
 Internal: Packet bitmask ACK.
 
#define MSK_URG   (0x0020)
 Internal: Packet bitmask URG.
 
#define MSK_FIN_ACK   (0x0011)
 Internal: Packet bitmask FIN & ACK.
 
#define MSK_SYN_ACK   (0x0012)
 Internal: Packet bitmask SYN & ACK.
 
#define MSK_RST_ACK   (0x0014)
 Internal: Packet bitmask RST & ACK.
 
#define MSK_SYN_FIN_ACK   (0x0013)
 Internal: Packet bitmask SYN & FIN & ACK.
 
#define MSK_FIN_ACK_PSH   (0x0019)
 Internal: Packet bitmask FIN & ACK & PSH.
 
#define MSK_CTL   (0x003F)
 Internal: Packet bitmask TCP status control bits.
 
#define MSK_OFFSET   (0xF000)
 Internal: Packet bitmask TCP status option offset.
 
#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)
 Internal: message id.
 
#define MSG_TYPE_USER_SPEC_TIMEOUT   (GNRC_NETAPI_MSG_TYPE_ACK + 103)
 Internal: message id.
 
#define MSG_TYPE_RETRANSMISSION   (GNRC_NETAPI_MSG_TYPE_ACK + 104)
 Internal: message id.
 
#define MSG_TYPE_TIMEWAIT   (GNRC_NETAPI_MSG_TYPE_ACK + 105)
 Internal: message id.
 
#define MSG_TYPE_NOTIFY_USER   (GNRC_NETAPI_MSG_TYPE_ACK + 106)
 Internal: message id.
 
#define LSS_32_BIT(x, y)   (((int32_t) (x)) - ((int32_t) (y)) < 0)
 Overflow tolerant comparison operators for sequence and acknowledgement number comparison.
 
#define LEQ_32_BIT(x, y)   (((int32_t) (x)) - ((int32_t) (y)) <= 0)
 Internal: operator <=.
 
#define GRT_32_BIT(x, y)   (!LEQ_32_BIT(x, y))
 Internal: operator >
 
#define GEQ_32_BIT(x, y)   (!LSS_32_BOT(x, y))
 Internal: operator >=.
 

Macro Definition Documentation

◆ GEQ_32_BIT

#define GEQ_32_BIT (   x,
 
)    (!LSS_32_BOT(x, y))

Internal: operator >=.

Definition at line 104 of file gnrc_tcp_common.h.

◆ GET_OFFSET

#define GET_OFFSET (   x)    (((x) & MSK_OFFSET) >> 12)

Extract offset value from "offctl" field in TCP header.

Definition at line 115 of file gnrc_tcp_common.h.

◆ GRT_32_BIT

#define GRT_32_BIT (   x,
 
)    (!LEQ_32_BIT(x, y))

Internal: operator >

Definition at line 103 of file gnrc_tcp_common.h.

◆ INSIDE_WND

#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.

Definition at line 110 of file gnrc_tcp_common.h.

◆ LEQ_32_BIT

#define LEQ_32_BIT (   x,
 
)    (((int32_t) (x)) - ((int32_t) (y)) <= 0)

Internal: operator <=.

Definition at line 102 of file gnrc_tcp_common.h.

◆ LSS_32_BIT

#define LSS_32_BIT (   x,
 
)    (((int32_t) (x)) - ((int32_t) (y)) < 0)

Overflow tolerant comparison operators for sequence and acknowledgement number comparison.

Internal: operator <

Definition at line 101 of file gnrc_tcp_common.h.

◆ MSG_TYPE_CONNECTION_TIMEOUT

#define MSG_TYPE_CONNECTION_TIMEOUT   (GNRC_NETAPI_MSG_TYPE_ACK + 101)

Message types for GNRC TCPs internal message passing.

Internal: message id

Definition at line 83 of file gnrc_tcp_common.h.

◆ MSG_TYPE_NOTIFY_USER

#define MSG_TYPE_NOTIFY_USER   (GNRC_NETAPI_MSG_TYPE_ACK + 106)

Internal: message id.

Definition at line 88 of file gnrc_tcp_common.h.

◆ MSG_TYPE_PROBE_TIMEOUT

#define MSG_TYPE_PROBE_TIMEOUT   (GNRC_NETAPI_MSG_TYPE_ACK + 102)

Internal: message id.

Definition at line 84 of file gnrc_tcp_common.h.

◆ MSG_TYPE_RETRANSMISSION

#define MSG_TYPE_RETRANSMISSION   (GNRC_NETAPI_MSG_TYPE_ACK + 104)

Internal: message id.

Definition at line 86 of file gnrc_tcp_common.h.

◆ MSG_TYPE_TIMEWAIT

#define MSG_TYPE_TIMEWAIT   (GNRC_NETAPI_MSG_TYPE_ACK + 105)

Internal: message id.

Definition at line 87 of file gnrc_tcp_common.h.

◆ MSG_TYPE_USER_SPEC_TIMEOUT

#define MSG_TYPE_USER_SPEC_TIMEOUT   (GNRC_NETAPI_MSG_TYPE_ACK + 103)

Internal: message id.

Definition at line 85 of file gnrc_tcp_common.h.

◆ MSK_ACK

#define MSK_ACK   (0x0010)

Internal: Packet bitmask ACK.

Definition at line 68 of file gnrc_tcp_common.h.

◆ MSK_CTL

#define MSK_CTL   (0x003F)

Internal: Packet bitmask TCP status control bits.

Definition at line 75 of file gnrc_tcp_common.h.

◆ MSK_FIN

#define MSK_FIN   (0x0001)

Bitmasks for control bit field handling.

Internal: Packet bitmask FIN

Definition at line 64 of file gnrc_tcp_common.h.

◆ MSK_FIN_ACK

#define MSK_FIN_ACK   (0x0011)

Internal: Packet bitmask FIN & ACK.

Definition at line 70 of file gnrc_tcp_common.h.

◆ MSK_FIN_ACK_PSH

#define MSK_FIN_ACK_PSH   (0x0019)

Internal: Packet bitmask FIN & ACK & PSH.

Definition at line 74 of file gnrc_tcp_common.h.

◆ MSK_OFFSET

#define MSK_OFFSET   (0xF000)

Internal: Packet bitmask TCP status option offset.

Definition at line 76 of file gnrc_tcp_common.h.

◆ MSK_PSH

#define MSK_PSH   (0x0008)

Internal: Packet bitmask PSH.

Definition at line 67 of file gnrc_tcp_common.h.

◆ MSK_RST

#define MSK_RST   (0x0004)

Internal: Packet bitmask RST.

Definition at line 66 of file gnrc_tcp_common.h.

◆ MSK_RST_ACK

#define MSK_RST_ACK   (0x0014)

Internal: Packet bitmask RST & ACK.

Definition at line 72 of file gnrc_tcp_common.h.

◆ MSK_SYN

#define MSK_SYN   (0x0002)

Internal: Packet bitmask SYN.

Definition at line 65 of file gnrc_tcp_common.h.

◆ MSK_SYN_ACK

#define MSK_SYN_ACK   (0x0012)

Internal: Packet bitmask SYN & ACK.

Definition at line 71 of file gnrc_tcp_common.h.

◆ MSK_SYN_FIN_ACK

#define MSK_SYN_FIN_ACK   (0x0013)

Internal: Packet bitmask SYN & FIN & ACK.

Definition at line 73 of file gnrc_tcp_common.h.

◆ MSK_URG

#define MSK_URG   (0x0020)

Internal: Packet bitmask URG.

Definition at line 69 of file gnrc_tcp_common.h.

◆ PORT_UNSPEC

#define PORT_UNSPEC   (0)

Port number unspecified.

See also
https://www.ietf.org/rfc/rfc1700.txt

Definition at line 39 of file gnrc_tcp_common.h.

◆ RTO_UNINITIALIZED

#define RTO_UNINITIALIZED   (-1)

Define for marking that time measurement is uninitialized.

Internal: Constant RTO uninitialized

Definition at line 94 of file gnrc_tcp_common.h.

◆ STATUS_ACCEPTED

#define STATUS_ACCEPTED   (1 << 3)

Internal: Status bitmask ACCEPTED.

Definition at line 48 of file gnrc_tcp_common.h.

◆ STATUS_ALLOW_ANY_ADDR

#define STATUS_ALLOW_ANY_ADDR   (1 << 1)

Internal: Status bitmask ALLOW_ANY_ADDR.

Definition at line 46 of file gnrc_tcp_common.h.

◆ STATUS_LISTENING

#define STATUS_LISTENING   (1 << 0)

TCB status flags.

Internal: Status bitmask LISTENING

Definition at line 45 of file gnrc_tcp_common.h.

◆ STATUS_LOCKED

#define STATUS_LOCKED   (1 << 4)

Internal: Status bitmask LOCKED.

Definition at line 49 of file gnrc_tcp_common.h.

◆ STATUS_NOTIFY_USER

#define STATUS_NOTIFY_USER   (1 << 2)

Internal: Status bitmask NOTIFY_USER.

Definition at line 47 of file gnrc_tcp_common.h.

◆ TCP_DEBUG_ENTER

#define TCP_DEBUG_ENTER
Value:
DEBUG("GNRC_TCP: Enter \"%s\", File: %s(%d)\n", \
DEBUG_FUNC, __FILE__, __LINE__)
#define DEBUG_FUNC
Contains the function name if given compiler supports it.
Definition debug.h:108
#define DEBUG(...)
Print debug information to stdout.
Definition debug.h:118

Helper macro used to create debug message on function entry.

Note
Compilation units using TCP_DEBUG_ENTER must set ENABLE_DEBUG and include debug.h.

Definition at line 122 of file gnrc_tcp_common.h.

◆ TCP_DEBUG_ERROR

#define TCP_DEBUG_ERROR (   msg)
Value:
DEBUG("GNRC_TCP: Error: \"%s\", Func: %s, File: %s(%d)\n", \
msg, DEBUG_FUNC, __FILE__, __LINE__)

Helper macro used to create debug message on error.

Note
Compilation units using TCP_DEBUG_ERROR must set ENABLE_DEBUG and include debug.h.

Definition at line 138 of file gnrc_tcp_common.h.

◆ TCP_DEBUG_INFO

#define TCP_DEBUG_INFO (   msg)
Value:
DEBUG("GNRC_TCP: Info: \"%s\", Func: %s, File: %s(%d)\n", \
msg, DEBUG_FUNC, __FILE__, __LINE__)

Helper macro used to create informational debug message.

Note
Compilation units using TCP_DEBUG_INFO must set ENABLE_DEBUG and include debug.h.

Definition at line 146 of file gnrc_tcp_common.h.

◆ TCP_DEBUG_LEAVE

#define TCP_DEBUG_LEAVE
Value:
DEBUG("GNRC_TCP: Leave \"%s\", File: %s(%d)\n", \
DEBUG_FUNC, __FILE__, __LINE__)

Helper macro used to create debug message on function exit.

Note
Compilation units using TCP_DEBUG_LEAVE must set ENABLE_DEBUG and include debug.h.

Definition at line 130 of file gnrc_tcp_common.h.

◆ TCP_EVENTLOOP_PRIO

#define TCP_EVENTLOOP_PRIO   (THREAD_PRIORITY_MAIN - 2U)

Defines for "eventloop" thread settings.

Internal: Handler priority

Definition at line 56 of file gnrc_tcp_common.h.

◆ TCP_EVENTLOOP_STACK_SIZE

#define TCP_EVENTLOOP_STACK_SIZE   (THREAD_STACKSIZE_DEFAULT)

Internal: Handler stack size.

Definition at line 57 of file gnrc_tcp_common.h.

Function Documentation

◆ _gnrc_tcp_common_get_tcb_list()

_gnrc_tcp_common_tcb_list_t * _gnrc_tcp_common_get_tcb_list ( void  )

Function to access to TCB list.

Returns
Pointer to global TCB list.