make name more specific to avoid namespace bs

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4820 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-04-01 01:16:16 +00:00
parent 41d9cf2989
commit bba24931de
6 changed files with 48 additions and 48 deletions

View 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);
}

View 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 {

View 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) {

View 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)

View 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);

View 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);
}