Wed Jan 8 2020 09:50:18

Asterisk developer's documentation


res_curl.c File Reference

curl resource engine More...

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

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 __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 = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_REALTIME_DEPEND, }
 
static struct ast_module_infoast_module_info = &__mod_info
 

Detailed Description

curl resource engine

Author
Tilghman Lesher res_c.nosp@m.url_.nosp@m.v1@th.nosp@m.e-ti.nosp@m.lghma.nosp@m.n.co.nosp@m.m
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 78 of file res_curl.c.

static void __unreg_module ( void  )
static

Definition at line 78 of file res_curl.c.

static int load_module ( void  )
static

Definition at line 62 of file res_curl.c.

References ast_log(), AST_MODULE_LOAD_DECLINE, and LOG_ERROR.

63 {
64  int res = 0;
65 
66  if (curl_global_init(CURL_GLOBAL_ALL)) {
67  ast_log(LOG_ERROR, "Unable to initialize the CURL library. Cannot load res_curl\n");
69  }
70 
71  return res;
72 }
#define LOG_ERROR
Definition: logger.h:155
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
Definition: logger.c:1207
static int unload_module ( void  )
static

Definition at line 42 of file res_curl.c.

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

43 {
44  int res = 0;
45 
46  /* If the dependent modules are still in memory, forbid unload */
47  if (ast_module_check("func_curl.so")) {
48  ast_log(LOG_ERROR, "func_curl.so (dependent module) is still loaded. Cannot unload res_curl.so\n");
49  return -1;
50  }
51 
52  if (ast_module_check("res_config_curl.so")) {
53  ast_log(LOG_ERROR, "res_config_curl.so (dependent module) is still loaded. Cannot unload res_curl.so\n");
54  return -1;
55  }
56 
57  curl_global_cleanup();
58 
59  return res;
60 }
int ast_module_check(const char *name)
Check if module with the name given is loaded.
Definition: loader.c:1255
#define LOG_ERROR
Definition: logger.h:155
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
Definition: logger.c:1207

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 = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_REALTIME_DEPEND, }
static

Definition at line 78 of file res_curl.c.

Definition at line 78 of file res_curl.c.