Blame view

RIOT/sys/net/transport_layer/udp/udp_hdr_print.c 818 Bytes
a752c7ab   elopes   add first test an...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  /*
   * Copyright (C) 2015 Freie Universitรคt Berlin
   *
   * 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.
   */
  
  /**
   * @ingroup     net_pktdump
   * @{
   *
   * @file
   * @brief       Generic module to dump packages received via netapi to STDOUT
   *
   * @author      Hauke Petersen <hauke.petersen@fu-berlin.de>
   *
   * @}
   */
  
  #include <stdio.h>
  #include <inttypes.h>
  
  #include "net/udp.h"
  
  void udp_hdr_print(udp_hdr_t *hdr)
  {
      printf("   src-port: %5" PRIu16 "  dst-port: %5" PRIu16 "\n",
             byteorder_ntohs(hdr->src_port), byteorder_ntohs(hdr->dst_port));
      printf("   length: %" PRIu16 "  cksum: 0x%04" PRIx16 "\n",
             byteorder_ntohs(hdr->length), byteorder_ntohs(hdr->checksum));
  }