Contiki-NG
rpl-ext-header.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017, Inria.
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 
32 /**
33  * \addtogroup rpl-lite
34  * @{
35  *
36  * \file
37  * Header file for rpl-ext-header
38  *
39  * \author Simon Duquennoy <simon.duquennoy@inria.fr>
40  */
41 
42  #ifndef RPL_EXT_HEADER_H_
43  #define RPL_EXT_HEADER_H_
44 
45 /********** Public functions **********/
46 
47 /**
48 * Look for next hop from SRH of current uIP packet.
49 *
50 * \param ipaddr A pointer to the address where to store the next hop.
51 * \return 1 if a next hop was found, 0 otherwise
52 */
53 int rpl_ext_header_srh_get_next_hop(uip_ipaddr_t *ipaddr);
54 
55 /**
56 * Process and update SRH in-place,
57 * i.e. internal address swapping as per RFC6554
58 * \return 1 if SRH found, 0 otherwise
59 */
61 
62 /**
63 * Process and update the RPL hop-by-hop extension headers of
64 * the current uIP packet.
65 *
66 * \param ext_buf A pointer to the ext header buffer
67 * \param opt_offset The offset within the extension header where
68 * the option starts
69 * \return 1 in case the packet is valid and to be processed further,
70 * 0 in case the packet must be dropped.
71 */
72 int rpl_ext_header_hbh_update(uint8_t *ext_buf, int opt_offset);
73 
74 /**
75  * Adds/updates all RPL extension headers to current uIP packet.
76  *
77  * \return 1 in case of success, 0 otherwise
78 */
79 int rpl_ext_header_update(void);
80 
81 /**
82  * Removes all RPL extension headers.
83  *
84  * \return true in case of success, false otherwise
85 */
86 bool rpl_ext_header_remove(void);
87 
88  /** @} */
89 
90 #endif /* RPL_EXT_HEADER_H_ */
static uip_ipaddr_t ipaddr
Pointer to prefix information option in uip_buf.
Definition: uip-nd6.c:116
int rpl_ext_header_srh_get_next_hop(uip_ipaddr_t *ipaddr)
Look for next hop from SRH of current uIP packet.
int rpl_ext_header_update(void)
Adds/updates all RPL extension headers to current uIP packet.
int rpl_ext_header_hbh_update(uint8_t *ext_buf, int opt_offset)
Process and update the RPL hop-by-hop extension headers of the current uIP packet.
bool rpl_ext_header_remove(void)
Removes all RPL extension headers.
int rpl_ext_header_srh_update(void)
Process and update SRH in-place, i.e.