summaryrefslogtreecommitdiff
path: root/include/asterisk/res_pjproject.h
diff options
context:
space:
mode:
authorGeorge Joseph <george.joseph@fairview5.com>2016-01-18 18:27:57 -0700
committerGeorge Joseph <george.joseph@fairview5.com>2016-01-20 09:56:13 -0700
commitdd5c063934ab816f3826d89d363f285307d1f051 (patch)
treeabd78ef80969c06e9ce39bdebe44ab170927a3bf /include/asterisk/res_pjproject.h
parent130aa1427eeb6d56c149ca1f30a170d38d4830dc (diff)
res_pjproject: Add module providing pjproject logging and utils
res_pjsip_log_forwarder has been renamed to res_pjproject and enhanced as follows: As a follow-on to the recent 'Add CLI "pjsip show buildopts"' patch, a new ast_pjproject_get_buildopt function has been added. It allows the caller to get the value of one of the buildopts. The initial use case is retrieving the runtime value of PJ_MAX_HOSTNAME to insure we don't send a hostname greater than pjproject can handle. Since it can differ between the version of pjproject that Asterisk was compiled against and the version of pjproject that Asterisk is running against, we can't use the PJ_MAX_HOSTNAME macro directly in Asterisk source code. Change-Id: Iab6e82fec3d7cf00c1cf6185c42be3e7569dee1e
Diffstat (limited to 'include/asterisk/res_pjproject.h')
-rw-r--r--include/asterisk/res_pjproject.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/include/asterisk/res_pjproject.h b/include/asterisk/res_pjproject.h
new file mode 100644
index 000000000..2095caed2
--- /dev/null
+++ b/include/asterisk/res_pjproject.h
@@ -0,0 +1,62 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2016, Fairview 5 Engineering, LLC
+ *
+ * George Joseph <george.joseph@fairview5.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.
+ */
+
+#ifndef _RES_PJPROJECT_H
+#define _RES_PJPROJECT_H
+
+/*!
+ * \brief Retrieve a pjproject build option
+ *
+ * \param option The build option requested
+ * \param format_string A scanf-style format string to parse the option value into
+ * \param ... Pointers to variables to receive the values parsed
+ *
+ * \retval The number of values parsed
+ *
+ * \since 13.8.0
+ *
+ * \note The option requested must be from those returned by pj_dump_config()
+ * which can be displayed with the 'pjsip show buildopts' CLI command.
+ *
+ * <b>Sample Usage:</b>
+ * \code
+ *
+ * int max_hostname;
+ *
+ * ast_sip_get_pjproject_buildopt("PJ_MAX_HOSTNAME", "%d", &max_hostname);
+ *
+ * \endcode
+ *
+ */
+int ast_pjproject_get_buildopt(char *option, char *format_string, ...) __attribute__((format(scanf, 2,3)));
+
+/*!
+ * \brief Increment the res_pjproject reference count.
+ *
+ * This ensures graceful shutdown happens in the proper order.
+ */
+void ast_pjproject_ref(void);
+
+/*!
+ * \brief Decrement the res_pjproject reference count.
+ *
+ * This ensures graceful shutdown happens in the proper order.
+ */
+void ast_pjproject_unref(void);
+
+#endif /* _RES_PJPROJECT_H */