Commit 6263028e authored by Youness Alaoui's avatar Youness Alaoui Committed by Olivier Crête

Rename turn files and API to be UDP specific

The TURN-TCP RFC is very different from TURN-UDP, the current turn and tcp-turn
files were only for UDP TURN RFC and UDP TURN using TCP transport.
When we implement TCP-TURN, we'll need a different algorithm, so I
renamed the files and API to avoid any confusion.
parent b59c4bb5
...@@ -1645,8 +1645,8 @@ void agent_signal_new_selected_pair (NiceAgent *agent, guint stream_id, ...@@ -1645,8 +1645,8 @@ void agent_signal_new_selected_pair (NiceAgent *agent, guint stream_id,
&stream, &component)) &stream, &component))
return; return;
if (component->selected_pair.local->type == NICE_CANDIDATE_TYPE_RELAYED) { if (((NiceSocket *)lcandidate->sockptr)->type == NICE_SOCKET_TYPE_UDP_TURN) {
nice_turn_socket_set_peer (lcandidate->sockptr, &rcandidate->addr); nice_udp_turn_socket_set_peer (lcandidate->sockptr, &rcandidate->addr);
} }
if(agent->reliable) { if(agent->reliable) {
...@@ -1841,7 +1841,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent, ...@@ -1841,7 +1841,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
nicesock = nice_pseudossl_socket_new (nicesock, nicesock = nice_pseudossl_socket_new (nicesock,
NICE_PSEUDOSSL_SOCKET_COMPATIBILITY_MSOC); NICE_PSEUDOSSL_SOCKET_COMPATIBILITY_MSOC);
} }
cdisco->nicesock = nice_tcp_turn_socket_new (nicesock, cdisco->nicesock = nice_udp_turn_over_tcp_socket_new (nicesock,
agent_to_turn_socket_compatibility (agent)); agent_to_turn_socket_compatibility (agent));
component_attach_socket (component, cdisco->nicesock); component_attach_socket (component, cdisco->nicesock);
...@@ -2779,7 +2779,7 @@ agent_recv_message_unlocked ( ...@@ -2779,7 +2779,7 @@ agent_recv_message_unlocked (
if (cand->type == NICE_CANDIDATE_TYPE_RELAYED && if (cand->type == NICE_CANDIDATE_TYPE_RELAYED &&
cand->stream_id == stream->id && cand->stream_id == stream->id &&
cand->component_id == component->id) { cand->component_id == component->id) {
retval = nice_turn_socket_parse_recv_message (cand->sockptr, &nicesock, retval = nice_udp_turn_socket_parse_recv_message (cand->sockptr, &nicesock,
message); message);
break; break;
} }
......
...@@ -2518,8 +2518,10 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage * ...@@ -2518,8 +2518,10 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage *
d->turn); d->turn);
if (relay_cand) { if (relay_cand) {
nice_turn_socket_set_ms_realm(relay_cand->sockptr, &d->stun_message); nice_udp_turn_socket_set_ms_realm(relay_cand->sockptr,
nice_turn_socket_set_ms_connection_id(relay_cand->sockptr, resp); &d->stun_message);
nice_udp_turn_socket_set_ms_connection_id(relay_cand->sockptr,
resp);
} }
relay_cand = discovery_add_relay_candidate ( relay_cand = discovery_add_relay_candidate (
...@@ -2550,8 +2552,10 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage * ...@@ -2550,8 +2552,10 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage *
* response arrives to _nice_agent_recv(). We must set them right * response arrives to _nice_agent_recv(). We must set them right
* after socket gets created in discovery_add_relay_candidate(), * after socket gets created in discovery_add_relay_candidate(),
* so we are doing it here. */ * so we are doing it here. */
nice_turn_socket_set_ms_realm(relay_cand->sockptr, &d->stun_message); nice_udp_turn_socket_set_ms_realm(relay_cand->sockptr,
nice_turn_socket_set_ms_connection_id(relay_cand->sockptr, resp); &d->stun_message);
nice_udp_turn_socket_set_ms_connection_id(relay_cand->sockptr,
resp);
} else } else
priv_add_new_turn_refresh (d, relay_cand, lifetime); priv_add_new_turn_refresh (d, relay_cand, lifetime);
} }
......
...@@ -624,7 +624,7 @@ discovery_add_relay_candidate ( ...@@ -624,7 +624,7 @@ discovery_add_relay_candidate (
} }
/* step: link to the base candidate+socket */ /* step: link to the base candidate+socket */
relay_socket = nice_turn_socket_new (agent->main_context, address, relay_socket = nice_udp_turn_socket_new (agent->main_context, address,
base_socket, &turn->server, base_socket, &turn->server,
turn->username, turn->password, turn->username, turn->password,
agent_to_turn_socket_compatibility (agent)); agent_to_turn_socket_compatibility (agent));
...@@ -779,7 +779,7 @@ NiceCandidate *discovery_learn_remote_peer_reflexive_candidate ( ...@@ -779,7 +779,7 @@ NiceCandidate *discovery_learn_remote_peer_reflexive_candidate (
candidate->transport = conn_check_match_transport (local->transport); candidate->transport = conn_check_match_transport (local->transport);
else { else {
if (nicesock->type == NICE_SOCKET_TYPE_UDP_BSD || if (nicesock->type == NICE_SOCKET_TYPE_UDP_BSD ||
nicesock->type == NICE_SOCKET_TYPE_TURN) nicesock->type == NICE_SOCKET_TYPE_UDP_TURN)
candidate->transport = NICE_CANDIDATE_TRANSPORT_UDP; candidate->transport = NICE_CANDIDATE_TRANSPORT_UDP;
else else
candidate->transport = NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE; candidate->transport = NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE;
......
...@@ -32,9 +32,9 @@ libsocket_la_SOURCES = \ ...@@ -32,9 +32,9 @@ libsocket_la_SOURCES = \
socks5.c \ socks5.c \
http.h \ http.h \
http.c \ http.c \
turn.h \ udp-turn.h \
turn.c \ udp-turn.c \
tcp-turn.h \ udp-turn-over-tcp.h \
tcp-turn.c udp-turn-over-tcp.c
...@@ -61,8 +61,8 @@ typedef enum { ...@@ -61,8 +61,8 @@ typedef enum {
NICE_SOCKET_TYPE_PSEUDOSSL, NICE_SOCKET_TYPE_PSEUDOSSL,
NICE_SOCKET_TYPE_HTTP, NICE_SOCKET_TYPE_HTTP,
NICE_SOCKET_TYPE_SOCKS5, NICE_SOCKET_TYPE_SOCKS5,
NICE_SOCKET_TYPE_TURN, NICE_SOCKET_TYPE_UDP_TURN,
NICE_SOCKET_TYPE_TCP_TURN, NICE_SOCKET_TYPE_UDP_TURN_OVER_TCP,
NICE_SOCKET_TYPE_TCP_ACTIVE, NICE_SOCKET_TYPE_TCP_ACTIVE,
NICE_SOCKET_TYPE_TCP_PASSIVE, NICE_SOCKET_TYPE_TCP_PASSIVE,
NICE_SOCKET_TYPE_TCP_SO NICE_SOCKET_TYPE_TCP_SO
...@@ -117,8 +117,8 @@ nice_socket_free (NiceSocket *sock); ...@@ -117,8 +117,8 @@ nice_socket_free (NiceSocket *sock);
#include "pseudossl.h" #include "pseudossl.h"
#include "socks5.h" #include "socks5.h"
#include "http.h" #include "http.h"
#include "turn.h" #include "udp-turn.h"
#include "tcp-turn.h" #include "udp-turn-over-tcp.h"
G_END_DECLS G_END_DECLS
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
# include "config.h" # include "config.h"
#endif #endif
#include "tcp-turn.h" #include "udp-turn-over-tcp.h"
#include "agent-priv.h" #include "agent-priv.h"
#include <string.h> #include <string.h>
...@@ -84,7 +84,7 @@ static gint socket_send_messages_reliable (NiceSocket *sock, ...@@ -84,7 +84,7 @@ static gint socket_send_messages_reliable (NiceSocket *sock,
static gboolean socket_is_reliable (NiceSocket *sock); static gboolean socket_is_reliable (NiceSocket *sock);
NiceSocket * NiceSocket *
nice_tcp_turn_socket_new (NiceSocket *base_socket, nice_udp_turn_over_tcp_socket_new (NiceSocket *base_socket,
NiceTurnSocketCompatibility compatibility) NiceTurnSocketCompatibility compatibility)
{ {
TurnTcpPriv *priv; TurnTcpPriv *priv;
...@@ -94,7 +94,7 @@ nice_tcp_turn_socket_new (NiceSocket *base_socket, ...@@ -94,7 +94,7 @@ nice_tcp_turn_socket_new (NiceSocket *base_socket,
priv->compatibility = compatibility; priv->compatibility = compatibility;
priv->base_socket = base_socket; priv->base_socket = base_socket;
sock->type = NICE_SOCKET_TYPE_TCP_TURN; sock->type = NICE_SOCKET_TYPE_UDP_TURN_OVER_TCP;
sock->fileno = priv->base_socket->fileno; sock->fileno = priv->base_socket->fileno;
sock->addr = priv->base_socket->addr; sock->addr = priv->base_socket->addr;
sock->send_messages = socket_send_messages; sock->send_messages = socket_send_messages;
......
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
* file under either the MPL or the LGPL. * file under either the MPL or the LGPL.
*/ */
#ifndef _TCP_TURN_H #ifndef _UDP_TURN_OVER_TCP_H
#define _TCP_TURN_H #define _UDP_TURN_OVER_TCP_H
#include "socket.h" #include "socket.h"
#include "agent.h" #include "agent.h"
...@@ -44,11 +44,11 @@ G_BEGIN_DECLS ...@@ -44,11 +44,11 @@ G_BEGIN_DECLS
NiceSocket * NiceSocket *
nice_tcp_turn_socket_new (NiceSocket *base_socket, nice_udp_turn_over_tcp_socket_new (NiceSocket *base_socket,
NiceTurnSocketCompatibility compatibility); NiceTurnSocketCompatibility compatibility);
G_END_DECLS G_END_DECLS
#endif /* _TCP_TURN_H */ #endif /* _UDP_TURN_OVER_TCP_H */
This diff is collapsed.
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
* file under either the MPL or the LGPL. * file under either the MPL or the LGPL.
*/ */
#ifndef _TURN_H #ifndef _UDP_TURN_H
#define _TURN_H #define _UDP_TURN_H
typedef enum { typedef enum {
...@@ -53,30 +53,30 @@ typedef enum { ...@@ -53,30 +53,30 @@ typedef enum {
G_BEGIN_DECLS G_BEGIN_DECLS
guint guint
nice_turn_socket_parse_recv_message (NiceSocket *sock, NiceSocket **from_sock, nice_udp_turn_socket_parse_recv_message (NiceSocket *sock, NiceSocket **from_sock,
NiceInputMessage *message); NiceInputMessage *message);
gsize gsize
nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock, nice_udp_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock,
NiceAddress *from, gsize len, guint8 *buf, NiceAddress *from, gsize len, guint8 *buf,
NiceAddress *recv_from, guint8 *recv_buf, gsize recv_len); NiceAddress *recv_from, guint8 *recv_buf, gsize recv_len);
gboolean gboolean
nice_turn_socket_set_peer (NiceSocket *sock, NiceAddress *peer); nice_udp_turn_socket_set_peer (NiceSocket *sock, NiceAddress *peer);
NiceSocket * NiceSocket *
nice_turn_socket_new (GMainContext *ctx, NiceAddress *addr, nice_udp_turn_socket_new (GMainContext *ctx, NiceAddress *addr,
NiceSocket *base_socket, NiceAddress *server_addr, NiceSocket *base_socket, NiceAddress *server_addr,
gchar *username, gchar *password, NiceTurnSocketCompatibility compatibility); gchar *username, gchar *password, NiceTurnSocketCompatibility compatibility);
void void
nice_turn_socket_set_ms_realm(NiceSocket *sock, StunMessage *msg); nice_udp_turn_socket_set_ms_realm(NiceSocket *sock, StunMessage *msg);
void void
nice_turn_socket_set_ms_connection_id (NiceSocket *sock, StunMessage *msg); nice_udp_turn_socket_set_ms_connection_id (NiceSocket *sock, StunMessage *msg);
G_END_DECLS G_END_DECLS
#endif /* _TURN_H */ #endif /* _UDP_TURN_H */
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