|
|
|
@ -45,6 +45,8 @@ static void cli_incoming_terminate(str *instr, struct cli_writer *cw);
|
|
|
|
|
static void cli_incoming_ksadd(str *instr, struct cli_writer *cw);
|
|
|
|
|
static void cli_incoming_ksrm(str *instr, struct cli_writer *cw);
|
|
|
|
|
static void cli_incoming_kslist(str *instr, struct cli_writer *cw);
|
|
|
|
|
static void cli_incoming_active(str *instr, struct cli_writer *cw);
|
|
|
|
|
static void cli_incoming_standby(str *instr, struct cli_writer *cw);
|
|
|
|
|
|
|
|
|
|
static void cli_incoming_set_maxopenfiles(str *instr, struct cli_writer *cw);
|
|
|
|
|
static void cli_incoming_set_maxsessions(str *instr, struct cli_writer *cw);
|
|
|
|
@ -100,6 +102,8 @@ static const cli_handler_t cli_top_handlers[] = {
|
|
|
|
|
{ "ksadd", cli_incoming_ksadd },
|
|
|
|
|
{ "ksrm", cli_incoming_ksrm },
|
|
|
|
|
{ "kslist", cli_incoming_kslist },
|
|
|
|
|
{ "active", cli_incoming_active },
|
|
|
|
|
{ "standby", cli_incoming_standby },
|
|
|
|
|
{ NULL, },
|
|
|
|
|
};
|
|
|
|
|
static const cli_handler_t cli_set_handlers[] = {
|
|
|
|
@ -169,7 +173,7 @@ static void cli_handler_do(const cli_handler_t *handlers, str *instr,
|
|
|
|
|
cw->cw_printf(cw, "%s:%s\n", "Unknown or incomplete command:", instr->s);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void destroy_own_foreign_calls(unsigned int foreign_call, unsigned int uint_keyspace_db) {
|
|
|
|
|
static void destroy_own_foreign_calls(int foreign_call, unsigned int uint_keyspace_db) {
|
|
|
|
|
struct call *c = NULL;
|
|
|
|
|
struct call_monologue *ml = NULL;
|
|
|
|
|
GQueue call_list = G_QUEUE_INIT;
|
|
|
|
@ -224,15 +228,15 @@ static void destroy_own_foreign_calls(unsigned int foreign_call, unsigned int ui
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void destroy_all_foreign_calls(void) {
|
|
|
|
|
destroy_own_foreign_calls(CT_FOREIGN_CALL, UNDEFINED);
|
|
|
|
|
destroy_own_foreign_calls(1, UNDEFINED);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void destroy_all_own_calls(void) {
|
|
|
|
|
destroy_own_foreign_calls(CT_OWN_CALL, UNDEFINED);
|
|
|
|
|
destroy_own_foreign_calls(0, UNDEFINED);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void destroy_keyspace_foreign_calls(unsigned int uint_keyspace_db) {
|
|
|
|
|
destroy_own_foreign_calls(CT_FOREIGN_CALL, uint_keyspace_db);
|
|
|
|
|
destroy_own_foreign_calls(1, uint_keyspace_db);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void cli_incoming_params_start(str *instr, struct cli_writer *cw) {
|
|
|
|
@ -1054,6 +1058,28 @@ static void cli_incoming_kslist(str *instr, struct cli_writer *cw) {
|
|
|
|
|
cw->cw_printf(cw, "\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void cli_incoming_active_standby(struct cli_writer *cw, int foreign) {
|
|
|
|
|
GHashTableIter iter;
|
|
|
|
|
gpointer key, value;
|
|
|
|
|
|
|
|
|
|
rwlock_lock_r(&rtpe_callhash_lock);
|
|
|
|
|
|
|
|
|
|
g_hash_table_iter_init(&iter, rtpe_callhash);
|
|
|
|
|
while (g_hash_table_iter_next(&iter, &key, &value)) {
|
|
|
|
|
struct call *c = value;
|
|
|
|
|
call_make_own_foreign(c, foreign);
|
|
|
|
|
}
|
|
|
|
|
rwlock_unlock_r(&rtpe_callhash_lock);
|
|
|
|
|
|
|
|
|
|
cw->cw_printf(cw, "Ok, all calls set to '%s'\n", foreign ? "foreign (standby)" : "owned (active)");
|
|
|
|
|
}
|
|
|
|
|
static void cli_incoming_active(str *instr, struct cli_writer *cw) {
|
|
|
|
|
cli_incoming_active_standby(cw, 0);
|
|
|
|
|
}
|
|
|
|
|
static void cli_incoming_standby(str *instr, struct cli_writer *cw) {
|
|
|
|
|
cli_incoming_active_standby(cw, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void cli_incoming(struct streambuf_stream *s) {
|
|
|
|
|
ilog(LOG_INFO, "New cli connection from %s", s->addr);
|
|
|
|
|
}
|
|
|
|
@ -1079,7 +1105,6 @@ static void cli_stream_readable(struct streambuf_stream *s) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ilog(LOG_INFO, "Got CLI command: %s%s%s", FMT_M(inbuf));
|
|
|
|
|
str_init(&instr, inbuf);
|
|
|
|
|
|
|
|
|
|
struct cli_writer cw = {
|
|
|
|
@ -1094,6 +1119,7 @@ static void cli_stream_readable(struct streambuf_stream *s) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void cli_handle(str *instr, struct cli_writer *cw) {
|
|
|
|
|
ilog(LOG_INFO, "Got CLI command: " STR_FORMAT_M, STR_FMT_M(instr));
|
|
|
|
|
cli_handler_do(cli_top_handlers, instr, cw);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|