You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kamailio/doc/tutorials/serdev/via_parser.xml

56 lines
2.1 KiB

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<section id="via_parser" xmlns:xi="http://www.w3.org/2001/XInclude">
<sectioninfo>
<revhistory>
<revision>
<revnumber>$Revision$</revnumber>
<date>$Date$</date>
</revision>
</revhistory>
</sectioninfo>
<title>Via HF Body Parser</title>
<para>
Purpose of this parser is to parse body of Via header field. The parser
can be found in file <filename>parse_via.c</filename> under
<filename>parser</filename> subdirectory.
</para>
<para>
Main function is <function>parse_via</function> but there is no need to
call the function explicitly. Every time the parser finds a Via header
field, this function will be called automatically. Result of the parser
is <structname>via_body</structname> structure. Pointer to the
structure will be stored in <structfield>parsed</structfield> field of
<structname>hdr_field</structname> structure representing the parsed
header field.
</para>
<para>
The parser itself is a finite state machine that will parse Via body
according to the grammar defined in <acronym>RFC3261</acronym> and
store result in <structname>via_body</structname> structure.
</para>
<para>
The parser gets called automatically from function
<function>get_hdr_field</function> in file
<filename>msg_parser.c</filename>. The function first creates and
initializes an instance of <structname>via_body</structname> structure,
then calls <function>parse_via</function> function with the structure
as a parameter and if everything went OK, puts the pointer to the
structure in <structfield>parsed</structfield> field of
<structname>hdr_field</structname> structure representing the parsed
Via header field.
</para>
<para>
The newly created structure will be freed when the message is being
destroyed, see function <function>clean_hdr_field</function> in file
<filename>hf.c</filename> for more details.
</para>
<para>
Structure <structname>via_body</structname> is described in
<xref linkend="via_body"/>.
</para>
</section>