23#define ASTMM_LIBC ASTMM_IGNORE
28#define AST_API_MODULE 1
31#define AST_API_MODULE 1
41#ifdef DEBUG_THREADLOCALS
42#define MALLOC_FAILURE_MSG \
43 ast_log(LOG_ERROR, "Memory Allocation Failure in function %s at line %d of %s\n", func, lineno, file);
60 int line_num,
const char *func,
const char *lock_name,
void *lock_addr,
struct ast_bt *bt);
62 int line_num,
const char *func,
const char *lock_name,
void *lock_addr,
struct ast_bt *bt)
67void ast_remove_lock_info(
void *lock_addr,
struct ast_bt *bt);
68void ast_remove_lock_info(
void *lock_addr,
struct ast_bt *bt)
87void ast_suspend_lock_info(
void *lock_addr)
90void ast_restore_lock_info(
void *lock_addr)
93void ast_mark_lock_acquired(
void *);
94void ast_mark_lock_acquired(
void *foo)
119void ast_log(
int level,
const char *
file,
int line,
const char *function,
const char *fmt, ...) __attribute__((format(printf,5,6)));
121void ast_log(
int level, const
char *
file,
int line, const
char *function, const
char *fmt, ...)
126 printf(
"LOG: lev:%d file:%s line:%d func: %s ",
127 level,
file, line, function);
135unsigned int check_expr(
char* buffer,
char* error_report);
136int check_eval(
char *buffer,
char *error_report);
168 unsigned int warn_found = 0;
172 for (cp = buffer; *cp; ++cp)
178 while (*(++cp) && *cp !=
'"') ;
183 "Trouble? Unterminated double quote found at line %d\n",
191 if ( (*(cp + 1) ==
'=')
192 && ( ( (cp > buffer) && (*(cp - 1) !=
' ') ) || (*(cp + 2) !=
' ') ) )
197 "WARNING: line %d: '%c%c' operator not separated by spaces. This may lead to confusion. You may wish to use double quotes to quote the grouping it is in. Please check!\n",
199 strcat(error_report, msg);
215 if ( ( (cp > buffer) && (*(cp - 1) !=
' ') ) || (*(cp + 1) !=
' ') )
220 "WARNING: line %d: '%c' operator not separated by spaces. This may lead to confusion. You may wish to use double quotes to quote the grouping it is in. Please check!\n",
222 strcat(error_report, msg);
233int check_eval(
char *buffer,
char *error_report);
252 for (cp=buffer;*cp;cp++) {
253 if (*cp ==
'$' && *(cp+1) ==
'{') {
271 strncpy(varname,cp+2, xp-cp-2);
272 varname[xp-cp-2] = 0;
287 printf(
"Unterminated variable reference at line %d\n",
global_lineno);
291 else if (*cp ==
'\\') {
304 sprintf(error_report,
"line %d, evaluation of $[ %s ] result: %s\n",
global_lineno, evalbuf, s);
307 sprintf(error_report,
"line %d, evaluation of $[ %s ] result: ****SYNTAX ERROR****\n",
global_lineno, evalbuf);
317 FILE *f = fopen(fname,
"r");
318 FILE *l = fopen(
"expr2_log",
"w");
324 fprintf(stderr,
"Couldn't open %s for reading... need an extensions.conf file to parse!\n",fname);
328 fprintf(stderr,
"Couldn't open 'expr2_log' file for writing... please fix and re-run!\n");
334 while ((c1 = fgetc(f)) != EOF) {
337 else if (c1 ==
'[') {
338 if (last_char ==
'$') {
343 char error_report[30000];
345 while ((c1 = fgetc(f)) != EOF) {
351 fprintf(l,
"ERROR-- A newline in an expression? Weird! ...at line %d\n",
global_lineno);
354 printf(
"--- ERROR --- A newline in the middle of an expression at line %d!\n",
global_lineno);
359 buffer[bufcount++] = c1;
362 fprintf(l,
"ERROR-- End of File Reached in the middle of an Expr at line %d\n",
global_lineno);
365 printf(
"--- ERROR --- EOF reached in middle of an expression at line %d!\n",
global_lineno);
369 buffer[bufcount] = 0;
379 printf(
"Warning(s) at line %d, expression: $[%s]; see expr2_log file for details\n",
381 fprintf(l,
"%s", error_report);
389 fprintf(l,
"%s", error_report);
394 printf(
"Summary:\n Expressions detected: %d\n Expressions OK: %d\n Total # Warnings: %d\n Longest Expr: %d chars\n Ave expr len: %d chars\n",
412 printf(
"check_expr -- a program to look thru extensions.conf files for $[...] expressions,\n");
413 printf(
" and run them thru the parser, looking for problems\n");
414 printf(
"Hey-- give me a path to an extensions.conf file!\n");
415 printf(
" You can also follow the file path with a series of variable decls,\n");
416 printf(
" of the form, varname=value, each separated from the next by spaces.\n");
417 printf(
" (this might allow you to avoid division by zero messages, check that math\n");
418 printf(
" is being done correctly, etc.)\n");
419 printf(
" Note that messages about operators not being surrounded by spaces is merely to alert\n");
420 printf(
" you to possible problems where you might be expecting those operators as part of a string.\n");
421 printf(
" (to include operators in a string, wrap with double quotes!)\n");
426 for (argc1=2;argc1 < argc; argc1++) {
427 if ((eq = strchr(argv[argc1],
'='))) {
int ast_expr(char *expr, char *buf, int length, struct ast_channel *chan)
Evaluate the given expression.
Asterisk main include file. File version handling, generic pbx functions.
#define MALLOC_FAILURE_MSG
void * __ast_calloc(size_t nmemb, size_t size, const char *file, int lineno, const char *func) attribute_malloc
struct ast_vector_string * __ast_bt_get_symbols(void **addresses, size_t num_frames)
int __ast_bt_get_addresses(struct ast_bt *bt)
int main(int argc, char **argv)
char * find_var(const char *varname)
void set_var(const char *varname, const char *varval)
struct ast_custom_function * ast_custom_function_find(const char *name)
unsigned int check_expr(char *buffer, char *error_report)
int ast_add_profile(const char *x, uint64_t scale)
support for event profiling
struct varz * global_varlist
int check_eval(char *buffer, char *error_report)
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
void parse_file(const char *fname)
static int global_expr_tot_size
static int global_warn_count
static int global_expr_count
static int global_expr_max_size
static int global_OK_count
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
Inlinable API function macro.
Asterisk locking-related definitions:
A structure to hold backtrace information. This structure provides an easy means to store backtrace i...
Data structure associated with a custom dialplan function.
String vector definitions.