<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://reviewboard.asterisk.org/r/1655/">https://reviewboard.asterisk.org/r/1655/</a>
     </td>
    </tr>
   </table>
   <br />


<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Asterisk Developers.</div>
<div>By Terry Wilson.</div>


<p style="color: grey;"><i>Updated Jan. 6, 2012, 3:51 p.m.</i></p>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Fix the typo Mark pointed out.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">There would be many benefits to making the ast_channel an opaque handle, from increasing maintainability to presenting ways to kill masquerades. I propose that we kick things off by taking things a field at a time, renaming the field to &#39;__do_not_use_${fieldname}&#39; and then writing setters/getters and converting the existing code to using them. When all fields are done, we can move ast_channel to a C file from channel.h and lop off the &#39;__do_not_use_&#39;.

This patch sets up main/channel_interal_api.c to be the only file that actually accesses the ast_channel&#39;s fields directly. The intent would be for any API functions in channel.c to use the accessor functions. No more monkeying around with channel internals. We should use our own APIs.

The interesting changes in this patch are the addition of channel_internal_api.c, the moving of the AST_DATA stuff from channel.c to channel_internal_api.c (note: the AST_DATA stuff will have to be reworked to use accessor functions when ast_channel is really opaque), and some re-working of the way channel iterators/callbacks are handled so as to avoid creating fake ast_channels on the stack to pass in matching data by directly accessing fields (since &quot;name&quot; is a stringfield and the fake channel doesn&#39;t init the stringfields, you can&#39;t use the ast_channel_name_set() function). I went with ast_channel_name(chan) for a getter, and ast_channel_name_set(chan, name) for a setter.

Ideas welcome!

The majority of the grunt-work for this change was done by writing a semantic patch using Coccinelle ( http://coccinelle.lip6.fr/ ).

note: There are some extra changes to some of the h323 files to comment out variables that were set and not used so that I could get it to compile under dev-mode.
</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I ran it through the testsuite and seemed to get the same number of failures that I got without it. I also made some calls and tested out &#39;core show channel &lt;tab&gt;&#39; and &#39;core show channel Console/dsp&#39;, and core show channels to make sure that the changes to the iterators seemed to work.</pre>
  </td>
 </tr>
</table>




<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> (updated)</h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>/trunk/addons/chan_mobile.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/addons/chan_ooh323.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/addons/ooh323c/src/memheap.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_adsiprog.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_alarmreceiver.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_amd.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_chanisavail.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_chanspy.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_confbridge.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_dahdibarge.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_dahdiras.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_dial.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_directed_pickup.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_disa.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_dumpchan.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_externalivr.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_fax.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_flash.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_followme.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_getcpeid.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_jack.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_macro.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_meetme.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_milliwatt.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_minivm.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_mixmonitor.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_page.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_parkandannounce.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_playback.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_queue.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_readexten.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_record.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_rpt.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_sms.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_softhangup.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_stack.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_talkdetect.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_test.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_voicemail.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/apps/app_waitforsilence.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/bridges/bridge_multiplexed.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/chan_agent.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/chan_alsa.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/chan_console.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/chan_dahdi.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/chan_gtalk.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/chan_h323.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/chan_iax2.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/chan_jingle.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/chan_local.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/chan_mgcp.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/chan_misdn.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/chan_nbs.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/chan_oss.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/chan_phone.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/chan_sip.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/chan_skinny.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/chan_unistim.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/chan_usbradio.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/chan_vpb.cc <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/console_video.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/sig_analog.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/sig_pri.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/channels/sig_ss7.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/funcs/func_audiohookinherit.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/funcs/func_channel.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/funcs/func_frame_trace.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/funcs/func_global.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/funcs/func_groupcount.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/funcs/func_lock.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/include/asterisk/channel.h <span style="color: grey">(349871)</span></li>

 <li>/trunk/main/abstract_jb.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/main/aoc.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/main/app.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/main/autochan.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/main/bridging.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/main/ccss.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/main/cdr.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/main/cel.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/main/channel.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/main/channel_internal_api.c <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/trunk/main/cli.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/main/dial.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/main/dsp.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/main/features.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/main/file.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/main/indications.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/main/manager.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/main/pbx.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/main/rtp_engine.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/main/say.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/main/udptl.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/pbx/pbx_dundi.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/pbx/pbx_lua.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/pbx/pbx_realtime.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/res/res_adsi.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/res/res_agi.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/res/res_calendar.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/res/res_fax.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/res/res_jabber.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/res/res_monitor.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/res/res_musiconhold.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/res/res_mutestream.c <span style="color: grey">(349871)</span></li>

 <li>/trunk/res/snmp/agent.c <span style="color: grey">(349871)</span></li>

</ul>

<p><a href="https://reviewboard.asterisk.org/r/1655/diff/" style="margin-left: 3em;">View Diff</a></p>




  </td>
 </tr>
</table>




  </div>
 </body>
</html>