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
966fc22a
Commit
966fc22a
authored
Feb 09, 2009
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add WLM2009 compatibility mode to libnice and libstun
parent
64e898cd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
37 deletions
+53
-37
agent/agent.c
agent/agent.c
+30
-25
agent/agent.h
agent/agent.h
+2
-1
agent/conncheck.c
agent/conncheck.c
+5
-3
stun/stunagent.c
stun/stunagent.c
+14
-7
stun/stunagent.h
stun/stunagent.h
+2
-1
No files found.
agent/agent.c
View file @
966fc22a
...
...
@@ -119,35 +119,34 @@ static void priv_detach_stream_component (Stream *stream, Component *component);
StunUsageIceCompatibility
agent_to_ice_compatibility
(
NiceAgent
*
agent
)
{
return
agent
->
compatibility
==
NICE_COMPATIBILITY_DRAFT19
?
STUN_USAGE_ICE_COMPATIBILITY_DRAFT19
:
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
?
return
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
?
STUN_USAGE_ICE_COMPATIBILITY_GOOGLE
:
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
?
STUN_USAGE_ICE_COMPATIBILITY_MSN
:
STUN_USAGE_ICE_COMPATIBILITY_DRAFT19
;
STUN_USAGE_ICE_COMPATIBILITY_MSN
:
STUN_USAGE_ICE_COMPATIBILITY_DRAFT19
;
}
StunUsageTurnCompatibility
agent_to_turn_compatibility
(
NiceAgent
*
agent
)
{
return
agent
->
compatibility
==
NICE_COMPATIBILITY_DRAFT19
?
STUN_USAGE_TURN_COMPATIBILITY_DRAFT9
:
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
?
return
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
?
STUN_USAGE_TURN_COMPATIBILITY_GOOGLE
:
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
?
STUN_USAGE_TURN_COMPATIBILITY_MSN
:
agent
->
compatibility
==
NICE_COMPATIBILITY_WLM2009
?
STUN_USAGE_TURN_COMPATIBILITY_MSN
:
STUN_USAGE_TURN_COMPATIBILITY_DRAFT9
;
}
NiceTurnSocketCompatibility
agent_to_turn_socket_compatibility
(
NiceAgent
*
agent
)
{
return
agent
->
compatibility
==
NICE_COMPATIBILITY_DRAFT19
?
NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9
:
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
?
return
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
?
NICE_TURN_SOCKET_COMPATIBILITY_GOOGLE
:
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
?
NICE_TURN_SOCKET_COMPATIBILITY_MSN
:
agent
->
compatibility
==
NICE_COMPATIBILITY_WLM2009
?
NICE_TURN_SOCKET_COMPATIBILITY_MSN
:
NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9
;
}
...
...
@@ -631,12 +630,7 @@ nice_agent_set_property (
case
PROP_COMPATIBILITY
:
agent
->
compatibility
=
g_value_get_uint
(
value
);
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_DRAFT19
)
{
stun_agent_init
(
&
agent
->
stun_agent
,
STUN_ALL_KNOWN_ATTRIBUTES
,
STUN_COMPATIBILITY_RFC5389
,
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS
|
STUN_AGENT_USAGE_USE_FINGERPRINT
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
stun_agent_init
(
&
agent
->
stun_agent
,
STUN_ALL_KNOWN_ATTRIBUTES
,
STUN_COMPATIBILITY_RFC3489
,
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS
|
...
...
@@ -646,6 +640,16 @@ nice_agent_set_property (
STUN_COMPATIBILITY_RFC3489
,
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS
|
STUN_AGENT_USAGE_FORCE_VALIDATER
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_WLM2009
)
{
stun_agent_init
(
&
agent
->
stun_agent
,
STUN_ALL_KNOWN_ATTRIBUTES
,
STUN_COMPATIBILITY_WLM2009
,
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS
|
STUN_AGENT_USAGE_USE_FINGERPRINT
);
}
else
{
stun_agent_init
(
&
agent
->
stun_agent
,
STUN_ALL_KNOWN_ATTRIBUTES
,
STUN_COMPATIBILITY_RFC5389
,
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS
|
STUN_AGENT_USAGE_USE_FINGERPRINT
);
}
break
;
...
...
@@ -965,20 +969,21 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
cdisco
->
component
=
stream_find_component_by_id
(
stream
,
component_id
);
cdisco
->
agent
=
agent
;
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_
DRAFT19
)
{
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_
GOOGLE
)
{
stun_agent_init
(
&
cdisco
->
stun_agent
,
STUN_ALL_KNOWN_ATTRIBUTES
,
STUN_COMPATIBILITY_RFC5389
,
STUN_AGENT_USAGE_ADD_SOFTWARE
|
STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
STUN_COMPATIBILITY_RFC3489
,
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS
|
STUN_AGENT_USAGE_IGNORE_CREDENTIALS
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
agent
->
compatibility
==
NICE_COMPATIBILITY_WLM2009
)
{
stun_agent_init
(
&
cdisco
->
stun_agent
,
STUN_ALL_KNOWN_ATTRIBUTES
,
STUN_COMPATIBILITY_RFC3489
,
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
}
else
{
stun_agent_init
(
&
cdisco
->
stun_agent
,
STUN_ALL_KNOWN_ATTRIBUTES
,
STUN_COMPATIBILITY_RFC
34
89
,
STUN_AGENT_USAGE_
SHORT_TERM_CREDENTIALS
|
STUN_AGENT_USAGE_
IGNORE
_CREDENTIALS
);
STUN_COMPATIBILITY_RFC
53
89
,
STUN_AGENT_USAGE_
ADD_SOFTWARE
|
STUN_AGENT_USAGE_
LONG_TERM
_CREDENTIALS
);
}
nice_debug
(
"Agent %p : Adding new relay-rflx candidate discovery %p
\n
"
,
...
...
agent/agent.h
View file @
966fc22a
...
...
@@ -225,7 +225,8 @@ typedef enum
NICE_COMPATIBILITY_DRAFT19
=
0
,
NICE_COMPATIBILITY_GOOGLE
,
NICE_COMPATIBILITY_MSN
,
NICE_COMPATIBILITY_LAST
=
NICE_COMPATIBILITY_MSN
NICE_COMPATIBILITY_WLM2009
,
NICE_COMPATIBILITY_LAST
=
NICE_COMPATIBILITY_WLM2009
}
NiceCompatibility
;
/**
...
...
agent/conncheck.c
View file @
966fc22a
...
...
@@ -1020,7 +1020,8 @@ int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, Component *
/* note: do not create pairs where local candidate is
* a srv-reflexive (ICE 5.7.3. "Pruning the Pairs" ID-19) */
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_DRAFT19
&&
if
((
agent
->
compatibility
==
NICE_COMPATIBILITY_DRAFT19
||
agent
->
compatibility
==
NICE_COMPATIBILITY_WLM2009
)
&&
local
->
type
==
NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE
)
continue
;
...
...
@@ -1433,10 +1434,11 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream,
same state update as for processing responses to our own checks */
priv_update_check_list_state_for_ready
(
agent
,
stream
,
component
);
/* note: to take care of the controlling-controlling case in
/* note: to take care of the controlling-controlling case in
* aggressive nomination mode, send a new triggered
* check to nominate the pair */
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_DRAFT19
&&
if
((
agent
->
compatibility
==
NICE_COMPATIBILITY_DRAFT19
||
agent
->
compatibility
==
NICE_COMPATIBILITY_WLM2009
)
&&
agent
->
controlling_mode
)
priv_conn_check_initiate
(
agent
,
p
);
}
...
...
stun/stunagent.c
View file @
966fc22a
...
...
@@ -129,13 +129,15 @@ StunValidationStatus stun_agent_validate (StunAgent *agent, StunMessage *msg,
msg
->
long_term_valid
=
FALSE
;
/* TODO: reject it or not ? */
if
(
agent
->
compatibility
==
STUN_COMPATIBILITY_RFC5389
&&
if
((
agent
->
compatibility
==
STUN_COMPATIBILITY_RFC5389
||
agent
->
compatibility
==
STUN_COMPATIBILITY_WLM2009
)
&&
!
stun_has_cookie
(
msg
))
{
stun_debug
(
"STUN demux error: no cookie!
\n
"
);
return
STUN_VALIDATION_BAD_REQUEST
;
}
if
(
agent
->
compatibility
==
STUN_COMPATIBILITY_RFC5389
&&
if
((
agent
->
compatibility
==
STUN_COMPATIBILITY_RFC5389
||
agent
->
compatibility
==
STUN_COMPATIBILITY_WLM2009
)
&&
agent
->
usage_flags
&
STUN_AGENT_USAGE_USE_FINGERPRINT
)
{
/* Looks for FINGERPRINT */
if
(
stun_message_find32
(
msg
,
STUN_ATTRIBUTE_FINGERPRINT
,
&
fpr
)
!=
...
...
@@ -317,7 +319,8 @@ bool stun_agent_init_request (StunAgent *agent, StunMessage *msg,
ret
=
stun_message_init
(
msg
,
STUN_REQUEST
,
m
,
id
);
if
(
ret
)
{
if
(
agent
->
compatibility
==
STUN_COMPATIBILITY_RFC5389
)
{
if
(
agent
->
compatibility
==
STUN_COMPATIBILITY_RFC5389
||
agent
->
compatibility
==
STUN_COMPATIBILITY_WLM2009
)
{
uint32_t
cookie
=
htonl
(
STUN_MAGIC_COOKIE
);
memcpy
(
msg
->
buffer
+
STUN_MESSAGE_TRANS_ID_POS
,
&
cookie
,
sizeof
(
cookie
));
}
...
...
@@ -344,7 +347,8 @@ bool stun_agent_init_indication (StunAgent *agent, StunMessage *msg,
ret
=
stun_message_init
(
msg
,
STUN_INDICATION
,
m
,
id
);
if
(
ret
)
{
if
(
agent
->
compatibility
==
STUN_COMPATIBILITY_RFC5389
)
{
if
(
agent
->
compatibility
==
STUN_COMPATIBILITY_RFC5389
||
agent
->
compatibility
==
STUN_COMPATIBILITY_WLM2009
)
{
uint32_t
cookie
=
htonl
(
STUN_MAGIC_COOKIE
);
memcpy
(
msg
->
buffer
+
STUN_MESSAGE_TRANS_ID_POS
,
&
cookie
,
sizeof
(
cookie
));
}
...
...
@@ -378,7 +382,8 @@ bool stun_agent_init_response (StunAgent *agent, StunMessage *msg,
if
(
stun_message_init
(
msg
,
STUN_RESPONSE
,
stun_message_get_method
(
request
),
id
))
{
if
(
agent
->
compatibility
==
STUN_COMPATIBILITY_RFC5389
&&
if
((
agent
->
compatibility
==
STUN_COMPATIBILITY_RFC5389
||
agent
->
compatibility
==
STUN_COMPATIBILITY_WLM2009
)
&&
agent
->
usage_flags
&
STUN_AGENT_USAGE_ADD_SOFTWARE
)
{
stun_message_append_software
(
msg
);
}
...
...
@@ -413,7 +418,8 @@ bool stun_agent_init_error (StunAgent *agent, StunMessage *msg,
if
(
stun_message_init
(
msg
,
STUN_ERROR
,
stun_message_get_method
(
request
),
id
))
{
if
(
agent
->
compatibility
==
STUN_COMPATIBILITY_RFC5389
&&
if
((
agent
->
compatibility
==
STUN_COMPATIBILITY_RFC5389
||
agent
->
compatibility
==
STUN_COMPATIBILITY_WLM2009
)
&&
agent
->
usage_flags
&
STUN_AGENT_USAGE_ADD_SOFTWARE
)
{
stun_message_append_software
(
msg
);
}
...
...
@@ -519,7 +525,8 @@ size_t stun_agent_finish_message (StunAgent *agent, StunMessage *msg,
}
}
if
(
agent
->
compatibility
==
STUN_COMPATIBILITY_RFC5389
&&
if
((
agent
->
compatibility
==
STUN_COMPATIBILITY_RFC5389
||
agent
->
compatibility
==
STUN_COMPATIBILITY_WLM2009
)
&&
agent
->
usage_flags
&
STUN_AGENT_USAGE_USE_FINGERPRINT
)
{
ptr
=
stun_message_append
(
msg
,
STUN_ATTRIBUTE_FINGERPRINT
,
4
);
if
(
ptr
==
NULL
)
{
...
...
stun/stunagent.h
View file @
966fc22a
...
...
@@ -53,7 +53,8 @@ typedef struct stun_agent_t StunAgent;
typedef
enum
{
STUN_COMPATIBILITY_RFC3489
,
STUN_COMPATIBILITY_RFC5389
,
STUN_COMPATIBILITY_LAST
=
STUN_COMPATIBILITY_RFC5389
STUN_COMPATIBILITY_WLM2009
,
STUN_COMPATIBILITY_LAST
=
STUN_COMPATIBILITY_WLM2009
}
StunCompatibility
;
...
...
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