| Asterisk - The Open Source Telephony Project GIT-master-27fb039
    | 
PBX timing routines. More...
#include "asterisk.h"#include "asterisk/localtime.h"#include "asterisk/logger.h"#include "asterisk/pbx.h"#include "asterisk/strings.h"#include "asterisk/utils.h"
Go to the source code of this file.
| Functions | |
| int | ast_build_timing (struct ast_timing *i, const char *info_in) | 
| Construct a timing bitmap, for use in time-based conditionals. | |
| int | ast_check_timing (const struct ast_timing *i) | 
| Evaluate a pre-constructed bitmap as to whether the current time falls within the range specified. | |
| int | ast_check_timing2 (const struct ast_timing *i, const struct timeval tv) | 
| Evaluate a pre-constructed bitmap as to whether a particular time falls within the range specified. | |
| int | ast_destroy_timing (struct ast_timing *i) | 
| Deallocates memory structures associated with a timing bitmap. | |
| static unsigned | get_range (char *src, int max, const char *const names[], const char *msg) | 
| helper function to return a range up to max (7, 12, 31 respectively). names, if supplied, is an array of names that should be mapped to numbers. | |
| static void | get_timerange (struct ast_timing *i, char *times) | 
| store a bitmask of valid times, one bit each 1 minute | |
| static int | lookup_name (const char *s, const char *const names[], int max) | 
| Helper for get_range. return the index of the matching entry, starting from 1. If names is not supplied, try numeric values. | |
| Variables | |
| static const char *const | days [] | 
| static const char *const | months [] | 
PBX timing routines.
Definition in file pbx_timing.c.
| int ast_build_timing | ( | struct ast_timing * | i, | 
| const char * | info_in | ||
| ) | 
Construct a timing bitmap, for use in time-based conditionals.
| i | Pointer to an ast_timing structure. | 
| info_in | Standard string containing a timerange, weekday range, monthday range, and month range, as well as an optional timezone. | 
| 1 | on success. | 
| 0 | on failure. | 
Definition at line 197 of file pbx_timing.c.
References ast_strdup, ast_strdupa, ast_strlen_zero(), ast_timing::daymask, days, ast_timing::dowmask, get_range(), get_timerange(), ast_timing::monthmask, months, NULL, strsep(), and ast_timing::timezone.
| int ast_check_timing | ( | const struct ast_timing * | i | ) | 
Evaluate a pre-constructed bitmap as to whether the current time falls within the range specified.
| i | Pointer to an ast_timing structure. | 
| 1 | if the time matches. | 
| 0 | if the current time falls outside of the specified range. | 
Definition at line 240 of file pbx_timing.c.
References ast_check_timing2(), and ast_tvnow().
| int ast_check_timing2 | ( | const struct ast_timing * | i, | 
| const struct timeval | tv | ||
| ) | 
Evaluate a pre-constructed bitmap as to whether a particular time falls within the range specified.
| i | Pointer to an ast_timing structure. | 
| tv | Specified time | 
| 1 | if the time matches. | 
| 0 | if the time falls outside of the specified range. | 
Definition at line 245 of file pbx_timing.c.
References ast_localtime(), ast_log, ast_timing::daymask, ast_timing::dowmask, LOG_WARNING, ast_timing::minmask, ast_timing::monthmask, ast_timing::timezone, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, and ast_tm::tm_wday.
Referenced by ast_check_timing(), and pbx_builtin_gotoiftime().
| int ast_destroy_timing | ( | struct ast_timing * | i | ) | 
Deallocates memory structures associated with a timing bitmap.
| i | Pointer to an ast_timing structure. | 
| 0 | success | 
| non-zero | failure (number suitable to pass to | 
Definition at line 279 of file pbx_timing.c.
References ast_free, NULL, and ast_timing::timezone.
Referenced by iftime(), include_free(), pbx_builtin_execiftime(), and pbx_builtin_gotoiftime().
| 
 | static | 
helper function to return a range up to max (7, 12, 31 respectively). names, if supplied, is an array of names that should be mapped to numbers.
Definition at line 65 of file pbx_timing.c.
References ast_log, ast_strlen_zero(), end, LOG_WARNING, lookup_name(), max, and strsep().
Referenced by ast_build_timing().
| 
 | static | 
store a bitmask of valid times, one bit each 1 minute
Definition at line 108 of file pbx_timing.c.
References ast_log, ast_strlen_zero(), LOG_WARNING, ast_timing::minmask, and strsep().
Referenced by ast_build_timing().
| 
 | static | 
Helper for get_range. return the index of the matching entry, starting from 1. If names is not supplied, try numeric values.
Definition at line 42 of file pbx_timing.c.
References max.
Referenced by get_range().
| 
 | static | 
Definition at line 168 of file pbx_timing.c.
Referenced by ast_build_timing().
| 
 | static | 
Definition at line 180 of file pbx_timing.c.
Referenced by ast_build_timing().