From 4d6996c27ad2cc1e0055b06b18522a44036c4f5c Mon Sep 17 00:00:00 2001 From: murf Date: Tue, 7 Nov 2006 21:47:49 +0000 Subject: A fair number of changes for the sake of bug 7506 git-svn-id: http://svn.digium.com/svn/asterisk/trunk@47290 f38db490-d61c-443f-a65b-d21fe96a405b --- include/asterisk/channel.h | 8 +++++++- include/asterisk/stringfields.h | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index 26412b3fe..10491a041 100644 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -579,7 +579,7 @@ int ast_setstate(struct ast_channel *chan, enum ast_channel_state); by default set to the "default" context and extension "s" */ -struct ast_channel *ast_channel_alloc(int needalertpipe); +struct ast_channel *ast_channel_alloc(int needalertpipe, int state, const char *cid_num, const char *cid_name, const char *name_fmt, ...); /*! \brief Queue an outgoing frame */ int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f); @@ -1106,6 +1106,12 @@ void ast_deactivate_generator(struct ast_channel *chan); void ast_set_callerid(struct ast_channel *chan, const char *cidnum, const char *cidname, const char *ani); + +/*! return a mallocd string with the result of sprintf of the fmt and following args */ +char *ast_safe_string_alloc(const char *fmt, ...); + + + /*! Start a tone going */ int ast_tonepair_start(struct ast_channel *chan, int freq1, int freq2, int duration, int vol); /*! Stop a tone from playing */ diff --git a/include/asterisk/stringfields.h b/include/asterisk/stringfields.h index bf4c0a055..d35ef7d8e 100644 --- a/include/asterisk/stringfields.h +++ b/include/asterisk/stringfields.h @@ -167,6 +167,22 @@ void __ast_string_field_index_build(struct ast_string_field_mgr *mgr, ast_string_field *fields, int num_fields, int index, const char *format, ...); +/*! + \internal + \brief Set a field to a complex (built) value + \param mgr Pointer to the pool manager structure + \param fields Pointer to the first entry of the field array + \param num_fields Number of fields in the array + \param index Index position of the field within the structure + \param format printf-style format string + \param args va_list of the args for the format_string + \param args_again a copy of the first va_list for the sake of bsd not having a copy routine + \return nothing +*/ +void __ast_string_field_index_build_va(struct ast_string_field_mgr *mgr, + ast_string_field *fields, int num_fields, + int index, const char *format, va_list a1, va_list a2); + /*! \brief Declare a string field \param name The field name @@ -275,6 +291,18 @@ void __ast_string_field_index_build(struct ast_string_field_mgr *mgr, #define ast_string_field_index_build(x, index, fmt, args...) \ __ast_string_field_index_build(&(x)->__field_mgr, &(x)->__begin_field[0], ast_string_field_count(x), index, fmt, args) +/*! + \brief Set a field to a complex (built) value with prebuilt va_lists. + \param x Pointer to a structure containing fields + \param index Index position of the field within the structure + \param fmt printf-style format string + \param args1 Arguments for format string in va_list format + \param args2 a second copy of the va_list for the sake of bsd, with no va_list copy operation + \return nothing +*/ +#define ast_string_field_index_build_va(x, index, fmt, args1, args2) \ + __ast_string_field_index_build_va(&(x)->__field_mgr, &(x)->__begin_field[0], ast_string_field_count(x), index, fmt, args1, args2) + /*! \brief Set a field to a complex (built) value \param x Pointer to a structure containing fields @@ -286,6 +314,17 @@ void __ast_string_field_index_build(struct ast_string_field_mgr *mgr, #define ast_string_field_build(x, field, fmt, args...) \ ast_string_field_index_build(x, ast_string_field_index(x, field), fmt, args) +/*! + \brief Set a field to a complex (built) value + \param x Pointer to a structure containing fields + \param field Name of the field to set + \param fmt printf-style format string + \param argslist a va_list of the args + \return nothing +*/ +#define ast_string_field_build_va(x, field, fmt, args1, args2) \ + ast_string_field_index_build_va(x, ast_string_field_index(x, field), fmt, args1, args2) + /*! \brief Free a field's value. \param x Pointer to a structure containing fields -- cgit v1.2.3