Blame view

RIOT/sys/include/net/gnrc/rpl/srh.h 1.91 KB
fb11e647   vrobic   reseau statique a...
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
  /*
   * Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
   *
   * 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.
   */
  
  /**
   * @defgroup    net_gnrc_rpl_srh RPL source routing header extension
   * @ingroup     net_gnrc_rpl
   * @brief       Implementation of RPL source routing extension headers
   * @see <a href="https://tools.ietf.org/html/rfc6554">
   *          RFC 6554
   *      </a>
   * @{
   *
   * @file
   * @brief       Definititions for RPL source routing extension headers
   *
   * @author  Martine Lenders <mlenders@inf.fu-berlin.de>
   */
  #ifndef GNRC_RPL_SRH_H_
  #define GNRC_RPL_SRH_H_
  
  #include "net/ipv6/hdr.h"
  #include "net/ipv6/addr.h"
  
  #ifdef __cplusplus
  extern "C" {
  #endif
  
  /**
   * @brief   Type for source routing header.
   */
  #define GNRC_RPL_SRH_TYPE   (3U)
  
  /**
   * @brief   The RPL Source routing header.
   *
   * @see <a href="https://tools.ietf.org/html/rfc6554">
   *          RFC 6554
   *      </a>
   *
   * @extends ipv6_ext_rh_t
   */
  typedef struct __attribute__((packed)) {
      uint8_t nh;         /**< next header */
      uint8_t len;        /**< length in 8 octets without first octet */
      uint8_t type;       /**< identifier of a particular routing header type */
      uint8_t seg_left;   /**< number of route segments remaining */
      uint8_t compr;      /**< number of prefix octets (comprI and comprE) */
      uint8_t pad_resv;   /**< padding and reserved */
      uint16_t resv;      /**< reserved */
  } gnrc_rpl_srh_t;
  
  /**
   * @brief   Process the RPL source routing header.
   *
   * @param[in,out] ipv6  The IPv6 header of the incoming packet.
   * @param[in] rh        A RPL source routing header.
   *
   * @return  EXT_RH_CODE_ERROR
   * @return  EXT_RH_CODE_FORWARD
   * @return  EXT_RH_CODE_OK
   */
  int gnrc_rpl_srh_process(ipv6_hdr_t *ipv6, gnrc_rpl_srh_t *rh);
  
  #ifdef __cplusplus
  }
  #endif
  
  #endif /* GNRC_RPL_SRH_H_ */
  /** @} */