Commit bb5b0677 authored by Kai Vehmanen's avatar Kai Vehmanen

Updated documentation to match ICE ID-18.

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