Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * init_options.cpp - Fawkes run-time initialization options 00004 * 00005 * Created: Tue Jun 07 14:19:56 2011 00006 * Copyright 2006-2011 Tim Niemueller [www.niemueller.de] 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #include <baseapp/init_options.h> 00025 #include <baseapp/run.h> 00026 #include <utils/system/argparser.h> 00027 00028 #include <cstring> 00029 #include <cstdlib> 00030 00031 namespace fawkes { 00032 namespace runtime { 00033 #if 0 /* just to make Emacs auto-indent happy */ 00034 } 00035 } 00036 #endif 00037 00038 00039 /** @class InitOptions <baseapp/init_options.h> 00040 * Initialization options class. 00041 * This class provides a container for initialization options that can be 00042 * passed to the Fawkes runtime. It uses the named parameter idiom which 00043 * allows to set only the parameters which divert from the default value. 00044 * @author Tim Niemueller 00045 */ 00046 00047 00048 /** Constructor. 00049 * Initializes the default options. 00050 * @param basename program base name 00051 */ 00052 InitOptions::InitOptions(const char *basename) 00053 { 00054 __basename = strdup(basename); 00055 __default_plugin = strdup("default"); 00056 __has_net_tcp_port = false; 00057 __net_tcp_port = 0; 00058 __has_loggers = false; 00059 __loggers = NULL; 00060 __log_level = Logger::LL_DEBUG; 00061 __has_net_service_name = false; 00062 __net_service_name = NULL; 00063 __has_username = false; 00064 __username = NULL; 00065 __has_groupname = false; 00066 __groupname = NULL; 00067 __default_config = NULL; 00068 __host_config = NULL; 00069 __daemonize = false; 00070 __daemon_pid_file = NULL; 00071 __daemonize_kill = false; 00072 __daemonize_status = false; 00073 __show_help = false; 00074 __bb_cleanup = false; 00075 __default_signal_handlers = true; 00076 __init_plugin_cache = true; 00077 __has_load_plugin_list = false; 00078 __load_plugin_list = NULL; 00079 __plugin_module_flags = Module::MODULE_FLAGS_DEFAULT; 00080 } 00081 00082 00083 /** Copy constructor. 00084 * @param options options object to copy 00085 */ 00086 InitOptions::InitOptions(const InitOptions &options) 00087 { 00088 __basename = strdup(options.__basename); 00089 __default_plugin = strdup(options.__default_plugin); 00090 __net_tcp_port = 0; 00091 __has_net_tcp_port = options.__has_net_tcp_port; 00092 if (__has_net_tcp_port) { 00093 __net_tcp_port = options.__net_tcp_port; 00094 } 00095 __loggers = NULL; 00096 __has_loggers = options.__has_loggers; 00097 if (__has_loggers) { 00098 __loggers = strdup(options.__loggers); 00099 } 00100 00101 __log_level = options.__log_level; 00102 00103 __net_service_name = NULL; 00104 __has_net_service_name = options.__has_net_service_name; 00105 if (__has_net_service_name) { 00106 __net_service_name = strdup(options.__net_service_name); 00107 } 00108 00109 __username = NULL; 00110 __has_username = options.__has_username; 00111 if (__has_username) { 00112 __username = strdup(options.__username); 00113 } 00114 __groupname = NULL; 00115 __has_groupname = options.__has_groupname; 00116 if (__has_groupname) { 00117 __groupname = strdup(options.__groupname); 00118 } 00119 00120 __default_config = NULL; 00121 if (options.__default_config) { 00122 __default_config = strdup(options.__default_config); 00123 } 00124 __host_config = NULL; 00125 if (options.__host_config) { 00126 __host_config = strdup(options.__host_config); 00127 } 00128 __daemonize = options.__daemonize; 00129 __daemon_pid_file = NULL; 00130 if (__daemonize && options.__daemon_pid_file) { 00131 __daemon_pid_file = strdup(options.__daemon_pid_file); 00132 } 00133 __daemonize_kill = options.__daemonize_kill; 00134 __daemonize_status = options.__daemonize_status; 00135 __show_help = options.__show_help; 00136 __bb_cleanup = options.__bb_cleanup; 00137 __default_signal_handlers = options.__default_signal_handlers; 00138 __init_plugin_cache = options.__init_plugin_cache; 00139 __load_plugin_list = NULL; 00140 __has_load_plugin_list = options.__has_load_plugin_list; 00141 if (__has_load_plugin_list) { 00142 __load_plugin_list = strdup(options.__load_plugin_list); 00143 } 00144 00145 __plugin_module_flags = options.__plugin_module_flags; 00146 } 00147 00148 00149 /** Constructor from arguments. 00150 * Initializes the options from arguments passed from the command line. 00151 * @param argc number of elements in @p argv 00152 * @param argv argument array 00153 */ 00154 InitOptions::InitOptions(int argc, char **argv) 00155 { 00156 00157 option long_options[] = { 00158 {"net-service-name", 1, 0, 0}, 00159 {0, 0, 0, 0} 00160 }; 00161 00162 fawkes::runtime::argument_parser = 00163 new ArgumentParser(argc, argv, 00164 "hCc:d:q::l:L:p:P:u:g:D::ks", 00165 long_options); 00166 00167 ArgumentParser *argp = fawkes::runtime::argument_parser; 00168 00169 __basename = strdup(argp->program_name()); 00170 __default_plugin = strdup("default"); 00171 00172 __has_net_tcp_port = argp->has_arg("P"); 00173 if (__has_net_tcp_port) { 00174 __net_tcp_port = argp->parse_int("P"); 00175 } 00176 __has_loggers = argp->has_arg("L"); 00177 if (__has_loggers) { 00178 __loggers = strdup(argp->arg("L")); 00179 } 00180 00181 const char *tmp; 00182 __log_level = Logger::LL_DEBUG; 00183 if ( argp->has_arg("q") ) { 00184 __log_level = Logger::LL_INFO; 00185 if ( (tmp = argp->arg("q")) != NULL ) { 00186 for (unsigned int i = 0; i < strlen(tmp); ++i) { 00187 if ( tmp[i] == 'q' ) { 00188 switch (__log_level) { 00189 case Logger::LL_INFO: __log_level = Logger::LL_WARN; break; 00190 case Logger::LL_WARN: __log_level = Logger::LL_ERROR; break; 00191 case Logger::LL_ERROR: __log_level = Logger::LL_NONE; break; 00192 default: break; 00193 } 00194 } 00195 } 00196 } 00197 } else if ( (tmp = argp->arg("l")) != NULL ) { 00198 if ( strcmp(tmp, "debug") == 0 ) { 00199 __log_level = Logger::LL_DEBUG; 00200 } else if ( strcmp(tmp, "info") == 0 ) { 00201 __log_level = Logger::LL_INFO; 00202 } else if ( strcmp(tmp, "warn") == 0 ) { 00203 __log_level = Logger::LL_WARN; 00204 } else if ( strcmp(tmp, "error") == 0 ) { 00205 __log_level = Logger::LL_ERROR; 00206 } else if ( strcmp(tmp, "none") == 0 ) { 00207 __log_level = Logger::LL_NONE; 00208 } 00209 } 00210 00211 __has_net_service_name = argp->has_arg("net-service-name"); 00212 if (__has_net_service_name) { 00213 __net_service_name = strdup(argp->arg("net-service-name")); 00214 } else { 00215 __net_service_name = NULL; 00216 } 00217 00218 __has_username = argp->has_arg("u"); 00219 if (__has_username) { 00220 __username = strdup(argp->arg("u")); 00221 } else { 00222 __username = NULL; 00223 } 00224 00225 __has_groupname = argp->has_arg("u"); 00226 if (__has_groupname) { 00227 __groupname = strdup(argp->arg("u")); 00228 } else { 00229 __groupname = NULL; 00230 } 00231 00232 00233 __default_config = NULL; 00234 __host_config = NULL; 00235 if (argp->arg("d")) { 00236 __default_config = strdup(argp->arg("d")); 00237 } 00238 if (argp->arg("c")) { 00239 __host_config = strdup(argp->arg("c")); 00240 } 00241 00242 __daemonize = argp->has_arg("D"); 00243 __daemonize_kill = __daemonize && argp->has_arg("k"); 00244 __daemonize_status = __daemonize && argp->has_arg("s"); 00245 __daemon_pid_file = NULL; 00246 if (__daemonize && argp->arg("D")) { 00247 __daemon_pid_file = strdup(argp->arg("D")); 00248 } else { 00249 __daemon_pid_file = NULL; 00250 } 00251 __show_help = argp->has_arg("h"); 00252 __bb_cleanup = argp->has_arg("C"); 00253 00254 __has_load_plugin_list = argp->has_arg("p"); 00255 if (__has_load_plugin_list) { 00256 __load_plugin_list = strdup(argp->arg("p")); 00257 } else { 00258 __load_plugin_list = NULL; 00259 } 00260 00261 __init_plugin_cache = true; 00262 __plugin_module_flags = Module::MODULE_FLAGS_DEFAULT; 00263 __default_signal_handlers = true; 00264 } 00265 00266 00267 /** Destructor. */ 00268 InitOptions::~InitOptions() 00269 { 00270 free(__basename); 00271 free(__default_plugin); 00272 if (__has_loggers) free(__loggers); 00273 if (__has_net_service_name) free(__net_service_name); 00274 if (__has_username) free(__username); 00275 if (__has_groupname) free(__groupname); 00276 if (__has_load_plugin_list) free(__load_plugin_list); 00277 if (__default_config) free(__default_config); 00278 if (__host_config) free(__host_config); 00279 if (__daemon_pid_file) free(__daemon_pid_file); 00280 } 00281 00282 00283 /** Assignment operator. 00284 * @param options options object to copy 00285 * @return reference to this instance 00286 */ 00287 InitOptions & 00288 InitOptions::operator=(const InitOptions &options) 00289 { 00290 free(__basename); 00291 __basename = strdup(options.__basename); 00292 free(__default_plugin); 00293 __default_plugin = strdup(options.__default_plugin); 00294 __net_tcp_port = 0; 00295 __has_net_tcp_port = options.__has_net_tcp_port; 00296 if (__has_net_tcp_port) { 00297 __net_tcp_port = options.__net_tcp_port; 00298 } 00299 if (__has_loggers) { 00300 __has_loggers = false; 00301 free(__loggers); 00302 __loggers = NULL; 00303 } 00304 __has_loggers = options.__has_loggers; 00305 if (__has_loggers) { 00306 __loggers = strdup(options.__loggers); 00307 } 00308 00309 __log_level = options.__log_level; 00310 00311 if (__has_net_service_name) { 00312 __has_net_service_name = false; 00313 free(__net_service_name); 00314 __net_service_name = NULL; 00315 } 00316 __has_net_service_name = options.__has_net_service_name; 00317 if (__has_net_service_name) { 00318 __net_service_name = strdup(options.__net_service_name); 00319 } 00320 00321 if (__has_username) { 00322 __has_username = false; 00323 free(__username); 00324 __username = NULL; 00325 } 00326 __has_username = options.__has_username; 00327 if (__has_username) { 00328 __username = strdup(options.__username); 00329 } 00330 00331 if (__has_groupname) { 00332 __has_groupname = false; 00333 free(__groupname); 00334 __groupname = NULL; 00335 } 00336 __groupname = NULL; 00337 __has_groupname = options.__has_groupname; 00338 if (__has_groupname) { 00339 __groupname = strdup(options.__groupname); 00340 } 00341 00342 if (__default_config) { 00343 free(__default_config); 00344 __default_config = NULL; 00345 } 00346 if (options.__default_config) { 00347 __default_config = strdup(options.__default_config); 00348 } 00349 00350 if (__host_config) { 00351 free(__host_config); 00352 __host_config = NULL; 00353 } 00354 if (options.__host_config) { 00355 __host_config = strdup(options.__host_config); 00356 } 00357 00358 __daemonize = options.__daemonize; 00359 if (__daemon_pid_file) { 00360 free(__daemon_pid_file); 00361 __daemon_pid_file = NULL; 00362 } 00363 if (__daemonize && options.__daemon_pid_file) { 00364 __daemon_pid_file = strdup(options.__daemon_pid_file); 00365 } 00366 __daemonize_kill = options.__daemonize_kill; 00367 __daemonize_status = options.__daemonize_status; 00368 __show_help = options.__show_help; 00369 __bb_cleanup = options.__bb_cleanup; 00370 00371 if (__load_plugin_list) { 00372 free(__load_plugin_list); 00373 __load_plugin_list = NULL; 00374 } 00375 __has_load_plugin_list = options.__has_load_plugin_list; 00376 if (__has_load_plugin_list) { 00377 __load_plugin_list = strdup(options.__load_plugin_list); 00378 } 00379 00380 __init_plugin_cache = options.__init_plugin_cache; 00381 __plugin_module_flags = options.__plugin_module_flags; 00382 __default_signal_handlers = options.__default_signal_handlers; 00383 00384 return *this; 00385 } 00386 00387 00388 /** Set additional default plugin name. 00389 * @param default_plugin_ additional default plugin name 00390 * @return reference to this instance 00391 */ 00392 InitOptions & 00393 InitOptions::default_plugin(const char *default_plugin_) 00394 { 00395 free(__default_plugin); 00396 __default_plugin = strdup(default_plugin_); 00397 return *this; 00398 } 00399 00400 00401 /** Set Fawkes network TCP port. 00402 * @param port TCP port 00403 * @return reference to this instance 00404 */ 00405 InitOptions & 00406 InitOptions::net_tcp_port(unsigned short int port) 00407 { 00408 __has_net_tcp_port = true; 00409 __net_tcp_port = port; 00410 return *this; 00411 } 00412 00413 /** Set Fawkes network service name. 00414 * @param service_name service name 00415 * @return reference to this instance 00416 */ 00417 InitOptions & 00418 InitOptions::net_service_name(const char *service_name) 00419 { 00420 if (__has_net_service_name) { 00421 __has_net_service_name = false; 00422 free(__net_service_name); 00423 } 00424 if (service_name) { 00425 __has_net_service_name = true; 00426 __net_service_name = strdup(service_name); 00427 } 00428 return *this; 00429 } 00430 00431 /** Set daemonization options. 00432 * @param daemonize daemonization requested 00433 * @param kill kill a running daemon 00434 * @param status print status about running daemon 00435 * @param pid_file path to file to write PID to 00436 * @return reference to this instance 00437 */ 00438 InitOptions & 00439 InitOptions::daemonize(bool daemonize, bool kill, bool status, 00440 const char *pid_file) 00441 { 00442 __daemonize = daemonize; 00443 __daemonize_kill = daemonize && kill; 00444 __daemonize_status = daemonize && status; 00445 if (daemonize && pid_file) { 00446 __daemon_pid_file = strdup(pid_file); 00447 } 00448 return *this; 00449 } 00450 00451 /** Set loggers. 00452 * @param loggers string of loggers 00453 * @return reference to this instance 00454 */ 00455 InitOptions & 00456 InitOptions::loggers(const char *loggers) 00457 { 00458 if (__has_loggers) { 00459 __has_loggers = false; 00460 free(__loggers); 00461 } 00462 if (loggers) { 00463 __has_loggers = true; 00464 __loggers = strdup(loggers); 00465 } 00466 return *this; 00467 } 00468 00469 /** Set log level. 00470 * @param log_level desired log level 00471 * @return reference to this instance 00472 */ 00473 InitOptions & 00474 InitOptions::log_level(Logger::LogLevel log_level) 00475 { 00476 __log_level = log_level; 00477 return *this; 00478 } 00479 00480 /** Set to show help. 00481 * @param show_help true to request showing help information, false otherwise 00482 * @return reference to this instance 00483 */ 00484 InitOptions & 00485 InitOptions::show_help(bool show_help) 00486 { 00487 __show_help = show_help; 00488 return *this; 00489 } 00490 00491 00492 /** Enable or disable plugin cache initialization. 00493 * @param init_cache true to trigger plugin cache initialization, false to disable 00494 * @return reference to this instance 00495 */ 00496 InitOptions & 00497 InitOptions::init_plugin_cache(bool init_cache) 00498 { 00499 __init_plugin_cache = init_cache; 00500 return *this; 00501 } 00502 00503 /** Set user name to run as. 00504 * @param username user name to run as 00505 * @return reference to this instance 00506 */ 00507 InitOptions & 00508 InitOptions::user(const char *username) 00509 { 00510 if (__has_username) { 00511 __has_username = false; 00512 free(__username); 00513 } 00514 if (username) { 00515 __has_username = true; 00516 __username = strdup(username); 00517 } 00518 return *this; 00519 } 00520 00521 00522 /** Set list of plugins to load during startup. 00523 * @param plugin_list comma-separated list of names of plugins to load 00524 * @return reference to this instance 00525 */ 00526 InitOptions & 00527 InitOptions::load_plugins(const char *plugin_list) 00528 { 00529 if (__has_load_plugin_list) { 00530 __has_load_plugin_list = false; 00531 free(__load_plugin_list); 00532 __load_plugin_list = NULL; 00533 } 00534 if (plugin_list) { 00535 __has_load_plugin_list = true; 00536 __load_plugin_list = strdup(plugin_list); 00537 } 00538 return *this; 00539 } 00540 00541 00542 /** Set group name to run as. 00543 * @param groupname user name to run as 00544 * @return reference to this instance 00545 */ 00546 InitOptions & 00547 InitOptions::group(const char *groupname) 00548 { 00549 if (__has_groupname) { 00550 __has_groupname = false; 00551 free(__groupname); 00552 } 00553 if (groupname) { 00554 __has_groupname = true; 00555 __groupname = strdup(groupname); 00556 } 00557 return *this; 00558 } 00559 00560 /** Set default config name. 00561 * @param default_config default config name 00562 * @return reference to this instance 00563 */ 00564 InitOptions & 00565 InitOptions::default_config(const char *default_config) 00566 { 00567 if (__default_config) { 00568 free(__default_config); 00569 __default_config = NULL; 00570 } 00571 if (default_config) { 00572 __default_config = strdup(default_config); 00573 } 00574 return *this; 00575 } 00576 00577 /** Set host config name. 00578 * @param host_config host config name 00579 * @return reference to this instance 00580 */ 00581 InitOptions & 00582 InitOptions::host_config(const char *host_config) 00583 { 00584 if (__host_config) { 00585 free(__host_config); 00586 __host_config = NULL; 00587 } 00588 if (host_config) { 00589 __host_config = strdup(host_config); 00590 } 00591 return *this; 00592 } 00593 00594 /** Set blackboard cleanup. 00595 * @param bb_cleanup true to run blackboard cleanup, false otherwise 00596 * @return reference to this instance 00597 */ 00598 InitOptions & 00599 InitOptions::bb_cleanup(bool bb_cleanup) 00600 { 00601 __bb_cleanup = bb_cleanup; 00602 return *this; 00603 } 00604 00605 00606 /** Set module flags. 00607 * @param flags flags to open plugin modules with 00608 * @return reference to this instance 00609 */ 00610 InitOptions & 00611 InitOptions::plugin_module_flags(Module::ModuleFlags flags) 00612 { 00613 __plugin_module_flags = flags; 00614 return *this; 00615 } 00616 00617 00618 /** Set default signal handlers. 00619 * @param enable true to enable default signal handlers, false to disable. Note 00620 * that if you disable the signal handlers you must stop the Fawkes main thread 00621 * execution by yourself by some other means. 00622 * @return reference to this instance 00623 */ 00624 InitOptions & 00625 InitOptions::default_signal_handlers(bool enable) 00626 { 00627 __default_signal_handlers = enable; 00628 return *this; 00629 } 00630 00631 00632 /** Get program basename. 00633 * @return program base name 00634 */ 00635 const char * 00636 InitOptions::basename() const 00637 { 00638 return __basename; 00639 } 00640 00641 00642 /** Get name of default plugin. 00643 * This is usually the name of a meta plugin to load the appropriate 00644 * plugins. It may have a specialized name on a specific robot 00645 * platform. It defaults to "default". Note that "default" is always 00646 * loaded to avoid confusion. 00647 * @return default plugin name 00648 */ 00649 const char * 00650 InitOptions::default_plugin() const 00651 { 00652 return __default_plugin; 00653 } 00654 00655 00656 /** Check if TCP port has been passed. 00657 * @return true if the parameter has been set, false otherwise 00658 */ 00659 bool 00660 InitOptions::has_net_tcp_port() const 00661 { 00662 return __has_net_tcp_port; 00663 } 00664 00665 /** Get Fawkes network TCP port. 00666 * @return Fawkes network TCP port 00667 */ 00668 unsigned short int 00669 InitOptions::net_tcp_port() const 00670 { 00671 return __net_tcp_port; 00672 } 00673 00674 /** Check if network service name has been passed. 00675 * @return true if the parameter has been set, false otherwise 00676 */ 00677 bool 00678 InitOptions::has_net_service_name() const 00679 { 00680 return __has_net_service_name; 00681 } 00682 00683 /** Get network service name. 00684 * @return network service name 00685 */ 00686 const char * 00687 InitOptions::net_service_name() const 00688 { 00689 return __net_service_name; 00690 } 00691 00692 /** Check if plugin load list has been set. 00693 * @return true if the parameter has been set, false otherwise 00694 */ 00695 bool 00696 InitOptions::has_load_plugin_list() const 00697 { 00698 return __has_load_plugin_list; 00699 } 00700 00701 /** Get plugin load list. 00702 * @return plugin load list 00703 */ 00704 const char * 00705 InitOptions::load_plugin_list() const 00706 { 00707 return __load_plugin_list; 00708 } 00709 00710 /** Check if logger string has been passed. 00711 * @return true if the parameter has been set, false otherwise 00712 */ 00713 bool 00714 InitOptions::has_loggers() const 00715 { 00716 return __has_loggers; 00717 } 00718 00719 /** Get logger string. 00720 * @return logger stirng 00721 */ 00722 const char * 00723 InitOptions::loggers() const 00724 { 00725 return __loggers; 00726 } 00727 00728 /** Get log level. 00729 * @return log level 00730 */ 00731 Logger::LogLevel 00732 InitOptions::log_level() const 00733 { 00734 return __log_level; 00735 } 00736 00737 /** Check if help has been requested. 00738 * @return true if help has been requested, false otherwise 00739 */ 00740 bool 00741 InitOptions::show_help() const 00742 { 00743 return __show_help; 00744 } 00745 00746 /** Check if blackboard cleanup has been requested. 00747 * @return true if blackboard cleanup has been requested, false otherwise 00748 */ 00749 bool 00750 InitOptions::bb_cleanup() const 00751 { 00752 return __bb_cleanup; 00753 } 00754 00755 00756 /** Check if plugin cache initialization has been requested. 00757 * @return true if plugin cache initialization has been requested, false otherwise 00758 */ 00759 bool 00760 InitOptions::init_plugin_cache() const 00761 { 00762 return __init_plugin_cache; 00763 } 00764 00765 00766 /** Check if default signal handlers should be enabled. 00767 * @return true if default signal handlers have been requested, false otherwise 00768 */ 00769 bool 00770 InitOptions::default_signal_handlers() const 00771 { 00772 return __default_signal_handlers; 00773 } 00774 00775 /** Check if daemonization has been requested. 00776 * @return true if daemonization has been requested, false otherwise 00777 */ 00778 bool 00779 InitOptions::daemonize() const 00780 { 00781 return __daemonize; 00782 } 00783 00784 /** Check if killing of daemon has been requested. 00785 * @return true if killing of daemon has been requested, false otherwise 00786 */ 00787 bool 00788 InitOptions::daemonize_kill() const 00789 { 00790 return __daemonize_kill; 00791 } 00792 00793 /** Check if status of daemon has been requested. 00794 * @return true if status of daemon has been requested, false otherwise 00795 */ 00796 bool 00797 InitOptions::daemonize_status() const 00798 { 00799 return __daemonize_status; 00800 } 00801 00802 00803 /** Get daemon PID file. 00804 * @return daemon PID file path 00805 */ 00806 const char * 00807 InitOptions::daemon_pid_file() const 00808 { 00809 return __daemon_pid_file; 00810 } 00811 00812 00813 /** Check if user name has been passed. 00814 * @return true if the parameter has been set, false otherwise 00815 */ 00816 bool 00817 InitOptions::has_username() const 00818 { 00819 return __has_username; 00820 } 00821 00822 00823 /** Get user name to run as. 00824 * @return user name to run as 00825 */ 00826 const char * 00827 InitOptions::username() const 00828 { 00829 return __username; 00830 } 00831 00832 /** Check if group name has been passed. 00833 * @return true if the parameter has been set, false otherwise 00834 */ 00835 bool 00836 InitOptions::has_groupname() const 00837 { 00838 return __has_groupname; 00839 } 00840 00841 /** Get group name to run as. 00842 * @return group name to run as 00843 */ 00844 const char * 00845 InitOptions::groupname() const 00846 { 00847 return __groupname; 00848 } 00849 00850 00851 /** Get default config. 00852 * @return default config 00853 */ 00854 const char * 00855 InitOptions::default_config() const 00856 { 00857 return __default_config; 00858 } 00859 00860 00861 /** Get host config. 00862 * @return host config 00863 */ 00864 const char * 00865 InitOptions::host_config() const 00866 { 00867 return __host_config; 00868 } 00869 00870 00871 /** Get plugin module flags. 00872 * @return plugin module flags 00873 */ 00874 Module::ModuleFlags 00875 InitOptions::plugin_module_flags() const 00876 { 00877 return __plugin_module_flags; 00878 } 00879 00880 00881 } // end namespace runtime 00882 } // end namespace fawkes