2 * This file is part of the Nice GLib ICE library.
4 * (C) 2006-2010 Collabora Ltd.
5 * Contact: Youness Alaoui
6 * (C) 2006-2010 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_COMPONENT_H
41 #define _NICE_COMPONENT_H
45 typedef struct _Component Component
;
48 #include "candidate.h"
49 #include "stun/stunagent.h"
50 #include "stun/usages/timer.h"
51 #include "pseudotcp.h"
58 /* (ICE ยง4.1.1.1, ID-19)
59 * ""For RTP-based media streams, the RTP itself has a component
60 * ID of 1, and RTCP a component ID of 2. If an agent is using RTCP it MUST
61 * obtain a candidate for it. If an agent is using both RTP and RTCP, it
62 * would end up with 2*K host candidates if an agent has K interfaces.""
65 typedef struct _CandidatePair CandidatePair
;
66 typedef struct _CandidatePairKeepalive CandidatePairKeepalive
;
67 typedef struct _IncomingCheck IncomingCheck
;
69 struct _CandidatePairKeepalive
76 uint8_t stun_buffer
[STUN_MAX_MESSAGE_SIZE
];
77 StunMessage stun_message
;
83 NiceCandidate
*remote
;
84 guint64 priority
; /**< candidate pair priority */
85 CandidatePairKeepalive keepalive
;
91 NiceSocket
*local_socket
;
93 gboolean use_candidate
;
95 uint16_t username_len
;
101 Component
*component
;
106 NiceComponentType type
;
107 guint id
; /**< component id */
108 NiceComponentState state
;
109 GSList
*local_candidates
; /**< list of Candidate objs */
110 GSList
*remote_candidates
; /**< list of Candidate objs */
111 GSList
*sockets
; /**< list of NiceSocket objs */
112 GSList
*gsources
; /**< list of GSource objs */
113 GSList
*incoming_checks
; /**< list of IncomingCheck objs */
114 GList
*turn_servers
; /**< List of TURN servers */
115 CandidatePair selected_pair
; /**< independent from checklists,
116 see ICE 11.1. "Sending Media" (ID-19) */
117 NiceCandidate
*restart_candidate
; /**< for storing active remote candidate during a restart */
118 NiceAgentRecvFunc g_source_io_cb
; /**< function called on io cb */
119 gpointer data
; /**< data passed to the io function */
120 GMainContext
*ctx
; /**< context for data callbacks for this
122 PseudoTcpSocket
*tcp
;
124 TcpUserData
*tcp_data
;
125 gboolean tcp_readable
;
131 component_new (guint component_id
);
134 component_free (Component
*cmp
);
137 component_find_pair (Component
*cmp
, NiceAgent
*agent
, const gchar
*lfoundation
, const gchar
*rfoundation
, CandidatePair
*pair
);
140 component_restart (Component
*cmp
);
143 component_update_selected_pair (Component
*component
, const CandidatePair
*pair
);
146 component_find_remote_candidate (const Component
*component
, const NiceAddress
*addr
, NiceCandidateTransport transport
);
149 component_set_selected_remote_candidate (NiceAgent
*agent
, Component
*component
,
150 NiceCandidate
*candidate
);
154 #endif /* _NICE_COMPONENT_H */