res_curl.c File Reference

curl resource engine More...

#include "asterisk.h"
#include <curl/curl.h>
#include "asterisk/module.h"

Include dependency graph for res_curl.c:

Go to the source code of this file.

Functions

static void __reg_module (void)
static void __unreg_module (void)
static int load_module (void)
 Load the module.
static int unload_module (void)

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "cURL Resource Module" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_REALTIME_DEPEND, }
static struct ast_module_infoast_module_info = &__mod_info
static const char * dependents []


Detailed Description

curl resource engine

Author:
Tilghman Lesher <res_curl_v1@the-tilghman.com>
Depends on the CURL library - http://curl.haxx.se/

Definition in file res_curl.c.


Function Documentation

static void __reg_module ( void   )  [static]

Definition at line 104 of file res_curl.c.

static void __unreg_module ( void   )  [static]

Definition at line 104 of file res_curl.c.

static int load_module ( void   )  [static]

Load the module.

Module loading including tests for configuration or dependencies. This function can return AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_DECLINE, or AST_MODULE_LOAD_SUCCESS. If a dependency or environment variable fails tests return AST_MODULE_LOAD_FAILURE. If the module can not load the configuration file or other non-critical problem return AST_MODULE_LOAD_DECLINE. On success return AST_MODULE_LOAD_SUCCESS.

Definition at line 87 of file res_curl.c.

References ast_log, AST_MODULE_LOAD_DECLINE, and LOG_ERROR.

00088 {
00089    int res = 0;
00090 
00091    if (curl_global_init(CURL_GLOBAL_ALL)) {
00092       ast_log(LOG_ERROR, "Unable to initialize the cURL library. Cannot load res_curl.so\n");
00093       return AST_MODULE_LOAD_DECLINE;
00094    }
00095 
00096    return res;
00097 }

static int unload_module ( void   )  [static]

Definition at line 56 of file res_curl.c.

References ARRAY_LEN, ast_log, ast_module_check(), and LOG_ERROR.

00057 {
00058    int res = 0;
00059    size_t i;
00060 
00061    /* If the dependent modules are still in memory, forbid unload */
00062    for (i = 0; i < ARRAY_LEN(dependents); i++) {
00063       if (ast_module_check(dependents[i])) {
00064          ast_log(LOG_ERROR, "%s (dependent module) is still loaded.  Cannot unload res_curl.so\n", dependents[i]);
00065          res = -1;
00066       }
00067    }
00068 
00069    if (res)
00070       return -1;
00071 
00072    curl_global_cleanup();
00073 
00074    return res;
00075 }


Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "cURL Resource Module" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_REALTIME_DEPEND, } [static]

Definition at line 104 of file res_curl.c.

Definition at line 104 of file res_curl.c.

const char* dependents[] [static]

Initial value:

 {
   "func_curl.so",
   "res_config_curl.so",
}

Definition at line 51 of file res_curl.c.


Generated on Thu Apr 16 06:32:48 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6