File: to_parser.xml

package info (click to toggle)
kamailio 5.6.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 68,332 kB
  • sloc: ansic: 744,091; xml: 196,848; cpp: 14,471; makefile: 8,859; sh: 8,814; sql: 7,844; yacc: 3,863; perl: 2,955; python: 2,710; java: 449; javascript: 269; php: 258; ruby: 225; cs: 40; awk: 27
file content (58 lines) | stat: -rw-r--r-- 2,414 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?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="to_parser" xmlns:xi="http://www.w3.org/2001/XInclude">
    <sectioninfo>
	<revhistory>
	    <revision>
		<revnumber>$Revision$</revnumber>
		<date>$Date$</date>
	    </revision>
	</revhistory>
    </sectioninfo>
    
    <title>To Header Field Parser</title>
    <para>
	Purpose of this parser is to parse body of To header field. The parser
	can be found in file <filename>parse_to.c</filename> under
	<filename>parser</filename> subdirectory.
    </para>
    <para>
	Main function is <function>parse_to</function> but there is no need to
	call the function explicitly. Every time the parser finds a To header
	field, this function will be called automatically. Result of the parser
	is <structname>to_body</structname> structure. Pointer to the structure
	will be stored in <structfield>parsed</structfield> field of
	<structname>hdr_field</structname> structure. Since the pointer is
	<type>void*</type>, there is a convenience macro
	<function>get_to</function> in file <filename>parse_to.h</filename>
	that will do the necessary type-casting and will return pointer to
	<structname>to_body</structname> structure.
    </para>
    <para>
	The parser itself is a finite state machine that will parse To body
	according to the grammar defined in <acronym>RFC3261</acronym> and
	store result in <structname>to_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>to_body</structname> structure,
	then calls <function>parse_to</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 To
	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>
	See <xref linkend="to_body"/> for detailed description of the data
	structure produced by this parser.
    </para>
</section>