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
6f631ec6
Commit
6f631ec6
authored
Sep 10, 2008
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let the turn usage tell us if a mapped address was also found
parent
6c558075
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
stun/usages/turn.c
stun/usages/turn.c
+12
-4
stun/usages/turn.h
stun/usages/turn.h
+2
-1
No files found.
stun/usages/turn.c
View file @
6f631ec6
...
...
@@ -205,6 +205,7 @@ StunUsageTurnReturn stun_usage_turn_process (StunMessage *msg,
StunUsageTurnCompatibility
compatibility
)
{
int
val
,
code
=
-
1
;
StunUsageTurnReturn
ret
=
STUN_USAGE_TURN_RETURN_RELAY_SUCCESS
;
switch
(
stun_message_get_class
(
msg
))
{
...
...
@@ -250,15 +251,18 @@ StunUsageTurnReturn stun_usage_turn_process (StunMessage *msg,
stun_debug
(
"Received %u-bytes STUN message
\n
"
,
stun_message_length
(
msg
));
if
(
compatibility
==
STUN_USAGE_TURN_COMPATIBILITY_TD9
)
{
stun_message_find_xor_addr
(
msg
,
val
=
stun_message_find_xor_addr
(
msg
,
STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS
,
addr
,
addrlen
);
if
(
val
==
0
)
ret
=
STUN_USAGE_TURN_RETURN_MAPPED_SUCCESS
;
val
=
stun_message_find_xor_addr
(
msg
,
STUN_ATTRIBUTE_RELAY_ADDRESS
,
relay_addr
,
relay_addrlen
);
if
(
val
)
{
stun_debug
(
" No RELAYED-ADDRESS: %s
\n
"
,
strerror
(
val
));
return
STUN_USAGE_TURN_RETURN_ERROR
;
}
}
else
if
(
compatibility
==
STUN_USAGE_TURN_COMPATIBILITY_
TD9
)
{
}
else
if
(
compatibility
==
STUN_USAGE_TURN_COMPATIBILITY_
GOOGLE
)
{
val
=
stun_message_find_addr
(
msg
,
STUN_ATTRIBUTE_MAPPED_ADDRESS
,
relay_addr
,
relay_addrlen
);
if
(
val
)
{
...
...
@@ -266,8 +270,12 @@ StunUsageTurnReturn stun_usage_turn_process (StunMessage *msg,
return
STUN_USAGE_TURN_RETURN_ERROR
;
}
}
else
if
(
compatibility
==
STUN_USAGE_TURN_COMPATIBILITY_MSN
)
{
stun_message_find_xor_addr
(
msg
,
val
=
stun_message_find_xor_addr
(
msg
,
STUN_ATTRIBUTE_MSN_MAPPED_ADDRESS
,
addr
,
addrlen
);
if
(
val
==
0
)
ret
=
STUN_USAGE_TURN_RETURN_MAPPED_SUCCESS
;
val
=
stun_message_find_addr
(
msg
,
STUN_ATTRIBUTE_MAPPED_ADDRESS
,
relay_addr
,
relay_addrlen
);
if
(
val
)
{
...
...
@@ -277,6 +285,6 @@ StunUsageTurnReturn stun_usage_turn_process (StunMessage *msg,
}
stun_debug
(
" Mapped address found!
\n
"
);
return
STUN_USAGE_TURN_RETURN_SUCCESS
;
return
ret
;
}
stun/usages/turn.h
View file @
6f631ec6
...
...
@@ -63,7 +63,8 @@ typedef enum {
}
StunUsageTurnCompatibility
;
typedef
enum
{
STUN_USAGE_TURN_RETURN_SUCCESS
,
STUN_USAGE_TURN_RETURN_RELAY_SUCCESS
,
STUN_USAGE_TURN_RETURN_MAPPED_SUCCESS
,
STUN_USAGE_TURN_RETURN_ERROR
,
STUN_USAGE_TURN_RETURN_RETRY
,
STUN_USAGE_TURN_RETURN_ALTERNATE_SERVER
,
...
...
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