summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYouness Alaoui <youness.alaoui@collabora.co.uk>2011-01-14 00:23:45 (GMT)
committerYouness Alaoui <youness.alaoui@collabora.co.uk>2011-01-14 00:23:45 (GMT)
commitdf0ca1eda179ad358db06bf8f29635610d91d594 (patch)
tree674e2c957498dc12e99d78d0a99ab33eaa6435b5
parent1be180d438372cde9c0ec2ab1030cd9a5ab24407 (diff)
downloadlibnice-df0ca1eda179ad358db06bf8f29635610d91d594.tar.gz
libnice-df0ca1eda179ad358db06bf8f29635610d91d594.tar.xz
Add support for RFC TURN TCP
-rw-r--r--socket/tcp-turn.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/socket/tcp-turn.c b/socket/tcp-turn.c
index cfe0e70..9777849 100644
--- a/socket/tcp-turn.c
+++ b/socket/tcp-turn.c
@@ -131,7 +131,8 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf)
if (priv->recv_buf_len < headerlen)
return 0;
- if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9) {
+ if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 ||
+ priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766) {
guint16 magic = ntohs (*(guint16*)priv->recv_buf);
guint16 packetlen = ntohs (*(guint16*)(priv->recv_buf + 2));
@@ -150,7 +151,8 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf)
}
}
- if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9)
+ if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 ||
+ priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766)
padlen = (priv->expecting_len % 4) ? 4 - (priv->expecting_len % 4) : 0;
else
padlen = 0;
@@ -186,7 +188,8 @@ socket_send (NiceSocket *sock, const NiceAddress *to,
gchar buffer[MAX_UDP_MESSAGE_SIZE + sizeof(guint16) + sizeof(padbuf)];
guint buffer_len = 0;
- if (priv->compatibility != NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9)
+ if (priv->compatibility != NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 ||
+ priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766)
padlen = 0;
if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_GOOGLE) {
@@ -198,7 +201,8 @@ socket_send (NiceSocket *sock, const NiceAddress *to,
memcpy (buffer + buffer_len, buf, len);
buffer_len += len;
- if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9) {
+ if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 ||
+ priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766) {
memcpy (buffer + buffer_len, padbuf, padlen);
buffer_len += padlen;
}