[Nice] [nice/master] use stun_agent instead of turn_agent in order to be more generic

Youness Alaoui youness.alaoui at collabora.co.uk
Wed Nov 12 14:58:48 PST 2008


---
 agent/agent.c     |    6 +++---
 agent/conncheck.c |    8 ++++----
 agent/discovery.c |    4 ++--
 agent/discovery.h |    4 ++--
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/agent/agent.c b/agent/agent.c
index bfb883b..7004c06 100644
--- a/agent/agent.c
+++ b/agent/agent.c
@@ -788,16 +788,16 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
       cdisco->agent = agent;
 
       if (agent->compatibility == NICE_COMPATIBILITY_DRAFT19) {
-        stun_agent_init (&cdisco->turn_agent, STUN_ALL_KNOWN_ATTRIBUTES,
+        stun_agent_init (&cdisco->stun_agent, STUN_ALL_KNOWN_ATTRIBUTES,
             STUN_COMPATIBILITY_RFC5389,
             STUN_AGENT_USAGE_ADD_SOFTWARE |
             STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS);
       } else if (agent->compatibility == NICE_COMPATIBILITY_MSN) {
-        stun_agent_init (&cdisco->turn_agent, STUN_ALL_KNOWN_ATTRIBUTES,
+        stun_agent_init (&cdisco->stun_agent, STUN_ALL_KNOWN_ATTRIBUTES,
             STUN_COMPATIBILITY_RFC3489,
             STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS);
       } else if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) {
-        stun_agent_init (&cdisco->turn_agent, STUN_ALL_KNOWN_ATTRIBUTES,
+        stun_agent_init (&cdisco->stun_agent, STUN_ALL_KNOWN_ATTRIBUTES,
             STUN_COMPATIBILITY_RFC3489,
             STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS |
             STUN_AGENT_USAGE_IGNORE_CREDENTIALS);
diff --git a/agent/conncheck.c b/agent/conncheck.c
index b3e6e3a..40ee829 100644
--- a/agent/conncheck.c
+++ b/agent/conncheck.c
@@ -576,7 +576,7 @@ static void priv_turn_allocate_refresh_tick_unlocked (CandidateRefresh *cand)
     password = g_base64_decode ((gchar *)password, &password_len);
   }
 
-  buffer_len = stun_usage_turn_create_refresh (&cand->turn_agent,
+  buffer_len = stun_usage_turn_create_refresh (&cand->stun_agent,
       &cand->stun_message,  cand->stun_buffer, sizeof(cand->stun_buffer),
       cand->stun_resp_msg.buffer == NULL ? NULL : &cand->stun_resp_msg, -1,
       username, username_len,
@@ -1877,7 +1877,7 @@ priv_add_new_turn_refresh (CandidateDiscovery *cdisco, NiceCandidate *relay_cand
       cand->stream = cdisco->stream;
       cand->component = cdisco->component;
       cand->agent = cdisco->agent;
-      memcpy (&cand->turn_agent, &cdisco->turn_agent, sizeof(StunAgent));
+      memcpy (&cand->stun_agent, &cdisco->stun_agent, sizeof(StunAgent));
       nice_debug ("Agent %p : Adding new refresh candidate %p with timeout %d",
           agent, cand, (lifetime - 60) * 1000);
       agent->refresh_list = modified_list;
@@ -2241,7 +2241,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
       if (d->type == NICE_CANDIDATE_TYPE_RELAYED &&
           d->stream == stream && d->component == component &&
           d->nicesock == socket) {
-        valid = stun_agent_validate (&d->turn_agent, &req,
+        valid = stun_agent_validate (&d->stun_agent, &req,
             (uint8_t *) buf, len, conncheck_stun_validater, &validater_data);
 
         if (valid == STUN_VALIDATION_UNMATCHED_RESPONSE)
@@ -2261,7 +2261,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
           stream, r->component, component, r->nicesock, r->relay_socket, socket);
       if (r->stream == stream && r->component == component &&
           (r->nicesock == socket || r->relay_socket == socket)) {
-        valid = stun_agent_validate (&r->turn_agent, &req,
+        valid = stun_agent_validate (&r->stun_agent, &req,
             (uint8_t *) buf, len, conncheck_stun_validater, &validater_data);
         nice_debug ("Validating gave %d", valid);
         if (valid == STUN_VALIDATION_UNMATCHED_RESPONSE)
diff --git a/agent/discovery.c b/agent/discovery.c
index 5a15787..5ba5048 100644
--- a/agent/discovery.c
+++ b/agent/discovery.c
@@ -186,7 +186,7 @@ void refresh_free_item (gpointer data, gpointer user_data)
     password = g_base64_decode ((gchar *)password, &password_len);
   }
 
-  buffer_len = stun_usage_turn_create_refresh (&cand->turn_agent,
+  buffer_len = stun_usage_turn_create_refresh (&cand->stun_agent,
       &cand->stun_message,  cand->stun_buffer, sizeof(cand->stun_buffer),
       cand->stun_resp_msg.buffer == NULL ? NULL : &cand->stun_resp_msg, 0,
       username, username_len,
@@ -848,7 +848,7 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
             password = g_base64_decode ((gchar *)password, &password_len);
           }
 
-          buffer_len = stun_usage_turn_create (&cand->turn_agent,
+          buffer_len = stun_usage_turn_create (&cand->stun_agent,
               &cand->stun_message,  cand->stun_buffer, sizeof(cand->stun_buffer),
               cand->stun_resp_msg.buffer == NULL ? NULL : &cand->stun_resp_msg,
               STUN_USAGE_TURN_REQUEST_PORT_NORMAL,
diff --git a/agent/discovery.h b/agent/discovery.h
index 70a064e..f79fb4e 100644
--- a/agent/discovery.h
+++ b/agent/discovery.h
@@ -53,7 +53,7 @@ typedef struct
   Stream *stream;
   Component *component;
   TurnServer *turn;
-  StunAgent turn_agent;
+  StunAgent stun_agent;
   uint8_t *msn_turn_username;
   uint8_t *msn_turn_password;
   stun_timer_t timer;
@@ -72,7 +72,7 @@ typedef struct
   Stream *stream;
   Component *component;
   TurnServer *turn;
-  StunAgent turn_agent;
+  StunAgent stun_agent;
   GSource *timer_source;
   GSource *tick_source;
   uint8_t *msn_turn_username;
-- 
1.5.6.5




More information about the Nice mailing list