[sr-dev] git:master: utils: is_int() function moved to pv module

Daniel-Constantin Mierla miconda at gmail.com
Tue Sep 13 11:55:08 CEST 2011


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Tue Sep 13 11:52:57 2011 +0200

utils: is_int() function moved to pv module

---

 modules/utils/README              |   52 ++++++++++++-------------------------
 modules/utils/doc/utils_admin.xml |   22 ---------------
 modules/utils/functions.c         |   18 -------------
 modules/utils/functions.h         |    5 ---
 modules/utils/utils.c             |    2 -
 5 files changed, 17 insertions(+), 82 deletions(-)

diff --git a/modules/utils/README b/modules/utils/README
index aaf7d35..b2a82e0 100644
--- a/modules/utils/README
+++ b/modules/utils/README
@@ -4,7 +4,7 @@ Juha Heinanen
 
    TutPro Inc.
 
-   Copyright © 2008-2009 Juha Heinanen
+   Copyright © 2008-2009 Juha Heinanen
      __________________________________________________________________
 
    Table of Contents
@@ -28,7 +28,6 @@ Juha Heinanen
 
               4.1. http_query(url, result)
               4.2. xcap_auth_status(watcher_uri, presentity_uri)
-              4.3. is_int(pvar)
 
         5. MI Commands
 
@@ -47,11 +46,10 @@ Juha Heinanen
    1.4. Set xcap_table parameter
    1.5. http_query() usage
    1.6. xcap_auth_status() usage
-   1.7. is_int() usage
-   1.8. forward_list usage
-   1.9. forward_switch usage
-   1.10. forward_filter usage
-   1.11. forward_proxy usage
+   1.7. forward_list usage
+   1.8. forward_switch usage
+   1.9. forward_filter usage
+   1.10. forward_proxy usage
 
 Chapter 1. Admin Guide
 
@@ -74,7 +72,6 @@ Chapter 1. Admin Guide
 
         4.1. http_query(url, result)
         4.2. xcap_auth_status(watcher_uri, presentity_uri)
-        4.3. is_int(pvar)
 
    5. MI Commands
 
@@ -101,7 +98,7 @@ Chapter 1. Admin Guide
    deactivated.
 
    Function xcap_auth_status can be used to check from presence server
-   database, if watcher is authorized to subscribe event “presence” of
+   database, if watcher is authorized to subscribe event "presence" of
    presentity.
 
 2. Dependencies
@@ -142,7 +139,7 @@ modparam("utils", "http_query_timeout", 2)
 
    Defines if the forwarding callback should be installed.
 
-   Default value is “0”.
+   Default value is "0".
 
    Example 1.2. Set forward_active parameter
                                         ...
@@ -165,7 +162,7 @@ modparam("utils", "pres_db_url", "mysql://foo:secret@localhost/pres")
 
    Defines name of xcap table in presence server database.
 
-   Default value is “xcap”.
+   Default value is "xcap".
 
    Example 1.4. Set xcap_table parameter
 ...
@@ -176,15 +173,14 @@ modparam("utils", "xcap_table", "pres_xcap")
 
    4.1. http_query(url, result)
    4.2. xcap_auth_status(watcher_uri, presentity_uri)
-   4.3. is_int(pvar)
 
-4.1.  http_query(url, result)
+4.1. http_query(url, result)
 
-   Sends HTTP GET request according to URL given in “url” parameter, which
+   Sends HTTP GET request according to URL given in "url" parameter, which
    is a string that may contain pseudo variables.
 
    If HTTP server returns a class 2xx or 3xx reply, first line of reply's
-   body (if any) is stored in “result” parameter, which must be a writable
+   body (if any) is stored in "result" parameter, which must be a writable
    pseudo variable.
 
    Function returns reply code of HTTP reply or -1 if something went
@@ -203,10 +199,10 @@ switch ($retcode) {
 }
 ...
 
-4.2.  xcap_auth_status(watcher_uri, presentity_uri)
+4.2. xcap_auth_status(watcher_uri, presentity_uri)
 
    Function checks from presence server database if watcher is authorized
-   to subscribe event “presence” of presentity. Sphere checking is not
+   to subscribe event "presence" of presentity. Sphere checking is not
    included.
 
    Both watcher_uri and presentity_uri are pseudo variables. Function
@@ -229,20 +225,6 @@ if (method=="MESSAGE") {
 }
 ...
 
-4.3.  is_int(pvar)
-
-   Function checks if pvar argument contains integer value and returns 1
-   if it does and -1 otherwise.
-
-   Function can be used from all kinds of routes.
-
-   Example 1.7. is_int() usage
-...
-if (is_int("$var(foo)")) {
-    xlog("L_INFO", "variable foo contains integer value\n");
-}
-...
-
 5. MI Commands
 
    5.1. forward_list
@@ -256,7 +238,7 @@ if (is_int("$var(foo)")) {
 
    No parameters.
 
-   Example 1.8. forward_list usage
+   Example 1.7. forward_list usage
 ...
 kamctl fifo forward_list
 id switch                         filter proxy
@@ -269,7 +251,7 @@ id switch                         filter proxy
    The syntax of this configuration string is described in 1.6.
    (switch_setting_list).
 
-   Example 1.9. forward_switch usage
+   Example 1.8. forward_switch usage
 ...
 kamctl fifo sp_forward_switch 0=on
 ...
@@ -288,7 +270,7 @@ kamctl fifo sp_forward_switch 0=on
    The syntax of this configuration string is described in 1.6.
    (filter_setting_list).
 
-   Example 1.10. forward_filter usage
+   Example 1.9. forward_filter usage
 ...
 kamctl fifo sp_forward_filter 0=REGISTER:INVITE
 ...
@@ -301,7 +283,7 @@ kamctl fifo sp_forward_filter 0=REGISTER:INVITE
    switch). The syntax of this configuration string is described in 1.6.
    (proxy_setting_list).
 
-   Example 1.11. forward_proxy usage
+   Example 1.10. forward_proxy usage
 ...
 kamctl fifo sp_forward_proxy 0=host-c.domain-c:5060
 ...
diff --git a/modules/utils/doc/utils_admin.xml b/modules/utils/doc/utils_admin.xml
index 23527d0..f683f51 100644
--- a/modules/utils/doc/utils_admin.xml
+++ b/modules/utils/doc/utils_admin.xml
@@ -229,28 +229,6 @@ if (method=="MESSAGE") {
 				</programlisting>
 			</example>
 		</section>
-		<section>
-			<title>
-				<function moreinfo="none">is_int(pvar)</function>
-			</title>
-			<para>
-			Function checks if pvar argument contains integer value
-			and returns 1 if it does and -1 otherwise.
-	    	        </para>
-			<para>
-			Function can be used from all kinds of routes.
-			</para>
-			<example>
-				<title><function>is_int()</function> usage</title>
-				<programlisting format="linespecific">
-...
-if (is_int("$var(foo)")) {
-    xlog("L_INFO", "variable foo contains integer value\n");
-}
-...
-				</programlisting>
-			</example>
-		</section>
 	</section>
 	
 	<section>
diff --git a/modules/utils/functions.c b/modules/utils/functions.c
index 878073a..aadfdd5 100644
--- a/modules/utils/functions.c
+++ b/modules/utils/functions.c
@@ -139,21 +139,3 @@ int http_query(struct sip_msg* _m, char* _url, char* _dst)
 	
     return stat;
 }
-
-
-/* 
- * Checks if pvar argument contains int value
- */
-int is_int(struct sip_msg* _m, char* _pvar, char* _s2)
-{
-    pv_spec_t *pvar_sp;
-    pv_value_t pv_val;
-
-    pvar_sp = (pv_spec_t *)_pvar;
-   
-    if (pvar_sp && (pv_get_spec_value(_m, pvar_sp, &pv_val) == 0)) {
-	return (pv_val.flags & PV_VAL_INT)?1:-1;
-    }
-
-    return -1;
-}
diff --git a/modules/utils/functions.h b/modules/utils/functions.h
index df34211..5e666f9 100644
--- a/modules/utils/functions.h
+++ b/modules/utils/functions.h
@@ -42,9 +42,4 @@
 int http_query(struct sip_msg* _m, char* _page, char* _params, char* _dst);
 
 
-/* 
- * Checks if pvar argument contains int value
- */
-int is_int(struct sip_msg* _m, char* _pvar, char* _s2);
-
 #endif /* UTILS_FUNCTIONS_H */
diff --git a/modules/utils/utils.c b/modules/utils/utils.c
index b5fa5b1..86f71ea 100644
--- a/modules/utils/utils.c
+++ b/modules/utils/utils.c
@@ -101,8 +101,6 @@ static cmd_export_t cmds[] = {
      REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE},
     {"xcap_auth_status", (cmd_function)xcap_auth_status, 2, fixup_pvar_pvar,
      fixup_free_pvar_pvar, REQUEST_ROUTE},
-    {"is_int", (cmd_function)is_int, 1, fixup_pvar_null, fixup_free_pvar_null,
-     REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE},
     {0, 0, 0, 0, 0, 0}
 };
 




More information about the sr-dev mailing list