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
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.
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_COMPONENT_H
40 #define _NICE_COMPONENT_H
45 #include "candidate.h"
46 #include "stun/stunagent.h"
47 #include "stun/usages/timer.h"
52 /* (ICE ยง4.1.1.1, ID-19) ""For RTP-based media streams, the RTP itself has a component
53 * ID of 1, and RTCP a component ID of 2. If an agent is using RTCP it MUST
54 * obtain a candidate for it. If an agent is using both RTP and RTCP, it
55 * would end up with 2*K host candidates if an agent has K interfaces.""
58 typedef struct _Component Component
;
59 typedef struct _CandidatePair CandidatePair
;
60 typedef struct _CandidatePairKeepalive CandidatePairKeepalive
;
61 typedef struct _IncomingCheck IncomingCheck
;
63 struct _CandidatePairKeepalive
70 uint8_t stun_buffer
[STUN_MAX_MESSAGE_SIZE
];
71 StunMessage stun_message
;
77 NiceCandidate
*remote
;
78 guint64 priority
; /**< candidate pair priority */
79 CandidatePairKeepalive keepalive
;
85 NiceSocket
*local_socket
;
87 gboolean use_candidate
;
89 uint16_t username_len
;
94 NiceComponentType type
;
95 guint id
; /**< component id */
96 NiceComponentState state
;
97 GSList
*local_candidates
; /**< list of Candidate objs */
98 GSList
*remote_candidates
; /**< list of Candidate objs */
99 GSList
*sockets
; /**< list of NiceSocket objs */
100 GSList
*gsources
; /**< list of GSource objs */
101 GSList
*incoming_checks
; /**< list of IncomingCheck objs */
102 GList
*turn_servers
; /**< List of TURN servers */
103 CandidatePair selected_pair
; /**< independent from checklists,
104 see ICE 11.1. "Sending Media" (ID-19) */
105 NiceCandidate
*restart_candidate
; /**< for storing active remote candidate during a restart */
106 NiceAgentRecvFunc g_source_io_cb
; /**< function called on io cb */
107 gpointer data
; /**< data passed to the io function */
108 GMainContext
*ctx
; /**< context for data callbacks for this
118 component_free (Component
*cmp
);
121 component_find_pair (Component
*cmp
, NiceAgent
*agent
, const gchar
*lfoundation
, const gchar
*rfoundation
, CandidatePair
*pair
);
124 component_restart (Component
*cmp
);
127 component_update_selected_pair (Component
*component
, const CandidatePair
*pair
);
130 component_find_remote_candidate (const Component
*component
, const NiceAddress
*addr
, NiceCandidateTransport transport
);
133 component_set_selected_remote_candidate (NiceAgent
*agent
, Component
*component
,
134 NiceCandidate
*candidate
);
138 #endif /* _NICE_COMPONENT_H */