mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-30 00:00:11 +01:00
git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@24 8ec27952-4edc-4aab-86aa-e87bb2611832
55 lines
1.2 KiB
C
55 lines
1.2 KiB
C
/**
|
|
* Configuration parser
|
|
*
|
|
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
|
|
* @copyright 2014, Institute for Automation of Complex Power Systems, EONERC
|
|
*/
|
|
|
|
#ifndef _CFG_H_
|
|
#define _CFG_H_
|
|
|
|
#include <libconfig.h>
|
|
|
|
#include "path.h"
|
|
#include "node.h"
|
|
|
|
struct config {
|
|
/// Name of this node
|
|
const char *name;
|
|
/// Configuration filename
|
|
const char *filename;
|
|
/// Verbosity level
|
|
int debug;
|
|
/// Task priority (lower is better)
|
|
int nice;
|
|
/// Core affinity of this task
|
|
int affinity;
|
|
/// Protocol version of UDP packages
|
|
int protocol;
|
|
/// Number of parsed paths
|
|
int path_count, node_count;
|
|
|
|
/// libconfig object
|
|
config_t obj;
|
|
|
|
/// Array of nodes
|
|
struct node *nodes;
|
|
/// Array of paths
|
|
struct path *paths;
|
|
};
|
|
|
|
/**
|
|
* @brief Parse configuration file and store settings in suplied struct
|
|
*
|
|
* @param c A libconfig object
|
|
* @param g The global configuration structure (also contains the config filename)
|
|
*/
|
|
int config_parse(config_t *c, struct config *g);
|
|
|
|
int config_parse_global(config_setting_t *c, struct config *g);
|
|
|
|
int config_parse_path(config_setting_t *c, struct config *g);
|
|
|
|
int config_parse_node(config_setting_t *c, struct config *g);
|
|
|
|
#endif /* _CFG_H_ */
|