Monero
command_line_args.h
Go to the documentation of this file.
1 // Copyright (c) 2014-2018, The Monero Project
2 //
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without modification, are
6 // permitted provided that the following conditions are met:
7 //
8 // 1. Redistributions of source code must retain the above copyright notice, this list of
9 // conditions and the following disclaimer.
10 //
11 // 2. Redistributions in binary form must reproduce the above copyright notice, this list
12 // of conditions and the following disclaimer in the documentation and/or other
13 // materials provided with the distribution.
14 //
15 // 3. Neither the name of the copyright holder nor the names of its contributors may be
16 // used to endorse or promote products derived from this software without specific
17 // prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22 // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27 // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 
29 #ifndef DAEMON_COMMAND_LINE_ARGS_H
30 #define DAEMON_COMMAND_LINE_ARGS_H
31 
32 #include "common/command_line.h"
33 #include "cryptonote_config.h"
34 #include "daemonizer/daemonizer.h"
35 
36 namespace daemon_args
37 {
38  std::string const WINDOWS_SERVICE_NAME = "Monero Daemon";
39 
41  "config-file"
42  , "Specify configuration file"
43  , (daemonizer::get_default_data_dir() / std::string(CRYPTONOTE_NAME ".conf")).string()
45  , [](std::array<bool, 2> testnet_stagenet, bool defaulted, std::string val)->std::string {
46  if (testnet_stagenet[0] && defaulted)
47  return (daemonizer::get_default_data_dir() / "testnet" /
48  std::string(CRYPTONOTE_NAME ".conf")).string();
49  else if (testnet_stagenet[1] && defaulted)
50  return (daemonizer::get_default_data_dir() / "stagenet" /
51  std::string(CRYPTONOTE_NAME ".conf")).string();
52  return val;
53  }
54  };
56  "log-file"
57  , "Specify log file"
58  , (daemonizer::get_default_data_dir() / std::string(CRYPTONOTE_NAME ".log")).string()
60  , [](std::array<bool, 2> testnet_stagenet, bool defaulted, std::string val)->std::string {
61  if (testnet_stagenet[0] && defaulted)
62  return (daemonizer::get_default_data_dir() / "testnet" /
63  std::string(CRYPTONOTE_NAME ".log")).string();
64  else if (testnet_stagenet[1] && defaulted)
65  return (daemonizer::get_default_data_dir() / "stagenet" /
66  std::string(CRYPTONOTE_NAME ".log")).string();
67  return val;
68  }
69  };
71  "max-log-file-size"
72  , "Specify maximum log file size [B]"
73  , MAX_LOG_FILE_SIZE
74  };
76  "max-log-files"
77  , "Specify maximum number of rotated log files to be saved (no limit by setting to 0)"
78  , MAX_LOG_FILES
79  };
81  "log-level"
82  , ""
83  , ""
84  };
86  "daemon_command"
87  , "Hidden"
88  };
90  "os-version"
91  , "OS for which this executable was compiled"
92  };
94  "max-concurrency"
95  , "Max number of threads to use for a parallel job"
96  , 0
97  };
98 
100  "zmq-rpc-bind-ip"
101  , "IP for ZMQ RPC server to listen on"
102  , "127.0.0.1"
103  };
104 
106  "zmq-rpc-bind-port"
107  , "Port for ZMQ RPC server to listen on"
108  , std::to_string(config::ZMQ_RPC_DEFAULT_PORT)
110  , [](std::array<bool, 2> testnet_stagenet, bool defaulted, std::string val)->std::string {
111  if (testnet_stagenet[0] && defaulted)
112  return std::to_string(config::testnet::ZMQ_RPC_DEFAULT_PORT);
113  if (testnet_stagenet[1] && defaulted)
114  return std::to_string(config::stagenet::ZMQ_RPC_DEFAULT_PORT);
115  return val;
116  }
117  };
118 
119 } // namespace daemon_args
120 
121 #endif // DAEMON_COMMAND_LINE_ARGS_H
uint16_t const ZMQ_RPC_DEFAULT_PORT
Definition: cryptonote_config.h:164
const command_line::arg_descriptor< std::vector< std::string > > arg_command
Definition: command_line_args.h:85
const command_line::arg_descriptor< bool > arg_os_version
Definition: command_line_args.h:89
const command_line::arg_descriptor< std::string > arg_zmq_rpc_bind_ip
Definition: command_line_args.h:99
const command_line::arg_descriptor< bool, false > arg_stagenet_on
Definition: cryptonote_core.cpp:74
const command_line::arg_descriptor< std::string, false, true, 2 > arg_log_file
Definition: command_line_args.h:55
const command_line::arg_descriptor< std::size_t > arg_max_log_file_size
Definition: command_line_args.h:70
Definition: command_line_args.h:36
const command_line::arg_descriptor< unsigned > arg_max_concurrency
Definition: command_line_args.h:93
const command_line::arg_descriptor< std::string, false, true, 2 > arg_zmq_rpc_bind_port
Definition: command_line_args.h:105
const command_line::arg_descriptor< bool, false > arg_testnet_on
Definition: cryptonote_core.cpp:69
#define CRYPTONOTE_NAME
Definition: cryptonote_config.h:126
uint16_t const ZMQ_RPC_DEFAULT_PORT
Definition: cryptonote_config.h:193
const command_line::arg_descriptor< std::string > arg_log_level
Definition: command_line_args.h:80
boost::filesystem::path get_default_data_dir()
Definition: posix_daemonizer.inl:66
uint16_t const ZMQ_RPC_DEFAULT_PORT
Definition: cryptonote_config.h:178
const command_line::arg_descriptor< std::string, false, true, 2 > arg_config_file
Definition: command_line_args.h:40
std::string const WINDOWS_SERVICE_NAME
Definition: command_line_args.h:38
const command_line::arg_descriptor< std::size_t > arg_max_log_files
Definition: command_line_args.h:75