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