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
9cf4e79c
Commit
9cf4e79c
authored
Sep 14, 2010
by
Jakub Adam
Committed by
Youness Alaoui
Oct 01, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compatibility with MSOC 2007
parent
9eba3b31
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
34 deletions
+79
-34
agent/agent.c
agent/agent.c
+8
-1
agent/agent.h
agent/agent.h
+2
-0
agent/conncheck.c
agent/conncheck.c
+53
-25
agent/discovery.c
agent/discovery.c
+16
-8
No files found.
agent/agent.c
View file @
9cf4e79c
...
...
@@ -151,6 +151,8 @@ agent_to_ice_compatibility (NiceAgent *agent)
STUN_USAGE_ICE_COMPATIBILITY_MSN
:
agent
->
compatibility
==
NICE_COMPATIBILITY_WLM2009
?
STUN_USAGE_ICE_COMPATIBILITY_WLM2009
:
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
?
STUN_USAGE_ICE_COMPATIBILITY_MSN
:
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007R2
?
STUN_USAGE_ICE_COMPATIBILITY_WLM2009
:
STUN_USAGE_ICE_COMPATIBILITY_RFC5245
;
...
...
@@ -165,6 +167,8 @@ agent_to_turn_compatibility (NiceAgent *agent)
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
?
STUN_USAGE_TURN_COMPATIBILITY_MSN
:
agent
->
compatibility
==
NICE_COMPATIBILITY_WLM2009
?
STUN_USAGE_TURN_COMPATIBILITY_MSN
:
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
?
STUN_USAGE_TURN_COMPATIBILITY_MSN
:
STUN_USAGE_TURN_COMPATIBILITY_DRAFT9
;
}
...
...
@@ -177,6 +181,8 @@ agent_to_turn_socket_compatibility (NiceAgent *agent)
NICE_TURN_SOCKET_COMPATIBILITY_MSN
:
agent
->
compatibility
==
NICE_COMPATIBILITY_WLM2009
?
NICE_TURN_SOCKET_COMPATIBILITY_MSN
:
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
?
NICE_TURN_SOCKET_COMPATIBILITY_MSN
:
NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9
;
}
...
...
@@ -834,7 +840,8 @@ nice_agent_set_property (
STUN_COMPATIBILITY_RFC3489
,
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS
|
STUN_AGENT_USAGE_IGNORE_CREDENTIALS
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
)
{
stun_agent_init
(
&
agent
->
stun_agent
,
STUN_ALL_KNOWN_ATTRIBUTES
,
STUN_COMPATIBILITY_RFC3489
,
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS
|
...
...
agent/agent.h
View file @
9cf4e79c
...
...
@@ -213,6 +213,7 @@ typedef enum
* @NICE_COMPATIBILITY_MSN: Use compatibility for MSN Messenger specs
* @NICE_COMPATIBILITY_WLM2009: Use compatibility with Windows Live Messenger
* 2009
* @NICE_COMPATIBILITY_OC2007: Use compatibility with Microsoft Office Communicator 2007
* @NICE_COMPATIBILITY_OC2007R2: Use compatibility with Microsoft Office Communicator 2007 R2
* @NICE_COMPATIBILITY_DRAFT19: Use compatibility for ICE Draft 19 specs
* @NICE_COMPATIBILITY_LAST: Dummy last compatibility mode
...
...
@@ -230,6 +231,7 @@ typedef enum
NICE_COMPATIBILITY_GOOGLE
,
NICE_COMPATIBILITY_MSN
,
NICE_COMPATIBILITY_WLM2009
,
NICE_COMPATIBILITY_OC2007
,
NICE_COMPATIBILITY_OC2007R2
,
NICE_COMPATIBILITY_DRAFT19
=
NICE_COMPATIBILITY_RFC5245
,
NICE_COMPATIBILITY_LAST
=
NICE_COMPATIBILITY_OC2007R2
,
...
...
agent/conncheck.c
View file @
9cf4e79c
...
...
@@ -978,7 +978,8 @@ void conn_check_remote_candidates_set(NiceAgent *agent)
NiceCandidate
*
remote_candidate
=
NULL
;
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
||
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
)
{
/* We need to find which local candidate was used */
uint8_t
uname
[
NICE_STREAM_MAX_UNAME
];
guint
uname_len
;
...
...
@@ -1455,7 +1456,8 @@ size_t priv_gen_username (NiceAgent *agent, guint component_id,
len
+=
remote_len
;
memcpy
(
dest
+
len
,
local
,
local_len
);
len
+=
local_len
;
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
)
{
gchar
component_str
[
10
];
guchar
*
local_decoded
=
NULL
;
guchar
*
remote_decoded
=
NULL
;
...
...
@@ -1611,7 +1613,8 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
size_t
buffer_len
;
unsigned
int
timeout
;
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
)
{
password
=
g_base64_decode
((
gchar
*
)
password
,
&
password_len
);
}
...
...
@@ -1643,7 +1646,8 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
nice_debug
(
"Agent %p: conncheck created %d - %p"
,
agent
,
buffer_len
,
pair
->
stun_message
.
buffer
);
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
)
{
g_free
(
password
);
}
...
...
@@ -2512,7 +2516,17 @@ static bool conncheck_stun_validater (StunAgent *agent,
gchar
*
ufrag
=
NULL
;
gsize
ufrag_len
;
for
(
i
=
data
->
component
->
local_candidates
;
i
;
i
=
i
->
next
)
{
gboolean
msn_msoc_nice_compatibility
=
data
->
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
data
->
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
;
if
(
data
->
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
&&
stun_message_get_class
(
message
)
==
STUN_RESPONSE
)
i
=
data
->
component
->
remote_candidates
;
else
i
=
data
->
component
->
local_candidates
;
for
(;
i
;
i
=
i
->
next
)
{
NiceCandidate
*
cand
=
i
->
data
;
ufrag
=
NULL
;
...
...
@@ -2522,7 +2536,7 @@ static bool conncheck_stun_validater (StunAgent *agent,
ufrag
=
data
->
stream
->
local_ufrag
;
ufrag_len
=
ufrag
?
strlen
(
ufrag
)
:
0
;
if
(
ufrag
&&
data
->
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
if
(
ufrag
&&
msn_msoc_nice_compatibility
)
ufrag
=
(
gchar
*
)
g_base64_decode
(
ufrag
,
&
ufrag_len
);
if
(
ufrag
==
NULL
)
...
...
@@ -2547,20 +2561,20 @@ static bool conncheck_stun_validater (StunAgent *agent,
*
password
=
(
uint8_t
*
)
pass
;
*
password_len
=
strlen
(
pass
);
if
(
data
->
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
if
(
msn_msoc_nice_compatibility
)
{
data
->
password
=
g_base64_decode
(
pass
,
password_len
);
*
password
=
data
->
password
;
}
}
if
(
data
->
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
if
(
msn_msoc_nice_compatibility
)
g_free
(
ufrag
);
stun_debug
(
"Found valid username, returning password: '%s'
\n
"
,
*
password
);
return
TRUE
;
}
if
(
data
->
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
if
(
msn_msoc_nice_compatibility
)
g_free
(
ufrag
);
}
...
...
@@ -2681,7 +2695,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
if
(
len
==
0
)
return
FALSE
;
if
(
agent
->
compatibility
!=
NICE_COMPATIBILITY_MSN
)
{
if
(
agent
->
compatibility
!=
NICE_COMPATIBILITY_MSN
&&
agent
->
compatibility
!=
NICE_COMPATIBILITY_OC2007
)
{
nice_socket_send
(
socket
,
from
,
rbuf_len
,
(
const
gchar
*
)
rbuf
);
}
return
TRUE
;
...
...
@@ -2693,7 +2708,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
if
(
stun_agent_init_error
(
&
agent
->
stun_agent
,
&
msg
,
rbuf
,
rbuf_len
,
&
req
,
STUN_ERROR_UNAUTHORIZED
))
{
rbuf_len
=
stun_agent_finish_message
(
&
agent
->
stun_agent
,
&
msg
,
NULL
,
0
);
if
(
rbuf_len
>
0
&&
agent
->
compatibility
!=
NICE_COMPATIBILITY_MSN
)
if
(
rbuf_len
>
0
&&
agent
->
compatibility
!=
NICE_COMPATIBILITY_MSN
&&
agent
->
compatibility
!=
NICE_COMPATIBILITY_OC2007
)
nice_socket_send
(
socket
,
from
,
rbuf_len
,
(
const
gchar
*
)
rbuf
);
}
return
TRUE
;
...
...
@@ -2703,7 +2719,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
if
(
stun_agent_init_error
(
&
agent
->
stun_agent
,
&
msg
,
rbuf
,
rbuf_len
,
&
req
,
STUN_ERROR_BAD_REQUEST
))
{
rbuf_len
=
stun_agent_finish_message
(
&
agent
->
stun_agent
,
&
msg
,
NULL
,
0
);
if
(
rbuf_len
>
0
&&
agent
->
compatibility
!=
NICE_COMPATIBILITY_MSN
)
if
(
rbuf_len
>
0
&&
agent
->
compatibility
!=
NICE_COMPATIBILITY_MSN
&&
agent
->
compatibility
!=
NICE_COMPATIBILITY_OC2007
)
nice_socket_send
(
socket
,
from
,
rbuf_len
,
(
const
gchar
*
)
rbuf
);
}
return
TRUE
;
...
...
@@ -2721,7 +2738,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
}
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
||
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
)
{
/* We need to find which local candidate was used */
for
(
i
=
component
->
remote_candidates
;
i
!=
NULL
&&
remote_candidate2
==
NULL
;
i
=
i
->
next
)
{
...
...
@@ -2731,7 +2749,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
NiceCandidate
*
lcand
=
j
->
data
;
/* If we receive a response, then the username is local:remote */
if
(
agent
->
compatibility
!=
NICE_COMPATIBILITY_MSN
)
{
if
(
agent
->
compatibility
!=
NICE_COMPATIBILITY_MSN
&&
agent
->
compatibility
!=
NICE_COMPATIBILITY_OC2007
)
{
if
(
stun_message_get_class
(
&
req
)
==
STUN_REQUEST
||
stun_message_get_class
(
&
req
)
==
STUN_INDICATION
)
{
inbound
=
TRUE
;
...
...
@@ -2783,16 +2802,23 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
if
(
stun_message_get_class
(
&
req
)
==
STUN_REQUEST
)
{
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
)
{
if
(
local_candidate
&&
remote_candidate2
)
{
username
=
(
uint8_t
*
)
stun_message_find
(
&
req
,
STUN_ATTRIBUTE_USERNAME
,
&
username_len
);
uname_len
=
priv_create_username
(
agent
,
stream
,
component
->
id
,
remote_candidate2
,
local_candidate
,
uname
,
sizeof
(
uname
),
FALSE
);
memcpy
(
username
,
uname
,
username_len
);
req
.
key
=
g_base64_decode
((
gchar
*
)
remote_candidate2
->
password
,
&
req
.
key_len
);
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
username
=
(
uint8_t
*
)
stun_message_find
(
&
req
,
STUN_ATTRIBUTE_USERNAME
,
&
username_len
);
uname_len
=
priv_create_username
(
agent
,
stream
,
component
->
id
,
remote_candidate2
,
local_candidate
,
uname
,
sizeof
(
uname
),
FALSE
);
memcpy
(
username
,
uname
,
username_len
);
req
.
key
=
g_base64_decode
((
gchar
*
)
remote_candidate2
->
password
,
&
req
.
key_len
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
)
{
req
.
key
=
g_base64_decode
((
gchar
*
)
local_candidate
->
password
,
&
req
.
key_len
);
}
}
else
{
nice_debug
(
"Agent %p : received MSN incoming check from unknown remote candidate. "
"Ignoring request"
,
agent
);
...
...
@@ -2806,7 +2832,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
&
control
,
agent
->
tie_breaker
,
agent_to_ice_compatibility
(
agent
));
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
)
{
g_free
(
req
.
key
);
}
...
...
@@ -2822,7 +2849,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
if
(
agent
->
controlling_mode
||
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
||
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
)
use_candidate
=
TRUE
;
if
(
stream
->
initial_binding_request_received
!=
TRUE
)
...
...
agent/discovery.c
View file @
9cf4e79c
...
...
@@ -403,7 +403,8 @@ void priv_generate_candidate_credentials (NiceAgent *agent,
NiceCandidate
*
candidate
)
{
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
)
{
guchar
username
[
32
];
guchar
password
[
16
];
...
...
@@ -458,7 +459,8 @@ NiceCandidate *discovery_add_local_host_candidate (
candidate
->
base_addr
=
*
address
;
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
candidate
->
priority
=
nice_candidate_jingle_priority
(
candidate
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
)
{
candidate
->
priority
=
nice_candidate_msn_priority
(
candidate
);
}
else
{
candidate
->
priority
=
nice_candidate_ice_priority
(
candidate
);
...
...
@@ -523,7 +525,8 @@ discovery_add_server_reflexive_candidate (
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
candidate
->
priority
=
nice_candidate_jingle_priority
(
candidate
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
)
{
candidate
->
priority
=
nice_candidate_msn_priority
(
candidate
);
}
else
{
candidate
->
priority
=
nice_candidate_ice_priority_full
...
...
@@ -580,7 +583,8 @@ discovery_add_relay_candidate (
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
candidate
->
priority
=
nice_candidate_jingle_priority
(
candidate
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
)
{
candidate
->
priority
=
nice_candidate_msn_priority
(
candidate
);
}
else
{
candidate
->
priority
=
nice_candidate_ice_priority_full
...
...
@@ -656,7 +660,8 @@ discovery_add_peer_reflexive_candidate (
candidate
->
transport
=
NICE_CANDIDATE_TRANSPORT_UDP
;
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
candidate
->
priority
=
nice_candidate_jingle_priority
(
candidate
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
)
{
candidate
->
priority
=
nice_candidate_msn_priority
(
candidate
);
}
else
{
candidate
->
priority
=
nice_candidate_ice_priority_full
...
...
@@ -670,7 +675,8 @@ discovery_add_peer_reflexive_candidate (
priv_assign_foundation
(
agent
,
candidate
);
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
&&
if
((
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
)
&&
remote
&&
local
)
{
guchar
*
new_username
=
NULL
;
guchar
*
decoded_local
=
NULL
;
...
...
@@ -751,7 +757,8 @@ NiceCandidate *discovery_learn_remote_peer_reflexive_candidate (
candidate
->
priority
=
priority
;
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
candidate
->
priority
=
nice_candidate_jingle_priority
(
candidate
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
)
{
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
)
{
candidate
->
priority
=
nice_candidate_msn_priority
(
candidate
);
}
else
{
candidate
->
priority
=
nice_candidate_ice_priority_full
...
...
@@ -763,7 +770,8 @@ NiceCandidate *discovery_learn_remote_peer_reflexive_candidate (
priv_assign_remote_foundation
(
agent
,
candidate
);
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
&&
if
((
agent
->
compatibility
==
NICE_COMPATIBILITY_MSN
||
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007
)
&&
remote
&&
local
)
{
guchar
*
new_username
=
NULL
;
guchar
*
decoded_local
=
NULL
;
...
...
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