Contiki-NG
tsch-roots.h
1 /*
2  * Copyright (c) 2018, Amber Agriculture
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. Neither the name of the Institute nor the names of its contributors
13  * may be used to endorse or promote products derived from this software
14  * without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  *
28  */
29 /**
30  * \author Atis Elsts <atis.elsts@gmail.com>
31  */
32 
33 #ifndef __TSCH_ROOTS_H__
34 #define __TSCH_ROOTS_H__
35 
36 /**
37  * Add address as a potential RPL root that is a single-hop neighbor in the TSCH network.
38  * For now, only add addresses that send TSCH EB's with join priority set to zero.
39  *
40  * \param root_address - the address of the root.
41  */
42 void tsch_roots_add_address(const linkaddr_t *root_address);
43 
44 /**
45  * Set the root status of the local node
46  *
47  * \param is_root - if nonzero, the local node becomes root; otherwise, it ceases to be root
48  */
49 void tsch_roots_set_self_to_root(uint8_t is_root);
50 
51 /**
52  * Tests whether a given address belongs to a single-hop reachable root node in this network.
53  *
54  * \param address - the address to test
55  * \return nonzero if the address belongs to a root node that is a single hop neighbor;
56  * zero otherwise.
57  *
58  * Note: does not check if the address belongs to self, or to a root node more than a hop away!
59  */
60 int tsch_roots_is_root(const linkaddr_t *address);
61 
62 /**
63  * Initialize the list of RPL network roots.
64  */
65 void tsch_roots_init(void);
66 
67 #endif /* __TSCH_ROOTS_H__ */
void tsch_roots_add_address(const linkaddr_t *root_address)
Add address as a potential RPL root that is a single-hop neighbor in the TSCH network.
Definition: tsch-roots.c:168
int tsch_roots_is_root(const linkaddr_t *address)
Tests whether a given address belongs to a single-hop reachable root node in this network...
Definition: tsch-roots.c:176
void tsch_roots_init(void)
Initialize the list of RPL network roots.
Definition: tsch-roots.c:181
void tsch_roots_set_self_to_root(uint8_t is_root)
Set the root status of the local node.
Definition: tsch-roots.c:172