56 lines
1.1 KiB
C
56 lines
1.1 KiB
C
|
|
#include <stdbool.h>
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
|
|
#include <logger.h>
|
|
#include <clconfig.h>
|
|
#include <tconfig.h>
|
|
#include <massert.h>
|
|
|
|
|
|
typedef struct {
|
|
|
|
} server_t;
|
|
|
|
|
|
static server_t server;
|
|
|
|
int server_init(void) {
|
|
logger_dprintf("server initialization");
|
|
return 0;
|
|
}
|
|
|
|
#define SERVER_CONFIG_ERROR -1
|
|
|
|
int server_config(void) {
|
|
logger_dprintf("server configuration");
|
|
|
|
tconfig_t tconfig;
|
|
tconfig_init(&tconfig);
|
|
|
|
char* logpath = NULL;
|
|
tconfig_bind(&tconfig, TCONF_STR, "logpath", &logpath);
|
|
ssize_t rsize = tconfig_read(&tconfig, "helmet.conf");
|
|
if (rsize < 0) {
|
|
return SERVER_CONFIG_ERROR;
|
|
}
|
|
int res = tconfig_parse(&tconfig);
|
|
if (res < 0) {
|
|
return SERVER_CONFIG_ERROR;
|
|
}
|
|
|
|
tconfig_destroy(&tconfig);
|
|
logger_dprintf("logpath = %s", logpath);
|
|
|
|
//clconfig_t clconfig;
|
|
//clconfig_init(&clconfig);
|
|
|
|
return 0;
|
|
}
|
|
|
|
int server_run(void) {
|
|
logger_dprintf("start the server");
|
|
return 0;
|
|
}
|