2019-01-19 16:13:58 +08:00
|
|
|
#ifndef CONF_H
|
|
|
|
#define CONF_H
|
|
|
|
|
|
|
|
#include "iniparser.h"
|
2019-04-21 10:41:28 +08:00
|
|
|
#include <unistd.h>
|
2019-06-20 09:39:31 +08:00
|
|
|
|
2020-01-21 19:48:05 +08:00
|
|
|
// 配置文件结构
|
|
|
|
typedef struct CONF {
|
|
|
|
// server module
|
|
|
|
int uid;
|
|
|
|
int process;
|
|
|
|
int timer;
|
|
|
|
int server_port;
|
|
|
|
char *server_pid_file;
|
|
|
|
int server_pid_file_len; // length
|
|
|
|
|
|
|
|
// http module
|
|
|
|
int http_port;
|
|
|
|
char *http_ip, *http_del, *http_first;
|
|
|
|
int http_ip_len, http_del_len, http_first_len;
|
|
|
|
char *http_strrep, *http_regrep;
|
|
|
|
int http_strrep_len, http_regrep_len;
|
|
|
|
|
|
|
|
char *http_strrep_aim, *http_strrep_obj;
|
|
|
|
int http_strrep_aim_len, http_strrep_obj_len;
|
|
|
|
|
|
|
|
char *http_regrep_aim, *http_regrep_obj;
|
|
|
|
int http_regrep_aim_len, http_regrep_obj_len;
|
|
|
|
|
|
|
|
// https module
|
|
|
|
int https_port;
|
|
|
|
char *https_ip, *https_del, *https_first;
|
|
|
|
int https_ip_len, https_del_len, https_first_len;
|
|
|
|
char *https_strrep, *https_regrep;
|
|
|
|
int https_strrep_len, https_regrep_len;
|
|
|
|
|
|
|
|
char *https_strrep_aim, *https_strrep_obj;
|
|
|
|
int https_strrep_aim_len, https_strrep_obj_len;
|
|
|
|
|
|
|
|
char *https_regrep_aim, *https_regrep_obj;
|
|
|
|
int https_regrep_aim_len, https_regrep_obj_len;
|
|
|
|
} conf;
|
|
|
|
|
2019-02-19 17:29:58 +08:00
|
|
|
char *strncpy_(char *dest, const char *src, size_t n);
|
2019-12-16 19:27:36 +08:00
|
|
|
void read_conf(char *file, conf * p);
|
|
|
|
void free_conf(conf * p);
|
2019-01-19 16:13:58 +08:00
|
|
|
|
|
|
|
#endif
|