to_parser.xml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
  4. <section id="to_parser" xmlns:xi="http://www.w3.org/2001/XInclude">
  5. <sectioninfo>
  6. <revhistory>
  7. <revision>
  8. <revnumber>$Revision$</revnumber>
  9. <date>$Date$</date>
  10. </revision>
  11. </revhistory>
  12. </sectioninfo>
  13. <title>To Header Field Parser</title>
  14. <para>
  15. Purpose of this parser is to parse body of To header field. The parser
  16. can be found in file <filename>parse_to.c</filename> under
  17. <filename>parser</filename> subdirectory.
  18. </para>
  19. <para>
  20. Main function is <function>parse_to</function> but there is no need to
  21. call the function explicitly. Every time the parser finds a To header
  22. field, this function will be called automatically. Result of the parser
  23. is <structname>to_body</structname> structure. Pointer to the structure
  24. will be stored in <structfield>parsed</structfield> field of
  25. <structname>hdr_field</structname> structure. Since the pointer is
  26. <type>void*</type>, there is a convenience macro
  27. <function>get_to</function> in file <filename>parse_to.h</filename>
  28. that will do the necessary type-casting and will return pointer to
  29. <structname>to_body</structname> structure.
  30. </para>
  31. <para>
  32. The parser itself is a finite state machine that will parse To body
  33. according to the grammar defined in <acronym>RFC3261</acronym> and
  34. store result in <structname>to_body</structname> structure.
  35. </para>
  36. <para>
  37. The parser gets called automatically from function
  38. <function>get_hdr_field</function> in file
  39. <filename>msg_parser.c</filename>. The function first creates and
  40. initializes an instance of <structname>to_body</structname> structure,
  41. then calls <function>parse_to</function> function with the structure as
  42. a parameter and if everything went OK, puts the pointer to the
  43. structure in <structfield>parsed</structfield> field of
  44. <structname>hdr_field</structname> structure representing the parsed To
  45. header field.
  46. </para>
  47. <para>
  48. The newly created structure will be freed when the message is being
  49. destroyed, see function <function>clean_hdr_field</function> in file
  50. <filename>hf.c</filename> for more details.
  51. </para>
  52. <para>
  53. See <xref linkend="to_body"/> for detailed description of the data
  54. structure produced by this parser.
  55. </para>
  56. </section>