import worker code
This commit is contained in:
parent
61654a06e8
commit
8831040043
64 changed files with 20853 additions and 1 deletions
47
src/worker/include/xcecd_conf.h
Normal file
47
src/worker/include/xcecd_conf.h
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
#ifndef XCECD_CONF_H
|
||||
#define XCECD_CONF_H
|
||||
|
||||
#include <cyaml/cyaml.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define DEFAULT_CONFIG_PATH "/opt/xce/conf/worker.yaml"
|
||||
#define MAX_HOSTNAME_LEN 256
|
||||
#define MAX_PATH_LEN 512
|
||||
#define MAX_LOG_LEVEL_LEN 16
|
||||
|
||||
typedef enum {
|
||||
CONFIG_SUCCESS = 0,
|
||||
CONFIG_ERROR_FILE_NOT_FOUND,
|
||||
CONFIG_ERROR_PARSE_FAILED,
|
||||
CONFIG_ERROR_INVALID_DATA,
|
||||
CONFIG_ERROR_MEMORY,
|
||||
CONFIG_ERROR_UNKNOWN
|
||||
} config_error_t;
|
||||
|
||||
typedef struct {
|
||||
char *hostname;
|
||||
} management_host_t;
|
||||
|
||||
typedef struct {
|
||||
management_host_t *management_list;
|
||||
uint32_t management_list_count;
|
||||
uint16_t controller_port;
|
||||
char *log_level;
|
||||
char *log_dir;
|
||||
} worker_config_t;
|
||||
|
||||
typedef struct {
|
||||
config_error_t error_code;
|
||||
char error_message[512];
|
||||
worker_config_t *config;
|
||||
} config_result_t;
|
||||
|
||||
config_result_t* config_load(const char *config_path);
|
||||
config_result_t* config_load_default(void);
|
||||
void config_free(config_result_t *result);
|
||||
const char* config_error_string(config_error_t error);
|
||||
void config_print(const worker_config_t *config);
|
||||
int level_to_int(const char *level);
|
||||
|
||||
#endif // XCECD_CONF_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue