Classes | |
class | Params |
Do not use directly. Use params: : methods instead. More... | |
Functions | |
int | loadparams (int &argc, char **&argv, bool requireFile=false) |
Loads the parameters as though from the command line. | |
int | loadfile (const char *filename, bool allRequired=false) |
void | addRequired (const std::string &name, const std::string &desc="") |
Adds a required parameter of name name and description desc . | |
int | print (FILE *ostream) |
Prints all the parameters to a FILE* such as stdout . | |
int | print (std::ostream &os) |
Prints all the parameters to a ostream such as cout . | |
void | getBootstrapPeers (const mace::MaceKey &laddr, NodeSet &peers, bool &autoBootstrap) |
Returns either MACE_AUTO_BOOTSTRAP_PEERS or MACE_BOOTSTRAP_PEERS, parsed as a set of IPV4 nodes. | |
Variables | |
static const std::string | MACE_LOCAL_ADDRESS = "MACE_LOCAL_ADDRESS" |
Allows to override the detected local address. | |
static const std::string | MACE_PORT = "MACE_PORT" |
Sets the default port for addresses. | |
static const std::string | MACE_BIND_LOCAL_ADDRESS = "MACE_BIND_LOCAL_ADDRESS" |
1 or 0, sets whether to additionally bind to the local address rather than inaddr any. | |
static const std::string | MACE_TRANSPORT_DISABLE_TRANSLATION = "MACE_TRANSPORT_DISABLE_TRANSLATION" |
1 or 0, sets whether to have the transport re-write source addresses for hosts using the auto-forwarding transport features. | |
static const std::string | MACE_ALL_HOSTS_REACHABLE = "MACE_ALL_HOSTS_REACHABLE" |
When set allows the transport to skip overhead when not doing NAT. | |
static const std::string | MACE_CERT_FILE = "MACE_CERT_FILE" |
Tell the transport where the certificate file is. | |
static const std::string | MACE_PRIVATE_KEY_FILE = "MACE_PRIVATE_KEY_FILE" |
Tell the transport where the private key is. | |
static const std::string | MACE_CA_FILE = "MACE_CA_FILE" |
Tell the transport where the CA certificate to trust is. | |
static const std::string | MACE_NO_VERIFY_HOSTNAMES = "MACE_NO_VERIFY_HOSTNAMES" |
Tell the transport to ignore hostnames in certificates. | |
static const std::string | MACE_PRINT_HOSTNAME_ONLY = "MACE_PRINT_HOSTNAME_ONLY" |
In outputting logs, don't print prefix or IP, just hostname. | |
static const std::string | MACE_LOG_AUTO_SELECTORS = "MACE_LOG_AUTO_SELECTORS" |
These will be passed to Log::autoAdd. | |
static const std::string | MACE_LOG_TIMESTAMP_HUMAN = "MACE_LOG_TIMESTAMP_HUMAN" |
If true, configured logging will use human timestamps. | |
static const std::string | MACE_LOG_LEVEL = "MACE_LOG_LEVEL" |
Calls Log::setLevel. | |
static const std::string | MACE_LOG_AUTO_ALL = "MACE_LOG_AUTO_ALL" |
Enables all logging via Log::autoAddAll. | |
static const std::string | MACE_LOG_FILE = "MACE_LOG_FILE" |
Default file to write configured logs to. | |
static const std::string | MACE_LOG_PATH = "MACE_LOG_PATH" |
Default path for log files. | |
static const std::string | MACE_LOG_PREFIX = "MACE_LOG_PREFIX" |
Prefix for log files. | |
static const std::string | MACE_LOG_APPEND = "MACE_LOG_APPEND" |
Don't truncate MACE_LOG_FILE. | |
static const std::string | MACE_LOG_DISABLE_WARNING = "MACE_LOG_DISABLE_WARNING" |
During configuration, disable default warning logs. | |
static const std::string | MACE_LOG_AUTO_BINARY = "MACE_LOG_AUTO_BINARY" |
Like MACE_LOG_AUTO_SELECTORS, but adds as binary logs. | |
static const std::string | MACE_BIN_LOG_FILE = "MACE_BIN_LOG_FILE" |
File for writing the binary logs. | |
static const std::string | MACE_BOOTSTRAP_PEERS = "MACE_BOOTSTRAP_PEERS" |
sets autoBootstrap to false, but will return from params::getBootstrapPeers | |
static const std::string | MACE_AUTO_BOOTSTRAP_PEERS = "MACE_AUTO_BOOTSTRAP_PEERS" |
Will return for getBootstrapPeers, and set autoBootstrap to true. | |
static const std::string | MACE_ADDRESS_ALLOW_LOOPBACK = "MACE_ADDRESS_ALLOW_LOOPBACK" |
Enable the transport to use the loopback as a local address. Disabled by default to prevent bad address detection. |
void params::getBootstrapPeers | ( | const mace::MaceKey & | laddr, | |
NodeSet & | peers, | |||
bool & | autoBootstrap | |||
) | [inline] |
Returns either MACE_AUTO_BOOTSTRAP_PEERS or MACE_BOOTSTRAP_PEERS, parsed as a set of IPV4 nodes.
laddr | the local address, excluded from the parsed nodes | |
peers | the set to store the nodes in | |
autoBootstrap | set to true on return if MACE_AUTO_BOOTSTRAP_PEERS was set. |
int params::loadfile | ( | const char * | filename, | |
bool | allRequired = false | |||
) | [inline] |
Files are read in as follows: # is the comment delimiter. Lines beginning with it are ignored. The remainder of any line containing it, unless a quoted string are ignored. parameters are set by parameter = value, or parameter = "value"
filename | the file to read parameters from | |
allRequired | whether all required parameters must be in the file |
int params::loadparams | ( | int & | argc, | |
char **& | argv, | |||
bool | requireFile = false | |||
) | [inline] |
Loads the parameters as though from the command line.
Follows this method: 1 - Ignores argv[0], as this is the program executable 2 - If no option file is specified, defaults are read in from params.default 3 - If argv[1] is a file -- parameters are read in from it 4 - Remaining arguments are read and parsed as command-line [potentially] overriding values. 5 - Returns the number of parameters set.
argc | the number of arguments in argv | |
argv | the arguments | |
requireFile | whether there must be a file parameter |