]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
make name more specific to avoid namespace bs
authorAnthony Minessale <anthony.minessale@gmail.com>
Sun, 1 Apr 2007 01:16:16 +0000 (01:16 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sun, 1 Apr 2007 01:16:16 +0000 (01:16 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4820 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_reg.c

index f707cb73e7c57a04dfa82272a6224ac848e768e2..1cbf47cf0daa2b0e62f4327e65fa04300630d7f7 100644 (file)
@@ -38,7 +38,7 @@
 
 #include "mod_sofia.h"
 
-struct sofia_globals globals;
+struct mod_sofia_globals mod_sofia_globals;
 
 static switch_frame_t silence_frame = { 0 };
 static char silence_data[13] = "";
@@ -991,19 +991,19 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
                return SWITCH_STATUS_TERM;
        }
 
-       memset(&globals, 0, sizeof(globals));
-       switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, module_pool);
+       memset(&mod_sofia_globals, 0, sizeof(mod_sofia_globals));
+       switch_mutex_init(&mod_sofia_globals.mutex, SWITCH_MUTEX_NESTED, module_pool);
 
-       switch_find_local_ip(globals.guess_ip, sizeof(globals.guess_ip), AF_INET);
+       switch_find_local_ip(mod_sofia_globals.guess_ip, sizeof(mod_sofia_globals.guess_ip), AF_INET);
 
        if (switch_event_bind((char *) modname, SWITCH_EVENT_CUSTOM, MULTICAST_EVENT, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
                return SWITCH_STATUS_TERM;
        }
 
-       switch_core_hash_init(&globals.profile_hash, module_pool);
-       switch_core_hash_init(&globals.gateway_hash, module_pool);
-       switch_mutex_init(&globals.hash_mutex, SWITCH_MUTEX_NESTED, module_pool);
+       switch_core_hash_init(&mod_sofia_globals.profile_hash, module_pool);
+       switch_core_hash_init(&mod_sofia_globals.gateway_hash, module_pool);
+       switch_mutex_init(&mod_sofia_globals.hash_mutex, SWITCH_MUTEX_NESTED, module_pool);
 
        config_sofia(0);
 
@@ -1041,13 +1041,13 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
 
        sofia_presence_cancel();
 
-       switch_mutex_lock(globals.mutex);
-       if (globals.running == 1) {
-               globals.running = -1;
+       switch_mutex_lock(mod_sofia_globals.mutex);
+       if (mod_sofia_globals.running == 1) {
+               mod_sofia_globals.running = -1;
        }
-       switch_mutex_unlock(globals.mutex);
+       switch_mutex_unlock(mod_sofia_globals.mutex);
 
-       while (globals.running) {
+       while (mod_sofia_globals.running) {
                switch_yield(1000);
        }
 
index 8c6163dc1c7f1f96ad780c2e9132b811637eeddf..25532cb13a24cc3185fd78cf0ca6fb478afb0356 100644 (file)
@@ -133,7 +133,7 @@ typedef enum {
        TFLAG_LATE_NEGOTIATION = (1 << 24)
 } TFLAGS;
 
-struct sofia_globals {
+struct mod_sofia_globals {
        switch_hash_t *profile_hash;
        switch_hash_t *gateway_hash;
        switch_mutex_t *hash_mutex;
@@ -142,7 +142,7 @@ struct sofia_globals {
        switch_mutex_t *mutex;
        char guess_ip[80];
 };
-extern struct sofia_globals globals;
+extern struct mod_sofia_globals mod_sofia_globals;
 
 
 typedef enum {
index 98b5e730cfe26754e8a76104312c75c46f33469a..7db999c5130b0f15c36530d057daeea50ae99fe6 100644 (file)
@@ -359,7 +359,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t * thread, void
                sofia_presence_establish_presence(profile);
        }
 
-       while (globals.running == 1) {
+       while (mod_sofia_globals.running == 1) {
                if (++ireg_loops >= IREG_SECONDS) {
                        sofia_reg_check_expire(db, profile, time(NULL));
                        ireg_loops = 0;
@@ -387,9 +387,9 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t * thread, void
        su_root_destroy(profile->s_root);
        pool = profile->pool;
        switch_core_destroy_memory_pool(&pool);
-       switch_mutex_lock(globals.mutex);
-       globals.running = 0;
-       switch_mutex_unlock(globals.mutex);
+       switch_mutex_lock(mod_sofia_globals.mutex);
+       mod_sofia_globals.running = 0;
+       switch_mutex_unlock(mod_sofia_globals.mutex);
 
        return NULL;
 }
@@ -439,9 +439,9 @@ switch_status_t config_sofia(int reload)
        switch_status_t status = SWITCH_STATUS_SUCCESS;
        sofia_profile_t *profile = NULL;
        char url[512] = "";
-       switch_mutex_lock(globals.mutex);
-       globals.running = 1;
-       switch_mutex_unlock(globals.mutex);
+       switch_mutex_lock(mod_sofia_globals.mutex);
+       mod_sofia_globals.running = 1;
+       switch_mutex_unlock(mod_sofia_globals.mutex);
 
        if (!reload) {
                su_init();
@@ -531,14 +531,14 @@ switch_status_t config_sofia(int reload)
                                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invald option %s for VAD\n", val);
                                                }
                                        } else if (!strcasecmp(var, "ext-rtp-ip")) {
-                                               profile->extrtpip = switch_core_strdup(profile->pool, strcasecmp(val, "auto") ? val : globals.guess_ip);
+                                               profile->extrtpip = switch_core_strdup(profile->pool, strcasecmp(val, "auto") ? val : mod_sofia_globals.guess_ip);
                                        } else if (!strcasecmp(var, "rtp-ip")) {
-                                               profile->rtpip = switch_core_strdup(profile->pool, strcasecmp(val, "auto") ? val : globals.guess_ip);
+                                               profile->rtpip = switch_core_strdup(profile->pool, strcasecmp(val, "auto") ? val : mod_sofia_globals.guess_ip);
                                        } else if (!strcasecmp(var, "sip-ip")) {
-                                               profile->sipip = switch_core_strdup(profile->pool, strcasecmp(val, "auto") ? val : globals.guess_ip);
+                                               profile->sipip = switch_core_strdup(profile->pool, strcasecmp(val, "auto") ? val : mod_sofia_globals.guess_ip);
                                        } else if (!strcasecmp(var, "ext-sip-ip")) {
                                                if (!strcasecmp(val, "auto")) {
-                                                       profile->extsipip = switch_core_strdup(profile->pool, globals.guess_ip);
+                                                       profile->extsipip = switch_core_strdup(profile->pool, mod_sofia_globals.guess_ip);
                                                } else {
                                                        char *ip = NULL;
                                                        switch_port_t port = 0;
@@ -625,11 +625,11 @@ switch_status_t config_sofia(int reload)
                                }
 
                                if (!profile->sipip) {
-                                       profile->sipip = switch_core_strdup(profile->pool, globals.guess_ip);
+                                       profile->sipip = switch_core_strdup(profile->pool, mod_sofia_globals.guess_ip);
                                }
 
                                if (!profile->rtpip) {
-                                       profile->rtpip = switch_core_strdup(profile->pool, globals.guess_ip);
+                                       profile->rtpip = switch_core_strdup(profile->pool, mod_sofia_globals.guess_ip);
                                }
 
                                if (profile->nonce_ttl < 60) {
index b500a69b6738ae2e8848968b9cf9ab6beeec8a2a..eadbbc08733110393ec66e083925c24d72ae83f0 100644 (file)
@@ -1071,18 +1071,18 @@ sofia_profile_t *sofia_glue_find_profile(char *key)
 {
        sofia_profile_t *profile;
 
-       switch_mutex_lock(globals.hash_mutex);
-       profile = (sofia_profile_t *) switch_core_hash_find(globals.profile_hash, key);
-       switch_mutex_unlock(globals.hash_mutex);
+       switch_mutex_lock(mod_sofia_globals.hash_mutex);
+       profile = (sofia_profile_t *) switch_core_hash_find(mod_sofia_globals.profile_hash, key);
+       switch_mutex_unlock(mod_sofia_globals.hash_mutex);
 
        return profile;
 }
 
 void sofia_glue_add_profile(char *key, sofia_profile_t * profile)
 {
-       switch_mutex_lock(globals.hash_mutex);
-       switch_core_hash_insert(globals.profile_hash, key, profile);
-       switch_mutex_unlock(globals.hash_mutex);
+       switch_mutex_lock(mod_sofia_globals.hash_mutex);
+       switch_core_hash_insert(mod_sofia_globals.profile_hash, key, profile);
+       switch_mutex_unlock(mod_sofia_globals.hash_mutex);
 }
 
 void sofia_glue_execute_sql(char *dbname, char *sql, switch_mutex_t * mutex)
index e658f3782484897f8dcce0fe82023a651003b123..f553c7bdb9bd88ac102d50c36bcd57930a8a232d 100644 (file)
@@ -74,8 +74,8 @@ void sofia_presence_cancel(void)
        void *val;
 
        if ((sql = switch_mprintf("select 0,'unavailable','unavailable',* from sip_subscriptions where event='presence'"))) {
-               switch_mutex_lock(globals.hash_mutex);
-               for (hi = switch_hash_first(switch_hash_pool_get(globals.profile_hash), globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+               switch_mutex_lock(mod_sofia_globals.hash_mutex);
+               for (hi = switch_hash_first(switch_hash_pool_get(mod_sofia_globals.profile_hash), mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
                        switch_hash_this(hi, NULL, NULL, &val);
                        profile = (sofia_profile_t *) val;
                        if (!(profile->pflags & PFLAG_PRESENCE)) {
@@ -93,7 +93,7 @@ void sofia_presence_cancel(void)
                }
                switch_safe_free(sql);
        }
-       switch_mutex_unlock(globals.hash_mutex);
+       switch_mutex_unlock(mod_sofia_globals.hash_mutex);
 }
 
 void sofia_presence_establish_presence(sofia_profile_t * profile)
@@ -209,8 +209,8 @@ void sofia_presence_event_handler(switch_event_t *event)
                        sql = switch_mprintf("select 1,'%q','%q',* from sip_subscriptions where event='presence'", status, rpid);
                }
 
-               switch_mutex_lock(globals.hash_mutex);
-               for (hi = switch_hash_first(switch_hash_pool_get(globals.profile_hash), globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+               switch_mutex_lock(mod_sofia_globals.hash_mutex);
+               for (hi = switch_hash_first(switch_hash_pool_get(mod_sofia_globals.profile_hash), mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
                        switch_hash_this(hi, NULL, NULL, &val);
                        profile = (sofia_profile_t *) val;
                        if (!(profile->pflags & PFLAG_PRESENCE)) {
@@ -229,7 +229,7 @@ void sofia_presence_event_handler(switch_event_t *event)
                        }
 
                }
-               switch_mutex_unlock(globals.hash_mutex);
+               switch_mutex_unlock(mod_sofia_globals.hash_mutex);
 
                return;
        }
@@ -315,8 +315,8 @@ void sofia_presence_event_handler(switch_event_t *event)
                break;
        }
 
-       switch_mutex_lock(globals.hash_mutex);
-       for (hi = switch_hash_first(switch_hash_pool_get(globals.profile_hash), globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+       switch_mutex_lock(mod_sofia_globals.hash_mutex);
+       for (hi = switch_hash_first(switch_hash_pool_get(mod_sofia_globals.profile_hash), mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
                switch_hash_this(hi, NULL, NULL, &val);
                profile = (sofia_profile_t *) val;
                if (!(profile->pflags & PFLAG_PRESENCE)) {
@@ -335,7 +335,7 @@ void sofia_presence_event_handler(switch_event_t *event)
                        switch_core_db_close(db);
                }
        }
-       switch_mutex_unlock(globals.hash_mutex);
+       switch_mutex_unlock(mod_sofia_globals.hash_mutex);
 
        switch_safe_free(sql);
        switch_safe_free(user);
index 1aa3bc8ca46d6abd2bbe05001b729ae635ddee95..0dffeb17beacd2fe6e43ff9e4585d8266a7e32a6 100644 (file)
@@ -772,18 +772,18 @@ outbound_reg_t *sofia_reg_find_gateway(char *key)
 {
        outbound_reg_t *gateway;
 
-       switch_mutex_lock(globals.hash_mutex);
-       gateway = (outbound_reg_t *) switch_core_hash_find(globals.gateway_hash, key);
-       switch_mutex_unlock(globals.hash_mutex);
+       switch_mutex_lock(mod_sofia_globals.hash_mutex);
+       gateway = (outbound_reg_t *) switch_core_hash_find(mod_sofia_globals.gateway_hash, key);
+       switch_mutex_unlock(mod_sofia_globals.hash_mutex);
 
        return gateway;
 }
 
 void sofia_reg_add_gateway(char *key, outbound_reg_t * gateway)
 {
-       switch_mutex_lock(globals.hash_mutex);
-       switch_core_hash_insert(globals.gateway_hash, key, gateway);
-       switch_mutex_unlock(globals.hash_mutex);
+       switch_mutex_lock(mod_sofia_globals.hash_mutex);
+       switch_core_hash_insert(mod_sofia_globals.gateway_hash, key, gateway);
+       switch_mutex_unlock(mod_sofia_globals.hash_mutex);
 }