* @server: The #NiceAddress of the TURN server
* @username: The TURN username
* @password: The TURN password
+ * @decoded_username: The base64 decoded TURN username
+ * @decoded_password: The base64 decoded TURN password
+ * @decoded_username_len: The length of @decoded_username
+ * @decoded_password_len: The length of @decoded_password
* @type: The #NiceRelayType of the server
*
* A structure to store the TURN relay settings
NiceAddress server;
gchar *username;
gchar *password;
+ uint8_t *decoded_username;
+ uint8_t *decoded_password;
+ gsize decoded_username_len;
+ gsize decoded_password_len;
NiceRelayType type;
};
}
turn->username = g_strdup (username);
turn->password = g_strdup (password);
+ turn->decoded_username =
+ g_base64_decode ((gchar *)username, &turn->decoded_username_len);
+ turn->decoded_password =
+ g_base64_decode ((gchar *)password, &turn->decoded_password_len);
turn->type = type;
return turn;
if (turn->ref_count == 0) {
g_free (turn->username);
g_free (turn->password);
+ g_free (turn->decoded_username);
+ g_free (turn->decoded_password);
g_slice_free (TurnServer, turn);
}
}
if (turn_compat == STUN_USAGE_TURN_COMPATIBILITY_MSN ||
turn_compat == STUN_USAGE_TURN_COMPATIBILITY_OC2007) {
- username = g_base64_decode ((gchar *)username, &username_len);
- password = g_base64_decode ((gchar *)password, &password_len);
+ username = cand->candidate->turn->decoded_username;
+ password = cand->candidate->turn->decoded_password;
+ username_len = cand->candidate->turn->decoded_username_len;
+ password_len = cand->candidate->turn->decoded_password_len;
}
buffer_len = stun_usage_turn_create_refresh (&cand->stun_agent,
password, password_len,
turn_compat);
- if (turn_compat == STUN_USAGE_TURN_COMPATIBILITY_MSN ||
- turn_compat == STUN_USAGE_TURN_COMPATIBILITY_OC2007) {
- g_free (username);
- g_free (password);
- }
-
nice_debug ("Agent %p : Sending allocate Refresh %zd", agent,
buffer_len);
if (turn_compat == STUN_USAGE_TURN_COMPATIBILITY_MSN ||
turn_compat == STUN_USAGE_TURN_COMPATIBILITY_OC2007) {
- username = g_base64_decode ((gchar *)username, &username_len);
- password = g_base64_decode ((gchar *)password, &password_len);
+ username = cand->candidate->turn->decoded_username;
+ password = cand->candidate->turn->decoded_password;
+ username_len = cand->candidate->turn->decoded_username_len;
+ password_len = cand->candidate->turn->decoded_password_len;
}
buffer_len = stun_usage_turn_create_refresh (&cand->stun_agent,
(NiceTimeoutLockedCallback) on_refresh_remove_timeout, cand);
}
- if (turn_compat == STUN_USAGE_TURN_COMPATIBILITY_MSN ||
- turn_compat == STUN_USAGE_TURN_COMPATIBILITY_OC2007) {
- g_free (username);
- g_free (password);
- }
-
cand->destroy_cb = cb;
cand->destroy_cb_data = cb_data;
if (turn_compat == STUN_USAGE_TURN_COMPATIBILITY_MSN ||
turn_compat == STUN_USAGE_TURN_COMPATIBILITY_OC2007) {
- username = g_base64_decode ((gchar *)username, &username_len);
- password = g_base64_decode ((gchar *)password, &password_len);
+ username = cand->turn->decoded_username;
+ password = cand->turn->decoded_password;
+ username_len = cand->turn->decoded_username_len;
+ password_len = cand->turn->decoded_password_len;
}
buffer_len = stun_usage_turn_create (&cand->stun_agent,
username, username_len,
password, password_len,
turn_compat);
-
- if (turn_compat == STUN_USAGE_TURN_COMPATIBILITY_MSN ||
- turn_compat == STUN_USAGE_TURN_COMPATIBILITY_OC2007) {
- g_free (username);
- g_free (password);
- }
}
if (buffer_len > 0) {