Asterisk - The Open Source Telephony Project  18.5.0
res_curl.c
Go to the documentation of this file.
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");
63  }
64 
65  return res;
66 }
67 
69  .support_level = AST_MODULE_SUPPORT_CORE,
70  .load = load_module,
71  .unload = unload_module,
72  .load_pri = AST_MODPRI_REALTIME_DEPEND,
73 );
Asterisk main include file. File version handling, generic pbx functions.
static int unload_module(void)
Definition: res_curl.c:49
#define ast_log
Definition: astobj2.c:42
#define LOG_ERROR
Definition: logger.h:285
Module has failed to load, may be in an inconsistent state.
Definition: module.h:78
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Definition: module.h:46
Asterisk module definitions.
static int load_module(void)
Definition: res_curl.c:56