2 * This file is part of the Nice GLib ICE library.
4 * (C) 2006-2009 Collabora Ltd.
5 * Contact: Youness Alaoui
6 * (C) 2006-2009 Nokia Corporation. All rights reserved.
7 * Contact: Kai Vehmanen
9 * The contents of this file are subject to the Mozilla Public License Version
10 * 1.1 (the "License"); you may not use this file except in compliance with
11 * the License. You may obtain a copy of the License at
12 * http://www.mozilla.org/MPL/
14 * Software distributed under the License is distributed on an "AS IS" basis,
15 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
16 * for the specific language governing rights and limitations under the
19 * The Original Code is the Nice GLib ICE library.
21 * The Initial Developers of the Original Code are Collabora Ltd and Nokia
22 * Corporation. All Rights Reserved.
25 * Dafydd Harries, Collabora Ltd.
26 * Youness Alaoui, Collabora Ltd.
29 * Alternatively, the contents of this file may be used under the terms of the
30 * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
31 * case the provisions of LGPL are applicable instead of those above. If you
32 * wish to allow use of your version of this file only under the terms of the
33 * LGPL and not to allow others to use your version of this file under the
34 * MPL, indicate your decision by deleting the provisions above and replace
35 * them with the notice and other provisions required by the LGPL. If you do
36 * not delete the provisions above, a recipient may use your version of this
37 * file under either the MPL or the LGPL.
46 * @short_description: ICE candidate representation
47 * @see_also: #NiceAddress
50 * A representation of an ICE candidate. Make sure you read the ICE drafts[1] to
51 * understand correctly the concept of ICE candidates.
53 * [1] http://tools.ietf.org/wg/mmusic/draft-ietf-mmusic-ice/
60 #define NICE_CANDIDATE_TYPE_PREF_HOST 120
61 #define NICE_CANDIDATE_TYPE_PREF_PEER_REFLEXIVE 110
62 #define NICE_CANDIDATE_TYPE_PREF_SERVER_REFLEXIVE 100
63 #define NICE_CANDIDATE_TYPE_PREF_RELAYED 60
65 /* Max foundation size '1*32ice-char' plus terminating NULL, ICE ID-19 */
67 * NICE_CANDIDATE_MAX_FOUNDATION:
69 * The maximum size a candidate foundation can have.
71 #define NICE_CANDIDATE_MAX_FOUNDATION 32+1
76 * @NICE_CANDIDATE_TYPE_HOST: A host candidate
77 * @NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE: A server reflexive candidate
78 * @NICE_CANDIDATE_TYPE_PEER_REFLEXIVE: A peer reflexive candidate
79 * @NICE_CANDIDATE_TYPE_RELAYED: A relay candidate
81 * An enum represneting the type of a candidate
85 NICE_CANDIDATE_TYPE_HOST
,
86 NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE
,
87 NICE_CANDIDATE_TYPE_PEER_REFLEXIVE
,
88 NICE_CANDIDATE_TYPE_RELAYED
,
92 * NiceCandidateTransport:
93 * @NICE_CANDIDATE_TRANSPORT_UDP: UDP transport
95 * An enum representing the type of transport to use
99 NICE_CANDIDATE_TRANSPORT_UDP
,
100 } NiceCandidateTransport
;
104 * @NICE_RELAY_TYPE_TURN_UDP: A TURN relay using UDP
105 * @NICE_RELAY_TYPE_TURN_TCP: A TURN relay using TCP
106 * @NICE_RELAY_TYPE_TURN_TLS: A TURN relay using TLS over TCP
108 * An enum representing the type of relay to use
111 NICE_RELAY_TYPE_TURN_UDP
,
112 NICE_RELAY_TYPE_TURN_TCP
,
113 NICE_RELAY_TYPE_TURN_TLS
117 typedef struct _NiceCandidate NiceCandidate
;
119 typedef struct _TurnServer TurnServer
;
123 * @server: The #NiceAddress of the TURN server
124 * @username: The TURN username
125 * @password: The TURN password
126 * @type: The #NiceRelayType of the server
128 * A structure to store the TURN relay settings
132 NiceAddress server
; /**< TURN server address */
133 gchar
*username
; /**< TURN username */
134 gchar
*password
; /**< TURN password */
135 NiceRelayType type
; /**< TURN type */
140 * @type: The type of candidate
141 * @transport: The transport being used for the candidate
142 * @addr: The #NiceAddress of the candidate
143 * @base_addr: The #NiceAddress of the base address used by the candidate
144 * @priority: The priority of the candidate <emphasis> see note </emphasis>
145 * @stream_id: The ID of the stream to which belongs the candidate
146 * @component_id: The ID of the component to which belongs the candidate
147 * @foundation: The foundation of the candidate
148 * @username: The candidate-specific username to use (overrides the one set
149 * by nice_agent_set_local_credentials() or nice_agent_set_remote_credentials())
150 * @password: The candidate-specific password to use (overrides the one set
151 * by nice_agent_set_local_credentials() or nice_agent_set_remote_credentials())
152 * @turn: The #TurnServer settings if the candidate is
153 * of type %NICE_CANDIDATE_TYPE_RELAYED
154 * @sockptr: The underlying socket
156 * A structure to represent an ICE candidate
159 The @priority is an integer as specified in the ICE draft 19. If you are
160 using the MSN or the GOOGLE compatibility mode (which are based on ICE
161 draft 6, which uses a floating point qvalue as priority), then the @priority
162 value will represent the qvalue multiplied by 1000.
166 struct _NiceCandidate
168 NiceCandidateType type
;
169 NiceCandidateTransport transport
;
171 NiceAddress base_addr
;
175 gchar foundation
[NICE_CANDIDATE_MAX_FOUNDATION
];
176 gchar
*username
; /* pointer to a NULL-terminated username string */
177 gchar
*password
; /* pointer to a NULL-terminated password string */
183 * nice_candidate_new:
184 * @type: The #NiceCandidateType of the candidate to create
186 * Creates a new candidate. Must be freed with nice_candidate_free()
188 * Returns: A new #NiceCandidate
191 nice_candidate_new (NiceCandidateType type
);
194 * nice_candidate_free:
195 * @candidate: The candidate to free
197 * Frees a #NiceCandidate
200 nice_candidate_free (NiceCandidate
*candidate
);
203 * nice_candidate_copy:
204 * @candidate: The candidate to copy
206 * Makes a copy of a #NiceCandidate
208 * Returns: A new #NiceCandidate, a copy of @candidate
211 nice_candidate_copy (const NiceCandidate
*candidate
);
215 nice_candidate_jingle_priority (NiceCandidate
*candidate
);
218 nice_candidate_msn_priority (NiceCandidate
*candidate
);
221 nice_candidate_ice_priority_full (guint type_pref
, guint local_pref
,
225 nice_candidate_ice_priority (const NiceCandidate
*candidate
);
228 nice_candidate_pair_priority (guint32 o_prio
, guint32 a_prio
);
233 #endif /* _CANDIDATE_H */