AST_OPT_FLAG_GENERIC_PLC = (1 << 30),
/*! Generic PLC onm equal codecs */
AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS = (1 << 31),
+ /*!
+ * ast_options is now an ast_flags64 structure so if you add more
+ * options, make sure to use (1ULL << <bits>) to ensure that the
+ * enum itself is allocated as a uint64_t instead of the default
+ * uint32_t. Attmpting to simply shift a 1 by more than 31 bits
+ * will result in a "shift-count-overflow" compile failure.
+ * Example:
+ * AST_OPT_FLAG_NEW_OPTION = (1ULL << 32),
+ */
};
/*! These are the options that set by default when Asterisk starts */
#define AST_DEFAULT_OPTIONS (AST_OPT_FLAG_TRANSCODE_VIA_SLIN | AST_OPT_FLAG_CACHE_MEDIA_FRAMES)
-#define ast_opt_exec_includes ast_test_flag(&ast_options, AST_OPT_FLAG_EXEC_INCLUDES)
-#define ast_opt_no_fork ast_test_flag(&ast_options, AST_OPT_FLAG_NO_FORK)
-#define ast_opt_quiet ast_test_flag(&ast_options, AST_OPT_FLAG_QUIET)
-#define ast_opt_console ast_test_flag(&ast_options, AST_OPT_FLAG_CONSOLE)
-#define ast_opt_high_priority ast_test_flag(&ast_options, AST_OPT_FLAG_HIGH_PRIORITY)
-#define ast_opt_init_keys ast_test_flag(&ast_options, AST_OPT_FLAG_INIT_KEYS)
-#define ast_opt_remote ast_test_flag(&ast_options, AST_OPT_FLAG_REMOTE)
-#define ast_opt_exec ast_test_flag(&ast_options, AST_OPT_FLAG_EXEC)
-#define ast_opt_no_color ast_test_flag(&ast_options, AST_OPT_FLAG_NO_COLOR)
-#define ast_fully_booted ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)
-#define ast_opt_transcode_via_slin ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSCODE_VIA_SLIN)
-#define ast_opt_dump_core ast_test_flag(&ast_options, AST_OPT_FLAG_DUMP_CORE)
-#define ast_opt_cache_record_files ast_test_flag(&ast_options, AST_OPT_FLAG_CACHE_RECORD_FILES)
-#define ast_opt_cache_media_frames ast_test_flag(&ast_options, AST_OPT_FLAG_CACHE_MEDIA_FRAMES)
-#define ast_opt_timestamp ast_test_flag(&ast_options, AST_OPT_FLAG_TIMESTAMP)
-#define ast_opt_reconnect ast_test_flag(&ast_options, AST_OPT_FLAG_RECONNECT)
-#define ast_opt_transmit_silence ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSMIT_SILENCE)
-#define ast_opt_dont_warn ast_test_flag(&ast_options, AST_OPT_FLAG_DONT_WARN)
-#define ast_opt_always_fork ast_test_flag(&ast_options, AST_OPT_FLAG_ALWAYS_FORK)
-#define ast_opt_mute ast_test_flag(&ast_options, AST_OPT_FLAG_MUTE)
-#define ast_opt_dbg_module ast_test_flag(&ast_options, AST_OPT_FLAG_DEBUG_MODULE)
-#define ast_opt_trace_module ast_test_flag(&ast_options, AST_OPT_FLAG_TRACE_MODULE)
-#define ast_opt_light_background ast_test_flag(&ast_options, AST_OPT_FLAG_LIGHT_BACKGROUND)
-#define ast_opt_force_black_background ast_test_flag(&ast_options, AST_OPT_FLAG_FORCE_BLACK_BACKGROUND)
-#define ast_opt_hide_connect ast_test_flag(&ast_options, AST_OPT_FLAG_HIDE_CONSOLE_CONNECT)
-#define ast_opt_lock_confdir ast_test_flag(&ast_options, AST_OPT_FLAG_LOCK_CONFIG_DIR)
-#define ast_opt_generic_plc ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC)
-#define ast_opt_ref_debug ast_test_flag(&ast_options, AST_OPT_FLAG_REF_DEBUG)
-#define ast_opt_generic_plc_on_equal_codecs ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS)
-#define ast_opt_hide_messaging_ami_events ast_test_flag(&ast_options, AST_OPT_FLAG_HIDE_MESSAGING_AMI_EVENTS)
-#define ast_opt_sounds_search_custom ast_test_flag(&ast_options, AST_OPT_FLAG_SOUNDS_SEARCH_CUSTOM)
+#define ast_opt_exec_includes ast_test_flag64(&ast_options, AST_OPT_FLAG_EXEC_INCLUDES)
+#define ast_opt_no_fork ast_test_flag64(&ast_options, AST_OPT_FLAG_NO_FORK)
+#define ast_opt_quiet ast_test_flag64(&ast_options, AST_OPT_FLAG_QUIET)
+#define ast_opt_console ast_test_flag64(&ast_options, AST_OPT_FLAG_CONSOLE)
+#define ast_opt_high_priority ast_test_flag64(&ast_options, AST_OPT_FLAG_HIGH_PRIORITY)
+#define ast_opt_init_keys ast_test_flag64(&ast_options, AST_OPT_FLAG_INIT_KEYS)
+#define ast_opt_remote ast_test_flag64(&ast_options, AST_OPT_FLAG_REMOTE)
+#define ast_opt_exec ast_test_flag64(&ast_options, AST_OPT_FLAG_EXEC)
+#define ast_opt_no_color ast_test_flag64(&ast_options, AST_OPT_FLAG_NO_COLOR)
+#define ast_fully_booted ast_test_flag64(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)
+#define ast_opt_transcode_via_slin ast_test_flag64(&ast_options, AST_OPT_FLAG_TRANSCODE_VIA_SLIN)
+#define ast_opt_dump_core ast_test_flag64(&ast_options, AST_OPT_FLAG_DUMP_CORE)
+#define ast_opt_cache_record_files ast_test_flag64(&ast_options, AST_OPT_FLAG_CACHE_RECORD_FILES)
+#define ast_opt_cache_media_frames ast_test_flag64(&ast_options, AST_OPT_FLAG_CACHE_MEDIA_FRAMES)
+#define ast_opt_timestamp ast_test_flag64(&ast_options, AST_OPT_FLAG_TIMESTAMP)
+#define ast_opt_reconnect ast_test_flag64(&ast_options, AST_OPT_FLAG_RECONNECT)
+#define ast_opt_transmit_silence ast_test_flag64(&ast_options, AST_OPT_FLAG_TRANSMIT_SILENCE)
+#define ast_opt_dont_warn ast_test_flag64(&ast_options, AST_OPT_FLAG_DONT_WARN)
+#define ast_opt_always_fork ast_test_flag64(&ast_options, AST_OPT_FLAG_ALWAYS_FORK)
+#define ast_opt_mute ast_test_flag64(&ast_options, AST_OPT_FLAG_MUTE)
+#define ast_opt_dbg_module ast_test_flag64(&ast_options, AST_OPT_FLAG_DEBUG_MODULE)
+#define ast_opt_trace_module ast_test_flag64(&ast_options, AST_OPT_FLAG_TRACE_MODULE)
+#define ast_opt_light_background ast_test_flag64(&ast_options, AST_OPT_FLAG_LIGHT_BACKGROUND)
+#define ast_opt_force_black_background ast_test_flag64(&ast_options, AST_OPT_FLAG_FORCE_BLACK_BACKGROUND)
+#define ast_opt_hide_connect ast_test_flag64(&ast_options, AST_OPT_FLAG_HIDE_CONSOLE_CONNECT)
+#define ast_opt_lock_confdir ast_test_flag64(&ast_options, AST_OPT_FLAG_LOCK_CONFIG_DIR)
+#define ast_opt_generic_plc ast_test_flag64(&ast_options, AST_OPT_FLAG_GENERIC_PLC)
+#define ast_opt_ref_debug ast_test_flag64(&ast_options, AST_OPT_FLAG_REF_DEBUG)
+#define ast_opt_generic_plc_on_equal_codecs ast_test_flag64(&ast_options, AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS)
+#define ast_opt_hide_messaging_ami_events ast_test_flag64(&ast_options, AST_OPT_FLAG_HIDE_MESSAGING_AMI_EVENTS)
+#define ast_opt_sounds_search_custom ast_test_flag64(&ast_options, AST_OPT_FLAG_SOUNDS_SEARCH_CUSTOM)
/*! Maximum log level defined by PJPROJECT. */
#define MAX_PJ_LOG_MAX_LEVEL 6
/*! Current pjproject logging level */
extern int ast_option_pjproject_log_level;
-extern struct ast_flags ast_options;
+extern struct ast_flags64 ast_options;
extern int option_verbose;
extern int ast_option_maxfiles; /*!< Max number of open file handles (files, sockets) */
} while (0)
-/* The following 64-bit flag code can most likely be erased after app_dial
- is reorganized to either reduce the large number of options, or handle
- them in some other way. At the time of this writing, app_dial would be
- the only user of 64-bit option flags */
+/*!
+ * \brief Swap the upper and lower 32 bits of a big-endian 64-bit integer
+ *
+ * This macro is needed to preserve ABI compatability on big-endian systems
+ * after changing from a 32 bit flags to a 64 bit flags. It ensures that a
+ * new 64-bit flag field will still work with a function that expects a
+ * 32-bit flag field. On a little-endian system, nothing is needed, since
+ * the 64-bit flags are already in the correct order.
+ *
+ * \note This macro is different than a standard byte swap, as it
+ * doesn't reverse the byte order, it just swaps the upper 4 bytes with
+ * the lower 4 bytes.
+ *
+ * \param flags The 64-bit flags to swap
+ * \retval The flags with the upper and lower 32 bits swapped if the system is big-endian,
+ */
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define SWAP64_32(flags) (((uint64_t)flags << 32) | ((uint64_t)flags >> 32))
+#else
+#define SWAP64_32(flags) (flags)
+#endif
extern uint64_t __unsigned_int_flags_dummy64;
typeof ((p)->flags) __p = (p)->flags; \
typeof (__unsigned_int_flags_dummy64) __x = 0; \
(void) (&__p == &__x); \
- ((p)->flags & (flag)); \
+ ((p)->flags & SWAP64_32(flag)); \
})
#define ast_set_flag64(p,flag) do { \
typeof ((p)->flags) __p = (p)->flags; \
typeof (__unsigned_int_flags_dummy64) __x = 0; \
(void) (&__p == &__x); \
- ((p)->flags |= (flag)); \
+ ((p)->flags |= SWAP64_32(flag)); \
} while(0)
#define ast_clear_flag64(p,flag) do { \
typeof ((p)->flags) __p = (p)->flags; \
typeof (__unsigned_int_flags_dummy64) __x = 0; \
(void) (&__p == &__x); \
- ((p)->flags &= ~(flag)); \
+ ((p)->flags &= ~SWAP64_32(flag)); \
} while(0)
#define ast_copy_flags64(dest,src,flagz) do { \
typeof (__unsigned_int_flags_dummy64) __x = 0; \
(void) (&__d == &__x); \
(void) (&__s == &__x); \
- (dest)->flags &= ~(flagz); \
- (dest)->flags |= ((src)->flags & (flagz)); \
+ (dest)->flags &= ~SWAP64_32(flagz); \
+ (dest)->flags |= ((src)->flags & SWAP64_32(flagz)); \
} while (0)
#define ast_set2_flag64(p,value,flag) do { \
typeof (__unsigned_int_flags_dummy64) __x = 0; \
(void) (&__p == &__x); \
if (value) \
- (p)->flags |= (flag); \
+ (p)->flags |= SWAP64_32(flag); \
else \
- (p)->flags &= ~(flag); \
+ (p)->flags &= ~SWAP64_32(flag); \
} while (0)
#define ast_set_flags_to64(p,flag,value) do { \
typeof ((p)->flags) __p = (p)->flags; \
typeof (__unsigned_int_flags_dummy64) __x = 0; \
(void) (&__p == &__x); \
- (p)->flags &= ~(flag); \
- (p)->flags |= (value); \
+ (p)->flags &= ~SWAP64_32(flag); \
+ (p)->flags |= SWAP64_32(value); \
} while (0)
+#define AST_FLAGS64_ALL ULONG_MAX
/* Non-type checking variations for non-unsigned int flags. You
should only use non-unsigned int flags where required by
ast_cli(a->fd, " Running directory: %s\n", dir);
}
#endif /* defined(HAVE_EACCESS) || defined(HAVE_EUIDACCESS) */
- ast_cli(a->fd, " Executable includes: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_EXEC_INCLUDES) ? "Enabled" : "Disabled");
- ast_cli(a->fd, " Transcode via SLIN: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSCODE_VIA_SLIN) ? "Enabled" : "Disabled");
- ast_cli(a->fd, " Transmit silence during rec: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSMIT_SILENCE) ? "Enabled" : "Disabled");
- ast_cli(a->fd, " Generic PLC: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC) ? "Enabled" : "Disabled");
- ast_cli(a->fd, " Generic PLC on equal codecs: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS) ? "Enabled" : "Disabled");
+ ast_cli(a->fd, " Executable includes: %s\n", ast_opt_exec_includes ? "Enabled" : "Disabled");
+ ast_cli(a->fd, " Transcode via SLIN: %s\n", ast_opt_transcode_via_slin ? "Enabled" : "Disabled");
+ ast_cli(a->fd, " Transmit silence during rec: %s\n", ast_opt_transmit_silence ? "Enabled" : "Disabled");
+ ast_cli(a->fd, " Generic PLC: %s\n", ast_opt_generic_plc ? "Enabled" : "Disabled");
+ ast_cli(a->fd, " Generic PLC on equal codecs: %s\n", ast_opt_generic_plc_on_equal_codecs ? "Enabled" : "Disabled");
ast_cli(a->fd, " Hide Msg Chan AMI events: %s\n", ast_opt_hide_messaging_ami_events ? "Enabled" : "Disabled");
ast_cli(a->fd, " Sounds search custom dir: %s\n", ast_opt_sounds_search_custom ? "Enabled" : "Disabled");
ast_cli(a->fd, " Min DTMF duration:: %u\n", option_dtmfminduration);
/* if the progname is rasterisk consider it a remote console */
if (argv[0] && (strstr(argv[0], "rasterisk")) != NULL) {
- ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_REMOTE);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_REMOTE);
}
ast_mainpid = getpid();
while ((c = getopt(argc, argv, getopt_settings)) != -1) {
switch (c) {
case 'X':
- ast_set_flag(&ast_options, AST_OPT_FLAG_EXEC_INCLUDES);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_EXEC_INCLUDES);
break;
case 'C':
set_asterisk_conf_path(optarg);
case 'x':
/* ast_opt_remote is checked during config load. This is only part of what
* these options do, see the second loop for the rest of the actions. */
- ast_set_flag(&ast_options, AST_OPT_FLAG_REMOTE);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_REMOTE);
break;
case 'V':
show_version();
* option flags for new features. */
switch (c) {
case 'B': /* Force black background */
- ast_set_flag(&ast_options, AST_OPT_FLAG_FORCE_BLACK_BACKGROUND);
- ast_clear_flag(&ast_options, AST_OPT_FLAG_LIGHT_BACKGROUND);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_FORCE_BLACK_BACKGROUND);
+ ast_clear_flag64(&ast_options, AST_OPT_FLAG_LIGHT_BACKGROUND);
break;
case 'X':
/* The command-line -X option enables #exec for asterisk.conf only. */
/* already processed. */
break;
case 'c':
- ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_CONSOLE);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_CONSOLE);
break;
case 'd':
/* already processed. */
#endif
#if HAVE_WORKING_FORK
case 'F':
- ast_set_flag(&ast_options, AST_OPT_FLAG_ALWAYS_FORK);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_ALWAYS_FORK);
break;
case 'f':
- ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_NO_FORK);
break;
#endif
case 'G':
rungroup = ast_strdup(optarg);
break;
case 'g':
- ast_set_flag(&ast_options, AST_OPT_FLAG_DUMP_CORE);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_DUMP_CORE);
break;
case 'h':
/* already processed. */
" It will always be enabled if you have a timing module loaded.\n");
break;
case 'i':
- ast_set_flag(&ast_options, AST_OPT_FLAG_INIT_KEYS);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_INIT_KEYS);
break;
case 'L':
if ((sscanf(optarg, "%30lf", &ast_option_maxload) != 1) || (ast_option_maxload < 0.0)) {
}
break;
case 'm':
- ast_set_flag(&ast_options, AST_OPT_FLAG_MUTE);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_MUTE);
break;
case 'n':
- ast_set_flag(&ast_options, AST_OPT_FLAG_NO_COLOR);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_NO_COLOR);
break;
case 'p':
- ast_set_flag(&ast_options, AST_OPT_FLAG_HIGH_PRIORITY);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_HIGH_PRIORITY);
break;
case 'q':
- ast_set_flag(&ast_options, AST_OPT_FLAG_QUIET);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_QUIET);
break;
case 'R':
- ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_REMOTE | AST_OPT_FLAG_RECONNECT);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_REMOTE | AST_OPT_FLAG_RECONNECT);
break;
case 'r':
- ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_REMOTE);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_REMOTE);
break;
case 's':
if (ast_opt_remote) {
}
break;
case 'T':
- ast_set_flag(&ast_options, AST_OPT_FLAG_TIMESTAMP);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_TIMESTAMP);
break;
case 't':
- ast_set_flag(&ast_options, AST_OPT_FLAG_CACHE_RECORD_FILES);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_CACHE_RECORD_FILES);
break;
case 'U':
runuser = ast_strdup(optarg);
/* already processed. */
break;
case 'W': /* White background */
- ast_set_flag(&ast_options, AST_OPT_FLAG_LIGHT_BACKGROUND);
- ast_clear_flag(&ast_options, AST_OPT_FLAG_FORCE_BLACK_BACKGROUND);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_LIGHT_BACKGROUND);
+ ast_clear_flag64(&ast_options, AST_OPT_FLAG_FORCE_BLACK_BACKGROUND);
break;
case 'x':
/* -r is implied by -x so set the flags -r sets as well. */
- ast_set_flag(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_REMOTE);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_REMOTE);
- ast_set_flag(&ast_options, AST_OPT_FLAG_EXEC | AST_OPT_FLAG_NO_COLOR);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_EXEC | AST_OPT_FLAG_NO_COLOR);
xarg = ast_strdup(optarg);
break;
case '?':
if (ast_opt_always_fork && (ast_opt_remote || ast_opt_console)) {
fprintf(stderr, "'alwaysfork' is not compatible with console or remote console mode; ignored\n");
- ast_clear_flag(&ast_options, AST_OPT_FLAG_ALWAYS_FORK);
+ ast_clear_flag64(&ast_options, AST_OPT_FLAG_ALWAYS_FORK);
}
if (ast_opt_dump_core) {
}
}
- if (runuser && !ast_test_flag(&ast_options, AST_OPT_FLAG_REMOTE)) {
+ if (runuser && !ast_opt_remote) {
#ifdef HAVE_CAP
int has_cap = 1;
#endif /* HAVE_CAP */
/* Check whether high prio was successfully set by us or some
* other incantation. */
if (has_priority()) {
- ast_set_flag(&ast_options, AST_OPT_FLAG_HIGH_PRIORITY);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_HIGH_PRIORITY);
} else {
- ast_clear_flag(&ast_options, AST_OPT_FLAG_HIGH_PRIORITY);
+ ast_clear_flag64(&ast_options, AST_OPT_FLAG_HIGH_PRIORITY);
}
/* Spawning of astcanary must happen AFTER the call to daemon(3) */
ast_process_pending_reloads();
- ast_set_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_FULLY_BOOTED);
publish_fully_booted();
pthread_sigmask(SIG_UNBLOCK, &sigs, NULL);
}
AST_RWLIST_REMOVE(modules, ml, entry);
if (AST_RWLIST_EMPTY(modules)) {
- ast_clear_flag(&ast_options, module_option);
+ ast_clear_flag64(&ast_options, module_option);
}
AST_RWLIST_UNLOCK(modules);
ast_cli(a->fd, "Core %s was %u and has been set to 0 for '%s'.\n", handler_name,
strcpy(ml->module, mod);
AST_RWLIST_INSERT_TAIL(modules, ml, entry);
}
- ast_set_flag(&ast_options, module_option);
+ ast_set_flag64(&ast_options, module_option);
ast_cli(a->fd, "Core %s was %d and has been set to %u for '%s'.\n", handler_name,
oldval, ml->level, ml->module);
while ((ml = AST_RWLIST_REMOVE_HEAD(modules, entry))) {
ast_free(ml);
}
- ast_clear_flag(&ast_options, AST_OPT_FLAG_DEBUG_MODULE);
+ ast_clear_flag64(&ast_options, AST_OPT_FLAG_DEBUG_MODULE);
AST_RWLIST_UNLOCK(modules);
}
oldval = *core_option;
return NULL;
}
- while (!ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)) {
+ while (!ast_fully_booted) {
usleep(100);
}
}
/* Tab completion can't be used during startup, or CLI and loader will deadlock. */
- if (!ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)) {
+ if (!ast_fully_booted) {
return NULL;
}
astman_send_ack(s, m, "Authentication accepted");
if ((s->session->send_events & EVENT_FLAG_SYSTEM)
&& (s->session->readperm & EVENT_FLAG_SYSTEM)
- && ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)) {
+ && ast_fully_booted) {
struct ast_str *auth = ast_str_alloca(MAX_AUTH_PERM_STRING);
const char *cat_str = authority_to_str(EVENT_FLAG_SYSTEM, &auth);
long uptime = 0;
*/
/*! @{ */
-struct ast_flags ast_options = { AST_DEFAULT_OPTIONS };
+struct ast_flags64 ast_options = { AST_DEFAULT_OPTIONS };
/*! Maximum active system verbosity level. */
int ast_verb_sys_level;
#ifdef REF_DEBUG
/* The REF_DEBUG compiler flag is now only used to enable refdebug by default.
* Support for debugging reference counts is always compiled in. */
- ast_set2_flag(&ast_options, 1, AST_OPT_FLAG_REF_DEBUG);
+ ast_set2_flag64(&ast_options, 1, AST_OPT_FLAG_REF_DEBUG);
#endif
ast_set_default_eid(&ast_eid_default);
/* If AST_OPT_FLAG_EXEC_INCLUDES was previously enabled with -X turn it off now.
* Using #exec from other configs requires that it be enabled from asterisk.conf. */
- ast_clear_flag(&ast_options, AST_OPT_FLAG_EXEC_INCLUDES);
+ ast_clear_flag64(&ast_options, AST_OPT_FLAG_EXEC_INCLUDES);
/* no asterisk.conf? no problem, use buildtime config! */
if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID) {
option_verbose_new = atoi(v->value);
/* whether or not to force timestamping in CLI verbose output. (-T at startup) */
} else if (!strcasecmp(v->name, "timestamp")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_TIMESTAMP);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_TIMESTAMP);
/* whether or not to support #exec in config files */
} else if (!strcasecmp(v->name, "execincludes")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_EXEC_INCLUDES);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_EXEC_INCLUDES);
/* debug level (-d at startup) */
} else if (!strcasecmp(v->name, "debug")) {
option_debug_new = 0;
option_trace_new = ast_true(v->value) ? 1 : 0;
}
} else if (!strcasecmp(v->name, "refdebug")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_REF_DEBUG);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_REF_DEBUG);
#if HAVE_WORKING_FORK
/* Disable forking (-f at startup) */
} else if (!strcasecmp(v->name, "nofork")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_NO_FORK);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_NO_FORK);
/* Always fork, even if verbose or debug are enabled (-F at startup) */
} else if (!strcasecmp(v->name, "alwaysfork")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_ALWAYS_FORK);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_ALWAYS_FORK);
#endif
/* Run quietly (-q at startup ) */
} else if (!strcasecmp(v->name, "quiet")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_QUIET);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_QUIET);
/* Run as console (-c at startup, implies nofork) */
} else if (!strcasecmp(v->name, "console")) {
if (!ast_opt_remote) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_CONSOLE);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_NO_FORK | AST_OPT_FLAG_CONSOLE);
}
/* Run with high priority if the O/S permits (-p at startup) */
} else if (!strcasecmp(v->name, "highpriority")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_HIGH_PRIORITY);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_HIGH_PRIORITY);
/* Initialize RSA auth keys (IAX2) (-i at startup) */
} else if (!strcasecmp(v->name, "initcrypto")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_INIT_KEYS);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_INIT_KEYS);
/* Disable ANSI colors for console (-c at startup) */
} else if (!strcasecmp(v->name, "nocolor")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_NO_COLOR);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_NO_COLOR);
/* Disable some usage warnings for picky people :p */
} else if (!strcasecmp(v->name, "dontwarn")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_DONT_WARN);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_DONT_WARN);
/* Dump core in case of crash (-g) */
} else if (!strcasecmp(v->name, "dumpcore")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_DUMP_CORE);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_DUMP_CORE);
/* Cache recorded sound files to another directory during recording */
} else if (!strcasecmp(v->name, "cache_record_files")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_CACHE_RECORD_FILES);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_CACHE_RECORD_FILES);
#if !defined(LOW_MEMORY)
/* Cache media frames for performance */
} else if (!strcasecmp(v->name, "cache_media_frames")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_CACHE_MEDIA_FRAMES);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_CACHE_MEDIA_FRAMES);
#endif
/* Specify cache directory */
} else if (!strcasecmp(v->name, "record_cache_dir")) {
ast_copy_string(record_cache_dir, v->value, AST_CACHE_DIR_LEN);
/* Build transcode paths via SLINEAR, instead of directly */
} else if (!strcasecmp(v->name, "transcode_via_sln")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_TRANSCODE_VIA_SLIN);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_TRANSCODE_VIA_SLIN);
/* Transmit SLINEAR silence while a channel is being recorded or DTMF is being generated on a channel */
} else if (!strcasecmp(v->name, "transmit_silence_during_record") || !strcasecmp(v->name, "transmit_silence")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_TRANSMIT_SILENCE);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_TRANSMIT_SILENCE);
} else if (!strcasecmp(v->name, "mindtmfduration")) {
if (sscanf(v->value, "%30u", &option_dtmfminduration) != 1) {
option_dtmfminduration = AST_MIN_DTMF_DURATION;
ast_log(LOG_WARNING, "Invalid Entity ID '%s' provided\n", v->value);
}
} else if (!strcasecmp(v->name, "lightbackground")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_LIGHT_BACKGROUND);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_LIGHT_BACKGROUND);
} else if (!strcasecmp(v->name, "forceblackbackground")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_FORCE_BLACK_BACKGROUND);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_FORCE_BLACK_BACKGROUND);
} else if (!strcasecmp(v->name, "hideconnect")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_HIDE_CONSOLE_CONNECT);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_HIDE_CONSOLE_CONNECT);
} else if (!strcasecmp(v->name, "lockconfdir")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_LOCK_CONFIG_DIR);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_LOCK_CONFIG_DIR);
} else if (!strcasecmp(v->name, "stdexten")) {
/* Choose how to invoke the extensions.conf stdexten */
if (!strcasecmp(v->value, "gosub")) {
- ast_clear_flag(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO);
+ ast_clear_flag64(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO);
} else if (!strcasecmp(v->value, "macro")) {
- ast_set_flag(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO);
+ ast_set_flag64(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO);
} else {
ast_log(LOG_WARNING,
"'%s' is not a valid setting for the stdexten option, defaulting to 'gosub'\n",
v->value);
- ast_clear_flag(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO);
+ ast_clear_flag64(&ast_options, AST_OPT_FLAG_STDEXTEN_MACRO);
}
} else if (!strcasecmp(v->name, "live_dangerously")) {
live_dangerously = ast_true(v->value);
} else if (!strcasecmp(v->name, "hide_messaging_ami_events")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_HIDE_MESSAGING_AMI_EVENTS);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_HIDE_MESSAGING_AMI_EVENTS);
} else if (!strcasecmp(v->name, "sounds_search_custom_dir")) {
- ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_SOUNDS_SEARCH_CUSTOM);
+ ast_set2_flag64(&ast_options, ast_true(v->value), AST_OPT_FLAG_SOUNDS_SEARCH_CUSTOM);
} else if (!strcasecmp(v->name, "channel_storage_backend")) {
internal_channel_set_current_storage_driver(v->value);
} else if (!strcasecmp(v->name, "disable_remote_console_shell")) {
return AST_PBX_FAILED;
}
- if (!ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)) {
+ if (!ast_fully_booted) {
ast_log(LOG_WARNING, "PBX requires Asterisk to be fully booted\n");
return AST_PBX_FAILED;
}
{
enum ast_pbx_result res = AST_PBX_SUCCESS;
- if (!ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)) {
+ if (!ast_fully_booted) {
ast_log(LOG_WARNING, "PBX requires Asterisk to be fully booted\n");
return AST_PBX_FAILED;
}
for (var = ast_variable_browse(cfg, "plc"); var; var = var->next) {
if (!strcasecmp(var->name, "genericplc")) {
- ast_set2_flag(&ast_options, ast_true(var->value), AST_OPT_FLAG_GENERIC_PLC);
+ ast_set2_flag64(&ast_options, ast_true(var->value), AST_OPT_FLAG_GENERIC_PLC);
} else if (!strcasecmp(var->name, "genericplc_on_equal_codecs")) {
- ast_set2_flag(&ast_options, ast_true(var->value), AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS);
+ ast_set2_flag64(&ast_options, ast_true(var->value), AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS);
}
}
ast_config_destroy(cfg);
* Force on_equal_codecs to false if generic_plc is false.
*/
if (!ast_opt_generic_plc) {
- ast_set2_flag(&ast_options, 0, AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS);
+ ast_set2_flag64(&ast_options, 0, AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS);
}
return 0;
struct ast_taskprocessor *serializer = NULL;
pjsip_rx_data *clone;
- if (!ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)) {
+ if (!ast_fully_booted) {
/*
* Ignore everything until we are fully booted. Let the
* peer retransmit messages until we are ready.
if (!ast_sip_get_mwi_disable_initial_unsolicited()) {
create_mwi_subscriptions();
- if (ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)) {
+ if (ast_fully_booted) {
ast_sip_push_task(ast_serializer_pool_get(mwi_serializer_pool),
send_initial_notify_all, NULL);
} else {
pjsip_endpt_add_capability(ast_sip_get_pjsip_endpoint(), NULL, PJSIP_H_ALLOW, NULL, 1, &str_PUBLISH);
- if (ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)) {
+ if (ast_fully_booted) {
ast_sip_push_task(NULL, subscription_persistence_load, NULL);
} else {
struct stasis_subscription *sub;
struct ast_flags ast_options = { AST_DEFAULT_OPTIONS };
-#define ast_opt_exec_includes ast_test_flag(&ast_options, AST_OPT_FLAG_EXEC_INCLUDES)
-#define ast_opt_no_fork ast_test_flag(&ast_options, AST_OPT_FLAG_NO_FORK)
-#define ast_opt_quiet ast_test_flag(&ast_options, AST_OPT_FLAG_QUIET)
-#define ast_opt_console ast_test_flag(&ast_options, AST_OPT_FLAG_CONSOLE)
-#define ast_opt_high_priority ast_test_flag(&ast_options, AST_OPT_FLAG_HIGH_PRIORITY)
-#define ast_opt_init_keys ast_test_flag(&ast_options, AST_OPT_FLAG_INIT_KEYS)
-#define ast_opt_remote ast_test_flag(&ast_options, AST_OPT_FLAG_REMOTE)
-#define ast_opt_exec ast_test_flag(&ast_options, AST_OPT_FLAG_EXEC)
-#define ast_opt_no_color ast_test_flag(&ast_options, AST_OPT_FLAG_NO_COLOR)
-#define ast_fully_booted ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)
-#define ast_opt_transcode_via_slin ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSCODE_VIA_SLIN)
-#define ast_opt_priority_jumping ast_test_flag(&ast_options, AST_OPT_FLAG_PRIORITY_JUMPING)
-#define ast_opt_dump_core ast_test_flag(&ast_options, AST_OPT_FLAG_DUMP_CORE)
-#define ast_opt_cache_record_files ast_test_flag(&ast_options, AST_OPT_FLAG_CACHE_RECORD_FILES)
-#define ast_opt_timestamp ast_test_flag(&ast_options, AST_OPT_FLAG_TIMESTAMP)
-#define ast_opt_override_config ast_test_flag(&ast_options, AST_OPT_FLAG_OVERRIDE_CONFIG)
-#define ast_opt_reconnect ast_test_flag(&ast_options, AST_OPT_FLAG_RECONNECT)
-#define ast_opt_transmit_silence ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSMIT_SILENCE)
-#define ast_opt_dont_warn ast_test_flag(&ast_options, AST_OPT_FLAG_DONT_WARN)
-#define ast_opt_always_fork ast_test_flag(&ast_options, AST_OPT_FLAG_ALWAYS_FORK)
-#define ast_opt_mute ast_test_flag(&ast_options, AST_OPT_FLAG_MUTE)
+#define ast_opt_exec_includes ast_test_flag64(&ast_options, AST_OPT_FLAG_EXEC_INCLUDES)
+#define ast_opt_no_fork ast_test_flag64(&ast_options, AST_OPT_FLAG_NO_FORK)
+#define ast_opt_quiet ast_test_flag64(&ast_options, AST_OPT_FLAG_QUIET)
+#define ast_opt_console ast_test_flag64(&ast_options, AST_OPT_FLAG_CONSOLE)
+#define ast_opt_high_priority ast_test_flag64(&ast_options, AST_OPT_FLAG_HIGH_PRIORITY)
+#define ast_opt_init_keys ast_test_flag64(&ast_options, AST_OPT_FLAG_INIT_KEYS)
+#define ast_opt_remote ast_test_flag64(&ast_options, AST_OPT_FLAG_REMOTE)
+#define ast_opt_exec ast_test_flag64(&ast_options, AST_OPT_FLAG_EXEC)
+#define ast_opt_no_color ast_test_flag64(&ast_options, AST_OPT_FLAG_NO_COLOR)
+#define ast_fully_booted ast_test_flag64(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)
+#define ast_opt_transcode_via_slin ast_test_flag64(&ast_options, AST_OPT_FLAG_TRANSCODE_VIA_SLIN)
+#define ast_opt_priority_jumping ast_test_flag64(&ast_options, AST_OPT_FLAG_PRIORITY_JUMPING)
+#define ast_opt_dump_core ast_test_flag64(&ast_options, AST_OPT_FLAG_DUMP_CORE)
+#define ast_opt_cache_record_files ast_test_flag64(&ast_options, AST_OPT_FLAG_CACHE_RECORD_FILES)
+#define ast_opt_timestamp ast_test_flag64(&ast_options, AST_OPT_FLAG_TIMESTAMP)
+#define ast_opt_override_config ast_test_flag64(&ast_options, AST_OPT_FLAG_OVERRIDE_CONFIG)
+#define ast_opt_reconnect ast_test_flag64(&ast_options, AST_OPT_FLAG_RECONNECT)
+#define ast_opt_transmit_silence ast_test_flag64(&ast_options, AST_OPT_FLAG_TRANSMIT_SILENCE)
+#define ast_opt_dont_warn ast_test_flag64(&ast_options, AST_OPT_FLAG_DONT_WARN)
+#define ast_opt_always_fork ast_test_flag64(&ast_options, AST_OPT_FLAG_ALWAYS_FORK)
+#define ast_opt_mute ast_test_flag64(&ast_options, AST_OPT_FLAG_MUTE)
extern int option_verbose;
extern int option_debug; /*!< Debugging */