Thu Apr 28 2011 17:14:01

Asterisk developer's documentation


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)
static int unload_module (void)

Variables

static struct ast_module_info
__MODULE_INFO_SECTION 
__mod_info = { __MODULE_INFO_GLOBALS .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "cURL Resource Module" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, }
static struct ast_module_infoast_module_info = &__mod_info

Detailed Description

curl resource engine

Author:
Tilghman Lesher <res_curl_v1@the-tilghman.com>
ExtRef:
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 73 of file res_curl.c.

static void __unreg_module ( void  ) [static]

Definition at line 73 of file res_curl.c.

static int load_module ( void  ) [static]

Definition at line 61 of file res_curl.c.

References ast_log(), AST_MODULE_LOAD_DECLINE, and LOG_ERROR.

{
   int res = 0;

   if (curl_global_init(CURL_GLOBAL_ALL)) {
      ast_log(LOG_ERROR, "Unable to initialize the CURL library. Cannot load res_curl\n");
      return AST_MODULE_LOAD_DECLINE;
   }  

   return res;
}
static int unload_module ( void  ) [static]

Definition at line 41 of file res_curl.c.

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

{
   int res = 0;

   /* If the dependent modules are still in memory, forbid unload */
   if (ast_module_check("func_curl.so")) {
      ast_log(LOG_ERROR, "func_curl.so (dependent module) is still loaded.  Cannot unload res_curl.so\n");
      return -1;
   }

   if (ast_module_check("res_config_curl.so")) {
      ast_log(LOG_ERROR, "res_config_curl.so (dependent module) is still loaded.  Cannot unload res_curl.so\n");
      return -1;
   }

   curl_global_cleanup();

   return res;
}

Variable Documentation

struct ast_module_info __MODULE_INFO_SECTION __mod_info = { __MODULE_INFO_GLOBALS .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "cURL Resource Module" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, } [static]

Definition at line 73 of file res_curl.c.

Definition at line 73 of file res_curl.c.