[sr-dev] git:master: sanity: update docs related to return code

Daniel-Constantin Mierla miconda at gmail.com
Tue Oct 26 10:27:38 CEST 2010


Module: sip-router
Branch: master
Commit: 8a2334dd758a1e9d43d1fac544f6e962960b4dcc
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8a2334dd758a1e9d43d1fac544f6e962960b4dcc

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Tue Oct 26 10:25:03 2010 +0200

sanity: update docs related to return code

- sanity_check() returns false if a test fails
- reported by Sergey Okhapkin

---

 modules/sanity/README            |   22 +++++++++++-----------
 modules/sanity/doc/functions.xml |   16 ++++++++--------
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/modules/sanity/README b/modules/sanity/README
index 0e364e3..2510375 100644
--- a/modules/sanity/README
+++ b/modules/sanity/README
@@ -4,7 +4,7 @@ Nils Ohlmeier
 
    iptelorg GmbH
 
-   Copyright © 2006 iptelorg GmbH
+   Copyright © 2006 iptelorg GmbH
    Revision History
    Revision $Revision$ $Date$
      __________________________________________________________________
@@ -116,17 +116,17 @@ modparam("sanity", "proxy_require", "foo, bar")
    Revision History
    Revision $Revision$ $Date$
 
-1.4.1. sanity_check()
+1.4.1.  sanity_check()
 
    This function makes a row of sanity checks on the given request. The
-   function returns true if one of the checks failed. If one of the checks
-   fails the module sends a precise error reply via sl_send_reply. Thus
-   their is no need to reply with a generic error message.
+   function returns false (-1) if one of the checks failed. 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.
 
    Example 3. sanity_check usage
 ...
-if (sanity_check()) {
-        break;
+if (!sanity_check()) {
+        exit;
 }
 ...
 
@@ -138,10 +138,10 @@ if (sanity_check()) {
 
    Example 4. 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
 400 */
-        break;
+        exit;
 }
 ...
 
@@ -151,9 +151,9 @@ if (method=="REGISTER" && sanity_check("256")) {
 
    Example 5. 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
 a 400 */
-        break;
+        exit;
 }
 ...
diff --git a/modules/sanity/doc/functions.xml b/modules/sanity/doc/functions.xml
index 85f788d..ea9cf1d 100644
--- a/modules/sanity/doc/functions.xml
+++ b/modules/sanity/doc/functions.xml
@@ -26,9 +26,9 @@
 	    </title>
 	<para>
 		This function makes a row of sanity checks on the given request.
-		The function returns true if one of the checks failed. If one
+		The function returns false (-1) if one of the checks failed. If one
 		of the checks fails the module sends a precise error reply via 
-		sl_send_reply. Thus their is no need to reply with a generic 
+		sl_send_reply. Thus there is no need to reply with a generic 
 		error message.
 	</para>
 	<example>
@@ -36,8 +36,8 @@
 	    <programlisting>
 <![CDATA[
 ...
-if (sanity_check()) {
-	break;
+if (!sanity_check()) {
+	exit;
 }
 ...
 ]]>
@@ -55,9 +55,9 @@ if (sanity_check()) {
 	    <programlisting>
 <![CDATA[
 ...
-if (method=="REGISTER" && sanity_check("256")) {
+if (method=="REGISTER" && !sanity_check("256")) {
 	/* the register contains an invalid expires value and is replied with a 400 */
-	break;
+	exit;
 }
 ...
 ]]>
@@ -73,9 +73,9 @@ if (method=="REGISTER" && sanity_check("256")) {
 		<programlisting>
 <![CDATA[
 ...
-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 a 400 */
-	break;
+	exit;
 }
 ...
 ]]>




More information about the sr-dev mailing list