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
05bad78d
Commit
05bad78d
authored
Jul 17, 2007
by
Kai Vehmanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update references to ICE ID-17.
darcs-hash:20070717181000-77cd4-c07e724f0cc8a2f4bdadf179b1bd908f16fb3452.gz
parent
61f4fe02
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
41 deletions
+52
-41
agent/agent-priv.h
agent/agent-priv.h
+4
-5
agent/candidate.c
agent/candidate.c
+10
-6
agent/component.h
agent/component.h
+3
-3
agent/conncheck.c
agent/conncheck.c
+30
-23
agent/discovery.c
agent/discovery.c
+5
-4
No files found.
agent/agent-priv.h
View file @
05bad78d
...
...
@@ -49,9 +49,8 @@
#include "stream.h"
#include "conncheck.h"
/** As specified in ICE spec ID-15 */
#define NICE_AGENT_TIMER_TA_DEFAULT 20
/* timer Ta, msecs */
#define NICE_AGENT_TIMER_TR_DEFAULT 15000
/* timer Tr, msecs */
#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) */
/** An upper limit to size of STUN packets handled (based on Ethernet
* MTU and estimated typical sizes of ICE STUN packet */
...
...
@@ -88,8 +87,8 @@ struct _NiceAgent
guint
conncheck_timer_id
;
/**< id of discovery timer */
NiceCheckListState
conncheck_state
;
/**< checklist state */
guint
keepalive_timer_id
;
/**< id of keepalive timer */
guint64
tie_breaker
;
/**< tie breaker (ICE
ID-16 sect
5.2
) */
guint64
tie_breaker
;
/**< tie breaker (ICE
sect 5.2
"Determining Role" ID-17
) */
gchar
ufragtmp
[
NICE_STREAM_MAX_UNAME
];
/**< preallocated buffer for uname processing */
/* XXX: add pointer to internal data struct for ABI-safe extensions */
};
...
...
agent/candidate.c
View file @
05bad78d
...
...
@@ -48,10 +48,10 @@
#include "agent.h"
#include "component.h"
/* (ICE
-13 §4.1.1) Every candidate is a transport address. It also has a type and
* a
base. Three types are defined and gathered by this specification - host
*
candidates, server reflexive candidates, and relayed candidates. */
/* (ICE
4.1.1 "Gathering Candidates") ""Every candidate is a transport
* a
ddress. It also has a type and a base. Three types are defined and
*
gathered by this specification - host candidates, server reflexive
* candidates, and relayed candidates."" (ID-17) */
NICEAPI_EXPORT
NiceCandidate
*
nice_candidate_new
(
NiceCandidateType
type
)
...
...
@@ -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
NICEAPI_EXPORT
guint32
nice_candidate_ice_priority_full
(
...
...
@@ -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
nice_candidate_pair_priority
(
guint32
o_prio
,
guint32
a_prio
)
...
...
agent/component.h
View file @
05bad78d
...
...
@@ -46,10 +46,10 @@
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
* 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
;
...
...
@@ -72,7 +72,7 @@ struct _Component
GSList
*
sockets
;
/**< list of NiceUDPSocket objs */
GSList
*
gsources
;
/**< list of GSource objs */
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
keepalive tick */
};
...
...
agent/conncheck.c
View file @
05bad78d
...
...
@@ -374,7 +374,7 @@ static gboolean priv_conn_keepalive_tick (gpointer pointer)
g_debug
(
"%s"
,
G_STRFUNC
);
/* 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
)
{
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
ID-15
) */
* (ref ICE sect 4.1.1.5
"Keeping Candidates Alive" ID-17
) */
if
(
agent
->
conncheck_state
==
NICE_CHECKLIST_RUNNING
)
{
for
(
i
=
agent
->
conncheck_list
;
i
;
i
=
i
->
next
)
{
CandidateCheckPair
*
p
=
i
->
data
;
...
...
@@ -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
* '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 component pointer to the component
...
...
@@ -534,7 +535,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
ID-15
) */
* a srv-reflexive (ICE 5.7.3
. "Pruning the Pairs" ID-17
) */
if
(
local
->
type
==
NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE
)
continue
;
...
...
@@ -751,8 +752,9 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
/**
* Updates the check list state.
*
* Implements parts of the algorithm described in ICE ID-15 8.2
* that apply to the whole check list.
* Implements parts of the algorithm described in
* 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
)
{
...
...
@@ -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)
* after a pair has been nominated.
* Implemented the pruning steps described in ICE sect 8.1.2
*
"Updating States" (ID-17)
after a pair has been nominated.
*
* @see priv_update_check_list_state_for_component()
*/
...
...
@@ -810,7 +812,7 @@ static void priv_prune_pending_checks (NiceAgent *agent, guint component_id)
p
->
state
==
NICE_CHECK_WAITING
)
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
->
stun_ctx
)
stun_bind_cancel
(
p
->
stun_ctx
),
...
...
@@ -824,10 +826,11 @@ static void priv_prune_pending_checks (NiceAgent *agent, guint component_id)
/**
* Updates the check list state for a stream component.
*
* Implements the algorithm described in ICE sect 8.1.2 (ID-16)
* 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.
* Implements the algorithm described in ICE sect 8.1.2
* "Updating States" (ID-17) 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.
*/
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
/**
* 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
(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
)
{
...
...
@@ -883,7 +886,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
(ID-16
).
* connectivity check. Implements ICE sect 7.2.1.4
"Triggered Checks" (ID-17
).
*
* @param agent self pointer
* @param component the check is related to
...
...
@@ -908,8 +911,8 @@ 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
(ID-16), we should cancel
* the existing one, and send a new one...? :P */
/* XXX: according to ICE 7.2.1.4
"Triggered Checks" (ID-17),
*
we should cancel
the existing one, and send a new one...? :P */
g_debug
(
"Skipping triggered check, already in progress.."
);
}
else
if
(
p
->
state
==
NICE_CHECK_SUCCEEDED
||
...
...
@@ -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
* 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
*/
...
...
@@ -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
* 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
;
GSList
*
j
;
...
...
@@ -1111,7 +1115,8 @@ 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 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
);
ok_pair
=
new_pair
;
...
...
@@ -1127,11 +1132,13 @@ static gboolean priv_map_reply_to_conn_check_request (NiceAgent *agent, Stream *
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
)
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
);
trans_found
=
TRUE
;
...
...
@@ -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
);
/* 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
),
stream
->
local_password
,
&
control
,
agent
->
tie_breaker
);
...
...
agent/discovery.c
View file @
05bad78d
...
...
@@ -136,7 +136,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 (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
)
{
...
...
@@ -169,8 +170,8 @@ static gboolean priv_add_local_candidate_pruned (Component *component, NiceCandi
/**
* Assings a foundation to the candidate.
*
* Implements the mechanism described in ICE
(ID-16)
sect
* 4.1.1.4
(Computing Foundations
).
* Implements the mechanism described in ICE sect
* 4.1.1.4
"Computing Foundations" (ID-17
).
*/
static
void
priv_assign_foundation
(
NiceAgent
*
agent
,
Component
*
component
,
NiceCandidate
*
candidate
)
{
...
...
@@ -390,7 +391,7 @@ static guint priv_highest_remote_foundation (Component *component)
* remote candidates. The candidate is however not paired with
* 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
*/
...
...
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