summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asterisk.h4
-rw-r--r--include/asterisk/_private.h20
-rw-r--r--include/asterisk/abstract_jb.h2
-rw-r--r--include/asterisk/acl.h18
-rw-r--r--include/asterisk/adsi.h1
-rw-r--r--include/asterisk/ael_structs.h14
-rw-r--r--include/asterisk/agi.h8
-rw-r--r--include/asterisk/ari.h10
-rw-r--r--include/asterisk/ast_expr.h4
-rw-r--r--include/asterisk/ast_version.h2
-rw-r--r--include/asterisk/astdb.h10
-rw-r--r--include/asterisk/astmm.h67
-rw-r--r--include/asterisk/astobj.h823
-rw-r--r--include/asterisk/astobj2.h110
-rw-r--r--include/asterisk/astosp.h31
-rw-r--r--include/asterisk/autochan.h2
-rw-r--r--include/asterisk/autoconfig.h.in22
-rw-r--r--include/asterisk/bridge_after.h2
-rw-r--r--include/asterisk/bridge_features.h2
-rw-r--r--include/asterisk/bridge_technology.h6
-rw-r--r--include/asterisk/calendar.h4
-rw-r--r--include/asterisk/callerid.h2
-rw-r--r--include/asterisk/ccss.h15
-rw-r--r--include/asterisk/cdr.h6
-rw-r--r--include/asterisk/cel.h4
-rw-r--r--include/asterisk/channel.h56
-rw-r--r--include/asterisk/chanvars.h8
-rw-r--r--include/asterisk/cli.h20
-rw-r--r--include/asterisk/compat.h10
-rw-r--r--include/asterisk/config.h17
-rw-r--r--include/asterisk/config_options.h18
-rw-r--r--include/asterisk/core_unreal.h2
-rw-r--r--include/asterisk/datastore.h10
-rw-r--r--include/asterisk/devicestate.h36
-rw-r--r--include/asterisk/doxygen/architecture.h1
-rw-r--r--include/asterisk/doxygen/licensing.h2
-rw-r--r--include/asterisk/doxyref.h98
-rw-r--r--include/asterisk/dsp.h50
-rw-r--r--include/asterisk/dundi.h12
-rw-r--r--include/asterisk/endian.h1
-rw-r--r--include/asterisk/enum.h3
-rw-r--r--include/asterisk/event_defs.h2
-rw-r--r--include/asterisk/features_config.h6
-rw-r--r--include/asterisk/file.h97
-rw-r--r--include/asterisk/format.h2
-rw-r--r--include/asterisk/framehook.h6
-rw-r--r--include/asterisk/fskmodem.h1
-rw-r--r--include/asterisk/fskmodem_int.h4
-rw-r--r--include/asterisk/hashtab.h67
-rw-r--r--include/asterisk/heap.h15
-rw-r--r--include/asterisk/http.h2
-rw-r--r--include/asterisk/image.h20
-rw-r--r--include/asterisk/indications.h4
-rw-r--r--include/asterisk/io.h36
-rw-r--r--include/asterisk/linkedlists.h2
-rw-r--r--include/asterisk/lock.h181
-rw-r--r--include/asterisk/logger.h11
-rw-r--r--include/asterisk/manager.h26
-rw-r--r--include/asterisk/message.h2
-rw-r--r--include/asterisk/mod_format.h16
-rw-r--r--include/asterisk/module.h150
-rw-r--r--include/asterisk/netsock.h74
-rw-r--r--include/asterisk/netsock2.h2
-rw-r--r--include/asterisk/options.h18
-rw-r--r--include/asterisk/parking.h4
-rw-r--r--include/asterisk/paths.h2
-rw-r--r--include/asterisk/pbx.h6
-rw-r--r--include/asterisk/pktccops.h2
-rw-r--r--include/asterisk/presencestate.h1
-rw-r--r--include/asterisk/pval.h20
-rw-r--r--include/asterisk/res_fax.h2
-rw-r--r--include/asterisk/res_mwi_external.h16
-rw-r--r--include/asterisk/res_odbc.h10
-rw-r--r--include/asterisk/res_pjproject.h30
-rw-r--r--include/asterisk/res_pjsip.h89
-rw-r--r--include/asterisk/res_pjsip_pubsub.h9
-rw-r--r--include/asterisk/res_pjsip_session.h31
-rw-r--r--include/asterisk/rtp_engine.h14
-rw-r--r--include/asterisk/sched.h10
-rw-r--r--include/asterisk/security_events_defs.h2
-rw-r--r--include/asterisk/select.h2
-rw-r--r--include/asterisk/smdi.h12
-rw-r--r--include/asterisk/sounds_index.h8
-rw-r--r--include/asterisk/speech.h2
-rw-r--r--include/asterisk/srv.h4
-rw-r--r--include/asterisk/stasis_app.h30
-rw-r--r--include/asterisk/statsd.h1
-rw-r--r--include/asterisk/stringfields.h58
-rw-r--r--include/asterisk/strings.h99
-rw-r--r--include/asterisk/tcptls.h6
-rw-r--r--include/asterisk/tdd.h10
-rw-r--r--include/asterisk/threadstorage.h6
-rw-r--r--include/asterisk/timing.h2
-rw-r--r--include/asterisk/translate.h14
-rw-r--r--include/asterisk/udptl.h21
-rw-r--r--include/asterisk/utils.h153
-rw-r--r--include/asterisk/vector.h32
-rw-r--r--include/asterisk/xml.h1
-rw-r--r--include/jitterbuf.h18
-rw-r--r--include/solaris-compat/sys/queue.h5
100 files changed, 1028 insertions, 1981 deletions
diff --git a/include/asterisk.h b/include/asterisk.h
index 9122e3a5e..27d66b776 100644
--- a/include/asterisk.h
+++ b/include/asterisk.h
@@ -21,7 +21,7 @@
#include "asterisk/autoconfig.h"
#include "asterisk/compat.h"
-#if !defined(NO_MALLOC_DEBUG) && !defined(STANDALONE) && !defined(STANDALONE2) && defined(MALLOC_DEBUG)
+#if !defined(NO_MALLOC_DEBUG) && !defined(STANDALONE) && !defined(STANDALONE2)
#include "asterisk/astmm.h"
#endif
@@ -223,7 +223,7 @@ struct ast_json;
#elif defined(AST_MODULE_SELF_SYM)
-/*! Retreive the 'struct ast_module *' for the current module. */
+/*! Retrieve the 'struct ast_module *' for the current module. */
#define AST_MODULE_SELF AST_MODULE_SELF_SYM()
struct ast_module;
diff --git a/include/asterisk/_private.h b/include/asterisk/_private.h
index e989b16fd..431f96108 100644
--- a/include/asterisk/_private.h
+++ b/include/asterisk/_private.h
@@ -33,32 +33,24 @@ int astdb_init(void); /*!< Provided by db.c */
int ast_channels_init(void); /*!< Provided by channel.c */
void ast_builtins_init(void); /*!< Provided by cli.c */
int ast_cli_perms_init(int reload); /*!< Provided by cli.c */
-int dnsmgr_init(void); /*!< Provided by dnsmgr.c */
void dnsmgr_start_refresh(void); /*!< Provided by dnsmgr.c */
-int dnsmgr_reload(void); /*!< Provided by dnsmgr.c */
int ast_dns_system_resolver_init(void); /*!< Provided by dns_system_resolver.c */
void threadstorage_init(void); /*!< Provided by threadstorage.c */
int ast_device_state_engine_init(void); /*!< Provided by devicestate.c */
int astobj2_init(void); /*!< Provided by astobj2.c */
int ast_named_locks_init(void); /*!< Provided by named_locks.c */
int ast_file_init(void); /*!< Provided by file.c */
-int ast_features_init(void); /*!< Provided by features.c */
void ast_autoservice_init(void); /*!< Provided by autoservice.c */
-int ast_http_init(void); /*!< Provided by http.c */
-int ast_http_reload(void); /*!< Provided by http.c */
int ast_tps_init(void); /*!< Provided by taskprocessor.c */
int ast_timing_init(void); /*!< Provided by timing.c */
-int ast_indications_init(void); /*!< Provided by indications.c */
-int ast_indications_reload(void);/*!< Provided by indications.c */
void ast_stun_init(void); /*!< Provided by stun.c */
-int ast_cel_engine_init(void); /*!< Provided by cel.c */
-int ast_cel_engine_reload(void); /*!< Provided by cel.c */
int ast_ssl_init(void); /*!< Provided by ssl.c */
int ast_pj_init(void); /*!< Provided by libasteriskpj.c */
int ast_test_init(void); /*!< Provided by test.c */
int ast_msg_init(void); /*!< Provided by message.c */
void ast_msg_shutdown(void); /*!< Provided by message.c */
int aco_init(void); /*!< Provided by config_options.c */
+int dns_core_init(void); /*!< Provided by dns_core.c */
/*!
* \brief Initialize the bridging system.
@@ -96,13 +88,6 @@ void ast_process_pending_reloads(void);
*/
int ast_xmldoc_load_documentation(void);
-/*!
- * \brief Reload genericplc configuration value from codecs.conf
- *
- * Implementation is in main/channel.c
- */
-int ast_plc_reload(void);
-
/*! \brief initializes the rtp engine arrays */
int ast_rtp_engine_init(void);
@@ -112,9 +97,6 @@ int ast_rtp_engine_init(void);
*/
int ast_parking_stasis_init(void);
-/*! \brief initialize the sounds index */
-int ast_sounds_index_init(void);
-
/*!
* \brief Endpoint support initialization.
* \return 0 on success.
diff --git a/include/asterisk/abstract_jb.h b/include/asterisk/abstract_jb.h
index 173b22a5c..b300d1295 100644
--- a/include/asterisk/abstract_jb.h
+++ b/include/asterisk/abstract_jb.h
@@ -23,7 +23,7 @@
/*! \file
*
* \brief Common implementation-independent jitterbuffer stuff.
- *
+ *
* \author Slav Klenov <slav@securax.org>
*/
diff --git a/include/asterisk/acl.h b/include/asterisk/acl.h
index bda1c7606..09adc527d 100644
--- a/include/asterisk/acl.h
+++ b/include/asterisk/acl.h
@@ -382,24 +382,6 @@ const char *ast_tos2str(unsigned int tos);
struct ast_ha *ast_named_acl_find(const char *name, int *is_realtime, int *is_undefined);
/*!
- * \brief Initialize and configure the named ACL system.
- *
- * \details
- * This function will prepare the named ACL system for use.
- * For this reason, it needs to be called before other things that use ACLs are initialized.
- */
-int ast_named_acl_init(void);
-
-/*!
- * \brief reload/reconfigure the named ACL system.
- *
- * \details
- * This function is designed to trigger an event upon a successful reload that may update
- * ACL consumers.
- */
-int ast_named_acl_reload(void);
-
-/*!
* \brief a \ref stasis_message_type for changes against a named ACL or the set of all named ACLs
* \since 12
*
diff --git a/include/asterisk/adsi.h b/include/asterisk/adsi.h
index 31db2acb9..9834b9122 100644
--- a/include/asterisk/adsi.h
+++ b/include/asterisk/adsi.h
@@ -377,4 +377,3 @@ struct adsi_funcs {
void ast_adsi_install_funcs(const struct adsi_funcs *funcs);
#endif /* _ASTERISK_ADSI_H */
-
diff --git a/include/asterisk/ael_structs.h b/include/asterisk/ael_structs.h
index 592439346..205249b79 100644
--- a/include/asterisk/ael_structs.h
+++ b/include/asterisk/ael_structs.h
@@ -63,7 +63,7 @@ pval *linku1(pval *head, pval *tail);
void ael2_print(char *fname, pval *tree);
struct pval *ael2_parse(char *fname, int *errs); /* in ael.flex */
void destroy_pval(pval *item);
-
+
extern char *prev_word; /* in ael.flex */
#ifndef YY_TYPEDEF_YY_SCANNER_T
@@ -80,7 +80,7 @@ struct parse_io
};
/* for CODE GENERATION */
-
+
typedef enum { AEL_APPCALL, AEL_CONTROL1, AEL_FOR_CONTROL, AEL_IF_CONTROL, AEL_IFTIME_CONTROL, AEL_RAND_CONTROL, AEL_LABEL, AEL_RETURN } ael_priority_type;
@@ -88,13 +88,13 @@ struct ael_priority
{
int priority_num;
ael_priority_type type;
-
+
char *app;
char *appargs;
-
+
struct pval *origin;
struct ael_extension *exten;
-
+
struct ael_priority *goto_true;
struct ael_priority *goto_false;
struct ael_priority *next;
@@ -109,9 +109,9 @@ struct ael_extension
int is_switch;
int has_switch; /* set if a switch exists in the extension */
int checked_switch; /* set if we checked for a switch in the extension -- so we don't have to do it again */
-
+
struct ast_context *context;
-
+
struct ael_priority *plist;
struct ael_priority *plist_last;
struct ael_extension *next_exten;
diff --git a/include/asterisk/agi.h b/include/asterisk/agi.h
index 329521aeb..568cd5d11 100644
--- a/include/asterisk/agi.h
+++ b/include/asterisk/agi.h
@@ -41,7 +41,7 @@ typedef struct agi_state {
typedef struct agi_command {
const char * const cmda[AST_MAX_CMD_LEN]; /*!< Null terminated list of the words of the command */
- /*! Handler for the command (channel, AGI state, # of arguments, argument list).
+ /*! Handler for the command (channel, AGI state, # of arguments, argument list).
Returns RESULT_SHOWUSAGE for improper arguments */
int (* const handler)(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[]);
/*! Summary of the command (< 60 characters) */
@@ -82,13 +82,12 @@ AST_OPTIONAL_API(int, ast_agi_register,
*
* Unregisters an AGI command.
*
- * \param mod Pointer to the module_info structure for the module that is unregistering the command
* \param cmd Pointer to the descriptor for the command
* \return 1 on success, 0 if the command was not already registered
*
*/
AST_OPTIONAL_API(int, ast_agi_unregister,
- (struct ast_module *mod, agi_command *cmd),
+ (agi_command *cmd),
{ return AST_OPTIONAL_API_UNAVAILABLE; });
/*!
@@ -116,7 +115,6 @@ AST_OPTIONAL_API(int, ast_agi_register_multiple,
* Unregisters a group of AGI commands, provided as an array of struct agi_command
* entries.
*
- * \param mod Pointer to the module_info structure for the module that is unregistering the commands
* \param cmd Pointer to the first entry in the array of command descriptors
* \param len Length of the array (use the ARRAY_LEN macro to determine this easily)
* \return 0 on success, -1 on failure, AST_OPTIONAL_API_UNAVAILABLE if res_agi is not loaded
@@ -125,7 +123,7 @@ AST_OPTIONAL_API(int, ast_agi_register_multiple,
* remaining commands in the array; it will not reregister the already-unregistered commands.
*/
AST_OPTIONAL_API(int, ast_agi_unregister_multiple,
- (struct ast_module *mod, struct agi_command *cmd, unsigned int len),
+ (struct agi_command *cmd, unsigned int len),
{ return AST_OPTIONAL_API_UNAVAILABLE; });
/*!
diff --git a/include/asterisk/ari.h b/include/asterisk/ari.h
index f83d5963f..865b4b00c 100644
--- a/include/asterisk/ari.h
+++ b/include/asterisk/ari.h
@@ -268,14 +268,4 @@ void ast_ari_response_created(struct ast_ari_response *response,
*/
void ast_ari_response_alloc_failed(struct ast_ari_response *response);
-/*! \brief Determines whether the res_ari module is loaded */
-#define CHECK_ARI_MODULE_LOADED() \
- do { \
- if (!ast_module_check("res_ari.so") \
- || !ast_ari_oom_json()) { \
- return AST_MODULE_LOAD_DECLINE; \
- } \
- } while(0)
-
-
#endif /* _ASTERISK_ARI_H */
diff --git a/include/asterisk/ast_expr.h b/include/asterisk/ast_expr.h
index 2dcb71f63..18cfcf534 100644
--- a/include/asterisk/ast_expr.h
+++ b/include/asterisk/ast_expr.h
@@ -17,8 +17,8 @@
*/
/*! \file
- *
- * ???????
+ *
+ * ???????
* \todo Explain this file!
*/
diff --git a/include/asterisk/ast_version.h b/include/asterisk/ast_version.h
index 1ceac30fe..ff9c42f74 100644
--- a/include/asterisk/ast_version.h
+++ b/include/asterisk/ast_version.h
@@ -41,7 +41,7 @@ const char *ast_get_version(void);
*/
const char *ast_get_version_num(void);
-/*! Retreive the Asterisk build options */
+/*! Retrieve the Asterisk build options */
const char *ast_get_build_opts(void);
#endif /* __AST_VERSION_H */
diff --git a/include/asterisk/astdb.h b/include/asterisk/astdb.h
index 8a870ae83..383864baf 100644
--- a/include/asterisk/astdb.h
+++ b/include/asterisk/astdb.h
@@ -83,6 +83,16 @@ int ast_db_deltree(const char *family, const char *keytree);
*/
struct ast_db_entry *ast_db_gettree(const char *family, const char *keytree);
+/*!
+ * \brief Get a list of values with the given key prefix
+ *
+ * \param family The family to search under
+ * \param key_prefix The key prefix to search under
+ *
+ * \retval NULL An error occurred
+ */
+struct ast_db_entry *ast_db_gettree_by_prefix(const char *family, const char *key_prefix);
+
/*! \brief Free structure created by ast_db_gettree() */
void ast_db_freetree(struct ast_db_entry *entry);
diff --git a/include/asterisk/astmm.h b/include/asterisk/astmm.h
index 06300c861..4e4a65b31 100644
--- a/include/asterisk/astmm.h
+++ b/include/asterisk/astmm.h
@@ -32,27 +32,30 @@ extern "C" {
#define _ASTERISK_ASTMM_H
/* IWYU pragma: private, include "asterisk.h" */
+#if defined(MALLOC_DEBUG)
#define __AST_DEBUG_MALLOC
+void __ast_mm_init_phase_1(void);
+void __ast_mm_init_phase_2(void);
+#endif
+
void *ast_std_malloc(size_t size);
void *ast_std_calloc(size_t nmemb, size_t size);
void *ast_std_realloc(void *ptr, size_t size);
void ast_std_free(void *ptr);
void ast_free_ptr(void *ptr);
-void *__ast_calloc(size_t nmemb, size_t size, const char *file, int lineno, const char *func);
-void *__ast_calloc_cache(size_t nmemb, size_t size, const char *file, int lineno, const char *func);
-void *__ast_malloc(size_t size, const char *file, int lineno, const char *func);
+void *__ast_repl_calloc(size_t nmemb, size_t size, const char *file, int lineno, const char *func);
+void *__ast_repl_calloc_cache(size_t nmemb, size_t size, const char *file, int lineno, const char *func);
+void *__ast_repl_malloc(size_t size, const char *file, int lineno, const char *func);
void __ast_free(void *ptr, const char *file, int lineno, const char *func);
-void *__ast_realloc(void *ptr, size_t size, const char *file, int lineno, const char *func);
-char *__ast_strdup(const char *s, const char *file, int lineno, const char *func);
-char *__ast_strndup(const char *s, size_t n, const char *file, int lineno, const char *func);
-int __ast_asprintf(const char *file, int lineno, const char *func, char **strp, const char *format, ...)
+void *__ast_repl_realloc(void *ptr, size_t size, const char *file, int lineno, const char *func);
+char *__ast_repl_strdup(const char *s, const char *file, int lineno, const char *func);
+char *__ast_repl_strndup(const char *s, size_t n, const char *file, int lineno, const char *func);
+int __ast_repl_asprintf(const char *file, int lineno, const char *func, char **strp, const char *format, ...)
__attribute__((format(printf, 5, 6)));
-int __ast_vasprintf(char **strp, const char *format, va_list ap, const char *file, int lineno, const char *func)
+int __ast_repl_vasprintf(char **strp, const char *format, va_list ap, const char *file, int lineno, const char *func)
__attribute__((format(printf, 2, 0)));
-void __ast_mm_init_phase_1(void);
-void __ast_mm_init_phase_2(void);
/*!
* \brief ASTMM_LIBC can be defined to control the meaning of standard allocators.
@@ -120,42 +123,42 @@ void __ast_mm_init_phase_2(void);
#if ASTMM_LIBC == ASTMM_REDIRECT
/* Redefine libc functions to our own versions */
-#define calloc(a,b) \
- __ast_calloc(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define calloc(a, b) \
+ __ast_repl_calloc(a, b, __FILE__, __LINE__, __PRETTY_FUNCTION__)
#define malloc(a) \
- __ast_malloc(a,__FILE__, __LINE__, __PRETTY_FUNCTION__)
+ __ast_repl_malloc(a, __FILE__, __LINE__, __PRETTY_FUNCTION__)
#define free(a) \
- __ast_free(a,__FILE__, __LINE__, __PRETTY_FUNCTION__)
-#define realloc(a,b) \
- __ast_realloc(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__)
+ __ast_free(a, __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define realloc(a, b) \
+ __ast_repl_realloc(a, b, __FILE__, __LINE__, __PRETTY_FUNCTION__)
#define strdup(a) \
- __ast_strdup(a,__FILE__, __LINE__, __PRETTY_FUNCTION__)
-#define strndup(a,b) \
- __ast_strndup(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__)
+ __ast_repl_strdup(a, __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define strndup(a, b) \
+ __ast_repl_strndup(a, b, __FILE__, __LINE__, __PRETTY_FUNCTION__)
#define asprintf(a, b, c...) \
- __ast_asprintf(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, b, c)
-#define vasprintf(a,b,c) \
- __ast_vasprintf(a,b,c,__FILE__, __LINE__, __PRETTY_FUNCTION__)
+ __ast_repl_asprintf(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, b, c)
+#define vasprintf(a, b, c) \
+ __ast_repl_vasprintf(a, b, c, __FILE__, __LINE__, __PRETTY_FUNCTION__)
#elif ASTMM_LIBC == ASTMM_BLOCK
/* Redefine libc functions to cause compile errors */
-#define calloc(a,b) \
- Do_not_use_calloc__use_ast_calloc->fail(a,b)
+#define calloc(a, b) \
+ Do_not_use_calloc__use_ast_calloc->fail(a, b)
#define malloc(a) \
Do_not_use_malloc__use_ast_malloc->fail(a)
#define free(a) \
Do_not_use_free__use_ast_free_or_ast_std_free_for_remotely_allocated_memory->fail(a)
-#define realloc(a,b) \
- Do_not_use_realloc__use_ast_realloc->fail(a,b)
+#define realloc(a, b) \
+ Do_not_use_realloc__use_ast_realloc->fail(a, b)
#define strdup(a) \
Do_not_use_strdup__use_ast_strdup->fail(a)
-#define strndup(a,b) \
- Do_not_use_strndup__use_ast_strndup->fail(a,b)
+#define strndup(a, b) \
+ Do_not_use_strndup__use_ast_strndup->fail(a, b)
#define asprintf(a, b, c...) \
- Do_not_use_asprintf__use_ast_asprintf->fail(a,b,c)
-#define vasprintf(a,b,c) \
- Do_not_use_vasprintf__use_ast_vasprintf->fail(a,b,c)
+ Do_not_use_asprintf__use_ast_asprintf->fail(a, b, c)
+#define vasprintf(a, b, c) \
+ Do_not_use_vasprintf__use_ast_vasprintf->fail(a, b, c)
#else
#error "Unacceptable value for the macro ASTMM_LIBC"
@@ -166,7 +169,7 @@ void __ast_mm_init_phase_2(void);
/* Provide our own definition for ast_free */
#define ast_free(a) \
- __ast_free(a,__FILE__, __LINE__, __PRETTY_FUNCTION__)
+ __ast_free(a, __FILE__, __LINE__, __PRETTY_FUNCTION__)
#else
#error "NEVER INCLUDE astmm.h DIRECTLY!!"
diff --git a/include/asterisk/astobj.h b/include/asterisk/astobj.h
deleted file mode 100644
index 5959d40d0..000000000
--- a/include/asterisk/astobj.h
+++ /dev/null
@@ -1,823 +0,0 @@
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 1999 - 2005, Digium, Inc.
- *
- * Mark Spencer <markster@digium.com>
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
- */
-
-/*! \file
- * \brief Object Model for Asterisk
- *
- * \deprecated Use astobj2.h instead
- */
-
-#ifndef _ASTERISK_ASTOBJ_H
-#define _ASTERISK_ASTOBJ_H
-
-#include "asterisk/lock.h"
-
-/*! \file
- * \brief A set of macros implementing objects and containers.
- * Macros are used for maximum performance, to support multiple inheritance,
- * and to be easily integrated into existing structures without additional
- * malloc calls, etc.
- *
- * These macros expect to operate on two different object types, ASTOBJs and
- * ASTOBJ_CONTAINERs. These are not actual types, as any struct can be
- * converted into an ASTOBJ compatible object or container using the supplied
- * macros.
- *
- * <b>Sample Usage:</b>
- * \code
- * struct sample_object {
- * ASTOBJ_COMPONENTS(struct sample_object);
- * };
- *
- * struct sample_container {
- * ASTOBJ_CONTAINER_COMPONENTS(struct sample_object);
- * } super_container;
- *
- * void sample_object_destroy(struct sample_object *obj)
- * {
- * free(obj);
- * }
- *
- * int init_stuff()
- * {
- * struct sample_object *obj1;
- * struct sample_object *found_obj;
- *
- * obj1 = malloc(sizeof(struct sample_object));
- *
- * ASTOBJ_CONTAINER_INIT(&super_container);
- *
- * ASTOBJ_INIT(obj1);
- * ASTOBJ_WRLOCK(obj1);
- * ast_copy_string(obj1->name, "obj1", sizeof(obj1->name));
- * ASTOBJ_UNLOCK(obj1);
- *
- * ASTOBJ_CONTAINER_LINK(&super_container, obj1);
- *
- * found_obj = ASTOBJ_CONTAINER_FIND(&super_container, "obj1");
- *
- * if(found_obj) {
- * printf("Found object: %s", found_obj->name);
- * ASTOBJ_UNREF(found_obj,sample_object_destroy);
- * }
- *
- * ASTOBJ_CONTAINER_DESTROYALL(&super_container,sample_object_destroy);
- * ASTOBJ_CONTAINER_DESTROY(&super_container);
- *
- * return 0;
- * }
- * \endcode
- */
-
-#if defined(__cplusplus) || defined(c_plusplus)
-extern "C" {
-#endif
-
-#define ASTOBJ_DEFAULT_NAMELEN 80
-#define ASTOBJ_DEFAULT_BUCKETS 256
-#define ASTOBJ_DEFAULT_HASH ast_strhash
-
-#define ASTOBJ_FLAG_MARKED (1 << 0) /* Object has been marked for future operation */
-
-/* C++ is simply a syntactic crutch for those who cannot think for themselves
- in an object oriented way. */
-
-/*! \brief Lock an ASTOBJ for reading.
- */
-#define ASTOBJ_RDLOCK(object) ast_mutex_lock(&(object)->_lock)
-
-/*! \brief Lock an ASTOBJ for writing.
- */
-#define ASTOBJ_WRLOCK(object) ast_mutex_lock(&(object)->_lock)
-
-#define ASTOBJ_TRYWRLOCK(object) ast_mutex_trylock(&(object)->_lock)
-
-/*! \brief Unlock a locked object. */
-#define ASTOBJ_UNLOCK(object) ast_mutex_unlock(&(object)->_lock)
-
-#ifdef ASTOBJ_CONTAINER_HASHMODEL
-#define __ASTOBJ_HASH(type,hashes) \
- type *next[hashes]
-#else
-#define __ASTOBJ_HASH(type,hashes) \
- type *next[1]
-#endif
-
-/*! \brief Add ASTOBJ components to a struct (without locking support).
- *
- * \param type The datatype of the object.
- * \param namelen The length to make the name char array.
- * \param hashes The number of containers the object can be present in.
- *
- * This macro adds components to a struct to make it an ASTOBJ. This macro
- * differs from ASTOBJ_COMPONENTS_FULL in that it does not create a mutex for
- * locking.
- *
- * <b>Sample Usage:</b>
- * \code
- * struct sample_struct {
- * ASTOBJ_COMPONENTS_NOLOCK_FULL(struct sample_struct,1,1);
- * };
- * \endcode
- */
-#define ASTOBJ_COMPONENTS_NOLOCK_FULL(type,namelen,hashes) \
- char name[namelen]; \
- unsigned int refcount; \
- unsigned int objflags; \
- __ASTOBJ_HASH(type,hashes)
-
-/*! \brief Add ASTOBJ components to a struct (without locking support).
- *
- * \param type The datatype of the object.
- *
- * This macro works like #ASTOBJ_COMPONENTS_NOLOCK_FULL() except it only accepts a
- * type and uses default values for namelen and hashes.
- *
- * <b>Sample Usage:</b>
- * \code
- * struct sample_struct_componets {
- * ASTOBJ_COMPONENTS_NOLOCK(struct sample_struct);
- * };
- * \endcode
- */
-#define ASTOBJ_COMPONENTS_NOLOCK(type) \
- ASTOBJ_COMPONENTS_NOLOCK_FULL(type,ASTOBJ_DEFAULT_NAMELEN,1)
-
-/*! \brief Add ASTOBJ components to a struct (with locking support).
- *
- * \param type The datatype of the object.
- *
- * This macro works like #ASTOBJ_COMPONENTS_NOLOCK() except it includes locking
- * support.
- *
- * <b>Sample Usage:</b>
- * \code
- * struct sample_struct {
- * ASTOBJ_COMPONENTS(struct sample_struct);
- * };
- * \endcode
- */
-#define ASTOBJ_COMPONENTS(type) \
- ASTOBJ_COMPONENTS_NOLOCK(type); \
- ast_mutex_t _lock;
-
-/*! \brief Add ASTOBJ components to a struct (with locking support).
- *
- * \param type The datatype of the object.
- * \param namelen The length to make the name char array.
- * \param hashes The number of containers the object can be present in.
- *
- * This macro adds components to a struct to make it an ASTOBJ and includes
- * support for locking.
- *
- * <b>Sample Usage:</b>
- * \code
- * struct sample_struct {
- * ASTOBJ_COMPONENTS_FULL(struct sample_struct,1,1);
- * };
- * \endcode
- */
-#define ASTOBJ_COMPONENTS_FULL(type,namelen,hashes) \
- ASTOBJ_COMPONENTS_NOLOCK_FULL(type,namelen,hashes); \
- ast_mutex_t _lock;
-
-/*! \brief Increment an object reference count.
- * \param object A pointer to the object to operate on.
- * \return The object.
- */
-#define ASTOBJ_REF(object) \
- ({ \
- ASTOBJ_WRLOCK(object); \
- (object)->refcount++; \
- ASTOBJ_UNLOCK(object); \
- (object); \
- })
-
-/*! \brief Decrement the reference count on an object.
- *
- * \param object A pointer the object to operate on.
- * \param destructor The destructor to call if the object is no longer referenced. It will be passed the pointer as an argument.
- *
- * This macro unreferences an object and calls the specfied destructor if the
- * object is no longer referenced. The destructor should free the object if it
- * was dynamically allocated.
- */
-#define ASTOBJ_UNREF(object,destructor) \
- do { \
- int newcount = 0; \
- ASTOBJ_WRLOCK(object); \
- if (__builtin_expect((object)->refcount > 0, 1)) \
- newcount = --((object)->refcount); \
- else \
- ast_log(AST_LOG_WARNING, "Unreferencing unreferenced (object)!\n"); \
- ASTOBJ_UNLOCK(object); \
- if (newcount == 0) { \
- ast_mutex_destroy(&(object)->_lock); \
- destructor((object)); \
- } \
- (object) = NULL; \
- } while(0)
-
-/*! \brief Mark an ASTOBJ by adding the #ASTOBJ_FLAG_MARKED flag to its objflags mask.
- * \param object A pointer to the object to operate on.
- *
- * This macro "marks" an object. Marked objects can later be unlinked from a container using
- * #ASTOBJ_CONTAINER_PRUNE_MARKED().
- *
- */
-#define ASTOBJ_MARK(object) \
- do { \
- ASTOBJ_WRLOCK(object); \
- (object)->objflags |= ASTOBJ_FLAG_MARKED; \
- ASTOBJ_UNLOCK(object); \
- } while(0)
-
-/*! \brief Unmark an ASTOBJ by subtracting the #ASTOBJ_FLAG_MARKED flag from its objflags mask.
- * \param object A pointer to the object to operate on.
- */
-#define ASTOBJ_UNMARK(object) \
- do { \
- ASTOBJ_WRLOCK(object); \
- (object)->objflags &= ~ASTOBJ_FLAG_MARKED; \
- ASTOBJ_UNLOCK(object); \
- } while(0)
-
-/*! \brief Initialize an object.
- * \param object A pointer to the object to operate on.
- *
- * \note This should only be used on objects that support locking (objects
- * created with #ASTOBJ_COMPONENTS() or #ASTOBJ_COMPONENTS_FULL())
- */
-#define ASTOBJ_INIT(object) \
- do { \
- ast_mutex_init(&(object)->_lock); \
- object->name[0] = '\0'; \
- object->refcount = 1; \
- } while(0)
-
-/* Containers for objects -- current implementation is linked lists, but
- should be able to be converted to hashes relatively easily */
-
-/*! \brief Lock an ASTOBJ_CONTAINER for reading.
- */
-#define ASTOBJ_CONTAINER_RDLOCK(container) ast_mutex_lock(&(container)->_lock)
-
-/*! \brief Lock an ASTOBJ_CONTAINER for writing.
- */
-#define ASTOBJ_CONTAINER_WRLOCK(container) ast_mutex_lock(&(container)->_lock)
-
-/*! \brief Unlock an ASTOBJ_CONTAINER. */
-#define ASTOBJ_CONTAINER_UNLOCK(container) ast_mutex_unlock(&(container)->_lock)
-
-#ifdef ASTOBJ_CONTAINER_HASHMODEL
-#error "Hash model for object containers not yet implemented!"
-#else
-/* Linked lists */
-
-/*! \brief Create a container for ASTOBJs (without locking support).
- *
- * \param type The type of objects the container will hold.
- * \param hashes Currently unused.
- * \param buckets Currently unused.
- *
- * This macro is used to create a container for ASTOBJs without locking
- * support.
- *
- * <b>Sample Usage:</b>
- * \code
- * struct sample_struct_nolock_container {
- * ASTOBJ_CONTAINER_COMPONENTS_NOLOCK_FULL(struct sample_struct,1,1);
- * };
- * \endcode
- */
-#define ASTOBJ_CONTAINER_COMPONENTS_NOLOCK_FULL(type,hashes,buckets) \
- type *head
-
-/*! \brief Initialize a container.
- *
- * \param container A pointer to the container to initialize.
- * \param hashes Currently unused.
- * \param buckets Currently unused.
- *
- * This macro initializes a container. It should only be used on containers
- * that support locking.
- *
- * <b>Sample Usage:</b>
- * \code
- * struct sample_struct_container {
- * ASTOBJ_CONTAINER_COMPONENTS_FULL(struct sample_struct,1,1);
- * } container;
- *
- * int func()
- * {
- * ASTOBJ_CONTAINER_INIT_FULL(&container,1,1);
- * }
- * \endcode
- */
-#define ASTOBJ_CONTAINER_INIT_FULL(container,hashes,buckets) \
- do { \
- ast_mutex_init(&(container)->_lock); \
- } while(0)
-
-/*! \brief Destroy a container.
- *
- * \param container A pointer to the container to destroy.
- * \param hashes Currently unused.
- * \param buckets Currently unused.
- *
- * This macro frees up resources used by a container. It does not operate on
- * the objects in the container. To unlink the objects from the container use
- * #ASTOBJ_CONTAINER_DESTROYALL().
- *
- * \note This macro should only be used on containers with locking support.
- */
-#define ASTOBJ_CONTAINER_DESTROY_FULL(container,hashes,buckets) \
- do { \
- ast_mutex_destroy(&(container)->_lock); \
- } while(0)
-
-/*! \brief Iterate through the objects in a container.
- *
- * \param container A pointer to the container to traverse.
- * \param continue A condition to allow the traversal to continue.
- * \param eval A statement to evaluate in the iteration loop.
- *
- * This is macro is a little complicated, but it may help to think of it as a
- * loop. Basically it iterates through the specfied containter as long as the
- * condition is met. Two variables, iterator and next, are provided for use in
- * your \p eval statement. See the sample code for an example.
- *
- * <b>Sample Usage:</b>
- * \code
- * ASTOBJ_CONTAINER_TRAVERSE(&sample_container,1, {
- * ASTOBJ_RDLOCK(iterator);
- * printf("Currently iterating over '%s'\n", iterator->name);
- * ASTOBJ_UNLOCK(iterator);
- * } );
- * \endcode
- *
- * \code
- * ASTOBJ_CONTAINER_TRAVERSE(&sample_container,1, sample_func(iterator));
- * \endcode
- */
-#define ASTOBJ_CONTAINER_TRAVERSE(container,continue,eval) \
- do { \
- typeof((container)->head) iterator; \
- typeof((container)->head) next; \
- ASTOBJ_CONTAINER_RDLOCK(container); \
- next = (container)->head; \
- while((continue) && (iterator = next)) { \
- next = iterator->next[0]; \
- eval; \
- } \
- ASTOBJ_CONTAINER_UNLOCK(container); \
- } while(0)
-
-/*! \brief Find an object in a container.
- *
- * \param container A pointer to the container to search.
- * \param namestr The name to search for.
- *
- * Use this function to find an object with the specfied name in a container.
- *
- * \note When the returned object is no longer in use, #ASTOBJ_UNREF() should
- * be used to free the additional reference created by this macro.
- *
- * \return A new reference to the object located or NULL if nothing is found.
- */
-#define ASTOBJ_CONTAINER_FIND(container,namestr) \
- ({ \
- typeof((container)->head) found = NULL; \
- ASTOBJ_CONTAINER_TRAVERSE(container, !found, do { \
- if (!(strcasecmp(iterator->name, (namestr)))) \
- found = ASTOBJ_REF(iterator); \
- } while (0)); \
- found; \
- })
-
-/*! \brief Find an object in a container.
- *
- * \param container A pointer to the container to search.
- * \param data The data to search for.
- * \param field The field/member of the container's objects to search.
- * \param hashfunc The hash function to use, currently not implemented.
- * \param hashoffset The hash offset to use, currently not implemented.
- * \param comparefunc The function used to compare the field and data values.
- *
- * This macro iterates through a container passing the specified field and data
- * elements to the specified comparefunc. The function should return 0 when a match is found.
- *
- * \note When the returned object is no longer in use, #ASTOBJ_UNREF() should
- * be used to free the additional reference created by this macro.
- *
- * \return A pointer to the object located or NULL if nothing is found.
- */
-#define ASTOBJ_CONTAINER_FIND_FULL(container,data,field,hashfunc,hashoffset,comparefunc) \
- ({ \
- typeof((container)->head) found = NULL; \
- ASTOBJ_CONTAINER_TRAVERSE(container, !found, do { \
- ASTOBJ_RDLOCK(iterator); \
- if (!(comparefunc(iterator->field, (data)))) { \
- found = ASTOBJ_REF(iterator); \
- } \
- ASTOBJ_UNLOCK(iterator); \
- } while (0)); \
- found; \
- })
-
-/*! \brief Empty a container.
- *
- * \param container A pointer to the container to operate on.
- * \param destructor A destructor function to call on each object.
- *
- * This macro loops through a container removing all the items from it using
- * #ASTOBJ_UNREF(). This does not destroy the container itself, use
- * #ASTOBJ_CONTAINER_DESTROY() for that.
- *
- * \note If any object in the container is only referenced by the container,
- * the destructor will be called for that object once it has been removed.
- */
-#define ASTOBJ_CONTAINER_DESTROYALL(container,destructor) \
- do { \
- typeof((container)->head) iterator; \
- ASTOBJ_CONTAINER_WRLOCK(container); \
- while((iterator = (container)->head)) { \
- (container)->head = (iterator)->next[0]; \
- ASTOBJ_UNREF(iterator,destructor); \
- } \
- ASTOBJ_CONTAINER_UNLOCK(container); \
- } while(0)
-
-/*! \brief Remove an object from a container.
- *
- * \param container A pointer to the container to operate on.
- * \param obj A pointer to the object to remove.
- *
- * This macro iterates through a container and removes the specfied object if
- * it exists in the container.
- *
- * \note This macro does not destroy any objects, it simply unlinks
- * them from the list. No destructors are called.
- *
- * \return The container's reference to the removed object or NULL if no
- * matching object was found.
- */
-#define ASTOBJ_CONTAINER_UNLINK(container,obj) \
- ({ \
- typeof((container)->head) found = NULL; \
- typeof((container)->head) prev = NULL; \
- ASTOBJ_CONTAINER_TRAVERSE(container, !found, do { \
- if (iterator == obj) { \
- found = iterator; \
- found->next[0] = NULL; \
- ASTOBJ_CONTAINER_WRLOCK(container); \
- if (prev) \
- prev->next[0] = next; \
- else \
- (container)->head = next; \
- ASTOBJ_CONTAINER_UNLOCK(container); \
- } \
- prev = iterator; \
- } while (0)); \
- found; \
- })
-
-/*! \brief Find and remove an object from a container.
- *
- * \param container A pointer to the container to operate on.
- * \param namestr The name of the object to remove.
- *
- * This macro iterates through a container and removes the first object with
- * the specfied name from the container.
- *
- * \note This macro does not destroy any objects, it simply unlinks
- * them. No destructors are called.
- *
- * \return The container's reference to the removed object or NULL if no
- * matching object was found.
- */
-#define ASTOBJ_CONTAINER_FIND_UNLINK(container,namestr) \
- ({ \
- typeof((container)->head) found = NULL; \
- typeof((container)->head) prev = NULL; \
- ASTOBJ_CONTAINER_TRAVERSE(container, !found, do { \
- if (!(strcasecmp(iterator->name, (namestr)))) { \
- found = iterator; \
- found->next[0] = NULL; \
- ASTOBJ_CONTAINER_WRLOCK(container); \
- if (prev) \
- prev->next[0] = next; \
- else \
- (container)->head = next; \
- ASTOBJ_CONTAINER_UNLOCK(container); \
- } \
- prev = iterator; \
- } while (0)); \
- found; \
- })
-
-/*! \brief Find and remove an object in a container.
- *
- * \param container A pointer to the container to search.
- * \param data The data to search for.
- * \param field The field/member of the container's objects to search.
- * \param hashfunc The hash function to use, currently not implemented.
- * \param hashoffset The hash offset to use, currently not implemented.
- * \param comparefunc The function used to compare the field and data values.
- *
- * This macro iterates through a container passing the specified field and data
- * elements to the specified comparefunc. The function should return 0 when a match is found.
- * If a match is found it is removed from the list.
- *
- * \note This macro does not destroy any objects, it simply unlinks
- * them. No destructors are called.
- *
- * \return The container's reference to the removed object or NULL if no match
- * was found.
- */
-#define ASTOBJ_CONTAINER_FIND_UNLINK_FULL(container,data,field,hashfunc,hashoffset,comparefunc) \
- ({ \
- typeof((container)->head) found = NULL; \
- typeof((container)->head) prev = NULL; \
- ASTOBJ_CONTAINER_TRAVERSE(container, !found, do { \
- ASTOBJ_RDLOCK(iterator); \
- if (!(comparefunc(iterator->field, (data)))) { \
- found = iterator; \
- found->next[0] = NULL; \
- ASTOBJ_CONTAINER_WRLOCK(container); \
- if (prev) \
- prev->next[0] = next; \
- else \
- (container)->head = next; \
- ASTOBJ_CONTAINER_UNLOCK(container); \
- } \
- ASTOBJ_UNLOCK(iterator); \
- prev = iterator; \
- } while (0)); \
- found; \
- })
-
-/*! \brief Add an object to the end of a container.
- *
- * \param container A pointer to the container to operate on.
- * \param newobj A pointer to the object to be added.
- *
- * This macro adds an object to the end of a container.
- */
-#define ASTOBJ_CONTAINER_LINK_END(container,newobj) \
- do { \
- typeof((container)->head) iterator; \
- typeof((container)->head) next; \
- typeof((container)->head) prev; \
- ASTOBJ_CONTAINER_RDLOCK(container); \
- prev = NULL; \
- next = (container)->head; \
- while((iterator = next)) { \
- next = iterator->next[0]; \
- prev = iterator; \
- } \
- if(prev) { \
- ASTOBJ_CONTAINER_WRLOCK((container)); \
- prev->next[0] = ASTOBJ_REF(newobj); \
- (newobj)->next[0] = NULL; \
- ASTOBJ_CONTAINER_UNLOCK((container)); \
- } else { \
- ASTOBJ_CONTAINER_LINK_START((container),(newobj)); \
- } \
- ASTOBJ_CONTAINER_UNLOCK((container)); \
- } while(0)
-
-/*! \brief Add an object to the front of a container.
- *
- * \param container A pointer to the container to operate on.
- * \param newobj A pointer to the object to be added.
- *
- * This macro adds an object to the start of a container.
- */
-#define ASTOBJ_CONTAINER_LINK_START(container,newobj) \
- do { \
- ASTOBJ_CONTAINER_WRLOCK(container); \
- (newobj)->next[0] = (container)->head; \
- (container)->head = ASTOBJ_REF(newobj); \
- ASTOBJ_CONTAINER_UNLOCK(container); \
- } while(0)
-
-/*! \brief Remove an object from the front of a container.
- *
- * \param container A pointer to the container to operate on.
- *
- * This macro removes the first object in a container.
- *
- * \note This macro does not destroy any objects, it simply unlinks
- * them from the list. No destructors are called.
- *
- * \return The container's reference to the removed object or NULL if no
- * matching object was found.
- */
-#define ASTOBJ_CONTAINER_UNLINK_START(container) \
- ({ \
- typeof((container)->head) found = NULL; \
- ASTOBJ_CONTAINER_WRLOCK(container); \
- if((container)->head) { \
- found = (container)->head; \
- (container)->head = (container)->head->next[0]; \
- found->next[0] = NULL; \
- } \
- ASTOBJ_CONTAINER_UNLOCK(container); \
- found; \
- })
-
-/*! \brief Prune marked objects from a container.
- *
- * \param container A pointer to the container to prune.
- * \param destructor A destructor function to call on each marked object.
- *
- * This macro iterates through the specfied container and prunes any marked
- * objects executing the specfied destructor if necessary.
- */
-#define ASTOBJ_CONTAINER_PRUNE_MARKED(container,destructor) \
- do { \
- typeof((container)->head) prev = NULL; \
- ASTOBJ_CONTAINER_TRAVERSE(container, 1, do { \
- ASTOBJ_RDLOCK(iterator); \
- if (iterator->objflags & ASTOBJ_FLAG_MARKED) { \
- ASTOBJ_CONTAINER_WRLOCK(container); \
- if (prev) \
- prev->next[0] = next; \
- else \
- (container)->head = next; \
- ASTOBJ_CONTAINER_UNLOCK(container); \
- ASTOBJ_UNLOCK(iterator); \
- ASTOBJ_UNREF(iterator,destructor); \
- continue; \
- } \
- ASTOBJ_UNLOCK(iterator); \
- prev = iterator; \
- } while (0)); \
- } while(0)
-
-/*! \brief Add an object to a container.
- *
- * \param container A pointer to the container to operate on.
- * \param newobj A pointer to the object to be added.
- * \param data Currently unused.
- * \param field Currently unused.
- * \param hashfunc Currently unused.
- * \param hashoffset Currently unused.
- * \param comparefunc Currently unused.
- *
- * Currently this function adds an object to the head of the list. One day it
- * will support adding objects atthe position specified using the various
- * options this macro offers.
- */
-#define ASTOBJ_CONTAINER_LINK_FULL(container,newobj,data,field,hashfunc,hashoffset,comparefunc) \
- do { \
- ASTOBJ_CONTAINER_WRLOCK(container); \
- (newobj)->next[0] = (container)->head; \
- (container)->head = ASTOBJ_REF(newobj); \
- ASTOBJ_CONTAINER_UNLOCK(container); \
- } while(0)
-
-#endif /* List model */
-
-/* Common to hash and linked list models */
-
-/*! \brief Create a container for ASTOBJs (without locking support).
- *
- * \param type The type of objects the container will hold.
- *
- * This macro is used to create a container for ASTOBJs without locking
- * support.
- *
- * <b>Sample Usage:</b>
- * \code
- * struct sample_struct_nolock_container {
- * ASTOBJ_CONTAINER_COMPONENTS_NOLOCK(struct sample_struct);
- * };
- * \endcode
- */
-#define ASTOBJ_CONTAINER_COMPONENTS_NOLOCK(type) \
- ASTOBJ_CONTAINER_COMPONENTS_NOLOCK_FULL(type,1,ASTOBJ_DEFAULT_BUCKETS)
-
-
-/*! \brief Create a container for ASTOBJs (with locking support).
- *
- * \param type The type of objects the container will hold.
- *
- * This macro is used to create a container for ASTOBJs with locking support.
- *
- * <b>Sample Usage:</b>
- * \code
- * struct sample_struct_container {
- * ASTOBJ_CONTAINER_COMPONENTS(struct sample_struct);
- * };
- * \endcode
- */
-#define ASTOBJ_CONTAINER_COMPONENTS(type) \
- ast_mutex_t _lock; \
- ASTOBJ_CONTAINER_COMPONENTS_NOLOCK(type)
-
-/*! \brief Initialize a container.
- *
- * \param container A pointer to the container to initialize.
- *
- * This macro initializes a container. It should only be used on containers
- * that support locking.
- *
- * <b>Sample Usage:</b>
- * \code
- * struct sample_struct_container {
- * ASTOBJ_CONTAINER_COMPONENTS(struct sample_struct);
- * } container;
- *
- * int func()
- * {
- * ASTOBJ_CONTAINER_INIT(&container);
- * }
- * \endcode
- */
-#define ASTOBJ_CONTAINER_INIT(container) \
- ASTOBJ_CONTAINER_INIT_FULL(container,1,ASTOBJ_DEFAULT_BUCKETS)
-
-/*! \brief Destroy a container.
- *
- * \param container A pointer to the container to destory.
- *
- * This macro frees up resources used by a container. It does not operate on
- * the objects in the container. To unlink the objects from the container use
- * #ASTOBJ_CONTAINER_DESTROYALL().
- *
- * \note This macro should only be used on containers with locking support.
- */
-#define ASTOBJ_CONTAINER_DESTROY(container) \
- ASTOBJ_CONTAINER_DESTROY_FULL(container,1,ASTOBJ_DEFAULT_BUCKETS)
-
-/*! \brief Add an object to a container.
- *
- * \param container A pointer to the container to operate on.
- * \param newobj A pointer to the object to be added.
- *
- * Currently this macro adds an object to the head of a container. One day it
- * should add an object in alphabetical order.
- */
-#define ASTOBJ_CONTAINER_LINK(container,newobj) \
- ASTOBJ_CONTAINER_LINK_FULL(container,newobj,(newobj)->name,name,ASTOBJ_DEFAULT_HASH,0,strcasecmp)
-
-/*! \brief Mark all the objects in a container.
- * \param container A pointer to the container to operate on.
- */
-#define ASTOBJ_CONTAINER_MARKALL(container) \
- ASTOBJ_CONTAINER_TRAVERSE(container, 1, ASTOBJ_MARK(iterator))
-
-/*! \brief Unmark all the objects in a container.
- * \param container A pointer to the container to operate on.
- */
-#define ASTOBJ_CONTAINER_UNMARKALL(container) \
- ASTOBJ_CONTAINER_TRAVERSE(container, 1, ASTOBJ_UNMARK(iterator))
-
-/*! \brief Dump information about an object into a string.
- *
- * \param s A pointer to the string buffer to use.
- * \param slen The length of s.
- * \param obj A pointer to the object to dump.
- *
- * This macro dumps a text representation of the name, objectflags, and
- * refcount fields of an object to the specfied string buffer.
- */
-#define ASTOBJ_DUMP(s,slen,obj) \
- snprintf((s),(slen),"name: %s\nobjflags: %u\nrefcount: %u\n\n", (obj)->name, (obj)->objflags, (obj)->refcount);
-
-/*! \brief Dump information about all the objects in a container to a file descriptor.
- *
- * \param fd The file descriptor to write to.
- * \param s A string buffer, same as #ASTOBJ_DUMP().
- * \param slen The length of s, same as #ASTOBJ_DUMP().
- * \param container A pointer to the container to dump.
- *
- * This macro dumps a text representation of the name, objectflags, and
- * refcount fields of all the objects in a container to the specified file
- * descriptor.
- */
-#define ASTOBJ_CONTAINER_DUMP(fd,s,slen,container) \
- ASTOBJ_CONTAINER_TRAVERSE(container, 1, do { ASTOBJ_DUMP(s,slen,iterator); ast_cli(fd, "%s", s); } while(0))
-
-#if defined(__cplusplus) || defined(c_plusplus)
-}
-#endif
-
-#endif /* _ASTERISK_ASTOBJ_H */
diff --git a/include/asterisk/astobj2.h b/include/asterisk/astobj2.h
index a18f099c0..0e442dbe0 100644
--- a/include/asterisk/astobj2.h
+++ b/include/asterisk/astobj2.h
@@ -145,7 +145,7 @@ An interface to help debug refcounting is provided
in this package. It is dependent on the refdebug being enabled in
asterisk.conf.
-Each of the reference manipulations will generate one line of output in in the refs
+Each of the reference manipulations will generate one line of output in the refs
log file. These lines look like this:
...
0x8756f00,+1,1234,chan_sip.c,22240,load_module,**constructor**,allocate users
@@ -682,7 +682,7 @@ int ao2_weakproxy_unsubscribe(void *weakproxy, ao2_weakproxy_notification_cb cb,
* \since 14.0.0
* \brief Get the weakproxy attached to obj
*
- * \param obj The object to retreive a weakproxy from
+ * \param obj The object to retrieve a weakproxy from
*
* \return The weakproxy object
*/
@@ -1057,7 +1057,7 @@ enum search_flags {
OBJ_NODATA = (1 << 1),
/*!
* Don't stop at the first match in ao2_callback() unless the
- * result of of the callback function has the CMP_STOP bit set.
+ * result of the callback function has the CMP_STOP bit set.
*/
OBJ_MULTIPLE = (1 << 2),
/*!
@@ -1985,14 +1985,16 @@ void ao2_iterator_cleanup(struct ao2_iterator *iter);
int ao2_iterator_count(struct ao2_iterator *iter);
/*!
- * \brief Creates a hash function for a structure string field.
+ * \brief Creates a hash function for a structure field.
* \param stype The structure type
* \param field The string field in the structure to hash
+ * \param hash_fn Function which hashes the field
*
- * AO2_STRING_FIELD_HASH_CB(mystruct, myfield) will produce a function
- * named mystruct_hash_fn which hashes mystruct->myfield.
+ * AO2_FIELD_HASH_FN(mystruct, myfield, ast_str_hash) will
+ * produce a function named mystruct_hash_fn which hashes
+ * mystruct->myfield with ast_str_hash.
*/
-#define AO2_STRING_FIELD_HASH_FN(stype, field) \
+#define AO2_FIELD_HASH_FN(stype, field, hash_fn) \
static int stype ## _hash_fn(const void *obj, const int flags) \
{ \
const struct stype *object = obj; \
@@ -2008,19 +2010,33 @@ static int stype ## _hash_fn(const void *obj, const int flags) \
ast_assert(0); \
return 0; \
} \
- return ast_str_hash(key); \
+ return hash_fn(key); \
}
+
+#define AO2_FIELD_TRANSFORM_CMP_FN(cmp) ((cmp) ? 0 : CMP_MATCH)
+#define AO2_FIELD_TRANSFORM_SORT_FN(cmp) (cmp)
+
/*!
+ * \internal
+ *
* \brief Creates a compare function for a structure string field.
* \param stype The structure type
+ * \param fn_suffix Function name suffix
* \param field The string field in the structure to compare
+ * \param key_cmp Key comparison function like strcmp
+ * \param partial_key_cmp Partial key comparison function like strncmp
+ * \param transform A macro that takes the cmp result as an argument
+ * and transforms it to a return value.
*
- * AO2_STRING_FIELD_CMP_FN(mystruct, myfield) will produce a function
- * named mystruct_cmp_fn which compares mystruct->myfield.
+ * Do not use this macro directly, instead use macro's starting with
+ * AST_STRING_FIELD.
+ *
+ * \warning The macro is an internal implementation detail, the API
+ * may change at any time.
*/
-#define AO2_STRING_FIELD_CMP_FN(stype, field) \
-static int stype ## _cmp_fn(void *obj, void *arg, int flags) \
+#define AO2_FIELD_CMP_FN(stype, fn_suffix, field, key_cmp, partial_key_cmp, transform, argconst) \
+static int stype ## fn_suffix(argconst void *obj, argconst void *arg, int flags) \
{ \
const struct stype *object_left = obj, *object_right = arg; \
const char *right_key = arg; \
@@ -2029,52 +2045,64 @@ static int stype ## _cmp_fn(void *obj, void *arg, int flags) \
case OBJ_SEARCH_OBJECT: \
right_key = object_right->field; \
case OBJ_SEARCH_KEY: \
- cmp = strcmp(object_left->field, right_key); \
+ cmp = key_cmp(object_left->field, right_key); \
break; \
case OBJ_SEARCH_PARTIAL_KEY: \
- cmp = strncmp(object_left->field, right_key, strlen(right_key)); \
+ cmp = partial_key_cmp(object_left->field, right_key, strlen(right_key)); \
break; \
default: \
cmp = 0; \
break; \
} \
- if (cmp) { \
- return 0; \
- } \
- return CMP_MATCH; \
+ return transform(cmp); \
}
/*!
+ * \brief Creates a hash function for a structure string field.
+ * \param stype The structure type
+ * \param field The string field in the structure to hash
+ *
+ * AO2_STRING_FIELD_HASH_FN(mystruct, myfield) will produce a function
+ * named mystruct_hash_fn which hashes mystruct->myfield.
+ *
+ * AO2_STRING_FIELD_HASH_FN(mystruct, myfield) would do the same except
+ * it uses the hash function which ignores case.
+ */
+#define AO2_STRING_FIELD_HASH_FN(stype, field) \
+ AO2_FIELD_HASH_FN(stype, field, ast_str_hash)
+#define AO2_STRING_FIELD_CASE_HASH_FN(stype, field) \
+ AO2_FIELD_HASH_FN(stype, field, ast_str_case_hash)
+
+/*!
+ * \brief Creates a compare function for a structure string field.
+ * \param stype The structure type
+ * \param field The string field in the structure to compare
+ *
+ * AO2_STRING_FIELD_CMP_FN(mystruct, myfield) will produce a function
+ * named mystruct_cmp_fn which compares mystruct->myfield.
+ *
+ * AO2_STRING_FIELD_CASE_CMP_FN(mystruct, myfield) would do the same
+ * except it performs case insensitive comparisons.
+ */
+#define AO2_STRING_FIELD_CMP_FN(stype, field) \
+ AO2_FIELD_CMP_FN(stype, _cmp_fn, field, strcmp, strncmp, AO2_FIELD_TRANSFORM_CMP_FN,)
+#define AO2_STRING_FIELD_CASE_CMP_FN(stype, field) \
+ AO2_FIELD_CMP_FN(stype, _cmp_fn, field, strcasecmp, strncasecmp, AO2_FIELD_TRANSFORM_CMP_FN,)
+
+/*!
* \brief Creates a sort function for a structure string field.
* \param stype The structure type
* \param field The string field in the structure to compare
*
* AO2_STRING_FIELD_SORT_FN(mystruct, myfield) will produce a function
* named mystruct_sort_fn which compares mystruct->myfield.
+ *
+ * AO2_STRING_FIELD_CASE_SORT_FN(mystruct, myfield) would do the same
+ * except it performs case insensitive comparisons.
*/
#define AO2_STRING_FIELD_SORT_FN(stype, field) \
-static int stype ## _sort_fn(const void *obj, const void *arg, int flags) \
-{ \
- const struct stype *object_left = obj; \
- const struct stype *object_right = arg; \
- const char *right_key = arg; \
- int cmp; \
-\
- switch (flags & OBJ_SEARCH_MASK) { \
- case OBJ_SEARCH_OBJECT: \
- right_key = object_right->field; \
- /* Fall through */ \
- case OBJ_SEARCH_KEY: \
- cmp = strcmp(object_left->field, right_key); \
- break; \
- case OBJ_SEARCH_PARTIAL_KEY: \
- cmp = strncmp(object_left->field, right_key, strlen(right_key)); \
- break; \
- default: \
- cmp = 0; \
- break; \
- } \
- return cmp; \
-}
+ AO2_FIELD_CMP_FN(stype, _sort_fn, field, strcmp, strncmp, AO2_FIELD_TRANSFORM_SORT_FN, const)
+#define AO2_STRING_FIELD_CASE_SORT_FN(stype, field) \
+ AO2_FIELD_CMP_FN(stype, _sort_fn, field, strcasecmp, strncasecmp, AO2_FIELD_TRANSFORM_SORT_FN, const)
#endif /* _ASTERISK_ASTOBJ2_H */
diff --git a/include/asterisk/astosp.h b/include/asterisk/astosp.h
deleted file mode 100644
index d5c7da1a7..000000000
--- a/include/asterisk/astosp.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 1999 - 2005, Digium, Inc.
- *
- * Mark Spencer <markster@digium.com>
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
- */
-
-/*!
- * \file
- * \brief Open Settlement Protocol (OSP)
- */
-
-#ifndef _ASTERISK_OSP_H
-#define _ASTERISK_OSP_H
-
-#define AST_OSP_SUCCESS ((char*)"SUCCESS") /* Return status, success */
-#define AST_OSP_FAILED ((char*)"FAILED") /* Return status, failed */
-#define AST_OSP_ERROR ((char*)"ERROR") /* Return status, error */
-
-#endif /* _ASTERISK_OSP_H */
diff --git a/include/asterisk/autochan.h b/include/asterisk/autochan.h
index 128377b57..782f68f37 100644
--- a/include/asterisk/autochan.h
+++ b/include/asterisk/autochan.h
@@ -35,7 +35,7 @@ struct ast_autochan {
ast_mutex_t lock;
};
-/*!
+/*!
* \par Just what the $!@# is an autochan?
*
* An ast_autochan is a structure which contains an ast_channel. The pointer
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index f8bd0e376..5e9ba6011 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -188,6 +188,9 @@
/* Define to 1 if you have the curses library. */
#undef HAVE_CURSES
+/* Define to 1 if your C compiler provides __atomic operations. */
+#undef HAVE_C_ATOMICS
+
/* Define if your system has the DAHDI headers. */
#undef HAVE_DAHDI
@@ -292,7 +295,7 @@
/* Define to 1 if you have the `ftruncate' function. */
#undef HAVE_FTRUNCATE
-/* Define to 1 if your GCC C compiler provides atomic operations. */
+/* Define to 1 if your GCC C compiler provides __sync atomic operations. */
#undef HAVE_GCC_ATOMICS
/* Define to 1 if you have the `getcwd' function. */
@@ -480,9 +483,6 @@
than `double'. */
#undef HAVE_LONG_DOUBLE_WIDER
-/* Define to 1 if you have the libtool library. */
-#undef HAVE_LTDL
-
/* Define to 1 if you have the Lua library. */
#undef HAVE_LUA
@@ -573,9 +573,6 @@
/* Define to 1 if you have the OGG library. */
#undef HAVE_OGG
-/* Define if your system has the OpenH323 libraries. */
-#undef HAVE_OPENH323
-
/* Define to 1 if you have the MFR2 library. */
#undef HAVE_OPENR2
@@ -600,9 +597,6 @@
/* Define to 1 if you have the Open Sound System library. */
#undef HAVE_OSS
-/* Define to 1 if OSX atomic operations are supported. */
-#undef HAVE_OSX_ATOMICS
-
/* Define to 1 if your system defines the file flag O_EVTONLY in fcntl.h */
#undef HAVE_O_EVTONLY
@@ -666,7 +660,7 @@
/* Define to 1 if you have the popt library. */
#undef HAVE_POPT
-/* Define to 1 if you have the PortAudio library. */
+/* Define if your system has the PORTAUDIO libraries. */
#undef HAVE_PORTAUDIO
/* Define to 1 if you have the `pow' function. */
@@ -789,9 +783,6 @@
/* Define to 1 if you have the <pwd.h> header file. */
#undef HAVE_PWD_H
-/* Define if your system has the PWLib libraries. */
-#undef HAVE_PWLIB
-
/* Define if your system has the PYTHONDEV libraries. */
#undef HAVE_PYTHONDEV
@@ -1209,6 +1200,9 @@
/* Define to 1 if you have the uriparser library library. */
#undef HAVE_URIPARSER
+/* Define to 1 if you have the `uselocale' function. */
+#undef HAVE_USELOCALE
+
/* Define to 1 if you have the `utime' function. */
#undef HAVE_UTIME
diff --git a/include/asterisk/bridge_after.h b/include/asterisk/bridge_after.h
index 045168571..d4fcbeaf6 100644
--- a/include/asterisk/bridge_after.h
+++ b/include/asterisk/bridge_after.h
@@ -33,7 +33,7 @@
extern "C" {
#endif
-/*! Reason the the after bridge callback will not be called. */
+/*! Reason the after bridge callback will not be called. */
enum ast_bridge_after_cb_reason {
/*! The datastore is being destroyed. Likely due to hangup. (Enum value must be zero.) */
AST_BRIDGE_AFTER_CB_REASON_DESTROY,
diff --git a/include/asterisk/bridge_features.h b/include/asterisk/bridge_features.h
index 7fcb85bd2..f9af8fbfd 100644
--- a/include/asterisk/bridge_features.h
+++ b/include/asterisk/bridge_features.h
@@ -721,7 +721,7 @@ int ast_bridge_features_limits_construct(struct ast_bridge_features_limits *limi
* \param limits pointer to an ast_bridge_features_limits struct that needs to be destroyed
*
* This function does not free memory allocated to the ast_bridge_features_limits struct, it only frees elements within the struct.
- * You must still call ast_free on the the struct if you allocated it with malloc.
+ * You must still call ast_free on the struct if you allocated it with malloc.
*/
void ast_bridge_features_limits_destroy(struct ast_bridge_features_limits *limits);
diff --git a/include/asterisk/bridge_technology.h b/include/asterisk/bridge_technology.h
index eaea28de5..12fd49917 100644
--- a/include/asterisk/bridge_technology.h
+++ b/include/asterisk/bridge_technology.h
@@ -46,11 +46,9 @@ enum ast_bridge_preference {
* performing talking optimizations.
*/
struct ast_bridge_tech_optimizations {
- /*! The amount of time in ms that talking must be detected before
- * the dsp determines that talking has occurred */
+ /*! Minimum average magnitude threshold to determine talking by the DSP. */
unsigned int talking_threshold;
- /*! The amount of time in ms that silence must be detected before
- * the dsp determines that talking has stopped */
+ /*! Time in ms of silence necessary to declare talking stopped by the bridge. */
unsigned int silence_threshold;
/*! Whether or not the bridging technology should drop audio
* detected as silence from the mix. */
diff --git a/include/asterisk/calendar.h b/include/asterisk/calendar.h
index e9dcd8809..bfc7c6baf 100644
--- a/include/asterisk/calendar.h
+++ b/include/asterisk/calendar.h
@@ -177,7 +177,7 @@ struct ao2_container *ast_calendar_event_container_alloc(void);
*/
void ast_calendar_merge_events(struct ast_calendar *cal, struct ao2_container *new_events);
-/*! \brief Unreference an ast_calendar_event
+/*! \brief Unreference an ast_calendar_event
*
* \param event event to unref
*
@@ -185,7 +185,7 @@ void ast_calendar_merge_events(struct ast_calendar *cal, struct ao2_container *n
*/
struct ast_calendar_event *ast_calendar_unref_event(struct ast_calendar_event *event);
-/*! \brief Remove all events from calendar
+/*! \brief Remove all events from calendar
*
* \param cal calendar whose events need to be cleared
*/
diff --git a/include/asterisk/callerid.h b/include/asterisk/callerid.h
index f7d7719d2..143ffae23 100644
--- a/include/asterisk/callerid.h
+++ b/include/asterisk/callerid.h
@@ -240,7 +240,7 @@ void ast_shrink_phone_number(char *n);
int ast_isphonenumber(const char *n);
/*!
- * \brief Check if a string consists only of digits and and + \# ( ) - .
+ * \brief Check if a string consists only of digits and + \# ( ) - .
* (meaning it can be cleaned with ast_shrink_phone_number)
* \param exten The extension (or URI) to be checked.
* \retval 1 if string is valid AST shrinkable phone number
diff --git a/include/asterisk/ccss.h b/include/asterisk/ccss.h
index d8101cddf..c006c7639 100644
--- a/include/asterisk/ccss.h
+++ b/include/asterisk/ccss.h
@@ -1556,7 +1556,7 @@ void ast_cc_busy_interface(struct ast_channel *inbound, struct ast_cc_config_par
* ready, and then based on set flags, creates the proper frame type. For chan_dahdi, we
* provide this function. It provides us the data we need, and we'll make its frame for it.
*
- * \param chan A channel involved in the call. What we want is on a datastore on both incoming
+ * \param chan A channel involved in the call. What we want is on a datastore on both incoming
* and outgoing so either may be provided
* \param cc_params The CC configuration parameters for the outbound target
* \param monitor_type The type of monitor to use when CC is requested
@@ -1567,7 +1567,7 @@ void ast_cc_busy_interface(struct ast_channel *inbound, struct ast_cc_config_par
* data has been allocated, then this parameter should contain a pointer to that data. If using a generic
* monitor, this parameter should remain NULL. Note that if this function should fail at some point,
* it is the responsibility of the caller to free the private data upon return.
- * \param[out] frame The frame we will be returning to the caller. It is vital that ast_frame_free be
+ * \param[out] frame The frame we will be returning to the caller. It is vital that ast_frame_free be
* called on this frame since the payload will be allocated on the heap.
* \retval -1 Failure. At some point there was a failure. Do not attempt to use the frame in this case.
* \retval 0 Success
@@ -1618,15 +1618,4 @@ typedef void (*ast_cc_callback_fn)(struct ast_channel *chan, struct ast_cc_confi
*/
int ast_cc_callback(struct ast_channel *inbound, const char * const tech, const char * const dest, ast_cc_callback_fn callback);
-/*!
- * \since 1.8
- * \brief Initialize CCSS
- *
- * Performs startup routines necessary for CC operation.
- *
- * \retval 0 Success
- * \retval nonzero Failure
- */
-int ast_cc_init(void);
-
#endif /* _ASTERISK_CCSS_H */
diff --git a/include/asterisk/cdr.h b/include/asterisk/cdr.h
index e10da8223..c6b241315 100644
--- a/include/asterisk/cdr.h
+++ b/include/asterisk/cdr.h
@@ -581,12 +581,6 @@ const char *ast_cdr_disp2str(int disposition);
*/
void ast_cdr_setuserfield(const char *channel_name, const char *userfield);
-/*! \brief Reload the configuration file cdr.conf and start/stop CDR scheduling thread */
-int ast_cdr_engine_reload(void);
-
-/*! \brief Load the configuration file cdr.conf and possibly start the CDR scheduling thread */
-int ast_cdr_engine_init(void);
-
/*! Submit any remaining CDRs and prepare for shutdown */
void ast_cdr_engine_term(void);
diff --git a/include/asterisk/cel.h b/include/asterisk/cel.h
index c77a3538c..fed2085f4 100644
--- a/include/asterisk/cel.h
+++ b/include/asterisk/cel.h
@@ -14,9 +14,9 @@
* at the top of the source tree.
*/
-/*!
+/*!
* \file
- * \brief Call Event Logging API
+ * \brief Call Event Logging API
*
* \todo TODO: There some event types that have been defined here, but are not
* yet used anywhere in the code. It would be really awesome if someone
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index 3dfbe61d9..16f9aa8ae 100644
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -1144,22 +1144,6 @@ enum ama_flags {
* take a channel argument.
*/
-/*!
- * \brief Create a channel data store object
- * \deprecated You should use the ast_datastore_alloc() generic function instead.
- * \version 1.6.1 deprecated
- */
-struct ast_datastore * attribute_malloc ast_channel_datastore_alloc(const struct ast_datastore_info *info, const char *uid)
- __attribute__((deprecated));
-
-/*!
- * \brief Free a channel data store object
- * \deprecated You should use the ast_datastore_free() generic function instead.
- * \version 1.6.1 deprecated
- */
-int ast_channel_datastore_free(struct ast_datastore *datastore)
- __attribute__((deprecated));
-
/*! \brief Inherit datastores from a parent to a child. */
int ast_channel_datastore_inherit(struct ast_channel *from, struct ast_channel *to);
@@ -1208,7 +1192,7 @@ struct ast_datastore *ast_channel_datastore_find(struct ast_channel *chan, const
* and "default" context.
* \note Since 12.0.0 this function returns with the newly created channel locked.
*/
-struct ast_channel * attribute_malloc __attribute__((format(printf, 15, 16)))
+struct ast_channel * __attribute__((format(printf, 15, 16)))
__ast_channel_alloc(int needqueue, int state, const char *cid_num,
const char *cid_name, const char *acctcode,
const char *exten, const char *context, const struct ast_assigned_ids *assignedids,
@@ -1710,21 +1694,6 @@ void ast_channel_softhangup_withcause_locked(struct ast_channel *chan, int cause
/*!
* \brief Compare a offset with the settings of when to hang a channel up
- * \param chan channel on which to check for hang up
- * \param offset offset in seconds from current time
- * \return 1, 0, or -1
- * \details
- * This function compares a offset from current time with the absolute time
- * out on a channel (when to hang up). If the absolute time out on a channel
- * is earlier than current time plus the offset, it returns 1, if the two
- * time values are equal, it return 0, otherwise, it return -1.
- * \sa ast_channel_cmpwhentohangup_tv()
- * \version 1.6.1 deprecated function (only had seconds precision)
- */
-int ast_channel_cmpwhentohangup(struct ast_channel *chan, time_t offset) __attribute__((deprecated));
-
-/*!
- * \brief Compare a offset with the settings of when to hang a channel up
* \param chan channel on which to check for hangup
* \param offset offset in seconds and microseconds from current time
* \return 1, 0, or -1
@@ -1740,23 +1709,6 @@ int ast_channel_cmpwhentohangup_tv(struct ast_channel *chan, struct timeval offs
* \brief Set when to hang a channel up
*
* \param chan channel on which to check for hang up
- * \param offset offset in seconds relative to the current time of when to hang up
- *
- * \details
- * This function sets the absolute time out on a channel (when to hang up).
- *
- * \pre chan is locked
- *
- * \return Nothing
- * \sa ast_channel_setwhentohangup_tv()
- * \version 1.6.1 deprecated function (only had seconds precision)
- */
-void ast_channel_setwhentohangup(struct ast_channel *chan, time_t offset) __attribute__((deprecated));
-
-/*!
- * \brief Set when to hang a channel up
- *
- * \param chan channel on which to check for hang up
* \param offset offset in seconds and useconds relative to the current time of when to hang up
*
* This function sets the absolute time out on a channel (when to hang up).
@@ -2736,12 +2688,6 @@ int ast_namedgroups_intersect(struct ast_namedgroups *a, struct ast_namedgroups
/*! \brief Print named call groups and named pickup groups */
char *ast_print_namedgroups(struct ast_str **buf, struct ast_namedgroups *groups);
-/*!
- * \brief Convert enum channelreloadreason to text string for manager event
- * \param reason The reason for reload (manager, cli, start etc)
- */
-const char *channelreloadreason2txt(enum channelreloadreason reason);
-
/*! \brief return an ast_variable list of channeltypes */
struct ast_variable *ast_channeltype_list(void);
diff --git a/include/asterisk/chanvars.h b/include/asterisk/chanvars.h
index 2040c7b65..1a303c5f7 100644
--- a/include/asterisk/chanvars.h
+++ b/include/asterisk/chanvars.h
@@ -35,12 +35,10 @@ AST_LIST_HEAD_NOLOCK(varshead, ast_var_t);
struct varshead *ast_var_list_create(void);
void ast_var_list_destroy(struct varshead *head);
-#ifdef __AST_DEBUG_MALLOC
+
struct ast_var_t *_ast_var_assign(const char *name, const char *value, const char *file, int lineno, const char *function);
-#define ast_var_assign(a,b) _ast_var_assign(a,b,__FILE__,__LINE__,__PRETTY_FUNCTION__)
-#else
-struct ast_var_t *ast_var_assign(const char *name, const char *value);
-#endif
+#define ast_var_assign(name, value) _ast_var_assign(name, value, __FILE__, __LINE__, __PRETTY_FUNCTION__)
+
void ast_var_delete(struct ast_var_t *var);
const char *ast_var_name(const struct ast_var_t *var);
const char *ast_var_full_name(const struct ast_var_t *var);
diff --git a/include/asterisk/cli.h b/include/asterisk/cli.h
index 30c5dc798..71468e56e 100644
--- a/include/asterisk/cli.h
+++ b/include/asterisk/cli.h
@@ -105,7 +105,7 @@ void ast_cli(int fd, const char *fmt, ...)
char *new_setdebug(const struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
...
- // this is how we create the entry to register
+ // this is how we create the entry to register
AST_CLI_DEFINE(new_setdebug, "short description")
...
@@ -132,7 +132,7 @@ static char *test_new_cli(struct ast_cli_entry *e, int cmd, struct ast_cli_args
return NULL;
return ast_cli_complete(a->word, choices, a->n);
- default:
+ default:
// we are guaranteed to be called with argc >= e->args;
if (a->argc > e->args + 1) // we accept one extra argument
return CLI_SHOWUSAGE;
@@ -142,10 +142,10 @@ static char *test_new_cli(struct ast_cli_entry *e, int cmd, struct ast_cli_args
}
\endcode
-
+
*/
-/*! \brief calling arguments for new-style handlers.
+/*! \brief calling arguments for new-style handlers.
* \arg \ref CLI_command_API
*/
enum ast_cli_command {
@@ -165,7 +165,7 @@ struct ast_cli_args {
const int n; /* the iteration count (n-th entry we generate) */
};
-/*! \brief descriptor for a cli entry.
+/*! \brief descriptor for a cli entry.
* \arg \ref CLI_command_API
*/
struct ast_cli_entry {
@@ -215,7 +215,7 @@ struct ast_cli_entry {
*/
char *ast_cli_complete(const char *word, const char * const choices[], int pos);
-/*!
+/*!
* \brief Interprets a command
* Interpret a command s, sending output to fd if uid:gid has permissions
* to run this command. uid = CLI_NO_PERMS to avoid checking user permissions
@@ -229,9 +229,9 @@ char *ast_cli_complete(const char *word, const char * const choices[], int pos);
*/
int ast_cli_command_full(int uid, int gid, int fd, const char *s);
-#define ast_cli_command(fd,s) ast_cli_command_full(CLI_NO_PERMS, CLI_NO_PERMS, fd, s)
+#define ast_cli_command(fd,s) ast_cli_command_full(CLI_NO_PERMS, CLI_NO_PERMS, fd, s)
-/*!
+/*!
* \brief Executes multiple CLI commands
* Interpret strings separated by NULL and execute each one, sending output to fd
* if uid has permissions, uid = CLI_NO_PERMS to avoid checking users permissions.
@@ -267,7 +267,7 @@ int __ast_cli_register(struct ast_cli_entry *e, struct ast_module *mod);
int __ast_cli_register_multiple(struct ast_cli_entry *e, int len, struct ast_module *mod);
-/*!
+/*!
* \brief Unregisters a command or an array of commands
* \param e which cli entry to unregister
* Unregister your own command. You must pass a completed ast_cli_entry structure
@@ -282,7 +282,7 @@ int ast_cli_unregister(struct ast_cli_entry *e);
*/
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len);
-/*!
+/*!
* \brief Readline madness
* Useful for readline, that's about it
* \retval 0 on success
diff --git a/include/asterisk/compat.h b/include/asterisk/compat.h
index 88f88cf8b..85472837c 100644
--- a/include/asterisk/compat.h
+++ b/include/asterisk/compat.h
@@ -1,6 +1,6 @@
/*
* Asterisk -- An open source telephony toolkit.
- *
+ *
* Copyright (C) 1999-2006, Digium, Inc.
*
* Mark Spencer <markster@digium.com>
@@ -64,7 +64,7 @@
void closefrom(int lowfd);
#endif
-#if !defined(HAVE_ASPRINTF) && !defined(__AST_DEBUG_MALLOC)
+#if !defined(HAVE_ASPRINTF)
int __attribute__((format(printf, 2, 3))) asprintf(char **str, const char *fmt, ...);
#endif
@@ -96,7 +96,7 @@ int setenv(const char *name, const char *value, int overwrite);
char *strcasestr(const char *, const char *);
#endif
-#if !defined(HAVE_STRNDUP) && !defined(__AST_DEBUG_MALLOC)
+#if !defined(HAVE_STRNDUP)
char *strndup(const char *, size_t);
#endif
@@ -116,7 +116,7 @@ uint64_t strtoq(const char *nptr, char **endptr, int base);
int unsetenv(const char *name);
#endif
-#if !defined(HAVE_VASPRINTF) && !defined(__AST_DEBUG_MALLOC)
+#if !defined(HAVE_VASPRINTF)
int __attribute__((format(printf, 2, 0))) vasprintf(char **strp, const char *fmt, va_list ap);
#endif
@@ -187,7 +187,7 @@ typedef unsigned int uint;
typedef unsigned long long uint64_t;
#endif
-/* glob compat stuff */
+/* glob compat stuff */
#if defined(__Darwin__) || defined(__CYGWIN__)
#define GLOB_ABORTED GLOB_ABEND
#endif
diff --git a/include/asterisk/config.h b/include/asterisk/config.h
index 1addfa317..9908b905b 100644
--- a/include/asterisk/config.h
+++ b/include/asterisk/config.h
@@ -784,15 +784,6 @@ int ast_realtime_append_mapping(const char *name, const char *driver, const char
*/
int register_config_cli(void);
-/*!
- * \brief Exposed re-initialization method for core process
- *
- * \details
- * This method is intended for use only with the core re-initialization and is
- * not designed to be called from any user applications.
- */
-int read_config_maps(void);
-
/*! \brief Create a new base configuration structure */
struct ast_config *ast_config_new(void);
@@ -856,7 +847,7 @@ struct ast_category *ast_category_new_template(const char *name, const char *in_
/*!
* \brief Inserts new category
- *
+ *
* \param config which config to use
* \param cat newly created category to insert
* \param match which category to insert above
@@ -919,12 +910,9 @@ void ast_category_destroy(struct ast_category *cat);
struct ast_variable *ast_category_detach_variables(struct ast_category *cat);
void ast_category_rename(struct ast_category *cat, const char *name);
-#ifdef __AST_DEBUG_MALLOC
struct ast_variable *_ast_variable_new(const char *name, const char *value, const char *filename, const char *file, const char *function, int lineno);
#define ast_variable_new(name, value, filename) _ast_variable_new(name, value, filename, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-#else
-struct ast_variable *ast_variable_new(const char *name, const char *value, const char *filename);
-#endif
+
struct ast_config_include *ast_include_new(struct ast_config *conf, const char *from_file, const char *included_file, int is_exec, const char *exec_file, int from_lineno, char *real_included_file_name, int real_included_file_name_size);
struct ast_config_include *ast_include_find(struct ast_config *conf, const char *included_file);
void ast_include_rename(struct ast_config *conf, const char *from_file, const char *to_file);
@@ -997,7 +985,6 @@ int ast_config_text_file_save2(const char *filename, const struct ast_config *cf
* \return 0 on success or -1 on failure.
*/
int ast_config_text_file_save(const char *filename, const struct ast_config *cfg, const char *generator);
-int config_text_file_save(const char *filename, const struct ast_config *cfg, const char *generator) __attribute__((deprecated));
struct ast_config *ast_config_internal_load(const char *configfile, struct ast_config *cfg, struct ast_flags flags, const char *suggested_incl_file, const char *who_asked);
/*!
diff --git a/include/asterisk/config_options.h b/include/asterisk/config_options.h
index f4c3db188..420eb97dd 100644
--- a/include/asterisk/config_options.h
+++ b/include/asterisk/config_options.h
@@ -40,18 +40,30 @@ struct aco_type_internal;
enum aco_type_t {
ACO_GLOBAL,
ACO_ITEM,
+ ACO_IGNORE,
};
-/*! \brief Whether a category regex is a blackist or a whitelist */
+/*! Type of category matching to perform */
enum aco_category_op {
+ /*! Regex based blacklist. */
ACO_BLACKLIST = 0,
+ /*! Regex based whitelist. */
ACO_WHITELIST,
+ /*! Blacklist with a single string matched with strcasecmp. */
+ ACO_BLACKLIST_EXACT,
+ /*! Whitelist with a single string matched with strcasecmp. */
+ ACO_WHITELIST_EXACT,
+ /*! Blacklist with a NULL terminated array of strings matched with strcasecmp. */
+ ACO_BLACKLIST_ARRAY,
+ /*! Whitelist with a NULL terminated array of strings matched with strcasecmp. */
+ ACO_WHITELIST_ARRAY,
};
/*! \brief What kind of matching should be done on an option name */
enum aco_matchtype {
ACO_EXACT = 1,
ACO_REGEX,
+ ACO_PREFIX,
};
/*! Callback functions for option parsing via aco_process_config() */
@@ -772,11 +784,11 @@ intptr_t aco_option_get_argument(const struct aco_option *option, unsigned int p
* VA_NARGS(one, two, three) -> v
* VA_NARGS1(one, two, three, 8, 7, 6, 5, 4, 3, 2, 1, 0) ->
* VA_NARGS1( _1, _2, _3, _4, _5, _6, _7, _8, N, ... ) N -> 3
- *
+ *
* Note that VA_NARGS *does not* work when there are no arguments passed. Pasting an empty
* __VA_ARGS__ with a comma like ", ##__VA_ARGS__" will delete the leading comma, but it
* does not work when __VA_ARGS__ is the first argument. Instead, 1 is returned instead of 0:
- *
+ *
* VA_NARGS() -> v
* VA_NARGS1( , 8, 7, 6, 5, 4, 3, 2, 1, 0) ->
* VA_NARGS1(_1, _2, _3, _4, _5, _6, _7, _8, N) -> 1
diff --git a/include/asterisk/core_unreal.h b/include/asterisk/core_unreal.h
index 45045e0a9..35fc87ea6 100644
--- a/include/asterisk/core_unreal.h
+++ b/include/asterisk/core_unreal.h
@@ -205,7 +205,7 @@ struct ast_unreal_pvt *ast_unreal_alloc(size_t size, ao2_destructor_fn destructo
*/
struct ast_channel *ast_unreal_new_channels(struct ast_unreal_pvt *p,
const struct ast_channel_tech *tech, int semi1_state, int semi2_state,
- const char *exten, const char *context, const struct ast_assigned_ids *assignedids,
+ const char *exten, const char *context, const struct ast_assigned_ids *assignedids,
const struct ast_channel *requestor, ast_callid callid);
/*!
diff --git a/include/asterisk/datastore.h b/include/asterisk/datastore.h
index 85e9c6890..7a7d99be6 100644
--- a/include/asterisk/datastore.h
+++ b/include/asterisk/datastore.h
@@ -69,6 +69,7 @@ struct ast_datastore {
const char *uid; /*!< Unique data store identifier */
void *data; /*!< Contained data */
const struct ast_datastore_info *info; /*!< Data store type information */
+ struct ast_module *mod; /*!< Module referenced by this datastore */
unsigned int inheritance; /*!< Number of levels this item will continue to be inherited */
AST_LIST_ENTRY(ast_datastore) entry; /*!< Used for easy linking */
};
@@ -77,13 +78,16 @@ struct ast_datastore {
* \brief Create a data store object
* \param[in] info information describing the data store object
* \param[in] uid unique identifer
+ * \param[in] mod The module to hold until this datastore is freed.
* \param file, line, function
* \version 1.6.1 moved here and renamed from ast_channel_datastore_alloc
*/
-struct ast_datastore * attribute_malloc __ast_datastore_alloc(const struct ast_datastore_info *info, const char *uid,
- const char *file, int line, const char *function);
+struct ast_datastore *__ast_datastore_alloc(
+ const struct ast_datastore_info *info, const char *uid, struct ast_module *mod,
+ const char *file, int line, const char *function);
-#define ast_datastore_alloc(info, uid) __ast_datastore_alloc(info, uid, __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define ast_datastore_alloc(info, uid) \
+ __ast_datastore_alloc(info, uid, AST_MODULE_SELF, __FILE__, __LINE__, __PRETTY_FUNCTION__)
/*!
* \brief Free a data store object
diff --git a/include/asterisk/devicestate.h b/include/asterisk/devicestate.h
index 4f9aa739b..5b2f04de4 100644
--- a/include/asterisk/devicestate.h
+++ b/include/asterisk/devicestate.h
@@ -86,7 +86,6 @@ enum ast_device_state ast_state_chan2dev(enum ast_channel_state chanstate);
*
* \param devstate Current device state
*/
-const char *devstate2str(enum ast_device_state devstate) attribute_pure __attribute__((deprecated));
const char *ast_devstate2str(enum ast_device_state devstate) attribute_pure;
/*!
@@ -167,41 +166,6 @@ int ast_devstate_changed(enum ast_device_state state, enum ast_devstate_cache ca
int ast_devstate_changed_literal(enum ast_device_state state, enum ast_devstate_cache cachable, const char *device);
/*!
- * \brief Tells Asterisk the State for Device is changed.
- * (Accept change notification, add it to change queue.)
- *
- * \param fmt device name like a dial string with format parameters
- *
- * Asterisk polls the new extension states and calls the registered
- * callbacks for the changed extensions
- *
- * \retval 0 on success
- * \retval -1 on failure
- *
- * \note This is deprecated in favor of ast_devstate_changed()
- * \version 1.6.1 deprecated
- */
-int ast_device_state_changed(const char *fmt, ...)
- __attribute__((deprecated,format(printf, 1, 2)));
-
-/*!
- * \brief Tells Asterisk the State for Device is changed
- *
- * \param device device name like a dial string
- *
- * Asterisk polls the new extension states and calls the registered
- * callbacks for the changed extensions
- *
- * \retval 0 on success
- * \retval -1 on failure
- *
- * \note This is deprecated in favor of ast_devstate_changed_literal()
- * \version 1.6.1 deprecated
- */
-int ast_device_state_changed_literal(const char *device)
- __attribute__((deprecated));
-
-/*!
* \brief Add device state provider
*
* \param label to use in hint, like label:object
diff --git a/include/asterisk/doxygen/architecture.h b/include/asterisk/doxygen/architecture.h
index 0809d6b2e..315187016 100644
--- a/include/asterisk/doxygen/architecture.h
+++ b/include/asterisk/doxygen/architecture.h
@@ -715,4 +715,3 @@ The implementation of this memory debugging system can be found in
<hr>
Return to the \ref ArchTOC
*/
-
diff --git a/include/asterisk/doxygen/licensing.h b/include/asterisk/doxygen/licensing.h
index 27d55bfa0..10e5e4020 100644
--- a/include/asterisk/doxygen/licensing.h
+++ b/include/asterisk/doxygen/licensing.h
@@ -40,7 +40,7 @@
* \arg <b>Website</b>: http://www.openssl.org
* \arg <b>Used by</b>: Asterisk core (TLS for manager and HTTP), res_crypto
* \arg <b>License</b>: Apache 2.0
- * \arg <b>Note</b>: An exception has been granted to allow linking of
+ * \arg <b>Note</b>: An exception has been granted to allow linking of
* OpenSSL with Asterisk.
*
* \subsection curl_lib Curl
diff --git a/include/asterisk/doxyref.h b/include/asterisk/doxyref.h
index f5a87687f..73da18702 100644
--- a/include/asterisk/doxyref.h
+++ b/include/asterisk/doxyref.h
@@ -14,21 +14,21 @@
* at the top of the source tree.
*/
-/*!
+/*!
* \file
*
* This is the main header file used for generating miscellaneous documentation
- * using Doxygen. This also utilizes the documentation in
+ * using Doxygen. This also utilizes the documentation in
* include/asterisk/doxygen/ header files.
*/
-/*
+/*
* The following is for Doxygen Developer's documentation generated
* by running "make progdocs" with doxygen installed on your
* system.
*/
-/*!
+/*!
* \page DevDoc Asterisk Developer's Documentation - Appendices
*
* \section devpolicy Development and Release Policies
@@ -53,7 +53,7 @@
*
* \section debugconfig Debugging and Configuration References
* \arg \ref AstDebug : Hints on debugging
- * \arg \ref extref
+ * \arg \ref extref
* \arg \ref ConfigFiles
* \arg \ref SoundFiles included in the Asterisk distribution
*
@@ -66,7 +66,7 @@
* \arg \b Digium: The Asterisk Company https://www.digium.com
*/
-/*!
+/*!
* \page CodeGuide Coding Guidelines
* \AsteriskTrunkWarning
* \section Coding Guidelines
@@ -75,7 +75,7 @@
* \verbinclude CODING-GUIDELINES
*/
-/*!
+/*!
* \page AstAPI Asterisk API
* \section Asteriskapi Asterisk API
* Some generic documents on the Asterisk architecture
@@ -89,7 +89,7 @@
* \arg See \ref Def_Channel
*/
-/*!
+/*!
* \page AstAPIChanges Asterisk API Changes
*
* \section Changes161 Version 1.6.1
@@ -122,7 +122,7 @@
* \li ast_channel_alloc()
*/
-/*!
+/*!
* \page AstAMI AMI - The Manager Interface
* \section ami AMI - The manager Interface
* \arg \link Config_ami Configuration file \endlink
@@ -133,23 +133,23 @@
/*!
* \page AstARA ARA - The Asterisk Realtime Interface
* \section realtime ARA - a generic API to storage and retrieval
- * Implemented in \ref config.c
- * Implemented in \ref pbx_realtime.c
+ * Implemented in \ref config.c
+ * Implemented in \ref pbx_realtime.c
* \todo include missing realtime txt
* \todo include missing extconfig txt
*/
-/*!
+/*!
* \page AstDUNDi DUNDi
*
- * DUNDi is a peer-to-peer system for locating Internet gateways to telephony
- * services. Unlike traditional centralized services (such as the remarkably
- * simple and concise ENUM standard), DUNDi is fully-distributed with no
+ * DUNDi is a peer-to-peer system for locating Internet gateways to telephony
+ * services. Unlike traditional centralized services (such as the remarkably
+ * simple and concise ENUM standard), DUNDi is fully-distributed with no
* centralized authority whatsoever.
*
- * DUNDi is not itself a Voice-over IP signaling or media protocol. Instead,
- * it publishes routes which are in turn accessed via industry standard
- * protocols such as IAX, SIP and H.323.
+ * DUNDi is not itself a Voice-over IP signaling or media protocol. Instead,
+ * it publishes routes which are in turn accessed via industry standard
+ * protocols such as IAX, SIP and H.323.
*
* \par References
* \arg DUNDi is documented at http://www.dundi.com
@@ -157,7 +157,7 @@
* \arg Configuration in \ref dundi.conf
*/
-/*!
+/*!
* \page AstCDR CDR - Call Data Records and billing
* \section cdr Call Data Records
* \par See also
@@ -168,18 +168,18 @@
* \todo include missing cdrdriver txt
*/
-/*!
+/*!
* \page AstCREDITS CREDITS
* \verbinclude CREDITS
*/
-/*!
+/*!
* \page AstVideo Video support in Asterisk
* \section sectAstVideo Video support in Asterisk
* \todo include missing video txt
*/
-/*!
+/*!
* \page AstVar Globally predefined channel variables
* \section globchan Globally predefined channel variables
*
@@ -193,7 +193,7 @@
*
*/
-/*!
+/*!
* \page AstChanVar Asterisk Dialplan Variables
* Asterisk Dialplan variables are divided into three groups:
* - Predefined global variables, handled by the PBX core
@@ -204,7 +204,7 @@
* Channel variables are only reachable within the channel.
*
* For more information on the predefined variables, see \ref AstVar
- *
+ *
* Global and Channel variables:
* - Names are Case insensitive
* - Names that start with a character, but are alphanumeric
@@ -226,7 +226,7 @@
* Global variables can also be set in the [globals] section of extensions.conf. The
* setting \b clearglobalvars in extensions.conf [general] section affects whether
* or not the global variables defined in \b globals are reset at dialplan reload.
- *
+ *
* There are CLI commands to change and read global variables. This can be handy
* to reset counters at midnight from an external script.
*
@@ -240,7 +240,7 @@
* with the list starting at varshead in struct ast_channel
*/
-/*!
+/*!
* \page Config_mod Modules configuration
* All res_ resource modules are loaded with globals on, which means
* that non-static functions are callable from other modules.
@@ -251,11 +251,11 @@
/*!
* \page Config_ext Extensions.conf - the Dial Plan
- * \section dialplan Extensions.conf
+ * \section dialplan Extensions.conf
* \verbinclude extensions.conf.sample
*/
-/*!
+/*!
* \page Config_rtp RTP configuration
* \arg Implemented in \ref rtp.c
* Used in \ref chan_sip.c and \ref chan_mgcp.c (and various H.323 channels)
@@ -263,27 +263,27 @@
* \verbinclude rtp.conf.sample
*/
-/*!
+/*!
* \page Config_codec CODEC Configuration
* \section codecsconf codecs.conf
* \verbinclude codecs.conf.sample
*/
-/*!
+/*!
* \page Config_ara REALTIME Configuration
* \arg See also: \arg \link AstARA \endlink
* \section extconf extconfig.conf
* \verbinclude extconfig.conf.sample
*/
-/*!
+/*!
* \page Config_ami AMI configuration
* \arg See also: \arg \link AstAMI \endlink
* \section amiconf manager.conf
* \verbinclude manager.conf.sample
*/
-/*!
+/*!
* \page SoundFiles Sound files
* \section SecSound Asterisk Sound files
* Asterisk includes a large number of sound files. Many of these
@@ -308,59 +308,59 @@
/*! \addtogroup configuration_file Configuration Files
*/
-/*!
+/*!
* \addtogroup cdr_drivers Module: CDR Drivers
* \section CDR_generic Asterisk CDR Drivers
- * \brief CDR drivers are loaded dynamically, each loaded CDR driver produce
+ * \brief CDR drivers are loaded dynamically, each loaded CDR driver produce
* a billing record for each call.
* \arg \ref Config_mod "Modules Configuration"
* \arg \ref Config_cdr "CDR Configuration"
*/
-/*!
+/*!
* \addtogroup channel_drivers Module: Asterisk Channel Drivers
* \section channel_generic Asterisk Channel Drivers
- * \brief Channel drivers are loaded dynamically.
+ * \brief Channel drivers are loaded dynamically.
* \arg \ref Config_mod "Modules Configuration"
*/
-/*!
+/*!
* \addtogroup applications Dial plan applications
* \section app_generic Asterisk Dial Plan Applications
- * \brief Applications support the dialplan. They register dynamically with
- * \see ast_register_application() and unregister with
+ * \brief Applications support the dialplan. They register dynamically with
+ * \see ast_register_application() and unregister with
* \see ast_unregister_application()
* \par See also
* \arg \ref functions
*/
-/*!
+/*!
* \addtogroup functions Module: Dial plan functions
* \section func_generic Asterisk Dial Plan Functions
* \brief Functions support the dialplan. They do not change any property of a channel
* or touch a channel in any way.
* \par See also
* \arg \ref applications
- *
+ *
*/
-/*!
+/*!
* \addtogroup codecs Module: Codecs
* \section codec_generic Asterisk Codec Modules
- * Codecs are referenced in configuration files by name
- * \par See also
- * \arg \ref formats
+ * Codecs are referenced in configuration files by name
+ * \par See also
+ * \arg \ref formats
*/
-/*!
- * \addtogroup formats Module: Media File Formats
+/*!
+ * \addtogroup formats Module: Media File Formats
* \section codec_generic Asterisk Format drivers
* Formats are modules that read or write media files to disk.
* \par See also
- * \arg \ref codecs
+ * \arg \ref codecs
*/
-/*!
+/*!
* \addtogroup rtp_engines Module: RTP Engines
* \section rtp_engine_blah Asterisk RTP Engines
*/
diff --git a/include/asterisk/dsp.h b/include/asterisk/dsp.h
index 7e84ebe9c..769d3b981 100644
--- a/include/asterisk/dsp.h
+++ b/include/asterisk/dsp.h
@@ -87,7 +87,7 @@ void ast_dsp_free(struct ast_dsp *dsp);
* created with */
unsigned int ast_dsp_get_sample_rate(const struct ast_dsp *dsp);
-/*! \brief Set threshold value for silence */
+/*! \brief Set the minimum average magnitude threshold to determine talking by the DSP. */
void ast_dsp_set_threshold(struct ast_dsp *dsp, int threshold);
/*! \brief Set number of required cadences for busy */
@@ -106,19 +106,41 @@ int ast_dsp_set_call_progress_zone(struct ast_dsp *dsp, char *zone);
busies, and call progress, all dependent upon which features are enabled */
struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp, struct ast_frame *inf);
-/*! \brief Return non-zero if this is silence. Updates "totalsilence" with the total
- number of seconds of silence */
+/*!
+ * \brief Process the audio frame for silence.
+ *
+ * \param dsp DSP processing audio media.
+ * \param f Audio frame to process.
+ * \param totalsilence Variable to set to the total accumulated silence in ms
+ * seen by the DSP since the last noise.
+ *
+ * \return Non-zero if the frame is silence.
+ */
int ast_dsp_silence(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence);
-/*! \brief Return non-zero if this is silence. Updates "totalsilence" with the total
- number of seconds of silence. Returns the average energy of the samples in the frame
- in frames_energy variable. */
+/*!
+ * \brief Process the audio frame for silence.
+ *
+ * \param dsp DSP processing audio media.
+ * \param f Audio frame to process.
+ * \param totalsilence Variable to set to the total accumulated silence in ms
+ * seen by the DSP since the last noise.
+ * \param frames_energy Variable to set to the average energy of the samples in the frame.
+ *
+ * \return Non-zero if the frame is silence.
+ */
int ast_dsp_silence_with_energy(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence, int *frames_energy);
/*!
- * \brief Return non-zero if this is noise. Updates "totalnoise" with the total
- * number of seconds of noise
+ * \brief Process the audio frame for noise.
* \since 1.6.1
+ *
+ * \param dsp DSP processing audio media.
+ * \param f Audio frame to process.
+ * \param totalnoise Variable to set to the total accumulated noise in ms
+ * seen by the DSP since the last silence.
+ *
+ * \return Non-zero if the frame is silence.
*/
int ast_dsp_noise(struct ast_dsp *dsp, struct ast_frame *f, int *totalnoise);
@@ -171,16 +193,4 @@ int ast_dsp_get_tcount(struct ast_dsp *dsp);
*/
int ast_dsp_get_threshold_from_settings(enum threshold which);
-/*!
- * \brief Reloads dsp settings from dsp.conf
- * \since 1.6.1
- */
-int ast_dsp_reload(void);
-
-/*!
- * \brief Load dsp settings from dsp.conf
- * \since 1.6.1
- */
-int ast_dsp_init(void);
-
#endif /* _ASTERISK_DSP_H */
diff --git a/include/asterisk/dundi.h b/include/asterisk/dundi.h
index 2bffd0246..3f73c1937 100644
--- a/include/asterisk/dundi.h
+++ b/include/asterisk/dundi.h
@@ -21,7 +21,7 @@
* See also \arg \ref AstDUNDi
*/
-#ifndef _ASTERISK_DUNDI_H
+#ifndef _ASTERISK_DUNDI_H
#define _ASTERISK_DUNDI_H
#include "asterisk/channel.h"
@@ -131,7 +131,7 @@ enum {
DUNDI_CAUSE_BADENCRYPT = 7,
};
-struct dundi_cause {
+struct dundi_cause {
unsigned char causecode; /*!< Numerical cause (DUNDI_CAUSE_*) */
char desc[0]; /*!< Textual description */
} __attribute__((__packed__));
@@ -240,16 +240,16 @@ struct dundi_entity_info {
char org[80];
char orgunit[80];
char email[80];
- char phone[80];
+ char phone[80];
char ipaddr[80];
};
-/*!
+/*!
* \brief Lookup the given number in the given dundi context.
- * Lookup number in a given dundi context (if unspecified use e164), the given callerid (if specified)
+ * Lookup number in a given dundi context (if unspecified use e164), the given callerid (if specified)
* and return up to maxret results in the array specified.
* \retval the number of results found.
- * \retval -1 on a hangup of the channel.
+ * \retval -1 on a hangup of the channel.
*/
int dundi_lookup(struct dundi_result *result, int maxret, struct ast_channel *chan, const char *dcontext, const char *number, int nocache);
diff --git a/include/asterisk/endian.h b/include/asterisk/endian.h
index a1f388c71..fd3eb60f0 100644
--- a/include/asterisk/endian.h
+++ b/include/asterisk/endian.h
@@ -70,4 +70,3 @@
#endif /* __BYTE_ORDER */
#endif /* _ASTERISK_ENDIAN_H */
-
diff --git a/include/asterisk/enum.h b/include/asterisk/enum.h
index 877c0c3cf..2ce85ccb3 100644
--- a/include/asterisk/enum.h
+++ b/include/asterisk/enum.h
@@ -97,7 +97,4 @@ int ast_get_enum(struct ast_channel *chan, const char *number, char *location, i
*/
int ast_get_txt(struct ast_channel *chan, const char *number, char *txt, int maxtxt, char *suffix);
-int ast_enum_init(void);
-int ast_enum_reload(void);
-
#endif /* _ASTERISK_ENUM_H */
diff --git a/include/asterisk/event_defs.h b/include/asterisk/event_defs.h
index 2d5c75a44..fd8330e80 100644
--- a/include/asterisk/event_defs.h
+++ b/include/asterisk/event_defs.h
@@ -83,7 +83,7 @@ enum ast_event_ie_type {
AST_EVENT_IE_OLDMSGS = 0x0002,
/*!
* \brief Mailbox name \verbatim (mailbox[@context]) \endverbatim
- * Used by: AST_EVENT_MWI
+ * Used by: AST_EVENT_MWI
* Payload type: STR
*/
AST_EVENT_IE_MAILBOX = 0x0003,
diff --git a/include/asterisk/features_config.h b/include/asterisk/features_config.h
index 1bce50bba..cd1bbbcea 100644
--- a/include/asterisk/features_config.h
+++ b/include/asterisk/features_config.h
@@ -265,10 +265,4 @@ struct ast_applicationmap_item {
*/
struct ao2_container *ast_get_chan_applicationmap(struct ast_channel *chan);
-void ast_features_config_shutdown(void);
-
-int ast_features_config_reload(void);
-
-int ast_features_config_init(void);
-
#endif /* _FEATURES_CONFIG_H */
diff --git a/include/asterisk/file.h b/include/asterisk/file.h
index 01e5797f5..c17cb327b 100644
--- a/include/asterisk/file.h
+++ b/include/asterisk/file.h
@@ -99,8 +99,8 @@ int ast_stream_and_wait(struct ast_channel *chan, const char *file, const char *
*/
int ast_stopstream(struct ast_channel *c);
-/*!
- * \brief Checks for the existence of a given file
+/*!
+ * \brief Checks for the existence of a given file
* \param filename name of the file you wish to check, minus the extension
* \param fmt the format you wish to check (the extension)
* \param preflang (the preferred language you wisht to find the file in)
@@ -110,12 +110,12 @@ int ast_stopstream(struct ast_channel *c);
*/
int ast_fileexists(const char *filename, const char *fmt, const char *preflang);
-/*!
- * \brief Renames a file
+/*!
+ * \brief Renames a file
* \param oldname the name of the file you wish to act upon (minus the extension)
* \param newname the name you wish to rename the file to (minus the extension)
* \param fmt the format of the file
- * Rename a given file in a given format, or if fmt is NULL, then do so for all
+ * Rename a given file in a given format, or if fmt is NULL, then do so for all
* \return -1 on failure
*/
int ast_filerename(const char *oldname, const char *newname, const char *fmt);
@@ -124,16 +124,16 @@ int ast_filerename(const char *oldname, const char *newname, const char *fmt);
* \brief Deletes a file
* \param filename name of the file you wish to delete (minus the extension)
* \param fmt of the file
- * Delete a given file in a given format, or if fmt is NULL, then do so for all
+ * Delete a given file in a given format, or if fmt is NULL, then do so for all
*/
int ast_filedelete(const char *filename, const char *fmt);
-/*!
- * \brief Copies a file
+/*!
+ * \brief Copies a file
* \param oldname name of the file you wish to copy (minus extension)
* \param newname name you wish the file to be copied to (minus extension)
* \param fmt the format of the file
- * Copy a given file in a given format, or if fmt is NULL, then do so for all
+ * Copy a given file in a given format, or if fmt is NULL, then do so for all
*/
int ast_filecopy(const char *oldname, const char *newname, const char *fmt);
@@ -143,6 +143,11 @@ int ast_filecopy(const char *oldname, const char *newname, const char *fmt);
* \param filename the name of the file
* \param obj user data object
* \return non-zero to stop reading, otherwise zero to continue
+ *
+ * \note dir_name is not processed by realpath or other functions,
+ * symbolic links are not resolved. This ensures dir_name
+ * always starts with the exact string originally passed to
+ * \ref ast_file_read_dir or \ref ast_file_read_dirs.
*/
typedef int (*ast_file_on_file)(const char *dir_name, const char *filename, void *obj);
@@ -229,13 +234,13 @@ int ast_waitstream_fr_w_cb(struct ast_channel *c,
ast_waitstream_fr_cb cb);
/*!
- * Same as waitstream, but with audio output to fd and monitored fd checking.
+ * Same as waitstream, but with audio output to fd and monitored fd checking.
*
- * \return 1 if monfd is ready for reading
+ * \return 1 if monfd is ready for reading
*/
int ast_waitstream_full(struct ast_channel *c, const char *breakon, int audiofd, int monfd);
-/*!
+/*!
* \brief Starts reading from a file
* \param filename the name of the file to read from
* \param type format of file you wish to read from
@@ -243,8 +248,8 @@ int ast_waitstream_full(struct ast_channel *c, const char *breakon, int audiofd,
* \param flags file flags
* \param check (unimplemented, hence negligible)
* \param mode Open mode
- * Open an incoming file stream. flags are flags for the open() command, and
- * if check is non-zero, then it will not read a file if there are any files that
+ * Open an incoming file stream. flags are flags for the open() command, and
+ * if check is non-zero, then it will not read a file if there are any files that
* start with that name and have an extension
* Please note, this is a blocking function. Program execution will not return until ast_waitstream completes it's execution.
* \retval a struct ast_filestream on success.
@@ -252,16 +257,16 @@ int ast_waitstream_full(struct ast_channel *c, const char *breakon, int audiofd,
*/
struct ast_filestream *ast_readfile(const char *filename, const char *type, const char *comment, int flags, int check, mode_t mode);
-/*!
- * \brief Starts writing a file
+/*!
+ * \brief Starts writing a file
* \param filename the name of the file to write to
* \param type format of file you wish to write out to
* \param comment comment to go with
* \param flags output file flags
* \param check (unimplemented, hence negligible)
* \param mode Open mode
- * Create an outgoing file stream. oflags are flags for the open() command, and
- * if check is non-zero, then it will not write a file if there are any files that
+ * Create an outgoing file stream. oflags are flags for the open() command, and
+ * if check is non-zero, then it will not write a file if there are any files that
* start with that name and have an extension
* Please note, this is a blocking function. Program execution will not return until ast_waitstream completes it's execution.
* \retval a struct ast_filestream on success.
@@ -269,8 +274,8 @@ struct ast_filestream *ast_readfile(const char *filename, const char *type, cons
*/
struct ast_filestream *ast_writefile(const char *filename, const char *type, const char *comment, int flags, int check, mode_t mode);
-/*!
- * \brief Writes a frame to a stream
+/*!
+ * \brief Writes a frame to a stream
* \param fs filestream to write to
* \param f frame to write to the filestream
* Send a frame to a filestream -- note: does NOT free the frame, call ast_frfree manually
@@ -279,8 +284,8 @@ struct ast_filestream *ast_writefile(const char *filename, const char *type, con
*/
int ast_writestream(struct ast_filestream *fs, struct ast_frame *f);
-/*!
- * \brief Closes a stream
+/*!
+ * \brief Closes a stream
* \param f filestream to close
* Close a playback or recording stream
* \retval 0 on success.
@@ -288,8 +293,8 @@ int ast_writestream(struct ast_filestream *fs, struct ast_frame *f);
*/
int ast_closestream(struct ast_filestream *f);
-/*!
- * \brief Opens stream for use in seeking, playing
+/*!
+ * \brief Opens stream for use in seeking, playing
* \param chan channel to work with
* \param filename to use
* \param preflang prefered language to use
@@ -298,8 +303,8 @@ int ast_closestream(struct ast_filestream *f);
*/
struct ast_filestream *ast_openstream(struct ast_channel *chan, const char *filename, const char *preflang);
-/*!
- * \brief Opens stream for use in seeking, playing
+/*!
+ * \brief Opens stream for use in seeking, playing
* \param chan channel to work with
* \param filename to use
* \param preflang prefered language to use
@@ -308,8 +313,8 @@ struct ast_filestream *ast_openstream(struct ast_channel *chan, const char *file
* \retval NULL on error.
*/
struct ast_filestream *ast_openstream_full(struct ast_channel *chan, const char *filename, const char *preflang, int asis);
-/*!
- * \brief Opens stream for use in seeking, playing
+/*!
+ * \brief Opens stream for use in seeking, playing
* \param chan channel to work with
* \param filename to use
* \param preflang prefered language to use
@@ -318,8 +323,8 @@ struct ast_filestream *ast_openstream_full(struct ast_channel *chan, const char
*/
struct ast_filestream *ast_openvstream(struct ast_channel *chan, const char *filename, const char *preflang);
-/*!
- * \brief Applys a open stream to a channel.
+/*!
+ * \brief Applys a open stream to a channel.
* \param chan channel to work
* \param s ast_filestream to apply
* \retval 0 on success.
@@ -327,34 +332,34 @@ struct ast_filestream *ast_openvstream(struct ast_channel *chan, const char *fil
*/
int ast_applystream(struct ast_channel *chan, struct ast_filestream *s);
-/*!
- * \brief Play a open stream on a channel.
+/*!
+ * \brief Play a open stream on a channel.
* \param s filestream to play
* \retval 0 on success.
* \retval -1 on failure.
*/
int ast_playstream(struct ast_filestream *s);
-/*!
- * \brief Seeks into stream
+/*!
+ * \brief Seeks into stream
* \param fs ast_filestream to perform seek on
* \param sample_offset numbers of samples to seek
- * \param whence SEEK_SET, SEEK_CUR, SEEK_END
+ * \param whence SEEK_SET, SEEK_CUR, SEEK_END
* \retval 0 on success.
* \retval -1 on failure.
*/
int ast_seekstream(struct ast_filestream *fs, off_t sample_offset, int whence);
-/*!
- * \brief Trunc stream at current location
+/*!
+ * \brief Trunc stream at current location
* \param fs filestream to act on
* \retval 0 on success.
* \retval -1 on failure.
*/
int ast_truncstream(struct ast_filestream *fs);
-/*!
- * \brief Fast forward stream ms
+/*!
+ * \brief Fast forward stream ms
* \param fs filestream to act on
* \param ms milliseconds to move
* \retval 0 on success.
@@ -362,8 +367,8 @@ int ast_truncstream(struct ast_filestream *fs);
*/
int ast_stream_fastforward(struct ast_filestream *fs, off_t ms);
-/*!
- * \brief Rewind stream ms
+/*!
+ * \brief Rewind stream ms
* \param fs filestream to act on
* \param ms milliseconds to move
* \retval 0 on success.
@@ -371,8 +376,8 @@ int ast_stream_fastforward(struct ast_filestream *fs, off_t ms);
*/
int ast_stream_rewind(struct ast_filestream *fs, off_t ms);
-/*!
- * \brief Tell where we are in a stream
+/*!
+ * \brief Tell where we are in a stream
* \param fs fs to act on
* \return a long as a sample offset into stream
*/
@@ -385,12 +390,12 @@ off_t ast_tellstream(struct ast_filestream *fs);
*/
int ast_ratestream(struct ast_filestream *fs);
-/*!
- * \brief Read a frame from a filestream
+/*!
+ * \brief Read a frame from a filestream
* \param s ast_filestream to act on
* \return a frame.
* \retval NULL if read failed.
- */
+ */
struct ast_frame *ast_readframe(struct ast_filestream *s);
/*! Initialize file stuff */
diff --git a/include/asterisk/format.h b/include/asterisk/format.h
index 946c03d98..62fb1ef26 100644
--- a/include/asterisk/format.h
+++ b/include/asterisk/format.h
@@ -71,7 +71,7 @@ struct ast_format_interface {
enum ast_format_cmp_res (* const format_cmp)(const struct ast_format *format1,
const struct ast_format *format2);
- /*!
+ /*!
* \brief Get a format with the joint compatible attributes of both provided formats.
*
* \param format1 The first format
diff --git a/include/asterisk/framehook.h b/include/asterisk/framehook.h
index d388f2e1b..8e5afaeae 100644
--- a/include/asterisk/framehook.h
+++ b/include/asterisk/framehook.h
@@ -162,7 +162,7 @@ enum ast_framehook_event {
* \details Two events are guaranteed to occur once the ast_framehook_attach()
* function is called. These events are AST_FRAMEHOOK_EVENT_ATTACHED, which occurs
* immediately after the framehook is attached to a channel, and
- * AST_FRAMEHOOK_EVENT_DETACHED, which occurs right after the framehook is
+ * AST_FRAMEHOOK_EVENT_DETACHED, which occurs right after the framehook is
* detached.
*
* It is completely valid for the frame variable to be set to NULL. Always do a NULL
@@ -276,7 +276,7 @@ int ast_framehook_attach(struct ast_channel *chan, struct ast_framehook_interfac
/*!
* \brief Detach an framehook from a channel.
* \since 1.8
- *
+ *
* \pre The Channel must be locked during this function call.
* If this function is never called after attaching an framehook,
* the framehook will be detached and destroyed during channel
@@ -297,7 +297,7 @@ int ast_framehook_detach(struct ast_channel *chan, int framehook_id);
* \since 1.8
*
* \pre The Channel must be locked during this function call.
- *
+ *
* \param chan channel containing the framehook list to destroy.
* \retval 0 success
* \retval -1 failure
diff --git a/include/asterisk/fskmodem.h b/include/asterisk/fskmodem.h
index 81d4e386f..dcbf94630 100644
--- a/include/asterisk/fskmodem.h
+++ b/include/asterisk/fskmodem.h
@@ -28,4 +28,3 @@
#else
#include "fskmodem_float.h"
#endif
-
diff --git a/include/asterisk/fskmodem_int.h b/include/asterisk/fskmodem_int.h
index d50e8abde..6a4db8bc8 100644
--- a/include/asterisk/fskmodem_int.h
+++ b/include/asterisk/fskmodem_int.h
@@ -48,7 +48,7 @@ typedef struct {
int xi0;
int xi1;
int xi2;
-
+
int ispb;
int icont;
int bw; /*!< Band Selector*/
@@ -59,7 +59,7 @@ typedef struct {
int pllispb; /*!<Pll autosense */
int pllids;
int pllispb2;
-
+
struct filter_struct mark_filter;
struct filter_struct space_filter;
struct filter_struct demod_filter;
diff --git a/include/asterisk/hashtab.h b/include/asterisk/hashtab.h
index cfe035b28..64ed1bf6f 100644
--- a/include/asterisk/hashtab.h
+++ b/include/asterisk/hashtab.h
@@ -251,22 +251,15 @@ unsigned int ast_hashtab_hash_short(const short num);
* \param hash a func ptr to do the hashing
* \param do_locking use locks to guarantee safety of iterators/insertion/deletion -- real simpleminded right now
*/
-#ifdef __AST_DEBUG_MALLOC
-struct ast_hashtab * _ast_hashtab_create(int initial_buckets,
- int (*compare)(const void *a, const void *b),
- int (*resize)(struct ast_hashtab *),
- int (*newsize)(struct ast_hashtab *tab),
- unsigned int (*hash)(const void *obj),
- int do_locking, const char *file, int lineno, const char *function);
-#define ast_hashtab_create(a,b,c,d,e,f) _ast_hashtab_create(a,b,c,d,e,f,__FILE__,__LINE__,__PRETTY_FUNCTION__)
-#else
-struct ast_hashtab * ast_hashtab_create(int initial_buckets,
- int (*compare)(const void *a, const void *b),
- int (*resize)(struct ast_hashtab *),
- int (*newsize)(struct ast_hashtab *tab),
- unsigned int (*hash)(const void *obj),
- int do_locking );
-#endif
+struct ast_hashtab *_ast_hashtab_create(int initial_buckets,
+ int (*compare)(const void *a, const void *b),
+ int (*resize)(struct ast_hashtab *),
+ int (*newsize)(struct ast_hashtab *tab),
+ unsigned int (*hash)(const void *obj),
+ int do_locking,
+ const char *file, int lineno, const char *function);
+#define ast_hashtab_create(initial_buckets, compare, resize, newsize, hash, do_locking) \
+ _ast_hashtab_create(initial_buckets, compare, resize, newsize, hash, do_locking, __FILE__, __LINE__, __PRETTY_FUNCTION__)
/*!
* \brief This func will free the hash table and all its memory.
@@ -294,12 +287,9 @@ void ast_hashtab_destroy( struct ast_hashtab *tab, void (*objdestroyfunc)(void *
* \retval 1 on success
* \retval 0 if there's a problem
*/
-#ifdef __AST_DEBUG_MALLOC
int _ast_hashtab_insert_immediate(struct ast_hashtab *tab, const void *obj, const char *file, int lineno, const char *func);
-#define ast_hashtab_insert_immediate(a,b) _ast_hashtab_insert_immediate(a, b, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-#else
-int ast_hashtab_insert_immediate(struct ast_hashtab *tab, const void *obj);
-#endif
+#define ast_hashtab_insert_immediate(tab, obj) \
+ _ast_hashtab_insert_immediate(tab, obj, __FILE__, __LINE__, __PRETTY_FUNCTION__)
/*!
* \brief Insert without checking, hashing or locking
@@ -311,12 +301,9 @@ int ast_hashtab_insert_immediate(struct ast_hashtab *tab, const void *obj);
* \retval 1 on success
* \retval 0 if there's a problem
*/
-#ifdef __AST_DEBUG_MALLOC
int _ast_hashtab_insert_immediate_bucket(struct ast_hashtab *tab, const void *obj, unsigned int h, const char *file, int lineno, const char *func);
-#define ast_hashtab_insert_immediate_bucket(a,b,c) _ast_hashtab_insert_immediate_bucket(a, b, c, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-#else
-int ast_hashtab_insert_immediate_bucket(struct ast_hashtab *tab, const void *obj, unsigned int h);
-#endif
+#define ast_hashtab_insert_immediate_bucket(tab, obj, h) \
+ _ast_hashtab_insert_immediate_bucket(tab, obj, h, __FILE__, __LINE__, __PRETTY_FUNCTION__)
/*!
* \brief Check and insert new object only if it is not there.
@@ -324,12 +311,9 @@ int ast_hashtab_insert_immediate_bucket(struct ast_hashtab *tab, const void *obj
* \retval 1 on success
* \retval 0 if there's a problem, or it's already there.
*/
-#ifdef __AST_DEBUG_MALLOC
int _ast_hashtab_insert_safe(struct ast_hashtab *tab, const void *obj, const char *file, int lineno, const char *func);
-#define ast_hashtab_insert_safe(a,b) _ast_hashtab_insert_safe(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__)
-#else
-int ast_hashtab_insert_safe(struct ast_hashtab *tab, const void *obj);
-#endif
+#define ast_hashtab_insert_safe(tab, obj) \
+ _ast_hashtab_insert_safe(tab, obj, __FILE__, __LINE__, __PRETTY_FUNCTION__)
/*!
* \brief Lookup this object in the hash table.
@@ -362,20 +346,14 @@ int ast_hashtab_size( struct ast_hashtab *tab);
int ast_hashtab_capacity( struct ast_hashtab *tab);
/*! \brief Return a copy of the hash table */
-#ifdef __AST_DEBUG_MALLOC
struct ast_hashtab *_ast_hashtab_dup(struct ast_hashtab *tab, void *(*obj_dup_func)(const void *obj), const char *file, int lineno, const char *func);
-#define ast_hashtab_dup(a,b) _ast_hashtab_dup(a,b,__FILE__,__LINE__,__PRETTY_FUNCTION__)
-#else
-struct ast_hashtab *ast_hashtab_dup(struct ast_hashtab *tab, void *(*obj_dup_func)(const void *obj));
-#endif
+#define ast_hashtab_dup(tab, obj_dup_func) \
+ _ast_hashtab_dup(tab, obj_dup_func, __FILE__, __LINE__, __PRETTY_FUNCTION__)
/*! \brief Gives an iterator to hastable */
-#ifdef __AST_DEBUG_MALLOC
struct ast_hashtab_iter *_ast_hashtab_start_traversal(struct ast_hashtab *tab, const char *file, int lineno, const char *func);
-#define ast_hashtab_start_traversal(a) _ast_hashtab_start_traversal(a,__FILE__,__LINE__,__PRETTY_FUNCTION__)
-#else
-struct ast_hashtab_iter *ast_hashtab_start_traversal(struct ast_hashtab *tab);
-#endif
+#define ast_hashtab_start_traversal(tab) \
+ _ast_hashtab_start_traversal(tab, __FILE__, __LINE__, __PRETTY_FUNCTION__)
/*! \brief end the traversal, free the iterator, unlock if necc. */
void ast_hashtab_end_traversal(struct ast_hashtab_iter *it);
@@ -395,12 +373,9 @@ void *ast_hashtab_remove_this_object(struct ast_hashtab *tab, void *obj);
/* ------------------ */
/*! \brief Gives an iterator to hastable */
-#ifdef __AST_DEBUG_MALLOC
struct ast_hashtab_iter *_ast_hashtab_start_write_traversal(struct ast_hashtab *tab, const char *file, int lineno, const char *func);
-#define ast_hashtab_start_write_traversal(a) _ast_hashtab_start_write_traversal(a,__FILE__,__LINE__,__PRETTY_FUNCTION__)
-#else
-struct ast_hashtab_iter *ast_hashtab_start_write_traversal(struct ast_hashtab *tab);
-#endif
+#define ast_hashtab_start_write_traversal(tab) \
+ _ast_hashtab_start_write_traversal(tab, __FILE__, __LINE__, __PRETTY_FUNCTION__)
/*! \brief Looks up the object, removes the corresponding bucket */
void *ast_hashtab_remove_object_via_lookup_nolock(struct ast_hashtab *tab, void *obj);
diff --git a/include/asterisk/heap.h b/include/asterisk/heap.h
index 728327936..83c69a8d6 100644
--- a/include/asterisk/heap.h
+++ b/include/asterisk/heap.h
@@ -97,14 +97,10 @@ typedef int (*ast_heap_cmp_fn)(void *elm1, void *elm2);
* \return An instance of a max heap
* \since 1.6.1
*/
-#ifdef __AST_DEBUG_MALLOC
struct ast_heap *_ast_heap_create(unsigned int init_height, ast_heap_cmp_fn cmp_fn,
ssize_t index_offset, const char *file, int lineno, const char *func);
-#define ast_heap_create(a,b,c) _ast_heap_create(a,b,c,__FILE__,__LINE__,__PRETTY_FUNCTION__)
-#else
-struct ast_heap *ast_heap_create(unsigned int init_height, ast_heap_cmp_fn cmp_fn,
- ssize_t index_offset);
-#endif
+#define ast_heap_create(init_height, cmp_fn, index_offset) \
+ _ast_heap_create(init_height, cmp_fn, index_offset, __FILE__, __LINE__, __PRETTY_FUNCTION__)
/*!
* \brief Destroy a max heap
@@ -126,12 +122,9 @@ struct ast_heap *ast_heap_destroy(struct ast_heap *h);
* \retval non-zero failure
* \since 1.6.1
*/
-#ifdef __AST_DEBUG_MALLOC
int _ast_heap_push(struct ast_heap *h, void *elm, const char *file, int lineno, const char *func);
-#define ast_heap_push(a,b) _ast_heap_push(a,b,__FILE__,__LINE__,__PRETTY_FUNCTION__)
-#else
-int ast_heap_push(struct ast_heap *h, void *elm);
-#endif
+#define ast_heap_push(h, elm) \
+ _ast_heap_push(h, elm, __FILE__, __LINE__, __PRETTY_FUNCTION__)
/*!
* \brief Pop the max element off of the heap
diff --git a/include/asterisk/http.h b/include/asterisk/http.h
index d5f54cc65..63fb223bf 100644
--- a/include/asterisk/http.h
+++ b/include/asterisk/http.h
@@ -316,7 +316,7 @@ int ast_http_response_status_line(const char *buf, const char *version, int code
* \param name out parameter pointing to the header name
* \param value out parameter pointing to header value
* \return -1 if buf is empty
- * \return 0 if buf could be separated into into name and value
+ * \return 0 if buf could be separated into name and value
* \return 1 if name or value portion don't exist
* \since 13
*/
diff --git a/include/asterisk/image.h b/include/asterisk/image.h
index 9e358ad52..f159b41c7 100644
--- a/include/asterisk/image.h
+++ b/include/asterisk/image.h
@@ -35,16 +35,16 @@ struct ast_imager {
AST_LIST_ENTRY(ast_imager) list; /*!< For linked list */
};
-/*!
- * \brief Check for image support on a channel
+/*!
+ * \brief Check for image support on a channel
* \param chan channel to check
* Checks the channel to see if it supports the transmission of images
* \return non-zero if image transmission is supported
*/
int ast_supports_images(struct ast_channel *chan);
-/*!
- * \brief Sends an image
+/*!
+ * \brief Sends an image
* \param chan channel to send image on
* \param filename filename of image to send (minus extension)
* Sends an image on the given channel.
@@ -53,8 +53,8 @@ int ast_supports_images(struct ast_channel *chan);
*/
int ast_send_image(struct ast_channel *chan, const char *filename);
-/*!
- * \brief Make an image
+/*!
+ * \brief Make an image
* \param filename filename of image to prepare
* \param preflang preferred language to get the image...?
* \param format the format of the file, NULL for any image format
@@ -64,7 +64,7 @@ int ast_send_image(struct ast_channel *chan, const char *filename);
*/
struct ast_frame *ast_read_image(const char *filename, const char *preflang, struct ast_format *format);
-/*!
+/*!
* \brief Register image format
* \param imgdrv Populated ast_imager structure with info to register
* Registers an image format
@@ -72,15 +72,15 @@ struct ast_frame *ast_read_image(const char *filename, const char *preflang, str
*/
int ast_image_register(struct ast_imager *imgdrv);
-/*!
- * \brief Unregister an image format
+/*!
+ * \brief Unregister an image format
* \param imgdrv pointer to the ast_imager structure you wish to unregister
* Unregisters the image format passed in.
* Returns nothing
*/
void ast_image_unregister(struct ast_imager *imgdrv);
-/*!
+/*!
* \brief Initialize image stuff
* Initializes all the various image stuff. Basically just registers the cli stuff
* \return 0 all the time
diff --git a/include/asterisk/indications.h b/include/asterisk/indications.h
index 309954b05..e72ff0816 100644
--- a/include/asterisk/indications.h
+++ b/include/asterisk/indications.h
@@ -74,7 +74,7 @@ struct ast_tone_zone_sound {
struct ast_tone_zone {
/*! \brief Country code that this set of tones is for */
char country[MAX_TONEZONE_COUNTRY];
- /*!
+ /*!
* \brief Text description of the given country.
*
* This is for nothing more than friendly display to a human.
@@ -82,7 +82,7 @@ struct ast_tone_zone {
char description[40];
/*! \brief Number of ring cadence elements in the ringcadence array */
unsigned int nrringcadence;
- /*!
+ /*!
* \brief Array of ring cadence parts
*
* Each element is an amount of time in milliseconds. The first element
diff --git a/include/asterisk/io.h b/include/asterisk/io.h
index f103cf556..e9b155985 100644
--- a/include/asterisk/io.h
+++ b/include/asterisk/io.h
@@ -53,16 +53,16 @@ extern "C" {
struct io_context;
-/*!
- * \brief Creates a context
+/*!
+ * \brief Creates a context
* Create a context for I/O operations
* Basically mallocs an IO structure and sets up some default values.
* \return an allocated io_context structure
*/
struct io_context *io_context_create(void);
-/*!
- * \brief Destroys a context
+/*!
+ * \brief Destroys a context
* \param ioc structure to destroy
* Destroy a context for I/O operations
* Frees all memory associated with the given io_context structure along with the structure itself
@@ -72,57 +72,57 @@ void io_context_destroy(struct io_context *ioc);
typedef int (*ast_io_cb)(int *id, int fd, short events, void *cbdata);
#define AST_IO_CB(a) ((ast_io_cb)(a))
-/*!
- * \brief Adds an IO context
+/*!
+ * \brief Adds an IO context
* \param ioc which context to use
* \param fd which fd to monitor
* \param callback callback function to run
* \param events event mask of events to wait for
* \param data data to pass to the callback
* Watch for any of revents activites on fd, calling callback with data as
- * callback data.
+ * callback data.
* \retval a pointer to ID of the IO event
* \retval NULL on failure
*/
int *ast_io_add(struct io_context *ioc, int fd, ast_io_cb callback, short events, void *data);
-/*!
- * \brief Changes an IO handler
+/*!
+ * \brief Changes an IO handler
* \param ioc which context to use
* \param id
* \param fd the fd you wish it to contain now
* \param callback new callback function
* \param events event mask to wait for
* \param data data to pass to the callback function
- * Change an I/O handler, updating fd if > -1, callback if non-null,
+ * Change an I/O handler, updating fd if > -1, callback if non-null,
* and revents if >-1, and data if non-null.
* \retval a pointer to the ID of the IO event
* \retval NULL on failure
*/
int *ast_io_change(struct io_context *ioc, int *id, int fd, ast_io_cb callback, short events, void *data);
-/*!
- * \brief Removes an IO context
+/*!
+ * \brief Removes an IO context
* \param ioc which io_context to remove it from
* \param id which ID to remove
- * Remove an I/O id from consideration
+ * Remove an I/O id from consideration
* \retval 0 on success
* \retval -1 on failure
*/
int ast_io_remove(struct io_context *ioc, int *id);
-/*!
- * \brief Waits for IO
+/*!
+ * \brief Waits for IO
* \param ioc which context to act upon
* \param howlong how many milliseconds to wait
* Wait for I/O to happen, returning after
* howlong milliseconds, and after processing
- * any necessary I/O.
+ * any necessary I/O.
* \return he number of I/O events which took place.
*/
int ast_io_wait(struct io_context *ioc, int howlong);
-/*!
+/*!
* \brief Dumps the IO array.
* Debugging: Dump everything in the I/O array
*/
@@ -132,7 +132,7 @@ void ast_io_dump(struct io_context *ioc);
int ast_hide_password(int fd);
-/*!
+/*!
* \brief Restores TTY mode.
* Call with result from previous ast_hide_password
*/
diff --git a/include/asterisk/linkedlists.h b/include/asterisk/linkedlists.h
index 8715cf1ad..5f50c7535 100644
--- a/include/asterisk/linkedlists.h
+++ b/include/asterisk/linkedlists.h
@@ -854,7 +854,7 @@ struct { \
*/
#define AST_LIST_REMOVE(head, elm, field) \
({ \
- __typeof(elm) __elm = (elm); \
+ typeof(elm) __elm = (elm); \
if (__elm) { \
if ((head)->first == __elm) { \
(head)->first = __elm->field.next; \
diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h
index 58c9a8383..a46d04799 100644
--- a/include/asterisk/lock.h
+++ b/include/asterisk/lock.h
@@ -617,97 +617,130 @@ static void __attribute__((destructor)) fini_##rwlock(void) \
#define pthread_create __use_ast_pthread_create_instead__
#endif
-/*
- * Support for atomic instructions.
- * For platforms that have it, use the native cpu instruction to
- * implement them. For other platforms, resort to a 'slow' version
- * (defined in utils.c) that protects the atomic instruction with
- * a single lock.
- * The slow versions is always available, for testing purposes,
- * as ast_atomic_fetchadd_int_slow()
+/*!
+ * \brief Support for atomic instructions.
+ *
+ * These macros implement a uniform interface to use built-in atomic functionality.
+ * If available __atomic built-ins are prefered. Legacy __sync built-ins are used
+ * as a fallback for older compilers.
+ *
+ * Detailed documentation can be found in the GCC manual, all API's are modeled after
+ * the __atomic interfaces but using the namespace ast_atomic.
+ *
+ * The memorder argument is always ignored by legacy __sync functions. Invalid
+ * memorder arguments do not produce errors unless __atomic functions are supported
+ * as the argument is erased by the preprocessor.
+ *
+ * \note ast_atomic_fetch_nand and ast_atomic_nand_fetch purposely do not exist.
+ * It's implementation was broken prior to gcc-4.4.
+ *
+ * @{
*/
-int ast_atomic_fetchadd_int_slow(volatile int *p, int v);
-
#include "asterisk/inline_api.h"
-#if defined(HAVE_OSX_ATOMICS)
-#include "libkern/OSAtomic.h"
+#if defined(HAVE_C_ATOMICS)
+/*! Atomic += */
+#define ast_atomic_fetch_add(ptr, val, memorder) __atomic_fetch_add((ptr), (val), (memorder))
+#define ast_atomic_add_fetch(ptr, val, memorder) __atomic_add_fetch((ptr), (val), (memorder))
+
+/*! Atomic -= */
+#define ast_atomic_fetch_sub(ptr, val, memorder) __atomic_fetch_sub((ptr), (val), (memorder))
+#define ast_atomic_sub_fetch(ptr, val, memorder) __atomic_sub_fetch((ptr), (val), (memorder))
+
+/*! Atomic &= */
+#define ast_atomic_fetch_and(ptr, val, memorder) __atomic_fetch_and((ptr), (val), (memorder))
+#define ast_atomic_and_fetch(ptr, val, memorder) __atomic_and_fetch((ptr), (val), (memorder))
+
+/*! Atomic |= */
+#define ast_atomic_fetch_or(ptr, val, memorder) __atomic_fetch_or((ptr), (val), (memorder))
+#define ast_atomic_or_fetch(ptr, val, memorder) __atomic_or_fetch((ptr), (val), (memorder))
+
+/*! Atomic xor = */
+#define ast_atomic_fetch_xor(ptr, val, memorder) __atomic_fetch_xor((ptr), (val), (memorder))
+#define ast_atomic_xor_fetch(ptr, val, memorder) __atomic_xor_fetch((ptr), (val), (memorder))
+
+#if 0
+/* Atomic compare and swap
+ *
+ * See comments near the __atomic implementation for why this is disabled.
+ */
+#define ast_atomic_compare_exchange_n(ptr, expected, desired, success_memorder, failure_memorder) \
+ __atomic_compare_exchange_n((ptr), (expected), (desired), 0, success_memorder, failure_memorder)
+
+#define ast_atomic_compare_exchange(ptr, expected, desired, success_memorder, failure_memorder) \
+ __atomic_compare_exchange((ptr), (expected), (desired), 0, success_memorder, failure_memorder)
#endif
-/*! \brief Atomically add v to *p and return * the previous value of *p.
- * This can be used to handle reference counts, and the return value
- * can be used to generate unique identifiers.
+#elif defined(HAVE_GCC_ATOMICS)
+/*! Atomic += */
+#define ast_atomic_fetch_add(ptr, val, memorder) __sync_fetch_and_add((ptr), (val))
+#define ast_atomic_add_fetch(ptr, val, memorder) __sync_add_and_fetch((ptr), (val))
+
+/*! Atomic -= */
+#define ast_atomic_fetch_sub(ptr, val, memorder) __sync_fetch_and_sub((ptr), (val))
+#define ast_atomic_sub_fetch(ptr, val, memorder) __sync_sub_and_fetch((ptr), (val))
+
+/*! Atomic &= */
+#define ast_atomic_fetch_and(ptr, val, memorder) __sync_fetch_and_and((ptr), (val))
+#define ast_atomic_and_fetch(ptr, val, memorder) __sync_and_and_fetch((ptr), (val))
+
+/*! Atomic |= */
+#define ast_atomic_fetch_or(ptr, val, memorder) __sync_fetch_and_or((ptr), (val))
+#define ast_atomic_or_fetch(ptr, val, memorder) __sync_or_and_fetch((ptr), (val))
+
+/*! Atomic xor = */
+#define ast_atomic_fetch_xor(ptr, val, memorder) __sync_fetch_and_xor((ptr), (val))
+#define ast_atomic_xor_fetch(ptr, val, memorder) __sync_xor_and_fetch((ptr), (val))
+
+#if 0
+/* Atomic compare and swap
+ *
+ * The \a expected argument is a pointer, I'm guessing __atomic built-ins
+ * perform all memory reads/writes in a single atomic operation. I don't
+ * believe this is possible to exactly replicate using __sync built-ins.
+ * Will need to determine potential use cases of this feature and write a
+ * wrapper which provides consistant behavior between __sync and __atomic
+ * implementations.
*/
+#define ast_atomic_compare_exchange_n(ptr, expected, desired, success_memorder, failure_memorder) \
+ __sync_bool_compare_and_swap((ptr), *(expected), (desired))
-#if defined(HAVE_GCC_ATOMICS)
-AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v),
-{
- return __sync_fetch_and_add(p, v);
-})
-#elif defined(HAVE_OSX_ATOMICS) && (SIZEOF_INT == 4)
-AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v),
-{
- return OSAtomicAdd32(v, (int32_t *) p) - v;
-})
-#elif defined(HAVE_OSX_ATOMICS) && (SIZEOF_INT == 8)
-AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v),
-{
- return OSAtomicAdd64(v, (int64_t *) p) - v;
-})
-#elif defined (__i386__) || defined(__x86_64__)
-#ifdef sun
-AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v),
-{
- __asm __volatile (
- " lock; xaddl %0, %1 ; "
- : "+r" (v), /* 0 (result) */
- "=m" (*p) /* 1 */
- : "m" (*p)); /* 2 */
- return (v);
-})
-#else /* ifndef sun */
-AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v),
-{
- __asm __volatile (
- " lock xaddl %0, %1 ; "
- : "+r" (v), /* 0 (result) */
- "=m" (*p) /* 1 */
- : "m" (*p)); /* 2 */
- return (v);
-})
+#define ast_atomic_compare_exchange(ptr, expected, desired, success_memorder, failure_memorder) \
+ __sync_bool_compare_and_swap((ptr), *(expected), *(desired))
+#endif
+
+#else
+#error "Atomics not available."
#endif
-#else /* low performance version in utils.c */
+
+/*! Atomic flag set */
+#define ast_atomic_flag_set(ptr, val, memorder) ast_atomic_fetch_or((ptr), (val), (memorder))
+
+/*! Atomic flag clear */
+#define ast_atomic_flag_clear(ptr, val, memorder) ast_atomic_fetch_and((ptr), ~(val), (memorder))
+
+/*!
+ * \brief Atomically add v to *p and return the previous value of *p.
+ *
+ * This can be used to handle reference counts, and the return value
+ * can be used to generate unique identifiers.
+ */
AST_INLINE_API(int ast_atomic_fetchadd_int(volatile int *p, int v),
{
- return ast_atomic_fetchadd_int_slow(p, v);
+ return ast_atomic_fetch_add(p, v, __ATOMIC_RELAXED);
})
-#endif
-/*! \brief decrement *p by 1 and return true if the variable has reached 0.
+/*!
+ * \brief decrement *p by 1 and return true if the variable has reached 0.
+ *
* Useful e.g. to check if a refcount has reached 0.
*/
-#if defined(HAVE_GCC_ATOMICS)
-AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p),
-{
- return __sync_sub_and_fetch(p, 1) == 0;
-})
-#elif defined(HAVE_OSX_ATOMICS) && (SIZEOF_INT == 4)
-AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p),
-{
- return OSAtomicAdd32( -1, (int32_t *) p) == 0;
-})
-#elif defined(HAVE_OSX_ATOMICS) && (SIZEOF_INT == 8)
-AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p),
-{
- return OSAtomicAdd64( -1, (int64_t *) p) == 0;
-})
-#else
AST_INLINE_API(int ast_atomic_dec_and_test(volatile int *p),
{
- int a = ast_atomic_fetchadd_int(p, -1);
- return a == 1; /* true if the value is 0 now (so it was 1 previously) */
+ return ast_atomic_sub_fetch(p, 1, __ATOMIC_RELAXED) == 0;
})
-#endif
+
+/*! @} */
#endif /* _ASTERISK_LOCK_H */
diff --git a/include/asterisk/logger.h b/include/asterisk/logger.h
index 8b1e5fe01..56dd85985 100644
--- a/include/asterisk/logger.h
+++ b/include/asterisk/logger.h
@@ -133,9 +133,6 @@ int ast_logger_remove_channel(const char *log_channel);
*/
void ast_log_backtrace(void);
-/*! \brief Reload logger without rotating log files */
-int logger_reload(void);
-
/*! \brief Reload logger while rotating log files */
int ast_logger_rotate(void);
@@ -310,14 +307,6 @@ void ast_console_toggle_loglevel(int fd, int level, int state);
unsigned int ast_debug_get_by_module(const char *module);
/*!
- * \brief Get the verbose level for a module
- * \param module the name of module
- * \return the verbose level
- * \version 11.0.0 deprecated
- */
-unsigned int ast_verbose_get_by_module(const char *module) __attribute__((deprecated));
-
-/*!
* \brief Register a new logger level
* \param name The name of the level to be registered
* \retval -1 if an error occurs
diff --git a/include/asterisk/manager.h b/include/asterisk/manager.h
index 67dcead47..97d4b9c29 100644
--- a/include/asterisk/manager.h
+++ b/include/asterisk/manager.h
@@ -54,7 +54,7 @@
- \ref manager.c Main manager code file
*/
-#define AMI_VERSION "4.0.0"
+#define AMI_VERSION "5.0.0"
#define DEFAULT_MANAGER_PORT 5038 /* Default port for Asterisk management via TCP */
#define DEFAULT_MANAGER_TLS_PORT 5039 /* Default port for Asterisk management via TCP */
@@ -120,7 +120,7 @@ int check_manager_enabled(void);
/*! \brief Check if AMI/HTTP is enabled */
int check_webmanager_enabled(void);
-/*! Add a custom hook to be called when an event is fired
+/*! Add a custom hook to be called when an event is fired
\param hook struct manager_custom_hook object to add
*/
void ast_manager_register_hook(struct manager_custom_hook *hook);
@@ -178,7 +178,7 @@ struct manager_action {
unsigned int registered:1;
};
-/*! \brief External routines may register/unregister manager callbacks this way
+/*! \brief External routines may register/unregister manager callbacks this way
* \note Use ast_manager_register2() to register with help text for new manager commands */
#define ast_manager_register(action, authority, func, synopsis) ast_manager_register2(action, authority, func, AST_MODULE_SELF, synopsis, NULL)
@@ -219,8 +219,8 @@ int ast_manager_register2(
*/
int ast_manager_unregister(const char *action);
-/*!
- * \brief Verify a session's read permissions against a permission mask.
+/*!
+ * \brief Verify a session's read permissions against a permission mask.
* \param ident session identity
* \param perm permission mask to verify
* \retval 1 if the session has the permission mask capabilities
@@ -229,7 +229,7 @@ int ast_manager_unregister(const char *action);
int astman_verify_session_readpermissions(uint32_t ident, int perm);
/*!
- * \brief Verify a session's write permissions against a permission mask.
+ * \brief Verify a session's write permissions against a permission mask.
* \param ident session identity
* \param perm permission mask to verify
* \retval 1 if the session has the permission mask capabilities, otherwise 0
@@ -237,7 +237,7 @@ int astman_verify_session_readpermissions(uint32_t ident, int perm);
*/
int astman_verify_session_writepermissions(uint32_t ident, int perm);
-/*! \brief External routines may send asterisk manager events this way
+/*! \brief External routines may send asterisk manager events this way
* \param category Event category, matches manager authorization
\param event Event name
\param contents Contents of event
@@ -356,13 +356,7 @@ void __attribute__((format(printf, 2, 3))) astman_append(struct mansession *s, c
/*! \brief Determinie if a manager session ident is authenticated */
int astman_is_authed(uint32_t ident);
-/*! \brief Called by Asterisk initialization */
-int init_manager(void);
-
-/*! \brief Called by Asterisk module functions and the CLI command */
-int reload_manager(void);
-
-/*!
+/*!
* \brief Add a datastore to a session
*
* \retval 0 success
@@ -372,7 +366,7 @@ int reload_manager(void);
int astman_datastore_add(struct mansession *s, struct ast_datastore *datastore);
-/*!
+/*!
* \brief Remove a datastore from a session
*
* \retval 0 success
@@ -381,7 +375,7 @@ int astman_datastore_add(struct mansession *s, struct ast_datastore *datastore);
*/
int astman_datastore_remove(struct mansession *s, struct ast_datastore *datastore);
-/*!
+/*!
* \brief Find a datastore on a session
*
* \retval pointer to the datastore if found
diff --git a/include/asterisk/message.h b/include/asterisk/message.h
index f81574c9b..ae6533c46 100644
--- a/include/asterisk/message.h
+++ b/include/asterisk/message.h
@@ -283,7 +283,7 @@ const char *ast_msg_get_var(struct ast_msg *msg, const char *name);
/*!
* \brief Get the body of a message.
* \note The return value is valid only as long as the ast_message is valid. Hold a reference
- * to the message if you plan on storing the return value.
+ * to the message if you plan on storing the return value.
*
* \return The body of the messsage, encoded in UTF-8.
*/
diff --git a/include/asterisk/mod_format.h b/include/asterisk/mod_format.h
index 7e05a282b..5f93ea442 100644
--- a/include/asterisk/mod_format.h
+++ b/include/asterisk/mod_format.h
@@ -42,7 +42,7 @@ extern "C" {
*/
struct ast_format_def {
char name[80]; /*!< Name of format */
- char exts[80]; /*!< Extensions (separated by | if more than one)
+ char exts[80]; /*!< Extensions (separated by | if more than one)
* this format can read. First is assumed for writing (e.g. .mp3) */
struct ast_format *format; /*!< Format of frames it uses/provides (one only) */
/*!
@@ -53,11 +53,11 @@ struct ast_format_def {
* function can be omitted.
*/
int (*open)(struct ast_filestream *s);
- /*!
+ /*!
* \brief Prepare a stream for output, and comment it appropriately if applicable.
- * \return 0 on success, -1 on error.
- * Same as the open, the FILE is already open so the function just needs to
- * prepare any header and other fields, if any.
+ * \return 0 on success, -1 on error.
+ * Same as the open, the FILE is already open so the function just needs to
+ * prepare any header and other fields, if any.
* The function can be omitted if nothing is needed.
*/
int (*rewrite)(struct ast_filestream *s, const char *comment);
@@ -125,7 +125,7 @@ struct ast_filestream {
char *write_buffer;
};
-/*!
+/*!
* \brief Register a new file format capability.
* Adds a format to Asterisk's format abilities.
* \retval 0 on success
@@ -134,8 +134,8 @@ struct ast_filestream {
int __ast_format_def_register(const struct ast_format_def *f, struct ast_module *mod);
#define ast_format_def_register(f) __ast_format_def_register(f, AST_MODULE_SELF)
-/*!
- * \brief Unregisters a file format
+/*!
+ * \brief Unregisters a file format
* \param name the name of the format you wish to unregister
* Unregisters a format based on the name of the format.
* \retval 0 on success
diff --git a/include/asterisk/module.h b/include/asterisk/module.h
index 69ebb2640..faa4f7f67 100644
--- a/include/asterisk/module.h
+++ b/include/asterisk/module.h
@@ -69,7 +69,7 @@ enum ast_module_load_result {
AST_MODULE_LOAD_SUCCESS = 0, /*!< Module loaded and configured */
AST_MODULE_LOAD_DECLINE = 1, /*!< Module is not configured */
AST_MODULE_LOAD_SKIP = 2, /*!< Module was skipped for some reason (For loader.c use only. Should never be returned by modules)*/
- AST_MODULE_LOAD_PRIORITY = 3, /*!< Module is not loaded yet, but is added to prioity heap */
+ AST_MODULE_LOAD_PRIORITY = 3, /*!< Module is not loaded yet, but is added to priority list */
AST_MODULE_LOAD_FAILURE = -1, /*!< Module could not be loaded properly */
};
@@ -108,7 +108,7 @@ enum ast_module_helper_type {
AST_MODULE_HELPER_RUNNING,
};
-/*!
+/*!
* \brief Load a module.
* \param resource_name The name of the module to load.
*
@@ -120,13 +120,13 @@ enum ast_module_helper_type {
*/
enum ast_module_load_result ast_load_resource(const char *resource_name);
-/*!
+/*!
* \brief Unload a module.
* \param resource_name The name of the module to unload.
* \param ast_module_unload_mode The force flag. This should be set using one of the AST_FORCE flags.
*
* This function unloads a module. It will only unload modules that are not in
- * use (usecount not zero), unless #AST_FORCE_FIRM or #AST_FORCE_HARD is
+ * use (usecount not zero), unless #AST_FORCE_FIRM or #AST_FORCE_HARD is
* specified. Setting #AST_FORCE_FIRM or #AST_FORCE_HARD will unload the
* module regardless of consequences (NOT RECOMMENDED).
*
@@ -149,7 +149,7 @@ int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode);
*/
enum ast_module_reload_result ast_module_reload(const char *name);
-/*!
+/*!
* \brief Notify when usecount has been changed.
*
* This function calulates use counts and notifies anyone trying to keep track
@@ -214,39 +214,39 @@ int ast_update_module_list_condition(int (*modentry)(const char *module, const c
/*!
* \brief Check if module with the name given is loaded
* \param name Module name, like "chan_sip.so"
- * \retval 1 if true
+ * \retval 1 if true
* \retval 0 if false
*/
int ast_module_check(const char *name);
-/*!
+/*!
* \brief Add a procedure to be run when modules have been updated.
* \param updater The function to run when modules have been updated.
*
* This function adds the given function to a linked list of functions to be
- * run when the modules are updated.
+ * run when the modules are updated.
*
- * \retval 0 on success
+ * \retval 0 on success
* \retval -1 on failure.
*/
int ast_loader_register(int (*updater)(void));
-/*!
+/*!
* \brief Remove a procedure to be run when modules are updated.
* \param updater The updater function to unregister.
*
* This removes the given function from the updater list.
- *
+ *
* \retval 0 on success
* \retval -1 on failure.
*/
int ast_loader_unregister(int (*updater)(void));
-/*!
+/*!
* \brief Match modules names for the Asterisk cli.
* \param line Unused by this function, but this should be the line we are
* matching.
- * \param word The partial name to match.
+ * \param word The partial name to match.
* \param pos The position the word we are completing is in.
* \param state The possible match to return.
* \param rpos The position we should be matching. This should be the same as
@@ -292,38 +292,41 @@ enum ast_module_load_priority {
AST_MODPRI_REALTIME_DEPEND = 10, /*!< Dependency for a realtime driver */
AST_MODPRI_REALTIME_DEPEND2 = 20, /*!< Second level dependency for a realtime driver (func_curl needs res_curl, but is needed by res_config_curl) */
AST_MODPRI_REALTIME_DRIVER = 30, /*!< A realtime driver, which provides configuration services for other modules */
- AST_MODPRI_TIMING = 40, /*!< Dependency for a channel (MOH needs timing interfaces to be fully loaded) */
- AST_MODPRI_CHANNEL_DEPEND = 50, /*!< Channel driver dependency (may depend upon realtime, e.g. MOH) */
- AST_MODPRI_CHANNEL_DRIVER = 60, /*!< Channel drivers (provide devicestate) */
- AST_MODPRI_APP_DEPEND = 70, /*!< Dependency for an application */
- AST_MODPRI_DEVSTATE_PROVIDER = 80, /*!< Applications and other modules that _provide_ devicestate (e.g. meetme) */
- AST_MODPRI_DEVSTATE_PLUGIN = 90, /*!< Plugin for a module that provides devstate (e.g. res_calendar_*) */
- AST_MODPRI_CDR_DRIVER = 100, /*!< CDR or CEL backend */
+ AST_MODPRI_CORE = 40, /*!< A core module originally meant to start between preload and load. */
+ AST_MODPRI_TIMING = 50, /*!< Dependency for a channel (MOH needs timing interfaces to be fully loaded) */
+ AST_MODPRI_CHANNEL_DEPEND = 60, /*!< Channel driver dependency (may depend upon realtime, e.g. MOH) */
+ AST_MODPRI_CHANNEL_DRIVER = 70, /*!< Channel drivers (provide devicestate) */
+ AST_MODPRI_APP_DEPEND = 80, /*!< Dependency for an application */
+ AST_MODPRI_DEVSTATE_PROVIDER = 90, /*!< Applications and other modules that _provide_ devicestate (e.g. meetme) */
+ AST_MODPRI_DEVSTATE_PLUGIN = 100, /*!< Plugin for a module that provides devstate (e.g. res_calendar_*) */
+ AST_MODPRI_CDR_DRIVER = 110, /*!< CDR or CEL backend */
AST_MODPRI_DEFAULT = 128, /*!< Modules not otherwise defined (such as most apps) will load here */
AST_MODPRI_DEVSTATE_CONSUMER = 150, /*!< Certain modules, which consume devstate, need to load after all others (e.g. app_queue) */
};
struct ast_module_info {
-
/*!
* The 'self' pointer for a module; it will be set by the loader before
* it calls the module's load_module() entrypoint, and used by various
* other macros that need to identify the module.
*/
-
struct ast_module *self;
- enum ast_module_load_result (*load)(void); /*!< register stuff etc. Optional. */
- int (*reload)(void); /*!< config etc. Optional. */
- int (*unload)(void); /*!< unload. called with the module locked */
- const char *name; /*!< name of the module for loader reference and CLI commands */
- const char *description; /*!< user friendly description of the module. */
+ /*! Register stuff etc. Optional. */
+ enum ast_module_load_result (*load)(void);
+ /*! Config etc. Optional. */
+ int (*reload)(void);
+ /*! Unload. called with the module locked */
+ int (*unload)(void);
+ /*! Name of the module for loader reference and CLI commands */
+ const char *name;
+ /*! User friendly description of the module. */
+ const char *description;
- /*!
+ /*!
* This holds the ASTERISK_GPL_KEY, signifiying that you agree to the terms of
* the Asterisk license as stated in the ASTERISK_GPL_KEY. Your module will not
* load if it does not return the EXACT key string.
*/
-
const char *key;
unsigned int flags;
@@ -337,10 +340,42 @@ struct ast_module_info {
* on load. */
unsigned char load_pri;
- /*! Modules which should be loaded first, in comma-separated string format.
- * These are only required for loading, when the optional_api header file
- * detects that the compiler does not support the optional API featureset. */
- const char *nonoptreq;
+ /*! Modules which must always be started first, in comma-separated string format. */
+ const char *requires;
+
+ /*!
+ * \brief Comma-separated list of optionally required modules.
+ *
+ * The listed modules are optional, but load order is enforced. For example
+ * app_voicemail optionally requires res_adsi. This means that app_voicemail
+ * will happily load without res_adsi, but if both are being loaded the module
+ * loader will force res_adsi to start first.
+ */
+ const char *optional_modules;
+
+ /*!
+ * \brief Modules that we provide enhanced functionality for.
+ *
+ * This is similar to a "requires" but specifies that we add functionality to
+ * the other modules. Any module that requires something we "enhances" will
+ * also require us, but only if we are dlopen'ed.
+ *
+ * Example:
+ * - res_fax_spandsp has .enhances = "res_fax".
+ * - res_my_module has .requires = "res_fax" but has no direct knowledge
+ * of res_fax_spandsp.
+ *
+ * This forces the following startup order among the 3 modules:
+ * 1) res_fax starts.
+ * 2) res_fax_spandsp starts, holds a reference to res_fax.
+ * 3) res_mymod starts, holds a reference to res_fax and res_fax_spandsp.
+ *
+ * If res_fax_spandsp were not being loaded res_mymod would load with
+ * res_fax only. If res_fax_spandsp were later loaded res_mymod would
+ * get a reference to it.
+ */
+ const char *enhances;
+
/*! The support level for the given module */
enum ast_module_support_level support_level;
};
@@ -357,6 +392,7 @@ void __ast_module_user_hangup_all(struct ast_module *);
#define ast_module_user_hangup_all() __ast_module_user_hangup_all(AST_MODULE_SELF)
struct ast_module *__ast_module_ref(struct ast_module *mod, const char *file, int line, const char *func);
+struct ast_module *__ast_module_running_ref(struct ast_module *mod, const char *file, int line, const char *func);
void __ast_module_shutdown_ref(struct ast_module *mod, const char *file, int line, const char *func);
void __ast_module_unref(struct ast_module *mod, const char *file, int line, const char *func);
@@ -369,6 +405,20 @@ void __ast_module_unref(struct ast_module *mod, const char *file, int line, cons
* from being unloaded.
*/
#define ast_module_ref(mod) __ast_module_ref(mod, __FILE__, __LINE__, __PRETTY_FUNCTION__)
+
+/*!
+ * \brief Hold a reference to the module if it is running.
+ * \param mod Module to reference
+ * \retval mod if running
+ * \retval NULL if not running
+ *
+ * The returned pointer should be released with ast_module_unref.
+ *
+ * \note A module reference will prevent the module from being unloaded.
+ */
+#define ast_module_running_ref(mod) \
+ __ast_module_running_ref(mod, __FILE__, __LINE__, __PRETTY_FUNCTION__)
+
/*!
* \brief Prevent unload of the module before shutdown
* \param mod Module to hold
@@ -396,6 +446,8 @@ void __ast_module_unref(struct ast_module *mod, const char *file, int line, cons
AST_BUILDOPT_SUM, \
load_pri, \
NULL, \
+ NULL, \
+ NULL, \
support_level, \
}; \
static void __attribute__((constructor)) __reg_module(void) \
@@ -498,37 +550,37 @@ static const __attribute__((unused)) struct ast_module_info *ast_module_info;
#endif /* plain C */
-/*!
+/*!
* \brief Register an application.
*
* \param app Short name of the application
* \param execute a function callback to execute the application. It should return
* non-zero if the channel needs to be hung up.
* \param synopsis a short description (one line synopsis) of the application
- * \param description long description with all of the details about the use of
+ * \param description long description with all of the details about the use of
* the application
- *
- * This registers an application with Asterisk's internal application list.
+ *
+ * This registers an application with Asterisk's internal application list.
* \note The individual applications themselves are responsible for registering and unregistering
* and unregistering their own CLI commands.
- *
- * \retval 0 success
+ *
+ * \retval 0 success
* \retval -1 failure.
*/
#define ast_register_application(app, execute, synopsis, description) ast_register_application2(app, execute, synopsis, description, AST_MODULE_SELF)
-/*!
+/*!
* \brief Register an application using XML documentation.
*
* \param app Short name of the application
* \param execute a function callback to execute the application. It should return
* non-zero if the channel needs to be hung up.
- *
- * This registers an application with Asterisk's internal application list.
+ *
+ * This registers an application with Asterisk's internal application list.
* \note The individual applications themselves are responsible for registering and unregistering
* and unregistering their own CLI commands.
- *
- * \retval 0 success
+ *
+ * \retval 0 success
* \retval -1 failure.
*/
#define ast_register_application_xml(app, execute) ast_register_application(app, execute, NULL, NULL)
@@ -555,14 +607,14 @@ static const __attribute__((unused)) struct ast_module_info *ast_module_info;
int ast_register_application2(const char *app, int (*execute)(struct ast_channel *, const char *),
const char *synopsis, const char *description, void *mod);
-/*!
+/*!
* \brief Unregister an application
- *
+ *
* \param app name of the application (does not have to be the same string as the one that was registered)
- *
+ *
* This unregisters an application from Asterisk's internal application list.
- *
- * \retval 0 success
+ *
+ * \retval 0 success
* \retval -1 failure
*/
int ast_unregister_application(const char *app);
diff --git a/include/asterisk/netsock.h b/include/asterisk/netsock.h
deleted file mode 100644
index bd80072f5..000000000
--- a/include/asterisk/netsock.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 1999 - 2005, Digium, Inc.
- *
- * Mark Spencer <markster@digium.com>
- * Kevin P. Fleming <kpfleming@digium.com>
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
- */
-
-/*! \file
- * \brief Network socket handling
- *
- * \deprecated Use netsock2.h instead
- */
-
-#ifndef _ASTERISK_NETSOCK_H
-#define _ASTERISK_NETSOCK_H
-
-#if defined(__cplusplus) || defined(c_plusplus)
-extern "C" {
-#endif
-
-#include "asterisk/network.h"
-#include "asterisk/io.h"
-#include "asterisk/netsock2.h"
-
-struct ast_netsock;
-
-struct ast_netsock_list;
-
-struct ast_netsock_list *ast_netsock_list_alloc(void);
-
-int ast_netsock_init(struct ast_netsock_list *list);
-
-struct ast_netsock *ast_netsock_bind(struct ast_netsock_list *list, struct io_context *ioc,
- const char *bindinfo, int defaultport, int tos, int cos, ast_io_cb callback, void *data);
-
-struct ast_netsock *ast_netsock_bindaddr(struct ast_netsock_list *list, struct io_context *ioc,
- struct ast_sockaddr *bindaddr, int tos, int cos, ast_io_cb callback, void *data);
-
-int ast_netsock_release(struct ast_netsock_list *list);
-
-struct ast_netsock *ast_netsock_find(struct ast_netsock_list *list,
- struct ast_sockaddr *addr);
-
-/*!
- * \deprecated Use ast_seq_qos in netsock2.h which properly handles IPv4 and IPv6
- * sockets, instead.
- */
-int ast_netsock_set_qos(int sockfd, int tos, int cos, const char *desc);
-
-int ast_netsock_sockfd(const struct ast_netsock *ns);
-
-const struct ast_sockaddr *ast_netsock_boundaddr(const struct ast_netsock *ns);
-
-void *ast_netsock_data(const struct ast_netsock *ns);
-
-void ast_netsock_unref(struct ast_netsock *ns);
-
-#if defined(__cplusplus) || defined(c_plusplus)
-}
-#endif
-
-#endif /* _ASTERISK_NETSOCK_H */
diff --git a/include/asterisk/netsock2.h b/include/asterisk/netsock2.h
index 6c0dd633b..2d2cfdf5a 100644
--- a/include/asterisk/netsock2.h
+++ b/include/asterisk/netsock2.h
@@ -389,7 +389,7 @@ int ast_sockaddr_split_hostport(char *str, char **host, char **port, int flags);
*
* Host names are NOT allowed.
*
- * \param[out] addr The resulting ast_sockaddr. This MAY be NULL from
+ * \param[out] addr The resulting ast_sockaddr. This MAY be NULL from
* functions that are performing validity checks only, e.g. ast_parse_arg().
* \param str The string to parse
* \param flags If set to zero, a port MAY be present. If set to
diff --git a/include/asterisk/options.h b/include/asterisk/options.h
index 878748d16..6c4e55295 100644
--- a/include/asterisk/options.h
+++ b/include/asterisk/options.h
@@ -74,8 +74,6 @@ enum ast_option_flags {
AST_OPT_FLAG_TRANSMIT_SILENCE = (1 << 17),
/*! Suppress some warnings */
AST_OPT_FLAG_DONT_WARN = (1 << 18),
- /*! End CDRs before the 'h' extension */
- AST_OPT_FLAG_END_CDR_BEFORE_H_EXTEN = (1 << 19),
/*! Reference Debugging */
AST_OPT_FLAG_REF_DEBUG = (1 << 20),
/*! Always fork, even if verbose or debug settings are non-zero */
@@ -84,12 +82,8 @@ enum ast_option_flags {
AST_OPT_FLAG_MUTE = (1 << 22),
/*! There is a per-module debug setting */
AST_OPT_FLAG_DEBUG_MODULE = (1 << 23),
- /*! There is a per-module verbose setting */
- AST_OPT_FLAG_VERBOSE_MODULE = (1 << 24),
/*! Terminal colors should be adjusted for a light-colored background */
AST_OPT_FLAG_LIGHT_BACKGROUND = (1 << 25),
- /*! Count Initiated seconds in CDR's */
- AST_OPT_FLAG_INITIATED_SECONDS = (1 << 26),
/*! Force black background */
AST_OPT_FLAG_FORCE_BLACK_BACKGROUND = (1 << 27),
/*! Hide remote console connect messages on console */
@@ -98,6 +92,8 @@ enum ast_option_flags {
AST_OPT_FLAG_LOCK_CONFIG_DIR = (1 << 29),
/*! Generic PLC */
AST_OPT_FLAG_GENERIC_PLC = (1 << 30),
+ /*! Generic PLC onm equal codecs */
+ AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS = (1 << 31),
};
/*! These are the options that set by default when Asterisk starts */
@@ -123,17 +119,16 @@ enum ast_option_flags {
#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_end_cdr_before_h_exten ast_test_flag(&ast_options, AST_OPT_FLAG_END_CDR_BEFORE_H_EXTEN)
#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_verb_module ast_test_flag(&ast_options, AST_OPT_FLAG_VERBOSE_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)
/*! Maximum log level defined by PJPROJECT. */
#define MAX_PJ_LOG_MAX_LEVEL 6
@@ -173,6 +168,11 @@ enum ast_option_flags {
/*! Current linked pjproject maximum logging level */
extern int ast_pjproject_max_log_level;
+#define DEFAULT_PJPROJECT_CACHE_POOLS 1
+
+/*! Current pjproject pool caching enable */
+extern int ast_option_pjproject_cache_pools;
+
/*! Current pjproject logging level */
extern int ast_option_pjproject_log_level;
@@ -194,8 +194,6 @@ extern struct timeval ast_lastreloadtime;
extern pid_t ast_mainpid;
extern char record_cache_dir[AST_CACHE_DIR_LEN];
-extern char dahdi_chan_name[AST_CHANNEL_NAME];
-extern int dahdi_chan_name_len;
extern int ast_language_is_prefix;
diff --git a/include/asterisk/parking.h b/include/asterisk/parking.h
index 53dfe9320..554c8d523 100644
--- a/include/asterisk/parking.h
+++ b/include/asterisk/parking.h
@@ -164,7 +164,7 @@ struct ast_parking_bridge_feature_fn_table {
* \param parker The \ref bridge_channel object that is initiating the parking
* \param context The context to blind transfer to
* \param exten The extension to blind transfer to
- * \param parked_channel_cb Execute the following function on the the channel that gets parked
+ * \param parked_channel_cb Execute the following function on the channel that gets parked
* \param parked_channel_data Data for the parked_channel_cb
*
* \note If the bridge \ref parker is in has more than one other occupant, the entire
@@ -236,7 +236,7 @@ int ast_parking_park_call(struct ast_bridge_channel *parker, char *exten, size_t
* \param context The context to blind transfer to
* \param exten The extension to blind transfer to
* \param exten The extension to blind transfer to
- * \param parked_channel_cb Execute the following function on the the channel that gets parked
+ * \param parked_channel_cb Execute the following function on the channel that gets parked
* \param parked_channel_data Data for the parked_channel_cb
*
* \note If the bridge \ref parker is in has more than one other occupant, the entire
diff --git a/include/asterisk/paths.h b/include/asterisk/paths.h
index ea0c56123..3e3b8eae0 100644
--- a/include/asterisk/paths.h
+++ b/include/asterisk/paths.h
@@ -2,7 +2,7 @@
* Asterisk -- An open source telephony toolkit.
*
* Paths to configurable Asterisk directories
- *
+ *
* Copyright (C) 1999-2006, Digium, Inc.
*
* Mark Spencer <markster@digium.com>
diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h
index 008cfd3cb..a40c6a45b 100644
--- a/include/asterisk/pbx.h
+++ b/include/asterisk/pbx.h
@@ -85,7 +85,7 @@ struct ast_exten;
struct ast_include;
struct ast_ignorepat;
struct ast_sw;
-
+
enum ast_state_cb_update_reason {
/*! The extension state update is a result of a device state changing on the extension. */
AST_HINT_UPDATE_DEVICE = 1,
@@ -1108,7 +1108,7 @@ int ast_rdlock_context(struct ast_context *con);
int ast_unlock_context(struct ast_context *con);
/*!
- * \brief locks the macrolock in the given given context
+ * \brief locks the macrolock in the given context
*
* \param macrocontext name of the macro-context to lock
*
@@ -1432,7 +1432,7 @@ void ast_str_substitute_variables_varshead(struct ast_str **buf, ssize_t maxlen,
* \param c Channel variables from which to extract values, and channel to pass to any dialplan functions.
* \param headp If no channel is specified, a channel list from which to extract variable values
* \param templ Variable template to expand.
- * \param used Number of bytes read from the template.
+ * \param used Number of bytes read from the template. (May be NULL)
*/
void ast_str_substitute_variables_full(struct ast_str **buf, ssize_t maxlen, struct ast_channel *c, struct varshead *headp, const char *templ, size_t *used);
/*! @} */
diff --git a/include/asterisk/pktccops.h b/include/asterisk/pktccops.h
index 8f1a0dbc5..14c71b48b 100644
--- a/include/asterisk/pktccops.h
+++ b/include/asterisk/pktccops.h
@@ -19,7 +19,7 @@
/*! \file
*
* \brief PacketCable COPS
- *
+ *
* \author Attila Domjan <attila.domjan.hu@gmail.com>
*/
diff --git a/include/asterisk/presencestate.h b/include/asterisk/presencestate.h
index 1cdf73eda..87deda766 100644
--- a/include/asterisk/presencestate.h
+++ b/include/asterisk/presencestate.h
@@ -192,4 +192,3 @@ struct ast_presence_state_message {
int ast_presence_state_engine_init(void);
#endif
-
diff --git a/include/asterisk/pval.h b/include/asterisk/pval.h
index cd8c5d366..cb5a7da60 100644
--- a/include/asterisk/pval.h
+++ b/include/asterisk/pval.h
@@ -3,7 +3,7 @@
/* whatever includes this, better include asterisk/lock.h and asterisk/hashtab.h */
-typedef enum
+typedef enum
{
PV_WORD, /* an ident, string, name, label, etc. A user-supplied string. */ /* 0 */
PV_MACRO, /* 1 */
@@ -53,7 +53,7 @@ struct pval
int startcol;
int endcol;
char *filename;
-
+
union
{
char *str; /* wow, used almost everywhere! */
@@ -62,7 +62,7 @@ struct pval
char *for_init; /* used in FOR */
} u1;
struct pval *u1_last; /* to build in-order lists -- looks like we only need one */
-
+
union
{
struct pval *arglist; /* used in macro_call, application_call, MACRO def, also attached to PWORD, the 4 timevals for includes */
@@ -71,7 +71,7 @@ struct pval
char *for_test; /* used in FOR */
struct pval *goto_target; /* used in GOTO */
} u2;
-
+
union
{
char *for_inc; /* used in FOR */
@@ -83,16 +83,16 @@ struct pval
struct ael_extension *compiled_label;
struct pval *extend; /* to link extended contexts to the 'original' */
} u3;
-
+
union
{
struct pval *for_statements; /* used in PV_FOR */
int regexten; /* used in EXTENSION */
} u4;
-
- struct pval *next; /* the pval at the end of this ptr will ALWAYS be of the same type as this one!
+
+ struct pval *next; /* the pval at the end of this ptr will ALWAYS be of the same type as this one!
EXCEPT for objects of the different types, that are in the same list, like contexts & macros, etc */
-
+
struct pval *dad; /* the 'container' of this struct instance */
struct pval *prev; /* the opposite of the 'next' pointer */
} ;
@@ -102,8 +102,8 @@ typedef struct pval pval;
#ifndef AAL_ARGCHECK
/* for the time being, short circuit all the AAL related structures
- without permanently removing the code; after/during the AAL
- development, this code can be properly re-instated
+ without permanently removing the code; after/during the AAL
+ development, this code can be properly re-instated
*/
/* null definitions for structs passed down the infrastructure */
diff --git a/include/asterisk/res_fax.h b/include/asterisk/res_fax.h
index e88d8002f..c1dd37847 100644
--- a/include/asterisk/res_fax.h
+++ b/include/asterisk/res_fax.h
@@ -144,7 +144,7 @@ struct ast_fax_session_details {
unsigned int pages_transferred;
/*! session details flags for options */
union {
- /*! dontuse dummy variable - do not ever use */
+ /*! dontuse dummy variable - do not ever use */
uint32_t dontuse;
struct {
/*! flag to send debug manager events */
diff --git a/include/asterisk/res_mwi_external.h b/include/asterisk/res_mwi_external.h
index 7698a1bd6..25de70003 100644
--- a/include/asterisk/res_mwi_external.h
+++ b/include/asterisk/res_mwi_external.h
@@ -36,22 +36,6 @@ extern "C"
/* ------------------------------------------------------------------- */
-/*!
- * \brief Increase the external MWI resource module reference count.
- * \since 12.1.0
- *
- * \return Nothing
- */
-void ast_mwi_external_ref(void);
-
-/*!
- * \brief Decrease the external MWI resource module reference count.
- * \since 12.1.0
- *
- * \return Nothing
- */
-void ast_mwi_external_unref(void);
-
struct ast_mwi_mailbox_object;
/*! \brief Convienience unref function for mailbox object. */
diff --git a/include/asterisk/res_odbc.h b/include/asterisk/res_odbc.h
index 137f7d4a5..4286272fc 100644
--- a/include/asterisk/res_odbc.h
+++ b/include/asterisk/res_odbc.h
@@ -75,7 +75,7 @@ struct odbc_cache_tables {
/* functions */
-/*!
+/*!
* \brief Executes a prepared statement handle
* \param obj The non-NULL result of odbc_request_obj()
* \param stmt The prepared statement handle
@@ -120,13 +120,13 @@ struct odbc_obj *_ast_odbc_request_obj(const char *name, int check, const char *
#define ast_odbc_request_obj2(a, b) _ast_odbc_request_obj2(a, b, __FILE__, __PRETTY_FUNCTION__, __LINE__)
#define ast_odbc_request_obj(a, b) _ast_odbc_request_obj(a, b, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-/*!
+/*!
* \brief Releases an ODBC object previously allocated by ast_odbc_request_obj()
* \param obj The ODBC object
*/
void ast_odbc_release_obj(struct odbc_obj *obj);
-/*!
+/*!
* \brief Checks an ODBC object to ensure it is still connected
* \param obj The ODBC object
* \retval 0 if connected
@@ -150,12 +150,12 @@ int ast_odbc_backslash_is_escape(struct odbc_obj *obj);
*/
SQLHSTMT ast_odbc_direct_execute(struct odbc_obj *obj, SQLHSTMT (*exec_cb)(struct odbc_obj *obj, void *data), void *data);
-/*!
+/*!
* \brief Prepares, executes, and returns the resulting statement handle.
* \param obj The ODBC object
* \param prepare_cb A function callback, which, when called, should return a statement handle prepared, with any necessary parameters or result columns bound.
* \param data A parameter to be passed to the prepare_cb parameter function, indicating which statement handle is to be prepared.
- * \retval a statement handle
+ * \retval a statement handle
* \retval NULL on error
*/
SQLHSTMT ast_odbc_prepare_and_execute(struct odbc_obj *obj, SQLHSTMT (*prepare_cb)(struct odbc_obj *obj, void *data), void *data);
diff --git a/include/asterisk/res_pjproject.h b/include/asterisk/res_pjproject.h
index 8828b340c..17ebdd201 100644
--- a/include/asterisk/res_pjproject.h
+++ b/include/asterisk/res_pjproject.h
@@ -19,13 +19,8 @@
#ifndef _RES_PJPROJECT_H
#define _RES_PJPROJECT_H
-/*! \brief Determines whether the res_pjproject module is loaded */
-#define CHECK_PJPROJECT_MODULE_LOADED() \
- do { \
- if (!ast_module_check("res_pjproject.so")) { \
- return AST_MODULE_LOAD_DECLINE; \
- } \
- } while(0)
+#include <pj/types.h>
+#include <pj/pool.h>
/*!
* \brief Retrieve a pjproject build option
@@ -80,17 +75,26 @@ void ast_pjproject_log_intercept_begin(int fd);
void ast_pjproject_log_intercept_end(void);
/*!
- * \brief Increment the res_pjproject reference count.
+ * \brief Initialize the caching pool factory.
+ * \since 13.21.0
*
- * This ensures graceful shutdown happens in the proper order.
+ * \param cp Caching pool factory to initialize
+ * \param policy Pool factory policy
+ * \param max_capacity Total capacity to be retained in the cache. Zero disables caching.
+ *
+ * \return Nothing
*/
-void ast_pjproject_ref(void);
+void ast_pjproject_caching_pool_init(pj_caching_pool *cp,
+ const pj_pool_factory_policy *policy, pj_size_t max_capacity);
/*!
- * \brief Decrement the res_pjproject reference count.
+ * \brief Destroy caching pool factory and all cached pools.
+ * \since 13.21.0
*
- * This ensures graceful shutdown happens in the proper order.
+ * \param cp Caching pool factory to destroy
+ *
+ * \return Nothing
*/
-void ast_pjproject_unref(void);
+void ast_pjproject_caching_pool_destroy(pj_caching_pool *cp);
#endif /* _RES_PJPROJECT_H */
diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h
index e71eb98d7..c017e62db 100644
--- a/include/asterisk/res_pjsip.h
+++ b/include/asterisk/res_pjsip.h
@@ -289,9 +289,13 @@ struct ast_sip_contact {
* \brief Status type for a contact.
*/
enum ast_sip_contact_status_type {
+ /*! Frequency > 0, but no response from remote uri */
UNAVAILABLE,
+ /*! Frequency > 0, and got response from remote uri */
AVAILABLE,
+ /*! Default last status, and when a contact status object is not found */
UNKNOWN,
+ /*! Frequency == 0, has a contact, but don't know status (non-qualified) */
CREATED,
REMOVED,
};
@@ -439,6 +443,8 @@ enum ast_sip_endpoint_identifier_type {
AST_SIP_ENDPOINT_IDENTIFY_BY_AUTH_USERNAME = (1 << 1),
/*! Identify based on source IP address */
AST_SIP_ENDPOINT_IDENTIFY_BY_IP = (1 << 2),
+ /*! Identify based on arbitrary headers */
+ AST_SIP_ENDPOINT_IDENTIFY_BY_HEADER = (1 << 3),
};
AST_VECTOR(ast_sip_identify_by_vector, enum ast_sip_endpoint_identifier_type);
@@ -927,9 +933,7 @@ enum ast_sip_contact_filter {
* \retval 0 Success
* \retval -1 Failure
*/
-#define ast_sip_register_service(module) \
- __ast_sip_register_service(module, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-int __ast_sip_register_service(pjsip_module *module, const char *file, int line, const char *func);
+int ast_sip_register_service(pjsip_module *module);
/*!
* This is the opposite of ast_sip_register_service(). Unregistering a
@@ -938,9 +942,7 @@ int __ast_sip_register_service(pjsip_module *module, const char *file, int line,
*
* \param module The PJSIP module to unregister
*/
-#define ast_sip_unregister_service(module) \
- __ast_sip_unregister_service(module, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-void __ast_sip_unregister_service(pjsip_module *module, const char *file, int line, const char *func);
+void ast_sip_unregister_service(pjsip_module *module);
/*!
* \brief Register a SIP authenticator
@@ -2442,10 +2444,8 @@ struct ast_sip_endpoint_formatter {
* \brief Register an endpoint formatter.
*
* \param obj the formatter to register
- * \retval 0 Success
- * \retval -1 Failure
*/
-int ast_sip_register_endpoint_formatter(struct ast_sip_endpoint_formatter *obj);
+void ast_sip_register_endpoint_formatter(struct ast_sip_endpoint_formatter *obj);
/*!
* \brief Unregister an endpoint formatter.
@@ -2621,20 +2621,14 @@ struct ast_sip_supplement {
* \retval 0 Success
* \retval -1 Failure
*/
-#define ast_sip_register_supplement(supplement) \
- __ast_sip_register_supplement(supplement, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-int __ast_sip_register_supplement(struct ast_sip_supplement *supplement,
- const char *file, int line, const char *func);
+void ast_sip_register_supplement(struct ast_sip_supplement *supplement);
/*!
* \brief Unregister a an supplement to SIP out of dialog processing
*
* \param supplement The supplement to unregister
*/
-#define ast_sip_unregister_supplement(supplement) \
- __ast_sip_unregister_supplement(supplement, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-void __ast_sip_unregister_supplement(struct ast_sip_supplement *supplement,
- const char *file, int line, const char *func);
+void ast_sip_unregister_supplement(struct ast_sip_supplement *supplement);
/*!
* \brief Retrieve the global MWI taskprocessor high water alert trigger level.
@@ -2758,15 +2752,6 @@ void ast_sip_get_default_realm(char *realm, size_t size);
*/
void ast_sip_get_default_from_user(char *from_user, size_t size);
-/*! \brief Determines whether the res_pjsip module is loaded */
-#define CHECK_PJSIP_MODULE_LOADED() \
- do { \
- if (!ast_module_check("res_pjsip.so") \
- || !ast_sip_get_pjsip_endpoint()) { \
- return AST_MODULE_LOAD_DECLINE; \
- } \
- } while(0)
-
/*!
* \brief Retrieve the system keep alive interval setting.
*
@@ -3000,6 +2985,18 @@ int ast_sip_str_to_dtmf(const char *dtmf_mode);
*/
typedef void (*ast_transport_monitor_shutdown_cb)(void *data);
+/*!
+ * \brief Transport shutdown monitor data matcher
+ * \since 13.20.0
+ *
+ * \param a User data to compare.
+ * \param b User data to compare.
+ *
+ * \retval 1 The data objects match
+ * \retval 0 The data objects don't match
+ */
+typedef int (*ast_transport_monitor_data_matcher)(void *a, void *b);
+
enum ast_transport_monitor_reg {
/*! \brief Successfully registered the transport monitor */
AST_TRANSPORT_MONITOR_REG_SUCCESS,
@@ -3016,37 +3013,59 @@ enum ast_transport_monitor_reg {
/*!
* \brief Register a reliable transport shutdown monitor callback.
- * \since 13.18.0
+ * \since 13.20.0
*
* \param transport Transport to monitor for shutdown.
* \param cb Who to call when transport is shutdown.
* \param ao2_data Data to pass with the callback.
*
+ * \note The data object passed will have its reference count automatically
+ * incremented by this call and automatically decremented after the callback
+ * runs or when the callback is unregistered.
+ *
+ * There is no checking for duplicate registrations.
+ *
* \return enum ast_transport_monitor_reg
*/
enum ast_transport_monitor_reg ast_sip_transport_monitor_register(pjsip_transport *transport,
ast_transport_monitor_shutdown_cb cb, void *ao2_data);
/*!
- * \brief Unregister a reliable transport shutdown monitor callback.
- * \since 13.18.0
+ * \brief Unregister a reliable transport shutdown monitor
+ * \since 13.20.0
*
* \param transport Transport to monitor for shutdown.
- * \param cb Who to call when transport is shutdown.
+ * \param cb The callback that was used for the original register.
+ * \param data Data to pass to the matcher. May be NULL and does NOT need to be an ao2 object.
+ * If NULL, all monitors with the provided callbck are unregistered.
+ * \param matches Matcher function that returns true if data matches the previously
+ * registered data object. If NULL, a simple pointer comparison is done.
+ *
+ * \note The data object passed into the original register will have its reference count
+ * automatically decremeneted.
*
* \return Nothing
*/
-void ast_sip_transport_monitor_unregister(pjsip_transport *transport, ast_transport_monitor_shutdown_cb cb);
+void ast_sip_transport_monitor_unregister(pjsip_transport *transport,
+ ast_transport_monitor_shutdown_cb cb, void *data, ast_transport_monitor_data_matcher matches);
/*!
- * \brief Unregister monitor callback from all reliable transports.
- * \since 13.18.0
+ * \brief Unregister a transport shutdown monitor from all reliable transports
+ * \since 13.20.0
+ *
+ * \param cb The callback that was used for the original register.
+ * \param data Data to pass to the matcher. May be NULL and does NOT need to be an ao2 object.
+ * If NULL, all monitors with the provided callbck are unregistered.
+ * \param matches Matcher function that returns true if ao2_data matches the previously
+ * registered data object. If NULL, a simple pointer comparison is done.
*
- * \param cb Who to call when a transport is shutdown.
+ * \note The data object passed into the original register will have its reference count
+ * automatically decremeneted.
*
* \return Nothing
*/
-void ast_sip_transport_monitor_unregister_all(ast_transport_monitor_shutdown_cb cb);
+void ast_sip_transport_monitor_unregister_all(ast_transport_monitor_shutdown_cb cb,
+ void *data, ast_transport_monitor_data_matcher matches);
/*! Transport state notification registration element. */
struct ast_sip_tpmgr_state_callback {
diff --git a/include/asterisk/res_pjsip_pubsub.h b/include/asterisk/res_pjsip_pubsub.h
index cb51db31f..e9d59a085 100644
--- a/include/asterisk/res_pjsip_pubsub.h
+++ b/include/asterisk/res_pjsip_pubsub.h
@@ -754,13 +754,4 @@ const char *ast_sip_subscription_get_body_subtype(struct ast_sip_subscription *s
*/
void ast_sip_subscription_destroy(struct ast_sip_subscription *sub);
-/*! \brief Determines whether the res_pjsip_pubsub module is loaded */
-#define CHECK_PJSIP_PUBSUB_MODULE_LOADED() \
- do { \
- CHECK_PJSIP_MODULE_LOADED(); \
- if (!ast_module_check("res_pjsip_pubsub.so")) { \
- return AST_MODULE_LOAD_DECLINE; \
- } \
- } while(0)
-
#endif /* RES_PJSIP_PUBSUB_H */
diff --git a/include/asterisk/res_pjsip_session.h b/include/asterisk/res_pjsip_session.h
index a0fc9650e..f6ee0f00b 100644
--- a/include/asterisk/res_pjsip_session.h
+++ b/include/asterisk/res_pjsip_session.h
@@ -211,6 +211,8 @@ struct ast_sip_session {
unsigned int ended_while_deferred:1;
/*! DTMF mode to use with this session, from endpoint but can change */
enum ast_sip_dtmf_mode dtmf;
+ /*! Initial incoming INVITE Request-URI. NULL otherwise. */
+ pjsip_uri *request_uri;
};
typedef int (*ast_sip_session_request_creation_cb)(struct ast_sip_session *session, pjsip_tx_data *tdata);
@@ -263,7 +265,7 @@ struct ast_sip_session_supplement {
* This method will always be called from a SIP servant thread.
*/
void (*session_begin)(struct ast_sip_session *session);
- /*!
+ /*!
* \brief Notification that the session has ended
*
* This method may or may not be called from a SIP servant thread. Do
@@ -293,7 +295,7 @@ struct ast_sip_session_supplement {
* There is no guarantee that a channel will be present on the session when this is called.
*/
int (*incoming_request)(struct ast_sip_session *session, struct pjsip_rx_data *rdata);
- /*!
+ /*!
* \brief Called on an incoming SIP response
* This method is always called from a SIP servant thread.
*
@@ -314,7 +316,7 @@ struct ast_sip_session_supplement {
* This method is always called from a SIP servant thread.
*/
void (*outgoing_request)(struct ast_sip_session *session, struct pjsip_tx_data *tdata);
- /*!
+ /*!
* \brief Called on an outgoing SIP response
* This method is always called from a SIP servant thread.
*/
@@ -577,23 +579,15 @@ void ast_sip_session_unregister_sdp_handler(struct ast_sip_session_sdp_handler *
* a module could reject an incoming request if desired.
*
* \param supplement The supplement to register
- * \retval 0 Success
- * \retval -1 Failure
*/
-#define ast_sip_session_register_supplement(supplement) \
- __ast_sip_session_register_supplement(supplement, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-int __ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement,
- const char *file, int line, const char *func);
+void ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement);
/*!
* \brief Unregister a an supplement to SIP session processing
*
* \param supplement The supplement to unregister
*/
-#define ast_sip_session_unregister_supplement(supplement) \
- __ast_sip_session_unregister_supplement(supplement, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-void __ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement,
- const char *file, int line, const char *func);
+void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement);
/*!
* \brief Add supplements to a SIP session
@@ -667,7 +661,7 @@ void ast_sip_session_remove_datastore(struct ast_sip_session *session, const cha
* Note: The on_request_creation callback may or may not be called in the same
* thread where this function is called. Request creation may need to be delayed
* due to the current INVITE transaction state.
- *
+ *
* \param session The session on which the reinvite will be sent
* \param on_request_creation Callback called when request is created
* \param on_sdp_creation Callback called when SDP is created
@@ -892,13 +886,4 @@ int ast_sip_session_media_set_write_callback(struct ast_sip_session *session, st
*/
struct ast_sip_session_media *ast_sip_session_media_get_transport(struct ast_sip_session *session, struct ast_sip_session_media *session_media);
-/*! \brief Determines whether the res_pjsip_session module is loaded */
-#define CHECK_PJSIP_SESSION_MODULE_LOADED() \
- do { \
- CHECK_PJSIP_MODULE_LOADED(); \
- if (!ast_module_check("res_pjsip_session.so")) { \
- return AST_MODULE_LOAD_DECLINE; \
- } \
- } while(0)
-
#endif /* _RES_PJSIP_SESSION_H */
diff --git a/include/asterisk/rtp_engine.h b/include/asterisk/rtp_engine.h
index f9d686aca..3812cb159 100644
--- a/include/asterisk/rtp_engine.h
+++ b/include/asterisk/rtp_engine.h
@@ -122,6 +122,10 @@ enum ast_rtp_property {
AST_RTP_PROPERTY_RTCP,
/*! Enable Asymmetric RTP Codecs */
AST_RTP_PROPERTY_ASYMMETRIC_CODEC,
+ /*! Enable packet retransmission for received packets */
+ AST_RTP_PROPERTY_RETRANS_RECV,
+ /*! Enable packet retransmission for sent packets */
+ AST_RTP_PROPERTY_RETRANS_SEND,
/*!
* \brief Maximum number of RTP properties supported
@@ -1383,6 +1387,16 @@ int ast_rtp_codecs_payloads_set_rtpmap_type_rate(struct ast_rtp_codecs *codecs,
void ast_rtp_codecs_payloads_unset(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload);
/*!
+ * \brief Determine the type of RTP stream media from the codecs mapped.
+ * \since 13.19.0
+ *
+ * \param codecs Codecs structure to look in
+ *
+ * \return Media type or AST_MEDIA_TYPE_UNKNOWN if no codecs mapped.
+ */
+enum ast_media_type ast_rtp_codecs_get_stream_type(struct ast_rtp_codecs *codecs);
+
+/*!
* \brief Retrieve rx payload mapped information by payload type
*
* \param codecs Codecs structure to look in
diff --git a/include/asterisk/sched.h b/include/asterisk/sched.h
index b775095ad..fb630813e 100644
--- a/include/asterisk/sched.h
+++ b/include/asterisk/sched.h
@@ -28,7 +28,7 @@
extern "C" {
#endif
-/*!
+/*!
* \brief Remove a scheduler entry
*
* This is a loop construct to ensure that
@@ -39,8 +39,8 @@ extern "C" {
*
* Since macro expansion essentially works like pass-by-name
* parameter passing, this macro will still work correctly even
- * if the id of the task to delete changes. This holds as long as
- * the name of the id which could change is passed to the macro
+ * if the id of the task to delete changes. This holds as long as
+ * the name of the id which could change is passed to the macro
* and not a copy of the value of the id.
*/
#define AST_SCHED_DEL(sched, id) \
@@ -260,8 +260,8 @@ int ast_sched_add_variable(struct ast_sched_context *con, int when, ast_sched_cb
*/
int ast_sched_replace_variable(int old_id, struct ast_sched_context *con, int when, ast_sched_cb callback, const void *data, int variable) attribute_warn_unused_result;
-/*!
- * \brief Find a sched structure and return the data field associated with it.
+/*!
+ * \brief Find a sched structure and return the data field associated with it.
*
* \param con scheduling context in which to search fro the matching id
* \param id ID of the scheduled item to find
diff --git a/include/asterisk/security_events_defs.h b/include/asterisk/security_events_defs.h
index 30a713606..1cae046f9 100644
--- a/include/asterisk/security_events_defs.h
+++ b/include/asterisk/security_events_defs.h
@@ -394,7 +394,7 @@ struct ast_security_event_successful_auth {
* \brief Using password - if a password was used or not
* \note required, 0 = no, 1 = yes
*/
- uint32_t *using_password;
+ uint32_t using_password;
};
/*!
diff --git a/include/asterisk/select.h b/include/asterisk/select.h
index d6f9d32cc..07580a58d 100644
--- a/include/asterisk/select.h
+++ b/include/asterisk/select.h
@@ -66,7 +66,7 @@ typedef struct {
} while (0)
#endif /* HAVE_VARIABLE_FDSET */
-/*! \brief Waits for activity on a group of channels
+/*! \brief Waits for activity on a group of channels
* \param nfds the maximum number of file descriptors in the sets
* \param rfds file descriptors to check for read availability
* \param wfds file descriptors to check for write availability
diff --git a/include/asterisk/smdi.h b/include/asterisk/smdi.h
index c3a5c7eb0..429982ed5 100644
--- a/include/asterisk/smdi.h
+++ b/include/asterisk/smdi.h
@@ -17,7 +17,7 @@
* at the top of the source tree.
*/
-/*!
+/*!
* \file
* \brief SMDI support for Asterisk.
* \author Matthew A. Nicholson <mnicholson@digium.com>
@@ -46,7 +46,7 @@
*
* The ast_smdi_mwi_message structure contains the parsed out parts of an smdi
* message. Each ast_smdi_interface structure has a message queue consisting
- * ast_smdi_mwi_message structures.
+ * ast_smdi_mwi_message structures.
*/
struct ast_smdi_mwi_message {
char name[SMDI_MESG_NAME_LEN];
@@ -60,7 +60,7 @@ struct ast_smdi_mwi_message {
*
* The ast_smdi_md_message structure contains the parsed out parts of an smdi
* message. Each ast_smdi_interface structure has a message queue consisting
- * ast_smdi_md_message structures.
+ * ast_smdi_md_message structures.
*/
struct ast_smdi_md_message {
char name[SMDI_MESG_NAME_LEN];
@@ -72,7 +72,7 @@ struct ast_smdi_md_message {
struct timeval timestamp; /* a timestamp for the message */
};
-/*!
+/*!
* \brief SMDI interface structure.
*
* The ast_smdi_interface structure holds information on a serial port that
@@ -81,7 +81,7 @@ struct ast_smdi_md_message {
*/
struct ast_smdi_interface;
-/*!
+/*!
* \brief Get the next SMDI message from the queue.
* \param iface a pointer to the interface to use.
*
@@ -164,7 +164,7 @@ AST_OPTIONAL_API(int, ast_smdi_mwi_set,
(struct ast_smdi_interface *iface, const char *mailbox),
{ return -1; });
-/*!
+/*!
* \brief Unset the MWI indicator for a mailbox.
* \param iface the interface to use.
* \param mailbox the mailbox to use.
diff --git a/include/asterisk/sounds_index.h b/include/asterisk/sounds_index.h
index d7eb05332..bbd3965f4 100644
--- a/include/asterisk/sounds_index.h
+++ b/include/asterisk/sounds_index.h
@@ -33,14 +33,6 @@ extern "C" {
struct ast_media_index;
/*!
- * \brief Reload the sounds index
- *
- * \retval zero on success
- * \retval non-zero on failure
- */
-int ast_sounds_reindex(void);
-
-/*!
* \brief Get the sounds index
*
* \retval sounds index (must be ao2_cleanup()'ed)
diff --git a/include/asterisk/speech.h b/include/asterisk/speech.h
index 0da6f5cfc..7af7e998d 100644
--- a/include/asterisk/speech.h
+++ b/include/asterisk/speech.h
@@ -68,7 +68,7 @@ struct ast_speech {
/*! Pointer to the engine used by this speech structure */
struct ast_speech_engine *engine;
};
-
+
/* Speech recognition engine structure */
struct ast_speech_engine {
/*! Name of speech engine */
diff --git a/include/asterisk/srv.h b/include/asterisk/srv.h
index f8fa8649b..79c112680 100644
--- a/include/asterisk/srv.h
+++ b/include/asterisk/srv.h
@@ -54,7 +54,7 @@ extern int ast_srv_lookup(struct srv_context **context, const char *service, con
*/
void ast_srv_cleanup(struct srv_context **context);
-/*! \brief Lookup entry in SRV records Returns 1 if found, 0 if not found, -1 on hangup
+/*! \brief Lookup entry in SRV records Returns 1 if found, 0 if not found, -1 on hangup
*
* Only do SRV record lookup if you get a domain without a port. If you get a port #, it's a DNS host name.
*
@@ -97,7 +97,7 @@ unsigned int ast_srv_get_record_count(struct srv_context *context);
* \param[out] priority The priority portion of the record
* \param[out] weight The weight portion of the record
*
- * \retval -1 Failed to retrieve information.
+ * \retval -1 Failed to retrieve information.
* Likely due to an out of range record_num
* \retval 0 Success
*/
diff --git a/include/asterisk/stasis_app.h b/include/asterisk/stasis_app.h
index 8ef2bda1c..b0829ab73 100644
--- a/include/asterisk/stasis_app.h
+++ b/include/asterisk/stasis_app.h
@@ -46,8 +46,8 @@
* functions.
*
* Since module unload order is based on reference counting, any module that
- * uses the API defined in this file must call stasis_app_ref() when loaded,
- * and stasis_app_unref() when unloaded.
+ * uses the API defined in this file must list "res_stasis" in the requires
+ * field.
*/
#include "asterisk/channel.h"
@@ -229,18 +229,6 @@ void stasis_app_register_event_source(struct stasis_app_event_source *obj);
void stasis_app_register_event_sources(void);
/*!
- * \brief Checks to see if the given object is a core event source
- *
- * \note core event sources are currently only endpoint, bridge, and channel.
- *
- * \param obj event source object to check
- *
- * \return non-zero if core event source, otherwise 0 (false)
-
- */
-int stasis_app_is_core_event_source(struct stasis_app_event_source *obj);
-
-/*!
* \brief Unregister an application event source.
*
* \param obj the event source to unregister
@@ -850,20 +838,6 @@ struct ast_bridge *stasis_app_get_bridge(struct stasis_app_control *control);
void stasis_app_bridge_destroy(const char *bridge_id);
/*!
- * \brief Increment the res_stasis reference count.
- *
- * This ensures graceful shutdown happens in the proper order.
- */
-void stasis_app_ref(void);
-
-/*!
- * \brief Decrement the res_stasis reference count.
- *
- * This ensures graceful shutdown happens in the proper order.
- */
-void stasis_app_unref(void);
-
-/*!
* \brief Get the Stasis message sanitizer for app_stasis applications
*
* \retval The stasis message sanitizer
diff --git a/include/asterisk/statsd.h b/include/asterisk/statsd.h
index 4cbd213ad..4dbfb77eb 100644
--- a/include/asterisk/statsd.h
+++ b/include/asterisk/statsd.h
@@ -147,4 +147,3 @@ AST_OPTIONAL_API(void, ast_statsd_log_sample, (const char *metric_name,
#endif /* _ASTERISK_STATSD_H */
-
diff --git a/include/asterisk/stringfields.h b/include/asterisk/stringfields.h
index 24f945b26..ce978901b 100644
--- a/include/asterisk/stringfields.h
+++ b/include/asterisk/stringfields.h
@@ -27,7 +27,7 @@
Using this functionality is quite simple. An example structure
with three fields is defined like this:
-
+
\code
struct sample_fields {
int x1;
@@ -39,14 +39,14 @@
long x2;
};
\endcode
-
+
When an instance of this structure is allocated (either statically or
dynamically), the fields and the pool of storage for them must be
initialized:
-
+
\code
struct sample_fields *x;
-
+
x = ast_calloc(1, sizeof(*x));
if (x == NULL || ast_string_field_init(x, 252)) {
if (x)
@@ -62,7 +62,7 @@
ast_string_field_init(x, 0) will reset fields to the
initial value while keeping the pool allocated.
-
+
Reading the fields is much like using 'const char * const' fields in the
structure: you cannot write to the field or to the memory it points to.
@@ -88,7 +88,7 @@
When the structure instance is no longer needed, the fields
and their storage pool must be freed:
-
+
\code
ast_string_field_free_memory(x);
ast_free(x);
@@ -228,11 +228,6 @@ struct ast_string_field_mgr {
ast_string_field last_alloc; /*!< the last field allocated */
struct ast_string_field_pool *embedded_pool; /*!< pointer to the embedded pool, if any */
struct ast_string_field_vector string_fields; /*!< field vector for compare and copy */
-#if defined(__AST_DEBUG_MALLOC)
- const char *owner_file; /*!< filename of owner */
- const char *owner_func; /*!< function name of owner */
- int owner_line; /*!< line number of owner */
-#endif
};
/*!
@@ -266,7 +261,8 @@ int __ast_string_field_ptr_grow(struct ast_string_field_mgr *mgr,
an additional pool will be allocated.
*/
ast_string_field __ast_string_field_alloc_space(struct ast_string_field_mgr *mgr,
- struct ast_string_field_pool **pool_head, size_t needed);
+ struct ast_string_field_pool **pool_head, size_t needed,
+ const char *file, int lineno, const char *func);
/*!
\internal
@@ -277,9 +273,9 @@ ast_string_field __ast_string_field_alloc_space(struct ast_string_field_mgr *mgr
\param format printf-style format string
\return nothing
*/
-void __ast_string_field_ptr_build(struct ast_string_field_mgr *mgr,
- struct ast_string_field_pool **pool_head,
- ast_string_field *ptr, const char *format, ...) __attribute__((format(printf, 4, 5)));
+void __ast_string_field_ptr_build(const char *file, int lineno, const char *func,
+ struct ast_string_field_mgr *mgr, struct ast_string_field_pool **pool_head,
+ ast_string_field *ptr, const char *format, ...) __attribute__((format(printf, 7, 8)));
/*!
\internal
@@ -292,8 +288,9 @@ void __ast_string_field_ptr_build(struct ast_string_field_mgr *mgr,
\return nothing
*/
void __ast_string_field_ptr_build_va(struct ast_string_field_mgr *mgr,
- struct ast_string_field_pool **pool_head,
- ast_string_field *ptr, const char *format, va_list ap) __attribute__((format(printf, 4, 0)));
+ struct ast_string_field_pool **pool_head,
+ ast_string_field *ptr, const char *format, va_list ap,
+ const char *file, int lineno, const char *func) __attribute__((format(printf, 4, 0)));
/*!
\brief Declare a string field
@@ -434,7 +431,7 @@ int __ast_string_field_init(struct ast_string_field_mgr *mgr, struct ast_string_
* \internal
* \brief internal version of ast_calloc_with_stringfields
*/
-void * attribute_malloc __ast_calloc_with_stringfields(unsigned int num_structs,
+void *__ast_calloc_with_stringfields(unsigned int num_structs,
size_t struct_size, size_t field_mgr_offset, size_t field_mgr_pool_offset, size_t pool_size,
const char *file, int lineno, const char *func);
@@ -479,7 +476,7 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head,
__res__; \
})
-#define ast_string_field_ptr_set_by_fields(field_mgr_pool, field_mgr, ptr, data) \
+#define __ast_string_field_ptr_set_by_fields(field_mgr_pool, field_mgr, ptr, data, file, lineno, func) \
({ \
int __res__ = 0; \
const char *__d__ = (data); \
@@ -491,7 +488,7 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head,
*__p__ = __ast_string_field_empty; \
} else if ((__dlen__ <= AST_STRING_FIELD_ALLOCATION(*__p__)) || \
(!__ast_string_field_ptr_grow(&field_mgr, &field_mgr_pool, __dlen__, __p__)) || \
- (target = __ast_string_field_alloc_space(&field_mgr, &field_mgr_pool, __dlen__))) { \
+ (target = __ast_string_field_alloc_space(&field_mgr, &field_mgr_pool, __dlen__, file, lineno, func))) { \
if (target != *__p__) { \
__ast_string_field_release_active(field_mgr_pool, *__p__); \
*__p__ = target; \
@@ -503,6 +500,9 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head,
__res__; \
})
+#define ast_string_field_ptr_set_by_fields(field_mgr_pool, field_mgr, ptr, data) \
+ __ast_string_field_ptr_set_by_fields(field_mgr_pool, field_mgr, ptr, data, __FILE__, __LINE__, __PRETTY_FUNCTION__)
+
/*!
\brief Set a field to a simple string value
\param x Pointer to a structure containing fields
@@ -532,7 +532,8 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head,
({ \
int __res__ = -1; \
if (((void *)(x)) != NULL) { \
- __ast_string_field_ptr_build(&(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) ptr, fmt, args); \
+ __ast_string_field_ptr_build(__FILE__, __LINE__, __PRETTY_FUNCTION__, \
+ &(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) ptr, fmt, args); \
__res__ = 0; \
} \
__res__; \
@@ -550,7 +551,8 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head,
({ \
int __res__ = -1; \
if (((void *)(x)) != NULL) { \
- __ast_string_field_ptr_build(&(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) &(x)->field, fmt, args); \
+ __ast_string_field_ptr_build(__FILE__, __LINE__, __PRETTY_FUNCTION__, \
+ &(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) &(x)->field, fmt, args); \
__res__ = 0; \
} \
__res__; \
@@ -568,7 +570,8 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head,
({ \
int __res__ = -1; \
if (((void *)(x)) != NULL) { \
- __ast_string_field_ptr_build_va(&(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) ptr, fmt, args); \
+ __ast_string_field_ptr_build_va(&(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) ptr, fmt, args, \
+ __FILE__, __LINE__, __PRETTY_FUNCTION__); \
__res__ = 0; \
} \
__res__; \
@@ -586,7 +589,8 @@ void __ast_string_field_release_active(struct ast_string_field_pool *pool_head,
({ \
int __res__ = -1; \
if (((void *)(x)) != NULL) { \
- __ast_string_field_ptr_build_va(&(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) &(x)->field, fmt, args); \
+ __ast_string_field_ptr_build_va(&(x)->__field_mgr, &(x)->__field_mgr_pool, (ast_string_field *) &(x)->field, fmt, args, \
+ __FILE__, __LINE__, __PRETTY_FUNCTION__); \
__res__ = 0; \
} \
__res__; \
@@ -626,12 +630,14 @@ int __ast_string_fields_cmp(struct ast_string_field_vector *left, struct ast_str
if (((void *)(copy)) != NULL && ((void *)(orig)) != NULL) { \
__res__ = __ast_string_fields_copy(((copy)->__field_mgr_pool), \
(struct ast_string_field_mgr *)&((copy)->__field_mgr), \
- (struct ast_string_field_mgr *)&((orig)->__field_mgr)); \
+ (struct ast_string_field_mgr *)&((orig)->__field_mgr), \
+ __FILE__, __LINE__, __PRETTY_FUNCTION__); \
} \
__res__; \
})
int __ast_string_fields_copy(struct ast_string_field_pool *copy_pool,
- struct ast_string_field_mgr *copy_mgr, struct ast_string_field_mgr *orig_mgr);
+ struct ast_string_field_mgr *copy_mgr, struct ast_string_field_mgr *orig_mgr,
+ const char *file, int lineno, const char *func);
#endif /* _ASTERISK_STRINGFIELDS_H */
diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h
index 963519dc7..e4bef5f0f 100644
--- a/include/asterisk/strings.h
+++ b/include/asterisk/strings.h
@@ -168,7 +168,7 @@ char *ast_trim_blanks(char *str),
if (work) {
work += strlen(work) - 1;
- /* It's tempting to only want to erase after we exit this loop,
+ /* It's tempting to only want to erase after we exit this loop,
but since ast_trim_blanks *could* receive a constant string
(which we presumably wouldn't have to touch), we shouldn't
actually set anything unless we must, and it's easier just
@@ -198,7 +198,7 @@ char * attribute_pure ast_skip_nonblanks(const char *str),
return (char *) str;
}
)
-
+
/*!
\brief Strip leading/trailing whitespace from a string.
\param s The string to be stripped (will be modified).
@@ -215,7 +215,7 @@ char *ast_strip(char *s),
ast_trim_blanks(s);
}
return s;
-}
+}
)
/*!
@@ -256,7 +256,7 @@ enum ast_strsep_flags {
/*!
\brief Act like strsep but ignore separators inside quotes.
- \param s Pointer to address of the the string to be processed.
+ \param s Pointer to address of the string to be processed.
Will be modified and can't be constant.
\param sep A single character delimiter.
\param flags Controls post-processing of the result.
@@ -305,7 +305,7 @@ enum ast_strsep_flags {
char *ast_strsep(char **s, const char sep, uint32_t flags);
/*!
- \brief Strip backslash for "escaped" semicolons,
+ \brief Strip backslash for "escaped" semicolons,
the string to be stripped (will be modified).
\return The stripped string.
*/
@@ -402,7 +402,7 @@ void ast_copy_string(char *dst, const char *src, size_t size),
/*!
\brief Build a string in a buffer, designed to be called repeatedly
-
+
\note This method is not recommended. New code should use ast_str_*() instead.
This is a wrapper for snprintf, that properly handles the buffer pointer
@@ -418,7 +418,7 @@ int ast_build_string(char **buffer, size_t *space, const char *fmt, ...) __attri
/*!
\brief Build a string in a buffer, designed to be called repeatedly
-
+
This is a wrapper for snprintf, that properly handles the buffer pointer
and buffer space available.
@@ -442,11 +442,11 @@ int ast_build_string_va(char **buffer, size_t *space, const char *fmt, va_list a
*/
int attribute_pure ast_true(const char *val);
-/*!
+/*!
* \brief Make sure something is false.
* Determine if a string containing a boolean value is "false".
- * This function checks to see whether a string passed to it is an indication of an "false" value.
- * It checks to see if the string is "no", "false", "n", "f", "off" or "0".
+ * This function checks to see whether a string passed to it is an indication of an "false" value.
+ * It checks to see if the string is "no", "false", "n", "f", "off" or "0".
*
* \retval 0 if val is a NULL pointer.
* \retval -1 if "true".
@@ -617,8 +617,8 @@ int ast_regex_string_to_regex_pattern(const char *regex_string, struct ast_str *
* \note The result of this function is dynamically allocated memory, and must
* be free()'d after it is no longer needed.
*/
-#ifdef __AST_DEBUG_MALLOC
-#define ast_str_create(a) _ast_str_create(a,__FILE__,__LINE__,__PRETTY_FUNCTION__)
+#define ast_str_create(init_len) \
+ _ast_str_create(init_len, __FILE__, __LINE__, __PRETTY_FUNCTION__)
AST_INLINE_API(
struct ast_str * attribute_malloc _ast_str_create(size_t init_len,
const char *file, int lineno, const char *func),
@@ -636,24 +636,6 @@ struct ast_str * attribute_malloc _ast_str_create(size_t init_len,
return buf;
}
)
-#else
-AST_INLINE_API(
-struct ast_str * attribute_malloc ast_str_create(size_t init_len),
-{
- struct ast_str *buf;
-
- buf = (struct ast_str *)ast_calloc(1, sizeof(*buf) + init_len);
- if (buf == NULL)
- return NULL;
-
- buf->__AST_STR_LEN = init_len;
- buf->__AST_STR_USED = 0;
- buf->__AST_STR_TS = DS_MALLOC;
-
- return buf;
-}
-)
-#endif
/*! \brief Reset the content of a dynamic string.
* Useful before a series of ast_str_append.
@@ -754,7 +736,7 @@ char *ast_str_truncate(struct ast_str *buf, ssize_t len),
return buf->__AST_STR_STR;
}
)
-
+
/*
* AST_INLINE_API() is a macro that takes a block of code as an argument.
* Using preprocessor #directives in the argument is not supported by all
@@ -772,13 +754,12 @@ char *ast_str_truncate(struct ast_str *buf, ssize_t len),
/*!
* Make space in a new string (e.g. to read in data from a file)
*/
-#ifdef __AST_DEBUG_MALLOC
AST_INLINE_API(
int _ast_str_make_space(struct ast_str **buf, size_t new_len, const char *file, int lineno, const char *function),
{
struct ast_str *old_buf = *buf;
- if (new_len <= (*buf)->__AST_STR_LEN)
+ if (new_len <= (*buf)->__AST_STR_LEN)
return 0; /* success */
if ((*buf)->__AST_STR_TS == DS_ALLOCA || (*buf)->__AST_STR_TS == DS_STATIC)
return -1; /* cannot extend */
@@ -796,32 +777,8 @@ int _ast_str_make_space(struct ast_str **buf, size_t new_len, const char *file,
return 0;
}
)
-#define ast_str_make_space(a,b) _ast_str_make_space(a,b,__FILE__,__LINE__,__PRETTY_FUNCTION__)
-#else
-AST_INLINE_API(
-int ast_str_make_space(struct ast_str **buf, size_t new_len),
-{
- struct ast_str *old_buf = *buf;
-
- if (new_len <= (*buf)->__AST_STR_LEN)
- return 0; /* success */
- if ((*buf)->__AST_STR_TS == DS_ALLOCA || (*buf)->__AST_STR_TS == DS_STATIC)
- return -1; /* cannot extend */
- *buf = (struct ast_str *)ast_realloc(*buf, new_len + sizeof(struct ast_str));
- if (*buf == NULL) {
- *buf = old_buf;
- return -1;
- }
- if ((*buf)->__AST_STR_TS != DS_MALLOC) {
- pthread_setspecific((*buf)->__AST_STR_TS->key, *buf);
- _DB1(__ast_threadstorage_object_replace(old_buf, *buf, new_len + sizeof(struct ast_str));)
- }
-
- (*buf)->__AST_STR_LEN = new_len;
- return 0;
-}
-)
-#endif
+#define ast_str_make_space(buf, new_len) \
+ _ast_str_make_space(buf, new_len, __FILE__, __LINE__, __PRETTY_FUNCTION__)
AST_INLINE_API(
int ast_str_copy_string(struct ast_str **dst, struct ast_str *src),
@@ -855,8 +812,8 @@ int ast_str_copy_string(struct ast_str **dst, struct ast_str *src),
* \brief Retrieve a thread locally stored dynamic string
*
* \param ts This is a pointer to the thread storage structure declared by using
- * the AST_THREADSTORAGE macro. If declared with
- * AST_THREADSTORAGE(my_buf, my_buf_init), then this argument would be
+ * the AST_THREADSTORAGE macro. If declared with
+ * AST_THREADSTORAGE(my_buf, my_buf_init), then this argument would be
* (&my_buf).
* \param init_len This is the initial length of the thread's dynamic string. The
* current length may be bigger if previous operations in this thread have
@@ -965,14 +922,12 @@ enum {
* through calling one of the other functions or macros defined in this
* file.
*/
-#ifdef __AST_DEBUG_MALLOC
-int __attribute__((format(printf, 4, 0))) __ast_debug_str_helper(struct ast_str **buf, ssize_t max_len,
- int append, const char *fmt, va_list ap, const char *file, int lineno, const char *func);
-#define __ast_str_helper(a,b,c,d,e) __ast_debug_str_helper(a,b,c,d,e,__FILE__,__LINE__,__PRETTY_FUNCTION__)
-#else
-int __attribute__((format(printf, 4, 0))) __ast_str_helper(struct ast_str **buf, ssize_t max_len,
- int append, const char *fmt, va_list ap);
-#endif
+int __attribute__((format(printf, 4, 0))) __ast_str_helper(struct ast_str **buf,
+ ssize_t max_len, int append, const char *fmt, va_list ap,
+ const char *file, int lineno, const char *func);
+#define _ast_str_helper(buf, max_len, append, fmt, ap) \
+ __ast_str_helper(buf, max_len, append, fmt, ap, __FILE__, __LINE__, __PRETTY_FUNCTION__)
+
char *__ast_str_helper2(struct ast_str **buf, ssize_t max_len,
const char *src, size_t maxsrc, int append, int escapecommas);
@@ -1008,7 +963,7 @@ char *__ast_str_helper2(struct ast_str **buf, ssize_t max_len,
* va_start(fmt, ap);
* ast_str_set_va(&buf, 0, fmt, ap);
* va_end(ap);
- *
+ *
* printf("This is the string we just built: %s\n", buf->str);
* ...
* }
@@ -1022,7 +977,7 @@ char *__ast_str_helper2(struct ast_str **buf, ssize_t max_len,
*/
AST_INLINE_API(int __attribute__((format(printf, 3, 0))) ast_str_set_va(struct ast_str **buf, ssize_t max_len, const char *fmt, va_list ap),
{
- return __ast_str_helper(buf, max_len, 0, fmt, ap);
+ return _ast_str_helper(buf, max_len, 0, fmt, ap);
}
)
@@ -1040,7 +995,7 @@ AST_INLINE_API(int __attribute__((format(printf, 3, 0))) ast_str_set_va(struct a
*/
AST_INLINE_API(int __attribute__((format(printf, 3, 0))) ast_str_append_va(struct ast_str **buf, ssize_t max_len, const char *fmt, va_list ap),
{
- return __ast_str_helper(buf, max_len, 1, fmt, ap);
+ return _ast_str_helper(buf, max_len, 1, fmt, ap);
}
)
diff --git a/include/asterisk/tcptls.h b/include/asterisk/tcptls.h
index 1e3a7524b..9cf9fd6b2 100644
--- a/include/asterisk/tcptls.h
+++ b/include/asterisk/tcptls.h
@@ -26,7 +26,7 @@
*
* TLS/SSL support is basically implemented by reading from a config file
* (currently manager.conf, http.conf and sip.conf) the names of the certificate
- * files and cipher to use, and then run ssl_setup() to create an appropriate
+ * files and cipher to use, and then run ssl_setup() to create an appropriate
* data structure named ssl_ctx.
*
* If we support multiple domains, presumably we need to read multiple
@@ -44,7 +44,7 @@
* and their setup should be moved to a more central place, e.g. asterisk.conf
* and the source files that processes it. Similarly, ssl_setup() should
* be run earlier in the startup process so modules have it available.
- *
+ *
* \ref AstTlsOverview
*
* \todo For SIP, the SubjectAltNames should be checked on verification
@@ -163,7 +163,7 @@ struct ast_tcptls_session_instance {
void *private_data;
};
-/*!
+/*!
* \brief attempts to connect and start tcptls session, on error the tcptls_session's
* ref count is decremented, fd and file are closed, and NULL is returned.
*/
diff --git a/include/asterisk/tdd.h b/include/asterisk/tdd.h
index 6fb7e3e27..7ae81490d 100644
--- a/include/asterisk/tdd.h
+++ b/include/asterisk/tdd.h
@@ -29,7 +29,7 @@
struct tdd_state;
typedef struct tdd_state TDDSTATE;
-/*! CallerID Initialization
+/*! CallerID Initialization
* Initializes the TDD system. Mostly stuff for inverse FFT
*/
void tdd_init(void);
@@ -43,7 +43,7 @@ void tdd_init(void);
*/
int tdd_generate(struct tdd_state *tdd, unsigned char *buf, const char *string);
-/*! Create a TDD state machine
+/*! Create a TDD state machine
* This function returns a malloc'd instance of the tdd_state data structure.
* Returns a pointer to a malloc'd tdd_state structure, or NULL on error.
*/
@@ -60,13 +60,13 @@ struct tdd_state *tdd_new(void);
*/
int tdd_feed(struct tdd_state *tdd, unsigned char *ubuf, int samples);
-/*! Free a TDD state machine
+/*! Free a TDD state machine
* \param tdd This is the tdd_state state machine to free
* This function frees tdd_state tdd.
*/
void tdd_free(struct tdd_state *tdd);
-/*! Generate Echo Canceller disable tone (2100HZ)
+/*! Generate Echo Canceller disable tone (2100HZ)
* \param outbuf This is the buffer to receive the tone data
* \param len This is the length (in samples) of the tone data to generate
* Returns 0 if no error, and -1 if error.
@@ -74,7 +74,7 @@ void tdd_free(struct tdd_state *tdd);
int ast_tdd_gen_ecdisa(unsigned char *outbuf, int len);
-/*! Generate hold tone
+/*! Generate hold tone
* \param outbuf This is the buffer to receive the tone data
*/
int tdd_gen_holdtone(unsigned char* outbuf);
diff --git a/include/asterisk/threadstorage.h b/include/asterisk/threadstorage.h
index 4e61f42d2..8c3ca0045 100644
--- a/include/asterisk/threadstorage.h
+++ b/include/asterisk/threadstorage.h
@@ -82,9 +82,9 @@ void __ast_threadstorage_object_replace(void *key_old, void *key_new, size_t len
* \endcode
*/
#define AST_THREADSTORAGE(name) \
- AST_THREADSTORAGE_CUSTOM_SCOPE(name, NULL, ast_free_ptr, static)
+ AST_THREADSTORAGE_CUSTOM_SCOPE(name, NULL, ast_free_ptr, static)
#define AST_THREADSTORAGE_PUBLIC(name) \
- AST_THREADSTORAGE_CUSTOM_SCOPE(name, NULL, ast_free_ptr,)
+ AST_THREADSTORAGE_CUSTOM_SCOPE(name, NULL, ast_free_ptr,)
#define AST_THREADSTORAGE_EXTERNAL(name) \
extern struct ast_threadstorage name
#define AST_THREADSTORAGE_RAW(name) \
@@ -149,7 +149,7 @@ static void __init_##name(void) \
* \brief Retrieve thread storage
*
* \param ts This is a pointer to the thread storage structure declared by using
- * the AST_THREADSTORAGE macro. If declared with
+ * the AST_THREADSTORAGE macro. If declared with
* AST_THREADSTORAGE(my_buf), then this argument would be (&my_buf).
* \param init_size This is the amount of space to be allocated the first time
* this thread requests its data. Thus, this should be the size that the
diff --git a/include/asterisk/timing.h b/include/asterisk/timing.h
index 268200375..5dad850e1 100644
--- a/include/asterisk/timing.h
+++ b/include/asterisk/timing.h
@@ -88,7 +88,7 @@ struct ast_timing_interface {
* \param i An instance of the \c ast_timing_interfaces structure with pointers
* to the functions provided by the timing implementation.
*
- * \retval NULL failure
+ * \retval NULL failure
* \retval non-Null handle to be passed to ast_unregister_timing_interface() on success
* \since 1.6.1
*/
diff --git a/include/asterisk/translate.h b/include/asterisk/translate.h
index a52e13347..b2da45326 100644
--- a/include/asterisk/translate.h
+++ b/include/asterisk/translate.h
@@ -107,7 +107,7 @@ enum ast_trans_cost_table {
};
/*! \brief
- * Descriptor of a translator.
+ * Descriptor of a translator.
*
* Name, callbacks, and various options
* related to run-time operation (size of buffers, auxiliary
@@ -148,15 +148,15 @@ struct ast_translator {
* on computation time. This cost value is computed based
* on the time required to translate sample data. */
- int (*newpvt)(struct ast_trans_pvt *); /*!< initialize private data
+ int (*newpvt)(struct ast_trans_pvt *); /*!< initialize private data
* associated with the translator */
int (*framein)(struct ast_trans_pvt *pvt, struct ast_frame *in);
- /*!< Input frame callback. Store
+ /*!< Input frame callback. Store
* (and possibly convert) input frame. */
struct ast_frame * (*frameout)(struct ast_trans_pvt *pvt);
- /*!< Output frame callback. Generate a frame
+ /*!< Output frame callback. Generate a frame
* with outbuf content. */
void (*feedback)(struct ast_trans_pvt *pvt, struct ast_frame *feedback);
@@ -164,7 +164,7 @@ struct ast_translator {
* input frame. */
void (*destroy)(struct ast_trans_pvt *pvt);
- /*!< cleanup private data, if needed
+ /*!< cleanup private data, if needed
* (often unnecessary). */
struct ast_frame * (*sample)(void); /*!< Generate an example frame */
@@ -301,9 +301,9 @@ int ast_translator_best_choice(struct ast_format_cap *dst_cap,
struct ast_format **dst_fmt_out,
struct ast_format **src_fmt_out);
-/*!
+/*!
* \brief Builds a translator path
- * Build a path (possibly NULL) from source to dest
+ * Build a path (possibly NULL) from source to dest
* \param dst dest destination format
* \param src source source format
* \return ast_trans_pvt on success, NULL on failure
diff --git a/include/asterisk/udptl.h b/include/asterisk/udptl.h
index 456a5adbc..0d79d6f66 100644
--- a/include/asterisk/udptl.h
+++ b/include/asterisk/udptl.h
@@ -2,7 +2,7 @@
* Asterisk -- An open source telephony toolkit.
*
* UDPTL support for T.38
- *
+ *
* Copyright (C) 2005, Steve Underwood, partly based on RTP code which is
* Copyright (C) 1999-2004, Digium, Inc.
*
@@ -54,7 +54,7 @@ struct ast_udptl *ast_udptl_new_with_bindaddr(struct ast_sched_context *sched, s
* \brief Associates a character string 'tag' with a UDPTL session.
* \param udptl The UDPTL session.
* \param format printf-style format string used to construct the tag
- *
+ *
* This function formats a tag for the specified UDPTL
* session, so that any log messages generated by the UDPTL stack
* related to that session will include the tag and the reader of
@@ -98,15 +98,15 @@ void ast_udptl_set_error_correction_scheme(struct ast_udptl *udptl, enum ast_t38
void ast_udptl_set_local_max_ifp(struct ast_udptl *udptl, unsigned int max_ifp);
-/*!
+/*!
* \brief retrieves local_max_datagram.
- *
+ *
* \retval positive value representing max datagram size.
* \retval 0 if no value is present
*/
unsigned int ast_udptl_get_local_max_datagram(struct ast_udptl *udptl);
-/*!
+/*!
* \brief sets far max datagram size. If max_datagram is = 0, the far max datagram
* size is set to a default value.
*/
@@ -114,9 +114,9 @@ void ast_udptl_set_far_max_datagram(struct ast_udptl *udptl, unsigned int max_da
unsigned int ast_udptl_get_far_max_datagram(const struct ast_udptl *udptl);
-/*!
+/*!
* \brief retrieves far max ifp
- *
+ *
* \retval positive value representing max ifp size
* \retval 0 if no value is present
*/
@@ -126,13 +126,6 @@ void ast_udptl_setnat(struct ast_udptl *udptl, int nat);
void ast_udptl_stop(struct ast_udptl *udptl);
-void ast_udptl_init(void);
-
-/*!
- * \version 1.6.1 return changed to int
- */
-int ast_udptl_reload(void);
-
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index 0a12b1d8a..bb9aa2a3c 100644
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -509,11 +509,11 @@ long int ast_random(void);
#endif
-#ifndef __AST_DEBUG_MALLOC
-#define ast_std_malloc malloc
-#define ast_std_calloc calloc
-#define ast_std_realloc realloc
-#define ast_std_free free
+#if !defined(NO_MALLOC_DEBUG) && !defined(STANDALONE) && !defined(STANDALONE2)
+void *ast_std_malloc(size_t size);
+void *ast_std_calloc(size_t nmemb, size_t size);
+void *ast_std_realloc(void *ptr, size_t size);
+void ast_std_free(void *ptr);
/*!
* \brief free() wrapper
@@ -521,8 +521,44 @@ long int ast_random(void);
* ast_free_ptr should be used when a function pointer for free() needs to be passed
* as the argument to a function. Otherwise, astmm will cause seg faults.
*/
+void ast_free_ptr(void *ptr);
+void __ast_free(void *ptr, const char *file, int lineno, const char *func);
+
+#else
+
+/*
+ * Need to defeat the MALLOC_DEBUG API when building the standalone utilities.
+ */
+
+#define ast_std_malloc malloc
+#define ast_std_calloc calloc
+#define ast_std_realloc realloc
+#define ast_std_free free
+
+#define ast_free_ptr free
#define ast_free free
-#define ast_free_ptr ast_free
+
+#define __ast_repl_calloc(nmemb, size, file, lineno, func) \
+ calloc(nmemb, size)
+
+#define __ast_repl_calloc_cache(nmemb, size, file, lineno, func) \
+ calloc(nmemb, size)
+
+#define __ast_repl_malloc(size, file, lineno, func) \
+ malloc(size)
+
+#define __ast_repl_realloc(ptr, size, file, lineno, func) \
+ realloc(ptr, size)
+
+#define __ast_repl_strdup(s, file, lineno, func) \
+ strdup(s)
+
+#define __ast_repl_strndup(s, n, file, lineno, func) \
+ strndup(s, n)
+
+#define __ast_repl_vasprintf(strp, format, ap, file, lineno, func) \
+ vasprintf(strp, format, ap)
+#endif
#if defined(AST_IN_CORE)
#define MALLOC_FAILURE_MSG \
@@ -539,7 +575,8 @@ void * attribute_malloc __ast_malloc(size_t len, const char *file, int lineno, c
DEBUG_CHAOS_RETURN(DEBUG_CHAOS_ALLOC_CHANCE, NULL);
- if (!(p = malloc(len))) {
+ p = __ast_repl_malloc(len, file, lineno, func);
+ if (!p) {
MALLOC_FAILURE_MSG;
}
@@ -554,7 +591,24 @@ void * attribute_malloc __ast_calloc(size_t num, size_t len, const char *file, i
DEBUG_CHAOS_RETURN(DEBUG_CHAOS_ALLOC_CHANCE, NULL);
- if (!(p = calloc(num, len))) {
+ p = __ast_repl_calloc(num, len, file, lineno, func);
+ if (!p) {
+ MALLOC_FAILURE_MSG;
+ }
+
+ return p;
+}
+)
+
+AST_INLINE_API(
+void * attribute_malloc __ast_calloc_cache(size_t num, size_t len, const char *file, int lineno, const char *func),
+{
+ void *p;
+
+ DEBUG_CHAOS_RETURN(DEBUG_CHAOS_ALLOC_CHANCE, NULL);
+
+ p = __ast_repl_calloc_cache(num, len, file, lineno, func);
+ if (!p) {
MALLOC_FAILURE_MSG;
}
@@ -563,13 +617,14 @@ void * attribute_malloc __ast_calloc(size_t num, size_t len, const char *file, i
)
AST_INLINE_API(
-void * attribute_malloc __ast_realloc(void *p, size_t len, const char *file, int lineno, const char *func),
+void *__ast_realloc(void *p, size_t len, const char *file, int lineno, const char *func),
{
void *newp;
DEBUG_CHAOS_RETURN(DEBUG_CHAOS_ALLOC_CHANCE, NULL);
- if (!(newp = realloc(p, len))) {
+ newp = __ast_repl_realloc(p, len, file, lineno, func);
+ if (!newp) {
MALLOC_FAILURE_MSG;
}
@@ -585,7 +640,8 @@ char * attribute_malloc __ast_strdup(const char *str, const char *file, int line
DEBUG_CHAOS_RETURN(DEBUG_CHAOS_ALLOC_CHANCE, NULL);
if (str) {
- if (!(newstr = strdup(str))) {
+ newstr = __ast_repl_strdup(str, file, lineno, func);
+ if (!newstr) {
MALLOC_FAILURE_MSG;
}
}
@@ -602,7 +658,8 @@ char * attribute_malloc __ast_strndup(const char *str, size_t len, const char *f
DEBUG_CHAOS_RETURN(DEBUG_CHAOS_ALLOC_CHANCE, NULL);
if (str) {
- if (!(newstr = strndup(str, len))) {
+ newstr = __ast_repl_strndup(str, len, file, lineno, func);
+ if (!newstr) {
MALLOC_FAILURE_MSG;
}
}
@@ -611,8 +668,30 @@ char * attribute_malloc __ast_strndup(const char *str, size_t len, const char *f
}
)
-int __attribute__((format(printf, 5, 6)))
- __ast_asprintf(const char *file, int lineno, const char *func, char **ret, const char *fmt, ...);
+AST_INLINE_API(
+__attribute__((format(printf, 5, 6)))
+int __ast_asprintf(const char *file, int lineno, const char *func, char **ret, const char *fmt, ...),
+{
+ int res;
+ va_list ap;
+
+ DEBUG_CHAOS_RETURN(DEBUG_CHAOS_ALLOC_CHANCE, -1);
+
+ va_start(ap, fmt);
+ res = __ast_repl_vasprintf(ret, fmt, ap, file, lineno, func);
+ if (res < 0) {
+ /*
+ * *ret is undefined so set to NULL to ensure it is
+ * initialized to something useful.
+ */
+ *ret = NULL;
+ MALLOC_FAILURE_MSG;
+ }
+ va_end(ap);
+
+ return res;
+}
+)
AST_INLINE_API(
__attribute__((format(printf, 2, 0)))
@@ -622,7 +701,7 @@ int __ast_vasprintf(char **ret, const char *fmt, va_list ap, const char *file, i
DEBUG_CHAOS_RETURN(DEBUG_CHAOS_ALLOC_CHANCE, -1);
- res = vasprintf(ret, fmt, ap);
+ res = __ast_repl_vasprintf(ret, fmt, ap, file, lineno, func);
if (res < 0) {
/*
* *ret is undefined so set to NULL to ensure it is
@@ -636,8 +715,6 @@ int __ast_vasprintf(char **ret, const char *fmt, va_list ap, const char *file, i
}
)
-#endif /* AST_DEBUG_MALLOC */
-
/*!
* \brief A wrapper for malloc()
*
@@ -671,7 +748,7 @@ int __ast_vasprintf(char **ret, const char *fmt, va_list ap, const char *file, i
* The arguments and return value are the same as calloc()
*/
#define ast_calloc_cache(num, len) \
- __ast_calloc((num), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+ __ast_calloc_cache((num), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
/*!
* \brief A wrapper for realloc()
@@ -1141,4 +1218,44 @@ int ast_compare_versions(const char *version1, const char *version2);
*/
int ast_check_ipv6(void);
+enum ast_fd_flag_operation {
+ AST_FD_FLAG_SET,
+ AST_FD_FLAG_CLEAR,
+};
+
+/*
+ * \brief Set flags on the given file descriptor
+ * \since 13.19
+ *
+ * If getting or setting flags of the given file descriptor fails, logs an
+ * error message.
+ *
+ * \param fd File descriptor to set flags on
+ * \param flags The flag(s) to set
+ *
+ * \return -1 on error
+ * \return 0 if successful
+ */
+#define ast_fd_set_flags(fd, flags) \
+ __ast_fd_set_flags((fd), (flags), AST_FD_FLAG_SET, __FILE__, __LINE__, __PRETTY_FUNCTION__)
+
+/*
+ * \brief Clear flags on the given file descriptor
+ * \since 13.19
+ *
+ * If getting or setting flags of the given file descriptor fails, logs an
+ * error message.
+ *
+ * \param fd File descriptor to clear flags on
+ * \param flags The flag(s) to clear
+ *
+ * \return -1 on error
+ * \return 0 if successful
+ */
+#define ast_fd_clear_flags(fd, flags) \
+ __ast_fd_set_flags((fd), (flags), AST_FD_FLAG_CLEAR, __FILE__, __LINE__, __PRETTY_FUNCTION__)
+
+int __ast_fd_set_flags(int fd, int flags, enum ast_fd_flag_operation op,
+ const char *file, int lineno, const char *function);
+
#endif /* _ASTERISK_UTILS_H */
diff --git a/include/asterisk/vector.h b/include/asterisk/vector.h
index 8bd1cefef..d1b2973bf 100644
--- a/include/asterisk/vector.h
+++ b/include/asterisk/vector.h
@@ -51,8 +51,38 @@
/*! \brief Integer vector definition */
AST_VECTOR(ast_vector_int, int);
-/*! \brief String vector definition */
+/*! \brief String vector definitions */
AST_VECTOR(ast_vector_string, char *);
+AST_VECTOR(ast_vector_const_string, const char *);
+
+/*! Options to override default processing of ast_vector_string_split. */
+enum ast_vector_string_split_flags {
+ /*! Do not trim whitespace from values. */
+ AST_VECTOR_STRING_SPLIT_NO_TRIM = 0x01,
+ /*! Append empty strings to the vector. */
+ AST_VECTOR_STRING_SPLIT_ALLOW_EMPTY = 0x02,
+};
+
+/*!
+ * \brief Append a string vector by splitting a string.
+ *
+ * \param dest Pointer to an initialized vector.
+ * \param input String buffer to split.
+ * \param delim String delimeter passed to strsep.
+ * \param flags Processing options defined by \ref enum ast_vector_string_split_flags.
+ * \param excludes_cmp NULL or a function like strcmp to exclude duplicate strings.
+ *
+ * \retval 0 Success
+ * \retval -1 Failure
+ *
+ * \note All elements added to the vector are allocated. The caller is always
+ * responsible for calling ast_free on each element in the vector even
+ * after failure. It's possible for this function to successfully add
+ * some elements before failing.
+ */
+int ast_vector_string_split(struct ast_vector_string *dest,
+ const char *input, const char *delim, int flags,
+ int (*excludes_cmp)(const char *s1, const char *s2));
/*!
* \brief Define a vector structure with a read/write lock
diff --git a/include/asterisk/xml.h b/include/asterisk/xml.h
index ab7b630a2..d80fb26f7 100644
--- a/include/asterisk/xml.h
+++ b/include/asterisk/xml.h
@@ -247,4 +247,3 @@ struct ast_xml_node *ast_xml_xpath_get_first_result(struct ast_xml_xpath_results
struct ast_xml_xpath_results *ast_xml_query(struct ast_xml_doc *doc, const char *xpath_str);
#endif /* _ASTERISK_XML_H */
-
diff --git a/include/jitterbuf.h b/include/jitterbuf.h
index 32579fc6c..9e453a966 100644
--- a/include/jitterbuf.h
+++ b/include/jitterbuf.h
@@ -14,7 +14,7 @@
*/
/*! \file
- * \brief
+ * \brief
* jitterbuf: an application-independent jitterbuffer
* \ref jitterbuf.c
*/
@@ -30,14 +30,14 @@ extern "C" {
/*! \name configuration constants */
/*@{ */
/*! Number of historical timestamps to use in calculating jitter and drift */
-#define JB_HISTORY_SZ 500
+#define JB_HISTORY_SZ 500
/*! what percentage of timestamps should we drop from the history when we examine it;
* this might eventually be something made configurable */
#define JB_HISTORY_DROPPCT 3
/*! the maximum droppct we can handle (say it was configurable). */
#define JB_HISTORY_DROPPCT_MAX 4
/*! the size of the buffer we use to keep the top and botton timestamps for dropping */
-#define JB_HISTORY_MAXBUF_SZ JB_HISTORY_SZ * JB_HISTORY_DROPPCT_MAX / 100
+#define JB_HISTORY_MAXBUF_SZ JB_HISTORY_SZ * JB_HISTORY_DROPPCT_MAX / 100
/*! amount of additional jitterbuffer adjustment */
#define JB_TARGET_EXTRA 40
/*! ms between growing and shrinking; may not be honored if jitterbuffer runs out of space */
@@ -131,10 +131,10 @@ void jb_destroy(jitterbuf *jb);
* you will leak queued frames, and some internal structures */
void jb_reset(jitterbuf *jb);
-/*!\brief queue a frame
- *
- * data=frame data, timings (in ms): ms=length of frame (for voice), ts=ts (sender's time)
- * now=now (in receiver's time) return value is one of
+/*!\brief queue a frame
+ *
+ * data=frame data, timings (in ms): ms=length of frame (for voice), ts=ts (sender's time)
+ * now=now (in receiver's time) return value is one of
* JB_OK: Frame added. Last call to jb_next() still valid
* JB_DROP: Drop this frame immediately
* JB_SCHED: Frame added. Call jb_next() to get a new time for the next frame
@@ -145,7 +145,7 @@ enum jb_return_code jb_put(jitterbuf *jb, void *data, const enum jb_frame_type t
* JB_OK: You've got frame!
* JB_DROP: Here's an audio frame you should just drop. Ask me again for this time..
* JB_NOFRAME: There's no frame scheduled for this time.
- * JB_INTERP: Please interpolate an interpl-length frame for this time (either we need to grow, or there was a lost frame)
+ * JB_INTERP: Please interpolate an interpl-length frame for this time (either we need to grow, or there was a lost frame)
* JB_EMPTY: The jb is empty.
*/
enum jb_return_code jb_get(jitterbuf *jb, jb_frame *frame, long now, long interpl);
@@ -153,7 +153,7 @@ enum jb_return_code jb_get(jitterbuf *jb, jb_frame *frame, long now, long interp
/*! \brief unconditionally get frames from jitterbuf until empty */
enum jb_return_code jb_getall(jitterbuf *jb, jb_frame *frameout);
-/*! \brief when is the next frame due out, in receiver's time (0=EMPTY)
+/*! \brief when is the next frame due out, in receiver's time (0=EMPTY)
* This value may change as frames are added (esp non-audio frames) */
long jb_next(jitterbuf *jb);
diff --git a/include/solaris-compat/sys/queue.h b/include/solaris-compat/sys/queue.h
index ac273dfe3..2176b9664 100644
--- a/include/solaris-compat/sys/queue.h
+++ b/include/solaris-compat/sys/queue.h
@@ -117,12 +117,12 @@ struct name { \
#define SLIST_HEAD_INITIALIZER(head) \
{ NULL }
-
+
#define SLIST_ENTRY(type) \
struct { \
struct type *sle_next; /* next element */ \
}
-
+
/*
* Singly-linked List functions.
*/
@@ -537,4 +537,3 @@ void remque __P((void *a));
#endif /* KERNEL */
#endif /* !_SYS_QUEUE_H_ */
-