Contiki-NG
Toggle main menu visibility
Loading...
Searching...
No Matches
rpl-nbr-policy.c
1
/*
2
* Copyright (c) 2020, Yanzi Networks AB.
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 copyright holder nor the names of its
14
* contributors may be used to endorse or promote products derived
15
* from this software without specific prior written permission.
16
*
17
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
* COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
27
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28
* SUCH DAMAGE.
29
*
30
*/
31
32
/**
33
* \addtogroup uip
34
* @{
35
*/
36
37
#include "net/routing/rpl-lite/rpl.h"
38
#include "net/nbr-table.h"
39
#include "net/link-stats.h"
40
#include "
net/ipv6/uip-ds6-route.h
"
41
#include "
sys/log.h
"
42
43
#define LOG_MODULE "RPL-nbrpol"
44
#define LOG_LEVEL LOG_LEVEL_NONE
45
46
/*---------------------------------------------------------------------------*/
47
static
rpl_rank_t
48
get_rank(
const
linkaddr_t *lladdr)
49
{
50
rpl_parent_t *p =
rpl_neighbor_get_from_lladdr
((uip_lladdr_t *)lladdr);
51
if
(p == NULL) {
52
return
RPL_INFINITE_RANK;
53
}
else
{
54
return
curr_instance.of->rank_via_nbr(p);
55
}
56
}
57
/*---------------------------------------------------------------------------*/
58
const
linkaddr_t *
59
rpl_nbr_gc_get_worst(
const
linkaddr_t *lladdr1,
const
linkaddr_t *lladdr2)
60
{
61
return
get_rank(lladdr2) > get_rank(lladdr1) ? lladdr2 : lladdr1;
62
}
63
/*---------------------------------------------------------------------------*/
64
/** @}*/
rpl_neighbor_get_from_lladdr
rpl_nbr_t * rpl_neighbor_get_from_lladdr(uip_lladdr_t *addr)
Returns a neighbor from its link-layer address.
Definition
rpl-neighbor.c:212
log.h
Header file for the logging system.
uip-ds6-route.h
Header file for routing table manipulation.
os
net
routing
rpl-lite
rpl-nbr-policy.c
Generated on
for Contiki-NG by
1.17.0