Fawkes API  Fawkes Development Version
init_options.h
1 
2 /***************************************************************************
3  * init_options.h - Fawkes run-time initialization options
4  *
5  * Created: Tue Jun 07 14:06:56 2011
6  * Copyright 2006-2011 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __LIBS_BASEAPP_INIT_OPTIONS_H_
25 #define __LIBS_BASEAPP_INIT_OPTIONS_H_
26 
27 #include <logging/logger.h>
28 #include <utils/system/dynamic_module/module.h>
29 
30 namespace fawkes {
31  namespace runtime {
32 #if 0 /* just to make Emacs auto-indent happy */
33  }
34 }
35 #endif
36 
38 {
39  public:
40  InitOptions(const char *basename);
41  InitOptions(int argc, char **argv);
42  InitOptions(const InitOptions &options);
43  ~InitOptions();
44 
45  InitOptions & operator=(const InitOptions &options);
46 
47  InitOptions & net_tcp_port(unsigned short int port);
48  InitOptions & net_service_name(const char *service_name);
49  InitOptions & daemonize(bool daemonize,
50  bool kill = false, bool status = false,
51  const char *pid_file = 0);
52  InitOptions & loggers(const char *loggers);
53  InitOptions & log_level(Logger::LogLevel log_level);
54  InitOptions & show_help(bool show_help);
55  InitOptions & user(const char *username);
56  InitOptions & group(const char *groupname);
57  InitOptions & config_file(const char *config_file);
58  InitOptions & bb_cleanup(bool bb_cleanup);
59  InitOptions & init_plugin_cache(bool init_plugin_cache);
60  InitOptions & load_plugins(const char *plugin_list);
61  InitOptions & default_plugin(const char *default_plugin);
62  InitOptions & plugin_module_flags(Module::ModuleFlags flags);
63  InitOptions & default_signal_handlers(bool enable);
64 
65  const char *basename() const;
66 
67  bool has_net_tcp_port() const;
68  unsigned short int net_tcp_port() const;
69  bool has_net_service_name() const;
70  const char * net_service_name() const;
71 
72  bool has_load_plugin_list() const;
73  const char * load_plugin_list() const;
74  const char * default_plugin() const;
75 
76 
77  bool has_loggers() const;
78  const char * loggers() const;
79  Logger::LogLevel log_level() const;
80 
81  bool show_help() const;
82  bool bb_cleanup() const;
83  bool init_plugin_cache() const;
84 
85  bool daemonize() const;
86  bool daemonize_kill() const;
87  bool daemonize_status() const;
88  const char * daemon_pid_file() const;
89 
90 
91  bool has_username() const;
92  const char * username() const;
93  bool has_groupname() const;
94  const char * groupname() const;
95 
96  const char * config_file() const;
97 
98  Module::ModuleFlags plugin_module_flags() const;
99 
100  bool default_signal_handlers() const;
101 
102  private:
103  char *__basename;
104 
105  bool __has_net_tcp_port;
106  unsigned short int __net_tcp_port;
107 
108  bool __has_load_plugin_list;
109  char *__load_plugin_list;
110  char *__default_plugin;
111 
112  bool __has_loggers;
113  char *__loggers;
114  Logger::LogLevel __log_level;
115 
116  bool __has_net_service_name;
117  char *__net_service_name;
118 
119  bool __has_username;
120  char *__username;
121  bool __has_groupname;
122  char *__groupname;
123 
124  char *__config_file;
125 
126  bool __daemonize;
127  char *__daemon_pid_file;
128  bool __daemonize_kill;
129  bool __daemonize_status;
130 
131  bool __show_help;
132  bool __bb_cleanup;
133 
134  bool __init_plugin_cache;
135  Module::ModuleFlags __plugin_module_flags;
136  bool __default_signal_handlers;
137 
138 };
139 
140 
141 } // end namespace runtime
142 } // end namespace fawkes
143 
144 #endif
LogLevel
Log level.
Definition: logger.h:45
Fawkes library namespace.
ModuleFlags
Flags for the loading process.
Definition: module.h:44
Initialization options class.
Definition: init_options.h:37