mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
more changes for new configuration file parser
git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@24 8ec27952-4edc-4aab-86aa-e87bb2611832
This commit is contained in:
parent
4022a631b9
commit
332e09e24e
2 changed files with 47 additions and 19 deletions
|
@ -1,21 +1,55 @@
|
|||
/**
|
||||
* Configuration parser
|
||||
*
|
||||
* @author Steffen Vogel <steffen.vogel@rwth-aachen.de>
|
||||
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
|
||||
* @copyright 2014, Institute for Automation of Complex Power Systems, EONERC
|
||||
*/
|
||||
|
||||
#ifndef _CONFIG_H_
|
||||
#define _CONFIG_H_
|
||||
#ifndef _CFG_H_
|
||||
#define _CFG_H_
|
||||
|
||||
#include <libconfig.h>
|
||||
|
||||
#include "path.h"
|
||||
#include "node.h"
|
||||
|
||||
int config_parse(config_t *c, const char *filename, struct path *paths, struct node *nodes);
|
||||
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;
|
||||
|
||||
int config_parse_path(config_setting_t *c, struct path *p);
|
||||
int config_parse_node(config_setting_t *c, struct node *n);
|
||||
/// libconfig object
|
||||
config_t obj;
|
||||
|
||||
#endif /* _CONFIG_H_ */
|
||||
/// 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_ */
|
||||
|
|
|
@ -10,23 +10,17 @@
|
|||
|
||||
/// The version number of the s2ss server
|
||||
#define VERSION __GIT_TAG__ "-" __GIT_REV__
|
||||
/// The Procotol version determines the format of a struct msg
|
||||
#define PROTOCOL 0
|
||||
/// The name of this node
|
||||
#define NAME "acs"
|
||||
|
||||
#define PRIORITY sched_get_priority_max(SCHED_FIFO)
|
||||
#define CORES ((1 << 6) | (1 << 7))
|
||||
|
||||
/// Maximum number of double values in a struct msg
|
||||
#define MAX_VALUES 4
|
||||
#define MAX_VALUES 6
|
||||
|
||||
/// Maximum number of registrable hook functions per path
|
||||
#define MAX_HOOKS 5
|
||||
/// Maximum number of paths
|
||||
#define MAX_PATHS 2
|
||||
/// Maximum number of nodes
|
||||
#define MAX_NODES 2
|
||||
|
||||
/// Size of the stack which gets prefaulted during initialization
|
||||
#define MAX_SAFE_STACK (16*1024) /* 16 KiB */
|
||||
|
||||
/// Socket priority
|
||||
#define SOCKET_PRIO 7
|
||||
|
||||
#endif /* _CONFIG_H_ */
|
||||
|
|
Loading…
Add table
Reference in a new issue