Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
e3da-public
contiki-ng
Commits
fe7ded07
Commit
fe7ded07
authored
Dec 13, 2017
by
Simon Duquennoy
Browse files
Routing API: add function node_has_joined
parent
177a68db
Changes
7
Hide whitespace changes
Inline
Side-by-side
os/net/routing/nullrouting/nullrouting.c
View file @
fe7ded07
...
...
@@ -82,6 +82,12 @@ leave_network(void)
}
/*---------------------------------------------------------------------------*/
static
int
node_has_joined
(
void
)
{
return
1
;
}
/*---------------------------------------------------------------------------*/
static
int
node_is_reachable
(
void
)
{
return
1
;
...
...
@@ -151,6 +157,7 @@ const struct routing_driver nullrouting_driver = {
get_root_ipaddr
,
get_sr_node_ipaddr
,
leave_network
,
node_has_joined
,
node_is_reachable
,
global_repair
,
local_repair
,
...
...
os/net/routing/routing.h
View file @
fe7ded07
...
...
@@ -93,6 +93,12 @@ struct routing_driver {
*
*/
void
(
*
leave_network
)(
void
);
/**
* Tells whether the node is currently part of a network
*
* \return 1 if we have joined a network, 0 otherwise.
*/
int
(
*
node_has_joined
)(
void
);
/**
* Tells whether the node is currently reachable as part of the network
*
...
...
os/net/routing/rpl-classic/rpl-dag.c
View file @
fe7ded07
...
...
@@ -1006,6 +1006,12 @@ rpl_move_parent(rpl_dag_t *dag_src, rpl_dag_t *dag_dst, rpl_parent_t *parent)
}
/*---------------------------------------------------------------------------*/
int
rpl_has_joined
(
void
)
{
return
rpl_get_any_dag
()
!=
NULL
;
}
/*---------------------------------------------------------------------------*/
int
rpl_has_downward_route
(
void
)
{
int
i
;
...
...
os/net/routing/rpl-classic/rpl.c
View file @
fe7ded07
...
...
@@ -423,6 +423,7 @@ const struct routing_driver rpl_classic_driver = {
get_root_ipaddr
,
get_sr_node_ipaddr
,
leave_network
,
rpl_has_joined
,
rpl_has_downward_route
,
global_repair
,
local_repair
,
...
...
os/net/routing/rpl-classic/rpl.h
View file @
fe7ded07
...
...
@@ -327,6 +327,12 @@ enum rpl_mode rpl_set_mode(enum rpl_mode mode);
*/
enum
rpl_mode
rpl_get_mode
(
void
);
/**
* Tells whether the node has joined a network or not
*
* \retval 1 if we have joined a network, 0 if not.
*/
int
rpl_has_joined
(
void
);
/**
* Get the RPL's best guess on if we have downward route or not.
...
...
os/net/routing/rpl-lite/rpl.c
View file @
fe7ded07
...
...
@@ -109,6 +109,12 @@ rpl_link_callback(const linkaddr_t *addr, int status, int numtx)
}
/*---------------------------------------------------------------------------*/
int
rpl_has_joined
(
void
)
{
return
curr_instance
.
used
&&
curr_instance
.
dag
.
state
>=
DAG_JOINED
;
}
/*---------------------------------------------------------------------------*/
int
rpl_is_reachable
(
void
)
{
return
curr_instance
.
used
&&
curr_instance
.
dag
.
state
==
DAG_REACHABLE
;
...
...
@@ -226,6 +232,7 @@ const struct routing_driver rpl_lite_driver = {
rpl_dag_get_root_ipaddr
,
get_sr_node_ipaddr
,
rpl_dag_poison_and_leave
,
rpl_has_joined
,
rpl_is_reachable
,
rpl_global_repair
,
rpl_local_repair
,
...
...
tests/07-simulation-base/code-slip-radio/wait-dag.c
View file @
fe7ded07
...
...
@@ -49,7 +49,7 @@ AUTOSTART_PROCESSES(&wait_for_dag);
static
void
timeout_handler
(
void
)
{
if
(
NETSTACK_ROUTING
.
node_
is_reachable
())
{
if
(
NETSTACK_ROUTING
.
node_
has_joined
())
{
PRINTF
(
"DAG Found
\n
"
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment