Added XML file for configurations.
The XML file will be used to auto generate the configuratioin code and the corresponding documentation in the future. The perl script parses this XML format and outputs gen_config.{h,c} files accordingly.
This commit is contained in:
parent
8e816fd196
commit
0a3fe10f16
@ -105,330 +105,7 @@
|
||||
{ \
|
||||
LOG_WARN("Configuration option %s deprecated and ingnored.", key); \
|
||||
return 0; \
|
||||
} \
|
||||
|
||||
/* default configuration values */
|
||||
#define DEF_SERVER_BIND_ADDR "any"
|
||||
#define DEF_SERVER_PORT 1511
|
||||
#define DEF_SERVER_BACKLOG 50
|
||||
#define DEF_SERVER_ALT_PORTS ""
|
||||
#define DEF_HUB_NAME "uhub"
|
||||
#define DEF_HUB_DESCRIPTION ""
|
||||
#define DEF_HUB_ENABLED 1
|
||||
#define DEF_FILE_ACL ""
|
||||
#define DEF_FILE_MOTD ""
|
||||
#define DEF_FILE_RULES ""
|
||||
#define DEF_MAX_USERS 500
|
||||
#define DEF_MAX_CHAT_HISTORY 20
|
||||
#define DEF_MAX_LOGOUT_LOG 100
|
||||
#define DEF_MAX_RECV_BUFFER 4096
|
||||
#define DEF_MAX_SEND_BUFFER 131072
|
||||
#define DEF_MAX_SEND_BUFFER_SOFT 98304
|
||||
#define DEF_SHOW_BANNER 1
|
||||
#define DEF_SHOW_BANNER_SYS_INFO 1
|
||||
#define DEF_REGISTERED_USERS_ONLY 0
|
||||
#define DEF_OBSOLETE_CLIENTS 0
|
||||
#define DEF_CHAT_ONLY 0
|
||||
#define DEF_CHAT_IS_PRIVILEGED 0
|
||||
#define DEF_LOW_BANDWIDTH_MODE 0
|
||||
#define DEF_LIMIT_MAX_HUBS_USER 0
|
||||
#define DEF_LIMIT_MAX_HUBS_REG 0
|
||||
#define DEF_LIMIT_MAX_HUBS_OP 0
|
||||
#define DEF_LIMIT_MAX_HUBS 0
|
||||
#define DEF_LIMIT_MIN_HUBS_USER 0
|
||||
#define DEF_LIMIT_MIN_HUBS_REG 0
|
||||
#define DEF_LIMIT_MIN_HUBS_OP 0
|
||||
#define DEF_LIMIT_MIN_SHARE 0
|
||||
#define DEF_LIMIT_MAX_SHARE 0
|
||||
#define DEF_LIMIT_MIN_SLOTS 0
|
||||
#define DEF_LIMIT_MAX_SLOTS 0
|
||||
#define DEF_FLOOD_INTERVAL 0
|
||||
#define DEF_FLOOD_CHAT 0
|
||||
#define DEF_FLOOD_CONNECT 0
|
||||
#define DEF_FLOOD_SEARCH 0
|
||||
#define DEF_FLOOD_UPDATE 0
|
||||
#define DEF_FLOOD_EXTRAS 0
|
||||
#define DEF_TLS_ENABLE 0
|
||||
#define DEF_TLS_REQUIRE 1
|
||||
#define DEF_TLS_PRIVATE_KEY ""
|
||||
#define DEF_TLS_CERTIFICATE ""
|
||||
#define DEF_MSG_HUB_FULL "Hub is full"
|
||||
#define DEF_MSG_HUB_DISABLED "Hub is disabled"
|
||||
#define DEF_MSG_HUB_REGISTERED_USERS_ONLY "Hub is for registered users only"
|
||||
#define DEF_MSG_INF_ERROR_NICK_MISSING "No nickname given"
|
||||
#define DEF_MSG_INF_ERROR_NICK_MULTIPLE "Multiple nicknames given"
|
||||
#define DEF_MSG_INF_ERROR_NICK_INVALID "Nickname is invalid"
|
||||
#define DEF_MSG_INF_ERROR_NICK_LONG "Nickname too long"
|
||||
#define DEF_MSG_INF_ERROR_NICK_SHORT "Nickname too short"
|
||||
#define DEF_MSG_INF_ERROR_NICK_SPACES "Nickname cannot start with spaces"
|
||||
#define DEF_MSG_INF_ERROR_NICK_BAD_CHARS "Nickname contains invalid characters"
|
||||
#define DEF_MSG_INF_ERROR_NICK_NOT_UTF8 "Nickname is not valid utf8"
|
||||
#define DEF_MSG_INF_ERROR_NICK_TAKEN "Nickname is already in use"
|
||||
#define DEF_MSG_INF_ERROR_NICK_RESTRICTED "Nickname cannot be used on this hub"
|
||||
#define DEF_MSG_INF_ERROR_CID_INVALID "CID is not valid"
|
||||
#define DEF_MSG_INF_ERROR_CID_MISSING "CID is not specified"
|
||||
#define DEF_MSG_INF_ERROR_CID_TAKEN "CID is taken"
|
||||
#define DEF_MSG_INF_ERROR_PID_MISSING "PID is not specified"
|
||||
#define DEF_MSG_INF_ERROR_PID_INVALID "PID is invalid"
|
||||
#define DEF_MSG_BAN_PERMANENTLY "Banned permanently"
|
||||
#define DEF_MSG_BAN_TEMPORARILY "Banned temporarily"
|
||||
#define DEF_MSG_AUTH_INVALID_PASSWORD "Password is wrong"
|
||||
#define DEF_MSG_AUTH_USER_NOT_FOUND "User not found in password database"
|
||||
#define DEF_MSG_ERROR_NO_MEMORY "No memory"
|
||||
#define DEF_MSG_USER_SHARE_SIZE_LOW "User is not sharing enough"
|
||||
#define DEF_MSG_USER_SHARE_SIZE_HIGH "User is sharing too much"
|
||||
#define DEF_MSG_USER_SLOTS_LOW "User have too few upload slots."
|
||||
#define DEF_MSG_USER_SLOTS_HIGH "User have too many upload slots."
|
||||
#define DEF_MSG_USER_HUB_LIMIT_LOW "User is on too few hubs."
|
||||
#define DEF_MSG_USER_HUB_LIMIT_HIGH "User is on too many hubs."
|
||||
#define DEF_MSG_FLOOD_CHAT "Chat flood detected, messages are dropped."
|
||||
#define DEF_MSG_FLOOD_CONNECT "Connect flood detected, connection refused."
|
||||
#define DEF_MSG_FLOOD_SEARCH "Search flood detected, search is stopped."
|
||||
#define DEF_MSG_FLOOD_UPDATE "Update flood detected."
|
||||
#define DEF_MSG_FLOOD_EXTRAS "Flood detected."
|
||||
#define DEF_MSG_PROTO_NO_COMMON_HASH "No common hash algorithm."
|
||||
#define DEF_MSG_PROTO_OBSOLETE_ADC0 "Your client does not support ADC/1.0."
|
||||
|
||||
void config_defaults(struct hub_config* config)
|
||||
{
|
||||
DEFAULT_STRING (server_bind_addr, DEF_SERVER_BIND_ADDR);
|
||||
DEFAULT_STRING (hub_name, DEF_HUB_NAME);
|
||||
DEFAULT_STRING (hub_description, DEF_HUB_DESCRIPTION);
|
||||
DEFAULT_BOOLEAN(hub_enabled, DEF_HUB_ENABLED);
|
||||
DEFAULT_STRING (file_acl, DEF_FILE_ACL);
|
||||
DEFAULT_STRING (file_motd, DEF_FILE_MOTD);
|
||||
DEFAULT_STRING (file_rules, DEF_FILE_RULES);
|
||||
DEFAULT_INTEGER(server_port, DEF_SERVER_PORT);
|
||||
DEFAULT_INTEGER(server_listen_backlog, DEF_SERVER_BACKLOG);
|
||||
DEFAULT_STRING (server_alt_ports, DEF_SERVER_ALT_PORTS);
|
||||
DEFAULT_INTEGER(max_users, DEF_MAX_USERS);
|
||||
DEFAULT_INTEGER(max_chat_history, DEF_MAX_CHAT_HISTORY);
|
||||
DEFAULT_INTEGER(max_logout_log, DEF_MAX_LOGOUT_LOG);
|
||||
DEFAULT_INTEGER(max_recv_buffer, DEF_MAX_RECV_BUFFER);
|
||||
DEFAULT_INTEGER(max_send_buffer, DEF_MAX_SEND_BUFFER);
|
||||
DEFAULT_INTEGER(max_send_buffer_soft, DEF_MAX_SEND_BUFFER_SOFT);
|
||||
DEFAULT_BOOLEAN(show_banner, DEF_SHOW_BANNER);
|
||||
DEFAULT_BOOLEAN(show_banner_sys_info, DEF_SHOW_BANNER_SYS_INFO);
|
||||
DEFAULT_BOOLEAN(obsolete_clients, DEF_OBSOLETE_CLIENTS);
|
||||
DEFAULT_BOOLEAN(chat_only, DEF_CHAT_ONLY);
|
||||
DEFAULT_BOOLEAN(chat_is_privileged, DEF_CHAT_IS_PRIVILEGED);
|
||||
DEFAULT_BOOLEAN(low_bandwidth_mode, DEF_LOW_BANDWIDTH_MODE);
|
||||
DEFAULT_BOOLEAN(registered_users_only, DEF_REGISTERED_USERS_ONLY);
|
||||
|
||||
/* Limits enforced on users */
|
||||
DEFAULT_INTEGER(limit_max_hubs_user, DEF_LIMIT_MAX_HUBS_USER);
|
||||
DEFAULT_INTEGER(limit_max_hubs_reg, DEF_LIMIT_MAX_HUBS_REG);
|
||||
DEFAULT_INTEGER(limit_max_hubs_op, DEF_LIMIT_MAX_HUBS_OP);
|
||||
DEFAULT_INTEGER(limit_min_hubs_user, DEF_LIMIT_MIN_HUBS_USER);
|
||||
DEFAULT_INTEGER(limit_min_hubs_reg, DEF_LIMIT_MIN_HUBS_REG);
|
||||
DEFAULT_INTEGER(limit_min_hubs_op, DEF_LIMIT_MIN_HUBS_OP);
|
||||
DEFAULT_INTEGER(limit_max_hubs, DEF_LIMIT_MAX_HUBS);
|
||||
DEFAULT_INTEGER(limit_min_share, DEF_LIMIT_MIN_SHARE);
|
||||
DEFAULT_INTEGER(limit_max_share, DEF_LIMIT_MAX_SHARE);
|
||||
DEFAULT_INTEGER(limit_min_slots, DEF_LIMIT_MIN_SLOTS);
|
||||
DEFAULT_INTEGER(limit_max_slots, DEF_LIMIT_MAX_SLOTS);
|
||||
|
||||
/* Flood control */
|
||||
DEFAULT_INTEGER(flood_ctl_interval, DEF_FLOOD_INTERVAL);
|
||||
DEFAULT_INTEGER(flood_ctl_chat, DEF_FLOOD_CHAT);
|
||||
DEFAULT_INTEGER(flood_ctl_connect, DEF_FLOOD_CONNECT);
|
||||
DEFAULT_INTEGER(flood_ctl_search, DEF_FLOOD_SEARCH);
|
||||
DEFAULT_INTEGER(flood_ctl_update, DEF_FLOOD_UPDATE);
|
||||
DEFAULT_INTEGER(flood_ctl_extras, DEF_FLOOD_EXTRAS);
|
||||
|
||||
/* Status/error strings */
|
||||
DEFAULT_STRING (msg_hub_full, DEF_MSG_HUB_FULL);
|
||||
DEFAULT_STRING (msg_hub_disabled, DEF_MSG_HUB_DISABLED)
|
||||
DEFAULT_STRING (msg_hub_registered_users_only, DEF_MSG_HUB_REGISTERED_USERS_ONLY);
|
||||
DEFAULT_STRING (msg_inf_error_nick_missing, DEF_MSG_INF_ERROR_NICK_MISSING);
|
||||
DEFAULT_STRING (msg_inf_error_nick_multiple, DEF_MSG_INF_ERROR_NICK_MULTIPLE);
|
||||
DEFAULT_STRING (msg_inf_error_nick_invalid, DEF_MSG_INF_ERROR_NICK_INVALID);
|
||||
DEFAULT_STRING (msg_inf_error_nick_long, DEF_MSG_INF_ERROR_NICK_LONG);
|
||||
DEFAULT_STRING (msg_inf_error_nick_short, DEF_MSG_INF_ERROR_NICK_SHORT);
|
||||
DEFAULT_STRING (msg_inf_error_nick_spaces, DEF_MSG_INF_ERROR_NICK_SPACES);
|
||||
DEFAULT_STRING (msg_inf_error_nick_bad_chars, DEF_MSG_INF_ERROR_NICK_BAD_CHARS);
|
||||
DEFAULT_STRING (msg_inf_error_nick_not_utf8, DEF_MSG_INF_ERROR_NICK_NOT_UTF8);
|
||||
DEFAULT_STRING (msg_inf_error_nick_taken, DEF_MSG_INF_ERROR_NICK_TAKEN);
|
||||
DEFAULT_STRING (msg_inf_error_nick_restricted, DEF_MSG_INF_ERROR_NICK_RESTRICTED);
|
||||
DEFAULT_STRING (msg_inf_error_cid_invalid, DEF_MSG_INF_ERROR_CID_INVALID);
|
||||
DEFAULT_STRING (msg_inf_error_cid_missing, DEF_MSG_INF_ERROR_CID_MISSING);
|
||||
DEFAULT_STRING (msg_inf_error_cid_taken, DEF_MSG_INF_ERROR_CID_TAKEN);
|
||||
DEFAULT_STRING (msg_inf_error_pid_missing, DEF_MSG_INF_ERROR_PID_MISSING);
|
||||
DEFAULT_STRING (msg_inf_error_pid_invalid, DEF_MSG_INF_ERROR_PID_INVALID);
|
||||
DEFAULT_STRING (msg_ban_permanently, DEF_MSG_BAN_PERMANENTLY);
|
||||
DEFAULT_STRING (msg_ban_temporarily, DEF_MSG_BAN_TEMPORARILY);
|
||||
DEFAULT_STRING (msg_auth_invalid_password, DEF_MSG_AUTH_INVALID_PASSWORD);
|
||||
DEFAULT_STRING (msg_auth_user_not_found, DEF_MSG_AUTH_USER_NOT_FOUND);
|
||||
DEFAULT_STRING (msg_error_no_memory, DEF_MSG_ERROR_NO_MEMORY);
|
||||
DEFAULT_STRING (msg_user_share_size_low, DEF_MSG_USER_SHARE_SIZE_LOW);
|
||||
DEFAULT_STRING (msg_user_share_size_high, DEF_MSG_USER_SHARE_SIZE_HIGH);
|
||||
DEFAULT_STRING (msg_user_slots_low, DEF_MSG_USER_SLOTS_LOW);
|
||||
DEFAULT_STRING (msg_user_slots_high, DEF_MSG_USER_SLOTS_HIGH);
|
||||
DEFAULT_STRING (msg_user_hub_limit_low, DEF_MSG_USER_HUB_LIMIT_LOW);
|
||||
DEFAULT_STRING (msg_user_hub_limit_high, DEF_MSG_USER_HUB_LIMIT_HIGH);
|
||||
DEFAULT_STRING (msg_user_flood_chat, DEF_MSG_FLOOD_CHAT);
|
||||
DEFAULT_STRING (msg_user_flood_connect, DEF_MSG_FLOOD_CONNECT);
|
||||
DEFAULT_STRING (msg_user_flood_search, DEF_MSG_FLOOD_SEARCH);
|
||||
DEFAULT_STRING (msg_user_flood_update, DEF_MSG_FLOOD_UPDATE);
|
||||
DEFAULT_STRING (msg_user_flood_extras, DEF_MSG_FLOOD_EXTRAS);
|
||||
DEFAULT_STRING (msg_proto_no_common_hash, DEF_MSG_PROTO_NO_COMMON_HASH);
|
||||
DEFAULT_STRING (msg_proto_obsolete_adc0, DEF_MSG_PROTO_OBSOLETE_ADC0);
|
||||
|
||||
DEFAULT_INTEGER(tls_enable, DEF_TLS_ENABLE);
|
||||
DEFAULT_INTEGER(tls_require, DEF_TLS_REQUIRE);
|
||||
DEFAULT_STRING (tls_certificate, DEF_TLS_CERTIFICATE);
|
||||
DEFAULT_STRING (tls_private_key, DEF_TLS_PRIVATE_KEY);
|
||||
}
|
||||
|
||||
|
||||
static int apply_config(struct hub_config* config, char* key, char* data, int line_count)
|
||||
{
|
||||
GET_STR (file_acl);
|
||||
GET_STR (file_motd);
|
||||
GET_STR (file_rules);
|
||||
GET_STR (server_bind_addr);
|
||||
GET_INT (server_port);
|
||||
GET_INT (server_listen_backlog);
|
||||
GET_STR (server_alt_ports);
|
||||
GET_STR (hub_name);
|
||||
GET_STR (hub_description);
|
||||
GET_BOOL(hub_enabled);
|
||||
GET_INT (max_users);
|
||||
GET_INT (max_chat_history);
|
||||
GET_INT (max_logout_log);
|
||||
GET_INT (max_recv_buffer);
|
||||
GET_INT (max_send_buffer);
|
||||
GET_INT (max_send_buffer_soft);
|
||||
GET_BOOL(show_banner);
|
||||
GET_BOOL(show_banner_sys_info);
|
||||
GET_BOOL(obsolete_clients);
|
||||
GET_BOOL(chat_only);
|
||||
GET_BOOL(chat_is_privileged);
|
||||
GET_BOOL(low_bandwidth_mode);
|
||||
GET_BOOL(registered_users_only);
|
||||
|
||||
/* Limits enforced on users */
|
||||
GET_INT(limit_max_hubs_user);
|
||||
GET_INT(limit_max_hubs_reg);
|
||||
GET_INT(limit_max_hubs_op);
|
||||
GET_INT(limit_min_hubs_user);
|
||||
GET_INT(limit_min_hubs_reg);
|
||||
GET_INT(limit_min_hubs_op);
|
||||
GET_INT(limit_max_hubs);
|
||||
GET_INT(limit_min_share);
|
||||
GET_INT(limit_max_share);
|
||||
GET_INT(limit_min_slots);
|
||||
GET_INT(limit_max_slots);
|
||||
|
||||
GET_INT(flood_ctl_interval);
|
||||
GET_INT(flood_ctl_chat);
|
||||
GET_INT(flood_ctl_connect);
|
||||
GET_INT(flood_ctl_search);
|
||||
GET_INT(flood_ctl_update);
|
||||
GET_INT(flood_ctl_extras);
|
||||
|
||||
/* Status/error strings */
|
||||
GET_STR (msg_hub_full);
|
||||
GET_STR (msg_hub_disabled);
|
||||
GET_STR (msg_hub_registered_users_only);
|
||||
GET_STR (msg_inf_error_nick_missing);
|
||||
GET_STR (msg_inf_error_nick_multiple);
|
||||
GET_STR (msg_inf_error_nick_invalid);
|
||||
GET_STR (msg_inf_error_nick_long);
|
||||
GET_STR (msg_inf_error_nick_short);
|
||||
GET_STR (msg_inf_error_nick_spaces);
|
||||
GET_STR (msg_inf_error_nick_bad_chars);
|
||||
GET_STR (msg_inf_error_nick_not_utf8);
|
||||
GET_STR (msg_inf_error_nick_taken);
|
||||
GET_STR (msg_inf_error_nick_restricted);
|
||||
GET_STR (msg_inf_error_cid_invalid);
|
||||
GET_STR (msg_inf_error_cid_missing);
|
||||
GET_STR (msg_inf_error_cid_taken);
|
||||
GET_STR (msg_inf_error_pid_missing);
|
||||
GET_STR (msg_inf_error_pid_invalid);
|
||||
GET_STR (msg_ban_permanently);
|
||||
GET_STR (msg_ban_temporarily);
|
||||
GET_STR (msg_auth_invalid_password);
|
||||
GET_STR (msg_auth_user_not_found);
|
||||
GET_STR (msg_error_no_memory);
|
||||
GET_STR (msg_user_share_size_low);
|
||||
GET_STR (msg_user_share_size_high);
|
||||
GET_STR (msg_user_slots_low);
|
||||
GET_STR (msg_user_slots_high);
|
||||
GET_STR (msg_user_hub_limit_low);
|
||||
GET_STR (msg_user_hub_limit_high);
|
||||
GET_STR (msg_user_flood_chat);
|
||||
GET_STR (msg_user_flood_connect);
|
||||
GET_STR (msg_user_flood_search);
|
||||
GET_STR (msg_user_flood_update);
|
||||
GET_STR (msg_user_flood_extras);
|
||||
GET_STR (msg_proto_no_common_hash);
|
||||
GET_STR (msg_proto_obsolete_adc0);
|
||||
|
||||
/* TLS/SSL related */
|
||||
GET_BOOL(tls_enable);
|
||||
GET_BOOL(tls_require);
|
||||
GET_STR (tls_certificate);
|
||||
GET_STR (tls_private_key);
|
||||
|
||||
/* Still here -- unknown directive */
|
||||
LOG_ERROR("Unknown configuration directive: '%s'", key);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void free_config(struct hub_config* config)
|
||||
{
|
||||
hub_free(config->server_bind_addr);
|
||||
hub_free(config->server_alt_ports);
|
||||
hub_free(config->file_motd);
|
||||
hub_free(config->file_acl);
|
||||
hub_free(config->file_rules);
|
||||
hub_free(config->hub_name);
|
||||
hub_free(config->hub_description);
|
||||
|
||||
hub_free(config->msg_hub_full);
|
||||
hub_free(config->msg_hub_disabled);
|
||||
hub_free(config->msg_hub_registered_users_only);
|
||||
hub_free(config->msg_inf_error_nick_missing);
|
||||
hub_free(config->msg_inf_error_nick_multiple);
|
||||
hub_free(config->msg_inf_error_nick_invalid);
|
||||
hub_free(config->msg_inf_error_nick_long);
|
||||
hub_free(config->msg_inf_error_nick_short);
|
||||
hub_free(config->msg_inf_error_nick_spaces);
|
||||
hub_free(config->msg_inf_error_nick_bad_chars);
|
||||
hub_free(config->msg_inf_error_nick_not_utf8);
|
||||
hub_free(config->msg_inf_error_nick_taken);
|
||||
hub_free(config->msg_inf_error_nick_restricted);
|
||||
hub_free(config->msg_inf_error_cid_invalid);
|
||||
hub_free(config->msg_inf_error_cid_missing);
|
||||
hub_free(config->msg_inf_error_cid_taken);
|
||||
hub_free(config->msg_inf_error_pid_missing);
|
||||
hub_free(config->msg_inf_error_pid_invalid);
|
||||
hub_free(config->msg_ban_permanently);
|
||||
hub_free(config->msg_ban_temporarily);
|
||||
hub_free(config->msg_auth_invalid_password);
|
||||
hub_free(config->msg_auth_user_not_found);
|
||||
hub_free(config->msg_error_no_memory);
|
||||
hub_free(config->msg_user_share_size_low);
|
||||
hub_free(config->msg_user_share_size_high);
|
||||
hub_free(config->msg_user_slots_low);
|
||||
hub_free(config->msg_user_slots_high);
|
||||
hub_free(config->msg_user_hub_limit_low);
|
||||
hub_free(config->msg_user_hub_limit_high);
|
||||
hub_free(config->msg_user_flood_chat);
|
||||
hub_free(config->msg_user_flood_connect);
|
||||
hub_free(config->msg_user_flood_search);
|
||||
hub_free(config->msg_user_flood_update);
|
||||
hub_free(config->msg_user_flood_extras);
|
||||
hub_free(config->msg_proto_no_common_hash);
|
||||
hub_free(config->msg_proto_obsolete_adc0);
|
||||
|
||||
hub_free(config->tls_certificate);
|
||||
hub_free(config->tls_private_key);
|
||||
|
||||
memset(config, 0, sizeof(struct hub_config));
|
||||
}
|
||||
}
|
||||
|
||||
#define DUMP_STR(NAME, DEFAULT) \
|
||||
if (ignore_defaults) \
|
||||
@ -448,7 +125,6 @@ void free_config(struct hub_config* config)
|
||||
else \
|
||||
fprintf(stdout, "%s = %d\n", #NAME , config->NAME); \
|
||||
|
||||
|
||||
#define DUMP_BOOL(NAME, DEFAULT) \
|
||||
if (ignore_defaults) \
|
||||
{ \
|
||||
@ -458,98 +134,8 @@ void free_config(struct hub_config* config)
|
||||
else \
|
||||
fprintf(stdout, "%s = %s\n", #NAME , (config->NAME ? "yes" : "no"));
|
||||
|
||||
void dump_config(struct hub_config* config, int ignore_defaults)
|
||||
{
|
||||
DUMP_STR (file_acl, DEF_FILE_ACL);
|
||||
DUMP_STR (file_motd, DEF_FILE_MOTD);
|
||||
DUMP_STR (file_rules, DEF_FILE_RULES);
|
||||
DUMP_STR (server_bind_addr, DEF_SERVER_BIND_ADDR);
|
||||
DUMP_INT (server_port, DEF_SERVER_PORT);
|
||||
DUMP_INT (server_listen_backlog, DEF_SERVER_BACKLOG);
|
||||
DUMP_STR (server_alt_ports, DEF_SERVER_ALT_PORTS);
|
||||
DUMP_STR (hub_name, DEF_HUB_NAME);
|
||||
DUMP_STR (hub_description, DEF_HUB_DESCRIPTION);
|
||||
DUMP_BOOL(hub_enabled, DEF_HUB_ENABLED);
|
||||
DUMP_INT (max_users, DEF_MAX_USERS);
|
||||
DUMP_INT (max_chat_history, DEF_MAX_CHAT_HISTORY);
|
||||
DUMP_INT (max_logout_log, DEF_MAX_LOGOUT_LOG);
|
||||
DUMP_INT (max_recv_buffer, DEF_MAX_RECV_BUFFER);
|
||||
DUMP_INT (max_send_buffer, DEF_MAX_SEND_BUFFER);
|
||||
DUMP_INT (max_send_buffer_soft, DEF_MAX_SEND_BUFFER_SOFT);
|
||||
DUMP_BOOL(show_banner, DEF_SHOW_BANNER);
|
||||
DUMP_BOOL(show_banner_sys_info, DEF_SHOW_BANNER_SYS_INFO);
|
||||
DUMP_BOOL(obsolete_clients, DEF_OBSOLETE_CLIENTS);
|
||||
DUMP_BOOL(chat_only, DEF_CHAT_ONLY);
|
||||
DUMP_BOOL(chat_is_privileged, DEF_CHAT_IS_PRIVILEGED);
|
||||
DUMP_BOOL(low_bandwidth_mode, DEF_LOW_BANDWIDTH_MODE);
|
||||
DUMP_BOOL(registered_users_only, DEF_REGISTERED_USERS_ONLY);
|
||||
|
||||
#ifdef SSL_SUPPORT
|
||||
DUMP_BOOL(tls_enable, DEF_TLS_ENABLE);
|
||||
DUMP_BOOL(tls_require, DEF_TLS_REQUIRE);
|
||||
DUMP_STR (tls_certificate, DEF_TLS_CERTIFICATE);
|
||||
DUMP_STR (tls_private_key, DEF_TLS_PRIVATE_KEY);
|
||||
#endif
|
||||
|
||||
/* Limits enforced on users */
|
||||
DUMP_INT(limit_max_hubs_user, DEF_LIMIT_MAX_HUBS_USER);
|
||||
DUMP_INT(limit_max_hubs_reg, DEF_LIMIT_MAX_HUBS_REG);
|
||||
DUMP_INT(limit_max_hubs_op, DEF_LIMIT_MAX_HUBS_OP);
|
||||
DUMP_INT(limit_min_hubs_user, DEF_LIMIT_MIN_HUBS_USER);
|
||||
DUMP_INT(limit_min_hubs_reg, DEF_LIMIT_MIN_HUBS_REG);
|
||||
DUMP_INT(limit_min_hubs_op, DEF_LIMIT_MIN_HUBS_OP);
|
||||
DUMP_INT(limit_max_hubs, DEF_LIMIT_MAX_HUBS);
|
||||
DUMP_INT(limit_min_share, DEF_LIMIT_MIN_SHARE);
|
||||
DUMP_INT(limit_max_share, DEF_LIMIT_MAX_SHARE);
|
||||
DUMP_INT(limit_min_slots, DEF_LIMIT_MIN_SLOTS);
|
||||
DUMP_INT(limit_max_slots, DEF_LIMIT_MAX_SLOTS);
|
||||
|
||||
DUMP_INT(flood_ctl_interval, DEF_FLOOD_INTERVAL);
|
||||
DUMP_INT(flood_ctl_chat, DEF_FLOOD_CHAT);
|
||||
DUMP_INT(flood_ctl_connect, DEF_FLOOD_CONNECT);
|
||||
DUMP_INT(flood_ctl_search, DEF_FLOOD_SEARCH);
|
||||
DUMP_INT(flood_ctl_update, DEF_FLOOD_UPDATE);
|
||||
DUMP_INT(flood_ctl_extras, DEF_FLOOD_EXTRAS);
|
||||
|
||||
/* Status/error strings */
|
||||
DUMP_STR (msg_hub_full, DEF_MSG_HUB_FULL);
|
||||
DUMP_STR (msg_hub_disabled, DEF_MSG_HUB_DISABLED);
|
||||
DUMP_STR (msg_hub_registered_users_only, DEF_MSG_HUB_REGISTERED_USERS_ONLY);
|
||||
DUMP_STR (msg_inf_error_nick_missing, DEF_MSG_INF_ERROR_NICK_MISSING);
|
||||
DUMP_STR (msg_inf_error_nick_multiple, DEF_MSG_INF_ERROR_NICK_MULTIPLE);
|
||||
DUMP_STR (msg_inf_error_nick_invalid, DEF_MSG_INF_ERROR_NICK_INVALID);
|
||||
DUMP_STR (msg_inf_error_nick_long, DEF_MSG_INF_ERROR_NICK_LONG);
|
||||
DUMP_STR (msg_inf_error_nick_short, DEF_MSG_INF_ERROR_NICK_SHORT);
|
||||
DUMP_STR (msg_inf_error_nick_spaces, DEF_MSG_INF_ERROR_NICK_SPACES);
|
||||
DUMP_STR (msg_inf_error_nick_bad_chars, DEF_MSG_INF_ERROR_NICK_BAD_CHARS);
|
||||
DUMP_STR (msg_inf_error_nick_not_utf8, DEF_MSG_INF_ERROR_NICK_NOT_UTF8);
|
||||
DUMP_STR (msg_inf_error_nick_taken, DEF_MSG_INF_ERROR_NICK_TAKEN);
|
||||
DUMP_STR (msg_inf_error_nick_restricted, DEF_MSG_INF_ERROR_NICK_RESTRICTED);
|
||||
DUMP_STR (msg_inf_error_cid_invalid, DEF_MSG_INF_ERROR_CID_INVALID);
|
||||
DUMP_STR (msg_inf_error_cid_missing, DEF_MSG_INF_ERROR_CID_MISSING);
|
||||
DUMP_STR (msg_inf_error_cid_taken, DEF_MSG_INF_ERROR_CID_TAKEN);
|
||||
DUMP_STR (msg_inf_error_pid_missing, DEF_MSG_INF_ERROR_PID_MISSING);
|
||||
DUMP_STR (msg_inf_error_pid_invalid, DEF_MSG_INF_ERROR_PID_INVALID);
|
||||
DUMP_STR (msg_ban_permanently, DEF_MSG_BAN_PERMANENTLY);
|
||||
DUMP_STR (msg_ban_temporarily, DEF_MSG_BAN_TEMPORARILY);
|
||||
DUMP_STR (msg_auth_invalid_password, DEF_MSG_AUTH_INVALID_PASSWORD);
|
||||
DUMP_STR (msg_auth_user_not_found, DEF_MSG_AUTH_USER_NOT_FOUND);
|
||||
DUMP_STR (msg_error_no_memory, DEF_MSG_ERROR_NO_MEMORY);
|
||||
DUMP_STR (msg_user_share_size_low, DEF_MSG_USER_SHARE_SIZE_LOW);
|
||||
DUMP_STR (msg_user_share_size_high, DEF_MSG_USER_SHARE_SIZE_HIGH);
|
||||
DUMP_STR (msg_user_slots_low, DEF_MSG_USER_SLOTS_LOW);
|
||||
DUMP_STR (msg_user_slots_high, DEF_MSG_USER_SLOTS_HIGH);
|
||||
DUMP_STR (msg_user_hub_limit_low, DEF_MSG_USER_HUB_LIMIT_LOW);
|
||||
DUMP_STR (msg_user_hub_limit_high, DEF_MSG_USER_HUB_LIMIT_HIGH);
|
||||
DUMP_STR (msg_user_flood_chat, DEF_MSG_FLOOD_CHAT);
|
||||
DUMP_STR (msg_user_flood_connect, DEF_MSG_FLOOD_CONNECT);
|
||||
DUMP_STR (msg_user_flood_search, DEF_MSG_FLOOD_SEARCH);
|
||||
DUMP_STR (msg_user_flood_update, DEF_MSG_FLOOD_UPDATE);
|
||||
DUMP_STR (msg_user_flood_extras, DEF_MSG_FLOOD_EXTRAS);
|
||||
DUMP_STR (msg_proto_no_common_hash, DEF_MSG_PROTO_NO_COMMON_HASH);
|
||||
DUMP_STR (msg_proto_obsolete_adc0, DEF_MSG_PROTO_OBSOLETE_ADC0);
|
||||
}
|
||||
|
||||
#include "gen_config.c"
|
||||
|
||||
static int config_parse_line(char* line, int line_count, void* ptr_data)
|
||||
{
|
||||
|
@ -20,96 +20,7 @@
|
||||
#ifndef HAVE_UHUB_CONFIG_H
|
||||
#define HAVE_UHUB_CONFIG_H
|
||||
|
||||
struct hub_config
|
||||
{
|
||||
int server_port; /**<<< "Server port to bind to (default: 1511)" */
|
||||
char* server_bind_addr; /**<<< "Server bind address (default: '0.0.0.0' or '::')" */
|
||||
int server_listen_backlog; /**<<< "Server listen backlog (default: 50)" */
|
||||
char* server_alt_ports; /**<<< "Comma separated list of alternative ports to listen to (default: '')" */
|
||||
int hub_enabled; /**<<< "Is server enabled (default: 1)" */
|
||||
int show_banner; /**<<< "Show banner on connect (default: 1)" */
|
||||
int show_banner_sys_info; /**<<< "Show banner system information (default: 1). Has no effect unless show_banner is enabled." */
|
||||
int max_users; /**<<< "Maximum number of users allowed on the hub (default: 500)" */
|
||||
int registered_users_only; /**<<< "Allow registered users only (default: 0)" */
|
||||
int obsolete_clients; /**<<< "Support obsolete clients using a ADC protocol prior to 1.0 (default: off)" */
|
||||
int chat_only; /**<<< "Allow chat only operation on hub (default: 0)" */
|
||||
int chat_is_privileged; /**<<< "Allow chat for operators and above only (default: 0) */
|
||||
char* file_motd; /**<<< "File containing the 'message of the day' (default: '' - no motd)" */
|
||||
char* file_acl; /**<<< "File containing user database (default: '' - no known users)" */
|
||||
char* file_rules; /**<<< "File containing the rules (default: '' - no rules)" */
|
||||
char* hub_name; /**<<< "Name of hub (default: 'My uhub hub')" */
|
||||
char* hub_description; /**<<< "Name of hub (default: 'no description')" */
|
||||
int max_recv_buffer; /**<<< "Max read buffer before parse, per user (default: 4096)" */
|
||||
int max_send_buffer; /**<<< "Max send buffer before disconnect, per user (default: 128K)" */
|
||||
int max_send_buffer_soft; /**<<< "Max send buffer before message drops, per user (default: 96K)" */
|
||||
int low_bandwidth_mode; /**<<< "If this is enabled, the hub will strip off elements from each user's info message to reduce bandwidth usage" */
|
||||
|
||||
int max_chat_history; /**<<< "Number of chat messages kept in history (default: 20)" */
|
||||
int max_logout_log; /**<<< "Number of log entries for people leaving the hub. (default: 100) */
|
||||
|
||||
/* Limits enforced on users */
|
||||
int limit_max_hubs_user; /**<<< "Max concurrent hubs as a user. (0=off, default: 10)" */
|
||||
int limit_max_hubs_reg; /**<<< "Max concurrent hubs as registered user. (0=off, default: 10)" */
|
||||
int limit_max_hubs_op; /**<<< "Max concurrent hubs as operator. (0=off, default: 10)" */
|
||||
int limit_min_hubs_user; /**<<< "Min concurrent hubs as a user. (0=off, default: 0)" */
|
||||
int limit_min_hubs_reg; /**<<< "Min concurrent hubs as registered user. (0=off, default: 0)" */
|
||||
int limit_min_hubs_op; /**<<< "Min concurrent hubs as operator. (0=off, default: 0)" */
|
||||
int limit_max_hubs; /**<<< "Max total hub connections allowed, user/reg/op combined. (0=off, default: 25)" */
|
||||
int limit_min_share; /**<<< "Limit minimum share size in megabytes (MiB) (0=off, default: 0)" */
|
||||
int limit_max_share; /**<<< "Limit maximum share size in megabytes (MiB) (0=off, default: 0)" */
|
||||
int limit_min_slots; /**<<< "Limit minimum number of slots open per user (0=off, default: 0)" */
|
||||
int limit_max_slots; /**<<< "Limit maximum number of slots open per user (0=off, default: 0)" */
|
||||
|
||||
int flood_ctl_interval; /**<<< "Time interval in seconds for flood control check. If 0 then all flood control is disabled. (0=off, default: 0)" */
|
||||
int flood_ctl_chat; /**<<< "Max chat messages allowed inside the time interval (0=off, default: 0)" */
|
||||
int flood_ctl_connect; /**<<< "Max connect requests allowed inside the time interval (0=off, default: 0)" */
|
||||
int flood_ctl_search; /**<<< "Max search requests allowed inside the time interval (0=off, default: 0)" */
|
||||
int flood_ctl_update; /**<<< "Max updates allowed inside the time interval (0=off, default: 0)" */
|
||||
int flood_ctl_extras; /**<<< "Max extra protocol messages allowed inside the time interval (0=off, default: 0)" */
|
||||
|
||||
/* Messages that can be sent to a user */
|
||||
char* msg_hub_full; /**<<< "hub is full" */
|
||||
char* msg_hub_disabled; /**<<< "hub is disabled" */
|
||||
char* msg_hub_registered_users_only; /**<<< "hub is for registered users only" */
|
||||
char* msg_inf_error_nick_missing; /**<<< "no nickname given" */
|
||||
char* msg_inf_error_nick_multiple; /**<<< "multiple nicknames given" */
|
||||
char* msg_inf_error_nick_invalid; /**<<< "generic/unkown" */
|
||||
char* msg_inf_error_nick_long; /**<<< "nickname too long" */
|
||||
char* msg_inf_error_nick_short; /**<<< "nickname too short" */
|
||||
char* msg_inf_error_nick_spaces; /**<<< "nickname cannot start with spaces" */
|
||||
char* msg_inf_error_nick_bad_chars; /**<<< "nickname contains chars below ascii 32" */
|
||||
char* msg_inf_error_nick_not_utf8; /**<<< "nickname is not valid utf8" */
|
||||
char* msg_inf_error_nick_taken; /**<<< "nickname is in use" */
|
||||
char* msg_inf_error_nick_restricted; /**<<< "nickname cannot be used on this hub" */
|
||||
char* msg_inf_error_cid_invalid; /**<<< "CID is not valid" */
|
||||
char* msg_inf_error_cid_missing; /**<<< "CID is not specified" */
|
||||
char* msg_inf_error_cid_taken; /**<<< "CID is taken" */
|
||||
char* msg_inf_error_pid_missing; /**<<< "PID is not specified" */
|
||||
char* msg_inf_error_pid_invalid; /**<<< "PID is invalid" */
|
||||
char* msg_ban_permanently; /**<<< "Banned permanently" */
|
||||
char* msg_ban_temporarily; /**<<< "Banned temporarily" */
|
||||
char* msg_auth_invalid_password; /**<<< "Password is wrong" */
|
||||
char* msg_auth_user_not_found; /**<<< "User not found in password database" */
|
||||
char* msg_error_no_memory; /**<<< "No memory" */
|
||||
char* msg_user_share_size_low; /**<<< "User is not sharing enough" */
|
||||
char* msg_user_share_size_high; /**<<< "User is sharing too much" */
|
||||
char* msg_user_slots_low; /**<<< "User have too few upload slots." */
|
||||
char* msg_user_slots_high; /**<<< "User have too many upload slots." */
|
||||
char* msg_user_hub_limit_low; /**<<< "User is on too few hubs." */
|
||||
char* msg_user_hub_limit_high; /**<<< "User is on too many hubs." */
|
||||
char* msg_user_flood_chat; /**<<< "Chat flood detected, messages are dropped." */
|
||||
char* msg_user_flood_connect; /**<<< "Connect flood detected, connection refused." */
|
||||
char* msg_user_flood_search; /**<<< "Search flood detected, search is stopped." */
|
||||
char* msg_user_flood_update; /**<<< "Update flood detected." */
|
||||
char* msg_user_flood_extras; /**<<< "Flood detected." */
|
||||
char* msg_proto_no_common_hash; /**<<< "No common hash algorithm." */
|
||||
char* msg_proto_obsolete_adc0; /**<<< "Client is using an obsolete ADC protocol version." */
|
||||
|
||||
int tls_enable; /**<<< "Enable SSL/TLS support (default: 0)" */
|
||||
int tls_require; /**<<< "If SSL/TLS enabled, should it be required (default: 0) */
|
||||
char* tls_certificate; /**<<< "Certificate file (PEM)" */
|
||||
char* tls_private_key; /**<<< "Private key" */
|
||||
};
|
||||
#include "gen_config.h"
|
||||
|
||||
/**
|
||||
* This initializes the configuration variables, and sets the default
|
||||
|
164
src/core/config.pl
Executable file
164
src/core/config.pl
Executable file
@ -0,0 +1,164 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use XML::Twig;
|
||||
|
||||
sub write_c_header(@);
|
||||
sub write_c_impl_defaults(@);
|
||||
sub write_c_impl_apply(@);
|
||||
sub write_c_impl_free(@);
|
||||
sub write_c_impl_dump(@);
|
||||
sub get_data($);
|
||||
|
||||
# initialize parser and read the file
|
||||
my $input = "./config.xml";
|
||||
my $parser = XML::Twig->new();
|
||||
my $tree = $parser->parsefile($input) || die "Unable to parse XML file.";
|
||||
|
||||
# Write header file
|
||||
open GENHEAD, ">gen_config.h" || die "Unable to write header file";
|
||||
print GENHEAD "/* THIS FILE IS AUTOGENERATED - DO NOT CHANGE IT! */\n\nstruct hub_config\n{\n";
|
||||
foreach my $p ($tree->root->children("option"))
|
||||
{
|
||||
my @data = ($p->att("type"), $p->att("name"), $p->att("default"), $p->att("advanced"), $p->children_text("short"), $p->children_text("description"), $p->children_text("since"), $p->children_text("example"));
|
||||
write_c_header(@data);
|
||||
}
|
||||
print GENHEAD "};\n\n";
|
||||
|
||||
# Write c source file
|
||||
open GENIMPL, ">gen_config.c" || die "Unable to write source file";
|
||||
print GENIMPL "/* THIS FILE IS AUTOGENERATED - DO NOT CHANGE IT! */\n\n";
|
||||
|
||||
# The defaults function
|
||||
print GENIMPL "void config_defaults(struct hub_config* config)\n{\n";
|
||||
foreach my $p ($tree->root->children("option"))
|
||||
{
|
||||
write_c_impl_defaults(get_data($p));
|
||||
}
|
||||
print GENIMPL "}\n\n";
|
||||
|
||||
# apply function
|
||||
print GENIMPL "static int apply_config(struct hub_config* config, char* key, char* data, int line_count)\n{\n";
|
||||
foreach my $p ($tree->root->children("option"))
|
||||
{
|
||||
write_c_impl_apply(get_data($p));
|
||||
}
|
||||
print GENIMPL "\t/* Still here -- unknown directive */\n";
|
||||
print GENIMPL "\tLOG_ERROR(\"Unknown configuration directive: '%s'\", key);\n";
|
||||
print GENIMPL "\t\treturn -1;\n";
|
||||
print GENIMPL "}\n\n";
|
||||
|
||||
# free function (for strings)
|
||||
print GENIMPL "void free_config(struct hub_config* config)\n{\n";
|
||||
foreach my $p ($tree->root->children("option"))
|
||||
{
|
||||
write_c_impl_free(get_data($p));
|
||||
}
|
||||
print GENIMPL "}\n\n";
|
||||
|
||||
# dump function
|
||||
print GENIMPL "void dump_config(struct hub_config* config, int ignore_defaults)\n{\n";
|
||||
foreach my $p ($tree->root->children("option"))
|
||||
{
|
||||
write_c_impl_dump(get_data($p));
|
||||
}
|
||||
print GENIMPL "}\n\n";
|
||||
|
||||
|
||||
|
||||
sub write_c_header(@)
|
||||
{
|
||||
my @output = @_;
|
||||
my ($type, $name, $default, $advanced, $short, $desc, $since, $example) = @output;
|
||||
|
||||
print GENHEAD "\t";
|
||||
print GENHEAD "int " if ($type eq "int");
|
||||
print GENHEAD "int " if ($type eq "boolean");
|
||||
print GENHEAD "char*" if ($type =~ /(string|file|message)/);
|
||||
print GENHEAD " " . $name . ";";
|
||||
|
||||
my $comment = "";
|
||||
if ($type eq "message")
|
||||
{
|
||||
$comment = "\"" . $default . "\"";
|
||||
}
|
||||
elsif (defined $short && length $short > 0)
|
||||
{
|
||||
$comment = $short;
|
||||
$comment .= " (default: " . $default . ")" if (defined $default);
|
||||
}
|
||||
|
||||
if (length $comment > 0)
|
||||
{
|
||||
my $pad = "";
|
||||
for (my $i = length $name; $i < 32; $i++)
|
||||
{
|
||||
$pad .= " ";
|
||||
}
|
||||
$comment = $pad . "/*<<< " . $comment . " */";
|
||||
}
|
||||
|
||||
print GENHEAD $comment . "\n";
|
||||
}
|
||||
|
||||
sub write_c_impl_defaults(@)
|
||||
{
|
||||
my @output = @_;
|
||||
my ($type, $name, $default, $advanced, $short, $desc, $since, $example) = @output;
|
||||
|
||||
print GENIMPL "\t";
|
||||
print GENIMPL "DEFAULT_INTEGER" if ($type eq "int");
|
||||
print GENIMPL "DEFAULT_BOOLEAN" if ($type eq "boolean");
|
||||
|
||||
if ($type =~ /(string|file|message)/)
|
||||
{
|
||||
print GENIMPL "DEFAULT_STRING ";
|
||||
$default = "\"" . $default . "\"";
|
||||
}
|
||||
print GENIMPL "(" . $name . ", " . $default . ");\n";
|
||||
}
|
||||
|
||||
sub write_c_impl_apply(@)
|
||||
{
|
||||
my @output = @_;
|
||||
my ($type, $name, $default, $advanced, $short, $desc, $since, $example) = @output;
|
||||
|
||||
print GENIMPL "\t";
|
||||
print GENIMPL "GET_INT " if ($type eq "int");
|
||||
print GENIMPL "GET_BOOL" if ($type eq "boolean");
|
||||
print GENIMPL "GET_STR " if ($type =~ /(string|file|message)/);
|
||||
print GENIMPL "(" . $name . ");\n";
|
||||
}
|
||||
|
||||
sub write_c_impl_free(@)
|
||||
{
|
||||
my @output = @_;
|
||||
my ($type, $name, $default, $advanced, $short, $desc, $since, $example) = @output;
|
||||
|
||||
print GENIMPL "\thub_free(config->" . $name . ");\n" if ($type =~ /(string|file|message)/)
|
||||
}
|
||||
|
||||
sub write_c_impl_dump(@)
|
||||
{
|
||||
my @output = @_;
|
||||
my ($type, $name, $default, $advanced, $short, $desc, $since, $example) = @output;
|
||||
|
||||
print GENIMPL "\t";
|
||||
print GENIMPL "DUMP_INT " if ($type eq "int");
|
||||
print GENIMPL "DUMP_BOOL" if ($type eq "boolean");
|
||||
|
||||
if ($type =~ /(string|file|message)/)
|
||||
{
|
||||
print GENIMPL "DUMP_STR";
|
||||
$default = "\"" . $default . "\"";
|
||||
}
|
||||
print GENIMPL "(" . $name . ", " . $default . ");\n"
|
||||
}
|
||||
|
||||
sub get_data($)
|
||||
{
|
||||
my $p = shift;
|
||||
my @data = ($p->att("type"), $p->att("name"), $p->att("default"), $p->att("advanced"), $p->children_text("short"), $p->children_text("description"), $p->children_text("since"), $p->children_text("example"));
|
||||
return @data;
|
||||
}
|
||||
|
663
src/core/config.xml
Normal file
663
src/core/config.xml
Normal file
@ -0,0 +1,663 @@
|
||||
<?xml version='1.0' standalone="yes" ?>
|
||||
<config>
|
||||
<option name="server_port" type="int" default="1511">
|
||||
<check min="1" max="65535" />
|
||||
<since>0.1.0</since>
|
||||
<short>Server port to bind to</short>
|
||||
<description>This is specifies the port number the hub should listen on.</description>
|
||||
</option>
|
||||
|
||||
<option name="server_bind_addr" type="string" default="any">
|
||||
<check regexp="(\d\.\d\.\d\.\d\)|(any)|(loopback)|(.*)" /><!-- FIXME: add better IPv6 regexp in the future! -->
|
||||
<short>Server bind address</short>
|
||||
<description>
|
||||
Specify the IP address the local hub should bind to. This can be an IPv4 or IPv6 address, or one of the special addresses "any" or "loopback". <br />
|
||||
When "any" or "loopback" is used, the hub will automatically detect if IPv6 is supported and prefer that.
|
||||
</description>
|
||||
<syntax>
|
||||
IPv4 address, IPv6 address, "any" or "loopback"
|
||||
</syntax>
|
||||
<since>0.1.2</since>
|
||||
<example>
|
||||
<p>
|
||||
To listen to a specific IP:<br />
|
||||
server_bind_addr = "192.168.12.69"
|
||||
</p>
|
||||
<p>
|
||||
To listen to any IPv4 address:<br />
|
||||
server_bind_addr = "0.0.0.0"
|
||||
</p>
|
||||
<p>
|
||||
Or to listen to any address including IPv6 (if supported):<br />
|
||||
server_bind_addr = "any"
|
||||
</p>
|
||||
</example>
|
||||
</option>
|
||||
|
||||
<option name="server_listen_backlog" type="int" default="50">
|
||||
<check min="5" />
|
||||
<short>Server listen backlog</short>
|
||||
<description>
|
||||
<p>
|
||||
This specifies the number of connections the hub will be able to accept in the backlog before they must be processed by the hub.
|
||||
</p>
|
||||
<p>
|
||||
A too low number here will mean the hub will not accept connections fast enough when users are reconnecting really fast. The hub should under normal circumstances be able to empty the listen backlog several times per second.
|
||||
</p>
|
||||
</description>
|
||||
<since>0.3.0</since>
|
||||
</option>
|
||||
|
||||
<option name="server_alt_ports" type="string" default="">
|
||||
<check regexp="((\d+)(,(\d+))*)?" />
|
||||
<short>Comma separated list of alternative ports to listen to</short>
|
||||
<description>
|
||||
In addition to the server_port the hub can listen to a list of alternative ports.
|
||||
</description>
|
||||
<example>
|
||||
server_alt_ports = 1295,1512,53990
|
||||
</example>
|
||||
<since>0.3.0</since>
|
||||
</option>
|
||||
|
||||
<option name="hub_enabled" type="boolean" default="1">
|
||||
<short>Is server enabled</short>
|
||||
<description>
|
||||
Use this to disable the hub for a while.
|
||||
</description>
|
||||
<since>0.1.3</since>
|
||||
</option>
|
||||
|
||||
<option name="show_banner" type="boolean" default="1">
|
||||
<short>Show banner on connect</short>
|
||||
<description>
|
||||
If enabled, the hub will announce the software version running to clients when they connect with a message like: "Powered by uhub/0.x.y"
|
||||
</description>
|
||||
<since>0.1.0</since>
|
||||
</option>
|
||||
|
||||
<option name="show_banner_sys_info" type="boolean" default="1">
|
||||
<short>Show banner on connect</short>
|
||||
<description>
|
||||
If enabled, the hub will announce the operating system and CPU architecture to clients when they join.<br />
|
||||
This option has no effect if show_banner is disabled.
|
||||
</description>
|
||||
<since>0.3.0</since>
|
||||
</option>
|
||||
|
||||
<option name="max_users" type="int" default="500">
|
||||
<check min="1" />
|
||||
<short>Maximum number of users allowed on the hub</short>
|
||||
<description>
|
||||
The maximum amount of users allowed on the hub.
|
||||
No new users will be allowed to enter the hub if this number is exceeded, however privileged users (operators, admins, etc) are still able to log in.
|
||||
</description>
|
||||
<since>0.1.0</since>
|
||||
<example>
|
||||
To run a hub for max 25 users:<br />
|
||||
max_users = 25
|
||||
</example>
|
||||
</option>
|
||||
|
||||
<option name="registered_users_only" type="boolean" default="0">
|
||||
<short>Allow registered users only</short>
|
||||
<description>
|
||||
If this is enabled only registered users will be able to use the hub. A user must be registered in the acl file (file_acl).
|
||||
</description>
|
||||
<since>0.1.1</since>
|
||||
</option>
|
||||
|
||||
<option name="obsolete_clients" type="boolean" default="0">
|
||||
<short>Support obsolete clients using a ADC protocol prior to 1.0</short>
|
||||
<description>
|
||||
If this is enabled users using old ADC clients are allowed to enter the hub,
|
||||
however they cannot log in using passwords since the protocols are incompatible.
|
||||
</description>
|
||||
<since>0.3.1</since>
|
||||
</option>
|
||||
|
||||
<option name="chat_only" type="boolean" default="0">
|
||||
<short>Allow chat only operation on hub</short>
|
||||
<description>
|
||||
If this is enabled the hub will refuse to relay messages for search and connection setup. This effectively makes the hub viable for chat only.
|
||||
</description>
|
||||
<since>0.1.1</since>
|
||||
</option>
|
||||
|
||||
<option name="chat_is_privileged" type="boolean" default="0">
|
||||
<short>Allow chat for operators and above only</short>
|
||||
<description>
|
||||
If enabled only operators and admins are allowed to chat in the main chat.
|
||||
</description>
|
||||
<since>0.2.4</since>
|
||||
</option>
|
||||
|
||||
<option name="hub_name" type="string" default="uhub">
|
||||
<short>Name of hub</short>
|
||||
<description>
|
||||
Configures the name of the hub
|
||||
</description>
|
||||
<since>0.1.0</since>
|
||||
<example>
|
||||
hub_name = "my hub"
|
||||
</example>
|
||||
</option>
|
||||
|
||||
<option name="hub_description" type="string" default="no description">
|
||||
<short>Short hub description, topic or subject.</short>
|
||||
<description>
|
||||
This is the description of the hub, as seen by users and hub lists.
|
||||
</description>
|
||||
<since>0.1.0</since>
|
||||
<example>
|
||||
hub_description = "a friendly hub for friendly people"
|
||||
</example>
|
||||
</option>
|
||||
|
||||
<option name="max_recv_buffer" type="int" default="4096" advanced="true" >
|
||||
<check min="1024" max="1048576" />
|
||||
<short>Max read buffer before parse, per user</short>
|
||||
<description>
|
||||
Maximum receive buffer allowed before commands are procesed. If a single ADC message exceeds this limit, it will be discarded by the hub. Use with caution.
|
||||
</description>
|
||||
<since>0.1.3</since>
|
||||
</option>
|
||||
|
||||
<option name="max_send_buffer" type="int" default="131072" advanced="true" >
|
||||
<check min="2048" />
|
||||
<short>Max send buffer before disconnect, per user</short>
|
||||
<description>
|
||||
Maximum amount of bytes allowed to be queued for sending to any particular user before the hub will disconnect the user. The lower the limit, the more aggressive the hub will be to disconnect slow clients. Use with caution.
|
||||
</description>
|
||||
<since>0.1.3</since>
|
||||
</option>
|
||||
|
||||
<option name="max_send_buffer_soft" type="int" default="98304" advanced="true" >
|
||||
<check min="1024" />
|
||||
<short>Max send buffer before message drops, per user</short>
|
||||
<description>
|
||||
Same as max_send_buffer, however low priority messages may be discarded if this limit is reached. Use with caution.
|
||||
</description>
|
||||
<since>0.1.3</since>
|
||||
</option>
|
||||
|
||||
<option name="low_bandwidth_mode" type="boolean" default="0" advanced="true" >
|
||||
<short>Enable bandwidth saving measures</short>
|
||||
<description>
|
||||
If this is enabled the hub will remove excessive information from each user's info message before broadcasting to all connected users.
|
||||
Description, e-mail address will be removed. This saves upload bandwidth for the hub.
|
||||
</description>
|
||||
<since>0.2.2</since>
|
||||
</option>
|
||||
|
||||
<option name="max_chat_history" type="int" default="20">
|
||||
<check min="0" max="250" />
|
||||
<short>Number of chat messages kept in history</short>
|
||||
<description>
|
||||
This specifies the number of main chat messages that are kept in the history buffer.
|
||||
Users can use the "!history" command to list these messages.
|
||||
</description>
|
||||
<since>0.3.0</since>
|
||||
</option>
|
||||
|
||||
<option name="max_logout_log" type="int" default="20">
|
||||
<check min="0" max="2000" />
|
||||
<short>Number of log entries for people leaving the hub</short>
|
||||
<description>
|
||||
Operators can use the "!log" command to list users who have recently left the hub.
|
||||
This option specifies the maximum size of this log.
|
||||
</description>
|
||||
<since>0.3.0</since>
|
||||
</option>
|
||||
|
||||
<option name="limit_max_hubs_user" type="int" default="10">
|
||||
<check min="0" />
|
||||
<short>Max concurrent hubs as a guest user</short>
|
||||
<description>
|
||||
This limits the number of hubs a user can be logged into as a guest user. If this number is exceeded, the user will not be allowed to enter the hub.
|
||||
</description>
|
||||
<syntax>0 = off</syntax>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="limit_max_hubs_reg" type="int" default="10">
|
||||
<check min="0" />
|
||||
<short>Max concurrent hubs as a registered user</short>
|
||||
<description>
|
||||
This limits the number of hubs a user can be logged into as a registered user. If this number is exceeded, the user will not be allowed to enter the hub.
|
||||
</description>
|
||||
<syntax>0 = off</syntax>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="limit_max_hubs_op" type="int" default="10">
|
||||
<check min="0" />
|
||||
<short>Max concurrent hubs as a operator (or admin)</short>
|
||||
<description>
|
||||
This limits the number of hubs a user can be logged into as an operator. If this number is exceeded, the user will not be allowed to enter the hub.
|
||||
</description>
|
||||
<syntax>0 = off</syntax>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="limit_max_hubs" type="int" default="25">
|
||||
<check min="0" />
|
||||
<short>Max total hub connections allowed, user/reg/op combined.</short>
|
||||
<description>
|
||||
Limit the number of hubs a user can be logged into in total regardless of registrations or privileges.
|
||||
If this number is exceeded, the user will not be allowed to enter the hub.
|
||||
</description>
|
||||
<syntax>0 = off</syntax>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="limit_min_hubs_user" type="int" default="10">
|
||||
<check min="0" />
|
||||
<short>Minimum concurrent hubs as a guest user</short>
|
||||
<description>
|
||||
Only allow users that are logged into other hubs with guest privileges to enter this hub.
|
||||
</description>
|
||||
<syntax>0 = off</syntax>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="limit_min_hubs_reg" type="int" default="10">
|
||||
<check min="0" />
|
||||
<short>Minimum concurrent hubs as a registered user</short>
|
||||
<description>
|
||||
Only allow users that are logged into other hubs as a registered user to enter this hub.
|
||||
</description>
|
||||
<syntax>0 = off</syntax>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="limit_min_hubs_op" type="int" default="10">
|
||||
<check min="0" />
|
||||
<short>Minimum concurrent hubs as a operator (or admin)</short>
|
||||
<description>
|
||||
Only allow users that are logged into other hubs with operator privileges to enter this hub.
|
||||
</description>
|
||||
<syntax>0 = off</syntax>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="limit_min_share" type="int" default="0">
|
||||
<check min="0" />
|
||||
<short>Limit minimum share size in megabytes</short>
|
||||
<description>
|
||||
Minimum share limit in megabytes (MiB). Users sharing less than this will not be allowed to enter the hub.
|
||||
</description>
|
||||
<syntax>0 = off</syntax>
|
||||
<since>0.2.0</since>
|
||||
<example>
|
||||
To require users to share at least 1 GB in order to enter the hub:<br />
|
||||
limit_min_share = 1024
|
||||
</example>
|
||||
</option>
|
||||
|
||||
<option name="limit_max_share" type="int" default="0">
|
||||
<check min="0" />
|
||||
<short>Limit maximum share size in megabytes</short>
|
||||
<description>
|
||||
Maximum share limit in megabytes (MiB). Users sharing more than this will not be allowed to enter the hub.
|
||||
</description>
|
||||
<syntax>0 = off</syntax>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
|
||||
<option name="limit_min_slots" type="int" default="0">
|
||||
<check min="0" />
|
||||
<short>Limit minimum number of upload slots open per user</short>
|
||||
<description>
|
||||
Minimum number of upload slots required. Users with less than this will not be allowed to enter the hub.
|
||||
</description>
|
||||
<syntax>0 = off</syntax>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="limit_max_slots" type="int" default="0">
|
||||
<check min="0" />
|
||||
<short>Limit minimum number of upload slots open per user</short>
|
||||
<description>
|
||||
Maximum number of upload slots allowed. Users with more than this will not be allowed to enter the hub.
|
||||
</description>
|
||||
<syntax>0 = off</syntax>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="flood_ctl_interval" type="int" default="0">
|
||||
<check min="0" max="60" />
|
||||
<short>Time interval in seconds for flood control check.</short>
|
||||
<description>
|
||||
This is the time interval that will be used for all flood control calculations.
|
||||
If this is 0 then all flood control is disabled.
|
||||
</description>
|
||||
<example>
|
||||
To limit maximum chat messages to 5 messages on 10 seconds: <br />
|
||||
flood_ctl_interval = 10 <br />
|
||||
flood_ctl_chat = 5<br />
|
||||
</example>
|
||||
<syntax>0 = off</syntax>
|
||||
<since>0.3.1</since>
|
||||
</option>
|
||||
|
||||
<option name="flood_ctl_chat" type="int" default="0">
|
||||
<short>Max chat messages allowed in time interval</short>
|
||||
<description>
|
||||
If this is 0 then no flood control is disabled for chat messages.
|
||||
</description>
|
||||
<syntax>0 = off</syntax>
|
||||
<since>0.3.1</since>
|
||||
</option>
|
||||
|
||||
<option name="flood_ctl_connect" type="int" default="0">
|
||||
<short>Max connections requests allowed in time interval</short>
|
||||
<description>
|
||||
If this is 0 then no flood control is disabled for connection requests.
|
||||
</description>
|
||||
<syntax>0 = off</syntax>
|
||||
<since>0.3.1</since>
|
||||
</option>
|
||||
|
||||
<option name="flood_ctl_search" type="int" default="0">
|
||||
<short>Max search requests allowed in time interval</short>
|
||||
<description>
|
||||
If this is 0 then no flood control is disabled for search requests.
|
||||
</description>
|
||||
<syntax>0 = off</syntax>
|
||||
<since>0.3.1</since>
|
||||
</option>
|
||||
|
||||
|
||||
<option name="flood_ctl_update" type="int" default="0">
|
||||
<short>Max updates allowed in time interval</short>
|
||||
<description>
|
||||
If this is 0 then no flood control is disabled for info updates (INF messages).
|
||||
</description>
|
||||
<syntax>0 = off</syntax>
|
||||
<since>0.3.1</since>
|
||||
</option>
|
||||
|
||||
<option name="flood_ctl_extras" type="int" default="0">
|
||||
<short>Max extra messages allowed in time interval</short>
|
||||
<description>
|
||||
Extra messages are messages that don't fit into the category of chat, search, update or connect.
|
||||
</description>
|
||||
<syntax>0 = off</syntax>
|
||||
<since>0.3.1</since>
|
||||
</option>
|
||||
|
||||
<option name="tls_enable" type="boolean" default="0">
|
||||
<short>Enable SSL/TLS support</short>
|
||||
<description>
|
||||
Enables/disables TLS/SSL support. tls_certificate and tls_private_key must be set if this is enabled.
|
||||
</description>
|
||||
<since>0.3.0</since>
|
||||
</option>
|
||||
|
||||
<option name="tls_require" type="boolean" default="0">
|
||||
<short>If SSL/TLS enabled, should it be required (default: 0)</short>
|
||||
<description>
|
||||
If TLS/SSL support is enabled it can either be optional or mandatory.
|
||||
If this option is disabled then SSL/TLS is not required to enter the hub, however it is possible to enter either with or without.
|
||||
This option has no effect unless tls_enable is enabled.
|
||||
</description>
|
||||
<since>0.3.0</since>
|
||||
</option>
|
||||
|
||||
<option name="tls_certificate" type="file" default="">
|
||||
<short>Certificate file</short>
|
||||
<description>
|
||||
Path to a TLS/SSL certificate (PEM format).
|
||||
</description>
|
||||
<since>0.3.0</since>
|
||||
</option>
|
||||
|
||||
<option name="tls_private_key" type="file" default="">
|
||||
<short>Private key file</short>
|
||||
<description>
|
||||
Path to a TLS/SSL private key (PEM format).
|
||||
</description>
|
||||
<since>0.3.0</since>
|
||||
</option>
|
||||
|
||||
<option name="file_motd" type="file" default="">
|
||||
<short>File containing the 'message of the day</short>
|
||||
<description>
|
||||
This can be specified as a message of the day file. If a valid file is given here it's content will be sent to all users after they have logged in to the hub. If the file is missing or empty this configuration entry will be ignored.
|
||||
</description>
|
||||
<since>0.1.3</since>
|
||||
<example>
|
||||
<p>
|
||||
Unix users: <br />
|
||||
file_acl = "/etc/uhub/motd.txt"
|
||||
</p>
|
||||
<p>
|
||||
Windows users: <br />
|
||||
file_acl = "c:\uhub\motd.txt"
|
||||
</p>
|
||||
</example>
|
||||
</option>
|
||||
|
||||
<option name="file_acl" type="file" default="">
|
||||
<short>File containing access control lists</short>
|
||||
<description>
|
||||
This is an access control list (acl) file.
|
||||
In this file all registered users, bans, etc should be stored.
|
||||
If the file is missing, or empty no registered users, or ban records are used.
|
||||
</description>
|
||||
<since>0.1.3</since>
|
||||
<example>
|
||||
<p>
|
||||
Unix users: <br />
|
||||
file_acl = "/etc/uhub/users.conf"
|
||||
</p>
|
||||
<p>
|
||||
Windows users: <br />
|
||||
file_acl = "c:\uhub\users.conf"
|
||||
</p>
|
||||
</example>
|
||||
</option>
|
||||
|
||||
<option name="file_rules" type="file" default="">
|
||||
<short>File containing hub rules</short>
|
||||
<description>
|
||||
This is a text file that is displayed on login as an extended message of the day.
|
||||
In addition the contents of the file is displayed when a user uses the "!rules" command.
|
||||
</description>
|
||||
<since>0.3.0</since>
|
||||
<example>
|
||||
<p>
|
||||
Unix users: <br />
|
||||
file_acl = "/etc/uhub/rules.txt"
|
||||
</p>
|
||||
<p>
|
||||
Windows users: <br />
|
||||
file_acl = "c:\uhub\rules.txt"
|
||||
</p>
|
||||
</example>
|
||||
</option>
|
||||
|
||||
<option name="msg_hub_full" type="message" default="Hub is full" >
|
||||
<description>This will be sent if the hub is full</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_hub_disabled" type="message" default="Hub is disabled" >
|
||||
<description>This will be sent if the hub is disabled (hub_enable = off)</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_hub_registered_users_only" type="message" default="Hub is for registered users only" >
|
||||
<description>This will be sent if the hub is configured to only accept registered users (registered_users_only = yes)</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_inf_error_nick_missing" type="message" default="No nickname given">
|
||||
<description>This is an error message that will be sent to clients that do not provide a nickname.</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_inf_error_nick_multiple" type="message" default="Multiple nicknames given">
|
||||
<description>This is an error message that will be sent to clients that provide multiple nicknames.</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_inf_error_nick_invalid" type="message" default="Nickname is invalid">
|
||||
<description>This is an error message that will be sent to clients that provides an invalid nickname.</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_inf_error_nick_long" type="message" default="Nickname too long">
|
||||
<description>This is an error message that will be sent to clients that provides a too long nickname.</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_inf_error_nick_short" type="message" default="Nickname too short">
|
||||
<description>This is an error message that will be sent to clients that provides a too short nickname.</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_inf_error_nick_spaces" type="message" default="Nickname cannot start with spaces">
|
||||
<description>This is an error message that will be sent to clients that provides a nickname that starts with a space.</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_inf_error_nick_bad_chars" type="message" default="Nickname contains invalid characters">
|
||||
<description>This is an error message that will be sent to clients that provides invalid characters in the nickname.</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_inf_error_nick_not_utf8" type="message" default="Nickname is not valid UTF-8">
|
||||
<description>This is an error message that will be sent to clients that provides a nick name that is not valid UTF-8 encoded.</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_inf_error_nick_taken" type="message" default="Nickname is already in use">
|
||||
<description>This message will be sent to clients if their provided nickname is alredy in use on the hub.</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_inf_error_nick_restricted" type="message" default="Nickname cannot be used on this hub">
|
||||
<description>This message will be sent to clients if they provide a restricted nickname. Restricted names can be configured in the acl.</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_inf_error_cid_invalid" type="message" default="CID is not valid">
|
||||
<description>This is an error message that will be sent to clients that provides an invalid client ID (CID)</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_inf_error_cid_missing" type="message" default="CID is not specified">
|
||||
<description>This is an error message that will be sent to clients that does not provide a client ID (CID)</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_inf_error_cid_taken" type="message" default="CID is taken">
|
||||
<description>This is an error message that will be sent to clients that provides a client ID (CID) already in use on the hub.</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_inf_error_pid_missing" type="message" default="PID is not specified">
|
||||
<description>This is an error message that will be sent to clients that does not provide a private ID (PID)</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_inf_error_pid_invalid" type="message" default="PID is invalid">
|
||||
<description>This is an error message that will be sent to clients that provides an invalid private ID (PID)</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_ban_permanently" type="message" default="Banned permanently">
|
||||
<description>This message is sent to users if they are banned (see acl)</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_ban_temporarily" type="message" default="Banned temporarily">
|
||||
<description>This message is sent to users if they are banned temporarily</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
|
||||
<option name="msg_auth_invalid_password" type="message" default="Password is wrong">
|
||||
<description>This message is sent to users if they provide a wrong password.</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_auth_user_not_found" type="message" default="User not found in password database">
|
||||
<description>This message is used if a user cannot be found in the password database.</description>
|
||||
<since>0.2.0</since> <!-- FIXME? -->
|
||||
</option>
|
||||
|
||||
<option name="msg_error_no_memory" type="message" default="No memory">
|
||||
<description></description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_user_share_size_low" type="message" default="User is not sharing enough">
|
||||
<description>This message is sent to users if they are not sharing enough.</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_user_share_size_high" type="message" default="User is sharing too much">
|
||||
<description>This message is sent to users if they are sharing too much.</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_user_slots_low" type="message" default="User have too few upload slots.">
|
||||
<description>This message is sent to users if they do not have enough upload slots.</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_user_slots_high" type="message" default="User have too many upload slots.">
|
||||
<description>This message is sent to users if they have too many upload slots.</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_user_hub_limit_low" type="message" default="User is on too few hubs.">
|
||||
<description>This message is sent to users if they are on too few other hubs.</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_user_hub_limit_high" type="message" default="User is on too many hubs.">
|
||||
<description>This message is sent to users if they are on too many other hubs.</description>
|
||||
<since>0.2.0</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_user_flood_chat" type="message" default="Chat flood detected, messages are dropped.">
|
||||
<description>This message is sent once to users who are flooding the chat.</description>
|
||||
<since>0.3.1</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_user_flood_connect" type="message" default="Connect flood detected, connection refused.">
|
||||
<description>This message is sent once to users who are sending too many connect requests too fast.</description>
|
||||
<since>0.3.1</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_user_flood_search" type="message" default="Search flood detected, search is stopped.">
|
||||
<description>This message is sent once to users who are sending too many search requests too fast.</description>
|
||||
<since>0.3.1</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_user_flood_update" type="message" default="Update flood detected.">
|
||||
<description>This message is sent once to users who are sending too many updates too fast.</description>
|
||||
<since>0.3.1</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_user_flood_extras" type="message" default="Flood detected.">
|
||||
<description>This message is sent once to users who are sending too many messages to the hub that neither are chat, searhes, updates nor connection requests..</description>
|
||||
<since>0.3.1</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_proto_no_common_hash" type="message" default="No common hash algorithm.">
|
||||
<description>This message is sent if a client connects that does support ADC/1.0 but not a hash algorithm that the hub supports.</description>
|
||||
<since>0.3.1</since>
|
||||
</option>
|
||||
|
||||
<option name="msg_proto_obsolete_adc0" type="message" default="Client is using an obsolete ADC protocol version.">
|
||||
<description>This message is sent if a client connects that does not support ADC/1.0, but rather the obsolete ADC/0.1 version.</description>
|
||||
<since>0.3.1</since>
|
||||
</option>
|
||||
|
||||
</config>
|
306
src/core/gen_config.c
Normal file
306
src/core/gen_config.c
Normal file
@ -0,0 +1,306 @@
|
||||
/* THIS FILE IS AUTOGENERATED - DO NOT CHANGE IT! */
|
||||
|
||||
void config_defaults(struct hub_config* config)
|
||||
{
|
||||
DEFAULT_INTEGER(server_port, 1511);
|
||||
DEFAULT_STRING (server_bind_addr, "any");
|
||||
DEFAULT_INTEGER(server_listen_backlog, 50);
|
||||
DEFAULT_STRING (server_alt_ports, "");
|
||||
DEFAULT_BOOLEAN(hub_enabled, 1);
|
||||
DEFAULT_BOOLEAN(show_banner, 1);
|
||||
DEFAULT_BOOLEAN(show_banner_sys_info, 1);
|
||||
DEFAULT_INTEGER(max_users, 500);
|
||||
DEFAULT_BOOLEAN(registered_users_only, 0);
|
||||
DEFAULT_BOOLEAN(obsolete_clients, 0);
|
||||
DEFAULT_BOOLEAN(chat_only, 0);
|
||||
DEFAULT_BOOLEAN(chat_is_privileged, 0);
|
||||
DEFAULT_STRING (hub_name, "uhub");
|
||||
DEFAULT_STRING (hub_description, "no description");
|
||||
DEFAULT_INTEGER(max_recv_buffer, 4096);
|
||||
DEFAULT_INTEGER(max_send_buffer, 131072);
|
||||
DEFAULT_INTEGER(max_send_buffer_soft, 98304);
|
||||
DEFAULT_BOOLEAN(low_bandwidth_mode, 0);
|
||||
DEFAULT_INTEGER(max_chat_history, 20);
|
||||
DEFAULT_INTEGER(max_logout_log, 20);
|
||||
DEFAULT_INTEGER(limit_max_hubs_user, 10);
|
||||
DEFAULT_INTEGER(limit_max_hubs_reg, 10);
|
||||
DEFAULT_INTEGER(limit_max_hubs_op, 10);
|
||||
DEFAULT_INTEGER(limit_max_hubs, 25);
|
||||
DEFAULT_INTEGER(limit_min_hubs_user, 10);
|
||||
DEFAULT_INTEGER(limit_min_hubs_reg, 10);
|
||||
DEFAULT_INTEGER(limit_min_hubs_op, 10);
|
||||
DEFAULT_INTEGER(limit_min_share, 0);
|
||||
DEFAULT_INTEGER(limit_max_share, 0);
|
||||
DEFAULT_INTEGER(limit_min_slots, 0);
|
||||
DEFAULT_INTEGER(limit_max_slots, 0);
|
||||
DEFAULT_INTEGER(flood_ctl_interval, 0);
|
||||
DEFAULT_INTEGER(flood_ctl_chat, 0);
|
||||
DEFAULT_INTEGER(flood_ctl_connect, 0);
|
||||
DEFAULT_INTEGER(flood_ctl_search, 0);
|
||||
DEFAULT_INTEGER(flood_ctl_update, 0);
|
||||
DEFAULT_INTEGER(flood_ctl_extras, 0);
|
||||
DEFAULT_BOOLEAN(tls_enable, 0);
|
||||
DEFAULT_BOOLEAN(tls_require, 0);
|
||||
DEFAULT_STRING (tls_certificate, "");
|
||||
DEFAULT_STRING (tls_private_key, "");
|
||||
DEFAULT_STRING (file_motd, "");
|
||||
DEFAULT_STRING (file_acl, "");
|
||||
DEFAULT_STRING (file_rules, "");
|
||||
DEFAULT_STRING (msg_hub_full, "Hub is full");
|
||||
DEFAULT_STRING (msg_hub_disabled, "Hub is disabled");
|
||||
DEFAULT_STRING (msg_hub_registered_users_only, "Hub is for registered users only");
|
||||
DEFAULT_STRING (msg_inf_error_nick_missing, "No nickname given");
|
||||
DEFAULT_STRING (msg_inf_error_nick_multiple, "Multiple nicknames given");
|
||||
DEFAULT_STRING (msg_inf_error_nick_invalid, "Nickname is invalid");
|
||||
DEFAULT_STRING (msg_inf_error_nick_long, "Nickname too long");
|
||||
DEFAULT_STRING (msg_inf_error_nick_short, "Nickname too short");
|
||||
DEFAULT_STRING (msg_inf_error_nick_spaces, "Nickname cannot start with spaces");
|
||||
DEFAULT_STRING (msg_inf_error_nick_bad_chars, "Nickname contains invalid characters");
|
||||
DEFAULT_STRING (msg_inf_error_nick_not_utf8, "Nickname is not valid UTF-8");
|
||||
DEFAULT_STRING (msg_inf_error_nick_taken, "Nickname is already in use");
|
||||
DEFAULT_STRING (msg_inf_error_nick_restricted, "Nickname cannot be used on this hub");
|
||||
DEFAULT_STRING (msg_inf_error_cid_invalid, "CID is not valid");
|
||||
DEFAULT_STRING (msg_inf_error_cid_missing, "CID is not specified");
|
||||
DEFAULT_STRING (msg_inf_error_cid_taken, "CID is taken");
|
||||
DEFAULT_STRING (msg_inf_error_pid_missing, "PID is not specified");
|
||||
DEFAULT_STRING (msg_inf_error_pid_invalid, "PID is invalid");
|
||||
DEFAULT_STRING (msg_ban_permanently, "Banned permanently");
|
||||
DEFAULT_STRING (msg_ban_temporarily, "Banned temporarily");
|
||||
DEFAULT_STRING (msg_auth_invalid_password, "Password is wrong");
|
||||
DEFAULT_STRING (msg_auth_user_not_found, "User not found in password database");
|
||||
DEFAULT_STRING (msg_error_no_memory, "No memory");
|
||||
DEFAULT_STRING (msg_user_share_size_low, "User is not sharing enough");
|
||||
DEFAULT_STRING (msg_user_share_size_high, "User is sharing too much");
|
||||
DEFAULT_STRING (msg_user_slots_low, "User have too few upload slots.");
|
||||
DEFAULT_STRING (msg_user_slots_high, "User have too many upload slots.");
|
||||
DEFAULT_STRING (msg_user_hub_limit_low, "User is on too few hubs.");
|
||||
DEFAULT_STRING (msg_user_hub_limit_high, "User is on too many hubs.");
|
||||
DEFAULT_STRING (msg_user_flood_chat, "Chat flood detected, messages are dropped.");
|
||||
DEFAULT_STRING (msg_user_flood_connect, "Connect flood detected, connection refused.");
|
||||
DEFAULT_STRING (msg_user_flood_search, "Search flood detected, search is stopped.");
|
||||
DEFAULT_STRING (msg_user_flood_update, "Update flood detected.");
|
||||
DEFAULT_STRING (msg_user_flood_extras, "Flood detected.");
|
||||
DEFAULT_STRING (msg_proto_no_common_hash, "No common hash algorithm.");
|
||||
DEFAULT_STRING (msg_proto_obsolete_adc0, "Client is using an obsolete ADC protocol version.");
|
||||
}
|
||||
|
||||
static int apply_config(struct hub_config* config, char* key, char* data, int line_count)
|
||||
{
|
||||
GET_INT (server_port);
|
||||
GET_STR (server_bind_addr);
|
||||
GET_INT (server_listen_backlog);
|
||||
GET_STR (server_alt_ports);
|
||||
GET_BOOL(hub_enabled);
|
||||
GET_BOOL(show_banner);
|
||||
GET_BOOL(show_banner_sys_info);
|
||||
GET_INT (max_users);
|
||||
GET_BOOL(registered_users_only);
|
||||
GET_BOOL(obsolete_clients);
|
||||
GET_BOOL(chat_only);
|
||||
GET_BOOL(chat_is_privileged);
|
||||
GET_STR (hub_name);
|
||||
GET_STR (hub_description);
|
||||
GET_INT (max_recv_buffer);
|
||||
GET_INT (max_send_buffer);
|
||||
GET_INT (max_send_buffer_soft);
|
||||
GET_BOOL(low_bandwidth_mode);
|
||||
GET_INT (max_chat_history);
|
||||
GET_INT (max_logout_log);
|
||||
GET_INT (limit_max_hubs_user);
|
||||
GET_INT (limit_max_hubs_reg);
|
||||
GET_INT (limit_max_hubs_op);
|
||||
GET_INT (limit_max_hubs);
|
||||
GET_INT (limit_min_hubs_user);
|
||||
GET_INT (limit_min_hubs_reg);
|
||||
GET_INT (limit_min_hubs_op);
|
||||
GET_INT (limit_min_share);
|
||||
GET_INT (limit_max_share);
|
||||
GET_INT (limit_min_slots);
|
||||
GET_INT (limit_max_slots);
|
||||
GET_INT (flood_ctl_interval);
|
||||
GET_INT (flood_ctl_chat);
|
||||
GET_INT (flood_ctl_connect);
|
||||
GET_INT (flood_ctl_search);
|
||||
GET_INT (flood_ctl_update);
|
||||
GET_INT (flood_ctl_extras);
|
||||
GET_BOOL(tls_enable);
|
||||
GET_BOOL(tls_require);
|
||||
GET_STR (tls_certificate);
|
||||
GET_STR (tls_private_key);
|
||||
GET_STR (file_motd);
|
||||
GET_STR (file_acl);
|
||||
GET_STR (file_rules);
|
||||
GET_STR (msg_hub_full);
|
||||
GET_STR (msg_hub_disabled);
|
||||
GET_STR (msg_hub_registered_users_only);
|
||||
GET_STR (msg_inf_error_nick_missing);
|
||||
GET_STR (msg_inf_error_nick_multiple);
|
||||
GET_STR (msg_inf_error_nick_invalid);
|
||||
GET_STR (msg_inf_error_nick_long);
|
||||
GET_STR (msg_inf_error_nick_short);
|
||||
GET_STR (msg_inf_error_nick_spaces);
|
||||
GET_STR (msg_inf_error_nick_bad_chars);
|
||||
GET_STR (msg_inf_error_nick_not_utf8);
|
||||
GET_STR (msg_inf_error_nick_taken);
|
||||
GET_STR (msg_inf_error_nick_restricted);
|
||||
GET_STR (msg_inf_error_cid_invalid);
|
||||
GET_STR (msg_inf_error_cid_missing);
|
||||
GET_STR (msg_inf_error_cid_taken);
|
||||
GET_STR (msg_inf_error_pid_missing);
|
||||
GET_STR (msg_inf_error_pid_invalid);
|
||||
GET_STR (msg_ban_permanently);
|
||||
GET_STR (msg_ban_temporarily);
|
||||
GET_STR (msg_auth_invalid_password);
|
||||
GET_STR (msg_auth_user_not_found);
|
||||
GET_STR (msg_error_no_memory);
|
||||
GET_STR (msg_user_share_size_low);
|
||||
GET_STR (msg_user_share_size_high);
|
||||
GET_STR (msg_user_slots_low);
|
||||
GET_STR (msg_user_slots_high);
|
||||
GET_STR (msg_user_hub_limit_low);
|
||||
GET_STR (msg_user_hub_limit_high);
|
||||
GET_STR (msg_user_flood_chat);
|
||||
GET_STR (msg_user_flood_connect);
|
||||
GET_STR (msg_user_flood_search);
|
||||
GET_STR (msg_user_flood_update);
|
||||
GET_STR (msg_user_flood_extras);
|
||||
GET_STR (msg_proto_no_common_hash);
|
||||
GET_STR (msg_proto_obsolete_adc0);
|
||||
/* Still here -- unknown directive */
|
||||
LOG_ERROR("Unknown configuration directive: '%s'", key);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void free_config(struct hub_config* config)
|
||||
{
|
||||
hub_free(config->server_bind_addr);
|
||||
hub_free(config->server_alt_ports);
|
||||
hub_free(config->hub_name);
|
||||
hub_free(config->hub_description);
|
||||
hub_free(config->tls_certificate);
|
||||
hub_free(config->tls_private_key);
|
||||
hub_free(config->file_motd);
|
||||
hub_free(config->file_acl);
|
||||
hub_free(config->file_rules);
|
||||
hub_free(config->msg_hub_full);
|
||||
hub_free(config->msg_hub_disabled);
|
||||
hub_free(config->msg_hub_registered_users_only);
|
||||
hub_free(config->msg_inf_error_nick_missing);
|
||||
hub_free(config->msg_inf_error_nick_multiple);
|
||||
hub_free(config->msg_inf_error_nick_invalid);
|
||||
hub_free(config->msg_inf_error_nick_long);
|
||||
hub_free(config->msg_inf_error_nick_short);
|
||||
hub_free(config->msg_inf_error_nick_spaces);
|
||||
hub_free(config->msg_inf_error_nick_bad_chars);
|
||||
hub_free(config->msg_inf_error_nick_not_utf8);
|
||||
hub_free(config->msg_inf_error_nick_taken);
|
||||
hub_free(config->msg_inf_error_nick_restricted);
|
||||
hub_free(config->msg_inf_error_cid_invalid);
|
||||
hub_free(config->msg_inf_error_cid_missing);
|
||||
hub_free(config->msg_inf_error_cid_taken);
|
||||
hub_free(config->msg_inf_error_pid_missing);
|
||||
hub_free(config->msg_inf_error_pid_invalid);
|
||||
hub_free(config->msg_ban_permanently);
|
||||
hub_free(config->msg_ban_temporarily);
|
||||
hub_free(config->msg_auth_invalid_password);
|
||||
hub_free(config->msg_auth_user_not_found);
|
||||
hub_free(config->msg_error_no_memory);
|
||||
hub_free(config->msg_user_share_size_low);
|
||||
hub_free(config->msg_user_share_size_high);
|
||||
hub_free(config->msg_user_slots_low);
|
||||
hub_free(config->msg_user_slots_high);
|
||||
hub_free(config->msg_user_hub_limit_low);
|
||||
hub_free(config->msg_user_hub_limit_high);
|
||||
hub_free(config->msg_user_flood_chat);
|
||||
hub_free(config->msg_user_flood_connect);
|
||||
hub_free(config->msg_user_flood_search);
|
||||
hub_free(config->msg_user_flood_update);
|
||||
hub_free(config->msg_user_flood_extras);
|
||||
hub_free(config->msg_proto_no_common_hash);
|
||||
hub_free(config->msg_proto_obsolete_adc0);
|
||||
}
|
||||
|
||||
void dump_config(struct hub_config* config, int ignore_defaults)
|
||||
{
|
||||
DUMP_INT (server_port, 1511);
|
||||
DUMP_STR(server_bind_addr, "any");
|
||||
DUMP_INT (server_listen_backlog, 50);
|
||||
DUMP_STR(server_alt_ports, "");
|
||||
DUMP_BOOL(hub_enabled, 1);
|
||||
DUMP_BOOL(show_banner, 1);
|
||||
DUMP_BOOL(show_banner_sys_info, 1);
|
||||
DUMP_INT (max_users, 500);
|
||||
DUMP_BOOL(registered_users_only, 0);
|
||||
DUMP_BOOL(obsolete_clients, 0);
|
||||
DUMP_BOOL(chat_only, 0);
|
||||
DUMP_BOOL(chat_is_privileged, 0);
|
||||
DUMP_STR(hub_name, "uhub");
|
||||
DUMP_STR(hub_description, "no description");
|
||||
DUMP_INT (max_recv_buffer, 4096);
|
||||
DUMP_INT (max_send_buffer, 131072);
|
||||
DUMP_INT (max_send_buffer_soft, 98304);
|
||||
DUMP_BOOL(low_bandwidth_mode, 0);
|
||||
DUMP_INT (max_chat_history, 20);
|
||||
DUMP_INT (max_logout_log, 20);
|
||||
DUMP_INT (limit_max_hubs_user, 10);
|
||||
DUMP_INT (limit_max_hubs_reg, 10);
|
||||
DUMP_INT (limit_max_hubs_op, 10);
|
||||
DUMP_INT (limit_max_hubs, 25);
|
||||
DUMP_INT (limit_min_hubs_user, 10);
|
||||
DUMP_INT (limit_min_hubs_reg, 10);
|
||||
DUMP_INT (limit_min_hubs_op, 10);
|
||||
DUMP_INT (limit_min_share, 0);
|
||||
DUMP_INT (limit_max_share, 0);
|
||||
DUMP_INT (limit_min_slots, 0);
|
||||
DUMP_INT (limit_max_slots, 0);
|
||||
DUMP_INT (flood_ctl_interval, 0);
|
||||
DUMP_INT (flood_ctl_chat, 0);
|
||||
DUMP_INT (flood_ctl_connect, 0);
|
||||
DUMP_INT (flood_ctl_search, 0);
|
||||
DUMP_INT (flood_ctl_update, 0);
|
||||
DUMP_INT (flood_ctl_extras, 0);
|
||||
DUMP_BOOL(tls_enable, 0);
|
||||
DUMP_BOOL(tls_require, 0);
|
||||
DUMP_STR(tls_certificate, "");
|
||||
DUMP_STR(tls_private_key, "");
|
||||
DUMP_STR(file_motd, "");
|
||||
DUMP_STR(file_acl, "");
|
||||
DUMP_STR(file_rules, "");
|
||||
DUMP_STR(msg_hub_full, "Hub is full");
|
||||
DUMP_STR(msg_hub_disabled, "Hub is disabled");
|
||||
DUMP_STR(msg_hub_registered_users_only, "Hub is for registered users only");
|
||||
DUMP_STR(msg_inf_error_nick_missing, "No nickname given");
|
||||
DUMP_STR(msg_inf_error_nick_multiple, "Multiple nicknames given");
|
||||
DUMP_STR(msg_inf_error_nick_invalid, "Nickname is invalid");
|
||||
DUMP_STR(msg_inf_error_nick_long, "Nickname too long");
|
||||
DUMP_STR(msg_inf_error_nick_short, "Nickname too short");
|
||||
DUMP_STR(msg_inf_error_nick_spaces, "Nickname cannot start with spaces");
|
||||
DUMP_STR(msg_inf_error_nick_bad_chars, "Nickname contains invalid characters");
|
||||
DUMP_STR(msg_inf_error_nick_not_utf8, "Nickname is not valid UTF-8");
|
||||
DUMP_STR(msg_inf_error_nick_taken, "Nickname is already in use");
|
||||
DUMP_STR(msg_inf_error_nick_restricted, "Nickname cannot be used on this hub");
|
||||
DUMP_STR(msg_inf_error_cid_invalid, "CID is not valid");
|
||||
DUMP_STR(msg_inf_error_cid_missing, "CID is not specified");
|
||||
DUMP_STR(msg_inf_error_cid_taken, "CID is taken");
|
||||
DUMP_STR(msg_inf_error_pid_missing, "PID is not specified");
|
||||
DUMP_STR(msg_inf_error_pid_invalid, "PID is invalid");
|
||||
DUMP_STR(msg_ban_permanently, "Banned permanently");
|
||||
DUMP_STR(msg_ban_temporarily, "Banned temporarily");
|
||||
DUMP_STR(msg_auth_invalid_password, "Password is wrong");
|
||||
DUMP_STR(msg_auth_user_not_found, "User not found in password database");
|
||||
DUMP_STR(msg_error_no_memory, "No memory");
|
||||
DUMP_STR(msg_user_share_size_low, "User is not sharing enough");
|
||||
DUMP_STR(msg_user_share_size_high, "User is sharing too much");
|
||||
DUMP_STR(msg_user_slots_low, "User have too few upload slots.");
|
||||
DUMP_STR(msg_user_slots_high, "User have too many upload slots.");
|
||||
DUMP_STR(msg_user_hub_limit_low, "User is on too few hubs.");
|
||||
DUMP_STR(msg_user_hub_limit_high, "User is on too many hubs.");
|
||||
DUMP_STR(msg_user_flood_chat, "Chat flood detected, messages are dropped.");
|
||||
DUMP_STR(msg_user_flood_connect, "Connect flood detected, connection refused.");
|
||||
DUMP_STR(msg_user_flood_search, "Search flood detected, search is stopped.");
|
||||
DUMP_STR(msg_user_flood_update, "Update flood detected.");
|
||||
DUMP_STR(msg_user_flood_extras, "Flood detected.");
|
||||
DUMP_STR(msg_proto_no_common_hash, "No common hash algorithm.");
|
||||
DUMP_STR(msg_proto_obsolete_adc0, "Client is using an obsolete ADC protocol version.");
|
||||
}
|
||||
|
86
src/core/gen_config.h
Normal file
86
src/core/gen_config.h
Normal file
@ -0,0 +1,86 @@
|
||||
/* THIS FILE IS AUTOGENERATED - DO NOT CHANGE IT! */
|
||||
|
||||
struct hub_config
|
||||
{
|
||||
int server_port; /*<<< Server port to bind to (default: 1511) */
|
||||
char* server_bind_addr; /*<<< Server bind address (default: any) */
|
||||
int server_listen_backlog; /*<<< Server listen backlog (default: 50) */
|
||||
char* server_alt_ports; /*<<< Comma separated list of alternative ports to listen to (default: ) */
|
||||
int hub_enabled; /*<<< Is server enabled (default: 1) */
|
||||
int show_banner; /*<<< Show banner on connect (default: 1) */
|
||||
int show_banner_sys_info; /*<<< Show banner on connect (default: 1) */
|
||||
int max_users; /*<<< Maximum number of users allowed on the hub (default: 500) */
|
||||
int registered_users_only; /*<<< Allow registered users only (default: 0) */
|
||||
int obsolete_clients; /*<<< Support obsolete clients using a ADC protocol prior to 1.0 (default: 0) */
|
||||
int chat_only; /*<<< Allow chat only operation on hub (default: 0) */
|
||||
int chat_is_privileged; /*<<< Allow chat for operators and above only (default: 0) */
|
||||
char* hub_name; /*<<< Name of hub (default: uhub) */
|
||||
char* hub_description; /*<<< Short hub description, topic or subject. (default: no description) */
|
||||
int max_recv_buffer; /*<<< Max read buffer before parse, per user (default: 4096) */
|
||||
int max_send_buffer; /*<<< Max send buffer before disconnect, per user (default: 131072) */
|
||||
int max_send_buffer_soft; /*<<< Max send buffer before message drops, per user (default: 98304) */
|
||||
int low_bandwidth_mode; /*<<< Enable bandwidth saving measures (default: 0) */
|
||||
int max_chat_history; /*<<< Number of chat messages kept in history (default: 20) */
|
||||
int max_logout_log; /*<<< Number of log entries for people leaving the hub (default: 20) */
|
||||
int limit_max_hubs_user; /*<<< Max concurrent hubs as a guest user (default: 10) */
|
||||
int limit_max_hubs_reg; /*<<< Max concurrent hubs as a registered user (default: 10) */
|
||||
int limit_max_hubs_op; /*<<< Max concurrent hubs as a operator (or admin) (default: 10) */
|
||||
int limit_max_hubs; /*<<< Max total hub connections allowed, user/reg/op combined. (default: 25) */
|
||||
int limit_min_hubs_user; /*<<< Minimum concurrent hubs as a guest user (default: 10) */
|
||||
int limit_min_hubs_reg; /*<<< Minimum concurrent hubs as a registered user (default: 10) */
|
||||
int limit_min_hubs_op; /*<<< Minimum concurrent hubs as a operator (or admin) (default: 10) */
|
||||
int limit_min_share; /*<<< Limit minimum share size in megabytes (default: 0) */
|
||||
int limit_max_share; /*<<< Limit maximum share size in megabytes (default: 0) */
|
||||
int limit_min_slots; /*<<< Limit minimum number of upload slots open per user (default: 0) */
|
||||
int limit_max_slots; /*<<< Limit minimum number of upload slots open per user (default: 0) */
|
||||
int flood_ctl_interval; /*<<< Time interval in seconds for flood control check. (default: 0) */
|
||||
int flood_ctl_chat; /*<<< Max chat messages allowed in time interval (default: 0) */
|
||||
int flood_ctl_connect; /*<<< Max connections requests allowed in time interval (default: 0) */
|
||||
int flood_ctl_search; /*<<< Max search requests allowed in time interval (default: 0) */
|
||||
int flood_ctl_update; /*<<< Max updates allowed in time interval (default: 0) */
|
||||
int flood_ctl_extras; /*<<< Max extra messages allowed in time interval (default: 0) */
|
||||
int tls_enable; /*<<< Enable SSL/TLS support (default: 0) */
|
||||
int tls_require; /*<<< If SSL/TLS enabled, should it be required (default: 0) (default: 0) */
|
||||
char* tls_certificate; /*<<< Certificate file (default: ) */
|
||||
char* tls_private_key; /*<<< Private key file (default: ) */
|
||||
char* file_motd; /*<<< File containing the 'message of the day (default: ) */
|
||||
char* file_acl; /*<<< File containing access control lists (default: ) */
|
||||
char* file_rules; /*<<< File containing hub rules (default: ) */
|
||||
char* msg_hub_full; /*<<< "Hub is full" */
|
||||
char* msg_hub_disabled; /*<<< "Hub is disabled" */
|
||||
char* msg_hub_registered_users_only; /*<<< "Hub is for registered users only" */
|
||||
char* msg_inf_error_nick_missing; /*<<< "No nickname given" */
|
||||
char* msg_inf_error_nick_multiple; /*<<< "Multiple nicknames given" */
|
||||
char* msg_inf_error_nick_invalid; /*<<< "Nickname is invalid" */
|
||||
char* msg_inf_error_nick_long; /*<<< "Nickname too long" */
|
||||
char* msg_inf_error_nick_short; /*<<< "Nickname too short" */
|
||||
char* msg_inf_error_nick_spaces; /*<<< "Nickname cannot start with spaces" */
|
||||
char* msg_inf_error_nick_bad_chars; /*<<< "Nickname contains invalid characters" */
|
||||
char* msg_inf_error_nick_not_utf8; /*<<< "Nickname is not valid UTF-8" */
|
||||
char* msg_inf_error_nick_taken; /*<<< "Nickname is already in use" */
|
||||
char* msg_inf_error_nick_restricted; /*<<< "Nickname cannot be used on this hub" */
|
||||
char* msg_inf_error_cid_invalid; /*<<< "CID is not valid" */
|
||||
char* msg_inf_error_cid_missing; /*<<< "CID is not specified" */
|
||||
char* msg_inf_error_cid_taken; /*<<< "CID is taken" */
|
||||
char* msg_inf_error_pid_missing; /*<<< "PID is not specified" */
|
||||
char* msg_inf_error_pid_invalid; /*<<< "PID is invalid" */
|
||||
char* msg_ban_permanently; /*<<< "Banned permanently" */
|
||||
char* msg_ban_temporarily; /*<<< "Banned temporarily" */
|
||||
char* msg_auth_invalid_password; /*<<< "Password is wrong" */
|
||||
char* msg_auth_user_not_found; /*<<< "User not found in password database" */
|
||||
char* msg_error_no_memory; /*<<< "No memory" */
|
||||
char* msg_user_share_size_low; /*<<< "User is not sharing enough" */
|
||||
char* msg_user_share_size_high; /*<<< "User is sharing too much" */
|
||||
char* msg_user_slots_low; /*<<< "User have too few upload slots." */
|
||||
char* msg_user_slots_high; /*<<< "User have too many upload slots." */
|
||||
char* msg_user_hub_limit_low; /*<<< "User is on too few hubs." */
|
||||
char* msg_user_hub_limit_high; /*<<< "User is on too many hubs." */
|
||||
char* msg_user_flood_chat; /*<<< "Chat flood detected, messages are dropped." */
|
||||
char* msg_user_flood_connect; /*<<< "Connect flood detected, connection refused." */
|
||||
char* msg_user_flood_search; /*<<< "Search flood detected, search is stopped." */
|
||||
char* msg_user_flood_update; /*<<< "Update flood detected." */
|
||||
char* msg_user_flood_extras; /*<<< "Flood detected." */
|
||||
char* msg_proto_no_common_hash; /*<<< "No common hash algorithm." */
|
||||
char* msg_proto_obsolete_adc0; /*<<< "Client is using an obsolete ADC protocol version." */
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user