mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 22:43:50 +01:00
gnrc/rpl: add gnrc_rpl_configure_root() convenience function
This commit is contained in:
parent
3dad587307
commit
d99972791a
@ -736,6 +736,18 @@ static inline void gnrc_rpl_config_pio(gnrc_rpl_dodag_t *dodag, bool status)
|
||||
}
|
||||
}
|
||||
|
||||
#if IS_USED(MODULE_GNRC_RPL) || DOXYGEN
|
||||
/**
|
||||
* @brief Convenience function to start a RPL root using the default configuration.
|
||||
*
|
||||
* @param[in] netif Network interface to use as RPL root
|
||||
* @param[in] dodag_id Id of the DODAG
|
||||
*/
|
||||
void gnrc_rpl_configure_root(gnrc_netif_t *netif, const ipv6_addr_t *dodag_id);
|
||||
#else
|
||||
#define gnrc_rpl_configure_root(netif, dodag_id) ((void)netif)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -419,6 +419,18 @@ uint8_t gnrc_rpl_gen_instance_id(bool local)
|
||||
return instance_id;
|
||||
}
|
||||
|
||||
void gnrc_rpl_configure_root(gnrc_netif_t *netif, const ipv6_addr_t *dodag_id)
|
||||
{
|
||||
gnrc_rpl_init(netif->pid);
|
||||
gnrc_rpl_instance_t *inst = gnrc_rpl_instance_get(
|
||||
CONFIG_GNRC_RPL_DEFAULT_INSTANCE
|
||||
);
|
||||
if (inst) {
|
||||
gnrc_rpl_instance_remove(inst);
|
||||
}
|
||||
gnrc_rpl_root_init(CONFIG_GNRC_RPL_DEFAULT_INSTANCE, dodag_id, false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user