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

Author: Andrei Pelinescu-Onciul <[email protected]>
Committer: Andrei Pelinescu-Onciul <[email protected]>
Date:   Mon Feb 22 19:45:14 2010 +0100

various modules: don't access route_type directly

route_type should be accessed only through get_route_type() or
is_route_type(FOO).
Replaced all the route_type==FOO_ROUTE with
is_route_type(FOO_ROUTE).

---

 modules/dialplan/dialplan.c           |    2 +-
 modules/lcr/lcr_mod.c                 |    2 +-
 modules_k/dialog/dlg_profile.c        |    6 +++---
 modules_k/dispatcher/dispatch.c       |    2 +-
 modules_k/domain/domain.c             |    4 ++--
 modules_k/domainpolicy/domainpolicy.c |    4 ++--
 modules_k/registrar/save.c            |    4 ++--
 7 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/modules/dialplan/dialplan.c b/modules/dialplan/dialplan.c
index 15477e1..e102748 100644
--- a/modules/dialplan/dialplan.c
+++ b/modules/dialplan/dialplan.c
@@ -288,7 +288,7 @@ static int dp_update(struct sip_msg * msg, pv_spec_t * src, 
pv_spec_t * dest,
                return -1;
        }
 
-       if(route_type==FAILURE_ROUTE
+       if(is_route_type(FAILURE_ROUTE)
                                && (dest->type==PVT_RURI || 
dest->type==PVT_RURI_USERNAME)) {
                if (append_branch(msg, 0, 0, 0, Q_UNSPECIFIED, 0, 0)!=1 ){
                        LM_ERR("append_branch action failed\n");
diff --git a/modules/lcr/lcr_mod.c b/modules/lcr/lcr_mod.c
index 3c83bfb..cd05b06 100644
--- a/modules/lcr/lcr_mod.c
+++ b/modules/lcr/lcr_mod.c
@@ -2048,7 +2048,7 @@ static int next_gw(struct sip_msg* _m, char* _s1, char* 
_s2)
        }
     }
 
-    if ((route_type == REQUEST_ROUTE) && (ru_avp == NULL)) {
+    if ((is_route_type(REQUEST_ROUTE)) && (ru_avp == NULL)) {
 
        /* First invocation in route block => Rewrite Request URI. */
        memset(&act, '\0', sizeof(act));
diff --git a/modules_k/dialog/dlg_profile.c b/modules_k/dialog/dlg_profile.c
index 8df5792..723b9aa 100644
--- a/modules_k/dialog/dlg_profile.c
+++ b/modules_k/dialog/dlg_profile.c
@@ -337,7 +337,7 @@ static struct dlg_cell *get_current_dialog(struct sip_msg 
*msg)
        struct cell *trans;
        struct tm_callback* x;
 
-       if (route_type==REQUEST_ROUTE) {
+       if (is_route_type(REQUEST_ROUTE)) {
                /* use the per-process static holder */
                if (msg->id==current_dlg_msg_id)
                        return current_dlg_pointer;
@@ -478,7 +478,7 @@ int set_dlg_profile(struct sip_msg *msg, str *value, struct 
dlg_profile_table *p
        /* get current dialog */
        dlg = get_current_dialog(msg);
 
-       if (dlg==NULL && route_type!=REQUEST_ROUTE) {
+       if (dlg==NULL && !is_route_type(REQUEST_ROUTE)) {
                LM_CRIT("BUG - dialog not found in a non REQUEST route (%d)\n",
                        REQUEST_ROUTE);
                return -1;
@@ -534,7 +534,7 @@ int unset_dlg_profile(struct sip_msg *msg, str *value,
        /* get current dialog */
        dlg = get_current_dialog(msg);
 
-       if (dlg==NULL || route_type==REQUEST_ROUTE) {
+       if (dlg==NULL || is_route_type(REQUEST_ROUTE)) {
                LM_CRIT("BUG - dialog NULL or del_profile used in request 
route\n");
                return -1;
        }
diff --git a/modules_k/dispatcher/dispatch.c b/modules_k/dispatcher/dispatch.c
index befac12..5fdc86b 100644
--- a/modules_k/dispatcher/dispatch.c
+++ b/modules_k/dispatcher/dispatch.c
@@ -1237,7 +1237,7 @@ static inline int ds_update_dst(struct sip_msg *msg, str 
*uri, int mode)
                        }       
                break;
        }
-       if(ds_append_branch!=0 && route_type==FAILURE_ROUTE)
+       if(ds_append_branch!=0 && is_route_type(FAILURE_ROUTE))
        {
                if (append_branch(msg, 0, duri, 0, Q_UNSPECIFIED, 0, 0)!=1 )
                {
diff --git a/modules_k/domain/domain.c b/modules_k/domain/domain.c
index 3b217c7..942a6ce 100644
--- a/modules_k/domain/domain.c
+++ b/modules_k/domain/domain.c
@@ -168,13 +168,13 @@ int is_uri_host_local(struct sip_msg* _msg, char* _s1, 
char* _s2)
        qvalue_t q;
        struct sip_uri puri;
 
-       if ( route_type&(REQUEST_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE) ) {
+       if ( is_route_type(REQUEST_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE) ) {
                if (parse_sip_msg_uri(_msg) < 0) {
                        LM_ERR("Error while parsing R-URI\n");
                        return -1;
                }
                return is_domain_local(&(_msg->parsed_uri.host));
-       } else if (route_type == FAILURE_ROUTE) {
+       } else if (is_route_type(FAILURE_ROUTE)) {
                        branch.s = get_branch(0, &branch.len, &q, 0, 0, 0, 0);
                        if (branch.s) {
                                if (parse_uri(branch.s, branch.len, &puri) < 0) 
{
diff --git a/modules_k/domainpolicy/domainpolicy.c 
b/modules_k/domainpolicy/domainpolicy.c
index f77095e..ad138e3 100644
--- a/modules_k/domainpolicy/domainpolicy.c
+++ b/modules_k/domainpolicy/domainpolicy.c
@@ -765,7 +765,7 @@ int dp_can_connect(struct sip_msg* _msg, char* _s1, char* 
_s2) {
        str domain;
        int ret;
 
-       if (route_type != REQUEST_ROUTE) {
+       if (!is_route_type(REQUEST_ROUTE)) {
                LM_ERR("unsupported route type\n");
                return -1;
        }
@@ -823,7 +823,7 @@ int dp_apply_policy(struct sip_msg* _msg, char* _s1, char* 
_s2) {
        int port, proto;
        struct socket_info* si;
 
-       if (route_type != REQUEST_ROUTE) {
+       if (!is_route_type(REQUEST_ROUTE)) {
                LM_ERR("unsupported route type\n");
                return -1;
        }
diff --git a/modules_k/registrar/save.c b/modules_k/registrar/save.c
index 3b479f6..71c8021 100644
--- a/modules_k/registrar/save.c
+++ b/modules_k/registrar/save.c
@@ -784,13 +784,13 @@ int save(struct sip_msg* _m, char* _d, char* _cflags)
        update_stat(accepted_registrations, 1);
 
        /* Only send reply upon request, not upon reply */
-       if ((route_type == REQUEST_ROUTE) && !is_cflag_set(REG_SAVE_NORPL_FL) 
&& (reg_send_reply(_m) < 0))
+       if ((is_route_type(REQUEST_ROUTE)) && !is_cflag_set(REG_SAVE_NORPL_FL) 
&& (reg_send_reply(_m) < 0))
                return -1;
 
        return ret;
 error:
        update_stat(rejected_registrations, 1);
-       if ((route_type == REQUEST_ROUTE) && !is_cflag_set(REG_SAVE_NORPL_FL) )
+       if (is_route_type(REQUEST_ROUTE) && !is_cflag_set(REG_SAVE_NORPL_FL) )
                reg_send_reply(_m);
 
        return 0;


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to