Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
libnice
libnice
Commits
bb5b0677
Commit
bb5b0677
authored
Oct 10, 2007
by
Kai Vehmanen
Browse files
Updated documentation to match ICE ID-18.
darcs-hash:20071010114010-77cd4-5aba24bc8c7d56e01596b824c6d6d7c5a37a1d05.gz
parent
1c976c0b
Changes
8
Hide whitespace changes
Inline
Side-by-side
agent/agent-priv.h
View file @
bb5b0677
...
...
@@ -49,6 +49,9 @@
#include
"conncheck.h"
#include
"component.h"
/* XXX: starting from ICE ID-18, Ta SHOULD now be set according
* to session bandwidth -> this is not yet implemented in NICE */
#define NICE_AGENT_TIMER_TA_DEFAULT 20
/* timer Ta, msecs (impl. defined) */
#define NICE_AGENT_TIMER_TR_DEFAULT 15000
/* timer Tr, msecs (ICE ID-17) */
...
...
agent/agent.c
View file @
bb5b0677
...
...
@@ -1367,7 +1367,7 @@ nice_agent_get_remote_candidates (
* nice_agent_restart
* @agent: A NiceAgent
*
* Restarts the session as defined in ICE spec (ID-1
7
). This function
* Restarts the session as defined in ICE spec (ID-1
8
). This function
* needs to be called both when initiating (ICE spec section 9.1.1.1.
* "ICE Restarts"), as well as when reacting (spec section 9.2.1.1.
* "Detecting ICE Restart") to a restart.
...
...
agent/candidate.c
View file @
bb5b0677
...
...
@@ -96,7 +96,7 @@ nice_candidate_jingle_priority (NiceCandidate *candidate)
/**
* ICE 4.1.2.1. "Recommended Formula" (ID-1
7
):
* ICE 4.1.2.1. "Recommended Formula" (ID-1
8
):
* returns number between 1 and 0x7effffff
*/
G_GNUC_CONST
...
...
@@ -140,7 +140,7 @@ nice_candidate_ice_priority (const NiceCandidate *candidate)
/**
* Calculates the pair priority as specified in ICE
* sect 5.7.2. "Computing Pair Priority and Ordering Pairs" (ID-1
7
).
* sect 5.7.2. "Computing Pair Priority and Ordering Pairs" (ID-1
8
).
*/
NICEAPI_EXPORT
guint64
nice_candidate_pair_priority
(
guint32
o_prio
,
guint32
a_prio
)
...
...
agent/component.c
View file @
bb5b0677
...
...
@@ -180,7 +180,7 @@ component_restart (Component *cmp)
/* note: do not remove the remote candidate that is
* currently part of the 'selected pair', see ICE
* 9.1.1.1. "ICE Restarts" (ID-1
7
) */
* 9.1.1.1. "ICE Restarts" (ID-1
8
) */
if
(
candidate
==
cmp
->
selected_pair
.
remote
)
{
if
(
cmp
->
restart_candidate
)
nice_candidate_free
(
cmp
->
restart_candidate
);
...
...
agent/conncheck.c
View file @
bb5b0677
...
...
@@ -104,7 +104,7 @@ static gboolean priv_conn_check_initiate (NiceAgent *agent, CandidateCheckPair *
/**
* Unfreezes the next connectivity check in the list. Follows the
* algorithm (2.) defined in 5.7.4 (Computing States) of the ICE spec
* (ID-1
7
), with some exceptions (see comments in code).
* (ID-1
8
), with some exceptions (see comments in code).
*
* See also sect 7.1.2.2.3 (Updating Pair States), and
* priv_conn_check_unfreeze_related().
...
...
@@ -158,7 +158,7 @@ static gboolean priv_conn_check_unfreeze_next (NiceAgent *agent)
* Unfreezes the next next connectivity check in the list after
* check 'success_check' has succesfully completed.
*
* See sect 7.1.2.2.3 (Updating Pair States) of ICE spec (ID-1
7
).
* See sect 7.1.2.2.3 (Updating Pair States) of ICE spec (ID-1
8
).
*
* @param agent context
* @param ok_check a connectivity check that has just completed
...
...
@@ -374,7 +374,7 @@ static gboolean priv_conn_keepalive_tick (gpointer pointer)
int
errors
=
0
;
/* case 1: session established and media flowing
* (ref ICE sect 10 "Keepalives" ID-1
7
) */
* (ref ICE sect 10 "Keepalives" ID-1
8
) */
for
(
i
=
agent
->
streams
;
i
;
i
=
i
->
next
)
{
Stream
*
stream
=
i
->
data
;
...
...
@@ -400,7 +400,7 @@ static gboolean priv_conn_keepalive_tick (gpointer pointer)
}
/* case 2: connectivity establishment ongoing
* (ref ICE sect 4.1.1.
5
"Keeping Candidates Alive" ID-1
7
) */
* (ref ICE sect 4.1.1.
4
"Keeping Candidates Alive" ID-1
8
) */
for
(
i
=
agent
->
streams
;
i
;
i
=
i
->
next
)
{
Stream
*
stream
=
i
->
data
;
if
(
stream
->
conncheck_state
==
NICE_CHECKLIST_RUNNING
)
{
...
...
@@ -516,7 +516,7 @@ static gboolean priv_add_new_check_pair (NiceAgent *agent, guint stream_id, Comp
* Forms new candidate pairs by matching the new remote candidate
* 'remote_cand' with all existing local candidates of 'component'.
* Implements the logic described in ICE sect 5.7.1. "Forming Candidate
* Pairs" (ID-1
7
).
* Pairs" (ID-1
8
).
*
* @param agent context
* @param component pointer to the component
...
...
@@ -540,7 +540,7 @@ int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, Component *
gboolean
result
;
/* note: do not create pairs where local candidate is
* a srv-reflexive (ICE 5.7.3. "Pruning the Pairs" ID-1
7
) */
* a srv-reflexive (ICE 5.7.3. "Pruning the Pairs" ID-1
8
) */
if
(
local
->
type
==
NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE
)
continue
;
...
...
@@ -761,7 +761,7 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
* Updates the check list state.
*
* Implements parts of the algorithm described in
* ICE sect 8.1.2. "Updating States" (ID-1
7
) that apply
* ICE sect 8.1.2. "Updating States" (ID-1
8
) that apply
* to the whole check list.
*/
static
void
priv_update_check_list_state
(
NiceAgent
*
agent
,
Stream
*
stream
)
...
...
@@ -804,7 +804,7 @@ static void priv_update_check_list_state (NiceAgent *agent, Stream *stream)
/**
* Implemented the pruning steps described in ICE sect 8.1.2
* "Updating States" (ID-1
7
) after a pair has been nominated.
* "Updating States" (ID-1
8
) after a pair has been nominated.
*
* @see priv_update_check_list_state_for_component()
*/
...
...
@@ -820,7 +820,7 @@ static void priv_prune_pending_checks (NiceAgent *agent, Stream *stream, guint c
p
->
state
==
NICE_CHECK_WAITING
)
p
->
state
=
NICE_CHECK_CANCELLED
;
/* note: a SHOULD level req. in ICE 8.1.2. "Updating States" (ID-1
7
) */
/* note: a SHOULD level req. in ICE 8.1.2. "Updating States" (ID-1
8
) */
if
(
p
->
state
==
NICE_CHECK_IN_PROGRESS
)
{
if
(
p
->
stun_ctx
)
stun_bind_cancel
(
p
->
stun_ctx
),
...
...
@@ -835,7 +835,7 @@ static void priv_prune_pending_checks (NiceAgent *agent, Stream *stream, guint c
* Updates the check list state for a stream component.
*
* Implements the algorithm described in ICE sect 8.1.2
* "Updating States" (ID-1
7
) as it applies to checks of
* "Updating States" (ID-1
8
) as it applies to checks of
* a certain component. If any there are any nominated pairs,
* ICE processing may be concluded, and component state is
* changed to READY.
...
...
@@ -873,7 +873,7 @@ static void priv_update_check_list_state_for_component (NiceAgent *agent, Stream
/**
* Changes the selected pair for the component if 'pair' is nominated
* and has higher priority than the currently selected pair. See
* ICE sect 11.1.1. "Procedures for Full Implementations" (ID-1
7
).
* ICE sect 11.1.1. "Procedures for Full Implementations" (ID-1
8
).
*/
static
gboolean
priv_update_selected_pair
(
NiceAgent
*
agent
,
Component
*
component
,
CandidateCheckPair
*
pair
)
{
...
...
@@ -894,7 +894,7 @@ static gboolean priv_update_selected_pair (NiceAgent *agent, Component *componen
/**
* Schedules a triggered check after a succesfully inbound
* connectivity check. Implements ICE sect 7.2.1.4 "Triggered Checks" (ID-1
7
).
* connectivity check. Implements ICE sect 7.2.1.4 "Triggered Checks" (ID-1
8
).
*
* @param agent self pointer
* @param component the check is related to
...
...
@@ -920,7 +920,7 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream,
priv_conn_check_initiate
(
agent
,
p
);
if
(
p
->
state
==
NICE_CHECK_IN_PROGRESS
)
{
/* XXX: according to ICE 7.2.1.4 "Triggered Checks" (ID-1
7
),
/* XXX: according to ICE 7.2.1.4 "Triggered Checks" (ID-1
8
),
* we should cancel the existing one, and send a new one...? :P */
g_debug
(
"Skipping triggered check, already in progress.."
);
}
...
...
@@ -1097,7 +1097,7 @@ static void priv_check_for_role_conflict (NiceAgent *agent, gboolean control)
/**
* Tries to match STUN reply in 'buf' to an existing STUN connectivity
* check transaction. If found, the reply is processed. Implements
* section 7.1.2 "Processing the Response" of ICE spec (ID-1
7
).
* section 7.1.2 "Processing the Response" of ICE spec (ID-1
8
).
*
* @return TRUE if a matching transaction is found
*/
...
...
@@ -1128,7 +1128,7 @@ static gboolean priv_map_reply_to_conn_check_request (NiceAgent *agent, Stream *
/* step: handle the possible case of a peer-reflexive
* candidate where the mapped-address in response does
* not match any local candidate, see 7.1.2.2.1
* "Discovering Peer Reflexive Candidates" ICE ID-1
7
) */
* "Discovering Peer Reflexive Candidates" ICE ID-1
8
) */
{
NiceAddress
mapped
;
GSList
*
j
;
...
...
@@ -1162,7 +1162,7 @@ static gboolean priv_map_reply_to_conn_check_request (NiceAgent *agent, Stream *
p
->
state
=
NICE_CHECK_FAILED
;
/* step: add a new discovered pair (see ICE 7.1.2.2.2
"Constructing a Valid Pair" (ID-1
7
)) */
"Constructing a Valid Pair" (ID-1
8
)) */
new_pair
=
priv_add_peer_reflexive_pair
(
agent
,
stream
->
id
,
component
->
id
,
cand
,
p
);
ok_pair
=
new_pair
;
...
...
@@ -1179,12 +1179,12 @@ static gboolean priv_map_reply_to_conn_check_request (NiceAgent *agent, Stream *
/* step: updating nominated flag (ICE 7.1.2.2.4 "Updating the
Nominated Flag" (ID-1
7
) */
Nominated Flag" (ID-1
8
) */
if
(
ok_pair
->
nominated
==
TRUE
)
priv_update_selected_pair
(
agent
,
component
,
ok_pair
);
/* step: update pair states (ICE 7.1.2.2.3 "Updating pair
states" and 8.1.2 "Updating States", ID-1
7
) */
states" and 8.1.2 "Updating States", ID-1
8
) */
priv_update_check_list_state_for_component
(
agent
,
stream
,
component
);
trans_found
=
TRUE
;
...
...
@@ -1195,7 +1195,7 @@ static gboolean priv_map_reply_to_conn_check_request (NiceAgent *agent, Stream *
/* note: our role might already have changed due to an
* incoming request, but if not, change role now;
* follows ICE 7.1.2.1 "Failure Cases" (ID-1
7
) */
* follows ICE 7.1.2.1 "Failure Cases" (ID-1
8
) */
priv_check_for_role_conflict
(
agent
,
!
p
->
controlling
);
p
->
stun_ctx
=
NULL
;
...
...
@@ -1319,7 +1319,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, Compo
g_debug
(
"inbound STUN packet for %p/%u/%u (agent/stream/component):"
,
agent
,
stream
->
id
,
component
->
id
);
/* note: ICE 7.2. "STUN Server Procedures" (ID-1
7
) */
/* note: ICE 7.2. "STUN Server Procedures" (ID-1
8
) */
res
=
stun_conncheck_reply
(
rbuf
,
&
rbuf_len
,
(
const
uint8_t
*
)
buf
,
&
sockaddr
,
sizeof
(
sockaddr
),
stream
->
local_password
,
&
control
,
agent
->
tie_breaker
);
...
...
@@ -1373,7 +1373,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, Compo
gboolean
trans_found
=
FALSE
;
/* note: ICE sect 7.1.2. "Processing the Response" (ID-1
7
) */
/* note: ICE sect 7.1.2. "Processing the Response" (ID-1
8
) */
/* step: let's try to match the response to an existing check context */
if
(
trans_found
!=
TRUE
)
...
...
agent/discovery.c
View file @
bb5b0677
...
...
@@ -135,8 +135,8 @@ gboolean discovery_prune_stream (NiceAgent *agent, guint stream_id)
/**
* Adds a new local candidate. Implements the candidate pruning
* defined in ICE spec section 4.1.
1.
3 "Eliminating Redundant
* Candidates" (ID-1
7
).
* defined in ICE spec section 4.1.3 "Eliminating Redundant
* Candidates" (ID-1
8
).
*/
static
gboolean
priv_add_local_candidate_pruned
(
Component
*
component
,
NiceCandidate
*
candidate
)
{
...
...
@@ -170,7 +170,7 @@ static gboolean priv_add_local_candidate_pruned (Component *component, NiceCandi
* Assings a foundation to the candidate.
*
* Implements the mechanism described in ICE sect
* 4.1.1.
4
"Computing Foundations" (ID-1
7
).
* 4.1.1.
3
"Computing Foundations" (ID-1
8
).
*/
static
void
priv_assign_foundation
(
NiceAgent
*
agent
,
NiceCandidate
*
candidate
)
{
...
...
@@ -402,7 +402,7 @@ static guint priv_highest_remote_foundation (Component *component)
* remote candidates. The candidate is however not paired with
* existing local candidates.
*
* See ICE sect 7.2.1.3 "Learning Peer Reflexive Candidates" (ID-1
7
).
* See ICE sect 7.2.1.3 "Learning Peer Reflexive Candidates" (ID-1
8
).
*
* @return pointer to the created candidate, or NULL on error
*/
...
...
agent/stream.c
View file @
bb5b0677
...
...
@@ -157,7 +157,7 @@ stream_find_component_by_fd (const Stream *stream, guint fd)
void
stream_initialize_credentials
(
Stream
*
stream
,
NiceRNG
*
rng
)
{
/* note: generate ufrag/pwd for the stream (see ICE 15.4.
* '"ice-ufrag" and "ice-pwd" Attributes', ID-1
7
) */
* '"ice-ufrag" and "ice-pwd" Attributes', ID-1
8
) */
nice_rng_generate_bytes_print
(
rng
,
NICE_STREAM_DEF_UFRAG
-
1
,
stream
->
local_ufrag
);
nice_rng_generate_bytes_print
(
rng
,
NICE_STREAM_DEF_PWD
-
1
,
stream
->
local_password
);
}
...
...
agent/stream.h
View file @
bb5b0677
...
...
@@ -44,7 +44,9 @@
G_BEGIN_DECLS
/* Following include the terminating NULL */
/* Maximum and default sizes for ICE attributes,
* last updated from ICE ID-18
* (the below sizes include the terminating NULL): */
#define NICE_STREAM_MAX_UFRAG 1024 + 1
#define NICE_STREAM_MAX_UNAME 1024 + 1024 + 1 + 1
/* colon plus NULL */
...
...
@@ -54,7 +56,7 @@ G_BEGIN_DECLS
/**
* Checklist states. These match the definition given in
* the ICE spec sect 5.7.4. "Computing States" (ID-1
7
).
* the ICE spec sect 5.7.4. "Computing States" (ID-1
8
).
*/
typedef
enum
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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