Updated doc to match code
[sipe-libnice.git] / agent / conncheck.h
blob17491d761df2fc36641158c8b759a59db9d53fb7
1 /*
2 * This file is part of the Nice GLib ICE library.
4 * (C) 2006, 2007 Collabora Ltd.
5 * Contact: Dafydd Harries
6 * (C) 2006, 2007 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 * 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_CONNCHECK_H
40 #define _NICE_CONNCHECK_H
42 /* note: this is a private header to libnice */
44 #include "agent.h"
45 #include "stream.h"
46 #include "stun/stunagent.h"
47 #include "stun/usages/timer.h"
49 #define NICE_CANDIDATE_PAIR_MAX_FOUNDATION NICE_CANDIDATE_MAX_FOUNDATION*2
51 typedef enum
53 NICE_CHECK_WAITING = 1, /**< waiting to be scheduled */
54 NICE_CHECK_IN_PROGRESS, /**< conn. checks started */
55 NICE_CHECK_SUCCEEDED, /**< conn. succesfully checked */
56 NICE_CHECK_FAILED, /**< no connectivity, retransmissions ceased */
57 NICE_CHECK_FROZEN, /**< waiting to be scheduled to WAITING */
58 NICE_CHECK_CANCELLED, /**< check cancelled */
59 NICE_CHECK_DISCOVERED /**< a valid candidate pair not on check list */
60 } NiceCheckState;
62 typedef struct _CandidateCheckPair CandidateCheckPair;
64 struct _CandidateCheckPair
66 NiceAgent *agent; /* back pointer to owner */
67 guint stream_id;
68 guint component_id;
69 NiceCandidate *local;
70 NiceCandidate *remote;
71 gchar foundation[NICE_CANDIDATE_PAIR_MAX_FOUNDATION];
72 NiceCheckState state;
73 gboolean nominated;
74 gboolean controlling;
75 guint64 priority;
76 GTimeVal next_tick; /* next tick timestamp */
77 gboolean traffic_after_tick;
78 stun_timer_t timer;
79 uint8_t stun_buffer[STUN_MAX_MESSAGE_SIZE];
80 StunMessage stun_message;
83 int conn_check_add_for_candidate (NiceAgent *agent, guint stream_id, Component *component, NiceCandidate *remote);
84 void conn_check_free_item (gpointer data, gpointer user_data);
85 void conn_check_free (NiceAgent *agent);
86 gboolean conn_check_schedule_next (NiceAgent *agent);
87 int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair);
88 gboolean conn_check_prune_stream (NiceAgent *agent, Stream *stream);
89 gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, Component *component, NiceUDPSocket *udp_socket, const NiceAddress *from, gchar *buf, guint len);
90 gint conn_check_compare (const CandidateCheckPair *a, const CandidateCheckPair *b);
91 void conn_check_remote_candidates_set(NiceAgent *agent);
93 #endif /*_NICE_CONNCHECK_H */