Loading...
Searching...
No Matches
gnrc_tcp_option.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 "assert.h"
21#include "net/tcp.h"
22#include "net/gnrc/tcp/tcb.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
35static inline uint32_t _gnrc_tcp_option_build_mss(uint16_t mss)
36{
37 return (((uint32_t) TCP_OPTION_KIND_MSS << 24) |
38 ((uint32_t) TCP_OPTION_LENGTH_MSS << 16) | mss);
39}
40
49static inline uint16_t _gnrc_tcp_option_build_offset_control(uint16_t nopts, uint16_t ctl)
50{
51 assert(TCP_HDR_OFFSET_MIN <= nopts && nopts <= TCP_HDR_OFFSET_MAX);
52 return (nopts << 12) | ctl;
53}
54
65
66#ifdef __cplusplus
67}
68#endif
69
POSIX.1-2008 compliant version of the assert macro.
#define assert(cond)
abort the program if assertion is false
Definition assert.h:143
int _gnrc_tcp_option_parse(gnrc_tcp_tcb_t *tcb, tcp_hdr_t *hdr)
Parses options of a given TCP header.
static uint32_t _gnrc_tcp_option_build_mss(uint16_t mss)
Helper function to build the MSS option.
static uint16_t _gnrc_tcp_option_build_offset_control(uint16_t nopts, uint16_t ctl)
Helper function to build the combined option and control flag field.
#define TCP_OPTION_KIND_MSS
"Maximum Segment Size"-Option
Definition tcp.h:41
#define TCP_OPTION_LENGTH_MSS
MSS Option Size always 4.
Definition tcp.h:49
#define TCP_HDR_OFFSET_MAX
Header offset maximum value.
Definition tcp.h:32
#define TCP_HDR_OFFSET_MIN
TCP offset value boundaries.
Definition tcp.h:31
TCP header definition.
Definition tcp.h:55
GNRC TCP transmission control block (TCB)
struct sock_tcp gnrc_tcp_tcb_t
Transmission control block of GNRC TCP.
TCP header and helper functions.