Blame view

RIOT/sys/net/routing/nhdp/nib_table.h 2.95 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
  /*
   * Copyright (C) 2014 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     nhdp
   * @{
   *
   * @file
   * @brief       Neighbor Information Base interface for NHDP
   *
   * @author      Fabian Nack <nack@inf.fu-berlin.de>
   */
  
  #ifndef NIB_TABLE_H_
  #define NIB_TABLE_H_
  
  #include "timex.h"
  
  #include "rfc5444/rfc5444_writer.h"
  
  #include "nhdp_address.h"
  
  #ifdef __cplusplus
  extern "C" {
  #endif
  
  /**
   * @brief   Neighbor Set entry (neighbor tuple)
   */
  typedef struct nib_entry {
      nhdp_addr_entry_t *address_list_head;   /**< Pointer to this tuple's addresses*/
      uint8_t symmetric;                      /**< Flag whether sym link to this nb exists */
      uint32_t metric_in;                     /**< Lowest metric value for incoming link */
      uint32_t metric_out;                    /**< Lowest metric value for outgoing link */
      struct nib_entry *next;                 /**< Pointer to next list entry */
  } nib_entry_t;
  
  /**
   * @brief   Lost Neighbor Set entry (lost neighbor tuple, lnt)
   */
  typedef struct nib_lost_address_entry {
      nhdp_addr_t *address;                   /**< Pointer to addr represented by this lnt */
      timex_t expiration_time;                /**< Time at which entry expires */
      struct nib_lost_address_entry *next;    /**< Pointer to next list entry */
  } nib_lost_address_entry_t;
  
  /**
   * @brief                   Process a received HELLO message in the NIB
   *
   * @note
   * Must not be called from outside the NHDP reader's message processing.
   *
   * @return                  Pointer to the new Neighbor Tuple
   * @return                  NULL on error
   */
  nib_entry_t *nib_process_hello(void);
  
  /**
   * @brief                   Add addresses to the currently constructed HELLO message
   *
   * @note
   * Must not be called from outside the NHDP writer's message creation process.
   *
   * @param[in] wr            The NHDP writer used for message construction
   */
  void nib_fill_wr_addresses(struct rfc5444_writer *wr);
  
  /**
   * @brief                   Remove a Neighbor Tuple
   *
   * @param[in] nib_entry     Pointer to the Neighbor Tuple
   */
  void nib_rem_nb_entry(nib_entry_t *nib_entry);
  
  /**
   * @brief                   Set a Neighbor Tuple's symmetry flag
   *
   * Removes all Lost Neighbor Tuples representing addresses included in the
   * Neighbor Tuple's address list.
   *
   * @param[in] nib_entry     Pointer to the Neighbor Tuple
   */
  void nib_set_nb_entry_sym(nib_entry_t *nib_entry);
  
  /**
   * @brief                   Reset a Neighbor Tuple's symmetry flag
   *
   * Adds a Lost Neighbor Tuple for every address in the Neighbor Tuple's
   * address list.
   *
   * @param[in] nib_entry     Pointer to the Neighbor Tuple
   * @param[in] now           Pointer to current time timex representation
   */
  void nib_reset_nb_entry_sym(nib_entry_t *nib_entry, timex_t *now);
  
  #ifdef __cplusplus
  }
  #endif
  
  #endif /* NIB_TABLE_H_ */
  /** @} */