Asterisk - The Open Source Telephony Project GIT-master-8f1982c
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
Functions | Variables
app_reload.c File Reference

Reload Asterisk modules. More...

#include "asterisk.h"
#include "asterisk/logger.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/app.h"
Include dependency graph for app_reload.c:

Go to the source code of this file.

Functions

 AST_MODULE_INFO_STANDARD_EXTENDED (ASTERISK_GPL_KEY, "Reload module(s)")
 
static int load_module (void)
 
static int reload_exec (struct ast_channel *chan, const char *data)
 
static int unload_module (void)
 

Variables

static char * app = "Reload"
 

Detailed Description

Reload Asterisk modules.

Author
Naveen Albert aster.nosp@m.isk@.nosp@m.phrea.nosp@m.knet.nosp@m..org

Definition in file app_reload.c.

Function Documentation

◆ AST_MODULE_INFO_STANDARD_EXTENDED()

AST_MODULE_INFO_STANDARD_EXTENDED ( ASTERISK_GPL_KEY  ,
"Reload module(s)"   
)

◆ load_module()

static int load_module ( void  )
static

Definition at line 109 of file app_reload.c.

110{
112}
static int reload_exec(struct ast_channel *chan, const char *data)
Definition: app_reload.c:80
static char * app
Definition: app_reload.c:78
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Definition: module.h:640

References app, ast_register_application_xml, and reload_exec().

◆ reload_exec()

static int reload_exec ( struct ast_channel chan,
const char *  data 
)
static

Definition at line 80 of file app_reload.c.

81{
82 char *targets, *target = NULL;
84
85 targets = ast_strdupa(data);
87 if (ast_strlen_zero(targets)) { /* Reload everything */
88 res = ast_module_reload(targets);
89 } else {
90 while((target = ast_strsep(&targets, ',', AST_STRSEP_ALL))) {
91 res |= ast_module_reload(target);
92 }
93 }
95
96 if (res == AST_MODULE_RELOAD_SUCCESS) {
97 pbx_builtin_setvar_helper(chan, "RELOADSTATUS", "SUCCESS");
98 } else {
99 pbx_builtin_setvar_helper(chan, "RELOADSTATUS", "FAILURE");
100 }
101 return 0;
102}
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:298
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
Definition: autoservice.c:266
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
Definition: autoservice.c:200
ast_module_reload_result
Possible return types for ast_module_reload.
Definition: module.h:109
@ AST_MODULE_RELOAD_SUCCESS
Definition: module.h:110
enum ast_module_reload_result ast_module_reload(const char *name)
Reload asterisk modules.
Definition: loader.c:1730
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name.
#define NULL
Definition: resample.c:96
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:65
@ AST_STRSEP_ALL
Definition: strings.h:258
char * ast_strsep(char **s, const char sep, uint32_t flags)
Act like strsep but ignore separators inside quotes.
Definition: utils.c:1835

References ast_autoservice_start(), ast_autoservice_stop(), ast_module_reload(), AST_MODULE_RELOAD_SUCCESS, ast_strdupa, ast_strlen_zero(), ast_strsep(), AST_STRSEP_ALL, NULL, and pbx_builtin_setvar_helper().

Referenced by load_module().

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 104 of file app_reload.c.

105{
107}
int ast_unregister_application(const char *app)
Unregister an application.
Definition: pbx_app.c:392

References app, and ast_unregister_application().

Variable Documentation

◆ app

char* app = "Reload"
static

Definition at line 78 of file app_reload.c.

Referenced by load_module(), and unload_module().