Debian Codegraph @

res/res_curl.c

raw symbols SCIP
1 /*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (c) 2008, Digium, Inc.
5 *
6 * Tilghman Lesher <[email protected]>
7 *
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.
13 *
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.
17 */
18
19 /*! \file
20 *
21 * \brief curl resource engine
22 *
23 * \author Tilghman Lesher <[email protected]>
24 *
25 * Depends on the CURL library - http://curl.haxx.se/
26 *
27 */
28
29 /*! \li \ref res_curl.c uses the configuration file \ref res_curl.conf
30 * \addtogroup configuration_file Configuration Files
31 */
32
33 /*!
34 * \page res_curl.conf res_curl.conf
35 * \verbinclude res_curl.conf.sample
36 */
37
38 /*** MODULEINFO
39 <depend>curl</depend>
40 <support_level>core</support_level>
41 ***/
42
43 #include "asterisk.h"
44
45 #include <curl/curl.h>
46
47 #include "asterisk/module.h"
48
49 static int unload_module(void)
50 {
51 curl_global_cleanup();
52
53 return 0;
54 }
55
56 static int load_module(void)
57 {
58 int res = AST_MODULE_LOAD_SUCCESS;
59
60 if (curl_global_init(CURL_GLOBAL_ALL)) {
61 ast_log(LOG_ERROR, "Unable to initialize the cURL library. Cannot load res_curl.so\n");
62 return AST_MODULE_LOAD_DECLINE;
63 }
64
65 return res;
66 }
67
68 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "cURL Resource Module",
69 .support_level = AST_MODULE_SUPPORT_CORE,
70 .load = load_module,
71 .unload = unload_module,
72 .load_pri = AST_MODPRI_REALTIME_DEPEND,
73 );