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
603e42ac
Commit
603e42ac
authored
Dec 22, 2010
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test-fullmode: Clean the credentials exchange by using a single function
parent
77e9d0b1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
69 deletions
+20
-69
tests/test-fullmode.c
tests/test-fullmode.c
+20
-69
No files found.
tests/test-fullmode.c
View file @
603e42ac
...
@@ -299,6 +299,20 @@ static void set_candidates (NiceAgent *from, guint from_stream,
...
@@ -299,6 +299,20 @@ static void set_candidates (NiceAgent *from, guint from_stream,
g_slist_free
(
cands
);
g_slist_free
(
cands
);
}
}
static
void
set_credentials
(
NiceAgent
*
lagent
,
guint
lstream
,
NiceAgent
*
ragent
,
guint
rstream
)
{
gchar
*
ufrag
=
NULL
,
*
password
=
NULL
;
nice_agent_get_local_credentials
(
lagent
,
lstream
,
&
ufrag
,
&
password
);
nice_agent_set_remote_credentials
(
ragent
,
rstream
,
ufrag
,
password
);
g_free
(
ufrag
);
g_free
(
password
);
nice_agent_get_local_credentials
(
ragent
,
rstream
,
&
ufrag
,
&
password
);
nice_agent_set_remote_credentials
(
lagent
,
lstream
,
ufrag
,
password
);
g_free
(
ufrag
);
g_free
(
password
);
}
static
int
run_full_test
(
NiceAgent
*
lagent
,
NiceAgent
*
ragent
,
NiceAddress
*
baseaddr
,
guint
ready
,
guint
failed
)
static
int
run_full_test
(
NiceAgent
*
lagent
,
NiceAgent
*
ragent
,
NiceAddress
*
baseaddr
,
guint
ready
,
guint
failed
)
{
{
...
@@ -368,21 +382,9 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
...
@@ -368,21 +382,9 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
g_assert
(
global_ragent_gathering_done
==
TRUE
);
g_assert
(
global_ragent_gathering_done
==
TRUE
);
}
}
set_credentials
(
lagent
,
ls_id
,
ragent
,
rs_id
);
/* step: pass the remote candidates to agents */
/* step: pass the remote candidates to agents */
{
gchar
*
ufrag
=
NULL
,
*
password
=
NULL
;
nice_agent_get_local_credentials
(
lagent
,
ls_id
,
&
ufrag
,
&
password
);
nice_agent_set_remote_credentials
(
ragent
,
rs_id
,
ufrag
,
password
);
g_free
(
ufrag
);
g_free
(
password
);
nice_agent_get_local_credentials
(
ragent
,
rs_id
,
&
ufrag
,
&
password
);
nice_agent_set_remote_credentials
(
lagent
,
ls_id
,
ufrag
,
password
);
g_free
(
ufrag
);
g_free
(
password
);
}
set_candidates
(
ragent
,
rs_id
,
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTP
);
set_candidates
(
ragent
,
rs_id
,
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTP
);
set_candidates
(
ragent
,
rs_id
,
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTCP
);
set_candidates
(
ragent
,
rs_id
,
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTCP
);
set_candidates
(
lagent
,
ls_id
,
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTP
);
set_candidates
(
lagent
,
ls_id
,
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTP
);
...
@@ -496,21 +498,8 @@ static int run_full_test_delayed_answer (NiceAgent *lagent, NiceAgent *ragent, N
...
@@ -496,21 +498,8 @@ static int run_full_test_delayed_answer (NiceAgent *lagent, NiceAgent *ragent, N
g_assert
(
global_ragent_gathering_done
==
TRUE
);
g_assert
(
global_ragent_gathering_done
==
TRUE
);
}
}
/* step: find out the local candidates of each agent */
set_credentials
(
lagent
,
ls_id
,
ragent
,
rs_id
);
{
gchar
*
ufrag
=
NULL
,
*
password
=
NULL
;
nice_agent_get_local_credentials
(
lagent
,
ls_id
,
&
ufrag
,
&
password
);
nice_agent_set_remote_credentials
(
ragent
,
rs_id
,
ufrag
,
password
);
g_free
(
ufrag
);
g_free
(
password
);
nice_agent_get_local_credentials
(
ragent
,
rs_id
,
&
ufrag
,
&
password
);
nice_agent_set_remote_credentials
(
lagent
,
ls_id
,
ufrag
,
password
);
g_free
(
ufrag
);
g_free
(
password
);
}
/* step: set remote candidates for agent R (answering party) */
/* step: set remote candidates for agent R (answering party) */
set_candidates
(
lagent
,
ls_id
,
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTP
);
set_candidates
(
lagent
,
ls_id
,
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTP
);
set_candidates
(
lagent
,
ls_id
,
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTCP
);
set_candidates
(
lagent
,
ls_id
,
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTCP
);
...
@@ -526,21 +515,6 @@ static int run_full_test_delayed_answer (NiceAgent *lagent, NiceAgent *ragent, N
...
@@ -526,21 +515,6 @@ static int run_full_test_delayed_answer (NiceAgent *lagent, NiceAgent *ragent, N
g_debug
(
"test-fullmode: Delayed answer received, continuing processing.."
);
g_debug
(
"test-fullmode: Delayed answer received, continuing processing.."
);
/* step: pass the remote candidates to agent L (offering party) */
{
gchar
*
ufrag
=
NULL
,
*
password
=
NULL
;
nice_agent_get_local_credentials
(
ragent
,
rs_id
,
&
ufrag
,
&
password
);
nice_agent_set_remote_credentials
(
lagent
,
ls_id
,
ufrag
,
password
);
g_free
(
ufrag
);
g_free
(
password
);
nice_agent_get_local_credentials
(
ragent
,
rs_id
,
&
ufrag
,
&
password
);
nice_agent_set_remote_credentials
(
lagent
,
ls_id
,
ufrag
,
password
);
g_free
(
ufrag
);
g_free
(
password
);
}
/* step: pass remove candidates to agent L (offering party) */
/* step: pass remove candidates to agent L (offering party) */
set_candidates
(
ragent
,
rs_id
,
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTP
);
set_candidates
(
ragent
,
rs_id
,
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTP
);
set_candidates
(
ragent
,
rs_id
,
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTCP
);
set_candidates
(
ragent
,
rs_id
,
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTCP
);
...
@@ -641,24 +615,12 @@ static int run_full_test_wrong_password (NiceAgent *lagent, NiceAgent *ragent, N
...
@@ -641,24 +615,12 @@ static int run_full_test_wrong_password (NiceAgent *lagent, NiceAgent *ragent, N
g_debug
(
"test-fullmode: Got local candidates..."
);
g_debug
(
"test-fullmode: Got local candidates..."
);
set_credentials
(
lagent
,
ls_id
,
ragent
,
rs_id
);
nice_agent_set_remote_credentials
(
ragent
,
rs_id
,
"wrong"
,
"password"
);
nice_agent_set_remote_credentials
(
ragent
,
rs_id
,
"wrong"
,
"password"
);
nice_agent_set_remote_credentials
(
lagent
,
ls_id
,
"wrong2"
,
"password2"
);
nice_agent_set_remote_credentials
(
lagent
,
ls_id
,
"wrong2"
,
"password2"
);
/* step: pass the remote candidates to agents */
/* step: pass the remote candidates to agents */
{
gchar
*
ufrag
=
NULL
,
*
password
=
NULL
;
nice_agent_get_local_credentials
(
lagent
,
ls_id
,
&
ufrag
,
&
password
);
nice_agent_set_remote_credentials
(
ragent
,
rs_id
,
"wrong"
,
password
);
g_free
(
ufrag
);
g_free
(
password
);
nice_agent_get_local_credentials
(
ragent
,
rs_id
,
&
ufrag
,
&
password
);
nice_agent_set_remote_credentials
(
lagent
,
ls_id
,
ufrag
,
"wrong2"
);
g_free
(
ufrag
);
g_free
(
password
);
}
set_candidates
(
ragent
,
rs_id
,
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTP
);
set_candidates
(
ragent
,
rs_id
,
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTP
);
set_candidates
(
lagent
,
ls_id
,
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTP
);
set_candidates
(
lagent
,
ls_id
,
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTP
);
...
@@ -740,20 +702,9 @@ static int run_full_test_control_conflict (NiceAgent *lagent, NiceAgent *ragent,
...
@@ -740,20 +702,9 @@ static int run_full_test_control_conflict (NiceAgent *lagent, NiceAgent *ragent,
g_debug
(
"test-fullmode: Got local candidates..."
);
g_debug
(
"test-fullmode: Got local candidates..."
);
set_credentials
(
lagent
,
ls_id
,
ragent
,
rs_id
);
/* step: pass the remote candidates to agents */
/* step: pass the remote candidates to agents */
{
gchar
*
ufrag
=
NULL
,
*
password
=
NULL
;
nice_agent_get_local_credentials
(
lagent
,
ls_id
,
&
ufrag
,
&
password
);
nice_agent_set_remote_credentials
(
ragent
,
rs_id
,
ufrag
,
password
);
g_free
(
ufrag
);
g_free
(
password
);
nice_agent_get_local_credentials
(
ragent
,
rs_id
,
&
ufrag
,
&
password
);
nice_agent_set_remote_credentials
(
lagent
,
ls_id
,
ufrag
,
password
);
g_free
(
ufrag
);
g_free
(
password
);
}
set_candidates
(
ragent
,
rs_id
,
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTP
);
set_candidates
(
ragent
,
rs_id
,
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTP
);
set_candidates
(
lagent
,
ls_id
,
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTP
);
set_candidates
(
lagent
,
ls_id
,
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTP
);
...
...
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