<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    headers are parsed as needed -- the core has an incremental sip
    parser. By default ony few are parsed (like: call-id, csec, to, top
    via).<br>
    <br>
    Some of the well known headers have internal flags, so parsing to
    locate them would be like (example for Authorization and
    Proxy-Authorization):<br>
    <br>
    parse_headers(msg, HDR_PROXYAUTH_F|HDR_AUTHORIZATION_F, 0)<br>
    <br>
    If this function does not return error, then you can get these
    headers via their hooks in the sip_msg_t or iterating through
    headers list.<br>
    <br>
    If you look for undefined header, you have to parse to the end of
    headers with:<br>
    <br>
    &nbsp;&nbsp;&nbsp; if(parse_headers(msg, HDR_EOH_F, 0)&lt;0)<br>
    &nbsp;&nbsp;&nbsp; {<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LM_ERR("error parsing headers\n");<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return -1;<br>
    &nbsp;&nbsp;&nbsp; }<br>
    <br>
    Then you iterate through headers and find it by name if it is
    actually in the message.<br>
    <br>
    The parser does caching, so when parsing to locate a header, all the
    headers found before it are added to the list. For example, calling
    second time parse_headers(msg, HDR_EOH_F, 0) does pretty much
    nothing, as sip_msg_t keeps a flag that message was already parsed
    to the last header.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 10/25/12 8:58 PM, Peter Dunkley
      wrote:<br>
    </div>
    <blockquote cite="mid:1351191524.30536.5.camel@pd-notebook-linux"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <meta name="GENERATOR" content="GtkHTML/4.4.4">
      Hi,<br>
      <br>
      When adding the oma.xcap-directory auid support to xcap_server I
      couldn't get the following bit of code (in
      xcap_server.c:xcaps_get_directory()) to work:<br>
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (hdr != NULL)<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (cmp_hdrname_strzn(&amp;hdr-&gt;name, "Host",
      4) == 0)<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; server_name = hdr-&gt;body;<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hdr = hdr-&gt;next;<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
      <br>
      The host header was never found.&nbsp; However, simply putting
      'xdbg("$hdr(Host)\n");' in event_route[xhttp:request] made it
      start working.<br>
      <br>
      Have I missed something in the code, or is this a bug?<br>
      <br>
      Regards,<br>
      <br>
      Peter<br>
      <br>
      <br>
      <table cellpadding="0" cellspacing="0" width="100%">
        <tbody>
          <tr>
            <td>
              <pre>-- 
Peter Dunkley
Technical Director
Crocodile RCS Ltd
</pre>
            </td>
          </tr>
        </tbody>
      </table>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
sr-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</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, Berlin, Nov 5-8, 2012 - <a class="moz-txt-link-freetext" href="http://asipto.com/u/kat">http://asipto.com/u/kat</a>
Kamailio Advanced Training, Miami, USA, Nov 12-14, 2012 - <a class="moz-txt-link-freetext" href="http://asipto.com/u/katu">http://asipto.com/u/katu</a></pre>
  </body>
</html>