summaryrefslogtreecommitdiff
path: root/include/asterisk/logger.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asterisk/logger.h')
-rw-r--r--include/asterisk/logger.h62
1 files changed, 15 insertions, 47 deletions
diff --git a/include/asterisk/logger.h b/include/asterisk/logger.h
index 84e6991f0..feb9c7eda 100644
--- a/include/asterisk/logger.h
+++ b/include/asterisk/logger.h
@@ -63,7 +63,7 @@ void ast_log(int level, const char *file, int line, const char *function, const
__attribute__((format(printf, 5, 6)));
/* XXX needs documentation */
-struct ast_callid;
+typedef unsigned int ast_callid;
/*! \brief Used for sending a log message with a known call_id
This is a modified logger function which is functionally identical to the above logger function,
@@ -77,7 +77,7 @@ struct ast_callid;
\param callid This is the ast_callid that is associated with the log message. May be NULL.
\param fmt This is what is important. The format is the same as your favorite breed of printf. You know how that works, right? :-)
*/
-void ast_log_callid(int level, const char *file, int line, const char *function, struct ast_callid *callid, const char *fmt, ...)
+void ast_log_callid(int level, const char *file, int line, const char *function, ast_callid callid, const char *fmt, ...)
__attribute__((format(printf, 6, 7)));
/*!
@@ -117,12 +117,12 @@ void __attribute__((format(printf, 5, 6))) __ast_verbose(const char *file, int l
* allow you to specify that a log will never display a call id even when there is a call id bound to the
* thread.
*/
-void __attribute__((format(printf, 6, 7))) __ast_verbose_callid(const char *file, int line, const char *func, int level, struct ast_callid *callid, const char *fmt, ...);
+void __attribute__((format(printf, 6, 7))) __ast_verbose_callid(const char *file, int line, const char *func, int level, ast_callid callid, const char *fmt, ...);
#define ast_verbose(...) __ast_verbose(__FILE__, __LINE__, __PRETTY_FUNCTION__, -1, __VA_ARGS__)
#define ast_verbose_callid(callid, ...) __ast_verbose_callid(__FILE__, __LINE__, __PRETTY_FUNCTION__, -1, callid, __VA_ARGS__)
-void __attribute__((format(printf, 6, 0))) __ast_verbose_ap(const char *file, int line, const char *func, int level, struct ast_callid *callid, const char *fmt, va_list ap);
+void __attribute__((format(printf, 6, 0))) __ast_verbose_ap(const char *file, int line, const char *func, int level, ast_callid callid, const char *fmt, va_list ap);
void __attribute__((format(printf, 2, 3))) ast_child_verbose(int level, const char *fmt, ...);
@@ -277,49 +277,17 @@ const char *ast_logger_get_dateformat(void);
/*!
* \brief factory function to create a new uniquely identifying callid.
*
- * \retval ast_callid struct pointer containing the call id
- *
- * \note The newly created callid will be referenced upon creation and this function should be
- * paired with a call to ast_callid_unref()
+ * \retval The call id
*/
-struct ast_callid *ast_create_callid(void);
+ast_callid ast_create_callid(void);
/*!
* \brief extracts the callerid from the thread
*
- * \retval ast_callid reference to call_id related to the thread
- * \retval NULL if no call_id is present in the thread
- *
- * This reference must be unreffed before it loses scope to prevent memory leaks.
- */
-struct ast_callid *ast_read_threadstorage_callid(void);
-
-/*!
- * \brief Increase callid reference count
- *
- * \param c the ast_callid
- *
- * \retval c always
- */
-#define ast_callid_ref(c) ({ ao2_ref(c, +1); (c); })
-
-/*!
- * \brief Decrease callid reference count
- *
- * \param c the ast_callid
- *
- * \retval NULL always
- */
-#define ast_callid_unref(c) ({ ao2_ref(c, -1); (struct ast_callid *) (NULL); })
-
-/*!
- * \brief Cleanup a callid reference (NULL safe ao2 unreference)
- *
- * \param c the ast_callid
- *
- * \retval NULL always
+ * \retval Non-zero Call id related to the thread
+ * \retval 0 if no call_id is present in the thread
*/
-#define ast_callid_cleanup(c) ({ ao2_cleanup(c); (struct ast_callid *) (NULL); })
+ast_callid ast_read_threadstorage_callid(void);
/*!
* \brief Sets what is stored in the thread storage to the given
@@ -328,7 +296,7 @@ struct ast_callid *ast_read_threadstorage_callid(void);
* \retval 0 - success
* \retval non-zero - failure
*/
-int ast_callid_threadassoc_change(struct ast_callid *callid);
+int ast_callid_threadassoc_change(ast_callid callid);
/*!
* \brief Adds a known callid to thread storage of the calling thread
@@ -336,7 +304,7 @@ int ast_callid_threadassoc_change(struct ast_callid *callid);
* \retval 0 - success
* \retval non-zero - failure
*/
-int ast_callid_threadassoc_add(struct ast_callid *callid);
+int ast_callid_threadassoc_add(ast_callid callid);
/*!
* \brief Removes callid from thread storage of the calling thread
@@ -351,12 +319,12 @@ int ast_callid_threadassoc_remove(void);
* If not, then a new one will be created, bound to the thread, and a reference
* to it will be stored.
*
- * \param callid pointer to struct pointer used to store the referenced callid
+ * \param callid pointer to store the callid
* \retval 0 - callid was found
* \retval 1 - callid was created
* \retval -1 - the function failed somehow (presumably memory problems)
*/
-int ast_callid_threadstorage_auto(struct ast_callid **callid);
+int ast_callid_threadstorage_auto(ast_callid *callid);
/*!
* \brief Use in conjunction with ast_callid_threadstorage_auto. Cleans up the
@@ -365,7 +333,7 @@ int ast_callid_threadstorage_auto(struct ast_callid **callid);
* \param callid The callid set by ast_callid_threadstorage_auto
* \param callid_created The integer returned through ast_callid_threadstorage_auto
*/
-void ast_callid_threadstorage_auto_clean(struct ast_callid *callid, int callid_created);
+void ast_callid_threadstorage_auto_clean(ast_callid callid, int callid_created);
/*!
* \brief copy a string representation of the callid into a target string
@@ -374,7 +342,7 @@ void ast_callid_threadstorage_auto_clean(struct ast_callid *callid, int callid_c
* \param buffer_size maximum writable length of the string (Less than 13 will result in truncation)
* \param callid Callid for which string is being requested
*/
-void ast_callid_strnprint(char *buffer, size_t buffer_size, struct ast_callid *callid);
+void ast_callid_strnprint(char *buffer, size_t buffer_size, ast_callid callid);
/*!
* \brief Send a log message to a dynamically registered log level