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/modules_s/maxfwd/doc/functions.xml

78 lines
2.4 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="maxfwd.functions" xmlns:xi="http://www.w3.org/2001/XInclude">
<sectioninfo>
</sectioninfo>
<title>Functions</title>
<section id="maxfwd_process">
<title>
<function>maxfwd_process(max_value)</function>
</title>
<para>
If no Max-Forward header is present in the received request, a
header will be added having the original value equal with
"max_value". An OK code is returned by the function.
</para>
<para>
If a Max-Forward header is already present, its value will be
decremented. If after this operation its value will be positive
non-zero, an OK code will be returned. Otherwise (for a zero value)
an error code will be returned. Note that an error code will be
also returned if the SIP message couldn't be parsed or if the
Max-Forward header's body invalid (non numerical string or negative
numerical value).
</para>
<para>Meaning of the parameters is as follows:</para>
<itemizedlist>
<listitem>
<para>
<emphasis>max_value</emphasis> - Value to be added if there
is no Max-Forwards header field in the message.
</para>
</listitem>
</itemizedlist>
<example>
<title><function>maxfwd_process</function> usage</title>
<programlisting>
# initial sanity checks -- messages with
# max_forwards==0, or excessively long requests
if (!maxfwd_process(10)) {
sl_send_reply(483, "Too many hops");
drop;
};
</programlisting>
</example>
</section>
<section id="maxfwd_at_least">
<title>
<function>maxfwd_at_least(min_value)</function>
</title>
<para>
Test is there is enough hops in Max-forward header, i.e. we know how many hops is required to reach target.
Returns true if Max-Forward header is present in the received request and
the value is greater than "min_value".
</para>
<para>Meaning of the parameters is as follows:</para>
<itemizedlist>
<listitem>
<para>
<emphasis>min_value</emphasis> - Min. number of required hops
</para>
</listitem>
</itemizedlist>
<example>
<title><function>maxfwd_at_least</function> usage</title>
<programlisting>
if (!maxfwd_at_least(3)) {
sl_send_reply(483, "Too many hops");
drop;
};
</programlisting>
</example>
</section>
</section>