return 1; /* success */
}
+#ifdef WITH_PROXY
static int command_show_home_servers(rad_listen_t *listener, UNUSED int argc, UNUSED char *argv[])
{
int i;
return 0;
}
-
+#endif
static int command_show_clients(rad_listen_t *listener, UNUSED int argc, UNUSED char *argv[])
{
return 1; /* success */
}
+static int command_show_version(rad_listen_t *listener, UNUSED int argc, UNUSED char *argv[])
+{
+ cprintf(listener, "%s\n", radiusd_version);
+ return 1;
+}
+
static int command_debug_level(rad_listen_t *listener, int argc, char *argv[])
{
int number;
return 1;
}
+#ifdef WITH_PROXY
static home_server *get_home_server(rad_listen_t *listener, int argc, char *argv[])
{
home_server *home;
return 1;
}
-
+#endif
static fr_command_table_t command_table_debug[] = {
{ NULL, 0, NULL, NULL, NULL }
};
+#ifdef WITH_PROXY
static fr_command_table_t command_table_show_home[] = {
{ "config", FR_READ,
"show home_server config <ipaddr> <port> - show configuration for given home server",
{ NULL, 0, NULL, NULL, NULL }
};
+#endif
static fr_command_table_t command_table_show[] = {
{ "debug", FR_READ,
"show debug <command> - show debug properties",
NULL, command_table_show_debug },
+#ifdef WITH_PROXY
{ "home_server", FR_READ,
"show home_server <command> - do sub-command of home_server",
NULL, command_table_show_home },
+#endif
{ "module", FR_READ,
"show module <command> - do sub-command of module",
NULL, command_table_show_module },
{ "uptime", FR_READ,
"show uptime - shows time at which server started",
command_uptime, NULL },
+ { "version", FR_READ,
+ "show version - Prints version of the running server",
+ command_show_version, NULL },
{ "xml", FR_READ,
"show xml <reference> - Prints out configuration as XML",
command_show_xml, NULL },
}
+#ifdef WITH_PROXY
static int command_stats_home_server(rad_listen_t *listener, int argc, char *argv[])
{
home_server *home;
+ if (argc == 0) {
+ cprintf(listener, "ERROR: Must specify [auth/acct] OR <ipaddr> <port>\n");
+ return 0;
+ }
+
+ if (argc == 1) {
+#ifdef WITH_ACCOUNTING
+ if (strcmp(argv[0], "acct") == 0) {
+ return command_print_stats(listener,
+ &proxy_acct_stats, 0);
+ }
+#endif
+ if (strcmp(argv[0], "auth") == 0) {
+ return command_print_stats(listener,
+ &proxy_auth_stats, 1);
+ }
+
+ cprintf(listener, "ERROR: Should specify [auth/acct]\n");
+ return 0;
+ }
+
home = get_home_server(listener, argc, argv);
if (!home) {
return 0;
cprintf(listener, "\toutstanding\t%d\n", home->currently_outstanding);
return 1;
}
-
+#endif
static int command_stats_client(rad_listen_t *listener, int argc, char *argv[])
{
};
+#ifdef WITH_PROXY
static fr_command_table_t command_table_set_home[] = {
{ "state", FR_WRITE,
"set home_server state <ipaddr> <port> [alive|dead] - set state for given home server",
{ NULL, 0, NULL, NULL, NULL }
};
+#endif
static fr_command_table_t command_table_set_module[] = {
{ "config", FR_WRITE,
{ "module", FR_WRITE,
"set module <command> - set module commands",
NULL, command_table_set_module },
+#ifdef WITH_PROXY
{ "home_server", FR_WRITE,
"set home_server <command> - set home server commands",
NULL, command_table_set_home },
+#endif
{ NULL, 0, NULL, NULL, NULL }
};
{ "client", FR_READ,
"stats client [auth/acct] <ipaddr> - show statistics for client",
command_stats_client, NULL },
+#ifdef WITH_PROXY
{ "home_server", FR_READ,
"stats home_server <ipaddr> <port> - show statistics for home server",
command_stats_home_server, NULL },
+#endif
{ NULL, 0, NULL, NULL, NULL }
};
"reconnect - reconnect to a running server",
NULL, NULL }, /* just here for "help" */
{ "terminate", FR_WRITE,
- "terminate - terminates the server, and causes it to exit",
+ "terminate - terminates the server, and cause it to exit",
command_terminate, NULL },
{ "set", FR_WRITE, NULL, NULL, command_table_set },
{ "show", FR_READ, NULL, NULL, command_table_show },