Module: sip-router
Branch: master
Commit: 80dc9107c5cd47cab24786a12d2612c25f714ff3
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=80dc910…
Author: Olle E. Johansson <oej(a)edvina.net>
Committer: Olle E. Johansson <oej(a)edvina.net>
Date: Sat Jan 19 20:07:08 2013 +0100
sanity Sanitize XML file names and formats
---
modules/sanity/README | 80 +++++++++++++------
modules/sanity/doc/sanity.xml | 3 +-
.../doc/{sanity_params.xml => sanity_admin.xml} | 0
modules/sanity/doc/sanity_functions.xml | 81 --------------------
4 files changed, 55 insertions(+), 109 deletions(-)
diff --git a/modules/sanity/README b/modules/sanity/README
index 90e7ca3..d57b8c0 100644
--- a/modules/sanity/README
+++ b/modules/sanity/README
@@ -7,15 +7,30 @@ Nils Ohlmeier
Copyright � 2006 iptelorg GmbH
__________________________________________________________________
+ Table of Contents
+
+ 1.
+
+ 1. Parameters
+
+ 1.1. default_checks (integer)
+ 1.2. uri_checks (integer)
+ 1.3. proxy_require (string)
+ 1.4. autodrop (integer)
+
+ 2. Functions
+
+ 2.1. sanity_check([msg_checks [, uri_checks]])
+
List of Examples
- 1. Set default_checks parameter
- 2. Set uri_checks parameter
- 3. Set proxy_require parameter
- 4. Set autodrop parameter
- 5. sanity_check usage
- 6. sanity_check usage with parameter
- 7. sanity_check usage with two parameters
+ 1.1. Set default_checks parameter
+ 1.2. Set uri_checks parameter
+ 1.3. Set proxy_require parameter
+ 1.4. Set autodrop parameter
+ 1.5. sanity_check usage
+ 1.6. sanity_check usage with parameter
+ 1.7. sanity_check usage with two parameters
1. Overview
@@ -64,14 +79,27 @@ Nils Ohlmeier
The following modules must be loaded before this module:
* sl - Stateless replies.
-3. Parameters
+ Table of Contents
+
+ 1. Parameters
+
+ 1.1. default_checks (integer)
+ 1.2. uri_checks (integer)
+ 1.3. proxy_require (string)
+ 1.4. autodrop (integer)
+
+ 2. Functions
+
+ 2.1. sanity_check([msg_checks [, uri_checks]])
+
+1. Parameters
- 3.1. default_checks (integer)
- 3.2. uri_checks (integer)
- 3.3. proxy_require (string)
- 3.4. autodrop (integer)
+ 1.1. default_checks (integer)
+ 1.2. uri_checks (integer)
+ 1.3. proxy_require (string)
+ 1.4. autodrop (integer)
-3.1. default_checks (integer)
+1.1. default_checks (integer)
This parameter determines which of the checks from the sanity module
are executed if no parameter was given to the sanity_check function
@@ -84,12 +112,12 @@ Nils Ohlmeier
cseq_method (32), cseq_value (64), cotent_length (128), expires_value
(256), proxy_require (512).
- Example 1. Set default_checks parameter
+ Example 1.1. Set default_checks parameter
...
modparam("sanity", "default_checks", 1)
...
-3.2. uri_checks (integer)
+1.2. uri_checks (integer)
This parameter determines which URIs are going to be checked if the
'parse uri' will be executed.
@@ -97,24 +125,24 @@ modparam("sanity", "default_checks", 1)
Default value is 7. This resolves to the following list of parsed URIs:
Request RUI (1), From URI (2) and To URI (4).
- Example 2. Set uri_checks parameter
+ Example 1.2. Set uri_checks parameter
...
modparam("sanity", "uri_checks", 3)
...
-3.3. proxy_require (string)
+1.3. proxy_require (string)
This parameter sets the list of supported extensions for this Kamailio.
The value is expected as a comma separated list of extensions. This
list is separated into single tokens. Each token from a proxy require
header will be compared to the tokens from this list.
- Example 3. Set proxy_require parameter
+ Example 1.3. Set proxy_require parameter
...
modparam("sanity", "proxy_require", "foo, bar")
...
-3.4. autodrop (integer)
+1.4. autodrop (integer)
This parameter controls whether the module drops automatically or not
the SIP message if the sanity checks fail. Default value is 1 (auto
@@ -123,16 +151,16 @@ modparam("sanity", "proxy_require", "foo,
bar")
sure you exit execution of config without sending a SIP reply because
it is sent by module itself.
- Example 4. Set autodrop parameter
+ Example 1.4. Set autodrop parameter
...
modparam("sanity", "autodrop", 1)
...
-4. Functions
+2. Functions
- 4.1. sanity_check([msg_checks [, uri_checks]])
+ 2.1. sanity_check([msg_checks [, uri_checks]])
-4.1. sanity_check([msg_checks [, uri_checks]])
+2.1. sanity_check([msg_checks [, uri_checks]])
This function makes a row of sanity checks over the given SIP request.
The behavior of the function is also controlled by 'autodrop'
@@ -142,7 +170,7 @@ modparam("sanity", "autodrop", 1)
module sends a precise error reply via SL send_reply(). Thus there is
no need to reply with a generic error message.
- Example 5. sanity_check usage
+ Example 1.5. sanity_check usage
...
if (!sanity_check()) {
exit;
@@ -155,7 +183,7 @@ if (!sanity_check()) {
checks (like for the module parameter) which should be executed at this
function call.
- Example 6. sanity_check usage with parameter
+ Example 1.6. sanity_check usage with parameter
...
if (method=="REGISTER" && !sanity_check("256")) {
/* the register contains an invalid expires value and is replied with a
@@ -168,7 +196,7 @@ if (method=="REGISTER" &&
!sanity_check("256")) {
overwrites the global module parameter uri_checks and thus determines
which URIs will be checked if the parse uri test will be executed.
- Example 7. sanity_check usage with two parameters
+ Example 1.7. sanity_check usage with two parameters
...
if (method=="INVITE" && !sanity_check("1024", "6"))
{
/* the INVITE contains an invalid From or To header and is replied with
diff --git a/modules/sanity/doc/sanity.xml b/modules/sanity/doc/sanity.xml
index 8ba8e32..7415abd 100644
--- a/modules/sanity/doc/sanity.xml
+++ b/modules/sanity/doc/sanity.xml
@@ -139,6 +139,5 @@
</para>
</section>
- <xi:include href="sanity_params.xml"/>
- <xi:include href="sanity_functions.xml"/>
+ <xi:include href="sanity_admin.xml"/>
</book>
diff --git a/modules/sanity/doc/sanity_params.xml b/modules/sanity/doc/sanity_admin.xml
similarity index 100%
rename from modules/sanity/doc/sanity_params.xml
rename to modules/sanity/doc/sanity_admin.xml
diff --git a/modules/sanity/doc/sanity_functions.xml
b/modules/sanity/doc/sanity_functions.xml
deleted file mode 100644
index 62d28e6..0000000
--- a/modules/sanity/doc/sanity_functions.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
-"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
-
-<!-- Include general documentation entities -->
-<!ENTITY % docentities SYSTEM "../../../docbook/entities.xml">
-%docentities;
-
-]>
-
-<section id="options.functions"
xmlns:xi="http://www.w3.org/2001/XInclude">
- <sectioninfo>
- </sectioninfo>
-
- <title>Functions</title>
-
- <section id="sanity_check">
- <title>
- <function>sanity_check([msg_checks [, uri_checks]])</function>
- </title>
- <para>
- This function makes a row of sanity checks over the given SIP request. The
- behavior of the function is also controlled by 'autodrop' parameter.
- If autodrop=0, the function returns false (-1) if one of the checks failed.
- When autodrop=1, the function stops the execution of configuration file.
- In both cases, if one of the checks fails the module sends a precise error
- reply via SL send_reply(). Thus there is no need to reply with a generic
- error message.
- </para>
- <example>
- <title><function>sanity_check</function> usage</title>
- <programlisting>
-<![CDATA[
-...
-if (!sanity_check()) {
- exit;
-}
-...
-]]>
- </programlisting>
- </example>
- <para>
- Optionally the function takes an integer argument which overwrites
- the global module parameter default_checks. This allows to make
- certain test from script regions. The integer value is again the sum
- of the checks (like for the module parameter) which should be executed
- at this function call.
- </para>
- <example>
- <title><function>sanity_check</function> usage with
parameter</title>
- <programlisting>
-<![CDATA[
-...
-if (method=="REGISTER" && !sanity_check("256")) {
- /* the register contains an invalid expires value and is replied with a 400 */
- exit;
-}
-...
-]]>
- </programlisting>
- </example>
- <para>
- Optionally the function takes a second integer argument which
- overwrites the global module parameter uri_checks and thus determines
- which URIs will be checked if the parse uri test will be executed.
- </para>
- <example>
- <title><function>sanity_check</function> usage with two
parameters</title>
- <programlisting>
-<![CDATA[
-...
-if (method=="INVITE" && !sanity_check("1024", "6"))
{
- /* the INVITE contains an invalid From or To header and is replied with a 400 */
- exit;
-}
-...
-]]>
- </programlisting>
- </example>
- </section>
-</section>