Contiki-NG
Loading...
Searching...
No Matches
rpl.h
1/*
2 * Copyright (c) 2010, Swedish Institute of Computer Science.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the Institute nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * This file is part of the Contiki operating system.
30 *
31 * \ingroup routing
32 * \addtogroup rpl-lite
33 RPL-lite is a lightweight implementation of RPL tailored for reliability.
34 Supports only non-storing mode, one instance and one DAG.
35 * @{
36 *
37 * \file
38 * Public API declarations for RPL.
39 * \author
40 * Joakim Eriksson <joakime@sics.se> & Nicolas Tsiftes <nvt@sics.se>
41 * Simon Duquennoy <simon.duquennoy@inria.fr>
42 *
43 */
44
45#ifndef RPL_H
46#define RPL_H
47
48/********** Includes **********/
49
50#include "net/ipv6/uip.h"
54
55/********** Public symbols **********/
56
57/* The only instance */
58extern rpl_instance_t curr_instance;
59/* The RPL multicast address (used for DIS and DIO) */
60extern uip_ipaddr_t rpl_multicast_addr;
61
62/********** More Includes **********/
63
70
71/********** Public functions **********/
72
73/**
74 * Called by lower layers after every packet transmission
75 *
76 * \param addr The link-layer addrress of the packet destination
77 * \param status The transmission status (see os/net/mac/mac.h)
78 * \param numtx The total number of transmission attempts
79 */
80void rpl_link_callback(const linkaddr_t *addr, int status, int numtx);
81
82/**
83 * Set prefix from an prefix data structure (from DIO)
84 *
85 * \param prefix The prefix
86 * \return 1 if success, 0 otherwise
87 */
88int rpl_set_prefix(rpl_prefix_t *prefix);
89/**
90* Set prefix from an IPv6 address
91*
92* \param addr The prefix
93* \param len The prefix length
94* \param flags The DIO prefix flags
95* \return 1 if success, 0 otherwise
96*/
97
98int rpl_set_prefix_from_addr(uip_ipaddr_t *addr, unsigned len, uint8_t flags);
99
100/**
101 * Removes current prefx
102 *
103 * \param last_prefix The last prefix (which is to be removed)
104 */
105void rpl_reset_prefix(rpl_prefix_t *last_prefix);
106
107/**
108 * Get one of the node's global addresses
109 *
110 * \return A (constant) pointer to the global IPv6 address found.
111 * The pointer directs to the internals of DS6, should only be used
112 * in the current function's local scope
113 */
114const uip_ipaddr_t *rpl_get_global_address(void);
115
116/**
117 * Get the RPL's best guess on if we are reachable via have downward route or not.
118 *
119 * \return 1 if we are reachable, 0 otherwise.
120 */
121int rpl_is_reachable(void);
122
123/**
124 * Greater-than function for a lollipop counter
125 *
126 * \param a The first counter
127 * \param b The second counter
128 * \return 1 is a>b else 0
129 */
130int rpl_lollipop_greater_than(int a, int b);
131
132/**
133 * Triggers a route fresh via DTSN increment
134 *
135 * \param str a textual description of the cause for refresh
136 */
137void rpl_refresh_routes(const char *str);
138
139/**
140 * Changes the value of the rpl_leaf_only flag, which determines if a node acts
141 * only as a leaf in the network
142 *
143 * \param value the value to set: 0-disable, 1-enable
144 */
145void rpl_set_leaf_only(uint8_t value);
146
147/**
148 * Get the value of the rpl_leaf_only flag
149 *
150 * \return The value of the rpl_leaf_only flag
151 */
152uint8_t rpl_get_leaf_only(void);
153
154#endif /* RPL_H */
int rpl_is_reachable(void)
Get the RPL's best guess on if we are reachable via have downward route or not.
Definition rpl.c:127
void rpl_set_leaf_only(uint8_t value)
Changes the value of the rpl_leaf_only flag, which determines if a node acts only as a leaf in the ne...
Definition rpl.c:236
uint8_t rpl_get_leaf_only(void)
Get the value of the rpl_leaf_only flag.
Definition rpl.c:242
int rpl_lollipop_greater_than(int a, int b)
Greater-than function for a lollipop counter.
Definition rpl.c:57
void rpl_reset_prefix(rpl_prefix_t *last_prefix)
Removes current prefx.
Definition rpl.c:141
int rpl_set_prefix_from_addr(uip_ipaddr_t *addr, unsigned len, uint8_t flags)
Set prefix from an IPv6 address.
Definition rpl.c:157
const uip_ipaddr_t * rpl_get_global_address(void)
Get one of the node's global addresses.
Definition rpl.c:71
void rpl_refresh_routes(const char *str)
Triggers a route fresh via DTSN increment.
Definition rpl-dag.c:189
void rpl_link_callback(const linkaddr_t *addr, int status, int numtx)
Called by lower layers after every packet transmission.
Definition rpl.c:265
Constants for RPL.
Header file for rpl-dag module.
Header file for rpl-ext-header.
Header file for rpl-ext-header.
Public configuration and API declarations for ContikiRPL.
DAG root utility functions for RPL.
Header file for rpl-neighbor module.
Header file for rpl-timers module.
RPL types and macros.
RPL instance structure.
Definition rpl.h:222
RPL prefix information.
Definition rpl.h:128
static uip_ds6_addr_t * addr
Pointer to a nbr cache entry.
Definition uip-nd6.c:107
Header file for the uIP TCP/IP stack.