diff --git a/server/include/cfg.h b/server/include/cfg.h index 04979c71d..73200ab1d 100644 --- a/server/include/cfg.h +++ b/server/include/cfg.h @@ -24,21 +24,7 @@ struct socket; struct opal; struct gtfpga; struct netem; - -/** Global configuration */ -struct settings { - /** Process priority (lower is better) */ - int priority; - /** Process affinity of the server and all created threads */ - int affinity; - /** Debug log level */ - int debug; - /** Interval for path statistics. Set to 0 to disable themo disable them. */ - double stats; - - /** A libconfig object pointing to the root of the config file */ - config_setting_t *cfg; -}; +struct settings; /** Parse config file and store settings in supplied struct settings. * diff --git a/server/include/config.h b/server/include/config.h index bf548b0ab..e94e66df4 100644 --- a/server/include/config.h +++ b/server/include/config.h @@ -12,26 +12,43 @@ #define _CONFIG_H_ #ifndef _GIT_REV - #define _GIT_REV "nogit" + #define _GIT_REV "nogit" #endif /** The version number of the s2ss server */ -#define VERSION "v0.4-" _GIT_REV +#define VERSION "v0.4-" _GIT_REV /** Maximum number of float values in a message */ -#define MAX_VALUES 16 +#define MAX_VALUES 16 /** Maximum number of messages in the circular history buffer */ -#define POOL_SIZE 16 +#define DEFAULT_POOLSIZE 32 /** Width of log output in characters */ -#define LOG_WIDTH 100 +#define LOG_WIDTH 100 /** Socket priority */ -#define SOCKET_PRIO 7 +#define SOCKET_PRIO 7 /* Protocol numbers */ -#define IPPROTO_S2SS 137 -#define ETH_P_S2SS 0xBABE +#define IPPROTO_S2SS 137 +#define ETH_P_S2SS 0xBABE + +/* Hook function configuration */ +#define HOOK_FIR_INDEX 1 /**< The first value of message should be filtered. */ +#define HOOK_TS_INDEX -1 /**< The last value of message should be overwritten by a timestamp. */ +#define HOOK_DECIMATE_RATIO 30 /**< Only forward every 10th message to the destination nodes. */ + +/** Global configuration */ +struct settings { + /** Process priority (lower is better) */ + int priority; + /** Process affinity of the server and all created threads */ + int affinity; + /** Debug log level */ + int debug; + /** Interval for path statistics. Set to 0 to disable themo disable them. */ + double stats; +}; #endif /* _CONFIG_H_ */ diff --git a/server/src/cfg.c b/server/src/cfg.c index 819897602..cb705cedd 100644 --- a/server/src/cfg.c +++ b/server/src/cfg.c @@ -86,7 +86,7 @@ int config_parse_global(config_setting_t *cfg, struct settings *set) config_setting_lookup_int(cfg, "debug", &set->debug); config_setting_lookup_float(cfg, "stats", &set->stats); - set->cfg = cfg; + log_setlevel(set->debug); return 0; } diff --git a/server/src/server.c b/server/src/server.c index f070024d3..176062799 100644 --- a/server/src/server.c +++ b/server/src/server.c @@ -15,10 +15,9 @@ #include #include "config.h" -#include "cfg.h" #include "if.h" -#include "msg.h" #include "utils.h" +#include "cfg.h" #include "path.h" #include "node.h"