Add win32 directory to EXTRA_DIST
[sipe-libnice.git] / agent / conncheck.h
blob431bb555e6fcc2b7ec1f276a7b8634b0ca327a6f
1 /*
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
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 * Dafydd Harries, Collabora Ltd.
26 * Youness Alaoui, Collabora Ltd.
27 * Kai Vehmanen, Nokia
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.
40 #ifndef _NICE_CONNCHECK_H
41 #define _NICE_CONNCHECK_H
43 /* note: this is a private header to libnice */
45 #include "agent.h"
46 #include "stream.h"
47 #include "stun/stunagent.h"
48 #include "stun/usages/timer.h"
50 #define NICE_CANDIDATE_PAIR_MAX_FOUNDATION NICE_CANDIDATE_MAX_FOUNDATION*2
52 typedef enum
54 NICE_CHECK_WAITING = 1, /**< waiting to be scheduled */
55 NICE_CHECK_IN_PROGRESS, /**< conn. checks started */
56 NICE_CHECK_SUCCEEDED, /**< conn. succesfully checked */
57 NICE_CHECK_FAILED, /**< no connectivity, retransmissions ceased */
58 NICE_CHECK_FROZEN, /**< waiting to be scheduled to WAITING */
59 NICE_CHECK_CANCELLED, /**< check cancelled */
60 NICE_CHECK_DISCOVERED /**< a valid candidate pair not on check list */
61 } NiceCheckState;
63 typedef struct _CandidateCheckPair CandidateCheckPair;
65 struct _CandidateCheckPair
67 NiceAgent *agent; /* back pointer to owner */
68 guint stream_id;
69 guint component_id;
70 NiceCandidate *local;
71 NiceCandidate *remote;
72 gchar foundation[NICE_CANDIDATE_PAIR_MAX_FOUNDATION];
73 NiceCheckState state;
74 gboolean nominated;
75 gboolean controlling;
76 gboolean timer_restarted;
77 guint64 priority;
78 GTimeVal next_tick; /* next tick timestamp */
79 StunTimer timer;
80 uint8_t stun_buffer[STUN_MAX_MESSAGE_SIZE];
81 StunMessage stun_message;
84 int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, Component *component, NiceCandidate *remote);
85 int conn_check_add_for_local_candidate (NiceAgent *agent, guint stream_id, Component *component, NiceCandidate *local);
86 void conn_check_free_item (gpointer data, gpointer user_data);
87 void conn_check_free (NiceAgent *agent);
88 gboolean conn_check_schedule_next (NiceAgent *agent);
89 int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair);
90 gboolean conn_check_prune_stream (NiceAgent *agent, Stream *stream);
91 gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, Component *component, NiceSocket *udp_socket, const NiceAddress *from, gchar *buf, guint len);
92 gint conn_check_compare (const CandidateCheckPair *a, const CandidateCheckPair *b);
93 void conn_check_remote_candidates_set(NiceAgent *agent);
95 #endif /*_NICE_CONNCHECK_H */