I have a few questions about porting modules from OpenSER 1.2<div><br></div><div>1) Obviously the LOG function has been replaced with LM_* (LM_INFO, LM_DBG, etc)</div><div><br></div><div>2) There seems to be extra parameters now to functions when they're being called from the config file, and I'm not sure why they're there and what they're needed for. I tried to make some sense of it from the cfgutils module with no luck. Take the m_sleep function for example (called with sleep() from the config):</div>
<div><br></div><div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><span style="color: #aa0d91">static</span> <span style="color: #aa0d91">int</span> m_sleep(<span style="color: #aa0d91">struct</span> sip_msg *msg, <span style="color: #aa0d91">char</span> *time, <span style="color: #aa0d91">char</span> *str2);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><br></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><span class="Apple-style-span" style="font-family: arial; font-size: 13px; "><div>People seem to randomly name these extra function parameters:</div>
<div><br></div><div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><span style="color: #aa0d91">static</span> <span style="color: #aa0d91">int</span> dbg_abort(<span style="color: #aa0d91">struct</span> sip_msg* msg, <span style="color: #aa0d91">char</span>* foo, <span style="color: #aa0d91">char</span>* bar);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><br></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><span class="Apple-style-span" style="font-family: arial; font-size: 13px;">The reason this is throwing a stone into my shoe is because I'm trying to figure out how the usrloc module works. I am attempting to "cache" register requests by sending them upstream and trapping the response. To do this, obviously I need to reimplement the save command, which uses such paramaters:</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><span class="Apple-style-span" style="font-family: arial; font-size: 13px;"><br></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><span class="Apple-style-span" style="font-family: arial; font-size: 13px;"></span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><span style="color: #aa0d91">int</span> save(<span style="color: #aa0d91">struct</span> sip_msg* _m, <span style="color: #aa0d91">char</span>* _d, <span style="color: #aa0d91">char</span>* _cflags);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><br></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><span class="Apple-style-span" style="font-family: arial; font-size: 13px; ">If I understand this correctly, the paramaters are arbitrary, they're always char* (meaning passing ints requires a fixup function).</span><br>
</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><span class="Apple-style-span" style="font-family: arial; font-size: 13px;"><br></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco">
<span class="Apple-style-span" style="font-family: arial; font-size: 13px;">Does this mean that I'm always limited to only two parameters per function? Even if I need more or less?</span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco">
<span class="Apple-style-span" style="font-family: arial; font-size: 13px;"><br></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><span class="Apple-style-span" style="font-family: arial; font-size: 13px;">Supposing I need to func(param, param, param), would I add an extra char* and define the function like:</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><span class="Apple-style-span" style="font-family: arial; font-size: 13px;"><br></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><span class="Apple-style-span" style="font-family: arial; font-size: 13px;">int func(struct sip_msg *m, char *p1, char *p2, char *p3);</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><span class="Apple-style-span" style="font-family: arial; font-size: 13px;"><br></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><span class="Apple-style-span" style="font-family: arial; font-size: 13px;">3) Any other gotchas I should be aware of?</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><span class="Apple-style-span" style="font-family: arial; font-size: 13px;"><br></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><span class="Apple-style-span" style="font-family: arial; font-size: 13px;">Thanks.</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><span class="Apple-style-span" style="font-family: arial; font-size: 13px;"><br></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><span class="Apple-style-span" style="font-family: arial; font-size: 13px;">-Daniel</span></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco"><span class="Apple-style-span" style="font-family: arial; font-size: 13px;"><br></span></p><p></p></div></span></p></div>