Skip to content
Snippets Groups Projects
Commit 43de60da authored by Sebastian Meiling's avatar Sebastian Meiling
Browse files

net: add tcp_hdr_print

parent 4403cc93
No related branches found
No related tags found
No related merge requests found
...@@ -341,6 +341,7 @@ endif ...@@ -341,6 +341,7 @@ endif
ifneq (,$(filter gnrc_tcp,$(USEMODULE))) ifneq (,$(filter gnrc_tcp,$(USEMODULE)))
USEMODULE += inet_csum USEMODULE += inet_csum
USEMODULE += random USEMODULE += random
USEMODULE += tcp
USEMODULE += xtimer USEMODULE += xtimer
endif endif
......
...@@ -79,6 +79,9 @@ endif ...@@ -79,6 +79,9 @@ endif
ifneq (,$(filter udp,$(USEMODULE))) ifneq (,$(filter udp,$(USEMODULE)))
DIRS += net/transport_layer/udp DIRS += net/transport_layer/udp
endif endif
ifneq (,$(filter tcp,$(USEMODULE)))
DIRS += net/transport_layer/tcp
endif
ifneq (,$(filter hamming256,$(USEMODULE))) ifneq (,$(filter hamming256,$(USEMODULE)))
DIRS += ecc/hamming256 DIRS += ecc/hamming256
......
...@@ -75,6 +75,13 @@ typedef struct __attribute__((packed)) { ...@@ -75,6 +75,13 @@ typedef struct __attribute__((packed)) {
uint8_t value[]; /**< Pointer to TCP options Value field */ uint8_t value[]; /**< Pointer to TCP options Value field */
} tcp_hdr_opt_t; } tcp_hdr_opt_t;
/**
* @brief Print the given TCP header to STDOUT
*
* @param[in] hdr TCP header to print
*/
void tcp_hdr_print(tcp_hdr_t *hdr);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
include $(RIOTBASE)/Makefile.base
/*
* Copyright (C) 2017 HAW Hamburg
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @{
*
* @file
*
* @author smlng <s@mlng.net>
*/
#include <stdio.h>
#include <inttypes.h>
#include "net/tcp.h"
void tcp_hdr_print(tcp_hdr_t *hdr)
{
printf(" src-port: %5" PRIu16 " dst-port: %5" PRIu16 "\n",
byteorder_ntohs(hdr->src_port), byteorder_ntohs(hdr->dst_port));
printf(" seq-num: %10" PRIu32 " ack-num: %10" PRIu32 "\n",
byteorder_ntohl(hdr->seq_num), byteorder_ntohl(hdr->ack_num));
printf(" off_ctl: %5" PRIu16 " window: %5" PRIu16 "\n",
byteorder_ntohs(hdr->off_ctl), byteorder_ntohs(hdr->window));
printf(" cksum: 0x%04" PRIx16 " urgent_ptr: %5" PRIu16 "\n",
byteorder_ntohs(hdr->checksum), byteorder_ntohs(hdr->urgent_ptr));
}
/** @} */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment