Loading...
Searching...
No Matches
gnrc_tcp_option.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015-2017 Simon Brummer
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
20#ifndef GNRC_TCP_OPTION_H
21#define GNRC_TCP_OPTION_H
22
23#include <stdint.h>
24#include "assert.h"
25#include "net/tcp.h"
26#include "net/gnrc/tcp/tcb.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
39static inline uint32_t _gnrc_tcp_option_build_mss(uint16_t mss)
40{
41 return (((uint32_t) TCP_OPTION_KIND_MSS << 24) |
42 ((uint32_t) TCP_OPTION_LENGTH_MSS << 16) | mss);
43}
44
53static inline uint16_t _gnrc_tcp_option_build_offset_control(uint16_t nopts, uint16_t ctl)
54{
55 assert(TCP_HDR_OFFSET_MIN <= nopts && nopts <= TCP_HDR_OFFSET_MAX);
56 return (nopts << 12) | ctl;
57}
58
69
70#ifdef __cplusplus
71}
72#endif
73
74#endif /* GNRC_TCP_OPTION_H */
POSIX.1-2008 compliant version of the assert macro.
#define assert(cond)
abort the program if assertion is false
Definition assert.h:136
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:45
#define TCP_OPTION_LENGTH_MSS
MSS Option Size always 4.
Definition tcp.h:53
#define TCP_HDR_OFFSET_MAX
Header offset maximum value.
Definition tcp.h:36
#define TCP_HDR_OFFSET_MIN
TCP offset value boundaries.
Definition tcp.h:35
TCP sock type.
Definition sock_types.h:101
TCP header definition.
Definition tcp.h:59
GNRC TCP transmission control block (TCB)
TCP header and helper functions.