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_of_manager.c

53 lines
1.3 KiB
C
Raw Normal View History

2015-05-22 21:47:37 +02:00
/*
* RPL dodag implementation
*
* Copyright (C) 2014 Freie Universität Berlin
*
* 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
2015-05-22 21:47:37 +02:00
* @{
* @file
* @brief RPL Objective functions manager
* @author Fabian Brandt <fabianbr@zedat.fu-berlin.de>
* @}
*/
#include "net/gnrc/rpl.h"
#include "net/gnrc/rpl/of_manager.h"
2015-05-22 21:47:37 +02:00
#include "of0.h"
2020-10-22 11:35:22 +02:00
#define ENABLE_DEBUG 0
2015-05-22 21:47:37 +02:00
#include "debug.h"
/* !!! TODO: port etx/mrhof to the new network stack */
static gnrc_rpl_of_t *objective_functions[GNRC_RPL_IMPLEMENTED_OFS_NUMOF];
2015-05-22 21:47:37 +02:00
void gnrc_rpl_of_manager_init(void)
2015-05-22 21:47:37 +02:00
{
/* insert new objective functions here */
objective_functions[0] = gnrc_rpl_get_of0();
/*objective_functions[1] = gnrc_rpl_get_of_mrhof(); */
2015-05-22 21:47:37 +02:00
}
/* find implemented OF via objective code point */
gnrc_rpl_of_t *gnrc_rpl_get_of_for_ocp(uint16_t ocp)
2015-05-22 21:47:37 +02:00
{
for (uint16_t i = 0; i < GNRC_RPL_IMPLEMENTED_OFS_NUMOF; i++) {
2015-05-22 21:47:37 +02:00
if (objective_functions[i] == NULL) {
/* fallback if something goes wrong */
return gnrc_rpl_get_of0();
2015-05-22 21:47:37 +02:00
}
else if (ocp == objective_functions[i]->ocp) {
return objective_functions[i];
}
}
return NULL;
}