Asterisk - The Open Source Telephony Project
21.4.1
|
Skeleton application. More...
#include "asterisk.h"
#include <math.h>
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/lock.h"
#include "asterisk/app.h"
#include "asterisk/config.h"
#include "asterisk/config_options.h"
#include "asterisk/say.h"
#include "asterisk/astobj2.h"
#include "asterisk/acl.h"
#include "asterisk/netsock2.h"
#include "asterisk/strings.h"
#include "asterisk/cli.h"
Go to the source code of this file.
Data Structures | |
struct | skel_config |
A container that holds all config-related information. More... | |
struct | skel_current_game |
Information about a currently running set of games. More... | |
struct | skel_global_config |
A structure to hold global configuration-related options. More... | |
struct | skel_level |
Object to hold level config information. More... | |
struct | skel_level_state |
A structure to maintain level state across reloads. More... | |
Enumerations | |
enum | option_args { OPTION_ARG_NUMGAMES, OPTION_ARG_ARRAY_SIZE } |
enum | option_flags { OPTION_CHEAT = (1 << 0), OPTION_NUMGAMES = (1 << 1), OPTION_PATTERNS_DISABLED = (1 << 0) } |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static | AO2_GLOBAL_OBJ_STATIC (globals) |
A global object container that will contain the skel_config that gets swapped out on reloads. | |
static int | app_exec (struct ast_channel *chan, const char *data) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
CONFIG_INFO_STANDARD (cfg_info, globals, skel_config_alloc,.files=ACO_FILES(&app_skel_conf),) | |
Register information about the configs being processed by this module. | |
static int | custom_bitfield_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
A custom bitfield handler. | |
static char * | handle_skel_show_config (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_skel_show_games (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_skel_show_levels (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static int | load_module (void) |
Load the module. More... | |
static void | play_files_helper (struct ast_channel *chan, const char *prompts) |
static int | reload_module (void) |
static void * | skel_config_alloc (void) |
Allocate a skel_config to hold a snapshot of the complete results of parsing a config. | |
static void | skel_config_destructor (void *obj) |
static void * | skel_find_or_create_state (const char *category) |
Look up an existing state object, or create a new one. | |
static struct skel_current_game * | skel_game_alloc (struct skel_level *level) |
static void | skel_game_destructor (void *obj) |
static void | skel_global_config_destructor (void *obj) |
static void * | skel_level_alloc (const char *cat) |
Allocate a skel_level based on a category in a configuration file. More... | |
static int | skel_level_cmp (void *obj, void *arg, int flags) |
static void | skel_level_destructor (void *obj) |
static void * | skel_level_find (struct ao2_container *tmp_container, const char *category) |
Find a skel level in the specified container. More... | |
static int | skel_level_hash (const void *obj, const int flags) |
static struct skel_level * | skel_state_alloc (const char *name) |
static void | skel_state_destructor (void *obj) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Skeleton (sample) Application" , .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 = "da6642af068ee5e6490c5b1d2cc1d238" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload_module, } |
static char * | app = "SkelGuessNumber" |
static const struct ast_app_option | app_opts [128] = { [ 'c' ] = { .flag = OPTION_CHEAT }, [ 'n' ] = { .flag = OPTION_NUMGAMES , .arg_index = OPTION_ARG_NUMGAMES + 1 }, } |
struct aco_file | app_skel_conf |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ao2_container * | games |
The container of active games. | |
static struct aco_type | global_option |
An aco_type structure to link the "general" category to the skel_global_config type. | |
struct aco_type * | global_options [] = ACO_TYPES(&global_option) |
static const char * | level_categories [] |
static struct aco_type | level_option |
An aco_type structure to link the everything but the "general" and "sounds" categories to the skel_level type. | |
struct aco_type * | level_options [] = ACO_TYPES(&level_option) |
static struct ast_cli_entry | skel_cli [] |
static struct aco_type | sound_option |
An aco_type structure to link the "sounds" category to the skel_global_config type. | |
struct aco_type * | sound_options [] = ACO_TYPES(&sound_option) |
Skeleton application.
This is a skeleton for development of an Asterisk application
Definition in file app_skel.c.
|
static |
Load the module.
Module loading including tests for configuration or dependencies. This function can return AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_DECLINE, or AST_MODULE_LOAD_SUCCESS. If a dependency or environment variable fails tests return AST_MODULE_LOAD_FAILURE. If the module can not load the configuration file or other non-critical problem return AST_MODULE_LOAD_DECLINE. On success return AST_MODULE_LOAD_SUCCESS.
Definition at line 726 of file app_skel.c.
References aco_info_destroy(), aco_info_init(), aco_option_register, aco_option_register_custom, aco_process_config(), ACO_PROCESS_ERROR, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_list, ast_cli_register_multiple, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_register_application_xml, custom_bitfield_handler(), FLDSET, OPT_STRINGFIELD_T, OPT_UINT_T, and STRFLDSET.
|
static |
Allocate a skel_level based on a category in a configuration file.
cat | The category to base the level on |
Definition at line 533 of file app_skel.c.
References ao2_ref, ast_string_field_init, ast_string_field_set, skel_find_or_create_state(), and skel_level::state.
|
static |
Find a skel level in the specified container.
tmp_container | A non-active container to search for a level |
category | The category associated with the level to check for |
non-NULL | The level from the container |
NULL | The level does not exist in the container |
Definition at line 509 of file app_skel.c.
References OBJ_KEY.
struct aco_file app_skel_conf |
Definition at line 281 of file app_skel.c.
|
static |
Definition at line 262 of file app_skel.c.
|
static |
Definition at line 692 of file app_skel.c.