Commit 05bad78d authored by Kai Vehmanen's avatar Kai Vehmanen

Update references to ICE ID-17.

darcs-hash:20070717181000-77cd4-c07e724f0cc8a2f4bdadf179b1bd908f16fb3452.gz
parent 61f4fe02
...@@ -49,9 +49,8 @@ ...@@ -49,9 +49,8 @@
#include "stream.h" #include "stream.h"
#include "conncheck.h" #include "conncheck.h"
/** As specified in ICE spec ID-15 */ #define NICE_AGENT_TIMER_TA_DEFAULT 20 /* timer Ta, msecs (impl. defined) */
#define NICE_AGENT_TIMER_TA_DEFAULT 20 /* timer Ta, msecs */ #define NICE_AGENT_TIMER_TR_DEFAULT 15000 /* timer Tr, msecs (ICE ID-17) */
#define NICE_AGENT_TIMER_TR_DEFAULT 15000 /* timer Tr, msecs */
/** An upper limit to size of STUN packets handled (based on Ethernet /** An upper limit to size of STUN packets handled (based on Ethernet
* MTU and estimated typical sizes of ICE STUN packet */ * MTU and estimated typical sizes of ICE STUN packet */
...@@ -88,8 +87,8 @@ struct _NiceAgent ...@@ -88,8 +87,8 @@ struct _NiceAgent
guint conncheck_timer_id; /**< id of discovery timer */ guint conncheck_timer_id; /**< id of discovery timer */
NiceCheckListState conncheck_state; /**< checklist state */ NiceCheckListState conncheck_state; /**< checklist state */
guint keepalive_timer_id; /**< id of keepalive timer */ guint keepalive_timer_id; /**< id of keepalive timer */
guint64 tie_breaker; /**< tie breaker (ICE ID-16 sect guint64 tie_breaker; /**< tie breaker (ICE sect 5.2
5.2) */ "Determining Role" ID-17) */
gchar ufragtmp[NICE_STREAM_MAX_UNAME]; /**< preallocated buffer for uname processing */ gchar ufragtmp[NICE_STREAM_MAX_UNAME]; /**< preallocated buffer for uname processing */
/* XXX: add pointer to internal data struct for ABI-safe extensions */ /* XXX: add pointer to internal data struct for ABI-safe extensions */
}; };
......
...@@ -48,10 +48,10 @@ ...@@ -48,10 +48,10 @@
#include "agent.h" #include "agent.h"
#include "component.h" #include "component.h"
/* (ICE-13 §4.1.1) Every candidate is a transport address. It also has a type and /* (ICE 4.1.1 "Gathering Candidates") ""Every candidate is a transport
* a base. Three types are defined and gathered by this specification - host * address. It also has a type and a base. Three types are defined and
* candidates, server reflexive candidates, and relayed candidates. */ * gathered by this specification - host candidates, server reflexive
* candidates, and relayed candidates."" (ID-17) */
NICEAPI_EXPORT NiceCandidate * NICEAPI_EXPORT NiceCandidate *
nice_candidate_new (NiceCandidateType type) nice_candidate_new (NiceCandidateType type)
...@@ -95,7 +95,10 @@ nice_candidate_jingle_priority (NiceCandidate *candidate) ...@@ -95,7 +95,10 @@ nice_candidate_jingle_priority (NiceCandidate *candidate)
} }
/* ICE-15 §4.1.2.1; returns number between 1 and 0x7effffff */ /**
* ICE 4.1.2.1. "Recommended Formula" (ID-17):
* returns number between 1 and 0x7effffff
*/
G_GNUC_CONST G_GNUC_CONST
NICEAPI_EXPORT guint32 NICEAPI_EXPORT guint32
nice_candidate_ice_priority_full ( nice_candidate_ice_priority_full (
...@@ -136,7 +139,8 @@ nice_candidate_ice_priority (const NiceCandidate *candidate) ...@@ -136,7 +139,8 @@ nice_candidate_ice_priority (const NiceCandidate *candidate)
} }
/** /**
* Calculates the pair priority as specified in ICE -15 spec 5.7.2. * Calculates the pair priority as specified in ICE
* sect 5.7.2. "Computing Pair Priority and Ordering Pairs" (ID-17).
*/ */
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)
......
...@@ -46,10 +46,10 @@ ...@@ -46,10 +46,10 @@
G_BEGIN_DECLS G_BEGIN_DECLS
/* (ICE-16 §4.1.1.1) For RTP-based media streams, the RTP itself has a component /* (ICE §4.1.1.1, ID-17) ""For RTP-based media streams, the RTP itself has a component
* ID of 1, and RTCP a component ID of 2. If an agent is using RTCP it MUST * ID of 1, and RTCP a component ID of 2. If an agent is using RTCP it MUST
* obtain a candidate for it. If an agent is using both RTP and RTCP, it * obtain a candidate for it. If an agent is using both RTP and RTCP, it
* would end up with 2*K host candidates if an agent has K interfaces. * would end up with 2*K host candidates if an agent has K interfaces.""
*/ */
typedef struct _Component Component; typedef struct _Component Component;
...@@ -72,7 +72,7 @@ struct _Component ...@@ -72,7 +72,7 @@ struct _Component
GSList *sockets; /**< list of NiceUDPSocket objs */ GSList *sockets; /**< list of NiceUDPSocket objs */
GSList *gsources; /**< list of GSource objs */ GSList *gsources; /**< list of GSource objs */
CandidatePair selected_pair; /**< independent from checklists, CandidatePair selected_pair; /**< independent from checklists,
see ICE 11.1.1 (ID-15) */ see ICE 11.1. "Sending Media" (ID-17) */
gboolean media_after_tick; /**< true if media received since last gboolean media_after_tick; /**< true if media received since last
keepalive tick */ keepalive tick */
}; };
......
...@@ -374,7 +374,7 @@ static gboolean priv_conn_keepalive_tick (gpointer pointer) ...@@ -374,7 +374,7 @@ static gboolean priv_conn_keepalive_tick (gpointer pointer)
g_debug ("%s", G_STRFUNC); g_debug ("%s", G_STRFUNC);
/* case 1: session established and media flowing /* case 1: session established and media flowing
* (ref ICE sect 10 ID-16) */ * (ref ICE sect 10 "Keepalives" ID-17) */
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 ID-15) */ * (ref ICE sect 4.1.1.5 "Keeping Candidates Alive" ID-17) */
if (agent->conncheck_state == NICE_CHECKLIST_RUNNING) { if (agent->conncheck_state == NICE_CHECKLIST_RUNNING) {
for (i = agent->conncheck_list; i ; i = i->next) { for (i = agent->conncheck_list; i ; i = i->next) {
CandidateCheckPair *p = i->data; CandidateCheckPair *p = i->data;
...@@ -510,7 +510,8 @@ static gboolean priv_add_new_check_pair (NiceAgent *agent, guint stream_id, Comp ...@@ -510,7 +510,8 @@ 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 sect 5.7.1 of ICE -15 spec. * Implements the logic described in ICE sect 5.7.1. "Forming Candidate
* Pairs" (ID-17).
* *
* @param agent context * @param agent context
* @param component pointer to the component * @param component pointer to the component
...@@ -534,7 +535,7 @@ int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, Component * ...@@ -534,7 +535,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 ID-15) */ * a srv-reflexive (ICE 5.7.3. "Pruning the Pairs" ID-17) */
if (local->type == NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE) if (local->type == NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE)
continue; continue;
...@@ -751,8 +752,9 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair) ...@@ -751,8 +752,9 @@ 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 ICE ID-15 8.2 * Implements parts of the algorithm described in
* that apply to the whole check list. * ICE sect 8.1.2. "Updating States" (ID-17) that apply
* 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)
{ {
...@@ -793,8 +795,8 @@ static void priv_update_check_list_state (NiceAgent *agent, Stream *stream) ...@@ -793,8 +795,8 @@ static void priv_update_check_list_state (NiceAgent *agent, Stream *stream)
} }
/** /**
* Implemented the pruning steps described in ICE sect 8.1.2 (ID-16) * Implemented the pruning steps described in ICE sect 8.1.2
* after a pair has been nominated. * "Updating States" (ID-17) after a pair has been nominated.
* *
* @see priv_update_check_list_state_for_component() * @see priv_update_check_list_state_for_component()
*/ */
...@@ -810,7 +812,7 @@ static void priv_prune_pending_checks (NiceAgent *agent, guint component_id) ...@@ -810,7 +812,7 @@ static void priv_prune_pending_checks (NiceAgent *agent, guint component_id)
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 ID-15: */ /* note: a SHOULD level req. in ICE 8.1.2. "Updating States" (ID-17) */
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),
...@@ -824,10 +826,11 @@ static void priv_prune_pending_checks (NiceAgent *agent, guint component_id) ...@@ -824,10 +826,11 @@ static void priv_prune_pending_checks (NiceAgent *agent, guint component_id)
/** /**
* 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 (ID-16) * Implements the algorithm described in ICE sect 8.1.2
* as it applies to checks of a certain component. If any * "Updating States" (ID-17) as it applies to checks of
* there are any nominated pairs, ICE processing may be * a certain component. If any there are any nominated pairs,
* concluded, and component state is changed to READY. * ICE processing may be concluded, and component state is
* changed to READY.
*/ */
static void priv_update_check_list_state_for_component (NiceAgent *agent, Stream *stream, Component *component) static void priv_update_check_list_state_for_component (NiceAgent *agent, Stream *stream, Component *component)
{ {
...@@ -862,7 +865,7 @@ static void priv_update_check_list_state_for_component (NiceAgent *agent, Stream ...@@ -862,7 +865,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 (ID-15). * ICE sect 11.1.1. "Procedures for Full Implementations" (ID-17).
*/ */
static gboolean priv_update_selected_pair (NiceAgent *agent, Component *component, CandidateCheckPair *pair) static gboolean priv_update_selected_pair (NiceAgent *agent, Component *component, CandidateCheckPair *pair)
{ {
...@@ -883,7 +886,7 @@ static gboolean priv_update_selected_pair (NiceAgent *agent, Component *componen ...@@ -883,7 +886,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 (ID-16). * connectivity check. Implements ICE sect 7.2.1.4 "Triggered Checks" (ID-17).
* *
* @param agent self pointer * @param agent self pointer
* @param component the check is related to * @param component the check is related to
...@@ -908,8 +911,8 @@ static gboolean priv_schedule_triggered_check (NiceAgent *agent, Stream *stream, ...@@ -908,8 +911,8 @@ 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 (ID-16), we should cancel /* XXX: according to ICE 7.2.1.4 "Triggered Checks" (ID-17),
* 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..");
} }
else if (p->state == NICE_CHECK_SUCCEEDED || else if (p->state == NICE_CHECK_SUCCEEDED ||
...@@ -1048,7 +1051,7 @@ static CandidateCheckPair *priv_add_peer_reflexive_pair (NiceAgent *agent, guint ...@@ -1048,7 +1051,7 @@ static CandidateCheckPair *priv_add_peer_reflexive_pair (NiceAgent *agent, guint
/** /**
* 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-16). * section 7.1.2 "Processing the Response" of ICE spec (ID-17).
* *
* @return TRUE if a matching transaction is found * @return TRUE if a matching transaction is found
*/ */
...@@ -1078,7 +1081,8 @@ static gboolean priv_map_reply_to_conn_check_request (NiceAgent *agent, Stream * ...@@ -1078,7 +1081,8 @@ 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 in ICE ID-16) */ * not match any local candidate, see 7.1.2.2.1
* "Discovering Peer Reflexive Candidates" ICE ID-17) */
{ {
NiceAddress mapped; NiceAddress mapped;
GSList *j; GSList *j;
...@@ -1111,7 +1115,8 @@ static gboolean priv_map_reply_to_conn_check_request (NiceAgent *agent, Stream * ...@@ -1111,7 +1115,8 @@ 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 ID-16) */ /* step: add a new discovered pair (see ICE 7.1.2.2.2
"Constructing a Valid Pair" (ID-17)) */
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;
...@@ -1127,11 +1132,13 @@ static gboolean priv_map_reply_to_conn_check_request (NiceAgent *agent, Stream * ...@@ -1127,11 +1132,13 @@ static gboolean priv_map_reply_to_conn_check_request (NiceAgent *agent, Stream *
NICE_COMPONENT_STATE_CONNECTED); NICE_COMPONENT_STATE_CONNECTED);
/* step: updating nominated flag (ICE 7.1.2.2.4, ID-16 */ /* step: updating nominated flag (ICE 7.1.2.2.4 "Updating the
Nominated Flag" (ID-17) */
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 and 8.1.2, ID-16) */ /* step: update pair states (ICE 7.1.2.2.3 "Updating pair
states" and 8.1.2 "Updating States", ID-17) */
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;
...@@ -1276,7 +1283,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, Compo ...@@ -1276,7 +1283,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, Compo
g_debug ("inbound STUN packet for stream/component %u/%u:", stream->id, component->id); g_debug ("inbound STUN packet for stream/component %u/%u:", stream->id, component->id);
/* note: ICE ID-16, 7.2 */ /* note: ICE 7.2. "STUN Server Procedures" (ID-17) */
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);
......
...@@ -136,7 +136,8 @@ gboolean discovery_prune_stream (NiceAgent *agent, guint stream_id) ...@@ -136,7 +136,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 (ID-16). * defined in ICE spec section 4.1.1.3 "Eliminating Redundant
* Candidates" (ID-17).
*/ */
static gboolean priv_add_local_candidate_pruned (Component *component, NiceCandidate *candidate) static gboolean priv_add_local_candidate_pruned (Component *component, NiceCandidate *candidate)
{ {
...@@ -169,8 +170,8 @@ static gboolean priv_add_local_candidate_pruned (Component *component, NiceCandi ...@@ -169,8 +170,8 @@ 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 (ID-16) sect * Implements the mechanism described in ICE sect
* 4.1.1.4 (Computing Foundations). * 4.1.1.4 "Computing Foundations" (ID-17).
*/ */
static void priv_assign_foundation (NiceAgent *agent, Component *component, NiceCandidate *candidate) static void priv_assign_foundation (NiceAgent *agent, Component *component, NiceCandidate *candidate)
{ {
...@@ -390,7 +391,7 @@ static guint priv_highest_remote_foundation (Component *component) ...@@ -390,7 +391,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 ID-16 sect 7.2.1.3. * See ICE sect 7.2.1.3 "Learning Peer Reflexive Candidates" (ID-17).
* *
* @return pointer to the created candidate, or NULL on error * @return pointer to the created candidate, or NULL on error
*/ */
......
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