Opaquification for ast_format structs in struct ast_channel
[asterisk/asterisk.git] / main / channel_internal_api.c
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2012, Digium, Inc.
5  *
6  * Mark Spencer <markster@digium.com>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  */
18
19 /*! \file
20  *
21  * \brief Channel Accessor API
22  *
23  * This file is intended to be the only file that ever accesses the
24  * internals of an ast_channel. All other files should use the
25  * accessor functions defined here.
26  *
27  * \author Terry Wilson
28  */
29
30 #include "asterisk.h"
31
32 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
33
34 #include "asterisk/channel.h"
35 #include "asterisk/stringfields.h"
36 #include "asterisk/data.h"
37 #include "asterisk/indications.h"
38
39 /* AST_DATA definitions, which will probably have to be re-thought since the channel will be opaque */
40
41 #if 0   /* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */
42 #define DATA_EXPORT_CALLERID(MEMBER)                            \
43         MEMBER(ast_callerid, cid_dnid, AST_DATA_STRING)         \
44         MEMBER(ast_callerid, cid_num, AST_DATA_STRING)          \
45         MEMBER(ast_callerid, cid_name, AST_DATA_STRING)         \
46         MEMBER(ast_callerid, cid_ani, AST_DATA_STRING)          \
47         MEMBER(ast_callerid, cid_pres, AST_DATA_INTEGER)        \
48         MEMBER(ast_callerid, cid_ani2, AST_DATA_INTEGER)        \
49         MEMBER(ast_callerid, cid_tag, AST_DATA_STRING)
50
51 AST_DATA_STRUCTURE(ast_callerid, DATA_EXPORT_CALLERID);
52 #endif
53
54 #define DATA_EXPORT_CHANNEL(MEMBER)                                             \
55         MEMBER(ast_channel, __do_not_use_blockproc, AST_DATA_STRING)                            \
56         MEMBER(ast_channel, __do_not_use_appl, AST_DATA_STRING)                         \
57         MEMBER(ast_channel, __do_not_use_data, AST_DATA_STRING)                         \
58         MEMBER(ast_channel, __do_not_use_name, AST_DATA_STRING) \
59         MEMBER(ast_channel, __do_not_use_language, AST_DATA_STRING)                             \
60         MEMBER(ast_channel, __do_not_use_musicclass, AST_DATA_STRING)                   \
61         MEMBER(ast_channel, __do_not_use_accountcode, AST_DATA_STRING)                  \
62         MEMBER(ast_channel, __do_not_use_peeraccount, AST_DATA_STRING)                  \
63         MEMBER(ast_channel, __do_not_use_userfield, AST_DATA_STRING)                            \
64         MEMBER(ast_channel, __do_not_use_call_forward, AST_DATA_STRING)                 \
65         MEMBER(ast_channel, __do_not_use_uniqueid, AST_DATA_STRING)                             \
66         MEMBER(ast_channel, __do_not_use_linkedid, AST_DATA_STRING)                             \
67         MEMBER(ast_channel, __do_not_use_parkinglot, AST_DATA_STRING)                   \
68         MEMBER(ast_channel, __do_not_use_hangupsource, AST_DATA_STRING)                 \
69         MEMBER(ast_channel, __do_not_use_dialcontext, AST_DATA_STRING)                  \
70         MEMBER(ast_channel, __do_not_use_rings, AST_DATA_INTEGER)                               \
71         MEMBER(ast_channel, __do_not_use_priority, AST_DATA_INTEGER)                            \
72         MEMBER(ast_channel, __do_not_use_macropriority, AST_DATA_INTEGER)                       \
73         MEMBER(ast_channel, __do_not_use_adsicpe, AST_DATA_INTEGER)                             \
74         MEMBER(ast_channel, __do_not_use_fin, AST_DATA_UNSIGNED_INTEGER)                        \
75         MEMBER(ast_channel, __do_not_use_fout, AST_DATA_UNSIGNED_INTEGER)                       \
76         MEMBER(ast_channel, __do_not_use_emulate_dtmf_duration, AST_DATA_UNSIGNED_INTEGER)      \
77         MEMBER(ast_channel, __do_not_use_visible_indication, AST_DATA_INTEGER)          \
78         MEMBER(ast_channel, __do_not_use_context, AST_DATA_STRING)                              \
79         MEMBER(ast_channel, __do_not_use_exten, AST_DATA_STRING)                                \
80         MEMBER(ast_channel, __do_not_use_macrocontext, AST_DATA_STRING)                 \
81         MEMBER(ast_channel, __do_not_use_macroexten, AST_DATA_STRING)
82
83 AST_DATA_STRUCTURE(ast_channel, DATA_EXPORT_CHANNEL);
84
85 static void channel_data_add_flags(struct ast_data *tree,
86         struct ast_channel *chan)
87 {
88         ast_data_add_bool(tree, "DEFER_DTMF", ast_test_flag(chan, AST_FLAG_DEFER_DTMF));
89         ast_data_add_bool(tree, "WRITE_INT", ast_test_flag(chan, AST_FLAG_WRITE_INT));
90         ast_data_add_bool(tree, "BLOCKING", ast_test_flag(chan, AST_FLAG_BLOCKING));
91         ast_data_add_bool(tree, "ZOMBIE", ast_test_flag(chan, AST_FLAG_ZOMBIE));
92         ast_data_add_bool(tree, "EXCEPTION", ast_test_flag(chan, AST_FLAG_EXCEPTION));
93         ast_data_add_bool(tree, "MOH", ast_test_flag(chan, AST_FLAG_MOH));
94         ast_data_add_bool(tree, "SPYING", ast_test_flag(chan, AST_FLAG_SPYING));
95         ast_data_add_bool(tree, "NBRIDGE", ast_test_flag(chan, AST_FLAG_NBRIDGE));
96         ast_data_add_bool(tree, "IN_AUTOLOOP", ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP));
97         ast_data_add_bool(tree, "OUTGOING", ast_test_flag(chan, AST_FLAG_OUTGOING));
98         ast_data_add_bool(tree, "IN_DTMF", ast_test_flag(chan, AST_FLAG_IN_DTMF));
99         ast_data_add_bool(tree, "EMULATE_DTMF", ast_test_flag(chan, AST_FLAG_EMULATE_DTMF));
100         ast_data_add_bool(tree, "END_DTMF_ONLY", ast_test_flag(chan, AST_FLAG_END_DTMF_ONLY));
101         ast_data_add_bool(tree, "ANSWERED_ELSEWHERE", ast_test_flag(chan, AST_FLAG_ANSWERED_ELSEWHERE));
102         ast_data_add_bool(tree, "MASQ_NOSTREAM", ast_test_flag(chan, AST_FLAG_MASQ_NOSTREAM));
103         ast_data_add_bool(tree, "BRIDGE_HANGUP_RUN", ast_test_flag(chan, AST_FLAG_BRIDGE_HANGUP_RUN));
104         ast_data_add_bool(tree, "BRIDGE_HANGUP_DONT", ast_test_flag(chan, AST_FLAG_BRIDGE_HANGUP_DONT));
105         ast_data_add_bool(tree, "DISABLE_WORKAROUNDS", ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS));
106 }
107
108 int ast_channel_data_add_structure(struct ast_data *tree,
109         struct ast_channel *chan, int add_bridged)
110 {
111         struct ast_channel *bc;
112         struct ast_data *data_bridged;
113         struct ast_data *data_cdr;
114         struct ast_data *data_flags;
115         struct ast_data *data_zones;
116         struct ast_data *enum_node;
117         struct ast_data *data_softhangup;
118 #if 0   /* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */
119         struct ast_data *data_callerid;
120         char value_str[100];
121 #endif
122
123         if (!tree) {
124                 return -1;
125         }
126
127         ast_data_add_structure(ast_channel, tree, chan);
128
129         if (add_bridged) {
130                 bc = ast_bridged_channel(chan);
131                 if (bc) {
132                         data_bridged = ast_data_add_node(tree, "bridged");
133                         if (!data_bridged) {
134                                 return -1;
135                         }
136                         ast_channel_data_add_structure(data_bridged, bc, 0);
137                 }
138         }
139
140         ast_data_add_codec(tree, "oldwriteformat", ast_channel_oldwriteformat(chan));
141         ast_data_add_codec(tree, "readformat", ast_channel_readformat(chan));
142         ast_data_add_codec(tree, "writeformat", ast_channel_writeformat(chan));
143         ast_data_add_codec(tree, "rawreadformat", ast_channel_rawreadformat(chan));
144         ast_data_add_codec(tree, "rawwriteformat", ast_channel_rawwriteformat(chan));
145         ast_data_add_codecs(tree, "nativeformats", ast_channel_nativeformats(chan));
146
147         /* state */
148         enum_node = ast_data_add_node(tree, "state");
149         if (!enum_node) {
150                 return -1;
151         }
152         ast_data_add_str(enum_node, "text", ast_state2str(ast_channel_state(chan)));
153         ast_data_add_int(enum_node, "value", ast_channel_state(chan));
154
155         /* hangupcause */
156         enum_node = ast_data_add_node(tree, "hangupcause");
157         if (!enum_node) {
158                 return -1;
159         }
160         ast_data_add_str(enum_node, "text", ast_cause2str(ast_channel_hangupcause(chan)));
161         ast_data_add_int(enum_node, "value", ast_channel_hangupcause(chan));
162
163         /* amaflags */
164         enum_node = ast_data_add_node(tree, "amaflags");
165         if (!enum_node) {
166                 return -1;
167         }
168         ast_data_add_str(enum_node, "text", ast_cdr_flags2str(ast_channel_amaflags(chan)));
169         ast_data_add_int(enum_node, "value", ast_channel_amaflags(chan));
170
171         /* transfercapability */
172         enum_node = ast_data_add_node(tree, "transfercapability");
173         if (!enum_node) {
174                 return -1;
175         }
176         ast_data_add_str(enum_node, "text", ast_transfercapability2str(ast_channel_transfercapability(chan)));
177         ast_data_add_int(enum_node, "value", ast_channel_transfercapability(chan));
178
179         /* _softphangup */
180         data_softhangup = ast_data_add_node(tree, "softhangup");
181         if (!data_softhangup) {
182                 return -1;
183         }
184         ast_data_add_bool(data_softhangup, "dev", chan->_softhangup & AST_SOFTHANGUP_DEV);
185         ast_data_add_bool(data_softhangup, "asyncgoto", chan->_softhangup & AST_SOFTHANGUP_ASYNCGOTO);
186         ast_data_add_bool(data_softhangup, "shutdown", chan->_softhangup & AST_SOFTHANGUP_SHUTDOWN);
187         ast_data_add_bool(data_softhangup, "timeout", chan->_softhangup & AST_SOFTHANGUP_TIMEOUT);
188         ast_data_add_bool(data_softhangup, "appunload", chan->_softhangup & AST_SOFTHANGUP_APPUNLOAD);
189         ast_data_add_bool(data_softhangup, "explicit", chan->_softhangup & AST_SOFTHANGUP_EXPLICIT);
190         ast_data_add_bool(data_softhangup, "unbridge", chan->_softhangup & AST_SOFTHANGUP_UNBRIDGE);
191
192         /* channel flags */
193         data_flags = ast_data_add_node(tree, "flags");
194         if (!data_flags) {
195                 return -1;
196         }
197         channel_data_add_flags(data_flags, chan);
198
199         ast_data_add_uint(tree, "timetohangup", chan->whentohangup.tv_sec);
200
201 #if 0   /* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */
202         /* callerid */
203         data_callerid = ast_data_add_node(tree, "callerid");
204         if (!data_callerid) {
205                 return -1;
206         }
207         ast_data_add_structure(ast_callerid, data_callerid, &(chan->cid));
208         /* insert the callerid ton */
209         enum_node = ast_data_add_node(data_callerid, "cid_ton");
210         if (!enum_node) {
211                 return -1;
212         }
213         ast_data_add_int(enum_node, "value", chan->cid.cid_ton);
214         snprintf(value_str, sizeof(value_str), "TON: %s/Plan: %s",
215                 party_number_ton2str(chan->cid.cid_ton),
216                 party_number_plan2str(chan->cid.cid_ton));
217         ast_data_add_str(enum_node, "text", value_str);
218 #endif
219
220         /* tone zone */
221         if (ast_channel_zone(chan)) {
222                 data_zones = ast_data_add_node(tree, "zone");
223                 if (!data_zones) {
224                         return -1;
225                 }
226                 ast_tone_zone_data_add_structure(data_zones, ast_channel_zone(chan));
227         }
228
229         /* insert cdr */
230         data_cdr = ast_data_add_node(tree, "cdr");
231         if (!data_cdr) {
232                 return -1;
233         }
234
235         ast_cdr_data_add_structure(data_cdr, ast_channel_cdr(chan), 1);
236
237         return 0;
238 }
239
240 int ast_channel_data_cmp_structure(const struct ast_data_search *tree,
241         struct ast_channel *chan, const char *structure_name)
242 {
243         return ast_data_search_cmp_structure(tree, ast_channel, chan, structure_name);
244 }
245
246 /* ACCESSORS */
247
248 #define DEFINE_STRINGFIELD_SETTERS_FOR(field) \
249 void ast_channel_##field##_set(struct ast_channel *chan, const char *value) \
250 { \
251         ast_string_field_set(chan, __do_not_use_##field, value); \
252 } \
253   \
254 void ast_channel_##field##_build_va(struct ast_channel *chan, const char *fmt, va_list ap) \
255 { \
256         ast_string_field_build_va(chan, __do_not_use_##field, fmt, ap); \
257 } \
258 void ast_channel_##field##_build(struct ast_channel *chan, const char *fmt, ...) \
259 { \
260         va_list ap; \
261         va_start(ap, fmt); \
262         ast_channel_##field##_build_va(chan, fmt, ap); \
263         va_end(ap); \
264 }
265
266 DEFINE_STRINGFIELD_SETTERS_FOR(name)
267 DEFINE_STRINGFIELD_SETTERS_FOR(language)
268 DEFINE_STRINGFIELD_SETTERS_FOR(musicclass)
269 DEFINE_STRINGFIELD_SETTERS_FOR(accountcode)
270 DEFINE_STRINGFIELD_SETTERS_FOR(peeraccount)
271 DEFINE_STRINGFIELD_SETTERS_FOR(userfield)
272 DEFINE_STRINGFIELD_SETTERS_FOR(call_forward)
273 DEFINE_STRINGFIELD_SETTERS_FOR(uniqueid)
274 DEFINE_STRINGFIELD_SETTERS_FOR(linkedid)
275 DEFINE_STRINGFIELD_SETTERS_FOR(parkinglot)
276 DEFINE_STRINGFIELD_SETTERS_FOR(hangupsource)
277 DEFINE_STRINGFIELD_SETTERS_FOR(dialcontext)
278
279 #define DEFINE_STRINGFIELD_GETTER_FOR(field) const char *ast_channel_##field(const struct ast_channel *chan) \
280 { \
281         return chan->__do_not_use_##field; \
282 }
283
284 DEFINE_STRINGFIELD_GETTER_FOR(name)
285 DEFINE_STRINGFIELD_GETTER_FOR(language)
286 DEFINE_STRINGFIELD_GETTER_FOR(musicclass)
287 DEFINE_STRINGFIELD_GETTER_FOR(accountcode)
288 DEFINE_STRINGFIELD_GETTER_FOR(peeraccount)
289 DEFINE_STRINGFIELD_GETTER_FOR(userfield)
290 DEFINE_STRINGFIELD_GETTER_FOR(call_forward)
291 DEFINE_STRINGFIELD_GETTER_FOR(uniqueid)
292 DEFINE_STRINGFIELD_GETTER_FOR(linkedid)
293 DEFINE_STRINGFIELD_GETTER_FOR(parkinglot)
294 DEFINE_STRINGFIELD_GETTER_FOR(hangupsource)
295 DEFINE_STRINGFIELD_GETTER_FOR(dialcontext)
296
297 const char *ast_channel_appl(const struct ast_channel *chan)
298 {
299         return chan->__do_not_use_appl;
300 }
301 void ast_channel_appl_set(struct ast_channel *chan, const char *value)
302 {
303         chan->__do_not_use_appl = value;
304 }
305 const char *ast_channel_blockproc(const struct ast_channel *chan)
306 {
307         return chan->__do_not_use_blockproc;
308 }
309 void ast_channel_blockproc_set(struct ast_channel *chan, const char *value)
310 {
311         chan->__do_not_use_blockproc = value;
312 }
313 const char *ast_channel_data(const struct ast_channel *chan)
314 {
315         return chan->__do_not_use_data;
316 }
317 void ast_channel_data_set(struct ast_channel *chan, const char *value)
318 {
319         chan->__do_not_use_data = value;
320 }
321
322
323 const char *ast_channel_context(const struct ast_channel *chan)
324 {
325         return chan->__do_not_use_context;
326 }
327 void ast_channel_context_set(struct ast_channel *chan, const char *value)
328 {
329         ast_copy_string(chan->__do_not_use_context, value, sizeof(chan->__do_not_use_context));
330 }
331 const char *ast_channel_exten(const struct ast_channel *chan)
332 {
333         return chan->__do_not_use_exten;
334 }
335 void ast_channel_exten_set(struct ast_channel *chan, const char *value)
336 {
337         ast_copy_string(chan->__do_not_use_exten, value, sizeof(chan->__do_not_use_exten));
338 }
339 const char *ast_channel_macrocontext(const struct ast_channel *chan)
340 {
341         return chan->__do_not_use_macrocontext;
342 }
343 void ast_channel_macrocontext_set(struct ast_channel *chan, const char *value)
344 {
345         ast_copy_string(chan->__do_not_use_macrocontext, value, sizeof(chan->__do_not_use_macrocontext));
346 }
347 const char *ast_channel_macroexten(const struct ast_channel *chan)
348 {
349         return chan->__do_not_use_macroexten;
350 }
351 void ast_channel_macroexten_set(struct ast_channel *chan, const char *value)
352 {
353         ast_copy_string(chan->__do_not_use_macroexten, value, sizeof(chan->__do_not_use_macroexten));
354 }
355
356
357 char ast_channel_dtmf_digit_to_emulate(const struct ast_channel *chan)
358 {
359         return chan->__do_not_use_dtmf_digit_to_emulate;
360 }
361 void ast_channel_dtmf_digit_to_emulate_set(struct ast_channel *chan, char value)
362 {
363         chan->__do_not_use_dtmf_digit_to_emulate = value;
364 }
365 int ast_channel_amaflags(const struct ast_channel *chan)
366 {
367         return chan->__do_not_use_amaflags;
368 }
369 void ast_channel_amaflags_set(struct ast_channel *chan, int value)
370 {
371         chan->__do_not_use_amaflags = value;
372 }
373 #ifdef HAVE_EPOLL
374 int ast_channel_epfd(const struct ast_channel *chan)
375 {
376         return chan->__do_not_use_epfd;
377 }
378 void ast_channel_epfd_set(struct ast_channel *chan, int value)
379 {
380         chan->__do_not_use_epfd = value;
381 }
382 #endif
383 int ast_channel_fdno(const struct ast_channel *chan)
384 {
385         return chan->__do_not_use_fdno;
386 }
387 void ast_channel_fdno_set(struct ast_channel *chan, int value)
388 {
389         chan->__do_not_use_fdno = value;
390 }
391 int ast_channel_hangupcause(const struct ast_channel *chan)
392 {
393         return chan->__do_not_use_hangupcause;
394 }
395 void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
396 {
397         chan->__do_not_use_hangupcause = value;
398 }
399 int ast_channel_macropriority(const struct ast_channel *chan)
400 {
401         return chan->__do_not_use_macropriority;
402 }
403 void ast_channel_macropriority_set(struct ast_channel *chan, int value)
404 {
405         chan->__do_not_use_macropriority = value;
406 }
407 int ast_channel_priority(const struct ast_channel *chan)
408 {
409         return chan->__do_not_use_priority;
410 }
411 void ast_channel_priority_set(struct ast_channel *chan, int value)
412 {
413         chan->__do_not_use_priority = value;
414 }
415 int ast_channel_rings(const struct ast_channel *chan)
416 {
417         return chan->__do_not_use_rings;
418 }
419 void ast_channel_rings_set(struct ast_channel *chan, int value)
420 {
421         chan->__do_not_use_rings = value;
422 }
423 int ast_channel_streamid(const struct ast_channel *chan)
424 {
425         return chan->__do_not_use_streamid;
426 }
427 void ast_channel_streamid_set(struct ast_channel *chan, int value)
428 {
429         chan->__do_not_use_streamid = value;
430 }
431 int ast_channel_timingfd(const struct ast_channel *chan)
432 {
433         return chan->__do_not_use_timingfd;
434 }
435 void ast_channel_timingfd_set(struct ast_channel *chan, int value)
436 {
437         chan->__do_not_use_timingfd = value;
438 }
439 int ast_channel_visible_indication(const struct ast_channel *chan)
440 {
441         return chan->__do_not_use_visible_indication;
442 }
443 void ast_channel_visible_indication_set(struct ast_channel *chan, int value)
444 {
445         chan->__do_not_use_visible_indication = value;
446 }
447 int ast_channel_vstreamid(const struct ast_channel *chan)
448 {
449         return chan->__do_not_use_vstreamid;
450 }
451 void ast_channel_vstreamid_set(struct ast_channel *chan, int value)
452 {
453         chan->__do_not_use_vstreamid = value;
454 }
455 unsigned short ast_channel_transfercapability(const struct ast_channel *chan)
456 {
457         return chan->__do_not_use_transfercapability;
458 }
459 void ast_channel_transfercapability_set(struct ast_channel *chan, unsigned short value)
460 {
461         chan->__do_not_use_transfercapability = value;
462 }
463 unsigned int ast_channel_emulate_dtmf_duration(const struct ast_channel *chan)
464 {
465         return chan->__do_not_use_emulate_dtmf_duration;
466 }
467 void ast_channel_emulate_dtmf_duration_set(struct ast_channel *chan, unsigned int value)
468 {
469         chan->__do_not_use_emulate_dtmf_duration = value;
470 }
471 unsigned int ast_channel_fin(const struct ast_channel *chan)
472 {
473         return chan->__do_not_use_fin;
474 }
475 void ast_channel_fin_set(struct ast_channel *chan, unsigned int value)
476 {
477         chan->__do_not_use_fin = value;
478 }
479 unsigned int ast_channel_fout(const struct ast_channel *chan)
480 {
481         return chan->__do_not_use_fout;
482 }
483 void ast_channel_fout_set(struct ast_channel *chan, unsigned int value)
484 {
485         chan->__do_not_use_fout = value;
486 }
487 unsigned long ast_channel_insmpl(const struct ast_channel *chan)
488 {
489         return chan->__do_not_use_insmpl;
490 }
491 void ast_channel_insmpl_set(struct ast_channel *chan, unsigned long value)
492 {
493         chan->__do_not_use_insmpl = value;
494 }
495 unsigned long ast_channel_outsmpl(const struct ast_channel *chan)
496 {
497         return chan->__do_not_use_outsmpl;
498 }
499 void ast_channel_outsmpl_set(struct ast_channel *chan, unsigned long value)
500 {
501         chan->__do_not_use_outsmpl = value;
502 }
503 void *ast_channel_generatordata(const struct ast_channel *chan)
504 {
505         return chan->__do_not_use_generatordata;
506 }
507 void ast_channel_generatordata_set(struct ast_channel *chan, void *value)
508 {
509         chan->__do_not_use_generatordata = value;
510 }
511 void *ast_channel_music_state(const struct ast_channel *chan)
512 {
513         return chan->__do_not_use_music_state;
514 }
515 void ast_channel_music_state_set(struct ast_channel *chan, void *value)
516 {
517         chan->__do_not_use_music_state = value;
518 }
519 void *ast_channel_tech_pvt(const struct ast_channel *chan)
520 {
521         return chan->__do_not_use_tech_pvt;
522 }
523 void ast_channel_tech_pvt_set(struct ast_channel *chan, void *value)
524 {
525         chan->__do_not_use_tech_pvt = value;
526 }
527 void *ast_channel_timingdata(const struct ast_channel *chan)
528 {
529         return chan->__do_not_use_timingdata;
530 }
531 void ast_channel_timingdata_set(struct ast_channel *chan, void *value)
532 {
533         chan->__do_not_use_timingdata = value;
534 }
535 struct ast_audiohook_list *ast_channel_audiohooks(const struct ast_channel *chan)
536 {
537         return chan->__do_not_use_audiohooks;
538 }
539 void ast_channel_audiohooks_set(struct ast_channel *chan, struct ast_audiohook_list *value)
540 {
541         chan->__do_not_use_audiohooks = value;
542 }
543 struct ast_cdr *ast_channel_cdr(const struct ast_channel *chan)
544 {
545         return chan->__do_not_use_cdr;
546 }
547 void ast_channel_cdr_set(struct ast_channel *chan, struct ast_cdr *value)
548 {
549         chan->__do_not_use_cdr = value;
550 }
551 struct ast_channel *ast_channel_masq(const struct ast_channel *chan)
552 {
553         return chan->__do_not_use_masq;
554 }
555 void ast_channel_masq_set(struct ast_channel *chan, struct ast_channel *value)
556 {
557         chan->__do_not_use_masq = value;
558 }
559 struct ast_channel *ast_channel_masqr(const struct ast_channel *chan)
560 {
561         return chan->__do_not_use_masqr;
562 }
563 void ast_channel_masqr_set(struct ast_channel *chan, struct ast_channel *value)
564 {
565         chan->__do_not_use_masqr = value;
566 }
567 struct ast_channel_monitor *ast_channel_monitor(const struct ast_channel *chan)
568 {
569         return chan->__do_not_use_monitor;
570 }
571 void ast_channel_monitor_set(struct ast_channel *chan, struct ast_channel_monitor *value)
572 {
573         chan->__do_not_use_monitor = value;
574 }
575 struct ast_filestream *ast_channel_stream(const struct ast_channel *chan)
576 {
577         return chan->__do_not_use_stream;
578 }
579 void ast_channel_stream_set(struct ast_channel *chan, struct ast_filestream *value)
580 {
581         chan->__do_not_use_stream = value;
582 }
583 struct ast_filestream *ast_channel_vstream(const struct ast_channel *chan)
584 {
585         return chan->__do_not_use_vstream;
586 }
587 void ast_channel_vstream_set(struct ast_channel *chan, struct ast_filestream *value)
588 {
589         chan->__do_not_use_vstream = value;
590 }
591 struct ast_format_cap *ast_channel_nativeformats(const struct ast_channel *chan)
592 {
593         return chan->__do_not_use_nativeformats;
594 }
595 void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
596 {
597         chan->__do_not_use_nativeformats = value;
598 }
599 struct ast_framehook_list *ast_channel_framehooks(const struct ast_channel *chan)
600 {
601         return chan->__do_not_use_framehooks;
602 }
603 void ast_channel_framehooks_set(struct ast_channel *chan, struct ast_framehook_list *value)
604 {
605         chan->__do_not_use_framehooks = value;
606 }
607 struct ast_generator *ast_channel_generator(const struct ast_channel *chan)
608 {
609         return chan->__do_not_use_generator;
610 }
611 void ast_channel_generator_set(struct ast_channel *chan, struct ast_generator *value)
612 {
613         chan->__do_not_use_generator = value;
614 }
615 struct ast_pbx *ast_channel_pbx(const struct ast_channel *chan)
616 {
617         return chan->__do_not_use_pbx;
618 }
619 void ast_channel_pbx_set(struct ast_channel *chan, struct ast_pbx *value)
620 {
621         chan->__do_not_use_pbx = value;
622 }
623 struct ast_sched_context *ast_channel_sched(const struct ast_channel *chan)
624 {
625         return chan->__do_not_use_sched;
626 }
627 void ast_channel_sched_set(struct ast_channel *chan, struct ast_sched_context *value)
628 {
629         chan->__do_not_use_sched = value;
630 }
631 struct ast_timer *ast_channel_timer(const struct ast_channel *chan)
632 {
633         return chan->__do_not_use_timer;
634 }
635 void ast_channel_timer_set(struct ast_channel *chan, struct ast_timer *value)
636 {
637         chan->__do_not_use_timer = value;
638 }
639 struct ast_tone_zone *ast_channel_zone(const struct ast_channel *chan)
640 {
641         return chan->__do_not_use_zone;
642 }
643 void ast_channel_zone_set(struct ast_channel *chan, struct ast_tone_zone *value)
644 {
645         chan->__do_not_use_zone = value;
646 }
647 struct ast_trans_pvt *ast_channel_readtrans(const struct ast_channel *chan)
648 {
649         return chan->__do_not_use_readtrans;
650 }
651 void ast_channel_readtrans_set(struct ast_channel *chan, struct ast_trans_pvt *value)
652 {
653         chan->__do_not_use_readtrans = value;
654 }
655 struct ast_trans_pvt *ast_channel_writetrans(const struct ast_channel *chan)
656 {
657         return chan->__do_not_use_writetrans;
658 }
659 void ast_channel_writetrans_set(struct ast_channel *chan, struct ast_trans_pvt *value)
660 {
661         chan->__do_not_use_writetrans = value;
662 }
663 const struct ast_channel_tech *ast_channel_tech(const struct ast_channel *chan)
664 {
665         return chan->__do_not_use_tech;
666 }
667 void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
668 {
669         chan->__do_not_use_tech = value;
670 }
671 enum ast_channel_adsicpe ast_channel_adsicpe(const struct ast_channel *chan)
672 {
673         return chan->__do_not_use_adsicpe;
674 }
675 void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value)
676 {
677         chan->__do_not_use_adsicpe = value;
678 }
679 enum ast_channel_state ast_channel_state(const struct ast_channel *chan)
680 {
681         return chan->__do_not_use_state;
682 }
683 void ast_channel_state_set(struct ast_channel *chan, enum ast_channel_state value)
684 {
685         chan->__do_not_use_state = value;
686 }
687 struct ast_format *ast_channel_oldwriteformat(struct ast_channel *chan)
688 {
689         return &chan->__do_not_use_oldwriteformat;
690 }
691 struct ast_format *ast_channel_rawreadformat(struct ast_channel *chan)
692 {
693         return &chan->__do_not_use_rawreadformat;
694 }
695 struct ast_format *ast_channel_rawwriteformat(struct ast_channel *chan)
696 {
697         return &chan->__do_not_use_rawwriteformat;
698 }
699 struct ast_format *ast_channel_readformat(struct ast_channel *chan)
700 {
701         return &chan->__do_not_use_readformat;
702 }
703 struct ast_format *ast_channel_writeformat(struct ast_channel *chan)
704 {
705         return &chan->__do_not_use_writeformat;
706 }