| agent.h | | agent.h | |
| | | | |
| skipping to change at line 99 | | skipping to change at line 99 | |
| // Send our message! | | // Send our message! | |
| nice_agent_send (agent, stream_id, 1, sizeof(buffer), buffer); | | nice_agent_send (agent, stream_id, 1, sizeof(buffer), buffer); | |
| | | | |
| // Anything received will be received through the cb_nice_recv callback | | // Anything received will be received through the cb_nice_recv callback | |
| | | | |
| // Destroy the object | | // Destroy the object | |
| g_object_unref(agent); | | g_object_unref(agent); | |
| | | | |
| </programlisting> | | </programlisting> | |
| </example> | | </example> | |
|
| | | * | |
| | | * Refer to the examples in the examples/ subdirectory of the libnice sourc | |
| | | e for | |
| | | * complete examples. | |
| | | * | |
| */ | | */ | |
| | | | |
| #include <glib-object.h> | | #include <glib-object.h> | |
| | | | |
| /** | | /** | |
| * NiceAgent: | | * NiceAgent: | |
| * | | * | |
| * The #NiceAgent is the main GObject of the libnice library and represents | | * The #NiceAgent is the main GObject of the libnice library and represents | |
| * the ICE agent. | | * the ICE agent. | |
| */ | | */ | |
| | | | |
| skipping to change at line 503 | | skipping to change at line 507 | |
| calling nice_agent_set_remote_candidates() | | calling nice_agent_set_remote_candidates() | |
| </para> | | </para> | |
| <para> | | <para> | |
| Since 0.1.3, there is no need to wait for the candidate-gathering-done
signal. | | Since 0.1.3, there is no need to wait for the candidate-gathering-done
signal. | |
| Remote candidates can be set even while gathering local candidates. | | Remote candidates can be set even while gathering local candidates. | |
| Newly discovered local candidates will automatically be paired with | | Newly discovered local candidates will automatically be paired with | |
| existing remote candidates. | | existing remote candidates. | |
| </para> | | </para> | |
| </note> | | </note> | |
| * | | * | |
|
| * Returns: The number of candidates added, negative on errors (memory allo | | * Returns: The number of candidates added, negative on errors (memory | |
| cation | | * allocation error or invalid component) | |
| * or if the local candidates are not done gathering yet) | | | |
| **/ | | **/ | |
| int | | int | |
| nice_agent_set_remote_candidates ( | | nice_agent_set_remote_candidates ( | |
| NiceAgent *agent, | | NiceAgent *agent, | |
| guint stream_id, | | guint stream_id, | |
| guint component_id, | | guint component_id, | |
| const GSList *candidates); | | const GSList *candidates); | |
| | | | |
| /** | | /** | |
| * nice_agent_send: | | * nice_agent_send: | |
| | | | |
| skipping to change at line 676 | | skipping to change at line 680 | |
| */ | | */ | |
| gboolean | | gboolean | |
| nice_agent_set_selected_pair ( | | nice_agent_set_selected_pair ( | |
| NiceAgent *agent, | | NiceAgent *agent, | |
| guint stream_id, | | guint stream_id, | |
| guint component_id, | | guint component_id, | |
| const gchar *lfoundation, | | const gchar *lfoundation, | |
| const gchar *rfoundation); | | const gchar *rfoundation); | |
| | | | |
| /** | | /** | |
|
| | | * nice_agent_get_selected_pair: | |
| | | * @agent: The #NiceAgent Object | |
| | | * @stream_id: The ID of the stream | |
| | | * @component_id: The ID of the component | |
| | | * @local: The local selected candidate | |
| | | * @remote: The remote selected candidate | |
| | | * | |
| | | * Retreive the selected candidate pair for media transmission | |
| | | * for a given stream's component. | |
| | | * | |
| | | * Returns: %TRUE on success, %FALSE if there is no selected candidate pair | |
| | | */ | |
| | | gboolean | |
| | | nice_agent_get_selected_pair ( | |
| | | NiceAgent *agent, | |
| | | guint stream_id, | |
| | | guint component_id, | |
| | | NiceCandidate **local, | |
| | | NiceCandidate **remote); | |
| | | | |
| | | /** | |
| * nice_agent_set_selected_remote_candidate: | | * nice_agent_set_selected_remote_candidate: | |
| * @agent: The #NiceAgent Object | | * @agent: The #NiceAgent Object | |
| * @stream_id: The ID of the stream | | * @stream_id: The ID of the stream | |
| * @component_id: The ID of the component | | * @component_id: The ID of the component | |
| * @candidate: The #NiceCandidate to select | | * @candidate: The #NiceCandidate to select | |
| * | | * | |
| * Sets the selected remote candidate for media transmission | | * Sets the selected remote candidate for media transmission | |
| * for a given stream's component. This is used to force the selection of | | * for a given stream's component. This is used to force the selection of | |
| * a specific remote candidate even when connectivity checks are failing | | * a specific remote candidate even when connectivity checks are failing | |
| * (e.g. non-ICE compatible candidates). | | * (e.g. non-ICE compatible candidates). | |
| | | | |
| skipping to change at line 740 | | skipping to change at line 765 | |
| </para> | | </para> | |
| <para> | | <para> | |
| The @software argument must be in UTF-8 encoding and only the first | | The @software argument must be in UTF-8 encoding and only the first | |
| 128 characters will be sent. | | 128 characters will be sent. | |
| </para> | | </para> | |
| </note> | | </note> | |
| * | | * | |
| * Since: 0.0.10 | | * Since: 0.0.10 | |
| * | | * | |
| */ | | */ | |
|
| void nice_agent_set_software (NiceAgent *agent, const gchar *software); | | void nice_agent_set_software ( | |
| | | NiceAgent *agent, | |
| | | const gchar *software); | |
| | | | |
| | | /** | |
| | | * nice_agent_set_stream_name: | |
| | | * @agent: The #NiceAgent Object | |
| | | * @stream_id: The ID of the stream to change | |
| | | * @name: The new name of the stream or %NULL | |
| | | * | |
| | | * This function will assign a unique name to a stream. | |
| | | * This is only useful when parsing and generating an SDP of the candidates | |
| | | . | |
| | | * | |
| | | * <para>See also: nice_agent_generate_local_sdp()</para> | |
| | | * <para>See also: nice_agent_parse_remote_sdp()</para> | |
| | | * <para>See also: nice_agent_get_stream_name()</para> | |
| | | * | |
| | | * Returns: %TRUE if the name has been set. %FALSE in case of error | |
| | | * (invalid stream or duplicate name). | |
| | | * Since: 0.1.4 | |
| | | */ | |
| | | gboolean nice_agent_set_stream_name ( | |
| | | NiceAgent *agent, | |
| | | guint stream_id, | |
| | | const gchar *name); | |
| | | | |
| | | /** | |
| | | * nice_agent_get_stream_name: | |
| | | * @agent: The #NiceAgent Object | |
| | | * @stream_id: The ID of the stream to change | |
| | | * | |
| | | * This function will return the name assigned to a stream. | |
| | | | |
| | | * <para>See also: nice_agent_set_stream_name()</para> | |
| | | * | |
| | | * Returns: The name of the stream. The name is only valid while the stream | |
| | | * exists or until it changes through a call to nice_agent_set_stream_name( | |
| | | ). | |
| | | * | |
| | | * | |
| | | * Since: 0.1.4 | |
| | | */ | |
| | | const gchar *nice_agent_get_stream_name ( | |
| | | NiceAgent *agent, | |
| | | guint stream_id); | |
| | | | |
| | | /** | |
| | | * nice_agent_get_default_local_candidate: | |
| | | * @agent: The #NiceAgent Object | |
| | | * @stream_id: The ID of the stream | |
| | | * @component_id: The ID of the component | |
| | | * | |
| | | * This helper function will return the recommended default candidate to be | |
| | | * used for non-ICE compatible clients. This will usually be the candidate | |
| | | * with the lowest priority, since it will be the longest path but the one | |
| | | with | |
| | | * the most chances of success. | |
| | | * <note> | |
| | | <para> | |
| | | This function is only useful in order to manually generate the | |
| | | local SDP | |
| | | </para> | |
| | | * </note> | |
| | | * | |
| | | * Returns: The candidate to be used as the default candidate, or %NULL in | |
| | | case | |
| | | * of error. Must be freed with nice_candidate_free() once done. | |
| | | * | |
| | | */ | |
| | | NiceCandidate * | |
| | | nice_agent_get_default_local_candidate ( | |
| | | NiceAgent *agent, | |
| | | guint stream_id, | |
| | | guint component_id); | |
| | | | |
| | | /** | |
| | | * nice_agent_generate_local_sdp: | |
| | | * @agent: The #NiceAgent Object | |
| | | * | |
| | | * Generate an SDP string containing the local candidates and credentials f | |
| | | or | |
| | | * all streams and components in the agent. | |
| | | * | |
| | | <note> | |
| | | <para> | |
| | | The SDP will not contain any codec lines and the 'm' line will not lis | |
| | | t | |
| | | any payload types. | |
| | | </para> | |
| | | <para> | |
| | | It is highly recommended to set names on the streams prior to calling t | |
| | | his | |
| | | function. Unnamed streams will show up as '-' in the 'm' line, but the | |
| | | SDP | |
| | | will not be parseable with nice_agent_parse_remote_sdp() if a stream is | |
| | | unnamed. | |
| | | </para> | |
| | | <para> | |
| | | The default candidate in the SDP will be selected based on the lowest | |
| | | priority candidate for the first component. | |
| | | </para> | |
| | | </note> | |
| | | * | |
| | | * <para>See also: nice_agent_set_stream_name() </para> | |
| | | * <para>See also: nice_agent_parse_remote_sdp() </para> | |
| | | * <para>See also: nice_agent_generate_local_stream_sdp() </para> | |
| | | * <para>See also: nice_agent_generate_local_candidate_sdp() </para> | |
| | | * <para>See also: nice_agent_get_default_local_candidate() </para> | |
| | | * | |
| | | * Returns: A string representing the local SDP. Must be freed with g_free( | |
| | | ) | |
| | | * once done. | |
| | | * | |
| | | * Since: 0.1.4 | |
| | | **/ | |
| | | gchar * | |
| | | nice_agent_generate_local_sdp ( | |
| | | NiceAgent *agent); | |
| | | | |
| | | /** | |
| | | * nice_agent_generate_local_stream_sdp: | |
| | | * @agent: The #NiceAgent Object | |
| | | * @stream_id: The ID of the stream | |
| | | * @include_non_ice: Whether or not to include non ICE specific lines | |
| | | * (m=, c= and a=rtcp: lines) | |
| | | * | |
| | | * Generate an SDP string containing the local candidates and credentials | |
| | | * for a stream. | |
| | | * | |
| | | <note> | |
| | | <para> | |
| | | The SDP will not contain any codec lines and the 'm' line will not lis | |
| | | t | |
| | | any payload types. | |
| | | </para> | |
| | | <para> | |
| | | It is highly recommended to set the name of the stream prior to calling | |
| | | this | |
| | | function. Unnamed streams will show up as '-' in the 'm' line. | |
| | | </para> | |
| | | <para> | |
| | | The default candidate in the SDP will be selected based on the lowest | |
| | | priority candidate. | |
| | | </para> | |
| | | </note> | |
| | | * | |
| | | * <para>See also: nice_agent_set_stream_name() </para> | |
| | | * <para>See also: nice_agent_parse_remote_stream_sdp() </para> | |
| | | * <para>See also: nice_agent_generate_local_sdp() </para> | |
| | | * <para>See also: nice_agent_generate_local_candidate_sdp() </para> | |
| | | * <para>See also: nice_agent_get_default_local_candidate() </para> | |
| | | * | |
| | | * Returns: A string representing the local SDP for the stream. Must be fre | |
| | | ed | |
| | | * with g_free() once done. | |
| | | * | |
| | | * Since: 0.1.4 | |
| | | **/ | |
| | | gchar * | |
| | | nice_agent_generate_local_stream_sdp ( | |
| | | NiceAgent *agent, | |
| | | guint stream_id, | |
| | | gboolean include_non_ice); | |
| | | | |
| | | /** | |
| | | * nice_agent_generate_local_candidate_sdp: | |
| | | * @agent: The #NiceAgent Object | |
| | | * @candidate: The candidate to generate | |
| | | * | |
| | | * Generate an SDP string representing a local candidate. | |
| | | * | |
| | | * <para>See also: nice_agent_parse_remote_candidate_sdp() </para> | |
| | | * <para>See also: nice_agent_generate_local_sdp() </para> | |
| | | * <para>See also: nice_agent_generate_local_stream_sdp() </para> | |
| | | * | |
| | | * Returns: A string representing the SDP for the candidate. Must be freed | |
| | | * with g_free() once done. | |
| | | * | |
| | | * Since: 0.1.4 | |
| | | **/ | |
| | | gchar * | |
| | | nice_agent_generate_local_candidate_sdp ( | |
| | | NiceAgent *agent, | |
| | | NiceCandidate *candidate); | |
| | | | |
| | | /** | |
| | | * nice_agent_parse_remote_sdp: | |
| | | * @agent: The #NiceAgent Object | |
| | | * @sdp: The remote SDP to parse | |
| | | * | |
| | | * Parse an SDP string and extracts candidates and credentials from it and | |
| | | sets | |
| | | * them on the agent. | |
| | | * | |
| | | <note> | |
| | | <para> | |
| | | This function will return an error if a stream has not been assigned a | |
| | | name | |
| | | with nice_agent_set_stream_name() as it becomes troublesome to assign t | |
| | | he | |
| | | streams from the agent to the streams in the SDP. | |
| | | </para> | |
| | | </note> | |
| | | * | |
| | | * | |
| | | * <para>See also: nice_agent_set_stream_name() </para> | |
| | | * <para>See also: nice_agent_generate_local_sdp() </para> | |
| | | * <para>See also: nice_agent_parse_remote_stream_sdp() </para> | |
| | | * <para>See also: nice_agent_parse_remote_candidate_sdp() </para> | |
| | | * | |
| | | * Returns: The number of candidates added, negative on errors | |
| | | * | |
| | | * Since: 0.1.4 | |
| | | **/ | |
| | | int | |
| | | nice_agent_parse_remote_sdp ( | |
| | | NiceAgent *agent, | |
| | | const gchar *sdp); | |
| | | | |
| | | /** | |
| | | * nice_agent_parse_remote_stream_sdp: | |
| | | * @agent: The #NiceAgent Object | |
| | | * @stream_id: The ID of the stream to parse | |
| | | * @sdp: The remote SDP to parse | |
| | | * @ufrag: Pointer to store the ice ufrag if non %NULL. Must be freed with | |
| | | * g_free() after use | |
| | | * @pwd: Pointer to store the ice password if non %NULL. Must be freed with | |
| | | * g_free() after use | |
| | | * | |
| | | * Parse an SDP string representing a single stream and extracts candidates | |
| | | * and credentials from it. | |
| | | * | |
| | | * <para>See also: nice_agent_generate_local_stream_sdp() </para> | |
| | | * <para>See also: nice_agent_parse_remote_sdp() </para> | |
| | | * <para>See also: nice_agent_parse_remote_candidate_sdp() </para> | |
| | | * | |
| | | * Returns: A #GSList of candidates parsed from the SDP, or %NULL in case o | |
| | | f | |
| | | * errors | |
| | | * | |
| | | * Since: 0.1.4 | |
| | | **/ | |
| | | GSList * | |
| | | nice_agent_parse_remote_stream_sdp ( | |
| | | NiceAgent *agent, | |
| | | guint stream_id, | |
| | | const gchar *sdp, | |
| | | gchar **ufrag, | |
| | | gchar **pwd); | |
| | | | |
| | | /** | |
| | | * nice_agent_parse_remote_candidate_sdp: | |
| | | * @agent: The #NiceAgent Object | |
| | | * @stream_id: The ID of the stream the candidate belongs to | |
| | | * @sdp: The remote SDP to parse | |
| | | * | |
| | | * Parse an SDP string and extracts the candidate from it. | |
| | | * | |
| | | * <para>See also: nice_agent_generate_local_candidate_sdp() </para> | |
| | | * <para>See also: nice_agent_parse_remote_sdp() </para> | |
| | | * <para>See also: nice_agent_parse_remote_stream_sdp() </para> | |
| | | * | |
| | | * Returns: The parsed candidate or %NULL if there was an error. | |
| | | * | |
| | | * Since: 0.1.4 | |
| | | **/ | |
| | | NiceCandidate * | |
| | | nice_agent_parse_remote_candidate_sdp ( | |
| | | NiceAgent *agent, | |
| | | guint stream_id, | |
| | | const gchar *sdp); | |
| | | | |
| G_END_DECLS | | G_END_DECLS | |
| | | | |
| #endif /* _AGENT_H */ | | #endif /* _AGENT_H */ | |
| | | | |
End of changes. 4 change blocks. |
| 4 lines changed or deleted | | 300 lines changed or added | |
|
| debug.h | | debug.h | |
| /* | | /* | |
| * This file is part of the Nice GLib ICE library. | | * This file is part of the Nice GLib ICE library. | |
| * | | * | |
|
| * (C) 2008-2009 Collabora Ltd. | | * (C) 2008 Collabora Ltd. | |
| * Contact: Youness Alaoui | | * Contact: Youness Alaoui | |
|
| * (C) 2007 Nokia Corporation. All rights reserved. | | * (C) 2008 Nokia Corporation. All rights reserved. | |
| * | | * | |
| * The contents of this file are subject to the Mozilla Public License Vers
ion | | * The contents of this file are subject to the Mozilla Public License Vers
ion | |
| * 1.1 (the "License"); you may not use this file except in compliance with | | * 1.1 (the "License"); you may not use this file except in compliance with | |
| * the License. You may obtain a copy of the License at | | * the License. You may obtain a copy of the License at | |
| * http://www.mozilla.org/MPL/ | | * http://www.mozilla.org/MPL/ | |
| * | | * | |
| * Software distributed under the License is distributed on an "AS IS" basi
s, | | * Software distributed under the License is distributed on an "AS IS" basi
s, | |
| * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | |
| * for the specific language governing rights and limitations under the | | * for the specific language governing rights and limitations under the | |
| * License. | | * License. | |
| | | | |
| skipping to change at line 37 | | skipping to change at line 37 | |
| * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which | | * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which | |
| * case the provisions of LGPL are applicable instead of those above. If yo
u | | * case the provisions of LGPL are applicable instead of those above. If yo
u | |
| * wish to allow use of your version of this file only under the terms of t
he | | * wish to allow use of your version of this file only under the terms of t
he | |
| * LGPL and not to allow others to use your version of this file under the | | * LGPL and not to allow others to use your version of this file under the | |
| * MPL, indicate your decision by deleting the provisions above and replace | | * MPL, indicate your decision by deleting the provisions above and replace | |
| * them with the notice and other provisions required by the LGPL. If you d
o | | * them with the notice and other provisions required by the LGPL. If you d
o | |
| * not delete the provisions above, a recipient may use your version of thi
s | | * not delete the provisions above, a recipient may use your version of thi
s | |
| * file under either the MPL or the LGPL. | | * file under either the MPL or the LGPL. | |
| */ | | */ | |
| | | | |
|
| #ifndef STUN_DEBUG_H | | #ifndef _DEBUG_H | |
| #define STUN_DEBUG_H | | #define _DEBUG_H | |
| | | | |
|
| #ifdef __cplusplus | | /** | |
| extern "C" { | | * SECTION:debug | |
| #endif | | * @short_description: Debug messages utility functions | |
| | | * @stability: Unstable | |
| | | * | |
| | | * <para>Libnice can output a lot of information when debug messages are en | |
| | | abled. | |
| | | * This can significantly help track down problems and/or understand what | |
| | | * it's doing.</para> | |
| | | * | |
| | | * <para>You can enable/disable the debug messages by calling nice_debug_en | |
| | | able() | |
| | | * or nice_debug_disable() and choosing whether you want only ICE debug mes | |
| | | sages | |
| | | * or also stun debug messages.</para> | |
| | | * | |
| | | * <para>By default, the debug messages are disabled, unless the environmen | |
| | | t | |
| | | * variable NICE_DEBUG is set, in which case, it must contain a comma separ | |
| | | ated | |
| | | * list of flags specifying which debug to enable.</para> | |
| | | * <para> The currently available flags are "nice", "stun", "pseudotcp", | |
| | | * "pseudotcp-verbose" or "all" to enable all debug messages.</para> | |
| | | * <para> If the 'pseudotcp' flag is enabled, then 'pseudotcp-verbose' gets | |
| | | * automatically disabled. This is to allow the use of the 'all' flag witho | |
| | | ut | |
| | | * having verbose messages from pseudotcp. You can enable verbose debug mes | |
| | | sages | |
| | | * from the pseudotcp layer by specifying 'pseudotcp-verbose' without the | |
| | | * 'pseudotcp' flag.</para> | |
| | | * | |
| | | * | |
| | | * <para>This API is unstable and is subject to change at any time... | |
| | | * More flags are to come and a better API to enable/disable each flag | |
| | | * should be added.</para> | |
| | | */ | |
| | | | |
| | | #include <glib.h> | |
| | | | |
| | | G_BEGIN_DECLS | |
| | | | |
| | | /** | |
| | | * nice_debug_init: | |
| | | * | |
| | | * Initialize the debugging system. Uses the NICE_DEBUG environment variabl | |
| | | e | |
| | | * to set the appropriate debugging flags | |
| | | */ | |
| | | void nice_debug_init (void); | |
| | | | |
| /** | | /** | |
|
| * stun_debug_enable: | | * nice_debug_enable: | |
| | | * @with_stun: Also enable stun debugging messages | |
| * | | * | |
|
| * Enable debug messages to stderr | | * Enables libnice debug output to the terminal | |
| */ | | */ | |
|
| void stun_debug_enable (void); | | void nice_debug_enable (gboolean with_stun); | |
| | | | |
| /** | | /** | |
|
| * stun_debug_disable: | | * nice_debug_disable: | |
| | | * @with_stun: Also disable stun debugging messages | |
| * | | * | |
|
| * Disable debug messages to stderr | | * Disables libnice debug output to the terminal | |
| */ | | */ | |
|
| void stun_debug_disable (void); | | void nice_debug_disable (gboolean with_stun); | |
| | | | |
|
| void stun_debug (const char *fmt, ...); | | void nice_debug (const char *fmt, ...); | |
| void stun_debug_bytes (const void *data, size_t len); | | | |
| | | | |
|
| # ifdef __cplusplus | | G_END_DECLS | |
| } | | | |
| # endif | | | |
| | | | |
|
| #endif /* STUN_DEBUG_H */ | | #endif /* _DEBUG_H */ | |
| | | | |
End of changes. 13 change blocks. |
| 18 lines changed or deleted | | 63 lines changed or added | |
|