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
6dda75c7
Commit
6dda75c7
authored
Jul 16, 2012
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'shadeslayer/dribble_mode'
parents
428f7028
ebc7313f
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
794 additions
and
38 deletions
+794
-38
.gitignore
.gitignore
+1
-0
agent/agent.c
agent/agent.c
+0
-6
agent/agent.h
agent/agent.h
+6
-0
agent/conncheck.c
agent/conncheck.c
+65
-23
agent/conncheck.h
agent/conncheck.h
+1
-0
agent/discovery.c
agent/discovery.c
+7
-6
stun/tests/test-parse.c
stun/tests/test-parse.c
+1
-1
tests/Makefile.am
tests/Makefile.am
+4
-1
tests/test-dribble.c
tests/test-dribble.c
+1
-1
tests/test-new-dribble.c
tests/test-new-dribble.c
+708
-0
No files found.
.gitignore
View file @
6dda75c7
...
@@ -130,6 +130,7 @@ tests/test-priority
...
@@ -130,6 +130,7 @@ tests/test-priority
tests/test-pseudotcp
tests/test-pseudotcp
tests/test-restart
tests/test-restart
tests/test-thread
tests/test-thread
tests/test-new-dribble
docs/reference/libnice/libnice*.txt
docs/reference/libnice/libnice*.txt
docs/reference/libnice/libnice.args
docs/reference/libnice/libnice.args
...
...
agent/agent.c
View file @
6dda75c7
...
@@ -2220,12 +2220,6 @@ nice_agent_set_remote_candidates (NiceAgent *agent, guint stream_id, guint compo
...
@@ -2220,12 +2220,6 @@ nice_agent_set_remote_candidates (NiceAgent *agent, guint stream_id, guint compo
goto
done
;
goto
done
;
}
}
if
(
stream
->
gathering
)
{
nice_debug
(
"Agent %p: Remote candidates refused for stream %d because "
"we are still gathering our own candidates"
,
agent
,
stream_id
);
added
=
-
1
;
goto
done
;
}
if
(
agent
->
reliable
&&
component
->
tcp
==
NULL
)
{
if
(
agent
->
reliable
&&
component
->
tcp
==
NULL
)
{
nice_debug
(
"Agent %p: not setting remote candidate for s%d:%d because "
nice_debug
(
"Agent %p: not setting remote candidate for s%d:%d because "
...
...
agent/agent.h
View file @
6dda75c7
...
@@ -505,6 +505,12 @@ nice_agent_get_local_credentials (
...
@@ -505,6 +505,12 @@ nice_agent_get_local_credentials (
#NiceAgent::candidate-gathering-done signale before
#NiceAgent::candidate-gathering-done signale before
calling nice_agent_set_remote_candidates()
calling nice_agent_set_remote_candidates()
</para>
</para>
<para>
Since 0.1.3, there is no need to wait for the candidate-gathering-done signal.
Remote candidates can be set even while gathering local candidates.
Newly discovered local candidates will automatically be paired with
existing remote candidates.
</para>
</note>
</note>
*
*
* Returns: The number of candidates added, negative on errors (memory allocation
* Returns: The number of candidates added, negative on errors (memory allocation
...
...
agent/conncheck.c
View file @
6dda75c7
...
@@ -1286,6 +1286,40 @@ static void priv_add_new_check_pair (NiceAgent *agent, guint stream_id, Componen
...
@@ -1286,6 +1286,40 @@ static void priv_add_new_check_pair (NiceAgent *agent, guint stream_id, Componen
}
}
}
}
static
gboolean
priv_conn_check_add_for_candidate_pair
(
NiceAgent
*
agent
,
guint
stream_id
,
Component
*
component
,
NiceCandidate
*
local
,
NiceCandidate
*
remote
)
{
gboolean
ret
=
FALSE
;
/* note: do not create pairs where the local candidate is
* a srv-reflexive (ICE 5.7.3. "Pruning the pairs" ID-9) */
if
((
agent
->
compatibility
==
NICE_COMPATIBILITY_RFC5245
||
agent
->
compatibility
==
NICE_COMPATIBILITY_WLM2009
||
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007R2
)
&&
local
->
type
==
NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE
)
{
return
FALSE
;
}
/* note: match pairs only if transport and address family are the same */
if
(
local
->
transport
==
remote
->
transport
&&
local
->
addr
.
s
.
addr
.
sa_family
==
remote
->
addr
.
s
.
addr
.
sa_family
)
{
priv_add_new_check_pair
(
agent
,
stream_id
,
component
,
local
,
remote
,
NICE_CHECK_FROZEN
,
FALSE
);
ret
=
TRUE
;
if
(
component
->
state
<
NICE_COMPONENT_STATE_CONNECTED
)
{
agent_signal_component_state_change
(
agent
,
stream_id
,
component
->
id
,
NICE_COMPONENT_STATE_CONNECTING
);
}
else
{
agent_signal_component_state_change
(
agent
,
stream_id
,
component
->
id
,
NICE_COMPONENT_STATE_CONNECTED
);
}
}
return
ret
;
}
/*
/*
* Forms new candidate pairs by matching the new remote candidate
* Forms new candidate pairs by matching the new remote candidate
* 'remote_cand' with all existing local candidates of 'component'.
* 'remote_cand' with all existing local candidates of 'component'.
...
@@ -1302,36 +1336,44 @@ int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, Component *
...
@@ -1302,36 +1336,44 @@ int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, Component *
{
{
GSList
*
i
;
GSList
*
i
;
int
added
=
0
;
int
added
=
0
;
int
ret
=
0
;
for
(
i
=
component
->
local_candidates
;
i
;
i
=
i
->
next
)
{
for
(
i
=
component
->
local_candidates
;
i
;
i
=
i
->
next
)
{
NiceCandidate
*
local
=
i
->
data
;
NiceCandidate
*
local
=
i
->
data
;
ret
=
priv_conn_check_add_for_candidate_pair
(
agent
,
stream_id
,
component
,
local
,
remote
);
/* note: match pairs only if transport and address family are the same */
if
(
ret
)
{
if
(
local
->
transport
==
remote
->
transport
&&
++
added
;
local
->
addr
.
s
.
addr
.
sa_family
==
remote
->
addr
.
s
.
addr
.
sa_family
)
{
}
}
/* note: do not create pairs where local candidate is
return
added
;
* a srv-reflexive (ICE 5.7.3. "Pruning the Pairs" ID-19) */
}
if
((
agent
->
compatibility
==
NICE_COMPATIBILITY_RFC5245
||
agent
->
compatibility
==
NICE_COMPATIBILITY_WLM2009
||
agent
->
compatibility
==
NICE_COMPATIBILITY_OC2007R2
)
&&
local
->
type
==
NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE
)
continue
;
priv_add_new_check_pair
(
agent
,
stream_id
,
component
,
local
,
remote
,
NICE_CHECK_FROZEN
,
FALSE
);
/*
* Forms new candidate pairs by matching the new local candidate
* 'local_cand' with all existing remote candidates of 'component'.
*
* @param agent context
* @param component pointer to the component
* @param local local candidate to match with
*
* @return number of checks added, negative on fatal errors
*/
int
conn_check_add_for_local_candidate
(
NiceAgent
*
agent
,
guint
stream_id
,
Component
*
component
,
NiceCandidate
*
local
)
{
GSList
*
i
;
int
added
=
0
;
int
ret
=
0
;
for
(
i
=
component
->
remote_candidates
;
i
;
i
=
i
->
next
)
{
NiceCandidate
*
remote
=
i
->
data
;
ret
=
priv_conn_check_add_for_candidate_pair
(
agent
,
stream_id
,
component
,
local
,
remote
);
if
(
ret
)
{
++
added
;
++
added
;
if
(
component
->
state
<
NICE_COMPONENT_STATE_CONNECTED
)
{
agent_signal_component_state_change
(
agent
,
stream_id
,
component
->
id
,
NICE_COMPONENT_STATE_CONNECTING
);
}
else
{
agent_signal_component_state_change
(
agent
,
stream_id
,
component
->
id
,
NICE_COMPONENT_STATE_CONNECTED
);
}
}
}
}
}
...
...
agent/conncheck.h
View file @
6dda75c7
...
@@ -82,6 +82,7 @@ struct _CandidateCheckPair
...
@@ -82,6 +82,7 @@ struct _CandidateCheckPair
};
};
int
conn_check_add_for_candidate
(
NiceAgent
*
agent
,
guint
stream_id
,
Component
*
component
,
NiceCandidate
*
remote
);
int
conn_check_add_for_candidate
(
NiceAgent
*
agent
,
guint
stream_id
,
Component
*
component
,
NiceCandidate
*
remote
);
int
conn_check_add_for_local_candidate
(
NiceAgent
*
agent
,
guint
stream_id
,
Component
*
component
,
NiceCandidate
*
local
);
void
conn_check_free_item
(
gpointer
data
,
gpointer
user_data
);
void
conn_check_free_item
(
gpointer
data
,
gpointer
user_data
);
void
conn_check_free
(
NiceAgent
*
agent
);
void
conn_check_free
(
NiceAgent
*
agent
);
gboolean
conn_check_schedule_next
(
NiceAgent
*
agent
);
gboolean
conn_check_schedule_next
(
NiceAgent
*
agent
);
...
...
agent/discovery.c
View file @
6dda75c7
...
@@ -247,7 +247,7 @@ void refresh_cancel (CandidateRefresh *refresh)
...
@@ -247,7 +247,7 @@ void refresh_cancel (CandidateRefresh *refresh)
* defined in ICE spec section 4.1.3 "Eliminating Redundant
* defined in ICE spec section 4.1.3 "Eliminating Redundant
* Candidates" (ID-19).
* Candidates" (ID-19).
*/
*/
static
gboolean
priv_add_local_candidate_pruned
(
Component
*
component
,
NiceCandidate
*
candidate
)
static
gboolean
priv_add_local_candidate_pruned
(
NiceAgent
*
agent
,
guint
stream_id
,
Component
*
component
,
NiceCandidate
*
candidate
)
{
{
GSList
*
i
;
GSList
*
i
;
...
@@ -263,6 +263,7 @@ static gboolean priv_add_local_candidate_pruned (Component *component, NiceCandi
...
@@ -263,6 +263,7 @@ static gboolean priv_add_local_candidate_pruned (Component *component, NiceCandi
component
->
local_candidates
=
g_slist_append
(
component
->
local_candidates
,
component
->
local_candidates
=
g_slist_append
(
component
->
local_candidates
,
candidate
);
candidate
);
conn_check_add_for_local_candidate
(
agent
,
stream_id
,
component
,
candidate
);
return
TRUE
;
return
TRUE
;
}
}
...
@@ -489,7 +490,7 @@ NiceCandidate *discovery_add_local_host_candidate (
...
@@ -489,7 +490,7 @@ NiceCandidate *discovery_add_local_host_candidate (
candidate
->
addr
=
udp_socket
->
addr
;
candidate
->
addr
=
udp_socket
->
addr
;
candidate
->
base_addr
=
udp_socket
->
addr
;
candidate
->
base_addr
=
udp_socket
->
addr
;
if
(
!
priv_add_local_candidate_pruned
(
component
,
candidate
))
if
(
!
priv_add_local_candidate_pruned
(
agent
,
stream_id
,
component
,
candidate
))
goto
errors
;
goto
errors
;
component
->
sockets
=
g_slist_append
(
component
->
sockets
,
udp_socket
);
component
->
sockets
=
g_slist_append
(
component
->
sockets
,
udp_socket
);
...
@@ -547,7 +548,7 @@ discovery_add_server_reflexive_candidate (
...
@@ -547,7 +548,7 @@ discovery_add_server_reflexive_candidate (
priv_generate_candidate_credentials
(
agent
,
candidate
);
priv_generate_candidate_credentials
(
agent
,
candidate
);
priv_assign_foundation
(
agent
,
candidate
);
priv_assign_foundation
(
agent
,
candidate
);
result
=
priv_add_local_candidate_pruned
(
component
,
candidate
);
result
=
priv_add_local_candidate_pruned
(
agent
,
stream_id
,
component
,
candidate
);
if
(
result
)
{
if
(
result
)
{
agent_signal_new_candidate
(
agent
,
candidate
);
agent_signal_new_candidate
(
agent
,
candidate
);
}
}
...
@@ -620,7 +621,7 @@ discovery_add_relay_candidate (
...
@@ -620,7 +621,7 @@ discovery_add_relay_candidate (
priv_assign_foundation
(
agent
,
candidate
);
priv_assign_foundation
(
agent
,
candidate
);
if
(
!
priv_add_local_candidate_pruned
(
component
,
candidate
))
if
(
!
priv_add_local_candidate_pruned
(
agent
,
stream_id
,
component
,
candidate
))
goto
errors
;
goto
errors
;
component
->
sockets
=
g_slist_append
(
component
->
sockets
,
relay_socket
);
component
->
sockets
=
g_slist_append
(
component
->
sockets
,
relay_socket
);
...
@@ -715,9 +716,9 @@ discovery_add_peer_reflexive_candidate (
...
@@ -715,9 +716,9 @@ discovery_add_peer_reflexive_candidate (
candidate
->
sockptr
=
base_socket
;
candidate
->
sockptr
=
base_socket
;
candidate
->
base_addr
=
base_socket
->
addr
;
candidate
->
base_addr
=
base_socket
->
addr
;
result
=
priv_add_local_candidate_pruned
(
component
,
candidate
);
result
=
priv_add_local_candidate_pruned
(
agent
,
stream_id
,
component
,
candidate
);
if
(
result
!=
TRUE
)
{
if
(
result
!=
TRUE
)
{
/* error: memory allocation, or duplicate candidate
t
*/
/* error: memory allocation, or duplicate candidate */
nice_candidate_free
(
candidate
),
candidate
=
NULL
;
nice_candidate_free
(
candidate
),
candidate
=
NULL
;
}
}
...
...
stun/tests/test-parse.c
View file @
6dda75c7
...
@@ -368,7 +368,7 @@ static void test_attribute (void)
...
@@ -368,7 +368,7 @@ static void test_attribute (void)
StunMessage
msg
;
StunMessage
msg
;
uint16_t
known_attributes
[]
=
{
STUN_ATTRIBUTE_MESSAGE_INTEGRITY
,
STUN_ATTRIBUTE_USERNAME
,
0
};
uint16_t
known_attributes
[]
=
{
STUN_ATTRIBUTE_MESSAGE_INTEGRITY
,
STUN_ATTRIBUTE_USERNAME
,
0
};
printf
(
"Attribute test message length: %u
\n
"
,
sizeof
(
acme
));
printf
(
"Attribute test message length: %
l
u
\n
"
,
sizeof
(
acme
));
stun_agent_init
(
&
agent
,
known_attributes
,
stun_agent_init
(
&
agent
,
known_attributes
,
STUN_COMPATIBILITY_RFC5389
,
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS
);
STUN_COMPATIBILITY_RFC5389
,
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS
);
...
...
tests/Makefile.am
View file @
6dda75c7
...
@@ -32,7 +32,8 @@ check_PROGRAMS = \
...
@@ -32,7 +32,8 @@ check_PROGRAMS = \
test-restart
\
test-restart
\
test-fallback
\
test-fallback
\
test-thread
\
test-thread
\
test-dribble
test-dribble
\
test-new-dribble
dist_check_SCRIPTS
=
\
dist_check_SCRIPTS
=
\
check-test-fullmode-with-stun.sh
\
check-test-fullmode-with-stun.sh
\
...
@@ -64,6 +65,8 @@ test_fallback_LDADD = $(COMMON_LDADD)
...
@@ -64,6 +65,8 @@ test_fallback_LDADD = $(COMMON_LDADD)
test_dribble_LDADD
=
$(COMMON_LDADD)
test_dribble_LDADD
=
$(COMMON_LDADD)
test_new_dribble_LDADD
=
$(COMMON_LDADD)
all-local
:
all-local
:
chmod
a+x
$(srcdir)
/check-test-fullmode-with-stun.sh
chmod
a+x
$(srcdir)
/check-test-fullmode-with-stun.sh
chmod
a+x
$(srcdir)
/test-pseudotcp-random.sh
chmod
a+x
$(srcdir)
/test-pseudotcp-random.sh
tests/test-dribble.c
View file @
6dda75c7
...
@@ -381,7 +381,7 @@ int main (void)
...
@@ -381,7 +381,7 @@ int main (void)
nice_agent_remove_stream
(
ragent
,
rs_id
);
nice_agent_remove_stream
(
ragent
,
rs_id
);
priv_print_global_status
();
priv_print_global_status
();
g_assert
(
global_lagent_state
==
NICE_COMPONENT_STATE_READY
);
g_assert
(
global_lagent_state
==
NICE_COMPONENT_STATE_READY
);
g_assert
(
global_ragent_state
==
NICE_COMPONENT_STATE_READY
);
g_assert
(
global_ragent_state
>=
NICE_COMPONENT_STATE_CONNECTED
);
/* note: verify that correct number of local candidates were reported */
/* note: verify that correct number of local candidates were reported */
g_assert
(
global_lagent_cands
==
1
);
g_assert
(
global_lagent_cands
==
1
);
g_assert
(
global_ragent_cands
==
1
);
g_assert
(
global_ragent_cands
==
1
);
...
...
tests/test-new-dribble.c
0 → 100644
View file @
6dda75c7
This diff is collapsed.
Click to expand it.
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