Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * init_options.h - Fawkes run-time initialization options 00004 * 00005 * Created: Tue Jun 07 14:06: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 #ifndef __LIBS_BASEAPP_INIT_OPTIONS_H_ 00025 #define __LIBS_BASEAPP_INIT_OPTIONS_H_ 00026 00027 #include <logging/logger.h> 00028 #include <utils/system/dynamic_module/module.h> 00029 00030 namespace fawkes { 00031 namespace runtime { 00032 #if 0 /* just to make Emacs auto-indent happy */ 00033 } 00034 } 00035 #endif 00036 00037 class InitOptions 00038 { 00039 public: 00040 InitOptions(const char *basename); 00041 InitOptions(int argc, char **argv); 00042 InitOptions(const InitOptions &options); 00043 ~InitOptions(); 00044 00045 InitOptions & operator=(const InitOptions &options); 00046 00047 InitOptions & net_tcp_port(unsigned short int port); 00048 InitOptions & net_service_name(const char *service_name); 00049 InitOptions & daemonize(bool daemonize, 00050 bool kill = false, bool status = false, 00051 const char *pid_file = 0); 00052 InitOptions & loggers(const char *loggers); 00053 InitOptions & log_level(Logger::LogLevel log_level); 00054 InitOptions & show_help(bool show_help); 00055 InitOptions & user(const char *username); 00056 InitOptions & group(const char *groupname); 00057 InitOptions & default_config(const char *default_config); 00058 InitOptions & host_config(const char *host_config); 00059 InitOptions & bb_cleanup(bool bb_cleanup); 00060 InitOptions & init_plugin_cache(bool init_plugin_cache); 00061 InitOptions & load_plugins(const char *plugin_list); 00062 InitOptions & default_plugin(const char *default_plugin); 00063 InitOptions & plugin_module_flags(Module::ModuleFlags flags); 00064 InitOptions & default_signal_handlers(bool enable); 00065 00066 const char *basename() const; 00067 00068 bool has_net_tcp_port() const; 00069 unsigned short int net_tcp_port() const; 00070 bool has_net_service_name() const; 00071 const char * net_service_name() const; 00072 00073 bool has_load_plugin_list() const; 00074 const char * load_plugin_list() const; 00075 const char * default_plugin() const; 00076 00077 00078 bool has_loggers() const; 00079 const char * loggers() const; 00080 Logger::LogLevel log_level() const; 00081 00082 bool show_help() const; 00083 bool bb_cleanup() const; 00084 bool init_plugin_cache() const; 00085 00086 bool daemonize() const; 00087 bool daemonize_kill() const; 00088 bool daemonize_status() const; 00089 const char * daemon_pid_file() const; 00090 00091 00092 bool has_username() const; 00093 const char * username() const; 00094 bool has_groupname() const; 00095 const char * groupname() const; 00096 00097 const char * host_config() const; 00098 const char * default_config() const; 00099 00100 Module::ModuleFlags plugin_module_flags() const; 00101 00102 bool default_signal_handlers() const; 00103 00104 private: 00105 char *__basename; 00106 00107 bool __has_net_tcp_port; 00108 unsigned short int __net_tcp_port; 00109 00110 bool __has_load_plugin_list; 00111 char *__load_plugin_list; 00112 char *__default_plugin; 00113 00114 bool __has_loggers; 00115 char *__loggers; 00116 Logger::LogLevel __log_level; 00117 00118 bool __has_net_service_name; 00119 char *__net_service_name; 00120 00121 bool __has_username; 00122 char *__username; 00123 bool __has_groupname; 00124 char *__groupname; 00125 00126 char *__default_config; 00127 char *__host_config; 00128 00129 bool __daemonize; 00130 char *__daemon_pid_file; 00131 bool __daemonize_kill; 00132 bool __daemonize_status; 00133 00134 bool __show_help; 00135 bool __bb_cleanup; 00136 00137 bool __init_plugin_cache; 00138 Module::ModuleFlags __plugin_module_flags; 00139 bool __default_signal_handlers; 00140 00141 }; 00142 00143 00144 } // end namespace runtime 00145 } // end namespace fawkes 00146 00147 #endif