Commit 12902169 authored by Youness Alaoui's avatar Youness Alaoui

Change the compatibility modes from DRAFT19 to RFC5245

parent e5bdf371
......@@ -149,7 +149,7 @@ agent_to_ice_compatibility (NiceAgent *agent)
STUN_USAGE_ICE_COMPATIBILITY_GOOGLE :
agent->compatibility == NICE_COMPATIBILITY_MSN ?
STUN_USAGE_ICE_COMPATIBILITY_MSN :
STUN_USAGE_ICE_COMPATIBILITY_DRAFT19;
STUN_USAGE_ICE_COMPATIBILITY_RFC5245;
}
......@@ -276,8 +276,8 @@ nice_agent_class_init (NiceAgentClass *klass)
"compatibility",
"ICE specification compatibility",
"The compatibility mode for the agent",
NICE_COMPATIBILITY_DRAFT19, NICE_COMPATIBILITY_LAST,
NICE_COMPATIBILITY_DRAFT19,
NICE_COMPATIBILITY_RFC5245, NICE_COMPATIBILITY_LAST,
NICE_COMPATIBILITY_RFC5245,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class, PROP_STUN_SERVER,
......@@ -671,7 +671,7 @@ nice_agent_init (NiceAgent *agent)
agent->media_after_tick = FALSE;
agent->software_attribute = NULL;
agent->compatibility = NICE_COMPATIBILITY_DRAFT19;
agent->compatibility = NICE_COMPATIBILITY_RFC5245;
agent->reliable = FALSE;
stun_agent_init (&agent->stun_agent, STUN_ALL_KNOWN_ATTRIBUTES,
......
......@@ -61,7 +61,7 @@
GSList *lcands = NULL;
// Create a nice agent
NiceAgent *agent = nice_agent_new (NULL, NICE_COMPATIBILITY_DRAFT19);
NiceAgent *agent = nice_agent_new (NULL, NICE_COMPATIBILITY_RFC5245);
// Connect the signals
g_signal_connect (G_OBJECT (agent), "candidate-gathering-done",
......@@ -208,23 +208,29 @@ typedef enum
/**
* NiceCompatibility:
* @NICE_COMPATIBILITY_DRAFT19: Use compatibility for ICE Draft 19 specs
* @NICE_COMPATIBILITY_RFC5245: Use compatibility with the RFC5245 ICE specs
* @NICE_COMPATIBILITY_GOOGLE: Use compatibility for Google Talk specs
* @NICE_COMPATIBILITY_MSN: Use compatibility for MSN Messenger specs
* @NICE_COMPATIBILITY_WLM2009: Use compatibility with Windows Live Messenger
* 2009
* @NICE_COMPATIBILITY_DRAFT19: Use compatibility for ICE Draft 19 specs
* @NICE_COMPATIBILITY_LAST: Dummy last compatibility mode
*
* An enum to specify which compatible specifications the #NiceAgent should use.
* Use with nice_agent_new()
*
* <warning>@NICE_COMPATIBILITY_DRAFT19 is deprecated and should not be used
* in newly-written code. It is kept for compatibility reasons and
* represents the same compatibility as @NICE_COMPATIBILITY_RFC5245 </warning>
*/
typedef enum
{
NICE_COMPATIBILITY_DRAFT19 = 0,
NICE_COMPATIBILITY_RFC5245 = 0,
NICE_COMPATIBILITY_GOOGLE,
NICE_COMPATIBILITY_MSN,
NICE_COMPATIBILITY_WLM2009,
NICE_COMPATIBILITY_LAST = NICE_COMPATIBILITY_WLM2009
NICE_COMPATIBILITY_DRAFT19 = NICE_COMPATIBILITY_RFC5245,
NICE_COMPATIBILITY_LAST = NICE_COMPATIBILITY_WLM2009,
} NiceCompatibility;
/**
......@@ -675,7 +681,7 @@ void nice_agent_set_stream_tos (
* This function will set the value of the SOFTWARE attribute to be added to
* STUN requests, responses and error responses sent during connectivity checks.
* <para>
* The SOFTWARE attribute will only be added in the #NICE_COMPATIBILITY_DRAFT19
* The SOFTWARE attribute will only be added in the #NICE_COMPATIBILITY_RFC5245
* and #NICE_COMPATIBILITY_WLM2009 compatibility modes.
*
* </para>
......
......@@ -1283,7 +1283,7 @@ static gboolean priv_add_new_check_pair (NiceAgent *agent, guint stream_id, Comp
/* implement the hard upper limit for number of
checks (see sect 5.7.3 ICE ID-19): */
if (agent->compatibility == NICE_COMPATIBILITY_DRAFT19) {
if (agent->compatibility == NICE_COMPATIBILITY_RFC5245) {
stream->conncheck_list =
priv_limit_conn_check_list_size (stream->conncheck_list, agent->max_conn_checks);
}
......@@ -1334,7 +1334,7 @@ int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, Component *
/* note: do not create pairs where local candidate is
* a srv-reflexive (ICE 5.7.3. "Pruning the Pairs" ID-19) */
if ((agent->compatibility == NICE_COMPATIBILITY_DRAFT19 ||
if ((agent->compatibility == NICE_COMPATIBILITY_RFC5245 ||
agent->compatibility == NICE_COMPATIBILITY_WLM2009) &&
local->type == NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE)
continue;
......@@ -1453,7 +1453,7 @@ size_t priv_gen_username (NiceAgent *agent, guint component_id,
gsize local_len = strlen (local);
if (remote_len > 0 && local_len > 0) {
if (agent->compatibility == NICE_COMPATIBILITY_DRAFT19 &&
if (agent->compatibility == NICE_COMPATIBILITY_RFC5245 &&
dest_len >= remote_len + local_len + 1) {
memcpy (dest, remote, remote_len);
len += remote_len;
......@@ -1794,7 +1794,7 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream,
/* note: to take care of the controlling-controlling case in
* aggressive nomination mode, send a new triggered
* check to nominate the pair */
if ((agent->compatibility == NICE_COMPATIBILITY_DRAFT19 ||
if ((agent->compatibility == NICE_COMPATIBILITY_RFC5245 ||
agent->compatibility == NICE_COMPATIBILITY_WLM2009) &&
agent->controlling_mode)
priv_conn_check_initiate (agent, p);
......@@ -2383,7 +2383,7 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage *
STUN_ATTRIBUTE_REALM, &recv_realm_len);
/* check for unauthorized error response */
if (agent->compatibility == NICE_COMPATIBILITY_DRAFT19 &&
if (agent->compatibility == NICE_COMPATIBILITY_RFC5245 &&
stun_message_get_class (resp) == STUN_ERROR &&
stun_message_find_error (resp, &code) ==
STUN_MESSAGE_RETURN_SUCCESS &&
......@@ -2471,7 +2471,7 @@ static gboolean priv_map_reply_to_relay_refresh (NiceAgent *agent, StunMessage *
STUN_ATTRIBUTE_REALM, &recv_realm_len);
/* check for unauthorized error response */
if (cand->agent->compatibility == NICE_COMPATIBILITY_DRAFT19 &&
if (cand->agent->compatibility == NICE_COMPATIBILITY_RFC5245 &&
stun_message_get_class (resp) == STUN_ERROR &&
stun_message_find_error (resp, &code) ==
STUN_MESSAGE_RETURN_SUCCESS &&
......
......@@ -111,7 +111,7 @@ int main (void)
len = sizeof (resp_buf);
val2 = stun_usage_ice_conncheck_create_reply (&agent, &req,
&resp, resp_buf, &len, (struct sockaddr *)&ip4,
sizeof (ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_DRAFT19);
sizeof (ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_RFC5245);
assert (val2 == STUN_USAGE_ICE_RETURN_INVALID_REQUEST);
assert (len == 0);
......@@ -125,7 +125,7 @@ int main (void)
len = sizeof (resp_buf);
val2 = stun_usage_ice_conncheck_create_reply (&agent, &req,
&resp, resp_buf, &len, (struct sockaddr *)&ip4,
sizeof (ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_DRAFT19);
sizeof (ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_RFC5245);
assert (val2 == STUN_USAGE_ICE_RETURN_INVALID_METHOD);
assert (len > 0);
......@@ -179,7 +179,7 @@ int main (void)
len = sizeof (resp_buf);
val2 = stun_usage_ice_conncheck_create_reply (&agent, &req,
&resp, resp_buf, &len, (struct sockaddr *)&ip4,
sizeof (ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_DRAFT19);
sizeof (ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_RFC5245);
assert (val == STUN_USAGE_ICE_RETURN_SUCCESS);
assert (len > 0);
assert (stun_agent_validate (&agent, &resp, resp_buf, len,
......@@ -199,7 +199,7 @@ int main (void)
len = sizeof (resp_buf);
val2 = stun_usage_ice_conncheck_create_reply (&agent, &req,
&resp, resp_buf, &len, (struct sockaddr *)&ip4,
sizeof (ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_DRAFT19);
sizeof (ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_RFC5245);
assert (val2 == STUN_USAGE_ICE_RETURN_INVALID_ADDRESS);
assert (len == 0);
......@@ -219,7 +219,7 @@ int main (void)
control = true;
val2 = stun_usage_ice_conncheck_create_reply (&agent, &req,
&resp, resp_buf, &len, (struct sockaddr *)&ip4,
sizeof (ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_DRAFT19);
sizeof (ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_RFC5245);
assert (val2 == STUN_USAGE_ICE_RETURN_ROLE_CONFLICT);
assert (len > 0);
assert (control == false);
......@@ -240,7 +240,7 @@ int main (void)
control = false;
val2 = stun_usage_ice_conncheck_create_reply (&agent, &req,
&resp, resp_buf, &len, (struct sockaddr *)&ip4,
sizeof (ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_DRAFT19);
sizeof (ip4), &control, tie, STUN_USAGE_ICE_COMPATIBILITY_RFC5245);
assert (val2 == STUN_USAGE_ICE_RETURN_SUCCESS);
assert (len > 0);
assert (control == false);
......
......@@ -70,7 +70,7 @@ stun_usage_ice_conncheck_create (StunAgent *agent, StunMessage *msg,
stun_agent_init_request (agent, msg, buffer, buffer_len, STUN_BINDING);
if (compatibility == STUN_USAGE_ICE_COMPATIBILITY_DRAFT19) {
if (compatibility == STUN_USAGE_ICE_COMPATIBILITY_RFC5245) {
if (cand_use)
{
val = stun_message_append_flag (msg, STUN_ATTRIBUTE_USE_CANDIDATE);
......
......@@ -60,18 +60,25 @@ extern "C" {
/**
* StunUsageIceCompatibility:
* @STUN_USAGE_ICE_COMPATIBILITY_DRAFT19: The ICE compatibility with draft 19
* @STUN_USAGE_ICE_COMPATIBILITY_RFC5245: The ICE compatibility with RFC 5245
* @STUN_USAGE_ICE_COMPATIBILITY_GOOGLE: The ICE compatibility with Google's
* implementation of ICE
* @STUN_USAGE_ICE_COMPATIBILITY_MSN: The ICE compatibility with MSN's
* implementation of ICE
* @STUN_USAGE_ICE_COMPATIBILITY_DRAFT19: The ICE compatibility with draft 19
*
* This enum defines which compatibility modes this ICE usage can use
*
* <warning>@STUN_USAGE_ICE_COMPATIBILITY_DRAFT19 is deprecated and should not
* be used in newly-written code. It is kept for compatibility reasons and
* represents the same compatibility as @STUN_USAGE_ICE_COMPATIBILITY_RFC5245
* </warning>
*/
typedef enum {
STUN_USAGE_ICE_COMPATIBILITY_DRAFT19,
STUN_USAGE_ICE_COMPATIBILITY_RFC5245,
STUN_USAGE_ICE_COMPATIBILITY_GOOGLE,
STUN_USAGE_ICE_COMPATIBILITY_MSN,
STUN_USAGE_ICE_COMPATIBILITY_DRAFT19 = STUN_USAGE_ICE_COMPATIBILITY_RFC5245,
} StunUsageIceCompatibility;
......@@ -127,7 +134,7 @@ typedef enum {
* request
*
* Builds an ICE connectivity check STUN message.
* If the compatibility is not #STUN_USAGE_ICE_COMPATIBILITY_DRAFT19, the
* If the compatibility is not #STUN_USAGE_ICE_COMPATIBILITY_RFC5245, the
* @cand_use, @controlling, @priority and @tie arguments are not used.
* Returns: The length of the message built.
*/
......
......@@ -57,7 +57,7 @@ main (void)
if (!nice_address_set_from_string (&addr, "127.0.0.1"))
g_assert_not_reached ();
agent = nice_agent_new (NULL, NICE_COMPATIBILITY_DRAFT19);
agent = nice_agent_new (NULL, NICE_COMPATIBILITY_RFC5245);
nice_agent_add_local_address (agent, &addr);
g_assert (nice_agent_add_stream (agent, 1) == 1);
......
......@@ -493,8 +493,8 @@ int main (void)
*/
/* step: create the agents L and R */
lagent = nice_agent_new (g_main_loop_get_context (global_mainloop), NICE_COMPATIBILITY_DRAFT19);
ragent = nice_agent_new (g_main_loop_get_context (global_mainloop), NICE_COMPATIBILITY_DRAFT19);
lagent = nice_agent_new (g_main_loop_get_context (global_mainloop), NICE_COMPATIBILITY_RFC5245);
ragent = nice_agent_new (g_main_loop_get_context (global_mainloop), NICE_COMPATIBILITY_RFC5245);
......
......@@ -73,7 +73,7 @@
#endif
#else
#define NICE_COMPATIBILITY NICE_COMPATIBILITY_DRAFT19
#define NICE_COMPATIBILITY NICE_COMPATIBILITY_RFC5245
#if USE_LOOPBACK
#define USE_TURN_SERVER_ORG 1
#else
......
......@@ -76,7 +76,7 @@ main (void)
g_thread_init (NULL);
loop = g_main_loop_new (NULL, FALSE);
agent = nice_agent_new (g_main_loop_get_context (loop), NICE_COMPATIBILITY_DRAFT19);
agent = nice_agent_new (g_main_loop_get_context (loop), NICE_COMPATIBILITY_RFC5245);
nice_address_set_ipv4 (&addr, 0x7f000001);
nice_agent_add_local_address (agent, &addr);
stream = nice_agent_add_stream (agent, 1);
......
......@@ -404,8 +404,8 @@ int main (void)
/* step: create the agents L and R */
lagent = nice_agent_new (g_main_loop_get_context (global_mainloop), NICE_COMPATIBILITY_DRAFT19);
ragent = nice_agent_new (g_main_loop_get_context (global_mainloop), NICE_COMPATIBILITY_DRAFT19);
lagent = nice_agent_new (g_main_loop_get_context (global_mainloop), NICE_COMPATIBILITY_RFC5245);
ragent = nice_agent_new (g_main_loop_get_context (global_mainloop), NICE_COMPATIBILITY_RFC5245);
/* step: add a timer to catch state changes triggered by signals */
......
......@@ -62,7 +62,7 @@ main (void)
g_assert (nice_address_set_from_string (&addr_remote, "127.0.0.1"));
nice_address_set_port (&addr_remote, 2345);
agent = nice_agent_new ( NULL, NICE_COMPATIBILITY_DRAFT19);
agent = nice_agent_new ( NULL, NICE_COMPATIBILITY_RFC5245);
g_assert (agent->local_addresses == NULL);
......
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