From 786f5898d12d30c481b1d178bb80e5801dbf666f Mon Sep 17 00:00:00 2001 From: Terry Wilson Date: Tue, 13 Mar 2012 18:20:34 +0000 Subject: Finalize ast_channel opaquification Review: https://reviewboard.asterisk.org/r/1786/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358907 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/channel_internal_api.c | 678 +++++++++++++++++++++++++++++--------------- 1 file changed, 450 insertions(+), 228 deletions(-) (limited to 'main/channel_internal_api.c') diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c index 0a7060e29..4f89ca788 100644 --- a/main/channel_internal_api.c +++ b/main/channel_internal_api.c @@ -38,6 +38,154 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/stringfields.h" #include "asterisk/data.h" #include "asterisk/indications.h" +#include "asterisk/channel_internal.h" + +/*! + * \brief Main Channel structure associated with a channel. + * + * \note XXX It is important to remember to increment .cleancount each time + * this structure is changed. XXX + * + * \note When adding fields to this structure, it is important to add the field + * 'in position' with like-aligned fields, so as to keep the compiler from + * having to add padding to align fields. The structure's fields are sorted + * in this order: pointers, structures, long, int/enum, short, char. This + * is especially important on 64-bit architectures, where mixing 4-byte + * and 8-byte fields causes 4 bytes of padding to be added before many + * 8-byte fields. + */ +struct ast_channel { + const struct ast_channel_tech *tech; /*!< Technology (point to channel driver) */ + void *tech_pvt; /*!< Private data used by the technology driver */ + void *music_state; /*!< Music State*/ + void *generatordata; /*!< Current generator data if there is any */ + struct ast_generator *generator; /*!< Current active data generator */ + struct ast_channel * bridged_channel; /*!< Who are we bridged to, if we're bridged. + * Who is proxying for us, if we are proxied (i.e. chan_agent). + * Do not access directly, use ast_bridged_channel(chan) */ + struct ast_channel *masq; /*!< Channel that will masquerade as us */ + struct ast_channel *masqr; /*!< Who we are masquerading as */ + const char *blockproc; /*!< Procedure causing blocking */ + const char *appl; /*!< Current application */ + const char *data; /*!< Data passed to current application */ + struct ast_sched_context *sched; /*!< Schedule context */ + struct ast_filestream *stream; /*!< Stream itself. */ + struct ast_filestream *vstream; /*!< Video Stream itself. */ + ast_timing_func_t timingfunc; + void *timingdata; + struct ast_pbx *pbx; /*!< PBX private structure for this channel */ + struct ast_trans_pvt *writetrans; /*!< Write translation path */ + struct ast_trans_pvt *readtrans; /*!< Read translation path */ + struct ast_audiohook_list *audiohooks; + struct ast_framehook_list *framehooks; + struct ast_cdr *cdr; /*!< Call Detail Record */ + struct ast_tone_zone *zone; /*!< Tone zone as set in indications.conf or + * in the CHANNEL dialplan function */ + struct ast_channel_monitor *monitor; /*!< Channel monitoring */ +#ifdef HAVE_EPOLL + struct ast_epoll_data *epfd_data[AST_MAX_FDS]; +#endif + + AST_DECLARE_STRING_FIELDS( + AST_STRING_FIELD(name); /*!< ASCII unique channel name */ + AST_STRING_FIELD(language); /*!< Language requested for voice prompts */ + AST_STRING_FIELD(musicclass); /*!< Default music class */ + AST_STRING_FIELD(accountcode); /*!< Account code for billing */ + AST_STRING_FIELD(peeraccount); /*!< Peer account code for billing */ + AST_STRING_FIELD(userfield); /*!< Userfield for CEL billing */ + AST_STRING_FIELD(call_forward); /*!< Where to forward to if asked to dial on this interface */ + AST_STRING_FIELD(uniqueid); /*!< Unique Channel Identifier */ + AST_STRING_FIELD(linkedid); /*!< Linked Channel Identifier -- gets propagated by linkage */ + AST_STRING_FIELD(parkinglot); /*! Default parking lot, if empty, default parking lot */ + AST_STRING_FIELD(hangupsource); /*! Who is responsible for hanging up this channel */ + AST_STRING_FIELD(dialcontext); /*!< Dial: Extension context that we were called from */ + ); + + struct timeval whentohangup; /*!< Non-zero, set to actual time when channel is to be hung up */ + pthread_t blocker; /*!< If anyone is blocking, this is them */ + + /*! + * \brief Dialed/Called information. + * \note Set on incoming channels to indicate the originally dialed party. + * \note Dialed Number Identifier (DNID) + */ + struct ast_party_dialed dialed; + + /*! + * \brief Channel Caller ID information. + * \note The caller id information is the caller id of this + * channel when it is used to initiate a call. + */ + struct ast_party_caller caller; + + /*! + * \brief Channel Connected Line ID information. + * \note The connected line information identifies the channel + * connected/bridged to this channel. + */ + struct ast_party_connected_line connected; + + /*! \brief Redirecting/Diversion information */ + struct ast_party_redirecting redirecting; + + struct ast_frame dtmff; /*!< DTMF frame */ + struct varshead varshead; /*!< A linked list for channel variables. See \ref AstChanVar */ + ast_group_t callgroup; /*!< Call group for call pickups */ + ast_group_t pickupgroup; /*!< Pickup group - which calls groups can be picked up? */ + struct ast_readq_list readq; + struct ast_jb jb; /*!< The jitterbuffer state */ + struct timeval dtmf_tv; /*!< The time that an in process digit began, or the last digit ended */ + struct ast_datastore_list datastores; /*!< Data stores on the channel */ + struct ast_autochan_list autochans; /*!< Autochans on the channel */ + unsigned long insmpl; /*!< Track the read/written samples for monitor use */ + unsigned long outsmpl; /*!< Track the read/written samples for monitor use */ + + int fds[AST_MAX_FDS]; /*!< File descriptors for channel -- Drivers will poll on + * these file descriptors, so at least one must be non -1. + * See \arg \ref AstFileDesc */ + int softhangup; /*!< Whether or not we have been hung up... Do not set this value + * directly, use ast_softhangup() */ + int fdno; /*!< Which fd had an event detected on */ + int streamid; /*!< For streaming playback, the schedule ID */ + int vstreamid; /*!< For streaming video playback, the schedule ID */ + struct ast_format oldwriteformat; /*!< Original writer format */ + int timingfd; /*!< Timing fd */ + enum ast_channel_state state; /*!< State of line -- Don't write directly, use ast_setstate() */ + int rings; /*!< Number of rings so far */ + int priority; /*!< Dialplan: Current extension priority */ + int macropriority; /*!< Macro: Current non-macro priority. See app_macro.c */ + int amaflags; /*!< Set BEFORE PBX is started to determine AMA flags */ + enum ast_channel_adsicpe adsicpe; /*!< Whether or not ADSI is detected on CPE */ + unsigned int fin; /*!< Frames in counters. The high bit is a debug mask, so + * the counter is only in the remaining bits */ + unsigned int fout; /*!< Frames out counters. The high bit is a debug mask, so + * the counter is only in the remaining bits */ + int hangupcause; /*!< Why is the channel hanged up. See causes.h */ + unsigned int finalized:1; /*!< Whether or not the channel has been successfully allocated */ + struct ast_flags flags; /*!< channel flags of AST_FLAG_ type */ + int alertpipe[2]; + struct ast_format_cap *nativeformats; /*!< Kinds of data this channel can natively handle */ + struct ast_format readformat; /*!< Requested read format (after translation) */ + struct ast_format writeformat; /*!< Requested write format (after translation) */ + struct ast_format rawreadformat; /*!< Raw read format (before translation) */ + struct ast_format rawwriteformat; /*!< Raw write format (before translation) */ + unsigned int emulate_dtmf_duration; /*!< Number of ms left to emulate DTMF for */ +#ifdef HAVE_EPOLL + int epfd; +#endif + int visible_indication; /*!< Indication currently playing on the channel */ + + unsigned short transfercapability; /*!< ISDN Transfer Capability - AST_FLAG_DIGITAL is not enough */ + + struct ast_bridge *bridge; /*!< Bridge this channel is participating in */ + struct ast_timer *timer; /*!< timer object that provided timingfd */ + + char context[AST_MAX_CONTEXT]; /*!< Dialplan: Current extension context */ + char exten[AST_MAX_EXTENSION]; /*!< Dialplan: Current extension number */ + char macrocontext[AST_MAX_CONTEXT]; /*!< Macro: Current non-macro context. See app_macro.c */ + char macroexten[AST_MAX_EXTENSION]; /*!< Macro: Current non-macro extension. See app_macro.c */ + char dtmf_digit_to_emulate; /*!< Digit being emulated */ +}; /* AST_DATA definitions, which will probably have to be re-thought since the channel will be opaque */ @@ -55,57 +203,57 @@ AST_DATA_STRUCTURE(ast_callerid, DATA_EXPORT_CALLERID); #endif #define DATA_EXPORT_CHANNEL(MEMBER) \ - MEMBER(ast_channel, __do_not_use_blockproc, AST_DATA_STRING) \ - MEMBER(ast_channel, __do_not_use_appl, AST_DATA_STRING) \ - MEMBER(ast_channel, __do_not_use_data, AST_DATA_STRING) \ - MEMBER(ast_channel, __do_not_use_name, AST_DATA_STRING) \ - MEMBER(ast_channel, __do_not_use_language, AST_DATA_STRING) \ - MEMBER(ast_channel, __do_not_use_musicclass, AST_DATA_STRING) \ - MEMBER(ast_channel, __do_not_use_accountcode, AST_DATA_STRING) \ - MEMBER(ast_channel, __do_not_use_peeraccount, AST_DATA_STRING) \ - MEMBER(ast_channel, __do_not_use_userfield, AST_DATA_STRING) \ - MEMBER(ast_channel, __do_not_use_call_forward, AST_DATA_STRING) \ - MEMBER(ast_channel, __do_not_use_uniqueid, AST_DATA_STRING) \ - MEMBER(ast_channel, __do_not_use_linkedid, AST_DATA_STRING) \ - MEMBER(ast_channel, __do_not_use_parkinglot, AST_DATA_STRING) \ - MEMBER(ast_channel, __do_not_use_hangupsource, AST_DATA_STRING) \ - MEMBER(ast_channel, __do_not_use_dialcontext, AST_DATA_STRING) \ - MEMBER(ast_channel, __do_not_use_rings, AST_DATA_INTEGER) \ - MEMBER(ast_channel, __do_not_use_priority, AST_DATA_INTEGER) \ - MEMBER(ast_channel, __do_not_use_macropriority, AST_DATA_INTEGER) \ - MEMBER(ast_channel, __do_not_use_adsicpe, AST_DATA_INTEGER) \ - MEMBER(ast_channel, __do_not_use_fin, AST_DATA_UNSIGNED_INTEGER) \ - MEMBER(ast_channel, __do_not_use_fout, AST_DATA_UNSIGNED_INTEGER) \ - MEMBER(ast_channel, __do_not_use_emulate_dtmf_duration, AST_DATA_UNSIGNED_INTEGER) \ - MEMBER(ast_channel, __do_not_use_visible_indication, AST_DATA_INTEGER) \ - MEMBER(ast_channel, __do_not_use_context, AST_DATA_STRING) \ - MEMBER(ast_channel, __do_not_use_exten, AST_DATA_STRING) \ - MEMBER(ast_channel, __do_not_use_macrocontext, AST_DATA_STRING) \ - MEMBER(ast_channel, __do_not_use_macroexten, AST_DATA_STRING) + MEMBER(ast_channel, blockproc, AST_DATA_STRING) \ + MEMBER(ast_channel, appl, AST_DATA_STRING) \ + MEMBER(ast_channel, data, AST_DATA_STRING) \ + MEMBER(ast_channel, name, AST_DATA_STRING) \ + MEMBER(ast_channel, language, AST_DATA_STRING) \ + MEMBER(ast_channel, musicclass, AST_DATA_STRING) \ + MEMBER(ast_channel, accountcode, AST_DATA_STRING) \ + MEMBER(ast_channel, peeraccount, AST_DATA_STRING) \ + MEMBER(ast_channel, userfield, AST_DATA_STRING) \ + MEMBER(ast_channel, call_forward, AST_DATA_STRING) \ + MEMBER(ast_channel, uniqueid, AST_DATA_STRING) \ + MEMBER(ast_channel, linkedid, AST_DATA_STRING) \ + MEMBER(ast_channel, parkinglot, AST_DATA_STRING) \ + MEMBER(ast_channel, hangupsource, AST_DATA_STRING) \ + MEMBER(ast_channel, dialcontext, AST_DATA_STRING) \ + MEMBER(ast_channel, rings, AST_DATA_INTEGER) \ + MEMBER(ast_channel, priority, AST_DATA_INTEGER) \ + MEMBER(ast_channel, macropriority, AST_DATA_INTEGER) \ + MEMBER(ast_channel, adsicpe, AST_DATA_INTEGER) \ + MEMBER(ast_channel, fin, AST_DATA_UNSIGNED_INTEGER) \ + MEMBER(ast_channel, fout, AST_DATA_UNSIGNED_INTEGER) \ + MEMBER(ast_channel, emulate_dtmf_duration, AST_DATA_UNSIGNED_INTEGER) \ + MEMBER(ast_channel, visible_indication, AST_DATA_INTEGER) \ + MEMBER(ast_channel, context, AST_DATA_STRING) \ + MEMBER(ast_channel, exten, AST_DATA_STRING) \ + MEMBER(ast_channel, macrocontext, AST_DATA_STRING) \ + MEMBER(ast_channel, macroexten, AST_DATA_STRING) AST_DATA_STRUCTURE(ast_channel, DATA_EXPORT_CHANNEL); static void channel_data_add_flags(struct ast_data *tree, struct ast_channel *chan) { - ast_data_add_bool(tree, "DEFER_DTMF", ast_test_flag(chan, AST_FLAG_DEFER_DTMF)); - ast_data_add_bool(tree, "WRITE_INT", ast_test_flag(chan, AST_FLAG_WRITE_INT)); - ast_data_add_bool(tree, "BLOCKING", ast_test_flag(chan, AST_FLAG_BLOCKING)); - ast_data_add_bool(tree, "ZOMBIE", ast_test_flag(chan, AST_FLAG_ZOMBIE)); - ast_data_add_bool(tree, "EXCEPTION", ast_test_flag(chan, AST_FLAG_EXCEPTION)); - ast_data_add_bool(tree, "MOH", ast_test_flag(chan, AST_FLAG_MOH)); - ast_data_add_bool(tree, "SPYING", ast_test_flag(chan, AST_FLAG_SPYING)); - ast_data_add_bool(tree, "NBRIDGE", ast_test_flag(chan, AST_FLAG_NBRIDGE)); - ast_data_add_bool(tree, "IN_AUTOLOOP", ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP)); - ast_data_add_bool(tree, "OUTGOING", ast_test_flag(chan, AST_FLAG_OUTGOING)); - ast_data_add_bool(tree, "IN_DTMF", ast_test_flag(chan, AST_FLAG_IN_DTMF)); - ast_data_add_bool(tree, "EMULATE_DTMF", ast_test_flag(chan, AST_FLAG_EMULATE_DTMF)); - ast_data_add_bool(tree, "END_DTMF_ONLY", ast_test_flag(chan, AST_FLAG_END_DTMF_ONLY)); - ast_data_add_bool(tree, "ANSWERED_ELSEWHERE", ast_test_flag(chan, AST_FLAG_ANSWERED_ELSEWHERE)); - ast_data_add_bool(tree, "MASQ_NOSTREAM", ast_test_flag(chan, AST_FLAG_MASQ_NOSTREAM)); - ast_data_add_bool(tree, "BRIDGE_HANGUP_RUN", ast_test_flag(chan, AST_FLAG_BRIDGE_HANGUP_RUN)); - ast_data_add_bool(tree, "BRIDGE_HANGUP_DONT", ast_test_flag(chan, AST_FLAG_BRIDGE_HANGUP_DONT)); - ast_data_add_bool(tree, "DISABLE_WORKAROUNDS", ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS)); + ast_data_add_bool(tree, "DEFER_DTMF", ast_test_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF)); + ast_data_add_bool(tree, "WRITE_INT", ast_test_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT)); + ast_data_add_bool(tree, "BLOCKING", ast_test_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING)); + ast_data_add_bool(tree, "ZOMBIE", ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE)); + ast_data_add_bool(tree, "EXCEPTION", ast_test_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION)); + ast_data_add_bool(tree, "MOH", ast_test_flag(ast_channel_flags(chan), AST_FLAG_MOH)); + ast_data_add_bool(tree, "SPYING", ast_test_flag(ast_channel_flags(chan), AST_FLAG_SPYING)); + ast_data_add_bool(tree, "NBRIDGE", ast_test_flag(ast_channel_flags(chan), AST_FLAG_NBRIDGE)); + ast_data_add_bool(tree, "IN_AUTOLOOP", ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP)); + ast_data_add_bool(tree, "OUTGOING", ast_test_flag(ast_channel_flags(chan), AST_FLAG_OUTGOING)); + ast_data_add_bool(tree, "IN_DTMF", ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_DTMF)); + ast_data_add_bool(tree, "EMULATE_DTMF", ast_test_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF)); + ast_data_add_bool(tree, "END_DTMF_ONLY", ast_test_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY)); + ast_data_add_bool(tree, "ANSWERED_ELSEWHERE", ast_test_flag(ast_channel_flags(chan), AST_FLAG_ANSWERED_ELSEWHERE)); + ast_data_add_bool(tree, "MASQ_NOSTREAM", ast_test_flag(ast_channel_flags(chan), AST_FLAG_MASQ_NOSTREAM)); + ast_data_add_bool(tree, "BRIDGE_HANGUP_RUN", ast_test_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_RUN)); + ast_data_add_bool(tree, "BRIDGE_HANGUP_DONT", ast_test_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_DONT)); + ast_data_add_bool(tree, "DISABLE_WORKAROUNDS", ast_test_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_WORKAROUNDS)); } int ast_channel_data_add_structure(struct ast_data *tree, @@ -251,12 +399,12 @@ int ast_channel_data_cmp_structure(const struct ast_data_search *tree, #define DEFINE_STRINGFIELD_SETTERS_FOR(field) \ void ast_channel_##field##_set(struct ast_channel *chan, const char *value) \ { \ - ast_string_field_set(chan, __do_not_use_##field, value); \ + ast_string_field_set(chan, field, value); \ } \ \ void ast_channel_##field##_build_va(struct ast_channel *chan, const char *fmt, va_list ap) \ { \ - ast_string_field_build_va(chan, __do_not_use_##field, fmt, ap); \ + ast_string_field_build_va(chan, field, fmt, ap); \ } \ void ast_channel_##field##_build(struct ast_channel *chan, const char *fmt, ...) \ { \ @@ -266,573 +414,571 @@ void ast_channel_##field##_build(struct ast_channel *chan, const char *fmt, ...) va_end(ap); \ } -DEFINE_STRINGFIELD_SETTERS_FOR(name) -DEFINE_STRINGFIELD_SETTERS_FOR(language) -DEFINE_STRINGFIELD_SETTERS_FOR(musicclass) -DEFINE_STRINGFIELD_SETTERS_FOR(accountcode) -DEFINE_STRINGFIELD_SETTERS_FOR(peeraccount) -DEFINE_STRINGFIELD_SETTERS_FOR(userfield) -DEFINE_STRINGFIELD_SETTERS_FOR(call_forward) -DEFINE_STRINGFIELD_SETTERS_FOR(uniqueid) -DEFINE_STRINGFIELD_SETTERS_FOR(linkedid) -DEFINE_STRINGFIELD_SETTERS_FOR(parkinglot) -DEFINE_STRINGFIELD_SETTERS_FOR(hangupsource) -DEFINE_STRINGFIELD_SETTERS_FOR(dialcontext) +DEFINE_STRINGFIELD_SETTERS_FOR(name); +DEFINE_STRINGFIELD_SETTERS_FOR(language); +DEFINE_STRINGFIELD_SETTERS_FOR(musicclass); +DEFINE_STRINGFIELD_SETTERS_FOR(accountcode); +DEFINE_STRINGFIELD_SETTERS_FOR(peeraccount); +DEFINE_STRINGFIELD_SETTERS_FOR(userfield); +DEFINE_STRINGFIELD_SETTERS_FOR(call_forward); +DEFINE_STRINGFIELD_SETTERS_FOR(uniqueid); +DEFINE_STRINGFIELD_SETTERS_FOR(linkedid); +DEFINE_STRINGFIELD_SETTERS_FOR(parkinglot); +DEFINE_STRINGFIELD_SETTERS_FOR(hangupsource); +DEFINE_STRINGFIELD_SETTERS_FOR(dialcontext); #define DEFINE_STRINGFIELD_GETTER_FOR(field) const char *ast_channel_##field(const struct ast_channel *chan) \ { \ - return chan->__do_not_use_##field; \ -} - -DEFINE_STRINGFIELD_GETTER_FOR(name) -DEFINE_STRINGFIELD_GETTER_FOR(language) -DEFINE_STRINGFIELD_GETTER_FOR(musicclass) -DEFINE_STRINGFIELD_GETTER_FOR(accountcode) -DEFINE_STRINGFIELD_GETTER_FOR(peeraccount) -DEFINE_STRINGFIELD_GETTER_FOR(userfield) -DEFINE_STRINGFIELD_GETTER_FOR(call_forward) -DEFINE_STRINGFIELD_GETTER_FOR(uniqueid) -DEFINE_STRINGFIELD_GETTER_FOR(linkedid) -DEFINE_STRINGFIELD_GETTER_FOR(parkinglot) -DEFINE_STRINGFIELD_GETTER_FOR(hangupsource) -DEFINE_STRINGFIELD_GETTER_FOR(dialcontext) + return chan->field; \ +} + +DEFINE_STRINGFIELD_GETTER_FOR(name); +DEFINE_STRINGFIELD_GETTER_FOR(language); +DEFINE_STRINGFIELD_GETTER_FOR(musicclass); +DEFINE_STRINGFIELD_GETTER_FOR(accountcode); +DEFINE_STRINGFIELD_GETTER_FOR(peeraccount); +DEFINE_STRINGFIELD_GETTER_FOR(userfield); +DEFINE_STRINGFIELD_GETTER_FOR(call_forward); +DEFINE_STRINGFIELD_GETTER_FOR(uniqueid); +DEFINE_STRINGFIELD_GETTER_FOR(linkedid); +DEFINE_STRINGFIELD_GETTER_FOR(parkinglot); +DEFINE_STRINGFIELD_GETTER_FOR(hangupsource); +DEFINE_STRINGFIELD_GETTER_FOR(dialcontext); const char *ast_channel_appl(const struct ast_channel *chan) { - return chan->__do_not_use_appl; + return chan->appl; } void ast_channel_appl_set(struct ast_channel *chan, const char *value) { - chan->__do_not_use_appl = value; + chan->appl = value; } const char *ast_channel_blockproc(const struct ast_channel *chan) { - return chan->__do_not_use_blockproc; + return chan->blockproc; } void ast_channel_blockproc_set(struct ast_channel *chan, const char *value) { - chan->__do_not_use_blockproc = value; + chan->blockproc = value; } const char *ast_channel_data(const struct ast_channel *chan) { - return chan->__do_not_use_data; + return chan->data; } void ast_channel_data_set(struct ast_channel *chan, const char *value) { - chan->__do_not_use_data = value; + chan->data = value; } - const char *ast_channel_context(const struct ast_channel *chan) { - return chan->__do_not_use_context; + return chan->context; } void ast_channel_context_set(struct ast_channel *chan, const char *value) { - ast_copy_string(chan->__do_not_use_context, value, sizeof(chan->__do_not_use_context)); + ast_copy_string(chan->context, value, sizeof(chan->context)); } const char *ast_channel_exten(const struct ast_channel *chan) { - return chan->__do_not_use_exten; + return chan->exten; } void ast_channel_exten_set(struct ast_channel *chan, const char *value) { - ast_copy_string(chan->__do_not_use_exten, value, sizeof(chan->__do_not_use_exten)); + ast_copy_string(chan->exten, value, sizeof(chan->exten)); } const char *ast_channel_macrocontext(const struct ast_channel *chan) { - return chan->__do_not_use_macrocontext; + return chan->macrocontext; } void ast_channel_macrocontext_set(struct ast_channel *chan, const char *value) { - ast_copy_string(chan->__do_not_use_macrocontext, value, sizeof(chan->__do_not_use_macrocontext)); + ast_copy_string(chan->macrocontext, value, sizeof(chan->macrocontext)); } const char *ast_channel_macroexten(const struct ast_channel *chan) { - return chan->__do_not_use_macroexten; + return chan->macroexten; } void ast_channel_macroexten_set(struct ast_channel *chan, const char *value) { - ast_copy_string(chan->__do_not_use_macroexten, value, sizeof(chan->__do_not_use_macroexten)); + ast_copy_string(chan->macroexten, value, sizeof(chan->macroexten)); } - char ast_channel_dtmf_digit_to_emulate(const struct ast_channel *chan) { - return chan->__do_not_use_dtmf_digit_to_emulate; + return chan->dtmf_digit_to_emulate; } void ast_channel_dtmf_digit_to_emulate_set(struct ast_channel *chan, char value) { - chan->__do_not_use_dtmf_digit_to_emulate = value; + chan->dtmf_digit_to_emulate = value; } int ast_channel_amaflags(const struct ast_channel *chan) { - return chan->__do_not_use_amaflags; + return chan->amaflags; } void ast_channel_amaflags_set(struct ast_channel *chan, int value) { - chan->__do_not_use_amaflags = value; + chan->amaflags = value; } #ifdef HAVE_EPOLL int ast_channel_epfd(const struct ast_channel *chan) { - return chan->__do_not_use_epfd; + return chan->epfd; } void ast_channel_epfd_set(struct ast_channel *chan, int value) { - chan->__do_not_use_epfd = value; + chan->epfd = value; } #endif int ast_channel_fdno(const struct ast_channel *chan) { - return chan->__do_not_use_fdno; + return chan->fdno; } void ast_channel_fdno_set(struct ast_channel *chan, int value) { - chan->__do_not_use_fdno = value; + chan->fdno = value; } int ast_channel_hangupcause(const struct ast_channel *chan) { - return chan->__do_not_use_hangupcause; + return chan->hangupcause; } void ast_channel_hangupcause_set(struct ast_channel *chan, int value) { - chan->__do_not_use_hangupcause = value; + chan->hangupcause = value; } int ast_channel_macropriority(const struct ast_channel *chan) { - return chan->__do_not_use_macropriority; + return chan->macropriority; } void ast_channel_macropriority_set(struct ast_channel *chan, int value) { - chan->__do_not_use_macropriority = value; + chan->macropriority = value; } int ast_channel_priority(const struct ast_channel *chan) { - return chan->__do_not_use_priority; + return chan->priority; } void ast_channel_priority_set(struct ast_channel *chan, int value) { - chan->__do_not_use_priority = value; + chan->priority = value; } int ast_channel_rings(const struct ast_channel *chan) { - return chan->__do_not_use_rings; + return chan->rings; } void ast_channel_rings_set(struct ast_channel *chan, int value) { - chan->__do_not_use_rings = value; + chan->rings = value; } int ast_channel_streamid(const struct ast_channel *chan) { - return chan->__do_not_use_streamid; + return chan->streamid; } void ast_channel_streamid_set(struct ast_channel *chan, int value) { - chan->__do_not_use_streamid = value; + chan->streamid = value; } int ast_channel_timingfd(const struct ast_channel *chan) { - return chan->__do_not_use_timingfd; + return chan->timingfd; } void ast_channel_timingfd_set(struct ast_channel *chan, int value) { - chan->__do_not_use_timingfd = value; + chan->timingfd = value; } int ast_channel_visible_indication(const struct ast_channel *chan) { - return chan->__do_not_use_visible_indication; + return chan->visible_indication; } void ast_channel_visible_indication_set(struct ast_channel *chan, int value) { - chan->__do_not_use_visible_indication = value; + chan->visible_indication = value; } int ast_channel_vstreamid(const struct ast_channel *chan) { - return chan->__do_not_use_vstreamid; + return chan->vstreamid; } void ast_channel_vstreamid_set(struct ast_channel *chan, int value) { - chan->__do_not_use_vstreamid = value; + chan->vstreamid = value; } unsigned short ast_channel_transfercapability(const struct ast_channel *chan) { - return chan->__do_not_use_transfercapability; + return chan->transfercapability; } void ast_channel_transfercapability_set(struct ast_channel *chan, unsigned short value) { - chan->__do_not_use_transfercapability = value; + chan->transfercapability = value; } unsigned int ast_channel_emulate_dtmf_duration(const struct ast_channel *chan) { - return chan->__do_not_use_emulate_dtmf_duration; + return chan->emulate_dtmf_duration; } void ast_channel_emulate_dtmf_duration_set(struct ast_channel *chan, unsigned int value) { - chan->__do_not_use_emulate_dtmf_duration = value; + chan->emulate_dtmf_duration = value; } unsigned int ast_channel_fin(const struct ast_channel *chan) { - return chan->__do_not_use_fin; + return chan->fin; } void ast_channel_fin_set(struct ast_channel *chan, unsigned int value) { - chan->__do_not_use_fin = value; + chan->fin = value; } unsigned int ast_channel_fout(const struct ast_channel *chan) { - return chan->__do_not_use_fout; + return chan->fout; } void ast_channel_fout_set(struct ast_channel *chan, unsigned int value) { - chan->__do_not_use_fout = value; + chan->fout = value; } unsigned long ast_channel_insmpl(const struct ast_channel *chan) { - return chan->__do_not_use_insmpl; + return chan->insmpl; } void ast_channel_insmpl_set(struct ast_channel *chan, unsigned long value) { - chan->__do_not_use_insmpl = value; + chan->insmpl = value; } unsigned long ast_channel_outsmpl(const struct ast_channel *chan) { - return chan->__do_not_use_outsmpl; + return chan->outsmpl; } void ast_channel_outsmpl_set(struct ast_channel *chan, unsigned long value) { - chan->__do_not_use_outsmpl = value; + chan->outsmpl = value; } void *ast_channel_generatordata(const struct ast_channel *chan) { - return chan->__do_not_use_generatordata; + return chan->generatordata; } void ast_channel_generatordata_set(struct ast_channel *chan, void *value) { - chan->__do_not_use_generatordata = value; + chan->generatordata = value; } void *ast_channel_music_state(const struct ast_channel *chan) { - return chan->__do_not_use_music_state; + return chan->music_state; } void ast_channel_music_state_set(struct ast_channel *chan, void *value) { - chan->__do_not_use_music_state = value; + chan->music_state = value; } void *ast_channel_tech_pvt(const struct ast_channel *chan) { - return chan->__do_not_use_tech_pvt; + return chan->tech_pvt; } void ast_channel_tech_pvt_set(struct ast_channel *chan, void *value) { - chan->__do_not_use_tech_pvt = value; + chan->tech_pvt = value; } void *ast_channel_timingdata(const struct ast_channel *chan) { - return chan->__do_not_use_timingdata; + return chan->timingdata; } void ast_channel_timingdata_set(struct ast_channel *chan, void *value) { - chan->__do_not_use_timingdata = value; + chan->timingdata = value; } struct ast_audiohook_list *ast_channel_audiohooks(const struct ast_channel *chan) { - return chan->__do_not_use_audiohooks; + return chan->audiohooks; } void ast_channel_audiohooks_set(struct ast_channel *chan, struct ast_audiohook_list *value) { - chan->__do_not_use_audiohooks = value; + chan->audiohooks = value; } struct ast_cdr *ast_channel_cdr(const struct ast_channel *chan) { - return chan->__do_not_use_cdr; + return chan->cdr; } void ast_channel_cdr_set(struct ast_channel *chan, struct ast_cdr *value) { - chan->__do_not_use_cdr = value; + chan->cdr = value; } struct ast_channel *ast_channel_masq(const struct ast_channel *chan) { - return chan->__do_not_use_masq; + return chan->masq; } void ast_channel_masq_set(struct ast_channel *chan, struct ast_channel *value) { - chan->__do_not_use_masq = value; + chan->masq = value; } struct ast_channel *ast_channel_masqr(const struct ast_channel *chan) { - return chan->__do_not_use_masqr; + return chan->masqr; } void ast_channel_masqr_set(struct ast_channel *chan, struct ast_channel *value) { - chan->__do_not_use_masqr = value; + chan->masqr = value; } struct ast_channel_monitor *ast_channel_monitor(const struct ast_channel *chan) { - return chan->__do_not_use_monitor; + return chan->monitor; } void ast_channel_monitor_set(struct ast_channel *chan, struct ast_channel_monitor *value) { - chan->__do_not_use_monitor = value; + chan->monitor = value; } struct ast_filestream *ast_channel_stream(const struct ast_channel *chan) { - return chan->__do_not_use_stream; + return chan->stream; } void ast_channel_stream_set(struct ast_channel *chan, struct ast_filestream *value) { - chan->__do_not_use_stream = value; + chan->stream = value; } struct ast_filestream *ast_channel_vstream(const struct ast_channel *chan) { - return chan->__do_not_use_vstream; + return chan->vstream; } void ast_channel_vstream_set(struct ast_channel *chan, struct ast_filestream *value) { - chan->__do_not_use_vstream = value; + chan->vstream = value; } struct ast_format_cap *ast_channel_nativeformats(const struct ast_channel *chan) { - return chan->__do_not_use_nativeformats; + return chan->nativeformats; } void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value) { - chan->__do_not_use_nativeformats = value; + chan->nativeformats = value; } struct ast_framehook_list *ast_channel_framehooks(const struct ast_channel *chan) { - return chan->__do_not_use_framehooks; + return chan->framehooks; } void ast_channel_framehooks_set(struct ast_channel *chan, struct ast_framehook_list *value) { - chan->__do_not_use_framehooks = value; + chan->framehooks = value; } struct ast_generator *ast_channel_generator(const struct ast_channel *chan) { - return chan->__do_not_use_generator; + return chan->generator; } void ast_channel_generator_set(struct ast_channel *chan, struct ast_generator *value) { - chan->__do_not_use_generator = value; + chan->generator = value; } struct ast_pbx *ast_channel_pbx(const struct ast_channel *chan) { - return chan->__do_not_use_pbx; + return chan->pbx; } void ast_channel_pbx_set(struct ast_channel *chan, struct ast_pbx *value) { - chan->__do_not_use_pbx = value; + chan->pbx = value; } struct ast_sched_context *ast_channel_sched(const struct ast_channel *chan) { - return chan->__do_not_use_sched; + return chan->sched; } void ast_channel_sched_set(struct ast_channel *chan, struct ast_sched_context *value) { - chan->__do_not_use_sched = value; + chan->sched = value; } struct ast_timer *ast_channel_timer(const struct ast_channel *chan) { - return chan->__do_not_use_timer; + return chan->timer; } void ast_channel_timer_set(struct ast_channel *chan, struct ast_timer *value) { - chan->__do_not_use_timer = value; + chan->timer = value; } struct ast_tone_zone *ast_channel_zone(const struct ast_channel *chan) { - return chan->__do_not_use_zone; + return chan->zone; } void ast_channel_zone_set(struct ast_channel *chan, struct ast_tone_zone *value) { - chan->__do_not_use_zone = value; + chan->zone = value; } struct ast_trans_pvt *ast_channel_readtrans(const struct ast_channel *chan) { - return chan->__do_not_use_readtrans; + return chan->readtrans; } void ast_channel_readtrans_set(struct ast_channel *chan, struct ast_trans_pvt *value) { - chan->__do_not_use_readtrans = value; + chan->readtrans = value; } struct ast_trans_pvt *ast_channel_writetrans(const struct ast_channel *chan) { - return chan->__do_not_use_writetrans; + return chan->writetrans; } void ast_channel_writetrans_set(struct ast_channel *chan, struct ast_trans_pvt *value) { - chan->__do_not_use_writetrans = value; + chan->writetrans = value; } const struct ast_channel_tech *ast_channel_tech(const struct ast_channel *chan) { - return chan->__do_not_use_tech; + return chan->tech; } void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value) { - chan->__do_not_use_tech = value; + chan->tech = value; } enum ast_channel_adsicpe ast_channel_adsicpe(const struct ast_channel *chan) { - return chan->__do_not_use_adsicpe; + return chan->adsicpe; } void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value) { - chan->__do_not_use_adsicpe = value; + chan->adsicpe = value; } enum ast_channel_state ast_channel_state(const struct ast_channel *chan) { - return chan->__do_not_use_state; + return chan->state; } void ast_channel_state_set(struct ast_channel *chan, enum ast_channel_state value) { - chan->__do_not_use_state = value; + chan->state = value; } struct ast_format *ast_channel_oldwriteformat(struct ast_channel *chan) { - return &chan->__do_not_use_oldwriteformat; + return &chan->oldwriteformat; } struct ast_format *ast_channel_rawreadformat(struct ast_channel *chan) { - return &chan->__do_not_use_rawreadformat; + return &chan->rawreadformat; } struct ast_format *ast_channel_rawwriteformat(struct ast_channel *chan) { - return &chan->__do_not_use_rawwriteformat; + return &chan->rawwriteformat; } struct ast_format *ast_channel_readformat(struct ast_channel *chan) { - return &chan->__do_not_use_readformat; + return &chan->readformat; } struct ast_format *ast_channel_writeformat(struct ast_channel *chan) { - return &chan->__do_not_use_writeformat; + return &chan->writeformat; } struct ast_datastore_list *ast_channel_datastores(struct ast_channel *chan) { - return &chan->__do_not_use_datastores; + return &chan->datastores; } struct ast_autochan_list *ast_channel_autochans(struct ast_channel *chan) { - return &chan->__do_not_use_autochans; + return &chan->autochans; } struct ast_readq_list *ast_channel_readq(struct ast_channel *chan) { - return &chan->__do_not_use_readq; + return &chan->readq; } struct ast_frame *ast_channel_dtmff(struct ast_channel *chan) { - return &chan->__do_not_use_dtmff; + return &chan->dtmff; } struct ast_jb *ast_channel_jb(struct ast_channel *chan) { - return &chan->__do_not_use_jb; + return &chan->jb; } struct ast_party_caller *ast_channel_caller(struct ast_channel *chan) { - return &chan->__do_not_use_caller; + return &chan->caller; } struct ast_party_connected_line *ast_channel_connected(struct ast_channel *chan) { - return &chan->__do_not_use_connected; + return &chan->connected; } struct ast_party_dialed *ast_channel_dialed(struct ast_channel *chan) { - return &chan->__do_not_use_dialed; + return &chan->dialed; } struct ast_party_redirecting *ast_channel_redirecting(struct ast_channel *chan) { - return &chan->__do_not_use_redirecting; + return &chan->redirecting; } struct timeval *ast_channel_dtmf_tv(struct ast_channel *chan) { - return &chan->__do_not_use_dtmf_tv; + return &chan->dtmf_tv; } struct timeval *ast_channel_whentohangup(struct ast_channel *chan) { - return &chan->__do_not_use_whentohangup; + return &chan->whentohangup; } struct varshead *ast_channel_varshead(struct ast_channel *chan) { - return &chan->__do_not_use_varshead; + return &chan->varshead; } void ast_channel_dtmff_set(struct ast_channel *chan, struct ast_frame *value) { - memcpy(&chan->__do_not_use_dtmff, value, sizeof(chan->__do_not_use_dtmff)); + chan->dtmff = *value; } void ast_channel_jb_set(struct ast_channel *chan, struct ast_jb *value) { - memcpy(&chan->__do_not_use_jb, value, sizeof(chan->__do_not_use_jb)); + chan->jb = *value; } void ast_channel_caller_set(struct ast_channel *chan, struct ast_party_caller *value) { - memcpy(&chan->__do_not_use_caller, value, sizeof(chan->__do_not_use_caller)); + chan->caller = *value; } void ast_channel_connected_set(struct ast_channel *chan, struct ast_party_connected_line *value) { - memcpy(&chan->__do_not_use_connected, value, sizeof(chan->__do_not_use_connected)); + chan->connected = *value; } void ast_channel_dialed_set(struct ast_channel *chan, struct ast_party_dialed *value) { - memcpy(&chan->__do_not_use_dialed, value, sizeof(chan->__do_not_use_dialed)); + chan->dialed = *value; } void ast_channel_redirecting_set(struct ast_channel *chan, struct ast_party_redirecting *value) { - memcpy(&chan->__do_not_use_redirecting, value, sizeof(chan->__do_not_use_redirecting)); + chan->redirecting = *value; } void ast_channel_dtmf_tv_set(struct ast_channel *chan, struct timeval *value) { - memcpy(&chan->__do_not_use_dtmf_tv, value, sizeof(chan->__do_not_use_dtmf_tv)); + chan->dtmf_tv = *value; } void ast_channel_whentohangup_set(struct ast_channel *chan, struct timeval *value) { - memcpy(&chan->__do_not_use_whentohangup, value, sizeof(chan->__do_not_use_whentohangup)); + chan->whentohangup = *value; } void ast_channel_varshead_set(struct ast_channel *chan, struct varshead *value) { - memcpy(&chan->__do_not_use_varshead, value, sizeof(chan->__do_not_use_varshead)); + chan->varshead = *value; } /* Evil softhangup accessors */ -int ast_channel_softhangup_internal_flag(struct ast_channel * chan) +int ast_channel_softhangup_internal_flag(struct ast_channel *chan) { - return chan->__do_not_use_softhangup; + return chan->softhangup; } void ast_channel_softhangup_internal_flag_set(struct ast_channel *chan, int value) { - chan->__do_not_use_softhangup = value; + chan->softhangup = value; } void ast_channel_softhangup_internal_flag_add(struct ast_channel *chan, int value) { - chan->__do_not_use_softhangup |= value; + chan->softhangup |= value; } void ast_channel_softhangup_internal_flag_clear(struct ast_channel *chan, int value) { - chan ->__do_not_use_softhangup &= ~value; + chan ->softhangup &= ~value; } /* Typedef accessors */ ast_group_t ast_channel_callgroup(const struct ast_channel *chan) { - return chan->__do_not_use_callgroup; + return chan->callgroup; } void ast_channel_callgroup_set(struct ast_channel *chan, ast_group_t value) { - chan->__do_not_use_callgroup = value; + chan->callgroup = value; } ast_group_t ast_channel_pickupgroup(const struct ast_channel *chan) { - return chan->__do_not_use_pickupgroup; + return chan->pickupgroup; } void ast_channel_pickupgroup_set(struct ast_channel *chan, ast_group_t value) { - chan->__do_not_use_pickupgroup = value; + chan->pickupgroup = value; } /* Alertpipe functions */ int ast_channel_alert_write(struct ast_channel *chan) { char blah = 0x7F; - return ast_channel_alert_writable(chan) && write(chan->__do_not_use_alertpipe[1], &blah, sizeof(blah)) != sizeof(blah); + return ast_channel_alert_writable(chan) && write(chan->alertpipe[1], &blah, sizeof(blah)) != sizeof(blah); } ast_alert_status_t ast_channel_internal_alert_read(struct ast_channel *chan) @@ -844,17 +990,17 @@ ast_alert_status_t ast_channel_internal_alert_read(struct ast_channel *chan) return AST_ALERT_NOT_READABLE; } - flags = fcntl(chan->__do_not_use_alertpipe[0], F_GETFL); + flags = fcntl(chan->alertpipe[0], F_GETFL); /* For some odd reason, the alertpipe occasionally loses nonblocking status, * which immediately causes a deadlock scenario. Detect and prevent this. */ if ((flags & O_NONBLOCK) == 0) { ast_log(LOG_ERROR, "Alertpipe on channel %s lost O_NONBLOCK?!!\n", ast_channel_name(chan)); - if (fcntl(chan->__do_not_use_alertpipe[0], F_SETFL, flags | O_NONBLOCK) < 0) { + if (fcntl(chan->alertpipe[0], F_SETFL, flags | O_NONBLOCK) < 0) { ast_log(LOG_WARNING, "Unable to set alertpipe nonblocking! (%d: %s)\n", errno, strerror(errno)); return AST_ALERT_READ_FATAL; } } - if (read(chan->__do_not_use_alertpipe[0], &blah, sizeof(blah)) < 0) { + if (read(chan->alertpipe[0], &blah, sizeof(blah)) < 0) { if (errno != EINTR && errno != EAGAIN) { ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno)); return AST_ALERT_READ_FAIL; @@ -866,42 +1012,42 @@ ast_alert_status_t ast_channel_internal_alert_read(struct ast_channel *chan) int ast_channel_alert_writable(struct ast_channel *chan) { - return chan->__do_not_use_alertpipe[1] > -1; + return chan->alertpipe[1] > -1; } int ast_channel_internal_alert_readable(struct ast_channel *chan) { - return chan->__do_not_use_alertpipe[0] > -1; + return chan->alertpipe[0] > -1; } void ast_channel_internal_alertpipe_clear(struct ast_channel *chan) { - chan->__do_not_use_alertpipe[0] = chan->__do_not_use_alertpipe[1] = -1; + chan->alertpipe[0] = chan->alertpipe[1] = -1; } void ast_channel_internal_alertpipe_close(struct ast_channel *chan) { if (ast_channel_internal_alert_readable(chan)) { - close(chan->__do_not_use_alertpipe[0]); + close(chan->alertpipe[0]); } if (ast_channel_alert_writable(chan)) { - close(chan->__do_not_use_alertpipe[1]); + close(chan->alertpipe[1]); } } int ast_channel_internal_alertpipe_init(struct ast_channel *chan) { - if (pipe(chan->__do_not_use_alertpipe)) { + if (pipe(chan->alertpipe)) { ast_log(LOG_WARNING, "Channel allocation failed: Can't create alert pipe! Try increasing max file descriptors with ulimit -n\n"); return -1; } else { - int flags = fcntl(chan->__do_not_use_alertpipe[0], F_GETFL); - if (fcntl(chan->__do_not_use_alertpipe[0], F_SETFL, flags | O_NONBLOCK) < 0) { + int flags = fcntl(chan->alertpipe[0], F_GETFL); + if (fcntl(chan->alertpipe[0], F_SETFL, flags | O_NONBLOCK) < 0) { ast_log(LOG_WARNING, "Channel allocation failed: Unable to set alertpipe nonblocking! (%d: %s)\n", errno, strerror(errno)); return -1; } - flags = fcntl(chan->__do_not_use_alertpipe[1], F_GETFL); - if (fcntl(chan->__do_not_use_alertpipe[1], F_SETFL, flags | O_NONBLOCK) < 0) { + flags = fcntl(chan->alertpipe[1], F_GETFL); + if (fcntl(chan->alertpipe[1], F_SETFL, flags | O_NONBLOCK) < 0) { ast_log(LOG_WARNING, "Channel allocation failed: Unable to set alertpipe nonblocking! (%d: %s)\n", errno, strerror(errno)); return -1; } @@ -911,21 +1057,21 @@ int ast_channel_internal_alertpipe_init(struct ast_channel *chan) int ast_channel_internal_alert_readfd(struct ast_channel *chan) { - return chan->__do_not_use_alertpipe[0]; + return chan->alertpipe[0]; } void ast_channel_internal_alertpipe_swap(struct ast_channel *chan1, struct ast_channel *chan2) { int i; - for (i = 0; i < ARRAY_LEN(chan1->__do_not_use_alertpipe); i++) { - SWAP(chan1->__do_not_use_alertpipe[i], chan2->__do_not_use_alertpipe[i]); + for (i = 0; i < ARRAY_LEN(chan1->alertpipe); i++) { + SWAP(chan1->alertpipe[i], chan2->alertpipe[i]); } } /* file descriptor array accessors */ void ast_channel_internal_fd_set(struct ast_channel *chan, int which, int value) { - chan->__do_not_use_fds[which] = value; + chan->fds[which] = value; } void ast_channel_internal_fd_clear(struct ast_channel *chan, int which) { @@ -940,7 +1086,7 @@ void ast_channel_internal_fd_clear_all(struct ast_channel *chan) } int ast_channel_fd(const struct ast_channel *chan, int which) { - return chan->__do_not_use_fds[which]; + return chan->fds[which]; } int ast_channel_fd_isset(const struct ast_channel *chan, int which) { @@ -950,10 +1096,86 @@ int ast_channel_fd_isset(const struct ast_channel *chan, int which) #ifdef HAVE_EPOLL struct ast_epoll_data *ast_channel_internal_epfd_data(const struct ast_channel *chan, int which) { - return chan->__do_not_use_epfd_data[which]; + return chan->epfd_data[which]; } void ast_channel_internal_epfd_data_set(struct ast_channel *chan, int which , struct ast_epoll_data *value) { - chan->__do_not_use_epfd_data[which] = value; + chan->epfd_data[which] = value; } #endif + +pthread_t ast_channel_blocker(const struct ast_channel *chan) +{ + return chan->blocker; +} +void ast_channel_blocker_set(struct ast_channel *chan, pthread_t value) +{ + chan->blocker = value; +} + +ast_timing_func_t ast_channel_timingfunc(const struct ast_channel *chan) +{ + return chan->timingfunc; +} +void ast_channel_timingfunc_set(struct ast_channel *chan, ast_timing_func_t value) +{ + chan->timingfunc = value; +} + +struct ast_bridge *ast_channel_internal_bridge(const struct ast_channel *chan) +{ + return chan->bridge; +} +void ast_channel_internal_bridge_set(struct ast_channel *chan, struct ast_bridge *value) +{ + chan->bridge = value; +} + +struct ast_channel *ast_channel_internal_bridged_channel(const struct ast_channel *chan) +{ + return chan->bridged_channel; +} +void ast_channel_internal_bridged_channel_set(struct ast_channel *chan, struct ast_channel *value) +{ + chan->bridged_channel = value; +} + +struct ast_flags *ast_channel_flags(struct ast_channel *chan) +{ + return &chan->flags; +} + +struct ast_channel *__ast_channel_internal_alloc(void (*destructor)(void *obj), const char *file, int line, const char *function) +{ + struct ast_channel *tmp; +#if defined(REF_DEBUG) + tmp = __ao2_alloc_debug(sizeof(*tmp), destructor, + AO2_ALLOC_OPT_LOCK_MUTEX, "", file, line, function, 1); +#elif defined(__AST_DEBUG_MALLOC) + tmp = __ao2_alloc_debug(sizeof(*tmp), destructor, + AO2_ALLOC_OPT_LOCK_MUTEX, "", file, line, function, 0); +#else + tmp = ao2_alloc(sizeof(*tmp), destructor); +#endif + + if ((ast_string_field_init(tmp, 128))) { + return ast_channel_unref(tmp); + } + + return tmp; +} + +void ast_channel_internal_cleanup(struct ast_channel *chan) +{ + ast_string_field_free_memory(chan); +} + +void ast_channel_internal_finalize(struct ast_channel *chan) +{ + chan->finalized = 1; +} + +int ast_channel_internal_is_finalized(struct ast_channel *chan) +{ + return chan->finalized; +} -- cgit v1.2.3