1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/sys/net/gnrc/routing/rpl/gnrc_rpl_auto_init.c

56 lines
1.5 KiB
C
Raw Normal View History

2016-05-14 12:46:14 +02:00
/*
* Copyright (C) 2016 Cenk Gündoğan <cenk.guendogan@haw-hamburg.de>
2016-05-14 12:46:14 +02:00
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*
*/
/*
2018-06-01 13:19:39 +02:00
* @ingroup net_gnrc_rpl
2016-05-14 12:46:14 +02:00
* @{
*
* @file
* @brief Auto initialization for gnrc_rpl
*
* @author Cenk Gündoğan <cenk.guendogan@haw-hamburg.de>
2016-05-14 12:46:14 +02:00
*/
#ifdef MODULE_AUTO_INIT_GNRC_RPL
#include "net/gnrc.h"
#include "net/gnrc/rpl.h"
#define ENABLE_DEBUG (0)
#include "debug.h"
void auto_init_gnrc_rpl(void)
{
#if (GNRC_NETIF_NUMOF == 1)
2017-11-16 18:06:46 +01:00
gnrc_netif_t *netif = gnrc_netif_iter(NULL);
assert(netif != NULL);
DEBUG("auto_init_gnrc_rpl: initializing RPL on interface %" PRIkernel_pid "\n",
netif->pid);
gnrc_rpl_init(netif->pid);
2016-05-14 12:46:14 +02:00
return;
#elif defined(GNRC_RPL_DEFAULT_NETIF)
2017-11-16 18:06:46 +01:00
if (gnrc_netif_get_by_pid(GNRC_RPL_DEFAULT_NETIF) != NULL) {
2016-05-14 12:46:14 +02:00
DEBUG("auto_init_gnrc_rpl: initializing RPL on interface %" PRIkernel_pid "\n",
GNRC_RPL_DEFAULT_NETIF);
gnrc_rpl_init(GNRC_RPL_DEFAULT_NETIF);
return;
}
DEBUG("auto_init_gnrc_rpl: could not initialize RPL on interface %" PRIkernel_pid" - "
"interface does not exist\n", GNRC_RPL_DEFAULT_NETIF);
return;
#else
DEBUG("auto_init_gnrc_rpl: please specify an interface by setting GNRC_RPL_DEFAULT_NETIF\n");
#endif
}
#else
typedef int dont_be_pedantic;
#endif /* MODULE_AUTO_INIT_GNRC_RPL */
/** @} */