Asterisk - The Open Source Telephony Project GIT-master-2070bb5
|
Compile symbolic Asterisk Extension Logic into Asterisk extensions, version 2. More...
#include "asterisk.h"
#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <regex.h>
#include <sys/stat.h>
#include "asterisk/pbx.h"
#include "asterisk/config.h"
#include "asterisk/module.h"
#include "asterisk/logger.h"
#include "asterisk/cli.h"
#include "asterisk/app.h"
#include "asterisk/channel.h"
#include "asterisk/callerid.h"
#include "asterisk/pval.h"
#include "asterisk/ael_structs.h"
#include "asterisk/utils.h"
Go to the source code of this file.
Macros | |
#define | ASTMM_LIBC ASTMM_REDIRECT |
#define | BUF_SIZE 2000 |
Variables | |
static int | control_statement_count |
static int | count_labels |
static pval * | current_context |
static pval * | current_db |
static pval * | current_extension |
static char * | days [] |
static int | errs |
static char | expr_output [2096] |
static int | in_abstract_context |
static int | label_count |
static pval * | last_matched_label |
static const char * | match_context |
static const char * | match_exten |
static const char * | match_label |
static char * | months [] |
static int | notes |
static char * | registrar = "pbx_ael" |
static int | return_on_context_match |
static int | warns |
Compile symbolic Asterisk Extension Logic into Asterisk extensions, version 2.
Definition in file pval.c.
#define ASTMM_LIBC ASTMM_REDIRECT |
void add_extensions | ( | struct ael_extension * | exten | ) |
Definition at line 4213 of file pval.c.
References AEL_APPCALL, AEL_CONTROL1, AEL_FOR_CONTROL, AEL_IF_CONTROL, AEL_IFTIME_CONTROL, AEL_LABEL, AEL_RAND_CONTROL, AEL_RETURN, app, ael_priority::app, ael_priority::appargs, ast_add_extension2(), ast_free_ptr(), ast_log, AST_MAX_EXTENSION, ael_extension::cidmatch, ael_extension::context, pval::else_statements, ael_priority::exten, ael_priority::goto_false, ael_priority::goto_true, ael_extension::hints, last, LOG_WARNING, ael_extension::name, ael_priority::next, ael_extension::next_exten, NULL, ael_priority::origin, pbx_substitute_variables_helper(), ael_extension::plist, PRIORITY_HINT, ael_priority::priority_num, PV_IFTIME, PV_SWITCH, registrar, strdup, ael_priority::type, pval::type, and pval::u3.
Referenced by ast_compile_ael2().
void ael2_print | ( | char * | fname, |
pval * | tree | ||
) |
Definition at line 382 of file pval.c.
References ast_log, LOG_ERROR, and print_pval_list().
void ael2_semantic_check | ( | pval * | item, |
int * | arg_errs, | ||
int * | arg_warns, | ||
int * | arg_notes | ||
) |
Definition at line 2885 of file pval.c.
References ast_alloca, ast_config_AST_VAR_DIR, check_context_names(), check_pval(), current_db, errs, item, notes, and warns.
Referenced by pbx_load_module().
int ast_compile_ael2 | ( | struct ast_context ** | local_contexts, |
struct ast_hashtab * | local_table, | ||
struct pval * | root | ||
) |
Definition at line 4413 of file pval.c.
References add_extensions(), AEL_APPCALL, AEL_LABEL, app, ael_priority::app, ael_priority::appargs, pval::arglist, ARRAY_LEN, ast_context_add_ignorepat2(), ast_context_add_include2(), ast_context_add_switch2(), ast_context_find_or_create(), ast_custom_function_find(), ast_get_context_name(), attach_exten(), buf, buf2, c, ael_extension::cidmatch, voicemailpwcheck::context, ael_extension::context, context_used(), control_statement_count, destroy_extensions(), ael_priority::exten, fix_gotos_in_extensions(), gen_prios(), ael_extension::hints, pval::hints, linkprio(), pval::list, local_contexts, local_table, pval::macro_statements, ael_extension::name, new_exten(), new_prio(), pval::next, ael_extension::next_exten, NULL, ael_priority::origin, pbx_builtin_setvar(), ael_extension::plist_last, priority, ael_priority::priority_num, PV_CONTEXT, PV_ESWITCHES, PV_EXTENSION, PV_GLOBALS, PV_IGNOREPAT, PV_INCLUDES, PV_MACRO, PV_SWITCHES, ael_extension::regexten, pval::regexten, registrar, remove_spaces_before_equals(), ael_extension::return_needed, set_priorities(), pval::statements, pval::str, strdup, ael_priority::type, pval::type, pval::u1, pval::u2, pval::u3, pval::u4, and pval::val.
Referenced by pbx_load_module().
|
static |
Definition at line 4318 of file pval.c.
References ael_extension::next_exten.
Referenced by ast_compile_ael2().
|
static |
Definition at line 2329 of file pval.c.
References ast_log, current_db, pval::endline, pval::filename, pval::list, LOG_WARNING, pval::next, PV_CONTEXT, PV_INCLUDES, pval::startline, pval::str, pval::type, pval::u1, pval::u2, and warns.
Referenced by check_pval_item().
Definition at line 2130 of file pval.c.
References app, ast_log, pval::endline, pval::filename, LOG_WARNING, pval::next, pval::startline, pval::str, pval::u1, and warns.
Referenced by check_pval_item().
|
static |
Definition at line 1038 of file pval.c.
References ast_log, pval::dad, errs, item, LOG_ERROR, PV_CASE, PV_CONTEXT, PV_DEFAULT, PV_FOR, PV_MACRO, PV_PATTERN, PV_WHILE, and pval::type.
Referenced by check_pval_item().
|
static |
Definition at line 2310 of file pval.c.
References pval::abstract, ast_log, current_db, pval::endline, pval::filename, LOG_WARNING, pval::next, PV_CONTEXT, PV_MACRO, pval::startline, pval::str, pval::type, pval::u1, pval::u3, and warns.
Referenced by ael2_semantic_check().
|
static |
Definition at line 1058 of file pval.c.
References ast_log, pval::dad, errs, item, LOG_ERROR, PV_CONTEXT, PV_FOR, PV_MACRO, PV_WHILE, and pval::type.
Referenced by check_pval_item().
|
static |
Definition at line 937 of file pval.c.
References ast_log, ast_strdupa, ast_strlen_zero(), c, DAY, LOG_WARNING, and warns.
Referenced by check_pval_item().
|
static |
get_dow: Get day of week
Definition at line 898 of file pval.c.
References ast_log, ast_strdupa, ast_strlen_zero(), c, days, pval::endline, pval::filename, LOG_WARNING, NULL, pval::startline, pval::str, pval::u1, and warns.
Referenced by check_pval_item().
|
static |
Definition at line 801 of file pval.c.
References ast_log, pval::endline, pval::filename, LOG_WARNING, pval::startline, str, and warns.
Referenced by check_pval_item().
|
static |
Definition at line 1225 of file pval.c.
References ast_log, E_FINDLABEL, E_MATCH, errs, find_context(), find_label_in_current_context(), find_label_in_current_db(), find_label_in_current_extension(), first, get_contxt(), get_extension_or_contxt(), in_context(), in_macro(), item, pval::list, localized_pbx_load_module(), LOG_ERROR, LOG_WARNING, pval::next, NULL, pbx_find_extension(), PV_INCLUDES, pbx_find_info::stacklen, pval::statements, pbx_find_info::status, STATUS_SUCCESS, pval::str, pval::type, pval::u1, pval::u2, and warns.
Referenced by check_pval_item(), and find_pval_goto_item().
|
static |
Definition at line 811 of file pval.c.
References ast_log, pval::endline, pval::filename, find_context(), pval::list, LOG_WARNING, pval::next, pval::startline, pval::str, pval::u1, and warns.
Referenced by check_pval_item().
|
static |
Definition at line 1106 of file pval.c.
References ast_log, current_context, current_extension, pval::dad, errs, pval::filename, find_first_label_in_current_context(), item, LOG_ERROR, PV_EXTENSION, PV_MACRO, pval::startline, and pval::type.
Referenced by check_pval_item().
|
static |
Definition at line 650 of file pval.c.
References ast_log, calloc, pval::endcol, pval::endline, pval::filename, LOG_WARNING, pval::macro_statements, pval::next, NULL, PV_RETURN, pval::startcol, pval::startline, pval::str, strdup, pval::type, pval::u1, and pval::u3.
Referenced by check_pval_item().
|
static |
Definition at line 1000 of file pval.c.
References ast_log, ast_strdupa, ast_strlen_zero(), c, pval::endline, pval::filename, LOG_WARNING, months, pval::startline, pval::str, pval::u1, and warns.
Referenced by check_pval_item().
Definition at line 2865 of file pval.c.
References check_pval_item(), item, and pval::next.
Referenced by ael2_semantic_check(), and check_pval_item().
Definition at line 2357 of file pval.c.
References app, pval::arglist, ast_expr(), ast_expr_clear_extra_error_info(), ast_expr_register_extra_error_info(), ast_log, check_abstract_reference(), check_app_args(), check_break(), check_continue(), check_day(), check_dow(), check_expr2_input(), check_goto(), check_includes(), check_label(), check_macro_returns(), check_month(), check_pval(), check_switch_expr(), check_timerange(), current_context, current_extension, E_MATCH, errs, expr_output, find_context(), find_macro(), find_pval_gotos(), free(), in_abstract_context, item, localized_pbx_load_module(), LOG_ERROR, LOG_WARNING, pval::next, NULL, pbx_find_extension(), PV_APPLICATION_CALL, PV_BREAK, PV_CASE, PV_CATCH, PV_CONTEXT, PV_CONTINUE, PV_DEFAULT, PV_ESWITCHES, PV_EXTENSION, PV_FOR, PV_GLOBALS, PV_GOTO, PV_IF, PV_IFTIME, PV_IGNOREPAT, PV_INCLUDES, PV_LABEL, PV_LOCALVARDEC, PV_MACRO, PV_MACRO_CALL, PV_PATTERN, PV_RANDOM, PV_RETURN, PV_STATEMENTBLOCK, PV_SWITCH, PV_SWITCHES, PV_VARDEC, PV_WHILE, PV_WORD, pbx_find_info::stacklen, pval::statements, pbx_find_info::status, STATUS_SUCCESS, pval::str, aco_type::type, pval::type, pval::u1, pval::u2, and warns.
Referenced by check_pval().
Definition at line 2184 of file pval.c.
References a, ast_log, ast_strdupa, c, calloc, current_extension, pval::endcol, pval::endline, pval::filename, item, LOG_WARNING, test_val::name, pval::next, argapp::next, test_val::next, PV_APPLICATION_CALL, PV_CASE, PV_DEFAULT, PV_PATTERN, PV_STATEMENTBLOCK, pval::startcol, pval::startline, pval::statements, pval::str, strdup, pval::type, pval::u1, pval::u2, and warns.
Referenced by check_pval_item().
|
static |
Definition at line 830 of file pval.c.
References ast_log, ast_strdupa, ast_strlen_zero(), pval::endline, pval::filename, LOG_WARNING, pval::startline, pval::str, pval::u1, and warns.
Referenced by check_pval_item().
int contains_switch | ( | pval * | item | ) |
Definition at line 3329 of file pval.c.
References find_switch_item(), item, and pval::next.
Referenced by find_switch_item(), and gen_prios().
|
static |
Definition at line 4398 of file pval.c.
References ast_context_ignorepats_count(), ast_context_includes_count(), ast_context_switches_count(), ast_walk_context_extensions(), voicemailpwcheck::context, ael_extension::context, ael_extension::next_exten, and NULL.
Referenced by ast_compile_ael2().
void destroy_extensions | ( | struct ael_extension * | exten | ) |
Definition at line 2978 of file pval.c.
References ael_priority::app, ael_priority::appargs, free(), ael_priority::goto_false, ael_priority::goto_true, ael_extension::hints, ael_extension::loop_break, ael_extension::loop_continue, ael_extension::name, ael_priority::next, ael_extension::next_exten, ael_priority::origin, ael_extension::plist, and ael_extension::plist_last.
Referenced by ast_compile_ael2().
void destroy_pval | ( | pval * | item | ) |
Definition at line 4940 of file pval.c.
References destroy_pval_item(), item, and pval::next.
Referenced by destroy_pval_item(), pbx_load_module(), pvalIfTimeSetCondition(), pvalIncludesAddIncludeWithTimeConstraints(), yydestruct(), and yyparse().
void destroy_pval_item | ( | pval * | item | ) |
Definition at line 4672 of file pval.c.
References ast_log, destroy_pval(), free(), item, LOG_WARNING, NULL, PV_APPLICATION_CALL, PV_BREAK, PV_CASE, PV_CATCH, PV_CONTEXT, PV_CONTINUE, PV_DEFAULT, PV_ESWITCHES, PV_EXTENSION, PV_FOR, PV_GLOBALS, PV_GOTO, PV_IF, PV_IFTIME, PV_IGNOREPAT, PV_INCLUDES, PV_LABEL, PV_LOCALVARDEC, PV_MACRO, PV_MACRO_CALL, PV_PATTERN, PV_RANDOM, PV_RETURN, PV_STATEMENTBLOCK, PV_SWITCH, PV_SWITCHES, PV_VARDEC, PV_WHILE, PV_WORD, and aco_type::type.
Referenced by destroy_pval().
|
static |
Definition at line 694 of file pval.c.
References ast_log, pval::endline, pval::filename, LOG_ERROR, LOG_WARNING, and pval::startline.
Referenced by match_pval_item().
struct pval * find_context | ( | char * | name | ) |
Definition at line 1953 of file pval.c.
References count_labels, current_db, match_context, match_exten, match_label, match_pval(), name, and return_on_context_match.
Referenced by check_goto(), check_includes(), check_pval_item(), find_first_label_in_current_context(), find_label_in_current_context(), find_pval_goto_item(), and get_goto_target().
Definition at line 1839 of file pval.c.
References count_labels, find_context(), find_first_label_in_current_context(), pval::list, match_context, match_exten, match_label, match_pval(), pval::next, PV_INCLUDES, return_on_context_match, pval::statements, pval::str, pval::type, pval::u1, and pval::u2.
Referenced by check_label(), and find_first_label_in_current_context().
Definition at line 1879 of file pval.c.
References count_labels, find_context(), find_label_in_current_context(), pval::list, match_context, match_exten, match_label, match_pval(), pval::next, PV_INCLUDES, return_on_context_match, pval::statements, pval::str, pval::type, pval::u1, and pval::u2.
Referenced by check_goto(), find_label_in_current_context(), and get_goto_target().
|
static |
Definition at line 1929 of file pval.c.
References voicemailpwcheck::context, count_labels, current_db, match_context, match_exten, match_label, match_pval(), and return_on_context_match.
Referenced by check_goto(), and get_goto_target().
Definition at line 1918 of file pval.c.
References count_labels, match_context, match_exten, match_label, match_pval(), and return_on_context_match.
Referenced by check_goto(), and get_goto_target().
struct pval * find_macro | ( | char * | name | ) |
Definition at line 1943 of file pval.c.
References count_labels, current_db, match_context, match_exten, match_label, match_pval(), name, and return_on_context_match.
Referenced by check_pval_item().
|
static |
Definition at line 1379 of file pval.c.
References ast_log, check_goto(), find_context(), find_pval_gotos(), item, LOG_ERROR, pval::next, PV_CASE, PV_CATCH, PV_CONTEXT, PV_DEFAULT, PV_EXTENSION, PV_FOR, PV_GOTO, PV_IF, PV_IFTIME, PV_INCLUDES, PV_MACRO, PV_PATTERN, PV_RANDOM, PV_STATEMENTBLOCK, PV_SWITCH, PV_WHILE, pval::statements, pval::str, aco_type::type, pval::u1, and pval::u2.
Referenced by find_pval_gotos().
|
static |
Definition at line 1550 of file pval.c.
References find_pval_goto_item(), item, and pval::next.
Referenced by check_pval_item(), and find_pval_goto_item().
int find_switch_item | ( | pval * | item | ) |
Definition at line 3090 of file pval.c.
References contains_switch(), item, PV_APPLICATION_CALL, PV_BREAK, PV_CASE, PV_CATCH, PV_CONTEXT, PV_CONTINUE, PV_DEFAULT, PV_ESWITCHES, PV_EXTENSION, PV_FOR, PV_GLOBALS, PV_GOTO, PV_IF, PV_IFTIME, PV_IGNOREPAT, PV_INCLUDES, PV_LABEL, PV_LOCALVARDEC, PV_MACRO, PV_MACRO_CALL, PV_PATTERN, PV_RANDOM, PV_RETURN, PV_STATEMENTBLOCK, PV_SWITCH, PV_SWITCHES, PV_VARDEC, PV_WHILE, PV_WORD, and aco_type::type.
Referenced by contains_switch().
|
static |
Definition at line 4355 of file pval.c.
References ael_priority::appargs, buf1, pval::compiled_label, free(), pval::goto_target, pval::goto_target_in_case, pval::list, ael_extension::name, ael_priority::next, pval::next, ael_extension::next_exten, ael_priority::origin, ael_extension::plist, PV_GOTO, pval::str, strdup, pval::type, pval::u1, pval::u2, and pval::u3.
Referenced by ast_compile_ael2().
|
static |
Definition at line 3061 of file pval.c.
References result.
Referenced by gen_prios().
|
static |
Definition at line 3341 of file pval.c.