Fri Jun 19 12:09:51 2009

Asterisk developer's documentation


res_curl.c

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (c) 2008, Digium, Inc.
00005  *
00006  * Tilghman Lesher <res_curl_v1@the-tilghman.com>
00007  *
00008  * See http://www.asterisk.org for more information about
00009  * the Asterisk project. Please do not directly contact
00010  * any of the maintainers of this project for assistance;
00011  * the project provides a web site, mailing lists and IRC
00012  * channels for your use.
00013  *
00014  * This program is free software, distributed under the terms of
00015  * the GNU General Public License Version 2. See the LICENSE file
00016  * at the top of the source tree.
00017  */
00018 
00019 /*! \file
00020  *
00021  * \brief curl resource engine
00022  *
00023  * \author Tilghman Lesher <res_curl_v1@the-tilghman.com>
00024  *
00025  * \extref Depends on the CURL library  - http://curl.haxx.se/
00026  * 
00027  */
00028 
00029 /*** MODULEINFO
00030    <depend>curl</depend>
00031  ***/
00032 
00033 #include "asterisk.h"
00034 
00035 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 125055 $")
00036 
00037 #include <curl/curl.h>
00038 
00039 #include "asterisk/module.h"
00040 
00041 static int unload_module(void)
00042 {
00043    int res = 0;
00044 
00045    /* If the dependent modules are still in memory, forbid unload */
00046    if (ast_module_check("func_curl.so")) {
00047       ast_log(LOG_ERROR, "func_curl.so (dependent module) is still loaded.  Cannot unload res_curl.so\n");
00048       return -1;
00049    }
00050 
00051    if (ast_module_check("res_config_curl.so")) {
00052       ast_log(LOG_ERROR, "res_config_curl.so (dependent module) is still loaded.  Cannot unload res_curl.so\n");
00053       return -1;
00054    }
00055 
00056    curl_global_cleanup();
00057 
00058    return res;
00059 }
00060 
00061 static int load_module(void)
00062 {
00063    int res = 0;
00064 
00065    if (curl_global_init(CURL_GLOBAL_ALL)) {
00066       ast_log(LOG_ERROR, "Unable to initialize the CURL library. Cannot load res_curl\n");
00067       return AST_MODULE_LOAD_DECLINE;
00068    }  
00069 
00070    return res;
00071 }
00072 
00073 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "cURL Resource Module");
00074 
00075 

Generated on Fri Jun 19 12:09:51 2009 for Asterisk - the Open Source PBX by  doxygen 1.4.7