diff --git a/spectrum_manager/src/server.cpp b/spectrum_manager/src/server.cpp index 94fb17e8408f43219f23961c646e4112e3d02a97..28f499853cfff11d634c8877d46b4aab1fec7035 100644 --- a/spectrum_manager/src/server.cpp +++ b/spectrum_manager/src/server.cpp @@ -306,6 +306,28 @@ void Server::serve_login(struct mg_connection *conn, const struct mg_request_inf print_html(conn, request_info, html); } +void Server::serve_start(struct mg_connection *conn, const struct mg_request_info *request_info) { + std::string html= get_header() ; + char jid[255]; + get_qsvar(request_info, "jid", jid, sizeof(jid)); + + start_instances(m_config, jid); + html += "" + get_response() + ""; + html += ""; + print_html(conn, request_info, html); +} + +void Server::serve_stop(struct mg_connection *conn, const struct mg_request_info *request_info) { + std::string html= get_header(); + char jid[255]; + get_qsvar(request_info, "jid", jid, sizeof(jid)); + + stop_instances(m_config, jid); + html += "" + get_response() + ""; + html += ""; + print_html(conn, request_info, html); +} + void Server::serve_root(struct mg_connection *conn, const struct mg_request_info *request_info) { std::vector list = show_list(m_config, false); std::string html= get_header() + "

List of instances

"; @@ -348,6 +370,10 @@ void *Server::event_handler(enum mg_event event, struct mg_connection *conn) { serve_login(conn, request_info); } else if (strcmp(request_info->uri, "/") == 0) { serve_root(conn, request_info); + } else if (strcmp(request_info->uri, "/start") == 0) { + serve_start(conn, request_info); + } else if (strcmp(request_info->uri, "/stop") == 0) { + serve_stop(conn, request_info); } else { // No suitable handler found, mark as not processed. Mongoose will // try to serve the request.
JIDStatusCommand