mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-16 18:13:49 +01:00
net: add tcp_hdr_print
This commit is contained in:
parent
4403cc931a
commit
43de60daf0
@ -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
|
|||||||
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)) {
|
|||||||
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
|
||||||
|
|||||||
1
sys/net/transport_layer/tcp/Makefile
Normal file
1
sys/net/transport_layer/tcp/Makefile
Normal file
@ -0,0 +1 @@
|
|||||||
|
include $(RIOTBASE)/Makefile.base
|
||||||
33
sys/net/transport_layer/tcp/tcp_hdr_print.c
Normal file
33
sys/net/transport_layer/tcp/tcp_hdr_print.c
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* 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));
|
||||||
|
}
|
||||||
|
/** @} */
|
||||||
Loading…
x
Reference in New Issue
Block a user