<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 />
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I've just taken a look at channel.c and channel_internal_api.c so far. I'll give things a closer look later.</pre>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://reviewboard.asterisk.org/r/1655/diff/1/?file=22741#file22741line1676" style="color: black; font-weight: bold; text-decoration: underline;">/trunk/main/channel.c</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">static int ast_channel_by_uniqueid_cb(void *obj, void *arg, void *data, int flags)</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">1470</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="k">if</span> <span class="p">(</span><span class="n">ast_strlen_zero</span><span class="p">(</span><span class="n">uniqueid</span><span class="p">))</span> <span class="p">{</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">1471</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                <span class="n">ast_log</span><span class="p">(</span><span class="n">LOG_ERROR</span><span class="p">,</span> <span class="s">"BUG! Must have a uniqueid to match!</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">1472</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                <span class="k">return</span> <span class="n">CMP_MATCH</span><span class="p">;</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">1473</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="p">}</span></pre></td>
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Returning CMP_MATCH is inconsistent with how the other callbacks work. The others return CMP_STOP in the case that the input is zero-length.</pre>
</div>
<br />
<p>- Mark</p>
<br />
<p>On January 6th, 2012, 3:05 p.m., Terry Wilson wrote:</p>
<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:05 p.m.</i></p>
<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 '__do_not_use_${fieldname}' 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 '__do_not_use_'.
This patch sets up main/channel_interal_api.c to be the only file that actually accesses the ast_channel'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 "name" is a stringfield and the fake channel doesn't init the stringfields, you can'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 'core show channel <tab>' and 'core show channel Console/dsp', 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> </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>