Asterisk - The Open Source Telephony Project GIT-master-27fb039
Loading...
Searching...
No Matches
Functions | Variables
func_module.c File Reference

Simple module check function. More...

#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"
Include dependency graph for func_module.c:

Go to the source code of this file.

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
static int ifmodule_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 
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 = "Checks if Asterisk module is loaded in memory" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
 
static const struct ast_module_infoast_module_info = &__mod_info
 
static struct ast_custom_function ifmodule_function
 

Detailed Description

Simple module check function.

Author
Olle E. Johansson, Edvina.net

Definition in file func_module.c.

Function Documentation

◆ __reg_module()

static void __reg_module ( void  )
static

Definition at line 88 of file func_module.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 88 of file func_module.c.

◆ AST_MODULE_SELF_SYM()

struct ast_module * AST_MODULE_SELF_SYM ( void  )

Definition at line 88 of file func_module.c.

◆ ifmodule_read()

static int ifmodule_read ( struct ast_channel chan,
const char *  cmd,
char *  data,
char *  buf,
size_t  len 
)
static

Definition at line 55 of file func_module.c.

57{
58 char *ret = "0";
59
60 *buf = '\0';
61
62 if (data)
63 if (ast_module_check(data))
64 ret = "1";
65
66 ast_copy_string(buf, ret, len);
67
68 return 0;
69}
char buf[BUFSIZE]
Definition eagi_proxy.c:66
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
int ast_module_check(const char *name)
Check if module with the name given is loaded.
Definition loader.c:2832
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition strings.h:425

References ast_copy_string(), ast_module_check(), buf, and len().

◆ load_module()

static int load_module ( void  )
static

Definition at line 83 of file func_module.c.

84{
86}
static struct ast_custom_function ifmodule_function
Definition func_module.c:71
#define ast_custom_function_register(acf)
Register a custom function.
Definition pbx.h:1562

References ast_custom_function_register, and ifmodule_function.

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 78 of file func_module.c.

79{
81}
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.

References ast_custom_function_unregister(), and ifmodule_function.

Variable Documentation

◆ __mod_info

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Checks if Asterisk module is loaded in memory" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
static

Definition at line 88 of file func_module.c.

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 88 of file func_module.c.

◆ ifmodule_function

struct ast_custom_function ifmodule_function
static
Initial value:
= {
.name = "IFMODULE",
.read = ifmodule_read,
.read_max = 2,
}
static int ifmodule_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
Definition func_module.c:55

Definition at line 71 of file func_module.c.

71 {
72 .name = "IFMODULE",
73 .read = ifmodule_read,
74 .read_max = 2,
75};

Referenced by load_module(), and unload_module().