Nanostack Border Router is a generic mbed border router implementation that provides the 6LoWPAN ND or Thread border router initialization logic.
Diff: source/cfg_parser.c
- Revision:
- 0:85f4174a8e29
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/source/cfg_parser.c Thu Mar 09 17:47:03 2017 +0000 @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016 ARM Limited. All rights reserved. + */ + +#include <string.h> +#include "cfg_parser.h" + +const char *cfg_string(conf_t *conf, const char *key, const char *default_value) +{ + for (; (conf && conf->name); conf++) { + if (0 == strcmp(conf->name, key)) { + return conf->svalue; + } + } + return default_value; +} + +int cfg_int(conf_t *conf, const char *key, int default_value) +{ + for (; (conf && conf->name); conf++) { + if (0 == strcmp(conf->name, key)) { + return conf->ivalue; + } + } + return default_value; +}