2 * This file is part of the Nice GLib ICE library.
4 * (C) 2008-2009 Collabora Ltd.
5 * Contact: Youness Alaoui
6 * (C) 2007-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 * Youness Alaoui, Collabora Ltd.
28 * Alternatively, the contents of this file may be used under the terms of the
29 * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
30 * case the provisions of LGPL are applicable instead of those above. If you
31 * wish to allow use of your version of this file only under the terms of the
32 * LGPL and not to allow others to use your version of this file under the
33 * MPL, indicate your decision by deleting the provisions above and replace
34 * them with the notice and other provisions required by the LGPL. If you do
35 * not delete the provisions above, a recipient may use your version of this
36 * file under either the MPL or the LGPL.
39 #ifndef _NICE_DISCOVERY_H
40 #define _NICE_DISCOVERY_H
42 /* note: this is a private header to libnice */
49 NiceCandidateType type; /* candidate type STUN or TURN */
50 NiceSocket *nicesock; /* XXX: should be taken from local cand: existing socket to use */
51 NiceAddress server; /* STUN/TURN server address */
52 gint64 next_tick; /* next tick timestamp */
53 gboolean pending; /* is discovery in progress? */
54 gboolean done; /* is discovery complete? */
60 uint8_t stun_buffer[STUN_MAX_MESSAGE_SIZE_IPV6];
61 StunMessage stun_message;
62 uint8_t stun_resp_buffer[STUN_MAX_MESSAGE_SIZE];
63 StunMessage stun_resp_msg;
68 NiceSocket *nicesock; /* existing socket to use */
69 NiceAddress server; /* STUN/TURN server address */
70 NiceCandidate *candidate; /* candidate to refresh */
74 GSource *timer_source;
77 uint8_t stun_buffer[STUN_MAX_MESSAGE_SIZE_IPV6];
78 StunMessage stun_message;
79 uint8_t stun_resp_buffer[STUN_MAX_MESSAGE_SIZE];
80 StunMessage stun_resp_msg;
83 GDestroyNotify destroy_cb;
84 gpointer destroy_cb_data;
85 GSource *destroy_source;
88 void refresh_free (NiceAgent *agent, CandidateRefresh *refresh);
89 void refresh_prune_agent_async (NiceAgent *agent,
90 NiceTimeoutLockedCallback function, gpointer user_data);
91 void refresh_prune_stream_async (NiceAgent *agent, NiceStream *stream,
92 NiceTimeoutLockedCallback function);
93 void refresh_prune_candidate (NiceAgent *agent, NiceCandidate *candidate);
94 void refresh_prune_candidate_async (NiceAgent *agent, NiceCandidate *candidate,
95 NiceTimeoutLockedCallback function);
98 void discovery_free (NiceAgent *agent);
99 void discovery_prune_stream (NiceAgent *agent, guint stream_id);
100 void discovery_prune_socket (NiceAgent *agent, NiceSocket *sock);
101 void discovery_schedule (NiceAgent *agent);
104 HOST_CANDIDATE_SUCCESS,
105 HOST_CANDIDATE_FAILED,
106 HOST_CANDIDATE_CANT_CREATE_SOCKET,
107 HOST_CANDIDATE_REDUNDANT,
108 HOST_CANDIDATE_DUPLICATE_PORT
109 } HostCandidateResult;
112 discovery_add_local_host_candidate (
116 NiceAddress *address,
117 NiceCandidateTransport transport,
118 NiceCandidate **candidate);
121 discovery_add_relay_candidate (
125 NiceAddress *address,
126 NiceCandidateTransport transport,
127 NiceSocket *base_socket,
131 discovery_add_server_reflexive_candidate (
135 NiceAddress *address,
136 NiceCandidateTransport transport,
137 NiceSocket *base_socket,
138 gboolean nat_assisted);
141 discovery_discover_tcp_server_reflexive_candidates (
145 NiceAddress *address,
146 NiceSocket *base_socket);
149 discovery_add_peer_reflexive_candidate (
154 NiceAddress *address,
155 NiceSocket *base_socket,
156 NiceCandidate *local,
157 NiceCandidate *remote);
160 discovery_learn_remote_peer_reflexive_candidate (
163 NiceComponent *component,
165 const NiceAddress *remote_address,
166 NiceSocket *udp_socket,
167 NiceCandidate *local,
168 NiceCandidate *remote);
170 #endif /*_NICE_CONNCHECK_H */