Loading...
Searching...
No Matches
tcp.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
20
21#include "byteorder.h"
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
31#define TCP_HDR_OFFSET_MIN (0x05)
32#define TCP_HDR_OFFSET_MAX (0x0F)
34
39#define TCP_OPTION_KIND_EOL (0x00)
40#define TCP_OPTION_KIND_NOP (0x01)
41#define TCP_OPTION_KIND_MSS (0x02)
43
48#define TCP_OPTION_LENGTH_MIN (2U)
49#define TCP_OPTION_LENGTH_MSS (0x04)
51
65
69typedef struct __attribute__((packed)) {
70 uint8_t kind;
71 uint8_t length;
72 uint8_t value[];
74
81
82#ifdef __cplusplus
83}
84#endif
85
Functions to work with different byte orders.
be_uint32_t network_uint32_t
A 32 bit integer in network byte order.
Definition byteorder.h:109
be_uint16_t network_uint16_t
A 16 bit integer in network byte order.
Definition byteorder.h:104
void tcp_hdr_print(tcp_hdr_t *hdr)
Print the given TCP header to STDOUT.
TCP option field helper structure.
Definition tcp.h:69
uint8_t value[]
TCP options "Value" field.
Definition tcp.h:72
uint8_t kind
TCP options "Kind" field.
Definition tcp.h:70
uint8_t length
TCP options "Length" field.
Definition tcp.h:71
TCP header definition.
Definition tcp.h:55
network_uint16_t dst_port
Destination port, in network byte order.
Definition tcp.h:57
network_uint16_t src_port
Source port, in network byte order.
Definition tcp.h:56
network_uint32_t ack_num
Acknowledgement number, in network byte order.
Definition tcp.h:59
network_uint16_t urgent_ptr
Urgent pointer, in network byte order.
Definition tcp.h:63
network_uint32_t seq_num
Sequence number, in network byte order.
Definition tcp.h:58
network_uint16_t window
Window, in network byte order.
Definition tcp.h:61
network_uint16_t checksum
Checksum, in network byte order.
Definition tcp.h:62
network_uint16_t off_ctl
Data Offset and control Bits in network byte order.
Definition tcp.h:60