diff options
author | bbryant <bbryant@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-09-09 18:50:13 +0000 |
---|---|---|
committer | bbryant <bbryant@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-09-09 18:50:13 +0000 |
commit | 12ad49e444d6108b7312a46b389090d51b670a7f (patch) | |
tree | fe20338149990fed28e3936bbbd7162e69d1f938 /include | |
parent | f8d0dcac122feafe9ebd0aba502263f829c77667 (diff) |
Fixes an issue with dialplan pattern matching where the specificity for pattern ranges and pattern special characters was inconsistent.
(closes issue #16903)
Reported by: Nick_Lewis
Patches:
pbx.c-specificity.patch uploaded by Nick Lewis (license 657)
Tested by: Nick_Lewis
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@285710 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/astobj2.h | 4 | ||||
-rw-r--r-- | include/asterisk/autoconfig.h.in | 65 | ||||
-rw-r--r-- | include/asterisk/channel.h | 36 | ||||
-rw-r--r-- | include/asterisk/pbx.h | 10 | ||||
-rw-r--r-- | include/asterisk/poll-compat.h | 8 | ||||
-rw-r--r-- | include/asterisk/select.h | 110 |
6 files changed, 165 insertions, 68 deletions
diff --git a/include/asterisk/astobj2.h b/include/asterisk/astobj2.h index 8ef6985c7..766993713 100644 --- a/include/asterisk/astobj2.h +++ b/include/asterisk/astobj2.h @@ -591,7 +591,7 @@ Operations on container include: i = ao2_iterator_init(c, flags); - while ( (o = ao2_iterator_next(&i)) ) { + while ((o = ao2_iterator_next(&i))) { ... do something on o ... ao2_ref(o, -1); } @@ -1013,7 +1013,7 @@ void *_ao2_find(struct ao2_container *c, void *arg, enum search_flags flags); * * i = ao2_iterator_init(c, flags); * - * while ( (o = ao2_iterator_next(&i)) ) { + * while ((o = ao2_iterator_next(&i))) { * ... do something on o ... * ao2_ref(o, -1); * } diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in index 07b996a7a..2936b96dd 100644 --- a/include/asterisk/autoconfig.h.in +++ b/include/asterisk/autoconfig.h.in @@ -17,6 +17,10 @@ /* Define to 1 if the `closedir' function returns void instead of `int'. */ #undef CLOSEDIR_VOID +/* Some configure tests will unexpectedly fail if configure is run by a + non-root user. These may be able to be tested at runtime. */ +#undef CONFIGURE_RAN_AS_ROOT + /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ @@ -480,6 +484,9 @@ /* Define to 1 if you have the `powl' function. */ #undef HAVE_POWL +/* Define to 1 if you have the `ppoll' function. */ +#undef HAVE_PPOLL + /* Define to 1 if you have the ISDN PRI library. */ #undef HAVE_PRI @@ -692,7 +699,7 @@ /* Define to 1 if you have the `strtoq' function. */ #undef HAVE_STRTOQ -/* Define to 1 if `st_blksize' is a member of `struct stat'. */ +/* Define to 1 if `st_blksize' is member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BLKSIZE /* Define to 1 if you have the mISDN Supplemental Services library. */ @@ -809,6 +816,10 @@ /* Define to 1 if `utime(file, NULL)' sets file's timestamp to the present. */ #undef HAVE_UTIME_NULL +/* Define to 1 if your system can support larger than default select bitmasks. + */ +#undef HAVE_VARIABLE_FDSET + /* Define to 1 if you have the `vasprintf' function. */ #undef HAVE_VASPRINTF @@ -924,12 +935,12 @@ /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME -/* Define to the home page for this package. */ -#undef PACKAGE_URL - /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* Define to 1 if the C compiler supports function prototypes. */ +#undef PROTOTYPES + /* Define to necessary symbol if this constant uses a non-standard name on your system. */ #undef PTHREAD_CREATE_JOINABLE @@ -949,6 +960,11 @@ /* Define to the type of arg 5 for `select'. */ #undef SELECT_TYPE_ARG5 +/* Define to 1 if the `setvbuf' function takes the buffering type as its + second argument and the buffer pointer as the third, as on System V before + release 3. */ +#undef SETVBUF_REVERSED + /* The size of `int', as computed by sizeof. */ #undef SIZEOF_INT @@ -969,31 +985,24 @@ /* Define to 1 if your <sys/time.h> declares `struct tm'. */ #undef TM_IN_SYS_TIME -/* Enable extensions on AIX 3, Interix. */ +/* Define to 1 if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif +/* Define to 1 if running on Darwin. */ +#undef _DARWIN_UNLIMITED_SELECT /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif + /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ #undef _LARGEFILE_SOURCE @@ -1010,6 +1019,20 @@ /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE +/* Enable extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif + +/* Define like PROTOTYPES; this can be used by system headers. */ +#undef __PROTOTYPES + /* Define to empty if `const' does not conform to ANSI C. */ #undef const diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index 7dde431be..208f88402 100644 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -1742,42 +1742,6 @@ static inline void timersub(struct timeval *tvend, struct timeval *tvstart, stru } #endif -/*! \brief Waits for activity on a group of channels - * \param nfds the maximum number of file descriptors in the sets - * \param rfds file descriptors to check for read availability - * \param wfds file descriptors to check for write availability - * \param efds file descriptors to check for exceptions (OOB data) - * \param tvp timeout while waiting for events - * This is the same as a standard select(), except it guarantees the - * behaviour where the passed struct timeval is updated with how much - * time was not slept while waiting for the specified events - */ -static inline int ast_select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *tvp) -{ -#ifdef __linux__ - return select(nfds, rfds, wfds, efds, tvp); -#else - if (tvp) { - struct timeval tv, tvstart, tvend, tvlen; - int res; - - tv = *tvp; - gettimeofday(&tvstart, NULL); - res = select(nfds, rfds, wfds, efds, tvp); - gettimeofday(&tvend, NULL); - timersub(&tvend, &tvstart, &tvlen); - timersub(&tv, &tvlen, tvp); - if (tvp->tv_sec < 0 || (tvp->tv_sec == 0 && tvp->tv_usec < 0)) { - tvp->tv_sec = 0; - tvp->tv_usec = 0; - } - return res; - } - else - return select(nfds, rfds, wfds, efds, NULL); -#endif -} - /*! \brief Retrieves the current T38 state of a channel */ static inline enum ast_t38_state ast_channel_get_t38_state(struct ast_channel *chan) { diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h index e35cb9650..4f2d6facb 100644 --- a/include/asterisk/pbx.h +++ b/include/asterisk/pbx.h @@ -1109,20 +1109,12 @@ struct pbx_find_info { const char *data; /* set on return */ const char *foundcontext; /* set on return */ }; - + struct ast_exten *pbx_find_extension(struct ast_channel *chan, struct ast_context *bypass, struct pbx_find_info *q, const char *context, const char *exten, int priority, const char *label, const char *callerid, enum ext_match_t action); - -/* every time a write lock is obtained for contexts, - a counter is incremented. You can check this via the - following func */ - -int ast_wrlock_contexts_version(void); - - /*!\brief hashtable functions for contexts */ /*! @{ */ int ast_hashtab_compare_contexts(const void *ah_a, const void *ah_b); diff --git a/include/asterisk/poll-compat.h b/include/asterisk/poll-compat.h index 1156e694b..c955f00bf 100644 --- a/include/asterisk/poll-compat.h +++ b/include/asterisk/poll-compat.h @@ -79,6 +79,8 @@ #ifndef __AST_POLL_COMPAT_H #define __AST_POLL_COMPAT_H +#include "asterisk/select.h" + #ifndef AST_POLL_COMPAT #include <sys/poll.h> @@ -114,4 +116,10 @@ int ast_internal_poll(struct pollfd *pArray, unsigned long n_fds, int timeout); #endif /* AST_POLL_COMPAT */ +/*! + * \brief Same as poll(2), except the time is specified in microseconds and + * the tv argument is modified to indicate the time remaining. + */ +int ast_poll2(struct pollfd *pArray, unsigned long n_fds, struct timeval *tv); + #endif /* __AST_POLL_COMPAT_H */ diff --git a/include/asterisk/select.h b/include/asterisk/select.h new file mode 100644 index 000000000..fea8c7aff --- /dev/null +++ b/include/asterisk/select.h @@ -0,0 +1,110 @@ +/* + * Asterisk -- An open source telephony toolkit. + * + * Copyright (C) 2010, Digium, Inc. + * + * Tilghman Lesher <tlesher AT digium DOT com> + * + * See http://www.asterisk.org for more information about + * the Asterisk project. Please do not directly contact + * any of the maintainers of this project for assistance; + * the project provides a web site, mailing lists and IRC + * channels for your use. + * + * This program is free software, distributed under the terms of + * the GNU General Public License Version 2. See the LICENSE file + * at the top of the source tree. + */ + +/*!\file + * \brief Bitfield expansions for ast_select + */ + +#ifndef __AST_SELECT_H +#define __AST_SELECT_H + +#include <sys/select.h> +#include <errno.h> +#include "asterisk/utils.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern unsigned int ast_FD_SETSIZE; + +#if !defined(HAVE_VARIABLE_FDSET) && defined(CONFIGURE_RAN_AS_ROOT) +#define ast_fdset fd_set +#else +typedef struct { + long fds_bits[4096 / sizeof(long)]; /* 32768 bits */ +} ast_fdset; + +#undef FD_ZERO +#define FD_ZERO(a) \ + do { \ + long *bytes = (long *) a; \ + int i; \ + for (i = 0; i < sizeof(*(a)) / sizeof(long); i++) { \ + bytes[i] = 0; \ + } \ + } while (0) +#undef FD_SET +#define FD_SET(fd, fds) \ + do { \ + long *bytes = (long *) fds; \ + if (fd / sizeof(*bytes) + ((fd + 1) % sizeof(*bytes) ? 1 : 0) < sizeof(*(fds))) { \ + bytes[fd / (sizeof(*bytes))] |= 1L << (fd % sizeof(*bytes)); \ + } else { \ + ast_log(LOG_ERROR, "FD %d exceeds the maximum size of ast_fdset!\n", fd); \ + } \ + } while (0) +#endif /* HAVE_VARIABLE_FDSET */ + +/*! \brief Waits for activity on a group of channels + * \param nfds the maximum number of file descriptors in the sets + * \param rfds file descriptors to check for read availability + * \param wfds file descriptors to check for write availability + * \param efds file descriptors to check for exceptions (OOB data) + * \param tvp timeout while waiting for events + * This is the same as a standard select(), except it guarantees the + * behaviour where the passed struct timeval is updated with how much + * time was not slept while waiting for the specified events + */ +static inline int ast_select(int nfds, ast_fdset *rfds, ast_fdset *wfds, ast_fdset *efds, struct timeval *tvp) +{ +#ifdef __linux__ + ast_assert((unsigned int) nfds <= ast_FD_SETSIZE); + return select(nfds, (fd_set *) rfds, (fd_set *) wfds, (fd_set *) efds, tvp); +#else + int save_errno = 0; + + ast_assert((unsigned int) nfds <= ast_FD_SETSIZE); + if (tvp) { + struct timeval tv, tvstart, tvend, tvlen; + int res; + + tv = *tvp; + gettimeofday(&tvstart, NULL); + res = select(nfds, (fd_set *) rfds, (fd_set *) wfds, (fd_set *) efds, tvp); + save_errno = errno; + gettimeofday(&tvend, NULL); + timersub(&tvend, &tvstart, &tvlen); + timersub(&tv, &tvlen, tvp); + if (tvp->tv_sec < 0 || (tvp->tv_sec == 0 && tvp->tv_usec < 0)) { + tvp->tv_sec = 0; + tvp->tv_usec = 0; + } + errno = save_errno; + return res; + } + else + return select(nfds, (fd_set *) rfds, (fd_set *) wfds, (fd_set *) efds, NULL); +#endif +} + +#ifdef __cplusplus +} +#endif + +#endif /* __AST_SELECT_H */ |