Commit 2a9bac88 authored by Youness Alaoui's avatar Youness Alaoui

use stun_agent instead of turn_agent in order to be more generic

parent 6b81931a
...@@ -788,16 +788,16 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent, ...@@ -788,16 +788,16 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
cdisco->agent = agent; cdisco->agent = agent;
if (agent->compatibility == NICE_COMPATIBILITY_DRAFT19) { 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_COMPATIBILITY_RFC5389,
STUN_AGENT_USAGE_ADD_SOFTWARE | STUN_AGENT_USAGE_ADD_SOFTWARE |
STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS); STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS);
} else if (agent->compatibility == NICE_COMPATIBILITY_MSN) { } 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_COMPATIBILITY_RFC3489,
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS); STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS);
} else if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) { } 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_COMPATIBILITY_RFC3489,
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS | STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS |
STUN_AGENT_USAGE_IGNORE_CREDENTIALS); STUN_AGENT_USAGE_IGNORE_CREDENTIALS);
......
...@@ -576,7 +576,7 @@ static void priv_turn_allocate_refresh_tick_unlocked (CandidateRefresh *cand) ...@@ -576,7 +576,7 @@ static void priv_turn_allocate_refresh_tick_unlocked (CandidateRefresh *cand)
password = g_base64_decode ((gchar *)password, &password_len); 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_message, cand->stun_buffer, sizeof(cand->stun_buffer),
cand->stun_resp_msg.buffer == NULL ? NULL : &cand->stun_resp_msg, -1, cand->stun_resp_msg.buffer == NULL ? NULL : &cand->stun_resp_msg, -1,
username, username_len, username, username_len,
...@@ -1877,7 +1877,7 @@ priv_add_new_turn_refresh (CandidateDiscovery *cdisco, NiceCandidate *relay_cand ...@@ -1877,7 +1877,7 @@ priv_add_new_turn_refresh (CandidateDiscovery *cdisco, NiceCandidate *relay_cand
cand->stream = cdisco->stream; cand->stream = cdisco->stream;
cand->component = cdisco->component; cand->component = cdisco->component;
cand->agent = cdisco->agent; 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", nice_debug ("Agent %p : Adding new refresh candidate %p with timeout %d",
agent, cand, (lifetime - 60) * 1000); agent, cand, (lifetime - 60) * 1000);
agent->refresh_list = modified_list; agent->refresh_list = modified_list;
...@@ -2241,7 +2241,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, ...@@ -2241,7 +2241,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
if (d->type == NICE_CANDIDATE_TYPE_RELAYED && if (d->type == NICE_CANDIDATE_TYPE_RELAYED &&
d->stream == stream && d->component == component && d->stream == stream && d->component == component &&
d->nicesock == socket) { 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); (uint8_t *) buf, len, conncheck_stun_validater, &validater_data);
if (valid == STUN_VALIDATION_UNMATCHED_RESPONSE) if (valid == STUN_VALIDATION_UNMATCHED_RESPONSE)
...@@ -2261,7 +2261,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, ...@@ -2261,7 +2261,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
stream, r->component, component, r->nicesock, r->relay_socket, socket); stream, r->component, component, r->nicesock, r->relay_socket, socket);
if (r->stream == stream && r->component == component && if (r->stream == stream && r->component == component &&
(r->nicesock == socket || r->relay_socket == socket)) { (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); (uint8_t *) buf, len, conncheck_stun_validater, &validater_data);
nice_debug ("Validating gave %d", valid); nice_debug ("Validating gave %d", valid);
if (valid == STUN_VALIDATION_UNMATCHED_RESPONSE) if (valid == STUN_VALIDATION_UNMATCHED_RESPONSE)
......
...@@ -186,7 +186,7 @@ void refresh_free_item (gpointer data, gpointer user_data) ...@@ -186,7 +186,7 @@ void refresh_free_item (gpointer data, gpointer user_data)
password = g_base64_decode ((gchar *)password, &password_len); 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_message, cand->stun_buffer, sizeof(cand->stun_buffer),
cand->stun_resp_msg.buffer == NULL ? NULL : &cand->stun_resp_msg, 0, cand->stun_resp_msg.buffer == NULL ? NULL : &cand->stun_resp_msg, 0,
username, username_len, username, username_len,
...@@ -848,7 +848,7 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer) ...@@ -848,7 +848,7 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
password = g_base64_decode ((gchar *)password, &password_len); 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_message, cand->stun_buffer, sizeof(cand->stun_buffer),
cand->stun_resp_msg.buffer == NULL ? NULL : &cand->stun_resp_msg, cand->stun_resp_msg.buffer == NULL ? NULL : &cand->stun_resp_msg,
STUN_USAGE_TURN_REQUEST_PORT_NORMAL, STUN_USAGE_TURN_REQUEST_PORT_NORMAL,
......
...@@ -53,7 +53,7 @@ typedef struct ...@@ -53,7 +53,7 @@ typedef struct
Stream *stream; Stream *stream;
Component *component; Component *component;
TurnServer *turn; TurnServer *turn;
StunAgent turn_agent; StunAgent stun_agent;
uint8_t *msn_turn_username; uint8_t *msn_turn_username;
uint8_t *msn_turn_password; uint8_t *msn_turn_password;
stun_timer_t timer; stun_timer_t timer;
...@@ -72,7 +72,7 @@ typedef struct ...@@ -72,7 +72,7 @@ typedef struct
Stream *stream; Stream *stream;
Component *component; Component *component;
TurnServer *turn; TurnServer *turn;
StunAgent turn_agent; StunAgent stun_agent;
GSource *timer_source; GSource *timer_source;
GSource *tick_source; GSource *tick_source;
uint8_t *msn_turn_username; uint8_t *msn_turn_username;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment