Commit 16cfd73b authored by Youness Alaoui's avatar Youness Alaoui

Add nice_socket_is_reliable to the API

parent ce5ce4d9
......@@ -65,6 +65,12 @@ nice_socket_send (
sock->send (sock, to, len, buf);
}
NICEAPI_EXPORT gboolean
nice_socket_is_reliable (NiceSocket *sock)
{
return sock->is_reliable (sock);
}
NICEAPI_EXPORT void
nice_socket_free (NiceSocket *sock)
{
......
......@@ -52,6 +52,7 @@ struct _NiceSocket
gchar *buf);
gboolean (*send) (NiceSocket *sock, const NiceAddress *to, guint len,
const gchar *buf);
gboolean (*is_reliable) (NiceSocket *sock);
void (*close) (NiceSocket *sock);
void *priv;
};
......@@ -71,6 +72,10 @@ nice_socket_send (
guint len,
const gchar *buf);
gboolean
nice_socket_is_reliable (NiceSocket *sock);
void
nice_socket_free (NiceSocket *sock);
......
......@@ -115,6 +115,12 @@ socket_send (
return sent == (ssize_t)len;
}
static gboolean
socket_is_reliable (NiceSocket *sock)
{
return FALSE;
}
static void
socket_close (NiceSocket *sock)
{
......@@ -222,6 +228,7 @@ nice_udp_bsd_socket_new (NiceAddress *addr)
sock->fileno = sockfd;
sock->send = socket_send;
sock->recv = socket_recv;
sock->is_reliable = socket_is_reliable;
sock->close = socket_close;
return sock;
}
......@@ -471,6 +471,13 @@ socket_send (
return TRUE;
}
static gboolean
socket_is_reliable (NiceSocket *sock)
{
turn_priv *priv = (turn_priv *) sock->priv;
return nice_socket_is_reliable (priv->base_socket);
}
static void
socket_close (NiceSocket *sock)
{
......@@ -544,6 +551,7 @@ nice_udp_turn_socket_new (
sock->fileno = base_socket->fileno;
sock->send = socket_send;
sock->recv = socket_recv;
sock->is_reliable = socket_is_reliable;
sock->close = socket_close;
sock->priv = (void *) priv;
return sock;
......
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