usrloc: use ul prefix for global param variables
authorDaniel-Constantin Mierla <miconda@gmail.com>
Fri, 1 May 2020 12:47:55 +0000 (14:47 +0200)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Fri, 1 May 2020 12:47:55 +0000 (14:47 +0200)
src/modules/usrloc/dlist.c
src/modules/usrloc/ucontact.c
src/modules/usrloc/udomain.c
src/modules/usrloc/ul_keepalive.c
src/modules/usrloc/ul_rpc.c
src/modules/usrloc/urecord.c
src/modules/usrloc/usrloc.c
src/modules/usrloc/usrloc_mod.c
src/modules/usrloc/usrloc_mod.h
src/modules/usrloc/utime.c
src/modules/usrloc/utime.h

index a811df5..a78f0af 100644 (file)
@@ -75,10 +75,10 @@ static inline int find_dlist(str* _n, dlist_t** _d)
                        *_d = ptr;
                        return 0;
                }
-               
+
                ptr = ptr->next;
        }
-       
+
        return 1;
 }
 
@@ -106,22 +106,22 @@ int ul_ka_db_records(int partidx)
        int i = 0;
 
        /* select fields */
-       keys2[0] = &received_col;
-       keys2[1] = &contact_col;
-       keys2[2] = &sock_col;
-       keys2[3] = &cflags_col;
-       keys2[4] = &path_col;
-       keys2[5] = &ruid_col;
-       keys2[6] = &user_col;
-       keys2[7] = &domain_col;
+       keys2[0] = &ul_received_col;
+       keys2[1] = &ul_contact_col;
+       keys2[2] = &ul_sock_col;
+       keys2[3] = &ul_cflags_col;
+       keys2[4] = &ul_path_col;
+       keys2[5] = &ul_ruid_col;
+       keys2[6] = &ul_user_col;
+       keys2[7] = &ul_domain_col;
 
        /* where fields */
-       keys1[0] = &expires_col;
+       keys1[0] = &ul_expires_col;
        ops1[0] = OP_GT;
        vals1[0].nul = 0;
        UL_DB_EXPIRES_SET(&vals1[0], time(0));
 
-       keys1[1] = &partition_col;
+       keys1[1] = &ul_partition_col;
        ops1[1] = OP_EQ;
        vals1[1].type = DB1_INT;
        vals1[1].nul = 0;
@@ -131,7 +131,7 @@ int ul_ka_db_records(int partidx)
                vals1[1].val.int_val = 0;
 
        if (ul_ka_mode & ULKA_NAT) {
-               keys1[n[0]] = &keepalive_col;
+               keys1[n[0]] = &ul_keepalive_col;
                ops1[n[0]] = OP_EQ;
                vals1[n[0]].type = DB1_INT;
                vals1[n[0]].nul = 0;
@@ -139,7 +139,7 @@ int ul_ka_db_records(int partidx)
                n[0]++;
        }
        if(ul_ka_filter&GAU_OPT_SERVER_ID) {
-               keys1[n[0]] = &srv_id_col;
+               keys1[n[0]] = &ul_srv_id_col;
                ops1[n[0]] = OP_EQ;
                vals1[n[0]].type = DB1_INT;
                vals1[n[0]].nul = 0;
@@ -310,20 +310,20 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags,
        aorhash = 0;
 
        /* select fields */
-       keys2[0] = &received_col;
-       keys2[1] = &contact_col;
-       keys2[2] = &sock_col;
-       keys2[3] = &cflags_col;
-       keys2[4] = &path_col;
-       keys2[5] = &ruid_col;
+       keys2[0] = &ul_received_col;
+       keys2[1] = &ul_contact_col;
+       keys2[2] = &ul_sock_col;
+       keys2[3] = &ul_cflags_col;
+       keys2[4] = &ul_path_col;
+       keys2[5] = &ul_ruid_col;
 
        /* where fields */
-       keys1[0] = &expires_col;
+       keys1[0] = &ul_expires_col;
        ops1[0] = OP_GT;
        vals1[0].nul = 0;
        UL_DB_EXPIRES_SET(&vals1[0], time(0));
 
-       keys1[1] = &partition_col;
+       keys1[1] = &ul_partition_col;
        ops1[1] = OP_EQ;
        vals1[1].type = DB1_INT;
        vals1[1].nul = 0;
@@ -332,8 +332,8 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags,
        else
                vals1[1].val.int_val = 0;
 
-       if (flags & nat_bflag) {
-               keys1[n[0]] = &keepalive_col;
+       if (flags & ul_nat_bflag) {
+               keys1[n[0]] = &ul_keepalive_col;
                ops1[n[0]] = OP_EQ;
                vals1[n[0]].type = DB1_INT;
                vals1[n[0]].nul = 0;
@@ -341,7 +341,7 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags,
                n[0]++;
        }
        if(options&GAU_OPT_SERVER_ID) {
-               keys1[n[0]] = &srv_id_col;
+               keys1[n[0]] = &ul_srv_id_col;
                ops1[n[0]] = OP_EQ;
                vals1[n[0]].type = DB1_INT;
                vals1[n[0]].nul = 0;
@@ -668,7 +668,7 @@ int get_all_ucontacts(void *buf, int len, unsigned int flags,
                                                                unsigned int part_idx, unsigned int part_max,
                                                                int options)
 {
-       if (db_mode==DB_ONLY)
+       if (ul_db_mode==DB_ONLY)
                return get_all_db_ucontacts( buf, len, flags, part_idx, part_max, options);
        else
                return get_all_mem_ucontacts( buf, len, flags, part_idx, part_max, options);
@@ -826,7 +826,7 @@ int register_udomain(const char* _n, udomain_t** _d)
                *_d = d->d;
                return 0;
        }
-       
+
        if (new_dlist(&s, &d) < 0) {
                LM_ERR("failed to create new domain\n");
                return -1;
@@ -835,8 +835,8 @@ int register_udomain(const char* _n, udomain_t** _d)
        /* Test tables from database if we are gonna
         * to use database
         */
-       if (db_mode != NO_DB) {
-               con = ul_dbf.init(&db_url);
+       if (ul_db_mode != NO_DB) {
+               con = ul_dbf.init(&ul_db_url);
                if (!con) {
                        LM_ERR("failed to open database connection\n");
                        goto dberror;
@@ -859,7 +859,7 @@ int register_udomain(const char* _n, udomain_t** _d)
 
        d->next = _ksr_ul_root;
        _ksr_ul_root = d;
-       
+
        *_d = d->d;
        return 0;
 
@@ -898,7 +898,7 @@ void free_all_udomains(void)
 void print_all_udomains(FILE* _f)
 {
        dlist_t* ptr;
-       
+
        ptr = _ksr_ul_root;
 
        fprintf(_f, "===Domain list===\n");
@@ -919,12 +919,12 @@ unsigned long get_number_of_users(void)
        long numberOfUsers = 0;
 
        dlist_t* current_dlist;
-       
+
        current_dlist = _ksr_ul_root;
 
        while (current_dlist)
        {
-               numberOfUsers += get_stat_val(current_dlist->d->users); 
+               numberOfUsers += get_stat_val(current_dlist->d->users);
                current_dlist  = current_dlist->next;
        }
 
@@ -941,9 +941,9 @@ int synchronize_all_udomains(int istart, int istep)
        int res = 0;
        dlist_t* ptr;
 
-       get_act_time(); /* Get and save actual time */
+       ul_get_act_time(); /* Get and save actual time */
 
-       if (db_mode==DB_ONLY) {
+       if (ul_db_mode==DB_ONLY) {
                if(istart == 0) {
                        for( ptr=_ksr_ul_root ; ptr ; ptr=ptr->next) {
                                res |= db_timer_udomain(ptr->d);
@@ -968,7 +968,7 @@ int ul_db_clean_udomains(void)
        int res = 0;
        dlist_t* ptr;
 
-       get_act_time(); /* Get and save actual time */
+       ul_get_act_time(); /* Get and save actual time */
 
        for( ptr=_ksr_ul_root ; ptr ; ptr=ptr->next)
                res |= db_timer_udomain(ptr->d);
index 8c65063..256d953 100644 (file)
@@ -132,7 +132,7 @@ ucontact_t* new_ucontact(str* _dom, str* _aor, str* _contact, ucontact_info_t* _
        c->last_keepalive = _ci->last_modified;
        c->tcpconn_id = _ci->tcpconn_id;
        c->server_id = _ci->server_id;
-       c->keepalive = (_ci->cflags & nat_bflag)?1:0;
+       c->keepalive = (_ci->cflags & ul_nat_bflag)?1:0;
        ucontact_xavp_store(c);
 
 
@@ -315,28 +315,28 @@ void st_update_ucontact(ucontact_t* _c)
 {
        switch(_c->state) {
        case CS_NEW:
-                        /* Contact is new and is not in the database yet,
-                         * we remain in the same state here because the
-                         * contact must be inserted later in the timer
-                         */
+                       /* Contact is new and is not in the database yet,
+                        * we remain in the same state here because the
+                        * contact must be inserted later in the timer
+                        */
                break;
 
        case CS_SYNC:
-                        /* For db mode 1 & 2 a modified contact needs to be 
-                         * updated also in the database, so transit into 
-                         * CS_DIRTY and let the timer to do the update 
-                         * again. For db mode 1 we try to update right
-                         * now and if fails, let the timer to do the job
-                         */
-               if (db_mode == WRITE_BACK || db_mode == WRITE_THROUGH) {
+                       /* For db mode 1 & 2 a modified contact needs to be
+                        * updated also in the database, so transit into
+                        * CS_DIRTY and let the timer to do the update
+                        * again. For db mode 1 we try to update right
+                        * now and if fails, let the timer to do the job
+                        */
+               if (ul_db_mode == WRITE_BACK || ul_db_mode == WRITE_THROUGH) {
                        _c->state = CS_DIRTY;
                }
                break;
 
        case CS_DIRTY:
-                        /* Modification of dirty contact results in
-                         * dirty contact again, don't change anything
-                         */
+                       /* Modification of dirty contact results in
+                        * dirty contact again, don't change anything
+                        */
                break;
        }
 }
@@ -351,30 +351,30 @@ int st_delete_ucontact(ucontact_t* _c)
 {
        switch(_c->state) {
        case CS_NEW:
-                    /* Contact is new and isn't in the database
-                     * yet, we can delete it from the memory
-                     * safely.
-                     */
+                       /* Contact is new and isn't in the database
+                        * yet, we can delete it from the memory
+                        * safely.
+                        */
                return 1;
 
        case CS_SYNC:
        case CS_DIRTY:
-                    /* Contact is in the database,
-                     * we cannot remove it from the memory 
-                     * directly, but we can set expires to zero
-                     * and the timer will take care of deleting 
-                     * the contact from the memory as well as 
-                     * from the database
-                     */
-               if (db_mode == WRITE_BACK) {
+                       /* Contact is in the database,
+                        * we cannot remove it from the memory
+                        * directly, but we can set expires to zero
+                        * and the timer will take care of deleting
+                        * the contact from the memory as well as
+                        * from the database
+                        */
+               if (ul_db_mode == WRITE_BACK) {
                        _c->expires = UL_EXPIRED_TIME;
                        return 0;
                } else {
-                            /* WRITE_THROUGH or NO_DB -- we can
-                             * remove it from memory immediately and
-                             * the calling function would also remove
-                             * it from the database if needed
-                             */
+                       /* WRITE_THROUGH or NO_DB -- we can
+                        * remove it from memory immediately and
+                        * the calling function would also remove
+                        * it from the database if needed
+                        */
                        return 1;
                }
        }
@@ -390,21 +390,21 @@ int st_delete_ucontact(ucontact_t* _c)
  */
 int st_expired_ucontact(ucontact_t* _c)
 {
-            /* There is no need to change contact
-             * state, because the contact will
-             * be deleted anyway
-             */
+       /* There is no need to change contact
+        * state, because the contact will
+        * be deleted anyway
+        */
 
        switch(_c->state) {
        case CS_NEW:
-                    /* Contact is not in the database
-                     * yet, remove it from memory only
-                     */
+               /* Contact is not in the database
+                * yet, remove it from memory only
+                */
                return 0;
 
        case CS_SYNC:
        case CS_DIRTY:
-                    /* Remove from database here */
+               /* Remove from database here */
                return 1;
        }
 
@@ -421,24 +421,24 @@ int st_flush_ucontact(ucontact_t* _c)
 {
        switch(_c->state) {
        case CS_NEW:
-                    /* Contact is new and is not in
-                     * the database yet so we have
-                     * to insert it
-                     */
+               /* Contact is new and is not in
+                * the database yet so we have
+                * to insert it
+                */
                _c->state = CS_SYNC;
                return 1;
 
        case CS_SYNC:
-                    /* Contact is synchronized, do
-                     * nothing
-                     */
+               /* Contact is synchronized, do
+                * nothing
+                */
                return 0;
 
        case CS_DIRTY:
-                    /* Contact has been modified and
-                     * is in the db already so we
-                     * have to update it
-                     */
+               /* Contact has been modified and
+                * is in the db already so we
+                * have to update it
+                */
                _c->state = CS_SYNC;
                return 2;
        }
@@ -463,7 +463,7 @@ int db_insert_ucontact(ucontact_t* _c)
        db_key_t keys[22];
        db_val_t vals[22];
        int nr_cols;
-       
+
        if (_c->flags & FL_MEM) {
                return 0;
        }
@@ -474,49 +474,49 @@ int db_insert_ucontact(ucontact_t* _c)
        }
 
 
-       keys[0] = &user_col;
+       keys[0] = &ul_user_col;
        vals[0].type = DB1_STR;
        vals[0].nul = 0;
        vals[0].val.str_val.s = _c->aor->s;
        vals[0].val.str_val.len = _c->aor->len;
 
-       keys[1] = &contact_col;
+       keys[1] = &ul_contact_col;
        vals[1].type = DB1_STR;
        vals[1].nul = 0;
-       vals[1].val.str_val.s = _c->c.s; 
+       vals[1].val.str_val.s = _c->c.s;
        vals[1].val.str_val.len = _c->c.len;
 
-       keys[2] = &expires_col;
+       keys[2] = &ul_expires_col;
        vals[2].nul = 0;
        UL_DB_EXPIRES_SET(&vals[2], _c->expires);
 
-       keys[3] = &q_col;
+       keys[3] = &ul_q_col;
        vals[3].type = DB1_DOUBLE;
        vals[3].nul = 0;
        vals[3].val.double_val = q2double(_c->q);
 
-       keys[4] = &callid_col;
+       keys[4] = &ul_callid_col;
        vals[4].type = DB1_STR;
        vals[4].nul = 0;
        vals[4].val.str_val.s = _c->callid.s;
        vals[4].val.str_val.len = _c->callid.len;
 
-       keys[5] = &cseq_col;
+       keys[5] = &ul_cseq_col;
        vals[5].type = DB1_INT;
        vals[5].nul = 0;
        vals[5].val.int_val = _c->cseq;
 
-       keys[6] = &flags_col;
+       keys[6] = &ul_flags_col;
        vals[6].type = DB1_INT;
        vals[6].nul = 0;
        vals[6].val.bitmap_val = _c->flags;
 
-       keys[7] = &cflags_col;
+       keys[7] = &ul_cflags_col;
        vals[7].type = DB1_INT;
        vals[7].nul = 0;
        vals[7].val.bitmap_val = _c->cflags;
 
-       keys[8] = &user_agent_col;
+       keys[8] = &ul_user_agent_col;
        vals[8].type = DB1_STR;
        vals[8].nul = 0;
        vals[8].val.str_val.s = _c->user_agent.s;
@@ -525,60 +525,60 @@ int db_insert_ucontact(ucontact_t* _c)
        nr_cols = 9;
 
        if (_c->received.s) {
-               keys[nr_cols] = &received_col;
+               keys[nr_cols] = &ul_received_col;
                vals[nr_cols].type = DB1_STR;
                vals[nr_cols].nul = 0;
                vals[nr_cols].val.str_val.s = _c->received.s;
                vals[nr_cols].val.str_val.len = _c->received.len;
                nr_cols++;
        } else if(ul_db_insert_null!=0) {
-               keys[nr_cols] = &received_col;
+               keys[nr_cols] = &ul_received_col;
                vals[nr_cols].type = DB1_STR;
                vals[nr_cols].nul = 1;
                nr_cols++;
        }
-       
+
        if (_c->path.s) {
-               keys[nr_cols] = &path_col;
+               keys[nr_cols] = &ul_path_col;
                vals[nr_cols].type = DB1_STR;
                vals[nr_cols].nul = 0;
                vals[nr_cols].val.str_val.s = _c->path.s;
                vals[nr_cols].val.str_val.len = _c->path.len;
                nr_cols++;
        } else if(ul_db_insert_null!=0) {
-               keys[nr_cols] = &path_col;
+               keys[nr_cols] = &ul_path_col;
                vals[nr_cols].type = DB1_STR;
                vals[nr_cols].nul = 1;
                nr_cols++;
        }
 
        if (_c->sock) {
-               keys[nr_cols] = &sock_col;
+               keys[nr_cols] = &ul_sock_col;
                vals[nr_cols].type = DB1_STR;
                vals[nr_cols].val.str_val = _c->sock->sock_str;
                vals[nr_cols].nul = 0;
                nr_cols++;
        } else if(ul_db_insert_null!=0) {
-               keys[nr_cols] = &sock_col;
+               keys[nr_cols] = &ul_sock_col;
                vals[nr_cols].type = DB1_STR;
                vals[nr_cols].nul = 1;
                nr_cols++;
        }
 
        if (_c->methods != 0xFFFFFFFF) {
-               keys[nr_cols] = &methods_col;
+               keys[nr_cols] = &ul_methods_col;
                vals[nr_cols].type = DB1_BITMAP;
                vals[nr_cols].val.bitmap_val = _c->methods;
                vals[nr_cols].nul = 0;
                nr_cols++;
        } else if(ul_db_insert_null!=0) {
-               keys[nr_cols] = &methods_col;
+               keys[nr_cols] = &ul_methods_col;
                vals[nr_cols].type = DB1_BITMAP;
                vals[nr_cols].nul = 1;
                nr_cols++;
        }
 
-       keys[nr_cols] = &last_mod_col;
+       keys[nr_cols] = &ul_last_mod_col;
        vals[nr_cols].nul = 0;
        UL_DB_EXPIRES_SET(&vals[nr_cols], _c->last_modified);
        nr_cols++;
@@ -586,13 +586,13 @@ int db_insert_ucontact(ucontact_t* _c)
 
        if(_c->ruid.len>0)
        {
-               keys[nr_cols] = &ruid_col;
+               keys[nr_cols] = &ul_ruid_col;
                vals[nr_cols].type = DB1_STR;
                vals[nr_cols].nul = 0;
                vals[nr_cols].val.str_val = _c->ruid;
                nr_cols++;
        } else if(ul_db_insert_null!=0) {
-               keys[nr_cols] = &ruid_col;
+               keys[nr_cols] = &ul_ruid_col;
                vals[nr_cols].type = DB1_STR;
                vals[nr_cols].nul = 1;
                nr_cols++;
@@ -600,43 +600,43 @@ int db_insert_ucontact(ucontact_t* _c)
 
        if(_c->instance.len>0)
        {
-               keys[nr_cols] = &instance_col;
+               keys[nr_cols] = &ul_instance_col;
                vals[nr_cols].type = DB1_STR;
                vals[nr_cols].nul = 0;
                vals[nr_cols].val.str_val = _c->instance;
                nr_cols++;
        } else if(ul_db_insert_null!=0) {
-               keys[nr_cols] = &instance_col;
+               keys[nr_cols] = &ul_instance_col;
                vals[nr_cols].type = DB1_STR;
                vals[nr_cols].nul = 1;
                nr_cols++;
        }
 
-       keys[nr_cols] = &reg_id_col;
+       keys[nr_cols] = &ul_reg_id_col;
        vals[nr_cols].type = DB1_INT;
        vals[nr_cols].nul = 0;
        vals[nr_cols].val.int_val = (int)_c->reg_id;
        nr_cols++;
 
-       keys[nr_cols] = &srv_id_col;
+       keys[nr_cols] = &ul_srv_id_col;
        vals[nr_cols].type = DB1_INT;
        vals[nr_cols].nul = 0;
        vals[nr_cols].val.int_val = (int)_c->server_id;
        nr_cols++;
 
-       keys[nr_cols] = &con_id_col;
+       keys[nr_cols] = &ul_con_id_col;
        vals[nr_cols].type = DB1_INT;
        vals[nr_cols].nul = 0;
        vals[nr_cols].val.int_val = (int)_c->tcpconn_id;
        nr_cols++;
 
-       keys[nr_cols] = &keepalive_col;
+       keys[nr_cols] = &ul_keepalive_col;
        vals[nr_cols].type = DB1_INT;
        vals[nr_cols].nul = 0;
        vals[nr_cols].val.int_val = (int)_c->keepalive;
        nr_cols++;
 
-       keys[nr_cols] = &partition_col;
+       keys[nr_cols] = &ul_partition_col;
        vals[nr_cols].type = DB1_INT;
        vals[nr_cols].nul = 0;
        if(_ul_max_partition>0) {
@@ -648,8 +648,8 @@ int db_insert_ucontact(ucontact_t* _c)
        nr_cols++;
 
 
-       if (use_domain) {
-               keys[nr_cols] = &domain_col;
+       if (ul_use_domain) {
+               keys[nr_cols] = &ul_domain_col;
                vals[nr_cols].type = DB1_STR;
                vals[nr_cols].nul = 0;
 
@@ -676,7 +676,7 @@ int db_insert_ucontact(ucontact_t* _c)
                return -1;
        }
 
-       if (db_insert_update && ul_dbf.insert_update) {
+       if (ul_db_insert_update && ul_dbf.insert_update) {
                if (ul_dbf.insert_update(ul_dbh, keys, vals, nr_cols) < 0) {
                        LM_ERR("inserting with update contact in db failed %.*s (%.*s)\n",
                                        _c->aor->len, ZSW(_c->aor->s), _c->ruid.len, ZSW(_c->ruid.s));
@@ -692,8 +692,8 @@ int db_insert_ucontact(ucontact_t* _c)
 
        if (ul_xavp_contact_name.s) {
                uldb_insert_attrs(_c->domain, &vals[0].val.str_val,
-                                 &vals[nr_cols-1].val.str_val,
-                                 &_c->ruid, _c->xavp);
+                               &vals[nr_cols-1].val.str_val,
+                               &_c->ruid, _c->xavp);
        }
 
        return 0;
@@ -721,14 +721,14 @@ int db_update_ucontact_addr(ucontact_t* _c)
                return 0;
        }
 
-       keys1[n1] = &user_col;
+       keys1[n1] = &ul_user_col;
        vals1[n1].type = DB1_STR;
        vals1[n1].nul = 0;
        vals1[n1].val.str_val = *_c->aor;
        LM_DBG("aor:%.*s\n", vals1[n1].val.str_val.len, vals1[n1].val.str_val.s);
        n1++;
 
-       keys1[n1] = &contact_col;
+       keys1[n1] = &ul_contact_col;
        vals1[n1].type = DB1_STR;
        vals1[n1].nul = 0;
        vals1[n1].val.str_val = _c->c;
@@ -738,13 +738,13 @@ int db_update_ucontact_addr(ucontact_t* _c)
        switch (ul_matching_mode) {
                case CONTACT_ONLY:
                        /* update call-id */
-                       keys2[nr_cols2] = &callid_col;
+                       keys2[nr_cols2] = &ul_callid_col;
                        vals2[nr_cols2].type = DB1_STR;
                        vals2[nr_cols2].nul = 0;
                        vals2[nr_cols2].val.str_val = _c->callid;
                        nr_cols2++;
                        /* update path */
-                       keys2[nr_cols2] = &path_col;
+                       keys2[nr_cols2] = &ul_path_col;
                        vals2[nr_cols2].type = DB1_STR;
                        if (_c->path.s == 0) {
                                vals2[nr_cols2].nul = 1;
@@ -755,14 +755,14 @@ int db_update_ucontact_addr(ucontact_t* _c)
                        nr_cols2++;
                        break;
                case CONTACT_CALLID:
-                       keys1[n1] = &callid_col;
+                       keys1[n1] = &ul_callid_col;
                        vals1[n1].type = DB1_STR;
                        vals1[n1].nul = 0;
                        vals1[n1].val.str_val = _c->callid;
                        LM_DBG("callid:%.*s\n", vals1[n1].val.str_val.len, vals1[n1].val.str_val.s);
                        n1++;
                        /* update path */
-                       keys2[nr_cols2] = &path_col;
+                       keys2[nr_cols2] = &ul_path_col;
                        vals2[nr_cols2].type = DB1_STR;
                        if (_c->path.s == 0) {
                                vals2[nr_cols2].nul = 1;
@@ -773,7 +773,7 @@ int db_update_ucontact_addr(ucontact_t* _c)
                        nr_cols2++;
                        break;
                case CONTACT_PATH:
-                       keys1[n1] = &path_col;
+                       keys1[n1] = &ul_path_col;
                        vals1[n1].type = DB1_STR;
                        if (_c->path.s == 0) {
                                vals1[n1].nul = 1;
@@ -785,7 +785,7 @@ int db_update_ucontact_addr(ucontact_t* _c)
                        }
                        n1++;
                        /* update call-id */
-                       keys2[nr_cols2] = &callid_col;
+                       keys2[nr_cols2] = &ul_callid_col;
                        vals2[nr_cols2].type = DB1_STR;
                        vals2[nr_cols2].nul = 0;
                        vals2[nr_cols2].val.str_val = _c->callid;
@@ -796,42 +796,42 @@ int db_update_ucontact_addr(ucontact_t* _c)
                        return -1;
        }
 
-       keys2[nr_cols2] = &expires_col;
+       keys2[nr_cols2] = &ul_expires_col;
        vals2[nr_cols2].nul = 0;
        UL_DB_EXPIRES_SET(&vals2[nr_cols2], _c->expires);
        nr_cols2++;
 
-       keys2[nr_cols2] = &q_col;
+       keys2[nr_cols2] = &ul_q_col;
        vals2[nr_cols2].type = DB1_DOUBLE;
        vals2[nr_cols2].nul = 0;
        vals2[nr_cols2].val.double_val = q2double(_c->q);
        nr_cols2++;
 
-       keys2[nr_cols2] = &cseq_col;
+       keys2[nr_cols2] = &ul_cseq_col;
        vals2[nr_cols2].type = DB1_INT;
        vals2[nr_cols2].nul = 0;
        vals2[nr_cols2].val.int_val = _c->cseq;
        nr_cols2++;
 
-       keys2[nr_cols2] = &flags_col;
+       keys2[nr_cols2] = &ul_flags_col;
        vals2[nr_cols2].type = DB1_INT;
        vals2[nr_cols2].nul = 0;
        vals2[nr_cols2].val.bitmap_val = _c->flags;
        nr_cols2++;
 
-       keys2[nr_cols2] = &cflags_col;
+       keys2[nr_cols2] = &ul_cflags_col;
        vals2[nr_cols2].type = DB1_INT;
        vals2[nr_cols2].nul = 0;
        vals2[nr_cols2].val.bitmap_val = _c->cflags;
        nr_cols2++;
 
-       keys2[nr_cols2] = &user_agent_col;
+       keys2[nr_cols2] = &ul_user_agent_col;
        vals2[nr_cols2].type = DB1_STR;
        vals2[nr_cols2].nul = 0;
        vals2[nr_cols2].val.str_val = _c->user_agent;
        nr_cols2++;
 
-       keys2[nr_cols2] = &received_col;
+       keys2[nr_cols2] = &ul_received_col;
        vals2[nr_cols2].type = DB1_STR;
        if (_c->received.s == 0) {
                vals2[nr_cols2].nul = 1;
@@ -841,7 +841,7 @@ int db_update_ucontact_addr(ucontact_t* _c)
        }
        nr_cols2++;
 
-       keys2[nr_cols2] = &sock_col;
+       keys2[nr_cols2] = &ul_sock_col;
        vals2[nr_cols2].type = DB1_STR;
        if (_c->sock) {
                vals2[nr_cols2].val.str_val = _c->sock->sock_str;
@@ -851,7 +851,7 @@ int db_update_ucontact_addr(ucontact_t* _c)
        }
        nr_cols2++;
 
-       keys2[nr_cols2] = &methods_col;
+       keys2[nr_cols2] = &ul_methods_col;
        vals2[nr_cols2].type = DB1_BITMAP;
        if (_c->methods == 0xFFFFFFFF) {
                vals2[nr_cols2].nul = 1;
@@ -861,12 +861,12 @@ int db_update_ucontact_addr(ucontact_t* _c)
        }
        nr_cols2++;
 
-       keys2[nr_cols2] = &last_mod_col;
+       keys2[nr_cols2] = &ul_last_mod_col;
        vals2[nr_cols2].nul = 0;
        UL_DB_EXPIRES_SET(&vals2[nr_cols2], _c->last_modified);
        nr_cols2++;
 
-       keys2[nr_cols2] = &ruid_col;
+       keys2[nr_cols2] = &ul_ruid_col;
        vals2[nr_cols2].type = DB1_STR;
        if(_c->ruid.len>0)
        {
@@ -877,7 +877,7 @@ int db_update_ucontact_addr(ucontact_t* _c)
        }
        nr_cols2++;
 
-       keys2[nr_cols2] = &instance_col;
+       keys2[nr_cols2] = &ul_instance_col;
        vals2[nr_cols2].type = DB1_STR;
        if(_c->instance.len>0)
        {
@@ -888,39 +888,39 @@ int db_update_ucontact_addr(ucontact_t* _c)
        }
        nr_cols2++;
 
-       keys2[nr_cols2] = &reg_id_col;
+       keys2[nr_cols2] = &ul_reg_id_col;
        vals2[nr_cols2].type = DB1_INT;
        vals2[nr_cols2].nul = 0;
        vals2[nr_cols2].val.int_val = (int)_c->reg_id;
        nr_cols2++;
 
-       keys2[nr_cols2] = &srv_id_col;
+       keys2[nr_cols2] = &ul_srv_id_col;
        vals2[nr_cols2].type = DB1_INT;
        vals2[nr_cols2].nul = 0;
        vals2[nr_cols2].val.int_val = (int)_c->server_id;
        nr_cols2++;
 
-       keys2[nr_cols2] = &con_id_col;
+       keys2[nr_cols2] = &ul_con_id_col;
        vals2[nr_cols2].type = DB1_INT;
        vals2[nr_cols2].nul = 0;
        vals2[nr_cols2].val.int_val = (int)_c->tcpconn_id;
        nr_cols2++;
 
-       keys2[nr_cols2] = &keepalive_col;
+       keys2[nr_cols2] = &ul_keepalive_col;
        vals2[nr_cols2].type = DB1_INT;
        vals2[nr_cols2].nul = 0;
        vals2[nr_cols2].val.int_val = (int)_c->keepalive;
        nr_cols2++;
 
-       keys2[nr_cols2] = &contact_col;
+       keys2[nr_cols2] = &ul_contact_col;
        vals2[nr_cols2].type = DB1_STR;
        vals2[nr_cols2].nul = 0;
        vals2[nr_cols2].val.str_val = _c->c;
        LM_DBG("contact:%.*s\n", vals2[nr_cols2].val.str_val.len, vals2[nr_cols2].val.str_val.s);
        nr_cols2++;
 
-       if (use_domain) {
-               keys1[n1] = &domain_col;
+       if (ul_use_domain) {
+               keys1[n1] = &ul_domain_col;
                vals1[n1].type = DB1_STR;
                vals1[n1].nul = 0;
                dom = memchr(_c->aor->s, '@', _c->aor->len);
@@ -957,17 +957,17 @@ int db_update_ucontact_addr(ucontact_t* _c)
        }
        /* delete old db attrs and add the current list */
        if (ul_xavp_contact_name.s) {
-               if (use_domain) {
+               if (ul_use_domain) {
                        uldb_delete_attrs(_c->domain, &vals1[0].val.str_val,
-                                         &vals1[n1-1].val.str_val, &_c->ruid);
+                                       &vals1[n1-1].val.str_val, &_c->ruid);
                        uldb_insert_attrs(_c->domain, &vals1[0].val.str_val,
-                                         &vals1[n1-1].val.str_val,
-                                         &_c->ruid, _c->xavp);
+                                       &vals1[n1-1].val.str_val,
+                                       &_c->ruid, _c->xavp);
                } else {
                        uldb_delete_attrs(_c->domain, &vals1[0].val.str_val,
-                                         NULL, &_c->ruid);
+                                       NULL, &_c->ruid);
                        uldb_insert_attrs(_c->domain, &vals1[0].val.str_val,
-                                         NULL, &_c->ruid, _c->xavp);
+                                       NULL, &_c->ruid, _c->xavp);
                }
        }
 
@@ -1002,7 +1002,7 @@ int db_update_ucontact_ruid(ucontact_t* _c)
        }
 
        n1 = 0;
-       keys1[n1] = &ruid_col;
+       keys1[n1] = &ul_ruid_col;
        vals1[n1].type = DB1_STR;
        vals1[n1].nul = 0;
        vals1[n1].val.str_val = _c->ruid;
@@ -1010,42 +1010,42 @@ int db_update_ucontact_ruid(ucontact_t* _c)
        n1++;
 
        n2 = 0;
-       keys2[n2] = &expires_col;
+       keys2[n2] = &ul_expires_col;
        vals2[n2].nul = 0;
        UL_DB_EXPIRES_SET(&vals2[n2], _c->expires);
        n2++;
 
-       keys2[n2] = &q_col;
+       keys2[n2] = &ul_q_col;
        vals2[n2].type = DB1_DOUBLE;
        vals2[n2].nul = 0;
        vals2[n2].val.double_val = q2double(_c->q);
        n2++;
 
-       keys2[n2] = &cseq_col;
+       keys2[n2] = &ul_cseq_col;
        vals2[n2].type = DB1_INT;
        vals2[n2].nul = 0;
        vals2[n2].val.int_val = _c->cseq;
        n2++;
 
-       keys2[n2] = &flags_col;
+       keys2[n2] = &ul_flags_col;
        vals2[n2].type = DB1_INT;
        vals2[n2].nul = 0;
        vals2[n2].val.bitmap_val = _c->flags;
        n2++;
 
-       keys2[n2] = &cflags_col;
+       keys2[n2] = &ul_cflags_col;
        vals2[n2].type = DB1_INT;
        vals2[n2].nul = 0;
        vals2[n2].val.bitmap_val = _c->cflags;
        n2++;
 
-       keys2[n2] = &user_agent_col;
+       keys2[n2] = &ul_user_agent_col;
        vals2[n2].type = DB1_STR;
        vals2[n2].nul = 0;
        vals2[n2].val.str_val = _c->user_agent;
        n2++;
 
-       keys2[n2] = &received_col;
+       keys2[n2] = &ul_received_col;
        vals2[n2].type = DB1_STR;
        if (_c->received.s == 0) {
                vals2[n2].nul = 1;
@@ -1055,7 +1055,7 @@ int db_update_ucontact_ruid(ucontact_t* _c)
        }
        n2++;
 
-       keys2[n2] = &path_col;
+       keys2[n2] = &ul_path_col;
        vals2[n2].type = DB1_STR;
        if (_c->path.s == 0) {
                vals2[n2].nul = 1;
@@ -1065,7 +1065,7 @@ int db_update_ucontact_ruid(ucontact_t* _c)
        }
        n2++;
 
-       keys2[n2] = &sock_col;
+       keys2[n2] = &ul_sock_col;
        vals2[n2].type = DB1_STR;
        if (_c->sock) {
                vals2[n2].val.str_val = _c->sock->sock_str;
@@ -1075,7 +1075,7 @@ int db_update_ucontact_ruid(ucontact_t* _c)
        }
        n2++;
 
-       keys2[n2] = &methods_col;
+       keys2[n2] = &ul_methods_col;
        vals2[n2].type = DB1_BITMAP;
        if (_c->methods == 0xFFFFFFFF) {
                vals2[n2].nul = 1;
@@ -1085,18 +1085,18 @@ int db_update_ucontact_ruid(ucontact_t* _c)
        }
        n2++;
 
-       keys2[n2] = &last_mod_col;
+       keys2[n2] = &ul_last_mod_col;
        vals2[n2].nul = 0;
        UL_DB_EXPIRES_SET(&vals2[n2], _c->last_modified);
        n2++;
 
-       keys2[n2] = &callid_col;
+       keys2[n2] = &ul_callid_col;
        vals2[n2].type = DB1_STR;
        vals2[n2].nul = 0;
        vals2[n2].val.str_val = _c->callid;
        n2++;
 
-       keys2[n2] = &instance_col;
+       keys2[n2] = &ul_instance_col;
        vals2[n2].type = DB1_STR;
        if(_c->instance.len>0)
        {
@@ -1107,31 +1107,31 @@ int db_update_ucontact_ruid(ucontact_t* _c)
        }
        n2++;
 
-       keys2[n2] = &reg_id_col;
+       keys2[n2] = &ul_reg_id_col;
        vals2[n2].type = DB1_INT;
        vals2[n2].nul = 0;
        vals2[n2].val.int_val = (int)_c->reg_id;
        n2++;
 
-       keys2[n2] = &srv_id_col;
+       keys2[n2] = &ul_srv_id_col;
        vals2[n2].type = DB1_INT;
        vals2[n2].nul = 0;
        vals2[n2].val.int_val = (int)_c->server_id;
        n2++;
 
-       keys2[n2] = &con_id_col;
+       keys2[n2] = &ul_con_id_col;
        vals2[n2].type = DB1_INT;
        vals2[n2].nul = 0;
        vals2[n2].val.int_val = (int)_c->tcpconn_id;
        n2++;
 
-       keys2[n2] = &keepalive_col;
+       keys2[n2] = &ul_keepalive_col;
        vals2[n2].type = DB1_INT;
        vals2[n2].nul = 0;
        vals2[n2].val.int_val = (int)_c->keepalive;
        n2++;
 
-       keys2[n2] = &contact_col;
+       keys2[n2] = &ul_contact_col;
        vals2[n2].type = DB1_STR;
        vals2[n2].nul = 0;
        vals2[n2].val.str_val = _c->c;
@@ -1160,8 +1160,8 @@ int db_update_ucontact_ruid(ucontact_t* _c)
 
        /* delete old db attrs and add the current list */
        if (ul_xavp_contact_name.s) {
-               auser = *_c->aor;
-               if (use_domain) {
+               auser = *_c->aor;
+               if (ul_use_domain) {
                        adomain.s = memchr(_c->aor->s, '@', _c->aor->len);
                        if (adomain.s==0) {
                                auser.len = 0;
@@ -1174,14 +1174,14 @@ int db_update_ucontact_ruid(ucontact_t* _c)
                        }
 
                        uldb_delete_attrs(_c->domain, &auser,
-                                         &adomain, &_c->ruid);
+                                       &adomain, &_c->ruid);
                        uldb_insert_attrs(_c->domain, &auser,
-                                         &adomain, &_c->ruid, _c->xavp);
+                                       &adomain, &_c->ruid, _c->xavp);
                } else {
                        uldb_delete_attrs(_c->domain, &auser,
-                                         NULL, &_c->ruid);
+                                       NULL, &_c->ruid);
                        uldb_insert_attrs(_c->domain, &auser,
-                                         NULL, &_c->ruid, _c->xavp);
+                                       NULL, &_c->ruid, _c->xavp);
                }
        }
 
@@ -1216,21 +1216,21 @@ int db_update_ucontact_instance(ucontact_t* _c)
        }
 
        n1 = 0;
-       keys1[n1] = &user_col;
+       keys1[n1] = &ul_user_col;
        vals1[n1].type = DB1_STR;
        vals1[n1].nul = 0;
        vals1[n1].val.str_val = *_c->aor;
        LM_DBG("aor:%.*s\n", vals1[n1].val.str_val.len, vals1[n1].val.str_val.s);
        n1++;
 
-       keys1[n1] = &instance_col;
+       keys1[n1] = &ul_instance_col;
        vals1[n1].type = DB1_STR;
        vals1[n1].nul = 0;
        vals1[n1].val.str_val = _c->instance;
        LM_DBG("instance:%.*s\n", vals1[n1].val.str_val.len, vals1[n1].val.str_val.s);
        n1++;
 
-       keys1[n1] = &reg_id_col;
+       keys1[n1] = &ul_reg_id_col;
        vals1[n1].type = DB1_INT;
        vals1[n1].nul = 0;
        vals1[n1].val.int_val = (int)_c->reg_id;
@@ -1238,42 +1238,42 @@ int db_update_ucontact_instance(ucontact_t* _c)
        n1++;
 
        n2 = 0;
-       keys2[n2] = &expires_col;
+       keys2[n2] = &ul_expires_col;
        vals2[n2].nul = 0;
        UL_DB_EXPIRES_SET(&vals2[n2], _c->expires);
        n2++;
 
-       keys2[n2] = &q_col;
+       keys2[n2] = &ul_q_col;
        vals2[n2].type = DB1_DOUBLE;
        vals2[n2].nul = 0;
        vals2[n2].val.double_val = q2double(_c->q);
        n2++;
 
-       keys2[n2] = &cseq_col;
+       keys2[n2] = &ul_cseq_col;
        vals2[n2].type = DB1_INT;
        vals2[n2].nul = 0;
        vals2[n2].val.int_val = _c->cseq;
        n2++;
 
-       keys2[n2] = &flags_col;
+       keys2[n2] = &ul_flags_col;
        vals2[n2].type = DB1_INT;
        vals2[n2].nul = 0;
        vals2[n2].val.bitmap_val = _c->flags;
        n2++;
 
-       keys2[n2] = &cflags_col;
+       keys2[n2] = &ul_cflags_col;
        vals2[n2].type = DB1_INT;
        vals2[n2].nul = 0;
        vals2[n2].val.bitmap_val = _c->cflags;
        n2++;
 
-       keys2[n2] = &user_agent_col;
+       keys2[n2] = &ul_user_agent_col;
        vals2[n2].type = DB1_STR;
        vals2[n2].nul = 0;
        vals2[n2].val.str_val = _c->user_agent;
        n2++;
 
-       keys2[n2] = &received_col;
+       keys2[n2] = &ul_received_col;
        vals2[n2].type = DB1_STR;
        if (_c->received.s == 0) {
                vals2[n2].nul = 1;
@@ -1283,7 +1283,7 @@ int db_update_ucontact_instance(ucontact_t* _c)
        }
        n2++;
 
-       keys2[n2] = &path_col;
+       keys2[n2] = &ul_path_col;
        vals2[n2].type = DB1_STR;
        if (_c->path.s == 0) {
                vals2[n2].nul = 1;
@@ -1293,7 +1293,7 @@ int db_update_ucontact_instance(ucontact_t* _c)
        }
        n2++;
 
-       keys2[n2] = &sock_col;
+       keys2[n2] = &ul_sock_col;
        vals2[n2].type = DB1_STR;
        if (_c->sock) {
                vals2[n2].val.str_val = _c->sock->sock_str;
@@ -1303,7 +1303,7 @@ int db_update_ucontact_instance(ucontact_t* _c)
        }
        n2++;
 
-       keys2[n2] = &methods_col;
+       keys2[n2] = &ul_methods_col;
        vals2[n2].type = DB1_BITMAP;
        if (_c->methods == 0xFFFFFFFF) {
                vals2[n2].nul = 1;
@@ -1313,36 +1313,36 @@ int db_update_ucontact_instance(ucontact_t* _c)
        }
        n2++;
 
-       keys2[n2] = &last_mod_col;
+       keys2[n2] = &ul_last_mod_col;
        vals2[n2].nul = 0;
        UL_DB_EXPIRES_SET(&vals2[n2], _c->last_modified);
        n2++;
 
-       keys2[n2] = &callid_col;
+       keys2[n2] = &ul_callid_col;
        vals2[n2].type = DB1_STR;
        vals2[n2].nul = 0;
        vals2[n2].val.str_val = _c->callid;
        n2++;
 
-       keys2[n2] = &srv_id_col;
+       keys2[n2] = &ul_srv_id_col;
        vals2[n2].type = DB1_INT;
        vals2[n2].nul = 0;
        vals2[n2].val.bitmap_val = _c->server_id;
        n2++;
 
-       keys2[n2] = &con_id_col;
+       keys2[n2] = &ul_con_id_col;
        vals2[n2].type = DB1_INT;
        vals2[n2].nul = 0;
        vals2[n2].val.bitmap_val = _c->tcpconn_id;
        n2++;
 
-       keys2[n2] = &keepalive_col;
+       keys2[n2] = &ul_keepalive_col;
        vals2[n2].type = DB1_INT;
        vals2[n2].nul = 0;
        vals2[n2].val.bitmap_val = _c->keepalive;
        n2++;
 
-       keys2[n2] = &contact_col;
+       keys2[n2] = &ul_contact_col;
        vals2[n2].type = DB1_STR;
        vals2[n2].nul = 0;
        vals2[n2].val.str_val.s = _c->c.s;
@@ -1351,8 +1351,8 @@ int db_update_ucontact_instance(ucontact_t* _c)
        n2++;
 
        auser = *_c->aor;
-       if (use_domain) {
-               keys1[n1] = &domain_col;
+       if (ul_use_domain) {
+               keys1[n1] = &ul_domain_col;
                vals1[n1].type = DB1_STR;
                vals1[n1].nul = 0;
                adomain.s = memchr(_c->aor->s, '@', _c->aor->len);
@@ -1396,16 +1396,16 @@ int db_update_ucontact_instance(ucontact_t* _c)
 
        /* delete old db attrs and add the current list */
        if (ul_xavp_contact_name.s) {
-           if (use_domain) {
+               if (ul_use_domain) {
                        uldb_delete_attrs(_c->domain, &auser,
-                                         &adomain, &_c->ruid);
+                                       &adomain, &_c->ruid);
                        uldb_insert_attrs(_c->domain, &auser,
-                                         &adomain, &_c->ruid, _c->xavp);
+                                       &adomain, &_c->ruid, _c->xavp);
                } else {
                        uldb_delete_attrs(_c->domain, &auser,
-                                         NULL, &_c->ruid);
+                                       NULL, &_c->ruid);
                        uldb_insert_attrs(_c->domain, &auser,
-                                         NULL, &_c->ruid, _c->xavp);
+                                       NULL, &_c->ruid, _c->xavp);
                }
        }
 
@@ -1448,13 +1448,13 @@ int db_delete_ucontact_addr(ucontact_t* _c)
 
 
        n = 0;
-       keys[n] = &user_col;
+       keys[n] = &ul_user_col;
        vals[n].type = DB1_STR;
        vals[n].nul = 0;
        vals[n].val.str_val = *_c->aor;
        n++;
 
-       keys[n] = &contact_col;
+       keys[n] = &ul_contact_col;
        vals[n].type = DB1_STR;
        vals[n].nul = 0;
        vals[n].val.str_val = _c->c;
@@ -1464,14 +1464,14 @@ int db_delete_ucontact_addr(ucontact_t* _c)
                case CONTACT_ONLY:
                        break;
                case CONTACT_CALLID:
-                       keys[n] = &callid_col;
+                       keys[n] = &ul_callid_col;
                        vals[n].type = DB1_STR;
                        vals[n].nul = 0;
                        vals[n].val.str_val = _c->callid;
                        n++;
                        break;
                case CONTACT_PATH:
-                       keys[n] = &path_col;
+                       keys[n] = &ul_path_col;
                        vals[n].type = DB1_STR;
                        if (_c->path.s == 0) {
                                vals[n].nul = 1;
@@ -1486,26 +1486,26 @@ int db_delete_ucontact_addr(ucontact_t* _c)
                        return -1;
        }
 
-       if (use_domain) {
-           keys[n] = &domain_col;
-           vals[n].type = DB1_STR;
-           vals[n].nul = 0;
-           dom = memchr(_c->aor->s, '@', _c->aor->len);
-           if (dom==0) {
-               vals[0].val.str_val.len = 0;
-               vals[n].val.str_val = *_c->aor;
-           } else {
-               vals[0].val.str_val.len = dom - _c->aor->s;
-               vals[n].val.str_val.s = dom + 1;
-               vals[n].val.str_val.len = _c->aor->s +
-                   _c->aor->len - dom - 1;
-           }
-           uldb_delete_attrs(_c->domain, &vals[0].val.str_val,
-                             &vals[n].val.str_val, &_c->ruid);
-           n++;
+       if (ul_use_domain) {
+               keys[n] = &ul_domain_col;
+               vals[n].type = DB1_STR;
+               vals[n].nul = 0;
+               dom = memchr(_c->aor->s, '@', _c->aor->len);
+               if (dom==0) {
+                       vals[0].val.str_val.len = 0;
+                       vals[n].val.str_val = *_c->aor;
+               } else {
+                       vals[0].val.str_val.len = dom - _c->aor->s;
+                       vals[n].val.str_val.s = dom + 1;
+                       vals[n].val.str_val.len = _c->aor->s +
+                               _c->aor->len - dom - 1;
+               }
+               uldb_delete_attrs(_c->domain, &vals[0].val.str_val,
+                               &vals[n].val.str_val, &_c->ruid);
+               n++;
        } else {
-           uldb_delete_attrs(_c->domain, &vals[0].val.str_val,
-                             NULL, &_c->ruid);
+               uldb_delete_attrs(_c->domain, &vals[0].val.str_val,
+                               NULL, &_c->ruid);
        }
 
        if (ul_dbf.use_table(ul_dbh, _c->domain) < 0) {
@@ -1542,7 +1542,7 @@ int db_delete_ucontact_ruid(ucontact_t* _c)
        }
 
        n = 0;
-       keys[n] = &ruid_col;
+       keys[n] = &ul_ruid_col;
        vals[n].type = DB1_STR;
        vals[n].nul = 0;
        vals[n].val.str_val = _c->ruid;
@@ -1606,7 +1606,7 @@ static inline void update_contact_pos(struct urecord* _r, ucontact_t* _c)
 {
        ucontact_t *pos, *ppos;
 
-       if (desc_time_order) {
+       if (ul_desc_time_order) {
                /* order by time - first the newest */
                if (_c->prev==0)
                        return;
@@ -1685,7 +1685,7 @@ int update_ucontact(struct urecord* _r, ucontact_t* _c, ucontact_info_t* _ci)
                return -1;
        }
 
-       if (db_mode==DB_ONLY) {
+       if (ul_db_mode==DB_ONLY) {
                /* urecord is static generate a copy for later */
                if (_r) memcpy(&_ur, _r, sizeof(struct urecord));
                if (update_contact_db(_c) < 0) return -1;
@@ -1699,7 +1699,7 @@ int update_ucontact(struct urecord* _r, ucontact_t* _c, ucontact_info_t* _ci)
        }
 
        if (_r) {
-               if (db_mode!=DB_ONLY) {
+               if (ul_db_mode!=DB_ONLY) {
                        update_contact_pos( _r, _c);
                } else {
                        /* urecord was static restore copy */
@@ -1709,7 +1709,7 @@ int update_ucontact(struct urecord* _r, ucontact_t* _c, ucontact_info_t* _ci)
 
        st_update_ucontact(_c);
 
-       if (db_mode == WRITE_THROUGH) {
+       if (ul_db_mode == WRITE_THROUGH) {
                if (update_contact_db(_c) < 0) return -1;
        }
        return 0;
@@ -1765,7 +1765,7 @@ int uldb_delete_attrs(str* _dname, str *_user, str *_domain, str *_ruid)
        vals[1].nul = 0;
        vals[1].val.str_val = *_ruid;
 
-       if (use_domain) {
+       if (ul_use_domain) {
                vals[2].type = DB1_STR;
                vals[2].nul = 0;
                vals[2].val.str_val = *_domain;
@@ -1776,7 +1776,7 @@ int uldb_delete_attrs(str* _dname, str *_user, str *_domain, str *_ruid)
                return -1;
        }
 
-       if (ul_dbf.delete(ul_dbh, keys, 0, vals, (use_domain) ? (3) : (2)) < 0) {
+       if (ul_dbf.delete(ul_dbh, keys, 0, vals, (ul_use_domain) ? (3) : (2)) < 0) {
                LM_ERR("deleting from database failed\n");
                return -1;
        }
@@ -1903,7 +1903,7 @@ int uldb_insert_attrs(str *_dname, str *_user, str *_domain,
        vals[2].nul = 0;
        UL_DB_EXPIRES_SET(&vals[2], time(NULL));
 
-       if (use_domain && _domain!=NULL && _domain->s!=NULL) {
+       if (ul_use_domain && _domain!=NULL && _domain->s!=NULL) {
                nr_cols = 7;
                vals[6].type = DB1_STR;
                vals[6].nul = 0;
index 59ddff9..4d8f5fc 100644 (file)
@@ -318,7 +318,7 @@ static inline ucontact_info_t* dbrow2info(db_val_t *vals, str *contact, int rcon
                ci.sock = grep_sock_info( &host, (unsigned short)port, proto);
                if (ci.sock==0) {
                        LM_DBG("non-local socket <%s>...ignoring\n", p);
-                       if (skip_remote_socket) {
+                       if (ul_skip_remote_socket) {
                                return 0;
                        }
                }
@@ -400,27 +400,27 @@ int preload_udomain(db1_con_t* _c, udomain_t* _d)
        urecord_t* r;
        ucontact_t* c;
 
-       columns[0] = &user_col;
-       columns[1] = &contact_col;
-       columns[2] = &expires_col;
-       columns[3] = &q_col;
-       columns[4] = &callid_col;
-       columns[5] = &cseq_col;
-       columns[6] = &flags_col;
-       columns[7] = &cflags_col;
-       columns[8] = &user_agent_col;
-       columns[9] = &received_col;
-       columns[10] = &path_col;
-       columns[11] = &sock_col;
-       columns[12] = &methods_col;
-       columns[13] = &last_mod_col;
-       columns[14] = &ruid_col;
-       columns[15] = &instance_col;
-       columns[16] = &reg_id_col;
-       columns[17] = &srv_id_col;
-       columns[18] = &con_id_col;
-       columns[19] = &keepalive_col;
-       columns[20] = &domain_col;
+       columns[0] = &ul_user_col;
+       columns[1] = &ul_contact_col;
+       columns[2] = &ul_expires_col;
+       columns[3] = &ul_q_col;
+       columns[4] = &ul_callid_col;
+       columns[5] = &ul_cseq_col;
+       columns[6] = &ul_flags_col;
+       columns[7] = &ul_cflags_col;
+       columns[8] = &ul_user_agent_col;
+       columns[9] = &ul_received_col;
+       columns[10] = &ul_path_col;
+       columns[11] = &ul_sock_col;
+       columns[12] = &ul_methods_col;
+       columns[13] = &ul_last_mod_col;
+       columns[14] = &ul_ruid_col;
+       columns[15] = &ul_instance_col;
+       columns[16] = &ul_reg_id_col;
+       columns[17] = &ul_srv_id_col;
+       columns[18] = &ul_con_id_col;
+       columns[19] = &ul_keepalive_col;
+       columns[20] = &ul_domain_col;
 
        if (ul_dbf.use_table(_c, _d->name) < 0) {
                LM_ERR("sql use_table failed\n");
@@ -433,7 +433,7 @@ int preload_udomain(db1_con_t* _c, udomain_t* _d)
 
        if (ul_db_srvid) {
                LM_NOTICE("filtered by server_id[%d]\n", server_id);
-               keys[0] = &srv_id_col;
+               keys[0] = &ul_srv_id_col;
                ops[0] = OP_EQ;
                vals[0].type = DB1_INT;
                vals[0].nul = 0;
@@ -444,7 +444,7 @@ int preload_udomain(db1_con_t* _c, udomain_t* _d)
                if (ul_dbf.query(_c, (ul_db_srvid)?(keys):(0),
                                                        (ul_db_srvid)?(ops):(0), (ul_db_srvid)?(vals):(0),
                                                        columns, (ul_db_srvid)?(1):(0),
-                                                       (use_domain)?(21):(20), 0, 0) < 0)
+                                                       (ul_use_domain)?(21):(20), 0, 0) < 0)
                {
                        LM_ERR("db_query (1) failed\n");
                        return -1;
@@ -457,7 +457,7 @@ int preload_udomain(db1_con_t* _c, udomain_t* _d)
                if (ul_dbf.query(_c, (ul_db_srvid)?(keys):(0),
                                                        (ul_db_srvid)?(ops):(0), (ul_db_srvid)?(vals):(0),
                                                        columns, (ul_db_srvid)?(1):(0),
-                                                       (use_domain)?(21):(20), 0, &res) < 0)
+                                                       (ul_use_domain)?(21):(20), 0, &res) < 0)
                {
                        LM_ERR("db_query failed\n");
                        return -1;
@@ -492,7 +492,7 @@ int preload_udomain(db1_con_t* _c, udomain_t* _d)
                                continue;
                        }
 
-                       if (use_domain) {
+                       if (ul_use_domain) {
                                domain = (char*)VAL_STRING(ROW_VALUES(row) + 20);
                                if (VAL_NULL(ROW_VALUES(row)+17) || domain==0 || domain[0]==0){
                                        LM_CRIT("empty domain record for user %.*s...skipping\n",
@@ -585,11 +585,11 @@ urecord_t* db_load_urecord(db1_con_t* _c, udomain_t* _d, str *_aor)
        urecord_t* r;
        ucontact_t* c;
 
-       keys[0] = &user_col;
+       keys[0] = &ul_user_col;
        vals[0].type = DB1_STR;
        vals[0].nul = 0;
-       if (use_domain) {
-               keys[1] = &domain_col;
+       if (ul_use_domain) {
+               keys[1] = &ul_domain_col;
                vals[1].type = DB1_STR;
                vals[1].nul = 0;
                domain = memchr(_aor->s, '@', _aor->len);
@@ -606,37 +606,37 @@ urecord_t* db_load_urecord(db1_con_t* _c, udomain_t* _d, str *_aor)
                vals[0].val.str_val = *_aor;
        }
 
-       columns[0] = &contact_col;
-       columns[1] = &expires_col;
-       columns[2] = &q_col;
-       columns[3] = &callid_col;
-       columns[4] = &cseq_col;
-       columns[5] = &flags_col;
-       columns[6] = &cflags_col;
-       columns[7] = &user_agent_col;
-       columns[8] = &received_col;
-       columns[9] = &path_col;
-       columns[10] = &sock_col;
-       columns[11] = &methods_col;
-       columns[12] = &last_mod_col;
-       columns[13] = &ruid_col;
-       columns[14] = &instance_col;
-       columns[15] = &reg_id_col;
-       columns[16] = &srv_id_col;
-       columns[17] = &con_id_col;
-       columns[18] = &keepalive_col;
-
-       if (desc_time_order)
-               order = &last_mod_col;
+       columns[0] = &ul_contact_col;
+       columns[1] = &ul_expires_col;
+       columns[2] = &ul_q_col;
+       columns[3] = &ul_callid_col;
+       columns[4] = &ul_cseq_col;
+       columns[5] = &ul_flags_col;
+       columns[6] = &ul_cflags_col;
+       columns[7] = &ul_user_agent_col;
+       columns[8] = &ul_received_col;
+       columns[9] = &ul_path_col;
+       columns[10] = &ul_sock_col;
+       columns[11] = &ul_methods_col;
+       columns[12] = &ul_last_mod_col;
+       columns[13] = &ul_ruid_col;
+       columns[14] = &ul_instance_col;
+       columns[15] = &ul_reg_id_col;
+       columns[16] = &ul_srv_id_col;
+       columns[17] = &ul_con_id_col;
+       columns[18] = &ul_keepalive_col;
+
+       if (ul_desc_time_order)
+               order = &ul_last_mod_col;
        else
-               order = &q_col;
+               order = &ul_q_col;
 
        if (ul_dbf.use_table(_c, _d->name) < 0) {
                LM_ERR("failed to use table %.*s\n", _d->name->len, _d->name->s);
                return 0;
        }
 
-       if (ul_dbf.query(_c, keys, 0, vals, columns, (use_domain)?2:1, 19, order,
+       if (ul_dbf.query(_c, keys, 0, vals, columns, (ul_use_domain)?2:1, 19, order,
                                &res) < 0) {
                LM_ERR("db_query failed\n");
                return 0;
@@ -785,37 +785,37 @@ urecord_t* db_load_urecord_by_ruid(db1_con_t* _c, udomain_t* _d, str *_ruid)
        urecord_t* r;
        ucontact_t* c;
 
-       keys[0] = &ruid_col;
+       keys[0] = &ul_ruid_col;
        vals[0].type = DB1_STR;
        vals[0].nul = 0;
        vals[0].val.str_val = *_ruid;
 
-       columns[0] = &contact_col;
-       columns[1] = &expires_col;
-       columns[2] = &q_col;
-       columns[3] = &callid_col;
-       columns[4] = &cseq_col;
-       columns[5] = &flags_col;
-       columns[6] = &cflags_col;
-       columns[7] = &user_agent_col;
-       columns[8] = &received_col;
-       columns[9] = &path_col;
-       columns[10] = &sock_col;
-       columns[11] = &methods_col;
-       columns[12] = &last_mod_col;
-       columns[13] = &ruid_col;
-       columns[14] = &instance_col;
-       columns[15] = &reg_id_col;
-       columns[16] = &srv_id_col;
-       columns[17] = &con_id_col;
-       columns[18] = &keepalive_col;
-       columns[19] = &user_col;
-       columns[20] = &domain_col;
-
-       if (desc_time_order)
-               order = &last_mod_col;
+       columns[0] = &ul_contact_col;
+       columns[1] = &ul_expires_col;
+       columns[2] = &ul_q_col;
+       columns[3] = &ul_callid_col;
+       columns[4] = &ul_cseq_col;
+       columns[5] = &ul_flags_col;
+       columns[6] = &ul_cflags_col;
+       columns[7] = &ul_user_agent_col;
+       columns[8] = &ul_received_col;
+       columns[9] = &ul_path_col;
+       columns[10] = &ul_sock_col;
+       columns[11] = &ul_methods_col;
+       columns[12] = &ul_last_mod_col;
+       columns[13] = &ul_ruid_col;
+       columns[14] = &ul_instance_col;
+       columns[15] = &ul_reg_id_col;
+       columns[16] = &ul_srv_id_col;
+       columns[17] = &ul_con_id_col;
+       columns[18] = &ul_keepalive_col;
+       columns[19] = &ul_user_col;
+       columns[20] = &ul_domain_col;
+
+       if (ul_desc_time_order)
+               order = &ul_last_mod_col;
        else
-               order = &q_col;
+               order = &ul_q_col;
 
        if (ul_dbf.use_table(_c, _d->name) < 0) {
                LM_ERR("failed to use table %.*s\n", _d->name->len, _d->name->s);
@@ -850,7 +850,7 @@ urecord_t* db_load_urecord_by_ruid(db1_con_t* _c, udomain_t* _d, str *_ruid)
        aor.s = (char*)VAL_STRING(ROW_VALUES(row) + 19);
        aor.len = strlen(aor.s);
 
-       if (use_domain) {
+       if (ul_use_domain) {
                domain.s = (char*)VAL_STRING(ROW_VALUES(row) + 20);
                if (VAL_NULL(ROW_VALUES(row)+20) || domain.s==0 || domain.s[0]==0){
                        LM_CRIT("empty domain record for user %.*s...skipping\n",
@@ -914,44 +914,44 @@ int udomain_contact_expired_cb(db1_con_t* _c, udomain_t* _d)
        char ruidbuf[RUIDBUF_SIZE];
        str ruid;
 
-       if (db_mode!=DB_ONLY) {
+       if (ul_db_mode!=DB_ONLY) {
                return 0;
        }
 
-       columns[0] = &user_col;
-       columns[1] = &contact_col;
-       columns[2] = &expires_col;
-       columns[3] = &q_col;
-       columns[4] = &callid_col;
-       columns[5] = &cseq_col;
-       columns[6] = &flags_col;
-       columns[7] = &cflags_col;
-       columns[8] = &user_agent_col;
-       columns[9] = &received_col;
-       columns[10] = &path_col;
-       columns[11] = &sock_col;
-       columns[12] = &methods_col;
-       columns[13] = &last_mod_col;
-       columns[14] = &ruid_col;
-       columns[15] = &instance_col;
-       columns[16] = &reg_id_col;
-       columns[17] = &srv_id_col;
-       columns[18] = &con_id_col;
-       columns[19] = &keepalive_col;
-       columns[20] = &domain_col;
-
-       query_cols[0] = &expires_col;
+       columns[0] = &ul_user_col;
+       columns[1] = &ul_contact_col;
+       columns[2] = &ul_expires_col;
+       columns[3] = &ul_q_col;
+       columns[4] = &ul_callid_col;
+       columns[5] = &ul_cseq_col;
+       columns[6] = &ul_flags_col;
+       columns[7] = &ul_cflags_col;
+       columns[8] = &ul_user_agent_col;
+       columns[9] = &ul_received_col;
+       columns[10] = &ul_path_col;
+       columns[11] = &ul_sock_col;
+       columns[12] = &ul_methods_col;
+       columns[13] = &ul_last_mod_col;
+       columns[14] = &ul_ruid_col;
+       columns[15] = &ul_instance_col;
+       columns[16] = &ul_reg_id_col;
+       columns[17] = &ul_srv_id_col;
+       columns[18] = &ul_con_id_col;
+       columns[19] = &ul_keepalive_col;
+       columns[20] = &ul_domain_col;
+
+       query_cols[0] = &ul_expires_col;
        query_ops[0] = "<";
        query_vals[0].nul = 0;
-       UL_DB_EXPIRES_SET(&query_vals[0], act_time + 1 - ul_rm_expired_delay);
+       UL_DB_EXPIRES_SET(&query_vals[0], ul_act_time + 1 - ul_rm_expired_delay);
 
-       query_cols[1] = &expires_col;
+       query_cols[1] = &ul_expires_col;
        query_ops[1] = OP_NEQ;
        query_vals[1].nul = 0;
        UL_DB_EXPIRES_SET(&query_vals[1], 0);
 
        if (ul_db_srvid != 0) {
-               query_cols[2] = &srv_id_col;
+               query_cols[2] = &ul_srv_id_col;
                query_ops[2] = OP_EQ;
                query_vals[2].type = DB1_INT;
                query_vals[2].nul = 0;
@@ -969,7 +969,8 @@ int udomain_contact_expired_cb(db1_con_t* _c, udomain_t* _d)
 #endif
 
        if (DB_CAPABILITY(ul_dbf, DB_CAP_FETCH)) {
-               if (ul_dbf.query(_c, query_cols, query_ops, query_vals, columns, key_num, (use_domain)?(21):(20), 0,
+               if (ul_dbf.query(_c, query_cols, query_ops, query_vals, columns, key_num,
+                                       (ul_use_domain)?(21):(20), 0,
                0) < 0) {
                        LM_ERR("db_query (1) failed\n");
                        return -1;
@@ -979,7 +980,8 @@ int udomain_contact_expired_cb(db1_con_t* _c, udomain_t* _d)
                        return -1;
                }
        } else {
-               if (ul_dbf.query(_c, query_cols, query_ops, query_vals, columns, key_num, (use_domain)?(21):(20), 0,
+               if (ul_dbf.query(_c, query_cols, query_ops, query_vals, columns, key_num,
+                                       (ul_use_domain)?(21):(20), 0,
                &res) < 0) {
                        LM_ERR("db_query failed\n");
                        return -1;
@@ -1095,18 +1097,18 @@ int db_timer_udomain(udomain_t* _d)
        /* call contact expired call back for a domain before deleting database rows */
        udomain_contact_expired_cb(ul_dbh, _d);
 
-       keys[0] = &expires_col;
+       keys[0] = &ul_expires_col;
        ops[0] = "<";
        vals[0].nul = 0;
-       UL_DB_EXPIRES_SET(&vals[0], act_time + 1 - ul_rm_expired_delay);
+       UL_DB_EXPIRES_SET(&vals[0], ul_act_time + 1 - ul_rm_expired_delay);
 
-       keys[1] = &expires_col;
+       keys[1] = &ul_expires_col;
        ops[1] = OP_NEQ;
        vals[1].nul = 0;
        UL_DB_EXPIRES_SET(&vals[1], 0);
 
        if (ul_db_srvid != 0) {
-               keys[2] = &srv_id_col;
+               keys[2] = &ul_srv_id_col;
                ops[2] = OP_EQ;
                vals[2].type = DB1_INT;
                vals[2].nul = 0;
@@ -1144,10 +1146,10 @@ int testdb_udomain(db1_con_t* con, udomain_t* d)
                return -1;
        }
 
-       key[0] = &user_col;
-       key[1] = &domain_col;
+       key[0] = &ul_user_col;
+       key[1] = &ul_domain_col;
 
-       col[0] = &user_col;
+       col[0] = &ul_user_col;
 
        VAL_TYPE(val) = DB1_STRING;
        VAL_NULL(val) = 0;
@@ -1157,7 +1159,7 @@ int testdb_udomain(db1_con_t* con, udomain_t* d)
        VAL_NULL(val+1) = 0;
        VAL_STRING(val+1) = "dummy_domain";
 
-       if(ul_dbf.query(con, key, 0, val, col, (use_domain)?2:1, 1, 0, &res)<0) {
+       if(ul_dbf.query(con, key, 0, val, col, (ul_use_domain)?2:1, 1, 0, &res)<0) {
                if(res) ul_dbf.free_result( con, res);
                LM_ERR("failure in db_query\n");
                return -1;
@@ -1246,7 +1248,7 @@ void mem_timer_udomain(udomain_t* _d, int istart, int istep)
 void lock_udomain(udomain_t* _d, str* _aor)
 {
        unsigned int sl;
-       if (db_mode!=DB_ONLY)
+       if (ul_db_mode!=DB_ONLY)
        {
                sl = ul_get_aorhash(_aor) & (_d->size - 1);
 
@@ -1263,7 +1265,7 @@ void lock_udomain(udomain_t* _d, str* _aor)
 void unlock_udomain(udomain_t* _d, str* _aor)
 {
        unsigned int sl;
-       if (db_mode!=DB_ONLY)
+       if (ul_db_mode!=DB_ONLY)
        {
                sl = ul_get_aorhash(_aor) & (_d->size - 1);
                rec_lock_release(&_d->table[sl].rlock);
@@ -1277,7 +1279,7 @@ void unlock_udomain(udomain_t* _d, str* _aor)
  */
 void lock_ulslot(udomain_t* _d, int i)
 {
-       if (db_mode!=DB_ONLY)
+       if (ul_db_mode!=DB_ONLY)
                rec_lock_get(&_d->table[i].rlock);
 }
 
@@ -1289,7 +1291,7 @@ void lock_ulslot(udomain_t* _d, int i)
  */
 void unlock_ulslot(udomain_t* _d, int i)
 {
-       if (db_mode!=DB_ONLY)
+       if (ul_db_mode!=DB_ONLY)
                rec_lock_release(&_d->table[i].rlock);
 }
 
@@ -1304,7 +1306,7 @@ void unlock_ulslot(udomain_t* _d, int i)
  */
 int insert_urecord(udomain_t* _d, str* _aor, struct urecord** _r)
 {
-       if (db_mode!=DB_ONLY) {
+       if (ul_db_mode!=DB_ONLY) {
                if (mem_insert_urecord(_d, _aor, _r) < 0) {
                        LM_ERR("inserting record failed\n");
                        return -1;
@@ -1329,7 +1331,7 @@ int get_urecord(udomain_t* _d, str* _aor, struct urecord** _r)
        urecord_t* r;
        ucontact_t* ptr = NULL;
 
-       if (db_mode!=DB_ONLY) {
+       if (ul_db_mode!=DB_ONLY) {
                /* search in cache */
                aorhash = ul_get_aorhash(_aor);
                sl = aorhash&(_d->size-1);
@@ -1339,7 +1341,7 @@ int get_urecord(udomain_t* _d, str* _aor, struct urecord** _r)
                        if((r->aorhash==aorhash) && (r->aor.len==_aor->len)
                                                && !memcmp(r->aor.s,_aor->s,_aor->len))
                        {
-                               if (handle_lost_tcp)
+                               if (ul_handle_lost_tcp)
                                {
                                        for (ptr = r->contacts;ptr;ptr = ptr->next)
                                        {
@@ -1386,7 +1388,7 @@ int get_urecord_by_ruid(udomain_t* _d, unsigned int _aorhash,
        sl = _aorhash&(_d->size-1);
        lock_ulslot(_d, sl);
 
-       if (db_mode!=DB_ONLY) {
+       if (ul_db_mode!=DB_ONLY) {
                /* search in cache */
                r = _d->table[sl].first;
 
@@ -1439,7 +1441,7 @@ int delete_urecord(udomain_t* _d, str* _aor, struct urecord* _r)
 {
        struct ucontact* c, *t;
 
-       if (db_mode==DB_ONLY) {
+       if (ul_db_mode==DB_ONLY) {
                if (_r==0)
                        get_static_urecord( _d, _aor, &_r);
                if (db_delete_urecord(_r)<0) {
@@ -1531,7 +1533,7 @@ int uldb_preload_attrs(udomain_t *_d)
 #endif
 
        if (DB_CAPABILITY(ul_dbf, DB_CAP_FETCH)) {
-               if (ul_dbf.query(ul_dbh, 0, 0, 0, columns, 0, (use_domain)?(6):(5), 0,
+               if (ul_dbf.query(ul_dbh, 0, 0, 0, columns, 0, (ul_use_domain)?(6):(5), 0,
                                        0) < 0) {
                        LM_ERR("db_query (1) failed\n");
                        return -1;
@@ -1541,7 +1543,7 @@ int uldb_preload_attrs(udomain_t *_d)
                        return -1;
                }
        } else {
-               if (ul_dbf.query(ul_dbh, 0, 0, 0, columns, 0, (use_domain)?(6):(5), 0,
+               if (ul_dbf.query(ul_dbh, 0, 0, 0, columns, 0, (ul_use_domain)?(6):(5), 0,
                &res) < 0) {
                        LM_ERR("db_query failed\n");
                        return -1;
@@ -1589,7 +1591,7 @@ int uldb_preload_attrs(udomain_t *_d)
                                continue;
                        }
 
-                       if (use_domain) {
+                       if (ul_use_domain) {
                                domain.s = (char*)VAL_STRING(ROW_VALUES(row) + 5);
                                if (VAL_NULL(ROW_VALUES(row)+5) || domain.s==0 || domain.s[0]==0){
                                        LM_CRIT("empty domain record for user %.*s...skipping\n",
index 6038a60..4439e19 100644 (file)
@@ -75,7 +75,7 @@ extern int ul_ka_filter;
 extern int ul_ka_loglevel;
 extern pv_elem_t *ul_ka_logfmt;
 
-extern unsigned int nat_bflag;
+extern unsigned int ul_nat_bflag;
 
 static unsigned int _ul_ka_counter = 0;
 
@@ -124,10 +124,10 @@ int ul_ka_urecord(urecord_t *ur)
                }
                if(ul_ka_mode & ULKA_NAT) {
                        /* keepalive for natted contacts only */
-                       if (nat_bflag == 0) {
+                       if (ul_nat_bflag == 0) {
                                continue;
                        }
-                       if ((uc->cflags & nat_bflag) != nat_bflag) {
+                       if ((uc->cflags & ul_nat_bflag) != ul_nat_bflag) {
                                continue;
                        }
                }
@@ -228,7 +228,7 @@ int ul_ka_urecord(urecord_t *ur)
  *
  */
 static int ul_ka_send(str *kamsg, dest_info_t *kadst)
-{ 
+{
        if (kadst->proto == PROTO_UDP) {
                return udp_send(kadst, kamsg->s, kamsg->len);
        }
index 7d6d633..dc4ed86 100644 (file)
@@ -359,7 +359,7 @@ static inline int rpc_fix_aor(str *aor)
        char *p;
 
        p = memchr( aor->s, '@', aor->len);
-       if (use_domain) {
+       if (ul_use_domain) {
                if (p==NULL)
                        return -1;
        } else {
@@ -421,7 +421,7 @@ static void ul_rpc_lookup(rpc_t* rpc, void* ctx)
                return;
        }
 
-       get_act_time();
+       ul_get_act_time();
        rpl_tree = 0;
 
        if (rpc->add(ctx, "{", &th) < 0)
@@ -443,7 +443,7 @@ static void ul_rpc_lookup(rpc_t* rpc, void* ctx)
 
        /* We have contacts, list them */
        for( con=rec->contacts ; con ; con=con->next) {
-               if (VALID_CONTACT( con, act_time)) {
+               if (VALID_CONTACT(con, ul_act_time)) {
                        rpl_tree++;
                        if (rpc_dump_contact(rpc, ctx, ih, con) == -1) {
                                release_urecord(rec);
@@ -700,14 +700,14 @@ static void ul_rpc_add(rpc_t* rpc, void* ctx)
                }
        }
 
-       get_act_time();
+       ul_get_act_time();
 
        ci.callid = &rpc_ul_cid;
        ci.user_agent = &rpc_ul_ua;
        ci.cseq = RPC_UL_CSEQ;
        /* 0 expires means permanent contact */
        if (ci.expires!=0)
-               ci.expires += act_time;
+               ci.expires += ul_act_time;
 
        if (c) {
                if (update_ucontact( r, c, &ci) < 0)
@@ -747,7 +747,7 @@ static void ul_rpc_db_users(rpc_t* rpc, void* ctx)
        db1_res_t* res = NULL;
        int count = 0;
 
-       if (db_mode == NO_DB) {
+       if (ul_db_mode == NO_DB) {
                rpc->fault(ctx, 500, "Command is not supported in db_mode=0");
                return;
        }
@@ -757,7 +757,7 @@ static void ul_rpc_db_users(rpc_t* rpc, void* ctx)
                return;
        }
 
-       if (user_col.len + domain_col.len + table.len + 32 > QUERY_LEN) {
+       if (ul_user_col.len + ul_domain_col.len + table.len + 32 > QUERY_LEN) {
                rpc->fault(ctx, 500, "Too long database query");
                return;
        }
@@ -774,8 +774,8 @@ static void ul_rpc_db_users(rpc_t* rpc, void* ctx)
        memset(query, 0, QUERY_LEN);
        query_str.len = snprintf(query, QUERY_LEN,
                        "SELECT COUNT(DISTINCT %.*s, %.*s) FROM %.*s WHERE (UNIX_TIMESTAMP(expires) = 0) OR (expires > NOW())",
-                       user_col.len, user_col.s,
-                       domain_col.len, domain_col.s,
+                       ul_user_col.len, ul_user_col.s,
+                       ul_domain_col.len, ul_domain_col.s,
                        table.len, table.s);
        query_str.s = query;
        if (ul_dbf.raw_query(ul_dbh, &query_str, &res) < 0 || res==NULL) {
@@ -803,7 +803,7 @@ static void ul_rpc_db_contacts(rpc_t* rpc, void* ctx)
        db1_res_t* res = NULL;
        int count = 0;
 
-       if (db_mode == NO_DB) {
+       if (ul_db_mode == NO_DB) {
                rpc->fault(ctx, 500, "Command is not supported in db_mode=0");
                return;
        }
@@ -857,7 +857,7 @@ static void ul_rpc_db_expired_contacts(rpc_t* rpc, void* ctx)
        db1_res_t* res = NULL;
        int count = 0;
 
-       if (db_mode == NO_DB) {
+       if (ul_db_mode == NO_DB) {
                rpc->fault(ctx, 500, "Command is not supported in db_mode=0");
                return;
        }
index afed194..faddeac 100644 (file)
@@ -96,7 +96,7 @@ void free_urecord(urecord_t* _r)
        }
 
        /* if mem cache is not used, the urecord struct is static*/
-       if (db_mode!=DB_ONLY) {
+       if (ul_db_mode!=DB_ONLY) {
                if (_r->aor.s) shm_free(_r->aor.s);
                shm_free(_r);
        }
@@ -153,7 +153,7 @@ ucontact_t* mem_insert_ucontact(urecord_t* _r, str* _c, ucontact_info_t* _ci)
 
        ptr = _r->contacts;
 
-       if (!desc_time_order) {
+       if (!ul_desc_time_order) {
                while(ptr) {
                        if (ptr->q < c->q) break;
                        prev = ptr;
@@ -279,12 +279,12 @@ static inline void nodb_timer(urecord_t* _r)
        ptr = _r->contacts;
 
        while(ptr) {
-               if (handle_lost_tcp && is_valid_tcpconn(ptr) && !is_tcp_alive(ptr)) {
+               if (ul_handle_lost_tcp && is_valid_tcpconn(ptr) && !is_tcp_alive(ptr)) {
                        LM_DBG("tcp connection has been lost, expiring contact %.*s\n", ptr->c.len, ptr->c.s);
                        ptr->expires = UL_EXPIRED_TIME;
                }
 
-               if (!VALID_CONTACT(ptr, act_time)) {
+               if (!VALID_CONTACT(ptr, ul_act_time)) {
                        /* run callbacks for EXPIRE event */
                        if (!(ptr->flags&FL_EXPCLB) && exists_ulcb_type(UL_CONTACT_EXPIRE)) {
                                run_ul_callbacks( UL_CONTACT_EXPIRE, ptr);
@@ -295,7 +295,7 @@ static inline void nodb_timer(urecord_t* _r)
                                ptr->aor->len, ZSW(ptr->aor->s),
                                ptr->c.len, ZSW(ptr->c.s));
 
-                       if (close_expired_tcp && is_valid_tcpconn(ptr)) {
+                       if (ul_close_expired_tcp && is_valid_tcpconn(ptr)) {
                                close_connection(ptr->tcpconn_id);
                        }
 
@@ -326,7 +326,7 @@ static inline void wt_timer(urecord_t* _r)
        ptr = _r->contacts;
 
        while(ptr) {
-               if (!VALID_CONTACT(ptr, act_time)) {
+               if (!VALID_CONTACT(ptr, ul_act_time)) {
                        /* run callbacks for EXPIRE event */
                        if (exists_ulcb_type(UL_CONTACT_EXPIRE)) {
                                run_ul_callbacks( UL_CONTACT_EXPIRE, ptr);
@@ -336,7 +336,7 @@ static inline void wt_timer(urecord_t* _r)
                                ptr->aor->len, ZSW(ptr->aor->s),
                                ptr->c.len, ZSW(ptr->c.s));
 
-                       if (close_expired_tcp && is_valid_tcpconn(ptr)) {
+                       if (ul_close_expired_tcp && is_valid_tcpconn(ptr)) {
                                close_connection(ptr->tcpconn_id);
                        }
 
@@ -373,12 +373,12 @@ static inline void wb_timer(urecord_t* _r)
        ptr = _r->contacts;
 
        while(ptr) {
-               if (handle_lost_tcp && is_valid_tcpconn(ptr) && !is_tcp_alive(ptr)) {
+               if (ul_handle_lost_tcp && is_valid_tcpconn(ptr) && !is_tcp_alive(ptr)) {
                        LM_DBG("tcp connection has been lost, expiring contact %.*s\n", ptr->c.len, ptr->c.s);
                        ptr->expires = UL_EXPIRED_TIME;
                }
 
-               if (!VALID_CONTACT(ptr, act_time)) {
+               if (!VALID_CONTACT(ptr, ul_act_time)) {
                        /* run callbacks for EXPIRE event */
                        if (exists_ulcb_type(UL_CONTACT_EXPIRE)) {
                                run_ul_callbacks( UL_CONTACT_EXPIRE, ptr);
@@ -389,7 +389,7 @@ static inline void wb_timer(urecord_t* _r)
                                ptr->c.len, ZSW(ptr->c.s));
                        update_stat( _r->slot->d->expires, 1);
 
-                       if (close_expired_tcp && is_valid_tcpconn(ptr)) {
+                       if (ul_close_expired_tcp && is_valid_tcpconn(ptr)) {
                                close_connection(ptr->tcpconn_id);
                        }
 
@@ -452,16 +452,19 @@ static inline void wb_timer(urecord_t* _r)
  */
 void timer_urecord(urecord_t* _r)
 {
-       switch(db_mode) {
-       case DB_READONLY:
-       case NO_DB:         nodb_timer(_r);
-                                               break;
-       /* use also the write_back timer routine to handle the failed
-        * realtime inserts/updates */
-       case WRITE_THROUGH: wb_timer(_r); /*wt_timer(_r);*/
-                                               break;
-       case WRITE_BACK:    wb_timer(_r);
-                                               break;
+       switch(ul_db_mode) {
+               case DB_READONLY:
+               case NO_DB:
+                       nodb_timer(_r);
+                       break;
+               /* use also the write_back timer routine to handle the failed
+               * realtime inserts/updates */
+               case WRITE_THROUGH:
+                       wb_timer(_r); /*wt_timer(_r);*/
+                       break;
+               case WRITE_BACK:
+                       wb_timer(_r);
+                       break;
        }
 }
 
@@ -477,14 +480,14 @@ int db_delete_urecord(urecord_t* _r)
        db_val_t vals[2];
        char* dom;
 
-       keys[0] = &user_col;
-       keys[1] = &domain_col;
+       keys[0] = &ul_user_col;
+       keys[1] = &ul_domain_col;
        vals[0].type = DB1_STR;
        vals[0].nul = 0;
        vals[0].val.str_val.s = _r->aor.s;
        vals[0].val.str_val.len = _r->aor.len;
 
-       if (use_domain) {
+       if (ul_use_domain) {
                dom = memchr(_r->aor.s, '@', _r->aor.len);
                vals[0].val.str_val.len = dom - _r->aor.s;
 
@@ -499,7 +502,7 @@ int db_delete_urecord(urecord_t* _r)
                return -1;
        }
 
-       if (ul_dbf.delete(ul_dbh, keys, 0, vals, (use_domain) ? (2) : (1)) < 0) {
+       if (ul_dbf.delete(ul_dbh, keys, 0, vals, (ul_use_domain) ? (2) : (1)) < 0) {
                LM_ERR("failed to delete from database\n");
                return -1;
        }
@@ -517,7 +520,7 @@ int db_delete_urecord_by_ruid(str *_table, str *_ruid)
        db_key_t keys[1];
        db_val_t vals[1];
 
-       keys[0] = &ruid_col;
+       keys[0] = &ul_ruid_col;
        vals[0].type = DB1_STR;
        vals[0].nul = 0;
        vals[0].val.str_val.s = _ruid->s;
@@ -551,7 +554,7 @@ int db_delete_urecord_by_ruid(str *_table, str *_ruid)
  */
 void release_urecord(urecord_t* _r)
 {
-       if (db_mode==DB_ONLY) {
+       if (ul_db_mode==DB_ONLY) {
                free_urecord(_r);
        } else if (_r->contacts == 0) {
                mem_delete_urecord(_r->slot->d, _r);
@@ -576,7 +579,7 @@ int insert_ucontact(urecord_t* _r, str* _contact, ucontact_info_t* _ci,
                return -1;
        }
 
-       if (db_mode==DB_ONLY) {
+       if (ul_db_mode==DB_ONLY) {
                /* urecord is static generate a copy for later */
                memcpy(&_ur, _r, sizeof(struct urecord));
 
@@ -592,7 +595,7 @@ int insert_ucontact(urecord_t* _r, str* _contact, ucontact_info_t* _ci,
                run_ul_callbacks( UL_CONTACT_INSERT, *_c);
        }
 
-       switch (db_mode) {
+       switch (ul_db_mode) {
                case WRITE_THROUGH:
                        if (db_insert_ucontact(*_c) < 0) {
                                LM_ERR("failed to insert in database\n");
@@ -622,7 +625,7 @@ int delete_ucontact(urecord_t* _r, struct ucontact* _c)
        int ret = 0;
        struct urecord _ur;
 
-       if (db_mode==DB_ONLY) {
+       if (ul_db_mode==DB_ONLY) {
                /* urecord is static generate a copy for later */
                memcpy(&_ur, _r, sizeof(struct urecord));
        }
@@ -631,13 +634,13 @@ int delete_ucontact(urecord_t* _r, struct ucontact* _c)
                run_ul_callbacks( UL_CONTACT_DELETE, _c);
        }
 
-       if (db_mode==DB_ONLY) {
+       if (ul_db_mode==DB_ONLY) {
                /* urecord was static restore copy */
                memcpy(_r, &_ur, sizeof(struct urecord));
        }
 
        if (st_delete_ucontact(_c) > 0) {
-               if (db_mode == WRITE_THROUGH || db_mode==DB_ONLY) {
+               if (ul_db_mode == WRITE_THROUGH || ul_db_mode==DB_ONLY) {
                        if (db_delete_ucontact(_c) < 0) {
                                LM_ERR("failed to remove contact from database\n");
                                ret = -1;
@@ -653,7 +656,7 @@ int delete_ucontact(urecord_t* _r, struct ucontact* _c)
 
 int delete_urecord_by_ruid(udomain_t* _d, str *_ruid)
 {
-       if (db_mode != DB_ONLY) {
+       if (ul_db_mode != DB_ONLY) {
                LM_ERR("delete_urecord_by_ruid currently available only in db_mode=3\n");
                return -1;
        }
@@ -797,8 +800,8 @@ int get_ucontact(urecord_t* _r, str* _c, str* _callid, str* _path, int _cseq,
                        if (_cseq<ptr->cseq)
                                return -1;
                        if (_cseq==ptr->cseq) {
-                               get_act_time();
-                               return (ptr->last_modified+cseq_delay>act_time)?-2:-1;
+                               ul_get_act_time();
+                               return (ptr->last_modified+cseq_delay>ul_act_time)?-2:-1;
                        }
                }
                *_co = ptr;
index 2181e7d..76c643c 100644 (file)
@@ -46,7 +46,7 @@ int bind_usrloc(usrloc_api_t* api)
                LM_ERR("invalid parameter value\n");
                return -1;
        }
-       if (init_flag==0) {
+       if (ul_init_flag==0) {
                LM_ERR("configuration error - trying to bind to usrloc module"
                                " before being initialized\n");
                return -1;
@@ -76,9 +76,9 @@ int bind_usrloc(usrloc_api_t* api)
        api->refresh_keepalive        = ul_refresh_keepalive;
        api->set_max_partition        = ul_set_max_partition;
 
-       api->use_domain = use_domain;
-       api->db_mode    = db_mode;
-       api->nat_flag   = nat_bflag;
+       api->use_domain = ul_use_domain;
+       api->db_mode    = ul_db_mode;
+       api->nat_flag   = ul_nat_bflag;
 
        return 0;
 }
index dfc0bc5..faaa6c8 100644 (file)
@@ -134,28 +134,28 @@ sruid_t _ul_sruid;
  * Module parameters and their default values
  */
 
-str ruid_col        = str_init(RUID_COL);              /*!< Name of column containing record unique id */
-str user_col        = str_init(USER_COL);              /*!< Name of column containing usernames */
-str domain_col      = str_init(DOMAIN_COL);    /*!< Name of column containing domains */
-str contact_col     = str_init(CONTACT_COL);   /*!< Name of column containing contact addresses */
-str expires_col     = str_init(EXPIRES_COL);   /*!< Name of column containing expires values */
-str q_col           = str_init(Q_COL);                 /*!< Name of column containing q values */
-str callid_col      = str_init(CALLID_COL);            /*!< Name of column containing callid string */
-str cseq_col        = str_init(CSEQ_COL);              /*!< Name of column containing cseq values */
-str flags_col       = str_init(FLAGS_COL);             /*!< Name of column containing internal flags */
-str cflags_col      = str_init(CFLAGS_COL);            /*!< Name of column containing contact flags */
-str user_agent_col  = str_init(USER_AGENT_COL);        /*!< Name of column containing user agent string */
-str received_col    = str_init(RECEIVED_COL);  /*!< Name of column containing transport info of REGISTER */
-str path_col        = str_init(PATH_COL);              /*!< Name of column containing the Path header */
-str sock_col        = str_init(SOCK_COL);              /*!< Name of column containing the received socket */
-str methods_col     = str_init(METHODS_COL);   /*!< Name of column containing the supported methods */
-str instance_col    = str_init(INSTANCE_COL);  /*!< Name of column containing the SIP instance value */
-str reg_id_col      = str_init(REG_ID_COL);            /*!< Name of column containing the reg-id value */
-str last_mod_col    = str_init(LAST_MOD_COL);  /*!< Name of column containing the last modified date */
-str srv_id_col      = str_init(SRV_ID_COL);            /*!< Name of column containing the server id value */
-str con_id_col      = str_init(CON_ID_COL);            /*!< Name of column containing the connection id value */
-str keepalive_col   = str_init(KEEPALIVE_COL); /*!< Name of column containing the keepalive value */
-str partition_col   = str_init(PARTITION_COL); /*!< Name of column containing the partition value */
+str ul_ruid_col        = str_init(RUID_COL);           /*!< Name of column containing record unique id */
+str ul_user_col        = str_init(USER_COL);           /*!< Name of column containing usernames */
+str ul_domain_col      = str_init(DOMAIN_COL);         /*!< Name of column containing domains */
+str ul_contact_col     = str_init(CONTACT_COL);        /*!< Name of column containing contact addresses */
+str ul_expires_col     = str_init(EXPIRES_COL);        /*!< Name of column containing expires values */
+str ul_q_col           = str_init(Q_COL);                      /*!< Name of column containing q values */
+str ul_callid_col      = str_init(CALLID_COL);         /*!< Name of column containing callid string */
+str ul_cseq_col        = str_init(CSEQ_COL);           /*!< Name of column containing cseq values */
+str ul_flags_col       = str_init(FLAGS_COL);          /*!< Name of column containing internal flags */
+str ul_cflags_col      = str_init(CFLAGS_COL);         /*!< Name of column containing contact flags */
+str ul_user_agent_col  = str_init(USER_AGENT_COL);     /*!< Name of column containing user agent string */
+str ul_received_col    = str_init(RECEIVED_COL);       /*!< Name of column containing transport info of REGISTER */
+str ul_path_col        = str_init(PATH_COL);           /*!< Name of column containing the Path header */
+str ul_sock_col        = str_init(SOCK_COL);           /*!< Name of column containing the received socket */
+str ul_methods_col     = str_init(METHODS_COL);        /*!< Name of column containing the supported methods */
+str ul_instance_col    = str_init(INSTANCE_COL);       /*!< Name of column containing the SIP instance value */
+str ul_reg_id_col      = str_init(REG_ID_COL);         /*!< Name of column containing the reg-id value */
+str ul_last_mod_col    = str_init(LAST_MOD_COL);       /*!< Name of column containing the last modified date */
+str ul_srv_id_col      = str_init(SRV_ID_COL);         /*!< Name of column containing the server id value */
+str ul_con_id_col      = str_init(CON_ID_COL);         /*!< Name of column containing the connection id value */
+str ul_keepalive_col   = str_init(KEEPALIVE_COL);      /*!< Name of column containing the keepalive value */
+str ul_partition_col   = str_init(PARTITION_COL);      /*!< Name of column containing the partition value */
 
 str ulattrs_user_col   = str_init(ULATTRS_USER_COL);   /*!< Name of column containing username */
 str ulattrs_domain_col = str_init(ULATTRS_DOMAIN_COL); /*!< Name of column containing domain */
@@ -165,16 +165,16 @@ str ulattrs_atype_col  = str_init(ULATTRS_ATYPE_COL);  /*!< Name of column conta
 str ulattrs_avalue_col = str_init(ULATTRS_AVALUE_COL); /*!< Name of column containing attribute value */
 str ulattrs_last_mod_col = str_init(ULATTRS_LAST_MOD_COL);     /*!< Name of column containing the last modified date */
 
-str db_url          = str_init(DEFAULT_DB_URL);        /*!< Database URL */
-int timer_interval  = 60;                              /*!< Timer interval in seconds */
-int db_mode         = 0;                               /*!< Database sync scheme: 0-no db, 1-write through, 2-write back, 3-only db */
-int db_load         = 1;                               /*!< Database load after restart: 1- true, 0- false (only the db_mode allows it) */
-int db_insert_update = 0;                              /*!< Database : update on duplicate key instead of error */
-int use_domain      = 0;                               /*!< Whether usrloc should use domain part of aor */
-int desc_time_order = 0;                               /*!< By default do not enable timestamp ordering */
-int handle_lost_tcp = 0;                               /*!< By default do not remove contacts before expiration time */
-int close_expired_tcp = 0;                             /*!< By default do not close TCP connections for expired contacts */
-int skip_remote_socket = 0;                            /*!< By default do not skip remote socket */
+str ul_db_url          = str_init(DEFAULT_DB_URL);     /*!< Database URL */
+int ul_timer_interval  = 60;                           /*!< Timer interval in seconds */
+int ul_db_mode         = 0;                            /*!< Database sync scheme: 0-no db, 1-write through, 2-write back, 3-only db */
+int ul_db_load         = 1;                            /*!< Database load after restart: 1- true, 0- false (only the db_mode allows it) */
+int ul_db_insert_update = 0;                           /*!< Database : update on duplicate key instead of error */
+int ul_use_domain      = 0;                            /*!< Whether usrloc should use domain part of aor */
+int ul_desc_time_order = 0;                            /*!< By default do not enable timestamp ordering */
+int ul_handle_lost_tcp = 0;                            /*!< By default do not remove contacts before expiration time */
+int ul_close_expired_tcp = 0;                          /*!< By default do not close TCP connections for expired contacts */
+int ul_skip_remote_socket = 0;                         /*!< By default do not skip remote socket */
 
 int ul_fetch_rows = 2000;                              /*!< number of rows to fetch from result */
 int ul_hash_size = 10;
@@ -182,8 +182,8 @@ int ul_db_insert_null = 0;
 int ul_db_timer_clean = 0;
 
 /* flags */
-unsigned int nat_bflag = (unsigned int)-1;
-unsigned int init_flag = 0;
+unsigned int ul_nat_bflag = (unsigned int)-1;
+unsigned int ul_init_flag = 0;
 
 db1_con_t* ul_dbh = 0; /* Database connection handle */
 db_func_t ul_dbf;
@@ -204,42 +204,42 @@ static cmd_export_t cmds[] = {
  * Exported parameters
  */
 static param_export_t params[] = {
-       {"ruid_column",         PARAM_STR, &ruid_col      },
-       {"user_column",         PARAM_STR, &user_col      },
-       {"domain_column",       PARAM_STR, &domain_col    },
-       {"contact_column",      PARAM_STR, &contact_col   },
-       {"expires_column",      PARAM_STR, &expires_col   },
-       {"q_column",            PARAM_STR, &q_col         },
-       {"callid_column",       PARAM_STR, &callid_col    },
-       {"cseq_column",         PARAM_STR, &cseq_col      },
-       {"flags_column",        PARAM_STR, &flags_col     },
-       {"cflags_column",       PARAM_STR, &cflags_col    },
-       {"db_url",              PARAM_STR, &db_url        },
-       {"timer_interval",      INT_PARAM, &timer_interval  },
-       {"db_mode",             INT_PARAM, &db_mode         },
-       {"db_load",             INT_PARAM, &db_load         },
-       {"db_insert_update",    INT_PARAM, &db_insert_update },
-       {"use_domain",          INT_PARAM, &use_domain      },
-       {"desc_time_order",     INT_PARAM, &desc_time_order },
-       {"user_agent_column",   PARAM_STR, &user_agent_col},
-       {"received_column",     PARAM_STR, &received_col  },
-       {"path_column",         PARAM_STR, &path_col      },
-       {"socket_column",       PARAM_STR, &sock_col      },
-       {"methods_column",      PARAM_STR, &methods_col   },
-       {"instance_column",     PARAM_STR, &instance_col  },
-       {"reg_id_column",       PARAM_STR, &reg_id_col    },
-       {"server_id_column",    PARAM_STR, &srv_id_col    },
-       {"connection_id_column",PARAM_STR, &con_id_col    },
-       {"keepalive_column",    PARAM_STR, &keepalive_col },
-       {"partition_column",    PARAM_STR, &partition_col },
+       {"ruid_column",         PARAM_STR, &ul_ruid_col      },
+       {"user_column",         PARAM_STR, &ul_user_col      },
+       {"domain_column",       PARAM_STR, &ul_domain_col    },
+       {"contact_column",      PARAM_STR, &ul_contact_col   },
+       {"expires_column",      PARAM_STR, &ul_expires_col   },
+       {"q_column",            PARAM_STR, &ul_q_col         },
+       {"callid_column",       PARAM_STR, &ul_callid_col    },
+       {"cseq_column",         PARAM_STR, &ul_cseq_col      },
+       {"flags_column",        PARAM_STR, &ul_flags_col     },
+       {"cflags_column",       PARAM_STR, &ul_cflags_col    },
+       {"db_url",              PARAM_STR, &ul_db_url        },
+       {"timer_interval",      INT_PARAM, &ul_timer_interval  },
+       {"db_mode",             INT_PARAM, &ul_db_mode         },
+       {"db_load",             INT_PARAM, &ul_db_load         },
+       {"db_insert_update",    INT_PARAM, &ul_db_insert_update },
+       {"use_domain",          INT_PARAM, &ul_use_domain      },
+       {"desc_time_order",     INT_PARAM, &ul_desc_time_order },
+       {"user_agent_column",   PARAM_STR, &ul_user_agent_col},
+       {"received_column",     PARAM_STR, &ul_received_col  },
+       {"path_column",         PARAM_STR, &ul_path_col      },
+       {"socket_column",       PARAM_STR, &ul_sock_col      },
+       {"methods_column",      PARAM_STR, &ul_methods_col   },
+       {"instance_column",     PARAM_STR, &ul_instance_col  },
+       {"reg_id_column",       PARAM_STR, &ul_reg_id_col    },
+       {"server_id_column",    PARAM_STR, &ul_srv_id_col    },
+       {"connection_id_column",PARAM_STR, &ul_con_id_col    },
+       {"keepalive_column",    PARAM_STR, &ul_keepalive_col },
+       {"partition_column",    PARAM_STR, &ul_partition_col },
        {"matching_mode",       INT_PARAM, &ul_matching_mode },
-       {"cseq_delay",          INT_PARAM, &cseq_delay      },
+       {"cseq_delay",          INT_PARAM, &ul_cseq_delay      },
        {"fetch_rows",          INT_PARAM, &ul_fetch_rows   },
        {"hash_size",           INT_PARAM, &ul_hash_size    },
-       {"nat_bflag",           INT_PARAM, &nat_bflag       },
-       {"handle_lost_tcp",     INT_PARAM, &handle_lost_tcp },
-       {"close_expired_tcp",   INT_PARAM, &close_expired_tcp },
-       {"skip_remote_socket",  INT_PARAM, &skip_remote_socket },
+       {"nat_bflag",           INT_PARAM, &ul_nat_bflag       },
+       {"handle_lost_tcp",     INT_PARAM, &ul_handle_lost_tcp },
+       {"close_expired_tcp",   INT_PARAM, &ul_close_expired_tcp },
+       {"skip_remote_socket",  INT_PARAM, &ul_skip_remote_socket },
        {"preload",             PARAM_STRING|USE_FUNC_PARAM, (void*)ul_preload_param},
        {"db_update_as_insert", INT_PARAM, &ul_db_update_as_insert},
        {"timer_procs",         INT_PARAM, &ul_timer_procs},
@@ -292,7 +292,7 @@ static int mod_init(void)
        udomain_t* d;
 
        if(ul_rm_expired_delay!=0) {
-               if(db_mode != DB_ONLY) {
+               if(ul_db_mode != DB_ONLY) {
                        LM_ERR("rm expired delay feature is available for db only mode\n");
                        return -1;
                }
@@ -308,7 +308,7 @@ static int mod_init(void)
 
 #ifdef STATISTICS
        /* register statistics */
-       if (register_module_stats( exports.name, mod_stats)!=0 ) {
+       if (register_module_stats(exports.name, mod_stats)!=0 ) {
                LM_ERR("failed to register core statistics\n");
                return -1;
        }
@@ -338,22 +338,22 @@ static int mod_init(void)
 
        /* Register cache timer */
        if(ul_timer_procs<=0) {
-               if (timer_interval > 0) {
-                       register_timer(ul_core_timer, 0, timer_interval);
+               if (ul_timer_interval > 0) {
+                       register_timer(ul_core_timer, 0, ul_timer_interval);
                }
        } else {
                register_sync_timers(ul_timer_procs);
        }
 
        /* init the callbacks list */
-       if ( init_ulcb_list() < 0) {
+       if (init_ulcb_list() < 0) {
                LM_ERR("usrloc/callbacks initialization failed\n");
                return -1;
        }
 
        /* Shall we use database ? */
-       if (db_mode != NO_DB) { /* Yes */
-               if (db_bind_mod(&db_url, &ul_dbf) < 0) { /* Find database module */
+       if (ul_db_mode != NO_DB) { /* Yes */
+               if (db_bind_mod(&ul_db_url, &ul_dbf) < 0) { /* Find database module */
                        LM_ERR("failed to bind database module\n");
                        return -1;
                }
@@ -367,22 +367,22 @@ static int mod_init(void)
                        return -1;
                }
        }
-       if(db_mode==WRITE_THROUGH || db_mode==WRITE_BACK) {
+       if(ul_db_mode==WRITE_THROUGH || ul_db_mode==WRITE_BACK) {
                if(ul_db_timer_clean!=0) {
-                       if(sr_wtimer_add(ul_db_clean_timer, 0, timer_interval)<0) {
+                       if(sr_wtimer_add(ul_db_clean_timer, 0, ul_timer_interval)<0) {
                                LM_ERR("failed to add db clean timer routine\n");
                                return -1;
                        }
                }
        }
 
-       if (nat_bflag==(unsigned int)-1) {
-               nat_bflag = 0;
-       } else if ( nat_bflag>=8*sizeof(nat_bflag) ) {
-               LM_ERR("bflag index (%d) too big!\n", nat_bflag);
+       if (ul_nat_bflag==(unsigned int)-1) {
+               ul_nat_bflag = 0;
+       } else if (ul_nat_bflag>=8*sizeof(ul_nat_bflag) ) {
+               LM_ERR("bflag index (%d) too big!\n", ul_nat_bflag);
                return -1;
        } else {
-               nat_bflag = 1<<nat_bflag;
+               ul_nat_bflag = 1<<ul_nat_bflag;
        }
 
        for(i=0; i<ul_preload_index; i++) {
@@ -392,11 +392,11 @@ static int mod_init(void)
                }
        }
 
-       if (handle_lost_tcp && db_mode == DB_ONLY) {
+       if (ul_handle_lost_tcp && ul_db_mode == DB_ONLY) {
                LM_WARN("handle_lost_tcp option makes nothing in DB_ONLY mode\n");
        }
 
-       if(db_mode != DB_ONLY) {
+       if(ul_db_mode != DB_ONLY) {
                ul_set_xavp_contact_clone(1);
        }
 
@@ -413,7 +413,7 @@ static int mod_init(void)
                }
        }
 
-       init_flag = 1;
+       ul_init_flag = 1;
        return 0;
 }
 
@@ -431,7 +431,7 @@ static int child_init(int _rank)
                for(i=0; i<ul_timer_procs; i++)
                {
                        if(fork_sync_timer(PROC_TIMER, "USRLOC Timer", 1 /*socks flag*/,
-                                       ul_local_timer, (void*)(long)i, timer_interval /*sec*/)<0) {
+                                       ul_local_timer, (void*)(long)i, ul_timer_interval /*sec*/)<0) {
                                LM_ERR("failed to start timer routine as process\n");
                                return -1; /* error */
                        }
@@ -439,7 +439,7 @@ static int child_init(int _rank)
        }
 
        /* connecting to DB ? */
-       switch (db_mode) {
+       switch (ul_db_mode) {
                case NO_DB:
                        return 0;
                case DB_ONLY:
@@ -458,19 +458,19 @@ static int child_init(int _rank)
                        break;
                case DB_READONLY:
                        /* connect to db only from child 1 for preload */
-                       db_load=1; /* we always load from the db in this mode */
+                       ul_db_load=1; /* we always load from the db in this mode */
                        if(_rank!=PROC_SIPINIT)
                                return 0;
                        break;
        }
 
-       ul_dbh = ul_dbf.init(&db_url); /* Get a database connection per child */
+       ul_dbh = ul_dbf.init(&ul_db_url); /* Get a database connection per child */
        if (!ul_dbh) {
                LM_ERR("child(%d): failed to connect to database\n", _rank);
                return -1;
        }
        /* _rank==PROC_SIPINIT is used even when fork is disabled */
-       if (_rank==PROC_SIPINIT && db_mode!=DB_ONLY && db_load) {
+       if (_rank==PROC_SIPINIT && ul_db_mode!=DB_ONLY && ul_db_load) {
                /* if cache is used, populate domains from DB */
                for(ptr=_ksr_ul_root ; ptr ; ptr=ptr->next) {
                        if (preload_udomain(ul_dbh, ptr->d) < 0) {
index 12735f1..6c3f6e0 100644 (file)
 
 #define UL_TABLE_VERSION 9
 
-extern str ruid_col;
-extern str user_col;
-extern str domain_col;
-extern str contact_col;
-extern str expires_col;
-extern str q_col;
-extern str callid_col;
-extern str cseq_col;
-extern str flags_col;
-extern str cflags_col;
-extern str user_agent_col;
-extern str received_col;
-extern str path_col;
-extern str sock_col;
-extern str methods_col;
-extern str instance_col;
-extern str reg_id_col;
-extern str srv_id_col;
-extern str con_id_col;
-extern str keepalive_col;
-extern str partition_col;
-extern str last_mod_col;
+extern str ul_ruid_col;
+extern str ul_user_col;
+extern str ul_domain_col;
+extern str ul_contact_col;
+extern str ul_expires_col;
+extern str ul_q_col;
+extern str ul_callid_col;
+extern str ul_cseq_col;
+extern str ul_flags_col;
+extern str ul_cflags_col;
+extern str ul_user_agent_col;
+extern str ul_received_col;
+extern str ul_path_col;
+extern str ul_sock_col;
+extern str ul_methods_col;
+extern str ul_instance_col;
+extern str ul_reg_id_col;
+extern str ul_srv_id_col;
+extern str ul_con_id_col;
+extern str ul_keepalive_col;
+extern str ul_partition_col;
+extern str ul_last_mod_col;
 
 extern str ulattrs_user_col;
 extern str ulattrs_domain_col;
@@ -73,27 +73,27 @@ extern str ulattrs_avalue_col;
 extern str ulattrs_last_mod_col;
 
 
-extern str db_url;
-extern int timer_interval;
-extern int db_mode;
-extern int db_insert_update;
-extern int use_domain;
-extern int desc_time_order;
-extern int cseq_delay;
+extern str ul_db_url;
+extern int ul_timer_interval;
+extern int ul_db_mode;
+extern int ul_db_insert_update;
+extern int ul_use_domain;
+extern int ul_desc_time_order;
+extern int ul_cseq_delay;
 extern int ul_fetch_rows;
 extern int ul_hash_size;
 extern int ul_db_update_as_insert;
 extern int ul_db_check_update;
 extern int ul_keepalive_timeout;
-extern int handle_lost_tcp;
-extern int close_expired_tcp;
-extern int skip_remote_socket;
+extern int ul_handle_lost_tcp;
+extern int ul_close_expired_tcp;
+extern int ul_skip_remote_socket;
 
 
 /*! nat branch flag */
-extern unsigned int nat_bflag;
+extern unsigned int ul_nat_bflag;
 /*! flag to protect against wrong initialization */
-extern unsigned int init_flag;
+extern unsigned int ul_init_flag;
 
 extern str ul_xavp_contact_name;
 
index 412661d..861f372 100644 (file)
 #include "utime.h"
 
 
-time_t act_time;
+time_t ul_act_time = 0;
 
-
-void get_act_time(void)
+void ul_get_act_time(void)
 {
-
-       act_time = time(0);
+       ul_act_time = time(0);
 }
index cf3dec9..bedddb4 100644 (file)
 #include <time.h>
 
 
-extern time_t act_time;
+extern time_t ul_act_time;
 
 
 /*! \brief
  * Get actual time
  */
-void get_act_time(void);
+void ul_get_act_time(void);
 
 
 #endif /* UTIME_H */