54295e8ad5317eb03c84e9b2182a21c853dd1db2
[asterisk/asterisk.git] / include / asterisk / options.h
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 1999 - 2005, Digium, Inc.
5  *
6  * Mark Spencer <markster@digium.com>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  */
18
19 /*! \file
20  * \brief Options provided by main asterisk program
21  */
22
23 #ifndef _ASTERISK_OPTIONS_H
24 #define _ASTERISK_OPTIONS_H
25
26 #if defined(__cplusplus) || defined(c_plusplus)
27 extern "C" {
28 #endif
29
30 #define AST_CACHE_DIR_LEN       512
31 #define AST_FILENAME_MAX        80
32 #define AST_CHANNEL_NAME    80  /*!< Max length of an ast_channel name */
33
34
35 /*! \ingroup main_options */
36 enum ast_option_flags {
37         /*! Allow \#exec in config files */
38         AST_OPT_FLAG_EXEC_INCLUDES = (1 << 0),
39         /*! Do not fork() */
40         AST_OPT_FLAG_NO_FORK = (1 << 1),
41         /*! Keep quiet */
42         AST_OPT_FLAG_QUIET = (1 << 2),
43         /*! Console mode */
44         AST_OPT_FLAG_CONSOLE = (1 << 3),
45         /*! Run in realtime Linux priority */
46         AST_OPT_FLAG_HIGH_PRIORITY = (1 << 4),
47         /*! Initialize keys for RSA authentication */
48         AST_OPT_FLAG_INIT_KEYS = (1 << 5),
49         /*! Remote console */
50         AST_OPT_FLAG_REMOTE = (1 << 6),
51         /*! Execute an asterisk CLI command upon startup */
52         AST_OPT_FLAG_EXEC = (1 << 7),
53         /*! Don't use termcap colors */
54         AST_OPT_FLAG_NO_COLOR = (1 << 8),
55         /*! Are we fully started yet? */
56         AST_OPT_FLAG_FULLY_BOOTED = (1 << 9),
57         /*! Trascode via signed linear */
58         AST_OPT_FLAG_TRANSCODE_VIA_SLIN = (1 << 10),
59         /*! Dump core on a seg fault */
60         AST_OPT_FLAG_DUMP_CORE = (1 << 12),
61         /*! Cache sound files */
62         AST_OPT_FLAG_CACHE_RECORD_FILES = (1 << 13),
63         /*! Display timestamp in CLI verbose output */
64         AST_OPT_FLAG_TIMESTAMP = (1 << 14),
65         /*! Override config */
66         AST_OPT_FLAG_OVERRIDE_CONFIG = (1 << 15),
67         /*! Reconnect */
68         AST_OPT_FLAG_RECONNECT = (1 << 16),
69         /*! Transmit Silence during Record() and DTMF Generation */
70         AST_OPT_FLAG_TRANSMIT_SILENCE = (1 << 17),
71         /*! Suppress some warnings */
72         AST_OPT_FLAG_DONT_WARN = (1 << 18),
73         /*! End CDRs before the 'h' extension */
74         AST_OPT_FLAG_END_CDR_BEFORE_H_EXTEN = (1 << 19),
75         /*! Use DAHDI Timing for generators if available */
76         AST_OPT_FLAG_INTERNAL_TIMING = (1 << 20),
77         /*! Always fork, even if verbose or debug settings are non-zero */
78         AST_OPT_FLAG_ALWAYS_FORK = (1 << 21),
79         /*! Disable log/verbose output to remote consoles */
80         AST_OPT_FLAG_MUTE = (1 << 22),
81         /*! There is a per-file debug setting */
82         AST_OPT_FLAG_DEBUG_FILE = (1 << 23),
83         /*! There is a per-file verbose setting */
84         AST_OPT_FLAG_VERBOSE_FILE = (1 << 24),
85         /*! Terminal colors should be adjusted for a light-colored background */
86         AST_OPT_FLAG_LIGHT_BACKGROUND = (1 << 25),
87         /*! Count Initiated seconds in CDR's */
88         AST_OPT_FLAG_INITIATED_SECONDS = (1 << 26),
89         /*! Force black background */
90         AST_OPT_FLAG_FORCE_BLACK_BACKGROUND = (1 << 27),
91 };
92
93 /*! These are the options that set by default when Asterisk starts */
94 #define AST_DEFAULT_OPTIONS AST_OPT_FLAG_TRANSCODE_VIA_SLIN
95
96 #define ast_opt_exec_includes           ast_test_flag(&ast_options, AST_OPT_FLAG_EXEC_INCLUDES)
97 #define ast_opt_no_fork                 ast_test_flag(&ast_options, AST_OPT_FLAG_NO_FORK)
98 #define ast_opt_quiet                   ast_test_flag(&ast_options, AST_OPT_FLAG_QUIET)
99 #define ast_opt_console                 ast_test_flag(&ast_options, AST_OPT_FLAG_CONSOLE)
100 #define ast_opt_high_priority           ast_test_flag(&ast_options, AST_OPT_FLAG_HIGH_PRIORITY)
101 #define ast_opt_init_keys               ast_test_flag(&ast_options, AST_OPT_FLAG_INIT_KEYS)
102 #define ast_opt_remote                  ast_test_flag(&ast_options, AST_OPT_FLAG_REMOTE)
103 #define ast_opt_exec                    ast_test_flag(&ast_options, AST_OPT_FLAG_EXEC)
104 #define ast_opt_no_color                ast_test_flag(&ast_options, AST_OPT_FLAG_NO_COLOR)
105 #define ast_fully_booted                ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)
106 #define ast_opt_transcode_via_slin      ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSCODE_VIA_SLIN)
107 #define ast_opt_dump_core               ast_test_flag(&ast_options, AST_OPT_FLAG_DUMP_CORE)
108 #define ast_opt_cache_record_files      ast_test_flag(&ast_options, AST_OPT_FLAG_CACHE_RECORD_FILES)
109 #define ast_opt_timestamp               ast_test_flag(&ast_options, AST_OPT_FLAG_TIMESTAMP)
110 #define ast_opt_override_config         ast_test_flag(&ast_options, AST_OPT_FLAG_OVERRIDE_CONFIG)
111 #define ast_opt_reconnect               ast_test_flag(&ast_options, AST_OPT_FLAG_RECONNECT)
112 #define ast_opt_transmit_silence        ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSMIT_SILENCE)
113 #define ast_opt_dont_warn               ast_test_flag(&ast_options, AST_OPT_FLAG_DONT_WARN)
114 #define ast_opt_end_cdr_before_h_exten  ast_test_flag(&ast_options, AST_OPT_FLAG_END_CDR_BEFORE_H_EXTEN)
115 #define ast_opt_internal_timing         ast_test_flag(&ast_options, AST_OPT_FLAG_INTERNAL_TIMING)
116 #define ast_opt_always_fork             ast_test_flag(&ast_options, AST_OPT_FLAG_ALWAYS_FORK)
117 #define ast_opt_mute                    ast_test_flag(&ast_options, AST_OPT_FLAG_MUTE)
118 #define ast_opt_dbg_file                ast_test_flag(&ast_options, AST_OPT_FLAG_DEBUG_FILE)
119 #define ast_opt_verb_file               ast_test_flag(&ast_options, AST_OPT_FLAG_VERBOSE_FILE)
120 #define ast_opt_light_background                ast_test_flag(&ast_options, AST_OPT_FLAG_LIGHT_BACKGROUND)
121 #define ast_opt_force_black_background          ast_test_flag(&ast_options, AST_OPT_FLAG_FORCE_BLACK_BACKGROUND)
122
123 extern struct ast_flags ast_options;
124
125 enum ast_compat_flags {
126         AST_COMPAT_DELIM_PBX_REALTIME = (1 << 0),
127         AST_COMPAT_DELIM_RES_AGI = (1 << 1),
128         AST_COMPAT_APP_SET = (1 << 2),
129 };
130
131 #define ast_compat_pbx_realtime ast_test_flag(&ast_compat, AST_COMPAT_DELIM_PBX_REALTIME)
132 #define ast_compat_res_agi      ast_test_flag(&ast_compat, AST_COMPAT_DELIM_RES_AGI)
133 #define ast_compat_app_set      ast_test_flag(&ast_compat, AST_COMPAT_APP_SET)
134
135 extern struct ast_flags ast_compat;
136
137 extern int option_verbose;
138 extern int option_maxfiles;             /*!< Max number of open file handles (files, sockets) */
139 extern int option_debug;                /*!< Debugging */
140 extern int option_maxcalls;             /*!< Maximum number of simultaneous channels */
141 extern double option_maxload;
142 #if defined(HAVE_SYSINFO)
143 extern long option_minmemfree;          /*!< Minimum amount of free system memory - stop accepting calls if free memory falls below this watermark */
144 #endif
145 extern char defaultlanguage[];
146
147 extern struct timeval ast_startuptime;
148 extern struct timeval ast_lastreloadtime;
149 extern pid_t ast_mainpid;
150
151 extern char record_cache_dir[AST_CACHE_DIR_LEN];
152 extern char dahdi_chan_name[AST_CHANNEL_NAME];
153 extern int dahdi_chan_name_len;
154
155 extern int ast_language_is_prefix;
156
157 #if defined(__cplusplus) || defined(c_plusplus)
158 }
159 #endif
160
161 #endif /* _ASTERISK_OPTIONS_H */