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,
&stream, &component))
return;
if (component->selected_pair.local->type == NICE_CANDIDATE_TYPE_RELAYED) {
nice_turn_socket_set_peer (lcandidate->sockptr, &rcandidate->addr);
if (((NiceSocket *)lcandidate->sockptr)->type == NICE_SOCKET_TYPE_UDP_TURN) {
nice_udp_turn_socket_set_peer (lcandidate->sockptr, &rcandidate->addr);
}
if(agent->reliable) {
......@@ -1841,7 +1841,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
nicesock = nice_pseudossl_socket_new (nicesock,
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));
component_attach_socket (component, cdisco->nicesock);
......@@ -2779,7 +2779,7 @@ agent_recv_message_unlocked (
if (cand->type == NICE_CANDIDATE_TYPE_RELAYED &&
cand->stream_id == stream->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);
break;
}
......
......@@ -2518,8 +2518,10 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage *
d->turn);
if (relay_cand) {
nice_turn_socket_set_ms_realm(relay_cand->sockptr, &d->stun_message);
nice_turn_socket_set_ms_connection_id(relay_cand->sockptr, resp);
nice_udp_turn_socket_set_ms_realm(relay_cand->sockptr,
&d->stun_message);
nice_udp_turn_socket_set_ms_connection_id(relay_cand->sockptr,
resp);
}
relay_cand = discovery_add_relay_candidate (
......@@ -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
* after socket gets created in discovery_add_relay_candidate(),
* so we are doing it here. */
nice_turn_socket_set_ms_realm(relay_cand->sockptr, &d->stun_message);
nice_turn_socket_set_ms_connection_id(relay_cand->sockptr, resp);
nice_udp_turn_socket_set_ms_realm(relay_cand->sockptr,
&d->stun_message);
nice_udp_turn_socket_set_ms_connection_id(relay_cand->sockptr,
resp);
} else
priv_add_new_turn_refresh (d, relay_cand, lifetime);
}
......
......@@ -624,7 +624,7 @@ discovery_add_relay_candidate (
}
/* 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,
turn->username, turn->password,
agent_to_turn_socket_compatibility (agent));
......@@ -779,7 +779,7 @@ NiceCandidate *discovery_learn_remote_peer_reflexive_candidate (
candidate->transport = conn_check_match_transport (local->transport);
else {
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;
else
candidate->transport = NICE_CANDIDATE_TRANSPORT_TCP_ACTIVE;
......
......@@ -32,9 +32,9 @@ libsocket_la_SOURCES = \
socks5.c \
http.h \
http.c \
turn.h \
turn.c \
tcp-turn.h \
tcp-turn.c
udp-turn.h \
udp-turn.c \
udp-turn-over-tcp.h \
udp-turn-over-tcp.c
......@@ -61,8 +61,8 @@ typedef enum {
NICE_SOCKET_TYPE_PSEUDOSSL,
NICE_SOCKET_TYPE_HTTP,
NICE_SOCKET_TYPE_SOCKS5,
NICE_SOCKET_TYPE_TURN,
NICE_SOCKET_TYPE_TCP_TURN,
NICE_SOCKET_TYPE_UDP_TURN,
NICE_SOCKET_TYPE_UDP_TURN_OVER_TCP,
NICE_SOCKET_TYPE_TCP_ACTIVE,
NICE_SOCKET_TYPE_TCP_PASSIVE,
NICE_SOCKET_TYPE_TCP_SO
......@@ -117,8 +117,8 @@ nice_socket_free (NiceSocket *sock);
#include "pseudossl.h"
#include "socks5.h"
#include "http.h"
#include "turn.h"
#include "tcp-turn.h"
#include "udp-turn.h"
#include "udp-turn-over-tcp.h"
G_END_DECLS
......
......@@ -42,7 +42,7 @@
# include "config.h"
#endif
#include "tcp-turn.h"
#include "udp-turn-over-tcp.h"
#include "agent-priv.h"
#include <string.h>
......@@ -84,7 +84,7 @@ static gint socket_send_messages_reliable (NiceSocket *sock,
static gboolean socket_is_reliable (NiceSocket *sock);
NiceSocket *
nice_tcp_turn_socket_new (NiceSocket *base_socket,
nice_udp_turn_over_tcp_socket_new (NiceSocket *base_socket,
NiceTurnSocketCompatibility compatibility)
{
TurnTcpPriv *priv;
......@@ -94,7 +94,7 @@ nice_tcp_turn_socket_new (NiceSocket *base_socket,
priv->compatibility = compatibility;
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->addr = priv->base_socket->addr;
sock->send_messages = socket_send_messages;
......
......@@ -34,8 +34,8 @@
* file under either the MPL or the LGPL.
*/
#ifndef _TCP_TURN_H
#define _TCP_TURN_H
#ifndef _UDP_TURN_OVER_TCP_H
#define _UDP_TURN_OVER_TCP_H
#include "socket.h"
#include "agent.h"
......@@ -44,11 +44,11 @@ G_BEGIN_DECLS
NiceSocket *
nice_tcp_turn_socket_new (NiceSocket *base_socket,
nice_udp_turn_over_tcp_socket_new (NiceSocket *base_socket,
NiceTurnSocketCompatibility compatibility);
G_END_DECLS
#endif /* _TCP_TURN_H */
#endif /* _UDP_TURN_OVER_TCP_H */
This diff is collapsed.
......@@ -34,8 +34,8 @@
* file under either the MPL or the LGPL.
*/
#ifndef _TURN_H
#define _TURN_H
#ifndef _UDP_TURN_H
#define _UDP_TURN_H
typedef enum {
......@@ -53,30 +53,30 @@ typedef enum {
G_BEGIN_DECLS
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);
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 *recv_from, guint8 *recv_buf, gsize recv_len);
gboolean
nice_turn_socket_set_peer (NiceSocket *sock, NiceAddress *peer);
nice_udp_turn_socket_set_peer (NiceSocket *sock, NiceAddress *peer);
NiceSocket *
nice_turn_socket_new (GMainContext *ctx, NiceAddress *addr,
nice_udp_turn_socket_new (GMainContext *ctx, NiceAddress *addr,
NiceSocket *base_socket, NiceAddress *server_addr,
gchar *username, gchar *password, NiceTurnSocketCompatibility compatibility);
void
nice_turn_socket_set_ms_realm(NiceSocket *sock, StunMessage *msg);
nice_udp_turn_socket_set_ms_realm(NiceSocket *sock, StunMessage *msg);
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
#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