Nanostack Border Router is a generic mbed border router implementation that provides the 6LoWPAN ND or Thread border router initialization logic.

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers cfg_parser.c Source File

cfg_parser.c

00001 /*
00002  * Copyright (c) 2016 ARM Limited. All rights reserved.
00003  */
00004 
00005 #include <string.h>
00006 #include "cfg_parser.h"
00007 
00008 const char *cfg_string(conf_t *conf, const char *key, const char *default_value)
00009 {
00010     for (; (conf && conf->name); conf++) {
00011         if (0 == strcmp(conf->name, key)) {
00012             return conf->svalue;
00013         }
00014     }
00015     return default_value;
00016 }
00017 
00018 int cfg_int(conf_t *conf, const char *key, int default_value)
00019 {
00020     for (; (conf && conf->name); conf++) {
00021         if (0 == strcmp(conf->name, key)) {
00022             return conf->ivalue;
00023         }
00024     }
00025     return default_value;
00026 }