Contiki-NG
Toggle main menu visibility
Loading...
Searching...
No Matches
rpl-border-router.c
1
/*
2
* Copyright (c) 2017, RISE SICS
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
#include "contiki.h"
34
#include "
net/routing/routing.h
"
35
#include "rpl-border-router.h"
36
37
/* Log configuration */
38
#include "
sys/log.h
"
39
#define LOG_MODULE "BR"
40
#define LOG_LEVEL LOG_LEVEL_INFO
41
42
uint8_t prefix_set;
43
44
/*---------------------------------------------------------------------------*/
45
void
46
print_local_addresses(
void
)
47
{
48
int
i;
49
uint8_t state;
50
51
LOG_INFO(
"Server IPv6 addresses:\n"
);
52
for
(i = 0; i < UIP_DS6_ADDR_NB; i++) {
53
state =
uip_ds6_if
.addr_list[i].state;
54
if
(
uip_ds6_if
.addr_list[i].isused &&
55
(state ==
ADDR_TENTATIVE
|| state == ADDR_PREFERRED)) {
56
LOG_INFO(
" "
);
57
LOG_INFO_6ADDR(&
uip_ds6_if
.addr_list[i].ipaddr);
58
LOG_INFO_(
"\n"
);
59
}
60
}
61
}
62
/*---------------------------------------------------------------------------*/
63
void
64
set_prefix_64(uip_ipaddr_t *prefix_64)
65
{
66
prefix_set = 1;
67
NETSTACK_ROUTING.root_set_prefix(prefix_64, NULL);
68
NETSTACK_ROUTING.root_start();
69
}
70
/*---------------------------------------------------------------------------*/
71
void
72
rpl_border_router_init(
void
)
73
{
74
PROCESS_NAME
(border_router_process);
75
process_start
(&border_router_process, NULL);
76
}
77
/*---------------------------------------------------------------------------*/
PROCESS_NAME
#define PROCESS_NAME(name)
Declare the name of a process.
Definition
process.h:288
process_start
void process_start(struct process *p, process_data_t data)
Start a process.
Definition
process.c:121
ADDR_TENTATIVE
#define ADDR_TENTATIVE
Possible states for the an address (RFC 4862).
Definition
uip-ds6.h:156
uip_ds6_if
uip_ds6_netif_t uip_ds6_if
The single interface.
Definition
uip-ds6.c:74
log.h
Header file for the logging system.
routing.h
Routing driver header file.
os
services
rpl-border-router
rpl-border-router.c
Generated on
for Contiki-NG by
1.17.0