2 * @file candidate.h Candidate for Media API
8 * Purple is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
27 #ifndef _PURPLE_MEDIA_CANDIDATE_H_
28 #define _PURPLE_MEDIA_CANDIDATE_H_
30 #include "enum-types.h"
32 #include <glib-object.h>
36 #define PURPLE_TYPE_MEDIA_CANDIDATE (purple_media_candidate_get_type())
37 #define PURPLE_IS_MEDIA_CANDIDATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_MEDIA_CANDIDATE))
38 #define PURPLE_IS_MEDIA_CANDIDATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_MEDIA_CANDIDATE))
39 #define PURPLE_MEDIA_CANDIDATE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA_CANDIDATE, PurpleMediaCandidate))
40 #define PURPLE_MEDIA_CANDIDATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA_CANDIDATE, PurpleMediaCandidate))
41 #define PURPLE_MEDIA_CANDIDATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_MEDIA_CANDIDATE, PurpleMediaCandidate))
43 /** An opaque structure representing a network candidate (IP Address and port pair). */
44 typedef struct _PurpleMediaCandidate PurpleMediaCandidate
;
47 * Gets the type of the media candidate structure.
49 * @return The media canditate's GType
53 GType
purple_media_candidate_get_type(void);
56 * Creates a PurpleMediaCandidate instance.
58 * @param foundation The foundation of the candidate.
59 * @param component_id The component this candidate is for.
60 * @param type The type of candidate.
61 * @param proto The protocol this component is for.
62 * @param ip The IP address of this component.
63 * @param port The network port.
65 * @return The newly created PurpleMediaCandidate instance.
69 PurpleMediaCandidate
*purple_media_candidate_new(
70 const gchar
*foundation
, guint component_id
,
71 PurpleMediaCandidateType type
,
72 PurpleMediaNetworkProtocol proto
,
73 const gchar
*ip
, guint port
);
76 * Copies a PurpleMediaCandidate.
78 * @param candidate The candidate to copy.
80 * @return The copy of the PurpleMediaCandidate.
84 PurpleMediaCandidate
*purple_media_candidate_copy(
85 PurpleMediaCandidate
*candidate
);
88 * Copies a GList of PurpleMediaCandidate and its contents.
90 * @param candidates The list of candidates to be copied.
92 * @return The copy of the GList.
96 GList
*purple_media_candidate_list_copy(GList
*candidates
);
99 * Frees a GList of PurpleMediaCandidate and its contents.
101 * @param candidates The list of candidates to be freed.
105 void purple_media_candidate_list_free(GList
*candidates
);
108 * Gets the foundation (identifier) from the candidate.
110 * @param candidate The candidate to get the foundation from.
112 * @return The foundation.
116 gchar
*purple_media_candidate_get_foundation(PurpleMediaCandidate
*candidate
);
119 * Gets the component id (rtp or rtcp)
121 * @param candidate The candidate to get the compnent id from.
123 * @return The component id.
127 guint
purple_media_candidate_get_component_id(PurpleMediaCandidate
*candidate
);
130 * Gets the IP address.
132 * @param candidate The candidate to get the IP address from.
134 * @return The IP address.
138 gchar
*purple_media_candidate_get_ip(PurpleMediaCandidate
*candidate
);
143 * @param candidate The candidate to get the port from.
149 guint16
purple_media_candidate_get_port(PurpleMediaCandidate
*candidate
);
152 * Gets the base (internal) IP address.
156 * @param candidate The candidate to get the base IP address from.
158 * @return The base IP address.
162 gchar
*purple_media_candidate_get_base_ip(PurpleMediaCandidate
*candidate
);
165 * Gets the base (internal) port.
167 * Invalid if the base IP is NULL.
169 * @param candidate The candidate to get the base port.
171 * @return The base port.
175 guint16
purple_media_candidate_get_base_port(PurpleMediaCandidate
*candidate
);
178 * Gets the protocol (TCP or UDP).
180 * @param candidate The candidate to get the protocol from.
182 * @return The protocol.
186 PurpleMediaNetworkProtocol
purple_media_candidate_get_protocol(
187 PurpleMediaCandidate
*candidate
);
192 * @param candidate The candidate to get the priority from.
194 * @return The priority.
198 guint32
purple_media_candidate_get_priority(PurpleMediaCandidate
*candidate
);
201 * Gets the candidate type.
203 * @param candidate The candidate to get the candidate type from.
205 * @return The candidate type.
209 PurpleMediaCandidateType
purple_media_candidate_get_candidate_type(
210 PurpleMediaCandidate
*candidate
);
215 * This can be NULL. It depends on the transmission type.
217 * @param The candidate to get the username from.
219 * @return The username.
223 gchar
*purple_media_candidate_get_username(PurpleMediaCandidate
*candidate
);
228 * This can be NULL. It depends on the transmission type.
230 * @param The candidate to get the password from.
232 * @return The password.
236 gchar
*purple_media_candidate_get_password(PurpleMediaCandidate
*candidate
);
241 * @param The candidate to get the TTL from.
247 guint
purple_media_candidate_get_ttl(PurpleMediaCandidate
*candidate
);
251 #endif /* _PURPLE_MEDIA_CANDIDATE_H_ */