m_info: be type-safe, somewhat enforced by macros

This commit is contained in:
Ed Kellett 2020-11-08 21:09:15 +00:00
parent b3701ae2f3
commit 0ee3f45c89

View file

@ -65,609 +65,531 @@ mapi_hlist_av1 info_hlist[] = {
DECLARE_MODULE_AV2(info, NULL, NULL, info_clist, info_hlist, NULL, NULL, NULL, info_desc); DECLARE_MODULE_AV2(info, NULL, NULL, info_clist, info_hlist, NULL, NULL, NULL, info_desc);
enum info_output_type {
OUTPUT_STRING, /* Output option as %s w/ dereference */
OUTPUT_STRING_PTR, /* Output option as %s w/out deference */
OUTPUT_DECIMAL, /* Output option as decimal (%d) */
OUTPUT_BOOLEAN, /* Output option as "ON" or "OFF" */
OUTPUT_BOOLEAN_YN, /* Output option as "YES" or "NO" */
OUTPUT_INTBOOL, /* BOOLEAN encoded as an int */
OUTPUT_INTBOOL_YN, /* BOOLEAN_YN encoded as an int */
OUTPUT_YESNOMASK, /* Output option as "YES/NO/MASKED" */
};
#define INFO_STRING(ptr) OUTPUT_STRING, .option.string_p = (ptr)
#define INFO_STRING_PTR(ptr) OUTPUT_STRING_PTR, .option.string = (ptr)
#define INFO_BOOLEAN(ptr) OUTPUT_BOOLEAN, .option.bool_ = (ptr)
#define INFO_BOOLEAN_YN(ptr) OUTPUT_BOOLEAN_YN, .option.bool_ = (ptr)
#define INFO_INTBOOL(ptr) OUTPUT_INTBOOL, .option.int_ = (ptr)
#define INFO_INTBOOL_YN(ptr) OUTPUT_INTBOOL_YN, .option.int_ = (ptr)
#define INFO_YESNOMASK(ptr) OUTPUT_YESNOMASK, .option.int_ = (ptr)
#define INFO_DECIMAL(ptr) OUTPUT_DECIMAL, .option.int_ = (ptr)
struct InfoStruct struct InfoStruct
{ {
const char *name; const char *name;
unsigned int output_type;
void *option;
const char *desc; const char *desc;
enum info_output_type output_type;
union
{
const int *int_;
const bool *bool_;
char **string_p;
char *string;
} option;
}; };
#define OUTPUT_STRING 0x0001 /* Output option as %s w/ dereference */
#define OUTPUT_STRING_PTR 0x0002 /* Output option as %s w/out deference */
#define OUTPUT_DECIMAL 0x0004 /* Output option as decimal (%d) */
#define OUTPUT_BOOLEAN 0x0008 /* Output option as "ON" or "OFF" */
#define OUTPUT_BOOLEAN_YN 0x0010 /* Output option as "YES" or "NO" */
#define OUTPUT_BOOLEAN2 0x0020 /* Output option as "YES/NO/MASKED" */
/* *INDENT-OFF* */ /* *INDENT-OFF* */
static struct InfoStruct info_table[] = { static struct InfoStruct info_table[] = {
{ {
"opers_see_all_users", "opers_see_all_users",
OUTPUT_BOOLEAN_YN, "Farconnect notices available or operspy accountability limited",
&opers_see_all_users, INFO_BOOLEAN(&opers_see_all_users)
"Farconnect notices available or operspy accountability limited"
}, },
{ {
"max_connections", "max_connections",
OUTPUT_DECIMAL, "Max number connections",
&maxconnections, INFO_DECIMAL(&maxconnections),
"Max number connections"
}, },
{ {
"anti_nick_flood", "anti_nick_flood",
OUTPUT_BOOLEAN, "NICK flood protection",
&ConfigFileEntry.anti_nick_flood, INFO_INTBOOL(&ConfigFileEntry.anti_nick_flood),
"NICK flood protection"
}, },
{ {
"anti_spam_exit_message_time", "anti_spam_exit_message_time",
OUTPUT_DECIMAL, "Duration a client must be connected for to have an exit message",
&ConfigFileEntry.anti_spam_exit_message_time, INFO_DECIMAL(&ConfigFileEntry.anti_spam_exit_message_time),
"Duration a client must be connected for to have an exit message"
}, },
{ {
"caller_id_wait", "caller_id_wait",
OUTPUT_DECIMAL, "Minimum delay between notifying UMODE +g users of messages",
&ConfigFileEntry.caller_id_wait, INFO_DECIMAL(&ConfigFileEntry.caller_id_wait),
"Minimum delay between notifying UMODE +g users of messages"
}, },
{ {
"client_exit", "client_exit",
OUTPUT_BOOLEAN, "Prepend 'Quit:' to user QUIT messages",
&ConfigFileEntry.client_exit, INFO_INTBOOL(&ConfigFileEntry.client_exit),
"Prepend 'Quit:' to user QUIT messages"
}, },
{ {
"client_flood_max_lines", "client_flood_max_lines",
OUTPUT_DECIMAL,
&ConfigFileEntry.client_flood_max_lines,
"Number of lines before a client Excess Flood's", "Number of lines before a client Excess Flood's",
INFO_DECIMAL(&ConfigFileEntry.client_flood_max_lines),
}, },
{ {
"client_flood_burst_rate", "client_flood_burst_rate",
OUTPUT_DECIMAL,
&ConfigFileEntry.client_flood_burst_rate,
"Maximum lines per second during flood grace period", "Maximum lines per second during flood grace period",
INFO_DECIMAL(&ConfigFileEntry.client_flood_burst_rate),
}, },
{ {
"client_flood_burst_max", "client_flood_burst_max",
OUTPUT_DECIMAL,
&ConfigFileEntry.client_flood_burst_max,
"Number of lines to process at once before delaying", "Number of lines to process at once before delaying",
INFO_DECIMAL(&ConfigFileEntry.client_flood_burst_max),
}, },
{ {
"client_flood_message_num", "client_flood_message_num",
OUTPUT_DECIMAL,
&ConfigFileEntry.client_flood_message_num,
"Number of messages to allow per client_flood_message_time outside of burst", "Number of messages to allow per client_flood_message_time outside of burst",
INFO_DECIMAL(&ConfigFileEntry.client_flood_message_num),
}, },
{ {
"client_flood_message_time", "client_flood_message_time",
OUTPUT_DECIMAL,
&ConfigFileEntry.client_flood_message_time,
"Time to allow per client_flood_message_num outside of burst", "Time to allow per client_flood_message_num outside of burst",
INFO_DECIMAL(&ConfigFileEntry.client_flood_message_time),
}, },
{ {
"post_registration_delay", "post_registration_delay",
OUTPUT_DECIMAL,
&ConfigFileEntry.post_registration_delay,
"Time to wait before processing commands from a new client", "Time to wait before processing commands from a new client",
INFO_DECIMAL(&ConfigFileEntry.post_registration_delay),
}, },
{ {
"connect_timeout", "connect_timeout",
OUTPUT_DECIMAL, "Connect timeout for connections to servers",
&ConfigFileEntry.connect_timeout, INFO_DECIMAL(&ConfigFileEntry.connect_timeout),
"Connect timeout for connections to servers"
}, },
{ {
"default_ident_timeout", "default_ident_timeout",
OUTPUT_DECIMAL,
&ConfigFileEntry.default_ident_timeout,
"Amount of time the server waits for ident responses from clients", "Amount of time the server waits for ident responses from clients",
INFO_DECIMAL(&ConfigFileEntry.default_ident_timeout),
}, },
{ {
"default_floodcount", "default_floodcount",
OUTPUT_DECIMAL,
&ConfigFileEntry.default_floodcount,
"Startup value of FLOODCOUNT", "Startup value of FLOODCOUNT",
INFO_DECIMAL(&ConfigFileEntry.default_floodcount),
}, },
{ {
"default_adminstring", "default_adminstring",
OUTPUT_STRING,
&ConfigFileEntry.default_adminstring,
"Default adminstring at startup.", "Default adminstring at startup.",
INFO_STRING(&ConfigFileEntry.default_adminstring),
}, },
{ {
"default_operstring", "default_operstring",
OUTPUT_STRING,
&ConfigFileEntry.default_operstring,
"Default operstring at startup.", "Default operstring at startup.",
INFO_STRING(&ConfigFileEntry.default_operstring),
}, },
{ {
"servicestring", "servicestring",
OUTPUT_STRING,
&ConfigFileEntry.servicestring,
"String shown in whois for opered services.", "String shown in whois for opered services.",
INFO_STRING(&ConfigFileEntry.servicestring),
}, },
{ {
"disable_auth", "disable_auth",
OUTPUT_BOOLEAN_YN, "Controls whether auth checking is disabled or not",
&ConfigFileEntry.disable_auth, INFO_INTBOOL_YN(&ConfigFileEntry.disable_auth),
"Controls whether auth checking is disabled or not"
}, },
{ {
"disable_fake_channels", "disable_fake_channels",
OUTPUT_BOOLEAN_YN, "Controls whether bold etc are disabled for JOIN",
&ConfigFileEntry.disable_fake_channels, INFO_INTBOOL_YN(&ConfigFileEntry.disable_fake_channels),
"Controls whether bold etc are disabled for JOIN"
}, },
{ {
"dots_in_ident", "dots_in_ident",
OUTPUT_DECIMAL, "Number of permissible dots in an ident",
&ConfigFileEntry.dots_in_ident, INFO_DECIMAL(&ConfigFileEntry.dots_in_ident),
"Number of permissible dots in an ident"
}, },
{ {
"failed_oper_notice", "failed_oper_notice",
OUTPUT_BOOLEAN, "Inform opers if someone /oper's with the wrong password",
&ConfigFileEntry.failed_oper_notice, INFO_INTBOOL(&ConfigFileEntry.failed_oper_notice),
"Inform opers if someone /oper's with the wrong password"
}, },
{ {
"fname_userlog", "fname_userlog",
OUTPUT_STRING, "User log file",
&ConfigFileEntry.fname_userlog, INFO_STRING(&ConfigFileEntry.fname_userlog),
"User log file"
}, },
{ {
"fname_fuserlog", "fname_fuserlog",
OUTPUT_STRING, "Failed user log file",
&ConfigFileEntry.fname_fuserlog, INFO_STRING(&ConfigFileEntry.fname_fuserlog),
"Failed user log file"
}, },
{ {
"fname_operlog", "fname_operlog",
OUTPUT_STRING, "Operator log file",
&ConfigFileEntry.fname_operlog, INFO_STRING(&ConfigFileEntry.fname_operlog),
"Operator log file"
}, },
{ {
"fname_foperlog", "fname_foperlog",
OUTPUT_STRING, "Failed operator log file",
&ConfigFileEntry.fname_foperlog, INFO_STRING(&ConfigFileEntry.fname_foperlog),
"Failed operator log file"
}, },
{ {
"fname_serverlog", "fname_serverlog",
OUTPUT_STRING, "Server connect/disconnect log file",
&ConfigFileEntry.fname_serverlog, INFO_STRING(&ConfigFileEntry.fname_serverlog),
"Server connect/disconnect log file"
}, },
{ {
"fname_killlog", "fname_killlog",
OUTPUT_STRING, "KILL log file",
&ConfigFileEntry.fname_killlog, INFO_STRING(&ConfigFileEntry.fname_killlog),
"KILL log file"
}, },
{ {
"fname_klinelog", "fname_klinelog",
OUTPUT_STRING, "KLINE etc log file",
&ConfigFileEntry.fname_klinelog, INFO_STRING(&ConfigFileEntry.fname_klinelog),
"KLINE etc log file"
}, },
{ {
"fname_operspylog", "fname_operspylog",
OUTPUT_STRING, "Oper spy log file",
&ConfigFileEntry.fname_operspylog, INFO_STRING(&ConfigFileEntry.fname_operspylog),
"Oper spy log file"
}, },
{ {
"fname_ioerrorlog", "fname_ioerrorlog",
OUTPUT_STRING, "IO error log file",
&ConfigFileEntry.fname_ioerrorlog, INFO_STRING(&ConfigFileEntry.fname_ioerrorlog),
"IO error log file"
}, },
{ {
"global_snotices", "global_snotices",
OUTPUT_BOOLEAN_YN, "Send out certain server notices globally",
&ConfigFileEntry.global_snotices, INFO_INTBOOL_YN(&ConfigFileEntry.global_snotices),
"Send out certain server notices globally"
}, },
{ {
"hide_error_messages", "hide_error_messages",
OUTPUT_BOOLEAN2, "Hide ERROR messages coming from servers",
&ConfigFileEntry.hide_error_messages, INFO_YESNOMASK(&ConfigFileEntry.hide_error_messages),
"Hide ERROR messages coming from servers"
}, },
{ {
"hide_spoof_ips", "hide_spoof_ips",
OUTPUT_BOOLEAN_YN, "Hide IPs of spoofed users",
&ConfigFileEntry.hide_spoof_ips, INFO_INTBOOL_YN(&ConfigFileEntry.hide_spoof_ips),
"Hide IPs of spoofed users"
}, },
{ {
"kline_reason", "kline_reason",
OUTPUT_STRING, "K-lined clients sign off with this reason",
&ConfigFileEntry.kline_reason, INFO_STRING(&ConfigFileEntry.kline_reason),
"K-lined clients sign off with this reason"
}, },
{ {
"dline_with_reason", "dline_with_reason",
OUTPUT_BOOLEAN_YN, "Display D-line reason to client on disconnect",
&ConfigFileEntry.dline_with_reason, INFO_INTBOOL_YN(&ConfigFileEntry.dline_with_reason),
"Display D-line reason to client on disconnect"
}, },
{ {
"kline_with_reason", "kline_with_reason",
OUTPUT_BOOLEAN_YN, "Display K-line reason to client on disconnect",
&ConfigFileEntry.kline_with_reason, INFO_INTBOOL_YN(&ConfigFileEntry.kline_with_reason),
"Display K-line reason to client on disconnect"
}, },
{ {
"max_accept", "max_accept",
OUTPUT_DECIMAL,
&ConfigFileEntry.max_accept,
"Maximum nicknames on accept list", "Maximum nicknames on accept list",
INFO_DECIMAL(&ConfigFileEntry.max_accept),
}, },
{ {
"max_nick_changes", "max_nick_changes",
OUTPUT_DECIMAL, "NICK change threshold setting",
&ConfigFileEntry.max_nick_changes, INFO_DECIMAL(&ConfigFileEntry.max_nick_changes),
"NICK change threshold setting"
}, },
{ {
"max_nick_time", "max_nick_time",
OUTPUT_DECIMAL, "NICK flood protection time interval",
&ConfigFileEntry.max_nick_time, INFO_DECIMAL(&ConfigFileEntry.max_nick_time),
"NICK flood protection time interval"
}, },
{ {
"max_targets", "max_targets",
OUTPUT_DECIMAL, "The maximum number of PRIVMSG/NOTICE targets",
&ConfigFileEntry.max_targets, INFO_DECIMAL(&ConfigFileEntry.max_targets),
"The maximum number of PRIVMSG/NOTICE targets"
}, },
{ {
"min_nonwildcard", "min_nonwildcard",
OUTPUT_DECIMAL,
&ConfigFileEntry.min_nonwildcard,
"Minimum non-wildcard chars in K lines", "Minimum non-wildcard chars in K lines",
INFO_DECIMAL(&ConfigFileEntry.min_nonwildcard),
}, },
{ {
"min_nonwildcard_simple", "min_nonwildcard_simple",
OUTPUT_DECIMAL,
&ConfigFileEntry.min_nonwildcard_simple,
"Minimum non-wildcard chars in xlines/resvs", "Minimum non-wildcard chars in xlines/resvs",
INFO_DECIMAL(&ConfigFileEntry.min_nonwildcard_simple),
}, },
{ {
"network_name", "network_name",
OUTPUT_STRING, "Network name",
&ServerInfo.network_name, INFO_STRING(&ServerInfo.network_name),
"Network name"
}, },
{ {
"nick_delay", "nick_delay",
OUTPUT_DECIMAL,
&ConfigFileEntry.nick_delay,
"Delay nicks are locked for on split", "Delay nicks are locked for on split",
INFO_DECIMAL(&ConfigFileEntry.nick_delay),
}, },
{ {
"no_oper_flood", "no_oper_flood",
OUTPUT_BOOLEAN,
&ConfigFileEntry.no_oper_flood,
"Disable flood control for operators", "Disable flood control for operators",
INFO_INTBOOL(&ConfigFileEntry.no_oper_flood),
}, },
{ {
"non_redundant_klines", "non_redundant_klines",
OUTPUT_BOOLEAN, "Check for and disallow redundant K-lines",
&ConfigFileEntry.non_redundant_klines, INFO_INTBOOL(&ConfigFileEntry.non_redundant_klines),
"Check for and disallow redundant K-lines"
}, },
{ {
"operspy_admin_only", "operspy_admin_only",
OUTPUT_BOOLEAN, "Send +Z operspy notices to admins only",
&ConfigFileEntry.operspy_admin_only, INFO_INTBOOL(&ConfigFileEntry.operspy_admin_only),
"Send +Z operspy notices to admins only"
}, },
{ {
"operspy_dont_care_user_info", "operspy_dont_care_user_info",
OUTPUT_BOOLEAN, "Remove accountability and some '!' requirement from non-channel operspy",
&ConfigFileEntry.operspy_dont_care_user_info, INFO_INTBOOL(&ConfigFileEntry.operspy_dont_care_user_info),
"Remove accountability and some '!' requirement from non-channel operspy"
}, },
{ {
"pace_wait", "pace_wait",
OUTPUT_DECIMAL, "Minimum delay between uses of certain commands",
&ConfigFileEntry.pace_wait, INFO_DECIMAL(&ConfigFileEntry.pace_wait),
"Minimum delay between uses of certain commands"
}, },
{ {
"pace_wait_simple", "pace_wait_simple",
OUTPUT_DECIMAL, "Minimum delay between less intensive commands",
&ConfigFileEntry.pace_wait_simple, INFO_DECIMAL(&ConfigFileEntry.pace_wait_simple),
"Minimum delay between less intensive commands"
}, },
{ {
"ping_cookie", "ping_cookie",
OUTPUT_BOOLEAN,
&ConfigFileEntry.ping_cookie,
"Require ping cookies to connect", "Require ping cookies to connect",
INFO_INTBOOL(&ConfigFileEntry.ping_cookie),
}, },
{ {
"reject_after_count", "reject_after_count",
OUTPUT_DECIMAL,
&ConfigFileEntry.reject_after_count,
"Client rejection threshold setting", "Client rejection threshold setting",
INFO_DECIMAL(&ConfigFileEntry.reject_after_count),
}, },
{ {
"reject_ban_time", "reject_ban_time",
OUTPUT_DECIMAL,
&ConfigFileEntry.reject_ban_time,
"Client rejection time interval", "Client rejection time interval",
INFO_DECIMAL(&ConfigFileEntry.reject_ban_time),
}, },
{ {
"reject_duration", "reject_duration",
OUTPUT_DECIMAL,
&ConfigFileEntry.reject_duration,
"Client rejection cache duration", "Client rejection cache duration",
INFO_DECIMAL(&ConfigFileEntry.reject_duration),
}, },
{ {
"short_motd", "short_motd",
OUTPUT_BOOLEAN_YN, "Do not show MOTD; only tell clients they should read it",
&ConfigFileEntry.short_motd, INFO_INTBOOL_YN(&ConfigFileEntry.short_motd),
"Do not show MOTD; only tell clients they should read it"
}, },
{ {
"stats_e_disabled", "stats_e_disabled",
OUTPUT_BOOLEAN_YN,
&ConfigFileEntry.stats_e_disabled,
"STATS e output is disabled", "STATS e output is disabled",
INFO_INTBOOL_YN(&ConfigFileEntry.stats_e_disabled),
}, },
{ {
"stats_c_oper_only", "stats_c_oper_only",
OUTPUT_BOOLEAN_YN,
&ConfigFileEntry.stats_c_oper_only,
"STATS C output is only shown to operators", "STATS C output is only shown to operators",
INFO_INTBOOL_YN(&ConfigFileEntry.stats_c_oper_only),
}, },
{ {
"stats_h_oper_only", "stats_h_oper_only",
OUTPUT_BOOLEAN_YN,
&ConfigFileEntry.stats_h_oper_only,
"STATS H output is only shown to operators", "STATS H output is only shown to operators",
INFO_INTBOOL_YN(&ConfigFileEntry.stats_h_oper_only),
}, },
{ {
"stats_i_oper_only", "stats_i_oper_only",
OUTPUT_BOOLEAN2,
&ConfigFileEntry.stats_i_oper_only,
"STATS I output is only shown to operators", "STATS I output is only shown to operators",
INFO_YESNOMASK(&ConfigFileEntry.stats_i_oper_only),
}, },
{ {
"stats_k_oper_only", "stats_k_oper_only",
OUTPUT_BOOLEAN2,
&ConfigFileEntry.stats_k_oper_only,
"STATS K output is only shown to operators", "STATS K output is only shown to operators",
INFO_YESNOMASK(&ConfigFileEntry.stats_k_oper_only),
}, },
{ {
"stats_o_oper_only", "stats_o_oper_only",
OUTPUT_BOOLEAN_YN,
&ConfigFileEntry.stats_o_oper_only,
"STATS O output is only shown to operators", "STATS O output is only shown to operators",
INFO_INTBOOL_YN(&ConfigFileEntry.stats_o_oper_only),
}, },
{ {
"stats_P_oper_only", "stats_P_oper_only",
OUTPUT_BOOLEAN_YN,
&ConfigFileEntry.stats_P_oper_only,
"STATS P is only shown to operators", "STATS P is only shown to operators",
INFO_INTBOOL_YN(&ConfigFileEntry.stats_P_oper_only),
}, },
{ {
"stats_y_oper_only", "stats_y_oper_only",
OUTPUT_BOOLEAN_YN,
&ConfigFileEntry.stats_y_oper_only,
"STATS Y is only shown to operators", "STATS Y is only shown to operators",
INFO_INTBOOL_YN(&ConfigFileEntry.stats_y_oper_only),
}, },
{ {
"throttle_count", "throttle_count",
OUTPUT_DECIMAL,
&ConfigFileEntry.throttle_count,
"Connection throttle threshold", "Connection throttle threshold",
INFO_DECIMAL(&ConfigFileEntry.throttle_count),
}, },
{ {
"throttle_duration", "throttle_duration",
OUTPUT_DECIMAL,
&ConfigFileEntry.throttle_duration,
"Connection throttle duration", "Connection throttle duration",
INFO_DECIMAL(&ConfigFileEntry.throttle_duration),
}, },
{ {
"tkline_expire_notices", "tkline_expire_notices",
OUTPUT_BOOLEAN, "Notices given to opers when tklines expire",
&ConfigFileEntry.tkline_expire_notices, INFO_INTBOOL(&ConfigFileEntry.tkline_expire_notices),
"Notices given to opers when tklines expire"
}, },
{ {
"ts_max_delta", "ts_max_delta",
OUTPUT_DECIMAL, "Maximum permitted TS delta from another server",
&ConfigFileEntry.ts_max_delta, INFO_DECIMAL(&ConfigFileEntry.ts_max_delta),
"Maximum permitted TS delta from another server"
}, },
{ {
"ts_warn_delta", "ts_warn_delta",
OUTPUT_DECIMAL, "Maximum permitted TS delta before displaying a warning",
&ConfigFileEntry.ts_warn_delta, INFO_DECIMAL(&ConfigFileEntry.ts_warn_delta),
"Maximum permitted TS delta before displaying a warning"
}, },
{ {
"warn_no_nline", "warn_no_nline",
OUTPUT_BOOLEAN, "Display warning if connecting server lacks connect block",
&ConfigFileEntry.warn_no_nline, INFO_INTBOOL(&ConfigFileEntry.warn_no_nline),
"Display warning if connecting server lacks connect block"
}, },
{ {
"use_propagated_bans", "use_propagated_bans",
OUTPUT_BOOLEAN, "KLINE sets fully propagated bans",
&ConfigFileEntry.use_propagated_bans, INFO_INTBOOL(&ConfigFileEntry.use_propagated_bans),
"KLINE sets fully propagated bans"
}, },
{ {
"max_ratelimit_tokens", "max_ratelimit_tokens",
OUTPUT_DECIMAL,
&ConfigFileEntry.max_ratelimit_tokens,
"The maximum number of tokens that can be accumulated for executing rate-limited commands", "The maximum number of tokens that can be accumulated for executing rate-limited commands",
INFO_DECIMAL(&ConfigFileEntry.max_ratelimit_tokens),
}, },
{ {
"away_interval", "away_interval",
OUTPUT_DECIMAL,
&ConfigFileEntry.away_interval,
"The minimum time between aways", "The minimum time between aways",
INFO_DECIMAL(&ConfigFileEntry.away_interval),
}, },
{ {
"tls_ciphers_oper_only", "tls_ciphers_oper_only",
OUTPUT_BOOLEAN_YN,
&ConfigFileEntry.tls_ciphers_oper_only,
"TLS cipher strings are hidden in whois for non-opers", "TLS cipher strings are hidden in whois for non-opers",
INFO_INTBOOL_YN(&ConfigFileEntry.tls_ciphers_oper_only),
}, },
{ {
"default_split_server_count", "default_split_server_count",
OUTPUT_DECIMAL,
&ConfigChannel.default_split_server_count,
"Startup value of SPLITNUM", "Startup value of SPLITNUM",
INFO_DECIMAL(&ConfigChannel.default_split_server_count),
}, },
{ {
"default_split_user_count", "default_split_user_count",
OUTPUT_DECIMAL,
&ConfigChannel.default_split_user_count,
"Startup value of SPLITUSERS", "Startup value of SPLITUSERS",
INFO_DECIMAL(&ConfigChannel.default_split_user_count),
}, },
{ {
"knock_delay", "knock_delay",
OUTPUT_DECIMAL, "Delay between a users KNOCK attempts",
&ConfigChannel.knock_delay, INFO_DECIMAL(&ConfigChannel.knock_delay),
"Delay between a users KNOCK attempts"
}, },
{ {
"knock_delay_channel", "knock_delay_channel",
OUTPUT_DECIMAL,
&ConfigChannel.knock_delay_channel,
"Delay between KNOCK attempts to a channel", "Delay between KNOCK attempts to a channel",
INFO_DECIMAL(&ConfigChannel.knock_delay_channel),
}, },
{ {
"kick_on_split_riding", "kick_on_split_riding",
OUTPUT_BOOLEAN_YN, "Kick users riding splits to join +i or +k channels",
&ConfigChannel.kick_on_split_riding, INFO_INTBOOL_YN(&ConfigChannel.kick_on_split_riding),
"Kick users riding splits to join +i or +k channels"
}, },
{ {
"disable_local_channels", "disable_local_channels",
OUTPUT_BOOLEAN_YN, "Disable local channels (&channels)",
&ConfigChannel.disable_local_channels, INFO_INTBOOL_YN(&ConfigChannel.disable_local_channels),
"Disable local channels (&channels)"
}, },
{ {
"max_bans", "max_bans",
OUTPUT_DECIMAL,
&ConfigChannel.max_bans,
"Total +b/e/I/q modes allowed in a channel", "Total +b/e/I/q modes allowed in a channel",
INFO_DECIMAL(&ConfigChannel.max_bans),
}, },
{ {
"max_bans_large", "max_bans_large",
OUTPUT_DECIMAL,
&ConfigChannel.max_bans_large,
"Total +b/e/I/q modes allowed in a +L channel", "Total +b/e/I/q modes allowed in a +L channel",
INFO_DECIMAL(&ConfigChannel.max_bans_large),
}, },
{ {
"max_chans_per_user", "max_chans_per_user",
OUTPUT_DECIMAL,
&ConfigChannel.max_chans_per_user,
"Maximum number of channels a user can join", "Maximum number of channels a user can join",
INFO_DECIMAL(&ConfigChannel.max_chans_per_user),
}, },
{ {
"max_chans_per_user_large", "max_chans_per_user_large",
OUTPUT_DECIMAL,
&ConfigChannel.max_chans_per_user_large,
"Maximum extended number of channels a user can join", "Maximum extended number of channels a user can join",
INFO_DECIMAL(&ConfigChannel.max_chans_per_user_large),
}, },
{ {
"no_create_on_split", "no_create_on_split",
OUTPUT_BOOLEAN_YN,
&ConfigChannel.no_create_on_split,
"Disallow creation of channels when split", "Disallow creation of channels when split",
INFO_INTBOOL_YN(&ConfigChannel.no_create_on_split),
}, },
{ {
"no_join_on_split", "no_join_on_split",
OUTPUT_BOOLEAN_YN,
&ConfigChannel.no_join_on_split,
"Disallow joining channels when split", "Disallow joining channels when split",
INFO_INTBOOL_YN(&ConfigChannel.no_join_on_split),
}, },
{ {
"only_ascii_channels", "only_ascii_channels",
OUTPUT_BOOLEAN_YN, "Controls whether non-ASCII is disabled for JOIN",
&ConfigChannel.only_ascii_channels, INFO_INTBOOL_YN(&ConfigChannel.only_ascii_channels),
"Controls whether non-ASCII is disabled for JOIN"
}, },
{ {
"use_except", "use_except",
OUTPUT_BOOLEAN_YN,
&ConfigChannel.use_except,
"Enable chanmode +e (ban exceptions)", "Enable chanmode +e (ban exceptions)",
INFO_INTBOOL_YN(&ConfigChannel.use_except),
}, },
{ {
"use_invex", "use_invex",
OUTPUT_BOOLEAN_YN,
&ConfigChannel.use_invex,
"Enable chanmode +I (invite exceptions)", "Enable chanmode +I (invite exceptions)",
INFO_INTBOOL_YN(&ConfigChannel.use_invex),
}, },
{ {
"use_forward", "use_forward",
OUTPUT_BOOLEAN_YN,
&ConfigChannel.use_forward,
"Enable chanmode +f (channel forwarding)", "Enable chanmode +f (channel forwarding)",
INFO_INTBOOL_YN(&ConfigChannel.use_forward),
}, },
{ {
"use_knock", "use_knock",
OUTPUT_BOOLEAN_YN,
&ConfigChannel.use_knock,
"Enable /KNOCK", "Enable /KNOCK",
INFO_INTBOOL_YN(&ConfigChannel.use_knock),
}, },
{ {
"resv_forcepart", "resv_forcepart",
OUTPUT_BOOLEAN_YN, "Force-part local users on channel RESV",
&ConfigChannel.resv_forcepart, INFO_INTBOOL_YN(&ConfigChannel.resv_forcepart),
"Force-part local users on channel RESV"
}, },
{ {
"opmod_send_statusmsg", "opmod_send_statusmsg",
OUTPUT_BOOLEAN_YN, "Send messages to @#channel if affected by +z",
&ConfigChannel.opmod_send_statusmsg, INFO_INTBOOL_YN(&ConfigChannel.opmod_send_statusmsg),
"Send messages to @#channel if affected by +z"
}, },
{ {
"disable_hidden", "disable_hidden",
OUTPUT_BOOLEAN_YN,
&ConfigServerHide.disable_hidden,
"Prevent servers from hiding themselves from a flattened /links", "Prevent servers from hiding themselves from a flattened /links",
INFO_INTBOOL_YN(&ConfigServerHide.disable_hidden),
}, },
{ {
"flatten_links", "flatten_links",
OUTPUT_BOOLEAN_YN,
&ConfigServerHide.flatten_links,
"Flatten /links list", "Flatten /links list",
INFO_INTBOOL_YN(&ConfigServerHide.flatten_links),
}, },
{ {
"hidden", "hidden",
OUTPUT_BOOLEAN_YN,
&ConfigServerHide.hidden,
"Hide this server from a flattened /links on remote servers", "Hide this server from a flattened /links on remote servers",
INFO_INTBOOL_YN(&ConfigServerHide.hidden),
}, },
{ {
"links_delay", "links_delay",
OUTPUT_DECIMAL, "Links rehash delay",
&ConfigServerHide.links_delay, INFO_DECIMAL(&ConfigServerHide.links_delay),
"Links rehash delay"
}, },
{ NULL, 0, NULL, NULL }, { NULL, NULL, 0, { NULL } },
}; };
/* *INDENT-ON* */ /* *INDENT-ON* */
@ -811,98 +733,107 @@ send_conf_options(struct Client *source_p)
{ {
switch (info_table[i].output_type) switch (info_table[i].output_type)
{ {
/* case OUTPUT_STRING:
* For "char *" references {
*/ char *option = *info_table[i].option.string_p;
case OUTPUT_STRING:
{
char *option = *((char **) info_table[i].option);
sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]", sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
get_id(&me, source_p), RPL_INFO, get_id(&me, source_p), RPL_INFO,
get_id(source_p, source_p), get_id(source_p, source_p),
info_table[i].name, info_table[i].name,
option ? option : "NONE", option ? option : "NONE",
info_table[i].desc ? info_table[i].desc : "<none>"); info_table[i].desc ? info_table[i].desc : "<none>");
break; break;
} }
/* case OUTPUT_STRING_PTR:
* For "char foo[]" references {
*/ char *option = info_table[i].option.string;
case OUTPUT_STRING_PTR:
{
char *option = (char *) info_table[i].option;
sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]", sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
get_id(&me, source_p), RPL_INFO, get_id(&me, source_p), RPL_INFO,
get_id(source_p, source_p), get_id(source_p, source_p),
info_table[i].name, info_table[i].name,
EmptyString(option) ? "NONE" : option, EmptyString(option) ? "NONE" : option,
info_table[i].desc ? info_table[i].desc : "<none>"); info_table[i].desc ? info_table[i].desc : "<none>");
break; break;
} }
/* case OUTPUT_DECIMAL:
* Output info_table[i].option as a decimal value. {
*/ int option = *info_table[i].option.int_;
case OUTPUT_DECIMAL:
{
int option = *((int *) info_table[i].option);
sendto_one(source_p, ":%s %d %s :%-30s %-16d [%s]", sendto_one(source_p, ":%s %d %s :%-30s %-16d [%s]",
get_id(&me, source_p), RPL_INFO, get_id(&me, source_p), RPL_INFO,
get_id(source_p, source_p), get_id(source_p, source_p),
info_table[i].name, info_table[i].name,
option, option,
info_table[i].desc ? info_table[i].desc : "<none>"); info_table[i].desc ? info_table[i].desc : "<none>");
break; break;
} }
case OUTPUT_BOOLEAN:
{
bool option = *info_table[i].option.bool_;
/* sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
* Output info_table[i].option as "ON" or "OFF" get_id(&me, source_p), RPL_INFO,
*/ get_id(source_p, source_p),
case OUTPUT_BOOLEAN: info_table[i].name,
{ option ? "ON" : "OFF",
int option = *((int *) info_table[i].option); info_table[i].desc ? info_table[i].desc : "<none>");
sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]", break;
get_id(&me, source_p), RPL_INFO, }
get_id(source_p, source_p), case OUTPUT_BOOLEAN_YN:
info_table[i].name, {
option ? "ON" : "OFF", bool option = *info_table[i].option.bool_;
info_table[i].desc ? info_table[i].desc : "<none>");
break; sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
} get_id(&me, source_p), RPL_INFO,
/* get_id(source_p, source_p),
* Output info_table[i].option as "YES" or "NO" info_table[i].name,
*/ option ? "YES" : "NO",
case OUTPUT_BOOLEAN_YN: info_table[i].desc ? info_table[i].desc : "<none>");
{
int option = *((int *) info_table[i].option);
sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]", break;
get_id(&me, source_p), RPL_INFO, }
get_id(source_p, source_p), case OUTPUT_YESNOMASK:
info_table[i].name, {
option ? "YES" : "NO", int option = *info_table[i].option.int_;
info_table[i].desc ? info_table[i].desc : "<none>");
break; sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
} me.name, RPL_INFO, source_p->name,
info_table[i].name,
option ? ((option == 1) ? "MASK" : "YES") : "NO",
info_table[i].desc ? info_table[i].desc : "<none>");
}
case OUTPUT_INTBOOL:
{
bool option = *info_table[i].option.int_;
case OUTPUT_BOOLEAN2: sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
{ get_id(&me, source_p), RPL_INFO,
int option = *((int *) info_table[i].option); get_id(source_p, source_p),
info_table[i].name,
option ? "ON" : "OFF",
info_table[i].desc ? info_table[i].desc : "<none>");
sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]", break;
me.name, RPL_INFO, source_p->name, }
info_table[i].name, case OUTPUT_INTBOOL_YN:
option ? ((option == 1) ? "MASK" : "YES") : "NO", {
info_table[i].desc ? info_table[i].desc : "<none>"); bool option = *info_table[i].option.int_;
}
sendto_one(source_p, ":%s %d %s :%-30s %-16s [%s]",
get_id(&me, source_p), RPL_INFO,
get_id(source_p, source_p),
info_table[i].name,
option ? "YES" : "NO",
info_table[i].desc ? info_table[i].desc : "<none>");
break;
}
} }
} }