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 const char *dependents[] = {
47 static int unload_module(void)
52 /* If the dependent modules are still in memory, forbid unload */
53 for (i = 0; i < ARRAY_LEN(dependents); i++) {
54 if (ast_module_check(dependents[i])) {
55 ast_log(LOG_ERROR, "%s (dependent module) is still loaded. Cannot unload res_curl.so\n", dependents[i]);
63 curl_global_cleanup();
68 static int load_module(void)
72 if (curl_global_init(CURL_GLOBAL_ALL)) {
73 ast_log(LOG_ERROR, "Unable to initialize the cURL library. Cannot load res_curl.so\n");
74 return AST_MODULE_LOAD_DECLINE;
80 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "cURL Resource Module",
82 .unload = unload_module,
83 .load_pri = AST_MODPRI_REALTIME_DEPEND,