version 0.0.11.1
[sipe-libnice.git] / agent / discovery.h
blob209fa95787d32fa799b540cfd236d8d410fd4a27
1 /*
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
17 * License.
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.
24 * Contributors:
25 * Youness Alaoui, Collabora Ltd.
26 * Kai Vehmanen, Nokia
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 */
44 #include "stream.h"
45 #include "agent.h"
47 typedef struct
49 NiceAgent *agent; /**< back pointer to owner */
50 NiceCandidateType type; /**< candidate type STUN or TURN */
51 NiceSocket *nicesock; /**< XXX: should be taken from local cand: existing socket to use */
52 NiceAddress server; /**< STUN/TURN server address */
53 GTimeVal next_tick; /**< next tick timestamp */
54 gboolean pending; /**< is discovery in progress? */
55 gboolean done; /**< is discovery complete? */
56 Stream *stream;
57 Component *component;
58 TurnServer *turn;
59 StunAgent stun_agent;
60 uint8_t *msn_turn_username;
61 uint8_t *msn_turn_password;
62 StunTimer timer;
63 uint8_t stun_buffer[STUN_MAX_MESSAGE_SIZE];
64 StunMessage stun_message;
65 uint8_t stun_resp_buffer[STUN_MAX_MESSAGE_SIZE];
66 StunMessage stun_resp_msg;
67 } CandidateDiscovery;
69 typedef struct
71 NiceAgent *agent; /**< back pointer to owner */
72 NiceSocket *nicesock; /**< existing socket to use */
73 NiceSocket *relay_socket; /**< relay socket from which we receive */
74 NiceAddress server; /**< STUN/TURN server address */
75 Stream *stream;
76 Component *component;
77 TurnServer *turn;
78 StunAgent stun_agent;
79 GSource *timer_source;
80 GSource *tick_source;
81 uint8_t *msn_turn_username;
82 uint8_t *msn_turn_password;
83 StunTimer timer;
84 uint8_t stun_buffer[STUN_MAX_MESSAGE_SIZE];
85 StunMessage stun_message;
86 uint8_t stun_resp_buffer[STUN_MAX_MESSAGE_SIZE];
87 StunMessage stun_resp_msg;
88 } CandidateRefresh;
90 void refresh_free_item (gpointer data, gpointer user_data);
91 void refresh_free (NiceAgent *agent);
92 void refresh_prune_stream (NiceAgent *agent, guint stream_id);
93 void refresh_cancel (CandidateRefresh *refresh);
96 void discovery_free_item (gpointer data, gpointer user_data);
97 void discovery_free (NiceAgent *agent);
98 void discovery_prune_stream (NiceAgent *agent, guint stream_id);
99 void discovery_schedule (NiceAgent *agent);
101 NiceCandidate *
102 discovery_add_local_host_candidate (
103 NiceAgent *agent,
104 guint stream_id,
105 guint component_id,
106 NiceAddress *address);
108 NiceCandidate*
109 discovery_add_relay_candidate (
110 NiceAgent *agent,
111 guint stream_id,
112 guint component_id,
113 NiceAddress *address,
114 NiceSocket *base_socket,
115 TurnServer *turn);
117 NiceCandidate*
118 discovery_add_server_reflexive_candidate (
119 NiceAgent *agent,
120 guint stream_id,
121 guint component_id,
122 NiceAddress *address,
123 NiceSocket *base_socket);
125 NiceCandidate*
126 discovery_add_peer_reflexive_candidate (
127 NiceAgent *agent,
128 guint stream_id,
129 guint component_id,
130 NiceAddress *address,
131 NiceSocket *base_socket,
132 NiceCandidate *local,
133 NiceCandidate *remote);
135 NiceCandidate *
136 discovery_learn_remote_peer_reflexive_candidate (
137 NiceAgent *agent,
138 Stream *stream,
139 Component *component,
140 guint32 priority,
141 const NiceAddress *remote_address,
142 NiceSocket *udp_socket,
143 NiceCandidate *local,
144 NiceCandidate *remote);
146 #endif /*_NICE_CONNCHECK_H */