mirror of
https://github.com/MariaDB/server.git
synced 2025-01-26 08:44:33 +01:00
5fb792ec40
created new facade object for CommandInterpreter removed CPC #if 0 code removed editline from mgmtsrver, no replace with readline since interface is obsolete anyways BitKeeper/deleted/.del-MANIFEST~e8c948c4a4413f8d: Delete: ndb/src/common/editline/MANIFEST BitKeeper/deleted/.del-Makefile.am~dfbe493d6e2d25f4: Delete: ndb/src/common/editline/Makefile.am BitKeeper/deleted/.del-Makefile_old~90ac19a1668ecdd5: Delete: ndb/src/common/editline/Makefile_old BitKeeper/deleted/.del-README~3f39f9b8294466e8: Delete: ndb/src/common/editline/README BitKeeper/deleted/.del-complete.c~a1bc3055fd90e27f: Delete: ndb/src/common/editline/complete.c BitKeeper/deleted/.del-editline.3~1f9bb4274cf4381: Delete: ndb/src/common/editline/editline.3 BitKeeper/deleted/.del-editline.c~5b759f3e5fd3c196: Delete: ndb/src/common/editline/editline.c BitKeeper/deleted/.del-editline_internal.h~96ca8d53fb758586: Delete: ndb/src/common/editline/editline_internal.h BitKeeper/deleted/.del-editline_win32.c~45b257bec279826e: Delete: ndb/src/common/editline/editline_win32.c BitKeeper/deleted/.del-sysunix.c~8e7a6901783efd17: Delete: ndb/src/common/editline/sysunix.c BitKeeper/deleted/.del-unix.h~1c244c1d4ba6c6fb: Delete: ndb/src/common/editline/unix.h BitKeeper/deleted/.del-Makefile~46cecfa6cd1a4e6b: Delete: ndb/src/common/editline/test/Makefile BitKeeper/deleted/.del-testit.c~82837111b1876e44: Delete: ndb/src/common/editline/test/testit.c BitKeeper/deleted/.del-Makefile_old~59409aa4debaeb90: Delete: ndb/src/common/Makefile_old BitKeeper/deleted/.del-Makefile_old~92af3f5a7f24caf: Delete: ndb/src/mgmclient/Makefile_old ndb/test/src/CpcClient.cpp: Rename: ndb/src/mgmclient/CpcClient.cpp -> ndb/test/src/CpcClient.cpp ndb/test/include/CpcClient.hpp: Rename: ndb/src/mgmclient/CpcClient.hpp -> ndb/test/include/CpcClient.hpp configure.in: removed editline ndb/src/common/Makefile.am: removed editline ndb/src/mgmclient/CommandInterpreter.cpp: removed editline and replaced with mysql readline created new facade object for CommandInterpreter removed CPC #if 0 code ndb/src/mgmclient/Makefile.am: removed editline and replaced with mysql readline created new facade object for CommandInterpreter removed CPC #if 0 code ndb/src/mgmclient/main.cpp: removed editline and replaced with mysql readline created new facade object for CommandInterpreter removed CPC #if 0 code ndb/src/mgmclient/ndb_mgmclient.hpp: new facade object for CommandInterpreter ndb/src/mgmsrv/CommandInterpreter.hpp: removed editline from mgmtsrver, no replace with readline since interface is obsolete anyways ndb/src/mgmsrv/Makefile.am: removed editline from mgmtsrver, no replace with readline since interface is obsolete anyways ndb/test/run-test/Makefile.am: moved cpc code to test ndb/test/src/Makefile.am: moved cpc code to test ndb/test/tools/Makefile.am: moved cpc code to test
104 lines
2.7 KiB
C++
104 lines
2.7 KiB
C++
/* Copyright (C) 2003 MySQL AB
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
#ifndef __CPCCLIENT_HPP_INCLUDED__
|
|
#define __CPCCLIENT_HPP_INCLUDED__
|
|
|
|
#include <Parser.hpp>
|
|
#include <SocketServer.hpp>
|
|
#include <util/InputStream.hpp>
|
|
#include <util/OutputStream.hpp>
|
|
|
|
/**
|
|
* Simple CPC client class. The whole management client should be replaced
|
|
* something smarter and more worked through.
|
|
*/
|
|
class SimpleCpcClient {
|
|
public:
|
|
SimpleCpcClient(const char *host, int port);
|
|
~SimpleCpcClient();
|
|
|
|
static void run(SimpleCpcClient &);
|
|
|
|
int getPort() const { return port;}
|
|
const char * getHost() const { return host;}
|
|
|
|
struct Process {
|
|
int m_id;
|
|
BaseString m_name;
|
|
|
|
BaseString m_owner;
|
|
BaseString m_group;
|
|
BaseString m_runas;
|
|
|
|
BaseString m_cwd;
|
|
BaseString m_env;
|
|
BaseString m_path;
|
|
BaseString m_args;
|
|
|
|
BaseString m_type;
|
|
BaseString m_status;
|
|
|
|
BaseString m_stdin;
|
|
BaseString m_stdout;
|
|
BaseString m_stderr;
|
|
BaseString m_ulimit;
|
|
};
|
|
|
|
private:
|
|
class ParserDummy : SocketServer::Session {
|
|
public:
|
|
ParserDummy(NDB_SOCKET_TYPE sock);
|
|
};
|
|
|
|
typedef Parser<ParserDummy> Parser_t;
|
|
typedef ParserRow<ParserDummy> ParserRow_t;
|
|
|
|
char *host;
|
|
int port;
|
|
NDB_SOCKET_TYPE cpc_sock;
|
|
InputStream *cpc_in;
|
|
OutputStream *cpc_out;
|
|
|
|
public:
|
|
int connect();
|
|
|
|
void cmd_list(char *arg);
|
|
void cmd_start(char *arg);
|
|
void cmd_stop(char *arg);
|
|
void cmd_help(char *arg);
|
|
|
|
int list_processes(Vector<Process>&, Properties &reply);
|
|
int start_process(Uint32 id, Properties& reply);
|
|
int stop_process(Uint32 id, Properties& reply);
|
|
int undefine_process(Uint32 id, Properties& reply);
|
|
int define_process(Process & p, Properties& reply);
|
|
|
|
private:
|
|
int cpc_send(const char *cmd,
|
|
const Properties &args);
|
|
|
|
|
|
Parser_t::ParserStatus cpc_recv(const ParserRow_t *syntax,
|
|
const Properties **reply,
|
|
void **user_data = NULL);
|
|
|
|
const Properties *cpc_call(const char *cmd,
|
|
const Properties &args,
|
|
const ParserRow_t *reply_syntax);
|
|
};
|
|
|
|
#endif /* !__CPCCLIENT_HPP_INCLUDED__ */
|