2 * Asterisk -- An open source telephony toolkit.
4 * Copyright (c) 2008, Digium, Inc.
6 * Tilghman Lesher <res_curl_v1@the-tilghman.com>
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
21 * \brief curl resource engine
23 * \author Tilghman Lesher <res_curl_v1@the-tilghman.com>
25 * \extref Depends on the CURL library - http://curl.haxx.se/
31 <support_level>core</support_level>
36 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
38 #include <curl/curl.h>
40 #include "asterisk/module.h"
42 static int unload_module(void)
46 /* If the dependent modules are still in memory, forbid unload */
47 if (ast_module_check("func_curl.so")) {
48 ast_log(LOG_ERROR, "func_curl.so (dependent module) is still loaded. Cannot unload res_curl.so\n");
52 if (ast_module_check("res_config_curl.so")) {
53 ast_log(LOG_ERROR, "res_config_curl.so (dependent module) is still loaded. Cannot unload res_curl.so\n");
57 curl_global_cleanup();
62 static int load_module(void)
66 if (curl_global_init(CURL_GLOBAL_ALL)) {
67 ast_log(LOG_ERROR, "Unable to initialize the CURL library. Cannot load res_curl\n");
68 return AST_MODULE_LOAD_DECLINE;
74 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "cURL Resource Module",
76 .unload = unload_module,
77 .load_pri = AST_MODPRI_REALTIME_DEPEND,