Asterisk - The Open Source Telephony Project  18.5.0
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 = "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 = "30ef0c93b36035ec78c9cfd712d36d9b" , .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 85 of file func_module.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 85 of file func_module.c.

◆ AST_MODULE_SELF_SYM()

struct ast_module* AST_MODULE_SELF_SYM ( void  )

Definition at line 85 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 52 of file func_module.c.

References ast_copy_string(), and ast_module_check().

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

◆ load_module()

static int load_module ( void  )
static

Definition at line 80 of file func_module.c.

References ast_custom_function_register.

81 {
83 }
static struct ast_custom_function ifmodule_function
Definition: func_module.c:68
#define ast_custom_function_register(acf)
Register a custom function.
Definition: pbx.h:1508

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 75 of file func_module.c.

References ast_custom_function_unregister().

76 {
78 }
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
static struct ast_custom_function ifmodule_function
Definition: func_module.c:68

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 = "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 = "30ef0c93b36035ec78c9cfd712d36d9b" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
static

Definition at line 85 of file func_module.c.

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 85 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:52

Definition at line 68 of file func_module.c.