|
|
@ -339,6 +339,7 @@ static const char *JSON_PARAMETER = "parameter"; |
|
|
|
#define MSG_ACCDENY 45 |
|
|
|
#define MSG_ACCDENY 45 |
|
|
|
#define MSG_ACCOK 46 |
|
|
|
#define MSG_ACCOK 46 |
|
|
|
#define MSG_ENAPOOL 47 |
|
|
|
#define MSG_ENAPOOL 47 |
|
|
|
|
|
|
|
#define MSG_POOLPRIO 73 |
|
|
|
#define MSG_DISPOOL 48 |
|
|
|
#define MSG_DISPOOL 48 |
|
|
|
#define MSG_ALRENAP 49 |
|
|
|
#define MSG_ALRENAP 49 |
|
|
|
#define MSG_ALRDISP 50 |
|
|
|
#define MSG_ALRDISP 50 |
|
|
@ -501,6 +502,7 @@ struct CODES { |
|
|
|
{ SEVERITY_ERR, MSG_ACCDENY, PARAM_STR, "Access denied to '%s' command" }, |
|
|
|
{ SEVERITY_ERR, MSG_ACCDENY, PARAM_STR, "Access denied to '%s' command" }, |
|
|
|
{ SEVERITY_SUCC, MSG_ACCOK, PARAM_NONE, "Privileged access OK" }, |
|
|
|
{ SEVERITY_SUCC, MSG_ACCOK, PARAM_NONE, "Privileged access OK" }, |
|
|
|
{ SEVERITY_SUCC, MSG_ENAPOOL, PARAM_POOL, "Enabling pool %d:'%s'" }, |
|
|
|
{ SEVERITY_SUCC, MSG_ENAPOOL, PARAM_POOL, "Enabling pool %d:'%s'" }, |
|
|
|
|
|
|
|
{ SEVERITY_SUCC, MSG_POOLPRIO,PARAM_NONE, "Changed pool priorities" }, |
|
|
|
{ SEVERITY_SUCC, MSG_DISPOOL, PARAM_POOL, "Disabling pool %d:'%s'" }, |
|
|
|
{ SEVERITY_SUCC, MSG_DISPOOL, PARAM_POOL, "Disabling pool %d:'%s'" }, |
|
|
|
{ SEVERITY_INFO, MSG_ALRENAP, PARAM_POOL, "Pool %d:'%s' already enabled" }, |
|
|
|
{ SEVERITY_INFO, MSG_ALRENAP, PARAM_POOL, "Pool %d:'%s' already enabled" }, |
|
|
|
{ SEVERITY_INFO, MSG_ALRDISP, PARAM_POOL, "Pool %d:'%s' already disabled" }, |
|
|
|
{ SEVERITY_INFO, MSG_ALRDISP, PARAM_POOL, "Pool %d:'%s' already disabled" }, |
|
|
@ -2132,6 +2134,39 @@ static void enablepool(__maybe_unused SOCKETTYPE c, char *param, bool isjson, __ |
|
|
|
strcpy(io_buffer, message(MSG_ENAPOOL, id, NULL, isjson)); |
|
|
|
strcpy(io_buffer, message(MSG_ENAPOOL, id, NULL, isjson)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void poolpriority(__maybe_unused SOCKETTYPE c, char *param, bool isjson, __maybe_unused char group) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
SETUP_STRTOK_TS; |
|
|
|
|
|
|
|
int total_pools_ = total_pools; // Keep a local copy, to be more threadsafe
|
|
|
|
|
|
|
|
char *a; |
|
|
|
|
|
|
|
int i, prio = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (total_pools_ == 0) { |
|
|
|
|
|
|
|
strcpy(io_buffer, message(MSG_NOPOOL, 0, NULL, isjson)); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool pools_changed[total_pools_]; |
|
|
|
|
|
|
|
for (i = 0; i < total_pools_; ++i) |
|
|
|
|
|
|
|
pools_changed[i] = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
a = strtok_ts(param, ","); |
|
|
|
|
|
|
|
do { |
|
|
|
|
|
|
|
i = atoi(a); |
|
|
|
|
|
|
|
pools[i]->prio = prio++; |
|
|
|
|
|
|
|
pools_changed[i] = true; |
|
|
|
|
|
|
|
} while ( (a = strtok_ts(NULL, ",")) ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < total_pools_; ++i) |
|
|
|
|
|
|
|
if (!pools_changed[i]) |
|
|
|
|
|
|
|
pools[i]->prio = prio++; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (current_pool()->prio) |
|
|
|
|
|
|
|
switch_pools(NULL); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strcpy(io_buffer, message(MSG_POOLPRIO, 0, NULL, isjson)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void disablepool(__maybe_unused SOCKETTYPE c, char *param, bool isjson, __maybe_unused char group) |
|
|
|
static void disablepool(__maybe_unused SOCKETTYPE c, char *param, bool isjson, __maybe_unused char group) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct pool *pool; |
|
|
|
struct pool *pool; |
|
|
@ -2663,6 +2698,7 @@ struct CMDS { |
|
|
|
{ "cpucount", cpucount, false }, |
|
|
|
{ "cpucount", cpucount, false }, |
|
|
|
{ "switchpool", switchpool, true }, |
|
|
|
{ "switchpool", switchpool, true }, |
|
|
|
{ "addpool", addpool, true }, |
|
|
|
{ "addpool", addpool, true }, |
|
|
|
|
|
|
|
{ "poolpriority", poolpriority, true }, |
|
|
|
{ "enablepool", enablepool, true }, |
|
|
|
{ "enablepool", enablepool, true }, |
|
|
|
{ "disablepool", disablepool, true }, |
|
|
|
{ "disablepool", disablepool, true }, |
|
|
|
{ "removepool", removepool, true }, |
|
|
|
{ "removepool", removepool, true }, |
|
|
|