Cleaned up code generator for config file parsing.

This commit is contained in:
Jan Vidar Krey 2012-05-23 23:38:19 +02:00
parent 9ea85ad1ac
commit 571abddd98
4 changed files with 268 additions and 218 deletions

View File

@ -1,80 +1,173 @@
#!/usr/bin/perl -w
use strict;
use XML::Twig;
use XML::DOM;
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 write_sql_dump(@);
sub get_data($);
my $dump_to_sql = 0;
# initialize parser and read the file
my $input = "./config.xml";
my $parser = XML::Twig->new();
my $parser = new XML::DOM::Parser;
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"))
# Get data
my $nodes = $tree->getElementsByTagName("option");
my @options = ();
for (my $i = 0; $i < $nodes->getLength; $i++)
{
write_c_header(get_data($p));
my @data = get_data($nodes->item($i));
push @options, \@data;
}
print GENHEAD "};\n\n";
# Write c source file
write_c_header(@options);
write_sql_dump(@options) if ($dump_to_sql);
my $config_defaults = "void config_defaults(struct hub_config* config)\n{\n";
my $config_apply = "static int apply_config(struct hub_config* config, char* key, char* data, int line_count)\n{\n\tint max = 0;\n\tint min = 0;\n\n";
my $config_free = "void free_config(struct hub_config* config)\n{\n";
my $config_dump = "void dump_config(struct hub_config* config, int ignore_defaults)\n{\n";
foreach my $option (@options)
{
my ($type, $name, $default, $advanced, $short, $desc, $since, $example, $check) = @$option;
my $string = ($type =~ /(string|file|message)/);
my $min = undef;
my $max = undef;
my $regexp = undef;
if (defined $check)
{
$min = $check->getAttribute("min");
$max = $check->getAttribute("max");
$regexp = $check->getAttribute("regexp");
$max = undef if ($max eq "");
$min = undef if ($min eq "");
$regexp = undef if ($regexp eq "");
}
$config_defaults .= "\tconfig->$name = ";
$config_defaults .= "hub_strdup(\"" if ($string);
$config_defaults .= $default;
$config_defaults .= "\")" if ($string);
$config_defaults .= ";\n";
$config_apply .= "\tif (!strcmp(key, \"" . $name . "\"))\n\t{\n";
if ($type eq "int")
{
$config_apply .= "\t\tmin = $min;\n" if (defined $min);
$config_apply .= "\t\tmax = $max;\n" if (defined $max);
$config_apply .= "\t\tif (!apply_integer(key, data, &config->$name, ";
if (defined $min) { $config_apply .= "&min"; } else { $config_apply .= "0"; }
$config_apply .= ", ";
if (defined $max) { $config_apply .= "&max"; } else { $config_apply .= "0"; }
$config_apply .= "))\n";
}
elsif ($type eq "boolean")
{
$config_apply .= "\t\tif (!apply_boolean(key, data, &config->$name))\n";
}
elsif ($string)
{
$config_apply .="\t\tif (!apply_string(key, data, &config->$name, (char*) \"\"))\n";
}
$config_apply .= "\t\t{\n" .
"\t\t\tLOG_ERROR(\"Configuration parse error on line %d\", line_count);\n" .
"\t\t\treturn -1;\n" .
"\t\t}\n" .
"\t\treturn 0;\n" .
"\t}\n\n";
$config_free .= "\thub_free(config->" . $name . ");\n\n" if ($string);
my $out = "%s";
my $val = "config->$name";
my $test = "config->$name != $default";
$out = "%d" if ($type eq "int");
$val = "config->$name ? \"yes\" : \"no\"" if ($type eq "boolean");
if ($string)
{
$out = "\\\"%s\\\"";
$test = "strcmp(config->$name, \"$default\") != 0";
}
$config_dump .= "\tif (!ignore_defaults || $test)\n";
$config_dump .= "\t\tfprintf(stdout, \"$name = $out\\n\", $val);\n\n";
}
$config_apply .= "\t/* Still here -- unknown directive */\n";
$config_apply .= "\tLOG_ERROR(\"Unknown configuration directive: '%s'\", key);\n";
$config_apply .= "\treturn -1;\n";
$config_apply .= "}\n\n";
$config_defaults .= "}\n\n";
$config_free .= "}\n\n";
$config_dump .= "}\n\n";
open GENIMPL, ">gen_config.c" || die "Unable to write source file";
print GENIMPL "/* THIS FILE IS AUTOGENERATED - DO NOT CHANGE IT! */\n\n";
print GENIMPL $config_defaults;
print GENIMPL $config_apply;
print GENIMPL $config_free;
print GENIMPL $config_dump;
# The defaults function
print GENIMPL "void config_defaults(struct hub_config* config)\n{\n";
foreach my $p ($tree->root->children("option"))
sub get_data($)
{
write_c_impl_defaults(get_data($p));
my $p = shift;
my $short = "";
my $example = "";
my $description = "";
my $since = "";
$short = $p->getElementsByTagName("short")->item(0)->getFirstChild()->getData() if ($p->getElementsByTagName("short")->getLength());
$since = $p->getElementsByTagName("since")->item(0)->getFirstChild()->getData() if ($p->getElementsByTagName("since")->getLength());
$example = $p->getElementsByTagName("example")->item(0)->getFirstChild()->getData() if ($p->getElementsByTagName("example")->getLength());
$description = $p->getElementsByTagName("description")->item(0)->getFirstChild()->getData() if ($p->getElementsByTagName("description")->getLength());
my $check = $p->getElementsByTagName("check")->item(0);
my @data = (
$p->getAttribute("type"),
$p->getAttribute("name"),
$p->getAttribute("default"),
$p->getAttribute("advanced"),
$short,
$description,
$since,
$example,
$check
);
return @data;
}
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\tint max = 0;\n\tint min = 0;\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";
# Write header file
sub write_c_header(@)
{
my @output = @_;
my ($type, $name, $default, $advanced, $short, $desc, $since, $example) = @output;
my @data = @_;
open GENHEAD, ">gen_config.h" || die "Unable to write header file";
print GENHEAD "/* THIS FILE IS AUTOGENERATED - DO NOT CHANGE IT! */\n\n";
print GENHEAD "struct hub_config\n{\n";
foreach my $option (@data)
{
my ($type, $name, $default, $advanced, $short, $desc, $since, $example) = @$option;
my $string = ($type =~ /(string|file|message)/);
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 "char*" if ($string);
print GENHEAD " " . $name . ";";
my $comment = "";
@ -85,7 +178,14 @@ sub write_c_header(@)
elsif (defined $short && length $short > 0)
{
$comment = $short;
$comment .= " (default: " . $default . ")" if (defined $default);
if (defined $default)
{
$comment .= " (default: ";
$comment .= "\"" if ($string);
$comment .= $default;
$comment .= "\"" if ($string);
$comment .= ")";
}
}
if (length $comment > 0)
@ -97,145 +197,74 @@ sub write_c_header(@)
}
$comment = $pad . "/*<<< " . $comment . " */";
}
print GENHEAD $comment . "\n";
}
sub write_c_impl_defaults(@)
{
my @output = @_;
my ($type, $name, $default, $advanced, $short, $desc, $since, $example) = @output;
my $prefix = "";
my $suffix = "";
print GENIMPL "\tconfig->$name = ";
if ($type =~ /(string|file|message)/)
{
$prefix = "hub_strdup(\"";
$suffix = "\")"
}
print GENIMPL $prefix . $default . $suffix . ";\n";
print GENHEAD "};\n\n";
}
sub write_c_impl_apply(@)
{
my @output = @_;
my ($type, $name, $default, $advanced, $short, $desc, $since, $example, $p) = @output;
my $min;
my $max;
my $regexp;
if (defined $p)
sub write_sql_dump(@)
{
$min = $p->att("min");
$max = $p->att("max");
$regexp = $p->att("regexp");
my @data = @_;
print "'check' is defined for option $name";
print ", min=$min" if (defined $min);
print ", max=$max" if (defined $max);
print ", regexp=\"$regexp\"" if (defined $regexp);
print "\n";
}
# Write SQL dump code
open GENSQL, ">gen_config.sql" || die "Unable to write SQL dump";
print GENSQL "START TRANSACTION;\n\n
DROP TABLE uhub_config IF EXISTS;\n\n
CREATE TABLE uhub_config (
name VARCHAR(32) UNIQUE NOT NULL,
defaultValue TINYTEXT NOT NULL,
description LONGTEXT NOT NULL,
type TINYTEXT NOT NULL,
advanced BOOLEAN,
example LONGTEXT,
since TINYTEXT
);\n\n";
print GENIMPL "\tif (!strcmp(key, \"" . $name . "\"))\n\t{\n";
if ($type eq "int")
foreach my $option (@data)
{
if (defined $min)
{
print GENIMPL "\t\tmin = $min;\n"
}
if (defined $max)
{
print GENIMPL "\t\tmax = $max;\n"
}
print GENIMPL "\t\tif (!apply_integer(key, data, &config->$name, ";
if (defined $min)
{
print GENIMPL "&min";
}
else
{
print GENIMPL "0";
}
print GENIMPL ", ";
if (defined $max)
{
print GENIMPL "&max";
}
else
{
print GENIMPL "0";
}
print GENIMPL "))\n";
}
elsif ($type eq "boolean")
{
print GENIMPL "\t\tif (!apply_boolean(key, data, &config->$name))\n";
}
elsif ($type =~ /(string|file|message)/)
{
print GENIMPL "\t\tif (!apply_string(key, data, &config->$name, (char*) \"\"))\n";
}
print GENIMPL "\t\t{\n" .
"\t\t\tLOG_ERROR(\"Configuration parse error on line %d\", line_count);\n" .
"\t\t\treturn -1;\n" .
"\t\t}\n" .
"\t\treturn 0;\n" .
"\t}\n\n";
}
sub write_c_impl_free(@)
{
my @output = @_;
my ($type, $name, $default, $advanced, $short, $desc, $since, $example) = @output;
my ($type, $name, $default, $advanced, $short, $desc, $since, $example) = @$option;
if ($type =~ /(string|file|message)/ )
{
print GENIMPL "\thub_free(config->" . $name . ");\n\n"
}
$default = "\\\"$default\\\"";
}
sub write_c_impl_dump(@)
{
my @output = @_;
my ($type, $name, $default, $advanced, $short, $desc, $since, $example) = @output;
my $out;
my $val = "config->$name";
my $test = "config->$name != $default";
$desc =~ s/\"/\\\"/g;
$type =~ s/^int$/integer/;
if ($type eq "int")
my $stmt = "INSERT INTO uhub_config VALUES(";
$stmt .= "\"$name\", ";
$stmt .= "\"$default\", ";
$stmt .= "\"$desc\", ";
$stmt .= "\"$type\", ";
if (defined $example)
{
$out = "%d";
}
elsif ($type eq "boolean")
{
$out = "%s";
$val = "config->$name ? \"yes\" : \"no\"";
}
elsif ($type =~ /(string|file|message)/)
{
$out = "\\\"%s\\\"";
$test = "strcmp(config->$name, \"$default\") != 0";
my $example_str = $example;
$example_str =~ s/\\/\\\\/g;
$example_str =~ s/\"/\\\"/g;
$stmt .= "\"$example_str\", ";
} else {
$stmt .= "NULL, ";
}
print GENIMPL "\tif (!ignore_defaults || $test)\n";
print GENIMPL "\t\tfprintf(stdout, \"$name = $out\\n\", $val);\n\n";
if (defined $since) {
$stmt .= "\"$since\", ";
} else {
$stmt .= "NULL, ";
}
sub get_data($)
{
my $p = shift;
my $check = $p->first_child_matches("check");
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"), $check);
return @data;
if (defined $advanced) {
$stmt .= "\"$advanced\"";
} else {
$stmt .= "NULL";
}
$stmt .= ");\n";
print GENSQL $stmt;
}
print GENSQL "\n\nCOMMIT;\n\n";
}

View File

@ -13,7 +13,7 @@
<check min="1" max="65535" />
<since>0.1.0</since>
<short>Server port to bind to</short>
<description><![CDATA[This is specifies the port number the hub should listen on.]]></description>
<description><![CDATA[This specifies the port number the hub should listen on.]]></description>
</option>
<option name="server_bind_addr" type="string" default="any">
@ -409,7 +409,7 @@
</option>
<option name="tls_require" type="boolean" default="0">
<short>If SSL/TLS enabled, should it be required (default: 0)</short>
<short>If SSL/TLS enabled, should it be required</short>
<description><![CDATA[
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.
@ -590,7 +590,7 @@
</option>
<option name="msg_error_no_memory" type="message" default="No memory">
<description><![CDATA[]]></description>
<description><![CDATA[Hub has no more memory]]></description>
<since>0.2.0</since>
</option>

View File

@ -102,7 +102,9 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
if (!strcmp(key, "server_port"))
{
if (!apply_integer(key, data, &config->server_port, 0, 0))
min = 1;
max = 65535;
if (!apply_integer(key, data, &config->server_port, &min, &max))
{
LOG_ERROR("Configuration parse error on line %d", line_count);
return -1;
@ -122,7 +124,8 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
if (!strcmp(key, "server_listen_backlog"))
{
if (!apply_integer(key, data, &config->server_listen_backlog, 0, 0))
min = 5;
if (!apply_integer(key, data, &config->server_listen_backlog, &min, 0))
{
LOG_ERROR("Configuration parse error on line %d", line_count);
return -1;
@ -244,7 +247,9 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
if (!strcmp(key, "max_recv_buffer"))
{
if (!apply_integer(key, data, &config->max_recv_buffer, 0, 0))
min = 1024;
max = 1048576;
if (!apply_integer(key, data, &config->max_recv_buffer, &min, &max))
{
LOG_ERROR("Configuration parse error on line %d", line_count);
return -1;
@ -254,7 +259,8 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
if (!strcmp(key, "max_send_buffer"))
{
if (!apply_integer(key, data, &config->max_send_buffer, 0, 0))
min = 2048;
if (!apply_integer(key, data, &config->max_send_buffer, &min, 0))
{
LOG_ERROR("Configuration parse error on line %d", line_count);
return -1;
@ -264,7 +270,8 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
if (!strcmp(key, "max_send_buffer_soft"))
{
if (!apply_integer(key, data, &config->max_send_buffer_soft, 0, 0))
min = 1024;
if (!apply_integer(key, data, &config->max_send_buffer_soft, &min, 0))
{
LOG_ERROR("Configuration parse error on line %d", line_count);
return -1;
@ -284,7 +291,9 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
if (!strcmp(key, "max_chat_history"))
{
if (!apply_integer(key, data, &config->max_chat_history, 0, 0))
min = 0;
max = 250;
if (!apply_integer(key, data, &config->max_chat_history, &min, &max))
{
LOG_ERROR("Configuration parse error on line %d", line_count);
return -1;
@ -294,7 +303,9 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
if (!strcmp(key, "max_logout_log"))
{
if (!apply_integer(key, data, &config->max_logout_log, 0, 0))
min = 0;
max = 2000;
if (!apply_integer(key, data, &config->max_logout_log, &min, &max))
{
LOG_ERROR("Configuration parse error on line %d", line_count);
return -1;
@ -304,7 +315,8 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
if (!strcmp(key, "limit_max_hubs_user"))
{
if (!apply_integer(key, data, &config->limit_max_hubs_user, 0, 0))
min = 0;
if (!apply_integer(key, data, &config->limit_max_hubs_user, &min, 0))
{
LOG_ERROR("Configuration parse error on line %d", line_count);
return -1;
@ -314,7 +326,8 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
if (!strcmp(key, "limit_max_hubs_reg"))
{
if (!apply_integer(key, data, &config->limit_max_hubs_reg, 0, 0))
min = 0;
if (!apply_integer(key, data, &config->limit_max_hubs_reg, &min, 0))
{
LOG_ERROR("Configuration parse error on line %d", line_count);
return -1;
@ -324,7 +337,8 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
if (!strcmp(key, "limit_max_hubs_op"))
{
if (!apply_integer(key, data, &config->limit_max_hubs_op, 0, 0))
min = 0;
if (!apply_integer(key, data, &config->limit_max_hubs_op, &min, 0))
{
LOG_ERROR("Configuration parse error on line %d", line_count);
return -1;
@ -334,7 +348,8 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
if (!strcmp(key, "limit_max_hubs"))
{
if (!apply_integer(key, data, &config->limit_max_hubs, 0, 0))
min = 0;
if (!apply_integer(key, data, &config->limit_max_hubs, &min, 0))
{
LOG_ERROR("Configuration parse error on line %d", line_count);
return -1;
@ -344,7 +359,8 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
if (!strcmp(key, "limit_min_hubs_user"))
{
if (!apply_integer(key, data, &config->limit_min_hubs_user, 0, 0))
min = 0;
if (!apply_integer(key, data, &config->limit_min_hubs_user, &min, 0))
{
LOG_ERROR("Configuration parse error on line %d", line_count);
return -1;
@ -354,7 +370,8 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
if (!strcmp(key, "limit_min_hubs_reg"))
{
if (!apply_integer(key, data, &config->limit_min_hubs_reg, 0, 0))
min = 0;
if (!apply_integer(key, data, &config->limit_min_hubs_reg, &min, 0))
{
LOG_ERROR("Configuration parse error on line %d", line_count);
return -1;
@ -364,7 +381,8 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
if (!strcmp(key, "limit_min_hubs_op"))
{
if (!apply_integer(key, data, &config->limit_min_hubs_op, 0, 0))
min = 0;
if (!apply_integer(key, data, &config->limit_min_hubs_op, &min, 0))
{
LOG_ERROR("Configuration parse error on line %d", line_count);
return -1;
@ -385,7 +403,8 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
if (!strcmp(key, "limit_max_share"))
{
if (!apply_integer(key, data, &config->limit_max_share, 0, 0))
min = 0;
if (!apply_integer(key, data, &config->limit_max_share, &min, 0))
{
LOG_ERROR("Configuration parse error on line %d", line_count);
return -1;
@ -395,7 +414,8 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
if (!strcmp(key, "limit_min_slots"))
{
if (!apply_integer(key, data, &config->limit_min_slots, 0, 0))
min = 0;
if (!apply_integer(key, data, &config->limit_min_slots, &min, 0))
{
LOG_ERROR("Configuration parse error on line %d", line_count);
return -1;
@ -405,7 +425,8 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
if (!strcmp(key, "limit_max_slots"))
{
if (!apply_integer(key, data, &config->limit_max_slots, 0, 0))
min = 0;
if (!apply_integer(key, data, &config->limit_max_slots, &min, 0))
{
LOG_ERROR("Configuration parse error on line %d", line_count);
return -1;

View File

@ -4,9 +4,9 @@ struct hub_config
{
int hub_enabled; /*<<< Is server enabled (default: 1) */
int server_port; /*<<< Server port to bind to (default: 1511) */
char* server_bind_addr; /*<<< Server bind address (default: any) */
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: ) */
char* server_alt_ports; /*<<< Comma separated list of alternative ports to listen to (default: "") */
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) */
@ -14,9 +14,9 @@ struct hub_config
int register_self; /*<<< Allow users to register themselves on the hub. (default: 0) */
int obsolete_clients; /*<<< Support obsolete clients using a ADC protocol prior to 1.0 (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) */
char* redirect_addr; /*<<< A common hub redirect address. (default: ) */
char* hub_name; /*<<< Name of hub (default: "uhub") */
char* hub_description; /*<<< Short hub description, topic or subject. (default: "no description") */
char* redirect_addr; /*<<< A common hub redirect address. (default: "") */
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) */
@ -41,12 +41,12 @@ struct hub_config
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_require_redirect_addr; /*<<< A redirect address in case a client connects using "adc://" when "adcs://" is required. (default: ) */
char* tls_certificate; /*<<< Certificate file (default: ) */
char* tls_private_key; /*<<< Private key file (default: ) */
char* file_acl; /*<<< File containing access control lists (default: ) */
char* file_plugins; /*<<< Plugin configuration file (default: ) */
int tls_require; /*<<< If SSL/TLS enabled, should it be required (default: 0) */
char* tls_require_redirect_addr; /*<<< A redirect address in case a client connects using "adc://" when "adcs://" is required. (default: "") */
char* tls_certificate; /*<<< Certificate file (default: "") */
char* tls_private_key; /*<<< Private key file (default: "") */
char* file_acl; /*<<< File containing access control lists (default: "") */
char* file_plugins; /*<<< Plugin configuration file (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" */