75 cmp = strcasecmp(name, cur->name);
120 length =
sizeof(*tmp) + strlen(app) + 1;
133 strcpy(tmp->name, app);
176 if (strcasecmp(tmp->name, cur->name) < 0) {
201 if (!synopsis || !description || !arguments || !seealso) {
205 "%s -= Info about application '%s' =- %s\n\n" 232 "%s -= Info about application '%s' =- %s\n\n" 263 int app, no_registered_app = 1;
267 e->
command =
"core show application";
269 "Usage: core show application <application> [<application> [<application> [...]]]\n" 270 " Describes a particular application.\n";
288 for (app = 3; app < a->
argc; app++) {
289 if (strcasecmp(aa->name, a->
argv[app])) {
294 no_registered_app = 0;
302 if (no_registered_app) {
303 ast_cli(a->
fd,
"Your application(s) is (are) not registered\n");
313 int like = 0, describing = 0;
319 e->
command =
"core show applications [like|describing]";
321 "Usage: core show applications [{like|describing} <text>]\n" 322 " List applications which are currently available.\n" 323 " If 'like', <text> will be a substring of the app name\n" 324 " If 'describing', <text> will be a substring of the description\n";
333 ast_cli(a->
fd,
"There are no registered applications\n");
339 if ((a->
argc == 5) && (!strcmp(a->
argv[3],
"like"))) {
341 }
else if ((a->
argc > 4) && (!strcmp(a->
argv[3],
"describing"))) {
346 if ((!like) && (!describing)) {
347 ast_cli(a->
fd,
" -= Registered Asterisk Applications =-\n");
349 ast_cli(a->
fd,
" -= Matching Asterisk Applications =-\n");
360 }
else if (describing) {
365 for (i = 4; i < a->
argc; i++) {
381 if ((!like) && (!describing)) {
382 ast_cli(a->
fd,
" -= %d Applications Registered =-\n",total_apps);
384 ast_cli(a->
fd,
" -= %d Applications Matching =-\n",total_match);
404 cmp = strcasecmp(app, cur->name);
412 ast_verb(2,
"Unregistered application '%s'\n", cur->name);
435 size_t wordlen = strlen(word);
439 cmp = strncasecmp(word, app->name, wordlen);
446 if (++which <= state) {
477 const char *saved_c_appl;
478 const char *saved_c_data;
493 if (app->module && u)
int(* execute)(struct ast_channel *chan, const char *data)
#define ast_channel_lock(chan)
Main Channel structure associated with a channel.
#define AST_CLI_DEFINE(fn, txt,...)
Asterisk main include file. File version handling, generic pbx functions.
Private include file for pbx.
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized...
String manipulation functions.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
Registered applications container.
int pbx_exec(struct ast_channel *c, struct ast_app *app, const char *data)
Execute an application.
void ast_channel_appl_set(struct ast_channel *chan, const char *value)
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
descriptor for a cli entry.
void __ast_module_user_remove(struct ast_module *, struct ast_module_user *)
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
char * ast_xmldoc_build_description(const char *type, const char *name, const char *module)
Generate description documentation from XML.
#define ast_cli_register_multiple(e, len)
Register multiple commands.
int ast_rdlock_contexts(void)
Read locks the context list.
static char * handle_show_application(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
const ast_string_field synopsis
#define ast_strdup(str)
A wrapper for strdup()
char * ast_xmldoc_build_synopsis(const char *type, const char *name, const char *module)
Generate synopsis documentation from XML.
void ast_cli(int fd, const char *fmt,...)
static struct ast_cli_entry app_cli[]
char * ast_xmldoc_build_arguments(const char *type, const char *name, const char *module)
Generate the [arguments] tag based on type of node ('application', 'function' or 'agi') and name...
ast_doc_src
From where the documentation come from, this structure is useful for use it inside application/functi...
#define ast_verb(level,...)
#define COLORIZE(fg, bg, str)
#define ast_strlen_zero(foo)
static char * handle_show_applications(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
static void unload_pbx_app(void)
int ast_register_cleanup(void(*func)(void))
Register a function to be executed before Asterisk gracefully exits.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
#define AST_RWLIST_TRAVERSE
#define AST_STRING_FIELD(name)
Declare a string field.
int ast_register_application2(const char *app, int(*execute)(struct ast_channel *, const char *), const char *synopsis, const char *description, void *mod)
Dynamically register a new dial plan application.
char * ast_complete_applications(const char *line, const char *word, int state)
Command completion for the list of installed applications.
#define COLORIZE_FMT
Shortcut macros for coloring a set of text.
#define AST_RWLIST_REMOVE_CURRENT
A set of macros to manage forward-linked lists.
#define AST_RWLIST_INSERT_BEFORE_CURRENT
Core PBX routines and definitions.
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
struct ast_module_user * __ast_module_user_add(struct ast_module *, struct ast_channel *)
const ast_string_field syntax
int ast_unlock_contexts(void)
Unlocks contexts.
const char * app_name(struct ast_app *app)
char * strcasestr(const char *, const char *)
const char * ast_channel_appl(const struct ast_channel *chan)
#define ast_channel_unlock(chan)
#define ast_calloc(num, len)
A wrapper for calloc()
const char * ast_term_reset(void)
Returns the terminal reset code.
Asterisk XML Documentation API.
Prototypes for public functions only of internal interest,.
const char * ast_term_color(int fgcolor, int bgcolor)
Return a color sequence string.
char * ast_xmldoc_printable(const char *bwinput, int withcolors)
Colorize and put delimiters (instead of tags) to the xmldoc output.
char * ast_xmldoc_build_syntax(const char *type, const char *name, const char *module)
Get the syntax for a specified application or function.
char * ast_xmldoc_build_seealso(const char *type, const char *name, const char *module)
Parse the <see-also> node content.
const char * ast_channel_data(const struct ast_channel *chan)
void unreference_cached_app(struct ast_app *app)
#define AST_RWLIST_INSERT_TAIL
const char * ast_module_name(const struct ast_module *mod)
Get the name of a module.
Standard Command Line Interface.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
ast_app: A registered application
const ast_string_field seealso
Handy terminal functions for vt* terms.
void ast_channel_publish_snapshot(struct ast_channel *chan)
Publish a ast_channel_snapshot for a channel.
static void print_app_docs(struct ast_app *aa, int fd)
int ast_cli_completion_add(char *value)
Add a result to a request for completion options.
static struct ast_app * pbx_findapp_nolock(const char *name)
Asterisk module definitions.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
struct ast_app * pbx_findapp(const char *app)
Look up an application.
#define AST_RWLIST_TRAVERSE_SAFE_END
void ast_channel_data_set(struct ast_channel *chan, const char *value)
const ast_string_field arguments
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
int ast_unregister_application(const char *app)
Unregister an application.
const ast_string_field description