Blame view

RIOT/sys/include/net/gnrc/rpl/dodag.h 4.7 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
  /*
   * Copyright (C) 2013  INRIA.
   * Copyright (C) 2015 Cenk Gündoğan <cnkgndgn@gmail.com>
   *
   * 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_gnrc_rpl
   * @{
   *
   * @file
   * @brief       DODAG-related functions for RPL
   *
   * Header file, which defines all public known DODAG-related functions for RPL.
   *
   * @author      Eric Engel <eric.engel@fu-berlin.de>
   * @author      Cenk Gündoğan <cnkgndgn@gmail.com>
   */
  
  #ifndef GNRC_RPL_DODAG_H_
  #define GNRC_RPL_DODAG_H_
  
  #ifdef __cplusplus
  extern "C" {
  #endif
  
  #include "net/ipv6/addr.h"
  #include "trickle.h"
  #include "net/gnrc/rpl.h"
  #include "net/gnrc/rpl/structs.h"
  
  /**
   * @brief   Number of RPL instances
   */
  #ifndef GNRC_RPL_INSTANCES_NUMOF
  #define GNRC_RPL_INSTANCES_NUMOF (1)
  #endif
  
  /**
   * @brief   Number of RPL parents
   */
  #ifndef GNRC_RPL_PARENTS_NUMOF
  #define GNRC_RPL_PARENTS_NUMOF (3)
  #endif
  
  /**
   * @brief   RPL instance table
   */
  extern gnrc_rpl_instance_t gnrc_rpl_instances[GNRC_RPL_INSTANCES_NUMOF];
  
  /**
   * @brief   RPL parent table
   */
  extern gnrc_rpl_parent_t gnrc_rpl_parents[GNRC_RPL_PARENTS_NUMOF];
  
  /**
   * @brief   Add a new RPL instance with the id @p instance_id.
   *
   * @param[in]   instance_id     The instance id of the new RPL instance.
   * @param[out]  inst            Pointer to an existing or new instance. Otherwise NULL.
   *
   * @return  true, if instance could be created.
   * @return  false, if instance could not be created or exists already.
   */
  bool gnrc_rpl_instance_add(uint8_t instance_id, gnrc_rpl_instance_t **inst);
  
  /**
   * @brief   Remove a RPL instance with the id @p instance_id.
   *
   * @param[in] instance_id     The instance id of the RPL instance to remove.
   *
   * @return  true, on success.
   * @return  false, otherwise.
   */
  bool gnrc_rpl_instance_remove_by_id(uint8_t instance_id);
  
  /**
   * @brief   Remove a RPL instance with the pointer @p inst.
   *
   * @param[in] inst     Pointer to the the RPL instance to remove.
   *
   * @return  true, on success.
   * @return  false, otherwise.
   */
  bool gnrc_rpl_instance_remove(gnrc_rpl_instance_t *inst);
  
  /**
   * @brief   Get the RPL instance with the id @p instance_id.
   *
   * @param[in] instance_id     The instance id of the RPL instance to get.
   *
   * @return  Pointer to the RPL instance, on success.
   * @return  NULL, otherwise.
   */
  gnrc_rpl_instance_t *gnrc_rpl_instance_get(uint8_t instance_id);
  
  /**
   * @brief   Initialize a new RPL DODAG with the id @p dodag_id for the instance @p instance.
   *
   * @param[in]   instance        Pointer to the instance to add the DODAG to
   * @param[in]   dodag_id        The DODAG-ID of the new DODAG
   * @param[in]   iface           Interface PID where the DODAG operates
   * @param[in]   netif_addr      netif address for this DODAG
   *
   * @return  true, if DODAG could be created.
   * @return  false, if DODAG could not be created or exists already.
   */
  bool gnrc_rpl_dodag_init(gnrc_rpl_instance_t *instance, ipv6_addr_t *dodag_id, kernel_pid_t iface,
                           gnrc_ipv6_netif_addr_t *netif_addr);
  
  /**
   * @brief   Remove all parents from the @p dodag.
   *
   * @param[in] dodag     Pointer to the dodag.
   */
  void gnrc_rpl_dodag_remove_all_parents(gnrc_rpl_dodag_t *dodag);
  
  /**
   * @brief   Add a new parent with the IPv6 address @p addr to the @p dodag.
   *
   * @param[in]   dodag           Pointer to the DODAG
   * @param[in]   addr            IPV6 address of the parent
   * @param[out]  parent          Pointer to an existing or new parent. Otherwise NULL.
   *
   * @return  true. if parent could be created.
   * @return  false, if parent could not be created or exists already.
   */
  bool gnrc_rpl_parent_add_by_addr(gnrc_rpl_dodag_t *dodag, ipv6_addr_t *addr,
                                   gnrc_rpl_parent_t **parent);
  
  /**
   * @brief   Remove the @p parent from its DODAG.
   *
   * @param[in] parent     Pointer to the parent.
   *
   * @return  true, on success.
   * @return  false, otherwise.
   */
  bool gnrc_rpl_parent_remove(gnrc_rpl_parent_t *parent);
  
  /**
   * @brief   Update a @p parent of the @p dodag.
   *
   * @param[in] dodag     Pointer to the DODAG
   * @param[in] parent    Pointer to the parent
   */
  void gnrc_rpl_parent_update(gnrc_rpl_dodag_t *dodag, gnrc_rpl_parent_t *parent);
  
  /**
   * @brief   Start a local repair.
   *
   * @param[in] dodag     Pointer to the DODAG
   */
  void gnrc_rpl_local_repair(gnrc_rpl_dodag_t *dodag);
  
  /**
   * @brief   Operate as leaf.
   *
   * @param[in] dodag     Pointer to the DODAG
   */
  void gnrc_rpl_leaf_operation(gnrc_rpl_dodag_t *dodag);
  
  /**
   * @brief   Operate as router.
   *
   * @param[in] dodag     Pointer to the DODAG
   */
  void gnrc_rpl_router_operation(gnrc_rpl_dodag_t *dodag);
  #ifdef __cplusplus
  }
  #endif
  
  #endif /* GNRC_RPL_DODAG_H_ */
  /**
   * @}
   */