Electroneum
Loading...
Searching...
No Matches
command_server.h
Go to the documentation of this file.
1
11
12// Copyrights(c) 2017-2021, The Electroneum Project
13// Copyrights(c) 2014-2019, 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#include "net/net_fwd.h"
48
49namespace daemonize {
50
52private:
54 epee::console_handlers_binder m_command_lookup;
55 bool m_is_rpc;
56
57public:
59 uint32_t ip
60 , uint16_t port
61 , const boost::optional<tools::login>& login
62 , const epee::net_utils::ssl_options_t& ssl_options
63 , bool is_rpc = true
64 , cryptonote::core_rpc_server* rpc_server = NULL
65 );
66
67 bool process_command_str(const std::string& cmd);
68
69 bool process_command_vec(const std::vector<std::string>& cmd);
70
71 bool start_handling(std::function<void(void)> exit_handler = NULL);
72
73 void stop_handling();
74
75private:
76 bool help(const std::vector<std::string>& args);
77
78 std::string get_commands_str();
79 std::string get_command_usage(const std::vector<std::string> &args);
80};
81
82} // namespace daemonize
bool process_command_vec(const std::vector< std::string > &cmd)
bool process_command_str(const std::string &cmd)
bool start_handling(std::function< void(void)> exit_handler=NULL)
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)
unsigned short uint16_t
Definition stdint.h:125
unsigned int uint32_t
Definition stdint.h:126