36#include "cmdhandler.h"
39#include "clientpipe.h"
40#include "longgetopt.h"
59 "start Starts the engine and the process. \n"
60 "running Returns acknowledgment that the engine is running.\n"
61 "reload Reload the engine.\n"
62 "stop Stop the engine and terminate the process.\n\n"
67handles(
const char *cmd)
69 if (ods_check_command(cmd,
"stop"))
return 1;
70 if (ods_check_command(cmd,
"reload"))
return 1;
71 if (ods_check_command(cmd,
"running"))
return 1;
72 if (ods_check_command(cmd,
"start"))
return 1;
78run(cmdhandler_ctx_type* context,
int argc,
char* argv[])
80 int sockfd = context->sockfd;
82 if (ods_check_command(argv[0],
"start")) {
83 ods_log_debug(
"[cmdhandler] start command");
84 client_printf(sockfd,
"Engine already running.\n");
87 }
else if (ods_check_command(argv[0],
"running")) {
88 ods_log_debug(
"[cmdhandler] running command");
89 client_printf(sockfd,
"Engine running.\n");
91 }
else if (ods_check_command(argv[0],
"reload")) {
92 ods_log_debug(
"[cmdhandler] reload command");
93 ods_log_assert(engine);
98 client_printf(sockfd,
"Reloading engine.\n");
100 }
else if (ods_check_command(argv[0],
"stop")) {
101 ods_log_debug(
"[cmdhandler] stop command");
102 ods_log_assert(engine);
107 client_printf(sockfd,
"%s\n", ODS_SE_STOP_RESPONSE);
115 "ctrl", &usage, &help, &handles, NULL, &run, NULL
struct cmd_func_block ctrl_funcblock
engine_type * getglobalcontext(cmdhandler_ctx_type *context)
pthread_mutex_t signal_lock
pthread_cond_t signal_cond