diff options
author | bbryant <bbryant@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-09-09 18:51:52 +0000 |
---|---|---|
committer | bbryant <bbryant@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-09-09 18:51:52 +0000 |
commit | 722eb3c4c3cfa1c0cee915c949c5f95199ee24dd (patch) | |
tree | 25683963c5e51bdedd6211cd0ea92a85639505c3 /include | |
parent | 815b5b09da5e555add7bba3d8fca588e7611248a (diff) |
Merged revisions 285710 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2
........
r285710 | bbryant | 2010-09-09 14:50:13 -0400 (Thu, 09 Sep 2010) | 8 lines
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.8@285711 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 | 17 | ||||
-rw-r--r-- | include/asterisk/calendar.h | 2 | ||||
-rw-r--r-- | include/asterisk/ccss.h | 19 | ||||
-rw-r--r-- | include/asterisk/cel.h | 7 | ||||
-rw-r--r-- | include/asterisk/channel.h | 38 | ||||
-rw-r--r-- | include/asterisk/cli.h | 4 | ||||
-rw-r--r-- | include/asterisk/compiler.h | 6 | ||||
-rw-r--r-- | include/asterisk/event_defs.h | 4 | ||||
-rw-r--r-- | include/asterisk/module.h | 5 | ||||
-rw-r--r-- | include/asterisk/netsock2.h | 20 | ||||
-rw-r--r-- | include/asterisk/pbx.h | 8 | ||||
-rw-r--r-- | include/asterisk/poll-compat.h | 22 | ||||
-rw-r--r-- | include/asterisk/res_srtp.h | 1 | ||||
-rw-r--r-- | include/asterisk/sched.h | 10 | ||||
-rw-r--r-- | include/asterisk/select.h | 110 | ||||
-rw-r--r-- | include/asterisk/translate.h | 8 | ||||
-rw-r--r-- | include/asterisk/unaligned.h | 2 |
18 files changed, 226 insertions, 61 deletions
diff --git a/include/asterisk/astobj2.h b/include/asterisk/astobj2.h index 172407b80..21dc60611 100644 --- a/include/asterisk/astobj2.h +++ b/include/asterisk/astobj2.h @@ -583,7 +583,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); } @@ -1002,7 +1002,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 acd3140c7..67ce9ee65 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. */ @@ -381,9 +385,6 @@ /* Define to 1 if your system defines the locale_t type in xlocale.h */ #undef HAVE_LOCALE_T_IN_XLOCALE_H -/* Define to 1 if you have the `localtime_r' function. */ -#undef HAVE_LOCALTIME_R - /* Define to 1 if you have the `log' function. */ #undef HAVE_LOG @@ -538,6 +539,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 @@ -956,6 +960,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 @@ -1150,6 +1158,9 @@ #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 diff --git a/include/asterisk/calendar.h b/include/asterisk/calendar.h index 09e5bcd5b..8b970ae69 100644 --- a/include/asterisk/calendar.h +++ b/include/asterisk/calendar.h @@ -95,7 +95,9 @@ struct ast_calendar_event { AST_STRING_FIELD(organizer); AST_STRING_FIELD(location); AST_STRING_FIELD(uid); + AST_STRING_FIELD(categories); ); + int priority; /*!< Priority of event */ struct ast_calendar *owner; /*!< The calendar that owns this event */ time_t start; /*!< Start of event (UTC) */ time_t end; /*!< End of event (UTC) */ diff --git a/include/asterisk/ccss.h b/include/asterisk/ccss.h index 4dc8e5922..31073a478 100644 --- a/include/asterisk/ccss.h +++ b/include/asterisk/ccss.h @@ -189,6 +189,21 @@ int ast_cc_is_config_param(const char * const name); /*! * \since 1.8 + * \brief Set the specified CC config params to default values. + * + * \details + * This is just like ast_cc_copy_config_params() and could be used in place + * of it if you need to set the config params to defaults instead. + * You are simply "copying" defaults into the destination. + * + * \param params CC config params to set to default values. + * + * \return Nothing + */ +void ast_cc_default_config_params(struct ast_cc_config_params *params); + +/*! + * \since 1.8 * \brief copy CCSS configuration parameters from one structure to another * * \details @@ -199,8 +214,8 @@ int ast_cc_is_config_param(const char * const name); * * \param src The structure from which data is copied * \param dest The structure to which data is copied - * \retval -1 Copy failed (no way for this to happen yet) - * \retval 0 Copy succeeded + * + * \return Nothing */ void ast_cc_copy_config_params(struct ast_cc_config_params *dest, const struct ast_cc_config_params *src); diff --git a/include/asterisk/cel.h b/include/asterisk/cel.h index f221dd643..353c06110 100644 --- a/include/asterisk/cel.h +++ b/include/asterisk/cel.h @@ -28,8 +28,13 @@ extern "C" { #include "asterisk/event.h" -/*! \brief AMA Flags */ +/*! + * \brief AMA Flags + * + * \note This must much up with the AST_CDR_* defines for AMA flags. + */ enum ast_cel_ama_flag { + AST_CEL_AMA_FLAG_NONE, AST_CEL_AMA_FLAG_OMIT, AST_CEL_AMA_FLAG_BILLING, AST_CEL_AMA_FLAG_DOCUMENTATION, diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index c54b02c1f..b0f589a9d 100644 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -2232,44 +2232,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 - * \details - * 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/cli.h b/include/asterisk/cli.h index 7258548b6..21a03834d 100644 --- a/include/asterisk/cli.h +++ b/include/asterisk/cli.h @@ -183,9 +183,13 @@ struct ast_cli_entry { AST_LIST_ENTRY(ast_cli_entry) list; }; +#if defined(__cplusplus) || defined(c_plusplus) +#define AST_CLI_DEFINE(fn, txt) { { "" }, txt, NULL, 0, NULL, NULL, 0, 0, NULL, fn } +#else /* XXX the parser in gcc 2.95 gets confused if you don't put a space * between the last arg before VA_ARGS and the comma */ #define AST_CLI_DEFINE(fn, txt , ... ) { .handler = fn, .summary = txt, ## __VA_ARGS__ } +#endif /*! * Helper function to generate cli entries from a NULL-terminated array. diff --git a/include/asterisk/compiler.h b/include/asterisk/compiler.h index b2db7ffdb..91112dbfe 100644 --- a/include/asterisk/compiler.h +++ b/include/asterisk/compiler.h @@ -41,6 +41,12 @@ #define attribute_const #endif +#ifdef HAVE_ATTRIBUTE_deprecated +#define attribute_deprecated __attribute__((deprecated)) +#else +#define attribute_deprecated +#endif + #ifdef HAVE_ATTRIBUTE_unused #define attribute_unused __attribute__((unused)) #else diff --git a/include/asterisk/event_defs.h b/include/asterisk/event_defs.h index 3779dac73..073d67bc6 100644 --- a/include/asterisk/event_defs.h +++ b/include/asterisk/event_defs.h @@ -52,8 +52,10 @@ enum ast_event_type { AST_EVENT_CEL = 0x07, /*! A report of a security related event (see security_events.h) */ AST_EVENT_SECURITY = 0x08, + /*! Used by res_stun_monitor to alert listeners to an exernal network address change. */ + AST_EVENT_NETWORK_CHANGE = 0x09, /*! Number of event types. This should be the last event type + 1 */ - AST_EVENT_TOTAL = 0x09, + AST_EVENT_TOTAL = 0x0a, }; /*! \brief Event Information Element types */ diff --git a/include/asterisk/module.h b/include/asterisk/module.h index 24f66fc36..aaa8cbef3 100644 --- a/include/asterisk/module.h +++ b/include/asterisk/module.h @@ -242,6 +242,11 @@ struct ast_module_info { * this value will never be read and the module will be given the lowest possible priority * on load. */ unsigned char load_pri; + + /*! Modules which should be loaded first, in comma-separated string format. + * These are only required for loading, when the optional_api header file + * detects that the compiler does not support the optional API featureset. */ + const char *nonoptreq; }; void ast_module_register(const struct ast_module_info *); diff --git a/include/asterisk/netsock2.h b/include/asterisk/netsock2.h index 24330d236..73c57c5d2 100644 --- a/include/asterisk/netsock2.h +++ b/include/asterisk/netsock2.h @@ -233,6 +233,26 @@ static inline char *ast_sockaddr_stringify_port(const struct ast_sockaddr *addr) * \since 1.8 * * \brief + * Splits a string into its host and port components + * + * \param str[in] The string to parse. May be modified by writing a NUL at the end of + * the host part. + * \param host[out] Pointer to the host component within \a str. + * \param port[out] Pointer to the port component within \a str. + * \param flags If set to zero, a port MAY be present. If set to PARSE_PORT_IGNORE, a + * port MAY be present but will be ignored. If set to PARSE_PORT_REQUIRE, + * a port MUST be present. If set to PARSE_PORT_FORBID, a port MUST NOT + * be present. + * + * \retval 1 Success + * \retval 0 Failure + */ +int ast_sockaddr_split_hostport(char *str, char **host, char **port, int flags); + +/*! + * \since 1.8 + * + * \brief * Parse an IPv4 or IPv6 address string. * * \details diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h index ac09f009b..a0ef3d476 100644 --- a/include/asterisk/pbx.h +++ b/include/asterisk/pbx.h @@ -1220,14 +1220,6 @@ struct ast_exten *pbx_find_extension(struct ast_channel *chan, 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..cbb610925 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,24 @@ 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); + +/*! + * \brief Shortcut for conversion of FD_ISSET to poll(2)-based + */ +static inline int ast_poll_fd_index(struct pollfd *haystack, int nfds, int needle) +{ + int i; + for (i = 0; i < nfds; i++) { + if (haystack[i].fd == needle) { + return i; + } + } + return -1; +} + #endif /* __AST_POLL_COMPAT_H */ diff --git a/include/asterisk/res_srtp.h b/include/asterisk/res_srtp.h index 7853ead6f..4aa830946 100644 --- a/include/asterisk/res_srtp.h +++ b/include/asterisk/res_srtp.h @@ -33,6 +33,7 @@ struct ast_srtp_res { int (*create)(struct ast_srtp **srtp, struct ast_rtp_instance *rtp, struct ast_srtp_policy *policy); void (*destroy)(struct ast_srtp *srtp); int (*add_stream)(struct ast_srtp *srtp, struct ast_srtp_policy *policy); + int (*change_source)(struct ast_srtp *srtp, unsigned int from_ssrc, unsigned int to_ssrc); void (*set_cb)(struct ast_srtp *srtp, const struct ast_srtp_cb *cb, void *data); int (*unprotect)(struct ast_srtp *srtp, void *buf, int *size, int rtcp); int (*protect)(struct ast_srtp *srtp, void **buf, int *size, int rtcp); diff --git a/include/asterisk/sched.h b/include/asterisk/sched.h index 3904daf36..4f5fb4217 100644 --- a/include/asterisk/sched.h +++ b/include/asterisk/sched.h @@ -53,7 +53,7 @@ extern "C" { int _count = 0; \ int _sched_res = -1; \ while (id > -1 && (_sched_res = ast_sched_del(sched, id)) && ++_count < 10) \ - usleep(1000); \ + usleep(1); \ if (_count == 10 && option_debug > 2) { \ ast_log(LOG_DEBUG, "Unable to cancel schedule ID %d.\n", id); \ } \ @@ -70,7 +70,7 @@ extern "C" { do { \ int _count = 0; \ while (id > -1 && ast_sched_del(sched, id) && ++_count < 10) { \ - usleep(1000); \ + usleep(1); \ } \ if (_count == 10) \ ast_log(LOG_WARNING, "Unable to cancel schedule ID %d. This is probably a bug (%s: %s, line %d).\n", id, __FILE__, __PRETTY_FUNCTION__, __LINE__); \ @@ -89,7 +89,7 @@ extern "C" { int _sched_res = -1; \ while (id > -1 && (_sched_res = ast_sched_del(sched, id)) && ++_count < 10) { \ ast_mutex_unlock(lock); \ - usleep(1000); \ + usleep(1); \ ast_mutex_lock(lock); \ } \ if (_count == 10 && option_debug > 2) { \ @@ -103,7 +103,7 @@ extern "C" { do { \ int _count = 0; \ while (id > -1 && ast_sched_del(sched, id) && ++_count < 10) { \ - usleep(1000); \ + usleep(1); \ } \ if (_count == 10) \ ast_log(LOG_WARNING, "Unable to cancel schedule ID %d. This is probably a bug (%s: %s, line %d).\n", id, __FILE__, __PRETTY_FUNCTION__, __LINE__); \ @@ -122,7 +122,7 @@ extern "C" { int _count = 0, _res=1; \ void *_data = (void *)ast_sched_find_data(sched, id); \ while (id > -1 && (_res = ast_sched_del(sched, id) && _count++ < 10)) { \ - usleep(1000); \ + usleep(1); \ } \ if (!_res && _data) \ unrefcall; /* should ref _data! */ \ 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 */ diff --git a/include/asterisk/translate.h b/include/asterisk/translate.h index 1d87adbf5..821463bf1 100644 --- a/include/asterisk/translate.h +++ b/include/asterisk/translate.h @@ -254,6 +254,14 @@ unsigned int ast_translate_path_steps(format_t dest, format_t src); */ format_t ast_translate_available_formats(format_t dest, format_t src); +/*! + * \brief Puts a string representation of the translation path into outbuf + * \param translator structure containing the translation path + * \param ast_str output buffer + * \retval on success pointer to beginning of outbuf. on failure "". + */ +const char *ast_translate_path_to_str(struct ast_trans_pvt *t, struct ast_str **str); + #if defined(__cplusplus) || defined(c_plusplus) } #endif diff --git a/include/asterisk/unaligned.h b/include/asterisk/unaligned.h index 63f430f89..9e6e743da 100644 --- a/include/asterisk/unaligned.h +++ b/include/asterisk/unaligned.h @@ -50,7 +50,7 @@ static inline unsigned short get_unaligned_uint16(const void *p) static inline void put_unaligned_uint64(void *p, uint64_t datum) { - struct { unsigned int d; } __attribute__((packed,may_alias)) *pp = p; + struct { uint64_t d; } __attribute__((packed,may_alias)) *pp = p; pp->d = datum; } |