Browse Source

sanity Sanitize XML file names and formats

Olle E. Johansson 12 years ago
parent
commit
80dc9107c5

+ 54 - 26
modules/sanity/README

@@ -7,15 +7,30 @@ Nils Ohlmeier
    Copyright © 2006 iptelorg GmbH
    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
    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
 1. Overview
 
 
@@ -64,14 +79,27 @@ Nils Ohlmeier
    The following modules must be loaded before this module:
    The following modules must be loaded before this module:
      * sl - Stateless replies.
      * 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
    This parameter determines which of the checks from the sanity module
    are executed if no parameter was given to the sanity_check function
    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
    cseq_method (32), cseq_value (64), cotent_length (128), expires_value
    (256), proxy_require (512).
    (256), proxy_require (512).
 
 
-   Example 1. Set default_checks parameter
+   Example 1.1. Set default_checks parameter
 ...
 ...
 modparam("sanity", "default_checks", 1)
 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
    This parameter determines which URIs are going to be checked if the
    'parse uri' will be executed.
    '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:
    Default value is 7. This resolves to the following list of parsed URIs:
    Request RUI (1), From URI (2) and To URI (4).
    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)
 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.
    This parameter sets the list of supported extensions for this Kamailio.
    The value is expected as a comma separated list of extensions. This
    The value is expected as a comma separated list of extensions. This
    list is separated into single tokens. Each token from a proxy require
    list is separated into single tokens. Each token from a proxy require
    header will be compared to the tokens from this list.
    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")
 modparam("sanity", "proxy_require", "foo, bar")
 ...
 ...
 
 
-3.4. autodrop (integer)
+1.4. autodrop (integer)
 
 
    This parameter controls whether the module drops automatically or not
    This parameter controls whether the module drops automatically or not
    the SIP message if the sanity checks fail. Default value is 1 (auto
    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
    sure you exit execution of config without sending a SIP reply because
    it is sent by module itself.
    it is sent by module itself.
 
 
-   Example 4. Set autodrop parameter
+   Example 1.4. Set autodrop parameter
 ...
 ...
 modparam("sanity", "autodrop", 1)
 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.
    This function makes a row of sanity checks over the given SIP request.
    The behavior of the function is also controlled by 'autodrop'
    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
    module sends a precise error reply via SL send_reply(). Thus there is
    no need to reply with a generic error message.
    no need to reply with a generic error message.
 
 
-   Example 5. sanity_check usage
+   Example 1.5. sanity_check usage
 ...
 ...
 if (!sanity_check()) {
 if (!sanity_check()) {
         exit;
         exit;
@@ -155,7 +183,7 @@ if (!sanity_check()) {
    checks (like for the module parameter) which should be executed at this
    checks (like for the module parameter) which should be executed at this
    function call.
    function call.
 
 
-   Example 6. sanity_check usage with parameter
+   Example 1.6. sanity_check usage with parameter
 ...
 ...
 if (method=="REGISTER" && !sanity_check("256")) {
 if (method=="REGISTER" && !sanity_check("256")) {
         /* the register contains an invalid expires value and is replied with a
         /* 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
    overwrites the global module parameter uri_checks and thus determines
    which URIs will be checked if the parse uri test will be executed.
    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")) {
 if (method=="INVITE" && !sanity_check("1024", "6")) {
         /* the INVITE contains an invalid From or To header and is replied with
         /* the INVITE contains an invalid From or To header and is replied with

+ 1 - 2
modules/sanity/doc/sanity.xml

@@ -139,6 +139,5 @@
 	</para>
 	</para>
     </section>
     </section>
 
 
-    <xi:include href="sanity_params.xml"/>
-    <xi:include href="sanity_functions.xml"/>
+    <xi:include href="sanity_admin.xml"/>
 </book>
 </book>

+ 0 - 0
modules/sanity/doc/sanity_params.xml → modules/sanity/doc/sanity_admin.xml


+ 0 - 81
modules/sanity/doc/sanity_functions.xml

@@ -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>