Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
mediastreamer2
Commits
88f44f13
Commit
88f44f13
authored
Aug 08, 2012
by
Ghislain MARY
Browse files
Add functions to check if ICE remote credentials have changed.
parent
6bd50950
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
+46
-0
include/mediastreamer2/ice.h
include/mediastreamer2/ice.h
+20
-0
src/ice.c
src/ice.c
+26
-0
No files found.
include/mediastreamer2/ice.h
View file @
88f44f13
...
...
@@ -322,6 +322,16 @@ MS2_PUBLIC void ice_session_set_role(IceSession *session, IceRole role);
*/
void
ice_session_set_local_credentials
(
IceSession
*
session
,
const
char
*
ufrag
,
const
char
*
pwd
);
/**
* Tell if remote credentials of an ICE session have changed or not.
*
* @param session A pointer to a session
* @param ufrag The new remote username fragment
* @param pwd The new remote password
* @return TRUE if the remote credentials of the session have changed, FALSE otherwise.
*/
MS2_PUBLIC
bool_t
ice_session_remote_credentials_changed
(
IceSession
*
session
,
const
char
*
ufrag
,
const
char
*
pwd
);
/**
* Set the remote credentials of an ICE session.
*
...
...
@@ -467,6 +477,16 @@ MS2_PUBLIC const char * ice_check_list_remote_pwd(const IceCheckList *cl);
*/
MS2_PUBLIC
bool_t
ice_check_list_is_mismatch
(
const
IceCheckList
*
cl
);
/**
* Tell if remote credentials of an ICE check list have changed or not.
*
* @param cl A pointer to a check list
* @param ufrag The new remote username fragment
* @param pwd The new remote password
* @return TRUE if the remote credentials of the check list have changed, FALSE otherwise.
*/
MS2_PUBLIC
bool_t
ice_check_list_remote_credentials_changed
(
IceCheckList
*
cl
,
const
char
*
ufrag
,
const
char
*
pwd
);
/**
* Set the remote credentials of an ICE check list.
*
...
...
src/ice.c
View file @
88f44f13
...
...
@@ -450,6 +450,24 @@ static int ice_find_default_local_candidate(const IceCandidate *candidate, const
return
!
((
candidate
->
componentID
==
*
componentID
)
&&
(
candidate
->
is_default
==
TRUE
));
}
bool_t
ice_check_list_remote_credentials_changed
(
IceCheckList
*
cl
,
const
char
*
ufrag
,
const
char
*
pwd
)
{
const
char
*
old_ufrag
;
const
char
*
old_pwd
;
if
((
cl
->
remote_ufrag
==
NULL
)
||
(
cl
->
remote_pwd
==
NULL
))
{
if
(
cl
->
remote_ufrag
==
NULL
)
old_ufrag
=
cl
->
session
->
remote_ufrag
;
else
old_ufrag
=
cl
->
remote_ufrag
;
if
((
strlen
(
ufrag
)
!=
strlen
(
old_ufrag
))
||
(
strcmp
(
ufrag
,
old_ufrag
)
!=
0
))
return
TRUE
;
if
(
cl
->
remote_pwd
==
NULL
)
old_pwd
=
cl
->
session
->
remote_pwd
;
else
old_pwd
=
cl
->
remote_pwd
;
if
((
strlen
(
pwd
)
!=
strlen
(
old_pwd
))
||
(
strcmp
(
pwd
,
old_pwd
)
!=
0
))
return
TRUE
;
return
FALSE
;
}
if
(
strlen
(
ufrag
)
!=
strlen
(
cl
->
remote_ufrag
)
||
(
strcmp
(
ufrag
,
cl
->
remote_ufrag
)
!=
0
))
return
TRUE
;
if
(
strlen
(
pwd
)
!=
strlen
(
cl
->
remote_pwd
)
||
(
strcmp
(
pwd
,
cl
->
remote_pwd
)
!=
0
))
return
TRUE
;
return
FALSE
;
}
void
ice_check_list_set_remote_credentials
(
IceCheckList
*
cl
,
const
char
*
ufrag
,
const
char
*
pwd
)
{
ice_set_credentials
(
&
cl
->
remote_ufrag
,
&
cl
->
remote_pwd
,
ufrag
,
pwd
);
...
...
@@ -633,6 +651,14 @@ void ice_session_set_local_credentials(IceSession *session, const char *ufrag, c
ice_set_credentials
(
&
session
->
local_ufrag
,
&
session
->
local_pwd
,
ufrag
,
pwd
);
}
bool_t
ice_session_remote_credentials_changed
(
IceSession
*
session
,
const
char
*
ufrag
,
const
char
*
pwd
)
{
if
((
session
->
remote_ufrag
==
NULL
)
||
(
session
->
remote_pwd
==
NULL
))
return
TRUE
;
if
(
strlen
(
ufrag
)
!=
strlen
(
session
->
remote_ufrag
)
||
(
strcmp
(
ufrag
,
session
->
remote_ufrag
)
!=
0
))
return
TRUE
;
if
(
strlen
(
pwd
)
!=
strlen
(
session
->
remote_pwd
)
||
(
strcmp
(
pwd
,
session
->
remote_pwd
)
!=
0
))
return
TRUE
;
return
FALSE
;
}
void
ice_session_set_remote_credentials
(
IceSession
*
session
,
const
char
*
ufrag
,
const
char
*
pwd
)
{
ice_set_credentials
(
&
session
->
remote_ufrag
,
&
session
->
remote_pwd
,
ufrag
,
pwd
);
...
...
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