config.h 2.12 KB
Newer Older
Jack Moffitt's avatar
Jack Moffitt committed
1 2 3 4 5 6
#ifndef __CONFIG_H__
#define __CONFIG_H__

#define CONFIG_EINSANE -1
#define CONFIG_ENOROOT -2
#define CONFIG_EBADROOT -3
7
#define CONFIG_EPARSE -4
Jack Moffitt's avatar
Jack Moffitt committed
8

9 10
#define MAX_YP_DIRECTORIES 25

Jack Moffitt's avatar
Jack Moffitt committed
11 12 13
typedef struct ice_config_dir_tag
{
	char *host;
14
	int touch_interval;
Jack Moffitt's avatar
Jack Moffitt committed
15 16 17
	struct ice_config_dir_tag *next;
} ice_config_dir_t;

Michael Smith's avatar
Michael Smith committed
18 19 20 21
typedef struct _relay_server {
    char *server;
    int port;
    char *mount;
22
    char *localmount;
Michael Smith's avatar
Michael Smith committed
23 24 25
    struct _relay_server *next;
} relay_server;

26 27 28 29 30 31 32 33 34 35 36 37 38 39
typedef struct _mount_proxy {
    char *mountname; /* The mountpoint this proxy is used for */

    char *username; /* Username and password for this mountpoint. If unset, */
    char *password; /* falls back to global source password */

    char *dumpfile; /* Filename to dump this stream to (will be appended). NULL
                       to not dump. */
    int max_listeners; /* Max listeners for this mountpoint only. -1 to not 
                          limit here (i.e. only use the global limit) */
    char *fallback_mount;
    struct _mount_proxy *next;
} mount_proxy;

Jack Moffitt's avatar
Jack Moffitt committed
40 41 42 43 44 45 46 47 48 49
typedef struct ice_config_tag
{
	char *location;
	char *admin;

	int client_limit;
	int source_limit;
	int threadpool_size;
	int client_timeout;
	int header_timeout;
50
	int source_timeout;
51
    int ice_login;
52
    int fileserve;
Jack Moffitt's avatar
Jack Moffitt committed
53 54

	char *source_password;
55
    char *relay_password;
56 57
    char *admin_username;
    char *admin_password;
Jack Moffitt's avatar
Jack Moffitt committed
58

59
	int touch_interval;
Jack Moffitt's avatar
Jack Moffitt committed
60 61 62 63 64
	ice_config_dir_t *dir_list;

	char *hostname;
	int port;
	char *bind_address;
65 66 67
	char *master_server;
	int master_server_port;
    int master_update_interval;
68
    char *master_password;
Jack Moffitt's avatar
Jack Moffitt committed
69

Michael Smith's avatar
Michael Smith committed
70 71
    relay_server *relay;

72 73
    mount_proxy *mounts;

Jack Moffitt's avatar
Jack Moffitt committed
74 75
	char *base_dir;
	char *log_dir;
76
	char *webroot_dir;
Jack Moffitt's avatar
Jack Moffitt committed
77 78 79

	char *access_log;
	char *error_log;
80
    int loglevel;
81 82 83 84 85

    int chroot;
    int chuid;
    char *user;
    char *group;
86 87 88
    char *yp_url[MAX_YP_DIRECTORIES];
    int	yp_url_timeout[MAX_YP_DIRECTORIES];
    int num_yp_directories;
Jack Moffitt's avatar
Jack Moffitt committed
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
} ice_config_t;

void config_initialize(void);
void config_shutdown(void);

int config_parse_file(const char *filename);
int config_parse_cmdline(int arg, char **argv);

int config_rehash(void);

ice_config_t *config_get_config(void);

#endif  /* __CONFIG_H__ */