<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    First a general recommendation: try to avoid patching core that much
    for non-common use cases.<br>
    <br>
    The pv spec does not store the pv name in most of the cases, storing
    it there will increase size of structure and it is not needed in
    typical use cases.<br>
    <br>
    At this moment, I think a good solution could be:<br>
    - most of the code in debugger module<br>
    - in core only a hook for a callback function for assignment
    operations that will print the desired info<br>
    - update the interpreter to use pv cache instead of own spec per pv
    (I can do it, being in my list and hopefully is no big change)<br>
    - if this feature is enabled in debugger module, it will create a
    hash table where to index pv set functions by pointer and point to
    the cache item<br>
    - this index has to be created in child_init with rank PROC_INIT to
    be sure all pvs were resolved to cache item<br>
    - not being a large set of writable variables, but also a debug
    case, looking up the pointer in hash table should be fast enough<br>
    <br>
    Where to look:<br>
    - adding a callback in the core - see how the callback to get the
    per module debug level was added<br>
    - hash table - a hash table was created for per module debug level
    as well in debugger module<br>
    - pvapi.c show the structure of pv cache items<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 5/23/13 5:29 PM, Victor Seva wrote:<br>
    </div>
    <blockquote
cite="mid:CAAgy_VkopQ2BuCbsxgvmqy-jaG9Qg2REoORJFCA9TJATAmH-Fw@mail.gmail.com"
      type="cite">
      <pre wrap="">2013/5/23 Daniel-Constantin Mierla <a class="moz-txt-link-rfc2396E" href="mailto:miconda@gmail.com"><miconda@gmail.com></a>:
</pre>
      <blockquote type="cite">
        <pre wrap="">Look for ASSIGN_T in core, one place to go to and check is lval_assign(...)
function, not sure there are other in core.
</pre>
      </blockquote>
      <pre wrap="">
Ok. First attempt to get this done.

I've created a new core cfg parameter "log_assign_actions" to
activate/deactivate de log. No problem there.

I've created to new functions on lvalue.c in order to log the assign
action on lval_assign()

questions:
- How can I get the name of the pvar if I only have pv_spec_t struct?
- Why is always called log_assign_action_pvar() with this kamailio.cfg example?

        xdbg("test assign_action: $$var(temp) = $$fu;\n");
        $var(temp) = $fu;
        xdbg("test assign_action: $$var(temp) = $$null;\n");
        $var(temp) = $null;
        xdbg("test assign_action: $$var(temp) = 2;\n");
        $var(temp) = 2;
        xdbg("test assign_action: $$avp(s:temp_avp) = $$si;\n");
        $avp(s:temp_avp) = $si;
        xdbg("test assign_action: $$avp(s:temp_avp) = \"hi\";\n");
        $avp(s:temp_avp) = "hi";
        xdbg("test assign_action: $$avp(s:temp_avp) = 3;\n");
        $avp(s:temp_avp) = 3;


 4(26395) DEBUG: <script>: test assign_action: $var(temp) = $fu;
 4(26395) DEBUG: <core> [parser/parse_addr_spec.c:885]:
parse_addr_spec(): end of header reached, state=10
 4(26395) DEBUG: <core> [lvalue.c:397]: log_assign_action_pvar(): value.flags: 4
 4(26395) DEBUG: <core> [lvalue.c:401]: log_assign_action_pvar():
$var(unknown): <a class="moz-txt-link-freetext" href="sip:janakj@dhcp246.fokus.gmd.de">sip:janakj@dhcp246.fokus.gmd.de</a>
 4(26395) DEBUG: <script>: test assign_action: $var(temp) = $null;
 4(26395) DEBUG: <core> [lvalue.c:397]: log_assign_action_pvar():
value.flags: 28
 4(26395) DEBUG: <core> [lvalue.c:401]: log_assign_action_pvar():
$var(unknown): 0
 4(26395) DEBUG: <script>: test assign_action: $var(temp) = 2;
 4(26395) DEBUG: <core> [lvalue.c:397]: log_assign_action_pvar():
value.flags: 28
 4(26395) DEBUG: <core> [lvalue.c:401]: log_assign_action_pvar():
$var(unknown): 2
 4(26395) DEBUG: <script>: test assign_action: $avp(s:temp_avp) = $si;
 4(26395) DEBUG: <core> [lvalue.c:397]: log_assign_action_pvar(): value.flags: 4
 4(26395) DEBUG: <core> [lvalue.c:401]: log_assign_action_pvar():
$var(unknown): 127.0.0.1
 4(26395) DEBUG: <script>: test assign_action: $avp(s:temp_avp) = "hi";
 4(26395) DEBUG: <core> [lvalue.c:397]: log_assign_action_pvar(): value.flags: 4
 4(26395) DEBUG: <core> [lvalue.c:401]: log_assign_action_pvar():
$var(unknown): hi
 4(26395) DEBUG: <script>: test assign_action: $avp(s:temp_avp) = 3;
 4(26395) DEBUG: <core> [lvalue.c:397]: log_assign_action_pvar():
value.flags: 28
 4(26395) DEBUG: <core> [lvalue.c:401]: log_assign_action_pvar():
$var(unknown): 3

Thanks in advance,
Victor
</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, San Francisco, USA - June 24-27, 2013
  * <a class="moz-txt-link-freetext" href="http://asipto.com/u/katu">http://asipto.com/u/katu</a> *</pre>
  </body>
</html>