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.
40 #ifndef _NICE_AGENT_PRIV_H
41 #define _NICE_AGENT_PRIV_H
43 /* note: this is a private header part of agent.h */
49 #define NICEAPI_EXPORT
56 #include "candidate.h"
58 #include "conncheck.h"
59 #include "component.h"
60 #include "stun/stunagent.h"
61 #include "stun/usages/turn.h"
62 #include "stun/usages/ice.h"
65 #include <libgupnp-igd/gupnp-simple-igd-thread.h>
68 /* XXX: starting from ICE ID-18, Ta SHOULD now be set according
69 * to session bandwidth -> this is not yet implemented in NICE */
71 #define NICE_AGENT_TIMER_TA_DEFAULT 20 /* timer Ta, msecs (impl. defined) */
72 #define NICE_AGENT_TIMER_TR_DEFAULT 25000 /* timer Tr, msecs (impl. defined) */
73 #define NICE_AGENT_TIMER_TR_MIN 15000 /* timer Tr, msecs (ICE ID-19) */
74 #define NICE_AGENT_MAX_CONNECTIVITY_CHECKS_DEFAULT 100 /* see spec 5.7.3 (ID-19) */
77 /* An upper limit to size of STUN packets handled (based on Ethernet
78 * MTU and estimated typical sizes of ICE STUN packet */
79 #define MAX_STUN_DATAGRAM_PAYLOAD 1300
83 GObject parent
; /* gobject pointer */
85 gboolean full_mode
; /* property: full-mode */
86 GTimeVal next_check_tv
; /* property: next conncheck timestamp */
87 gchar
*stun_server_ip
; /* property: STUN server IP */
88 guint stun_server_port
; /* property: STUN server port */
89 gchar
*proxy_ip
; /* property: Proxy server IP */
90 guint proxy_port
; /* property: Proxy server port */
91 NiceProxyType proxy_type
; /* property: Proxy type */
92 gchar
*proxy_username
; /* property: Proxy username */
93 gchar
*proxy_password
; /* property: Proxy password */
94 gboolean controlling_mode
; /* property: controlling-mode */
95 guint timer_ta
; /* property: timer Ta */
96 guint max_conn_checks
; /* property: max connectivity checks */
98 GSList
*local_addresses
; /* list of NiceAddresses for local
100 GSList
*streams
; /* list of Stream objects */
101 GMainContext
*main_context
; /* main context pointer */
102 guint next_candidate_id
; /* id of next created candidate */
103 guint next_stream_id
; /* id of next created candidate */
104 NiceRNG
*rng
; /* random number generator */
105 GSList
*discovery_list
; /* list of CandidateDiscovery items */
106 guint discovery_unsched_items
; /* number of discovery items unscheduled */
107 GSource
*discovery_timer_source
; /* source of discovery timer */
108 GSource
*conncheck_timer_source
; /* source of conncheck timer */
109 GSource
*keepalive_timer_source
; /* source of keepalive timer */
110 GSList
*refresh_list
; /* list of CandidateRefresh items */
111 guint64 tie_breaker
; /* tie breaker (ICE sect 5.2
112 "Determining Role" ID-19) */
113 NiceCompatibility compatibility
; /* property: Compatibility mode */
114 StunAgent stun_agent
; /* STUN agent */
115 gboolean media_after_tick
; /* Received media after keepalive tick */
117 GUPnPSimpleIgdThread
* upnp
; /* GUPnP Single IGD agent */
118 gboolean upnp_enabled
; /* whether UPnP discovery is enabled */
119 guint upnp_timeout
; /* UPnP discovery timeout */
120 GSList
*upnp_mapping
; /* list of Candidates being mapped */
121 GSource
*upnp_timer_source
; /* source of upnp timeout timer */
123 gchar
*software_attribute
; /* SOFTWARE attribute */
124 gboolean reliable
; /* property: reliable */
125 /* XXX: add pointer to internal data struct for ABI-safe extensions */
129 agent_find_component (
134 Component
**component
);
136 Stream
*agent_find_stream (NiceAgent
*agent
, guint stream_id
);
138 void agent_gathering_done (NiceAgent
*agent
);
139 void agent_signal_gathering_done (NiceAgent
*agent
);
141 void agent_lock (void);
142 void agent_unlock (void);
144 void agent_signal_new_selected_pair (
148 const gchar
*local_foundation
,
149 const gchar
*remote_foundation
);
151 void agent_signal_component_state_change (
155 NiceComponentState state
);
157 void agent_signal_new_candidate (
159 NiceCandidate
*candidate
);
161 void agent_signal_new_remote_candidate (NiceAgent
*agent
, NiceCandidate
*candidate
);
163 void agent_signal_initial_binding_request_received (NiceAgent
*agent
, Stream
*stream
);
165 guint64
agent_candidate_pair_priority (NiceAgent
*agent
, NiceCandidate
*local
, NiceCandidate
*remote
);
167 GSource
*agent_timeout_add_with_context (NiceAgent
*agent
, guint interval
, GSourceFunc function
, gpointer data
);
169 void agent_attach_stream_component_socket (NiceAgent
*agent
,
171 Component
*component
,
174 StunUsageIceCompatibility
agent_to_ice_compatibility (NiceAgent
*agent
);
175 StunUsageTurnCompatibility
agent_to_turn_compatibility (NiceAgent
*agent
);
176 NiceTurnSocketCompatibility
agent_to_turn_socket_compatibility (NiceAgent
*agent
);
178 void _priv_set_socket_tos (NiceAgent
*agent
, NiceSocket
*sock
, gint tos
);
180 #endif /*_NICE_AGENT_PRIV_H */