Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
libnice
Commits
ebc0e5cc
Commit
ebc0e5cc
authored
Sep 17, 2008
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support for receiving an answer to our channel bindings/lock and correctly handle such messages
parent
82539c8d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
2 deletions
+64
-2
udp/udp-turn.c
udp/udp-turn.c
+64
-2
No files found.
udp/udp-turn.c
View file @
ebc0e5cc
...
@@ -228,6 +228,8 @@ nice_udp_turn_socket_parse_recv (
...
@@ -228,6 +228,8 @@ nice_udp_turn_socket_parse_recv (
StunMessage
msg
;
StunMessage
msg
;
struct
sockaddr_storage
sa
;
struct
sockaddr_storage
sa
;
guint
from_len
=
sizeof
(
sa
);
guint
from_len
=
sizeof
(
sa
);
GList
*
i
=
priv
->
channels
;
ChannelBinding
*
binding
=
NULL
;
if
(
nice_address_equal
(
&
priv
->
server_addr
,
recv_from
))
{
if
(
nice_address_equal
(
&
priv
->
server_addr
,
recv_from
))
{
valid
=
stun_agent_validate
(
&
priv
->
agent
,
&
msg
,
valid
=
stun_agent_validate
(
&
priv
->
agent
,
&
msg
,
...
@@ -243,7 +245,33 @@ nice_udp_turn_socket_parse_recv (
...
@@ -243,7 +245,33 @@ nice_udp_turn_socket_parse_recv (
}
}
if
(
stun_message_get_class
(
&
msg
)
==
STUN_RESPONSE
&&
if
(
stun_message_get_class
(
&
msg
)
==
STUN_RESPONSE
&&
stun_message_get_method
(
&
msg
)
==
STUN_IND_SEND
)
{
stun_message_get_method
(
&
msg
)
==
STUN_SEND
)
{
if
(
priv
->
compatibility
==
NICE_UDP_TURN_SOCKET_COMPATIBILITY_GOOGLE
)
{
uint32_t
options
=
0
;
if
(
stun_message_find32
(
&
msg
,
STUN_ATTRIBUTE_OPTIONS
,
&
options
)
==
0
&&
options
&
0x1
)
goto
msn_google_lock
;
}
return
0
;
}
else
if
(
stun_message_get_class
(
&
msg
)
==
STUN_RESPONSE
&&
stun_message_get_method
(
&
msg
)
==
STUN_OLD_SET_ACTIVE_DST
)
{
if
(
priv
->
compatibility
==
NICE_UDP_TURN_SOCKET_COMPATIBILITY_MSN
)
goto
msn_google_lock
;
return
0
;
}
else
if
(
stun_message_get_class
(
&
msg
)
==
STUN_ERROR
&&
stun_message_get_method
(
&
msg
)
==
STUN_CHANNELBIND
)
{
if
(
priv
->
current_binding
)
{
priv_send_channel_bind
(
priv
,
&
msg
,
priv
->
current_binding
->
channel
,
&
priv
->
current_binding
->
peer
);
}
return
0
;
}
else
if
(
stun_message_get_class
(
&
msg
)
==
STUN_RESPONSE
&&
stun_message_get_method
(
&
msg
)
==
STUN_CHANNELBIND
)
{
if
(
priv
->
current_binding
)
{
priv
->
channels
=
g_list_append
(
priv
->
channels
,
priv
->
current_binding
);
priv
->
current_binding
=
NULL
;
}
return
0
;
return
0
;
}
else
if
(
stun_message_get_class
(
&
msg
)
==
STUN_INDICATION
&&
}
else
if
(
stun_message_get_class
(
&
msg
)
==
STUN_INDICATION
&&
stun_message_get_method
(
&
msg
)
==
STUN_IND_DATA
)
{
stun_message_get_method
(
&
msg
)
==
STUN_IND_DATA
)
{
...
@@ -274,9 +302,43 @@ nice_udp_turn_socket_parse_recv (
...
@@ -274,9 +302,43 @@ nice_udp_turn_socket_parse_recv (
}
}
recv:
recv:
for
(;
i
;
i
=
i
->
next
)
{
ChannelBinding
*
b
=
i
->
data
;
if
(
priv
->
compatibility
==
NICE_UDP_TURN_SOCKET_COMPATIBILITY_DRAFT9
)
{
if
(
b
->
channel
==
((
uint16_t
*
)
recv_buf
)[
0
])
{
recv_len
=
((
uint16_t
*
)
recv_buf
)[
1
];
recv_buf
+=
sizeof
(
uint32_t
);
binding
=
b
;
break
;
}
}
else
{
binding
=
b
;
break
;
}
}
if
(
binding
)
{
*
from
=
binding
->
peer
;
}
else
{
*
from
=
*
recv_from
;
*
from
=
*
recv_from
;
}
memmove
(
buf
,
recv_buf
,
len
>
recv_len
?
recv_len
:
len
);
memmove
(
buf
,
recv_buf
,
len
>
recv_len
?
recv_len
:
len
);
return
len
>
recv_len
?
recv_len
:
len
;
return
len
>
recv_len
?
recv_len
:
len
;
msn_google_lock:
if
(
priv
->
current_binding
)
{
GList
*
i
=
priv
->
channels
;
for
(;
i
;
i
=
i
->
next
)
{
ChannelBinding
*
b
=
i
->
data
;
g_free
(
b
);
}
g_list_free
(
priv
->
channels
);
priv
->
channels
=
g_list_append
(
NULL
,
priv
->
current_binding
);
priv
->
current_binding
=
NULL
;
}
return
0
;
}
}
static
gint
static
gint
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment