Electroneum
command_server.h
Go to the documentation of this file.
1 
12 // Copyrights(c) 2017-2019, The Electroneum Project
13 // Copyrights(c) 2014-2017, The Monero Project
14 //
15 // All rights reserved.
16 //
17 // Redistribution and use in source and binary forms, with or without modification, are
18 // permitted provided that the following conditions are met:
19 //
20 // 1. Redistributions of source code must retain the above copyright notice, this list of
21 // conditions and the following disclaimer.
22 //
23 // 2. Redistributions in binary form must reproduce the above copyright notice, this list
24 // of conditions and the following disclaimer in the documentation and/or other
25 // materials provided with the distribution.
26 //
27 // 3. Neither the name of the copyright holder nor the names of its contributors may be
28 // used to endorse or promote products derived from this software without specific
29 // prior written permission.
30 //
31 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
32 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
33 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
34 // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
36 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
37 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
38 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
39 // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 
41 #pragma once
42 
43 #include <boost/optional/optional_fwd.hpp>
44 #include "common/common_fwd.h"
45 #include "console_handler.h"
47 
48 namespace daemonize {
49 
51 private:
53  epee::console_handlers_binder m_command_lookup;
54  bool m_is_rpc;
55 
56 public:
58  uint32_t ip
59  , uint16_t port
60  , const boost::optional<tools::login>& login
61  , bool is_rpc = true
62  , cryptonote::core_rpc_server* rpc_server = NULL
63  );
64 
65  bool process_command_str(const std::string& cmd);
66 
67  bool process_command_vec(const std::vector<std::string>& cmd);
68 
69  bool start_handling(std::function<void(void)> exit_handler = NULL);
70 
71  void stop_handling();
72 
73 private:
74  bool help(const std::vector<std::string>& args);
75 
76  std::string get_commands_str();
77 };
78 
79 } // namespace daemonize
t_command_parser_executor m_parser
Definition: command_server.h:52
Definition: command_parser_executor.cpp:36
t_command_server(uint32_t ip, uint16_t port, const boost::optional< tools::login > &login, bool is_rpc=true, cryptonote::core_rpc_server *rpc_server=NULL)
Definition: command_server.cpp:41
bool help(const std::vector< std::string > &args)
Definition: command_server.cpp:310
bool process_command_str(const std::string &cmd)
Definition: command_server.cpp:279
bool m_is_rpc
Definition: command_server.h:54
Definition: command_server.h:50
Definition: command_parser_executor.h:48
std::string get_commands_str()
Definition: command_server.cpp:316
epee::console_handlers_binder m_command_lookup
Definition: command_server.h:53
bool start_handling(std::function< void(void)> exit_handler=NULL)
Definition: command_server.cpp:294
Definition: core_rpc_server.h:52
bool process_command_vec(const std::vector< std::string > &cmd)
Definition: command_server.cpp:284
void stop_handling()
Definition: command_server.cpp:303