Commit 65d4782c authored by Youness Alaoui's avatar Youness Alaoui

more clarity : COMPATIBILITY_TD9 becomes COMPATIBILITY_DRAFT9 for TURN compat

parent 932fa92f
...@@ -83,11 +83,11 @@ static StunUsageIceCompatibility priv_agent_to_ice_compatibility (NiceAgent *age ...@@ -83,11 +83,11 @@ static StunUsageIceCompatibility priv_agent_to_ice_compatibility (NiceAgent *age
static StunUsageTurnCompatibility priv_agent_to_turn_compatibility (NiceAgent *agent) { static StunUsageTurnCompatibility priv_agent_to_turn_compatibility (NiceAgent *agent) {
return agent->compatibility == NICE_COMPATIBILITY_DRAFT19 ? return agent->compatibility == NICE_COMPATIBILITY_DRAFT19 ?
STUN_USAGE_TURN_COMPATIBILITY_TD9 : STUN_USAGE_TURN_COMPATIBILITY_DRAFT9 :
agent->compatibility == NICE_COMPATIBILITY_GOOGLE ? agent->compatibility == NICE_COMPATIBILITY_GOOGLE ?
STUN_USAGE_TURN_COMPATIBILITY_GOOGLE : STUN_USAGE_TURN_COMPATIBILITY_GOOGLE :
agent->compatibility == NICE_COMPATIBILITY_MSN ? agent->compatibility == NICE_COMPATIBILITY_MSN ?
STUN_USAGE_TURN_COMPATIBILITY_MSN : STUN_USAGE_TURN_COMPATIBILITY_TD9; STUN_USAGE_TURN_COMPATIBILITY_MSN : STUN_USAGE_TURN_COMPATIBILITY_DRAFT9;
} }
......
...@@ -69,13 +69,25 @@ static inline int priv_timer_expired (GTimeVal *restrict timer, GTimeVal *restri ...@@ -69,13 +69,25 @@ static inline int priv_timer_expired (GTimeVal *restrict timer, GTimeVal *restri
now->tv_sec >= timer->tv_sec; now->tv_sec >= timer->tv_sec;
} }
static StunUsageTurnCompatibility priv_agent_to_turn_compatibility (NiceAgent *agent) { static StunUsageTurnCompatibility
priv_agent_to_turn_compatibility (NiceAgent *agent) {
return agent->compatibility == NICE_COMPATIBILITY_DRAFT19 ? return agent->compatibility == NICE_COMPATIBILITY_DRAFT19 ?
STUN_USAGE_TURN_COMPATIBILITY_TD9 : STUN_USAGE_TURN_COMPATIBILITY_DRAFT9 :
agent->compatibility == NICE_COMPATIBILITY_GOOGLE ? agent->compatibility == NICE_COMPATIBILITY_GOOGLE ?
STUN_USAGE_TURN_COMPATIBILITY_GOOGLE : STUN_USAGE_TURN_COMPATIBILITY_GOOGLE :
agent->compatibility == NICE_COMPATIBILITY_MSN ? agent->compatibility == NICE_COMPATIBILITY_MSN ?
STUN_USAGE_TURN_COMPATIBILITY_MSN : STUN_USAGE_TURN_COMPATIBILITY_TD9; STUN_USAGE_TURN_COMPATIBILITY_MSN : STUN_USAGE_TURN_COMPATIBILITY_DRAFT9;
}
static NiceUdpTurnSocketCompatibility
priv_agent_to_udp_turn_compatibility (NiceAgent *agent) {
return agent->compatibility == NICE_COMPATIBILITY_DRAFT19 ?
NICE_UDP_TURN_SOCKET_COMPATIBILITY_DRAFT9 :
agent->compatibility == NICE_COMPATIBILITY_GOOGLE ?
NICE_UDP_TURN_SOCKET_COMPATIBILITY_GOOGLE :
agent->compatibility == NICE_COMPATIBILITY_MSN ?
NICE_UDP_TURN_SOCKET_COMPATIBILITY_MSN :
NICE_UDP_TURN_SOCKET_COMPATIBILITY_DRAFT9;
} }
/** /**
...@@ -424,7 +436,7 @@ discovery_add_relay_candidate ( ...@@ -424,7 +436,7 @@ discovery_add_relay_candidate (
if (nice_udp_turn_create_socket_full (&agent->relay_socket_factory, if (nice_udp_turn_create_socket_full (&agent->relay_socket_factory,
relay_socket, address, base_socket, &component->turn_server, relay_socket, address, base_socket, &component->turn_server,
component->turn_username, component->turn_password, component->turn_username, component->turn_password,
NICE_UDP_TURN_SOCKET_COMPATIBILITY_GOOGLE)) { priv_agent_to_udp_turn_compatibility (agent))) {
candidate->sockptr = relay_socket; candidate->sockptr = relay_socket;
candidate->base_addr = base_socket->addr; candidate->base_addr = base_socket->addr;
......
...@@ -157,7 +157,7 @@ static void numb (void) ...@@ -157,7 +157,7 @@ static void numb (void)
STUN_USAGE_TURN_REQUEST_PORT_NORMAL, STUN_USAGE_TURN_REQUEST_PORT_NORMAL,
0, 0, 0, 0,
username, strlen (username), password, strlen(password), username, strlen (username), password, strlen(password),
STUN_USAGE_TURN_COMPATIBILITY_TD9); STUN_USAGE_TURN_COMPATIBILITY_DRAFT9);
assert (req_len > 0); assert (req_len > 0);
val = send (fd, req, req_len, MSG_NOSIGNAL); val = send (fd, req, req_len, MSG_NOSIGNAL);
...@@ -174,7 +174,7 @@ static void numb (void) ...@@ -174,7 +174,7 @@ static void numb (void)
(struct sockaddr *)&addr, &addrlen, (struct sockaddr *)&addr, &addrlen,
(struct sockaddr *)&alternate_addr, &alternate_addrlen, (struct sockaddr *)&alternate_addr, &alternate_addrlen,
&bandwidth, &lifetime, &bandwidth, &lifetime,
STUN_USAGE_TURN_COMPATIBILITY_TD9); STUN_USAGE_TURN_COMPATIBILITY_DRAFT9);
assert (val == STUN_USAGE_TURN_RETURN_ERROR); assert (val == STUN_USAGE_TURN_RETURN_ERROR);
req_len = stun_usage_turn_create (&agent, &req_msg, req, sizeof(req), req_len = stun_usage_turn_create (&agent, &req_msg, req, sizeof(req),
...@@ -182,7 +182,7 @@ static void numb (void) ...@@ -182,7 +182,7 @@ static void numb (void)
STUN_USAGE_TURN_REQUEST_PORT_NORMAL, STUN_USAGE_TURN_REQUEST_PORT_NORMAL,
0, 0, 0, 0,
username, strlen (username), password, strlen(password), username, strlen (username), password, strlen(password),
STUN_USAGE_TURN_COMPATIBILITY_TD9); STUN_USAGE_TURN_COMPATIBILITY_DRAFT9);
assert (req_len > 0); assert (req_len > 0);
val = send (fd, req, req_len, MSG_NOSIGNAL); val = send (fd, req, req_len, MSG_NOSIGNAL);
...@@ -199,7 +199,7 @@ static void numb (void) ...@@ -199,7 +199,7 @@ static void numb (void)
(struct sockaddr *)&addr, &addrlen, (struct sockaddr *)&addr, &addrlen,
(struct sockaddr *)&alternate_addr, &alternate_addrlen, (struct sockaddr *)&alternate_addr, &alternate_addrlen,
&bandwidth, &lifetime, &bandwidth, &lifetime,
STUN_USAGE_TURN_COMPATIBILITY_TD9); STUN_USAGE_TURN_COMPATIBILITY_DRAFT9);
assert (val == STUN_USAGE_TURN_RETURN_MAPPED_SUCCESS); assert (val == STUN_USAGE_TURN_RETURN_MAPPED_SUCCESS);
printaddr ("Relay address found : ", (struct sockaddr *)&relay_addr, relay_addrlen); printaddr ("Relay address found : ", (struct sockaddr *)&relay_addr, relay_addrlen);
...@@ -207,7 +207,7 @@ static void numb (void) ...@@ -207,7 +207,7 @@ static void numb (void)
req_len = stun_usage_turn_create_refresh (&agent, &refresh_msg, refresh, req_len = stun_usage_turn_create_refresh (&agent, &refresh_msg, refresh,
sizeof(refresh), &req_msg, 0, STUN_USAGE_TURN_COMPATIBILITY_TD9); sizeof(refresh), &req_msg, 0, STUN_USAGE_TURN_COMPATIBILITY_DRAFT9);
assert (req_len > 0); assert (req_len > 0);
val = send (fd, refresh, req_len, MSG_NOSIGNAL); val = send (fd, refresh, req_len, MSG_NOSIGNAL);
......
...@@ -75,7 +75,7 @@ size_t stun_usage_turn_create (StunAgent *agent, StunMessage *msg, ...@@ -75,7 +75,7 @@ size_t stun_usage_turn_create (StunAgent *agent, StunMessage *msg,
{ {
stun_agent_init_request (agent, msg, buffer, buffer_len, STUN_ALLOCATE); stun_agent_init_request (agent, msg, buffer, buffer_len, STUN_ALLOCATE);
if (compatibility == STUN_USAGE_TURN_COMPATIBILITY_TD9) { if (compatibility == STUN_USAGE_TURN_COMPATIBILITY_DRAFT9) {
if (stun_message_append32 (msg, STUN_ATTRIBUTE_REQUESTED_TRANSPORT, if (stun_message_append32 (msg, STUN_ATTRIBUTE_REQUESTED_TRANSPORT,
TURN_REQUESTED_TRANSPORT_UDP) != 0) TURN_REQUESTED_TRANSPORT_UDP) != 0)
return 0; return 0;
...@@ -93,7 +93,7 @@ size_t stun_usage_turn_create (StunAgent *agent, StunMessage *msg, ...@@ -93,7 +93,7 @@ size_t stun_usage_turn_create (StunAgent *agent, StunMessage *msg,
return 0; return 0;
} }
if (compatibility == STUN_USAGE_TURN_COMPATIBILITY_TD9 && if (compatibility == STUN_USAGE_TURN_COMPATIBILITY_DRAFT9 &&
request_props != STUN_USAGE_TURN_REQUEST_PORT_NORMAL) { request_props != STUN_USAGE_TURN_REQUEST_PORT_NORMAL) {
uint32_t req = 0; uint32_t req = 0;
...@@ -158,7 +158,7 @@ size_t stun_usage_turn_create_refresh (StunAgent *agent, StunMessage *msg, ...@@ -158,7 +158,7 @@ size_t stun_usage_turn_create_refresh (StunAgent *agent, StunMessage *msg,
uint8_t *username = NULL; uint8_t *username = NULL;
uint16_t len; uint16_t len;
if (compatibility == STUN_USAGE_TURN_COMPATIBILITY_TD9) { if (compatibility == STUN_USAGE_TURN_COMPATIBILITY_DRAFT9) {
stun_agent_init_request (agent, msg, buffer, buffer_len, STUN_REFRESH); stun_agent_init_request (agent, msg, buffer, buffer_len, STUN_REFRESH);
if (lifetime >= 0) { if (lifetime >= 0) {
if (stun_message_append32 (msg, STUN_ATTRIBUTE_LIFETIME, lifetime) != 0) if (stun_message_append32 (msg, STUN_ATTRIBUTE_LIFETIME, lifetime) != 0)
...@@ -250,7 +250,7 @@ StunUsageTurnReturn stun_usage_turn_process (StunMessage *msg, ...@@ -250,7 +250,7 @@ StunUsageTurnReturn stun_usage_turn_process (StunMessage *msg,
stun_debug ("Received %u-bytes STUN message\n", stun_message_length (msg)); stun_debug ("Received %u-bytes STUN message\n", stun_message_length (msg));
if (compatibility == STUN_USAGE_TURN_COMPATIBILITY_TD9) { if (compatibility == STUN_USAGE_TURN_COMPATIBILITY_DRAFT9) {
val = stun_message_find_xor_addr (msg, val = stun_message_find_xor_addr (msg,
STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS, addr, addrlen); STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS, addr, addrlen);
......
...@@ -57,7 +57,7 @@ extern "C" { ...@@ -57,7 +57,7 @@ extern "C" {
#define STUN_USAGE_TURN_REQUEST_PORT_PRESERVING (1<<2) #define STUN_USAGE_TURN_REQUEST_PORT_PRESERVING (1<<2)
typedef enum { typedef enum {
STUN_USAGE_TURN_COMPATIBILITY_TD9, STUN_USAGE_TURN_COMPATIBILITY_DRAFT9,
STUN_USAGE_TURN_COMPATIBILITY_GOOGLE, STUN_USAGE_TURN_COMPATIBILITY_GOOGLE,
STUN_USAGE_TURN_COMPATIBILITY_MSN, STUN_USAGE_TURN_COMPATIBILITY_MSN,
} StunUsageTurnCompatibility; } StunUsageTurnCompatibility;
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
G_BEGIN_DECLS G_BEGIN_DECLS
typedef enum { typedef enum {
NICE_UDP_TURN_SOCKET_COMPATIBILITY_TD9, NICE_UDP_TURN_SOCKET_COMPATIBILITY_DRAFT9,
NICE_UDP_TURN_SOCKET_COMPATIBILITY_GOOGLE, NICE_UDP_TURN_SOCKET_COMPATIBILITY_GOOGLE,
NICE_UDP_TURN_SOCKET_COMPATIBILITY_MSN, NICE_UDP_TURN_SOCKET_COMPATIBILITY_MSN,
} NiceUdpTurnSocketCompatibility; } NiceUdpTurnSocketCompatibility;
......
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