Was a limit on the number of remote candidates one can set, but is no longer used by libnice itself. Replace with dynamic value based on the #NiceAgent::max-connectivity-checks property The #NiceAddress structure that represents an IPv4 or IPv6 address. Create a new #NiceAddress with undefined address You must free it with nice_address_free() The new #NiceAddress Fills the sockaddr structure @sin with the address contained in @addr The #NiceAddress to query The sockaddr to fill Creates a new #NiceAddress with the same address as @addr The new #NiceAddress The #NiceAddress to dup Transforms the address @addr into a newly allocated human readable string the address string The #NiceAddress to query Compares two #NiceAddress structures to see if they contain the same address and the same port. %TRUE if @a and @b are the same address, %FALSE if they are different First #NiceAddress to compare Second #NiceAddress to compare Compares two #NiceAddress structures to see if they contain the same address, ignoring the port. %TRUE if @a and @b are the same address, %FALSE if they are different First #NiceAddress to compare Second #NiceAddress to compare Frees a #NiceAddress created with nice_address_new() or nice_address_dup() The #NiceAddress to free Retreive the port of @addr The port of @addr The #NiceAddress to query Initialize a #NiceAddress into an undefined address The #NiceAddress to init Returns the IP version of the address 4 for IPv4, 6 for IPv6 and 0 for undefined address The #NiceAddress to query Verifies if the address in @addr is a link-local address or not %TRUE if @addr is a link-local address, %FALSE otherwise The #NiceAddress to query Verifies if the address in @addr is a private address or not %TRUE if @addr is a private address, %FALSE otherwise The #NiceAddress to query Validate whether the #NiceAddress @addr is a valid IPv4 or IPv6 address %TRUE if @addr is valid, %FALSE otherwise The #NiceAddress to query Sets an IPv4 or IPv6 address from the sockaddr structure @sin The #NiceAddress to modify The sockaddr to set Sets an IPv4 or IPv6 address from the string @str %TRUE if success, %FALSE on error The #NiceAddress to modify The string to set Set @addr to an IPv4 address using the data from @addr_ipv4 <note> <para> This function will reset the port to 0, so make sure you call it before nice_address_set_port() </para> </note> The #NiceAddress to modify The IPv4 address Set @addr to an IPv6 address using the data from @addr_ipv6 <note> <para> This function will reset the port to 0, so make sure you call it before nice_address_set_port() </para> </note> The #NiceAddress to modify The IPv6 address Set the port of @addr to @port The #NiceAddress to modify The port to set Transforms the address @addr into a human readable string The #NiceAddress to query The string to fill The #NiceAgent is the main GObject of the libnice library and represents the ICE agent. Create a new #NiceAgent. The returned object must be freed with g_object_unref() The new agent GObject The Glib Mainloop Context to use for timers The compatibility mode of the agent Create a new #NiceAgent with parameters that must be be defined at construction time. The returned object must be freed with g_object_unref() <para> See also: #NiceNominationMode and #NiceAgentOption</para> The new agent GObject The Glib Mainloop Context to use for timers The compatibility mode of the agent Flags to set the properties Create a new #NiceAgent in reliable mode. If the connectivity is established through ICE-UDP, then a #PseudoTcpSocket will be transparently used to ensure reliability of the messages. The returned object must be freed with g_object_unref() <para> See also: #NiceAgent::reliable-transport-writable </para> The new agent GObject The Glib Mainloop Context to use for timers The compatibility mode of the agent Add a local address from which to derive local host candidates for candidate gathering. <para> Since 0.0.5, if this method is not called, libnice will automatically discover the local addresses available </para> See also: nice_agent_gather_candidates() %TRUE on success, %FALSE on fatal (memory allocation) errors The #NiceAgent Object The address to listen to If the port is 0, then a random port will be chosen by the system Adds a data stream to @agent containing @n_components components. The returned stream ID is guaranteed to be positive on success. The ID of the new stream, 0 on failure The #NiceAgent Object The number of components to add to the stream Attaches the stream's component's sockets to the Glib Mainloop Context in order to be notified whenever data becomes available for a component, and to enable #NiceAgent to receive STUN messages (during the establishment of ICE connectivity). This must not be used in combination with nice_agent_recv_messages() (or #NiceIOStream or #NiceInputStream) on the same stream/component pair. Calling nice_agent_attach_recv() with a %NULL @func will detach any existing callback and cause reception to be paused for the given stream/component pair. You must iterate the previously specified #GMainContext sufficiently to ensure all pending I/O callbacks have been received before calling this function to unset @func, otherwise data loss of received packets may occur. %TRUE on success, %FALSE if the stream or component IDs are invalid. The #NiceAgent Object The ID of stream The ID of the component The Glib Mainloop Context to use for listening on the component The callback function to be called when data is received on the stream's component (will not be called for STUN messages that should be handled by #NiceAgent itself) user data associated with the callback Asynchronously closes resources the agent has allocated on remote servers. The agent will call the callback in the current #GMainContext in which this function is called. The #GAsyncResult in the callback can be ignored as this operation never fails. Calling this function before freeing the agent makes sure the allocated relay ports aren't left behind on TURN server but properly removed. The #NiceAgent object A callback that will be called when the closing is complete A pointer that will be passed to the callback Notifies the agent that consent to receive has been revoked. This will cause the component to fail with 403 'Forbidden' all incoming STUN binding requests as specified in RFC 7675. A stream with a component in the consent-lost state can be reused by performing an ice restart with nice_agent_restart() or nice_agent_restart_stream(). Calling the function only has an effect when @agent has been created with @NICE_AGENT_OPTION_CONSENT_FRESHNESS. %FALSE if the stream or component could not be found or consent freshness is not enabled, %TRUE otherwise The #NiceAgent Object The ID of the stream The ID of the component Forget all the relay servers previously added using nice_agent_set_relay_info(). Currently connected streams will keep using the relay as long as they have not been restarted and haven't succesfully negotiated a different path. %FALSE if the component could not be found, %TRUE otherwise The #NiceAgent Object The ID of the stream The ID of the component Allocate and start listening on local candidate ports and start the remote candidate gathering process. Once done, #NiceAgent::candidate-gathering-done is called for the stream. As soon as this function is called, #NiceAgent::new-candidate signals may be emitted, even before this function returns. nice_agent_get_local_candidates() will only return non-empty results after calling this function. <para>See also: nice_agent_add_local_address()</para> <para>See also: nice_agent_set_port_range()</para> %FALSE if the stream ID is invalid or if a host candidate couldn't be allocated on the requested interfaces/ports; %TRUE otherwise <note> <para> Local addresses can be previously set with nice_agent_add_local_address() </para> <para> Since 0.0.5, If no local address was previously added, then the nice agent will automatically detect the local address using nice_interfaces_get_local_ips() </para> </note> The #NiceAgent object The ID of the stream to start 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> A string representing the SDP for the candidate. Must be freed with g_free() once done. The #NiceAgent Object The candidate to generate Generate an SDP string containing the local candidates and credentials for all streams and components in the agent. <note> <para> The SDP will not contain any codec lines and the 'm' line will not list any payload types. </para> <para> It is highly recommended to set names on the streams prior to calling this 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> A string representing the local SDP. Must be freed with g_free() once done. The #NiceAgent Object 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 list 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> A string representing the local SDP for the stream. Must be freed with g_free() once done. The #NiceAgent Object The ID of the stream Whether or not to include non ICE specific lines (m=, c= and a=rtcp: lines) Retrieves the current state of a component. the #NiceComponentState of the component and %NICE_COMPONENT_STATE_FAILED if the component was invalid. The #NiceAgent Object The ID of the stream 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> The candidate to be used as the default candidate, or %NULL in case of error. Must be freed with nice_candidate_free() once done. The #NiceAgent Object The ID of the stream The ID of the component Gets a #GIOStream wrapper around the given stream and component in @agent. The I/O stream will be valid for as long as @stream_id is valid. The #GInputStream and #GOutputStream implement #GPollableInputStream and #GPollableOutputStream. This function may only be called on reliable #NiceAgents. It is a programming error to try and create an I/O stream wrapper for an unreliable stream. A #GIOStream. A #NiceAgent The ID of the stream to wrap The ID of the component to wrap Retrieve from the agent the list of all local candidates for a stream's component <note> <para> The caller owns the returned GSList as well as the candidates contained within it. To get full results, the client should wait for the #NiceAgent::candidate-gathering-done signal. </para> </note> a #GSList of #NiceCandidate objects representing the local candidates of @agent The #NiceAgent Object The ID of the stream The ID of the component Gets the local credentials for stream @stream_id. This may be called any time after creating a stream using nice_agent_add_stream(). An error will be returned if this is called for a non-existent stream, or if either of @ufrag or @pwd are %NULL. %TRUE on success, %FALSE on error. The #NiceAgent Object The ID of the stream return location for a nul-terminated string containing an ICE username fragment; must be freed with g_free() return location for a nul-terminated string containing an ICE password; must be freed with g_free() Get a list of the remote candidates set on a stream's component <note> <para> The caller owns the returned GSList as well as the candidates contained within it. </para> <para> The list of remote candidates can change during processing. The client should register for the #NiceAgent::new-remote-candidate signal to get notified of new remote candidates. </para> </note> a #GSList of #NiceCandidates objects representing the remote candidates set on the @agent The #NiceAgent Object The ID of the stream The ID of the component Retreive the selected candidate pair for media transmission for a given stream's component. %TRUE on success, %FALSE if there is no selected candidate pair The #NiceAgent Object The ID of the stream The ID of the component The local selected candidate The remote selected candidate Retreive the local socket associated with the selected candidate pair for media transmission for a given stream's component. This is useful for adding ICE support to legacy applications that already have a protocol that maintains a connection. If the socket is duplicated before unrefing the agent, the application can take over and continue to use it. New applications are encouraged to use the built in libnice stream handling instead and let libnice handle the connection maintenance. Users of this method are encouraged to not use a TURN relay or any kind of proxy, as in this case, the socket will not be available to the application because the packets are encapsulated. pointer to the #GSocket, or %NULL if there is no selected candidate or if the selected candidate is a relayed candidate. The #NiceAgent Object The ID of the stream The ID of the component Each component can have multiple sockets, this is an API to retrieve them all to be able to set properties. Most of the sockets for a component are created when calling nice_agent_gather_candidates(), so this API should be called right after to able to set properties on the sockets before they are used. These sockets can be a mix of UDP & TCP sockets depending on the compatibility mode and options that have been set. An array containing all of the sockets for this component. Free with g_ptr_array_unref() when done. The #NiceAgent Object The ID of the stream The ID of the component This function will return the name assigned to a stream. <para>See also: nice_agent_set_stream_name()</para> 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(). The #NiceAgent Object The ID of the stream to change 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> The parsed candidate or %NULL if there was an error. The #NiceAgent Object The ID of the stream the candidate belongs to The remote SDP to parse Parse an SDP string and extracts candidates and credentials from it and sets them on the agent. <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> The number of candidates added, negative on errors The #NiceAgent Object The remote SDP to parse 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> A #GSList of candidates parsed from the SDP, or %NULL in case of errors The #NiceAgent Object The ID of the stream to parse The remote SDP to parse Pointer to store the ice ufrag if non %NULL. Must be freed with g_free() after use Pointer to store the ice password if non %NULL. Must be freed with g_free() after use Notifies the agent that the remote peer has concluded candidate gathering and thus no more remote candidates are expected to arrive for @stream_id. This will allow the stream components without a successful connectivity check to stop waiting for more candidates to come and finally transit into %NICE_COMPONENT_STATE_FAILED. Calling the function has an effect only when #NiceAgent:trickle-ice is %TRUE. %FALSE if the stream could not be found, %TRUE otherwise The #NiceAgent Object The ID of the stream A single-message version of nice_agent_recv_messages(). the number of bytes written to @buf on success (guaranteed to be greater than 0 unless @buf_len is 0), 0 if in reliable mode and the remote peer closed the stream, or -1 on error a #NiceAgent the ID of the stream to receive on the ID of the component to receive on caller-allocated buffer to write the received data into, of length at least @buf_len length of @buf a #GCancellable to allow the operation to be cancelled from another thread, or %NULL Block on receiving data from the given stream/component combination on @agent, returning only once exactly @n_messages messages have been received and written into @messages, the stream is closed by the other end or by calling nice_agent_remove_stream(), or @cancellable is cancelled. Any STUN packets received will not be added to @messages; instead, they'll be passed for processing to #NiceAgent itself. Since #NiceAgent does not poll for messages on its own, it's therefore essential to keep calling this function for ICE connection establishment to work. In the non-error case, in reliable mode, this will block until all buffers in all @n_messages have been filled with received data (i.e. @messages is treated as a large, flat array of buffers). In non-reliable mode, it will block until @n_messages messages have been received, each of which does not have to fill all the buffers in its #NiceInputMessage. In the non-reliable case, each #NiceInputMessage must have enough buffers to contain an entire message (65536 bytes), or any excess data may be silently dropped. For each received message, #NiceInputMessage::length will be set to the number of valid bytes stored in the message’s buffers. The bytes are stored sequentially in the buffers; there are no gaps apart from at the end of the buffer array (in non-reliable mode). If non-%NULL on input, #NiceInputMessage::from will have the address of the sending peer stored in it. The base addresses, sizes, and number of buffers in each message will not be modified in any case. This must not be used in combination with nice_agent_attach_recv() on the same stream/component pair. If the stream/component pair doesn’t exist, or if a suitable candidate socket hasn’t yet been selected for it, a %G_IO_ERROR_BROKEN_PIPE error will be returned. A %G_IO_ERROR_CANCELLED error will be returned if the operation was cancelled. %G_IO_ERROR_FAILED will be returned for other errors. the number of valid messages written to @messages on success (guaranteed to be greater than 0 unless @n_messages is 0), 0 if the remote peer closed the stream, or -1 on error a #NiceAgent the ID of the stream to receive on the ID of the component to receive on caller-allocated array of #NiceInputMessages to write the received messages into, of length at least @n_messages number of entries in @messages a #GCancellable to allow the operation to be cancelled from another thread, or %NULL Try to receive data from the given stream/component combination on @agent, without blocking. If receiving data would block, -1 is returned and %G_IO_ERROR_WOULD_BLOCK is set in @error. If any other error occurs, -1 is returned and @error is set accordingly. Otherwise, 0 is returned if (and only if) @n_messages is 0. In all other cases, the number of valid messages stored in @messages is returned, and will be greater than 0. This function behaves similarly to nice_agent_recv_messages(), except that it will not block on filling (in reliable mode) or receiving (in non-reliable mode) exactly @n_messages messages. In reliable mode, it will receive bytes into @messages until it would block; in non-reliable mode, it will receive messages until it would block. Any STUN packets received will not be added to @messages; instead, they'll be passed for processing to #NiceAgent itself. Since #NiceAgent does not poll for messages on its own, it's therefore essential to keep calling this function for ICE connection establishment to work. As this function is non-blocking, @cancellable is included only for parity with nice_agent_recv_messages(). If @cancellable is cancelled before this function is called, a %G_IO_ERROR_CANCELLED error will be returned immediately. This must not be used in combination with nice_agent_attach_recv() on the same stream/component pair. the number of valid messages written to @messages on success (guaranteed to be greater than 0 unless @n_messages is 0), 0 if in reliable mode and the remote peer closed the stream, or -1 on error a #NiceAgent the ID of the stream to receive on the ID of the component to receive on caller-allocated array of #NiceInputMessages to write the received messages into, of length at least @n_messages number of entries in @messages a #GCancellable to allow the operation to be cancelled from another thread, or %NULL A single-message version of nice_agent_recv_messages_nonblocking(). the number of bytes received into @buf on success (guaranteed to be greater than 0 unless @buf_len is 0), 0 if in reliable mode and the remote peer closed the stream, or -1 on error a #NiceAgent the ID of the stream to receive on the ID of the component to receive on caller-allocated buffer to write the received data into, of length at least @buf_len length of @buf a #GCancellable to allow the operation to be cancelled from another thread, or %NULL Remove and free a previously created data stream from @agent. If any I/O streams have been created using nice_agent_get_io_stream(), they should be closed completely using g_io_stream_close() before this is called, or they will get broken pipe errors. The #NiceAgent Object The ID of the stream to remove Restarts the session as defined in ICE draft 19. This function needs to be called both when initiating (ICE spec section 9.1.1.1. "ICE Restarts"), as well as when reacting (spec section 9.2.1.1. "Detecting ICE Restart") to a restart. If consent-freshness has been enabled on @agent, as specified in RFC7675 then restarting streams will restore the local consent. %TRUE on success %FALSE on error The #NiceAgent Object Restarts a single stream as defined in RFC 5245. This function needs to be called both when initiating (ICE spec section 9.1.1.1. "ICE Restarts"), as well as when reacting (spec section 9.2.1.1. "Detecting ICE Restart") to a restart. Unlike nice_agent_restart(), this applies to a single stream. It also does not generate a new tie breaker. If consent-freshness has been enabled on @agent, as specified in RFC7675 then restart @stream_id will restore the local consent for that stream. %TRUE on success %FALSE on error The #NiceAgent Object The ID of the stream Sends a data payload over a stream's component. <note> <para> Component state MUST be NICE_COMPONENT_STATE_READY, or as a special case, in any state if component was in READY state before and was then restarted </para> <para> In reliable mode, the -1 error value means either that you are not yet connected or that the send buffer is full (equivalent to EWOULDBLOCK). In both cases, you simply need to wait for the #NiceAgent::reliable-transport-writable signal to be fired before resending the data. </para> <para> In non-reliable mode, it will virtually never happen with UDP sockets, but it might happen if the active candidate is a TURN-TCP connection that got disconnected. </para> <para> In both reliable and non-reliable mode, a -1 error code could also mean that the stream_id and/or component_id are invalid. </para> </note> The number of bytes sent, or negative error code The #NiceAgent Object The ID of the stream to send to The ID of the component to send to The length of the buffer to send The buffer of data to send Sends multiple messages on the socket identified by the given stream/component pair. Transmission is non-blocking, so a %G_IO_ERROR_WOULD_BLOCK error may be returned if the send buffer is full. As with nice_agent_send(), the given component must be in %NICE_COMPONENT_STATE_READY or, as a special case, in any state if it was previously ready and was then restarted. On success, the number of messages written to the socket will be returned, which may be less than @n_messages if transmission would have blocked part-way through. Zero will be returned if @n_messages is zero, or if transmission would have blocked on the first message. In reliable mode, it is instead recommended to use nice_agent_send(). The return value can be less than @n_messages or 0 even if it is still possible to send a partial message. In this case, "nice-agent-writable" will never be triggered, so the application would have to use nice_agent_sent() to fill the buffer or have to retry sending at a later point. On failure, -1 will be returned and @error will be set. If the #NiceAgent is reliable and the socket is not yet connected, %G_IO_ERROR_BROKEN_PIPE will be returned; if the write buffer is full, %G_IO_ERROR_WOULD_BLOCK will be returned. In both cases, wait for the #NiceAgent::reliable-transport-writable signal before trying again. If the given @stream_id or @component_id are invalid or not yet connected, %G_IO_ERROR_BROKEN_PIPE will be returned. %G_IO_ERROR_FAILED will be returned for other errors. the number of messages sent (may be zero), or -1 on error a #NiceAgent the ID of the stream to send to the ID of the component to send to array of messages to send, of at least @n_messages entries in length number of entries in @messages a #GCancellable to cancel the operation from another thread, or %NULL Sets the local credentials for stream @stream_id. <note> <para> This is only effective before ICE negotiation has started. </para> </note> Since 0.1.11 %TRUE on success, %FALSE on error. The #NiceAgent Object The ID of the stream nul-terminated string containing an ICE username fragment (length must be between 22 and 256 chars) nul-terminated string containing an ICE password (length must be between 4 and 256 chars) Sets a preferred port range for allocating host candidates. <para> If a local host candidate cannot be created on that port range, then the nice_agent_gather_candidates() call will fail. </para> <para> This MUST be called before nice_agent_gather_candidates() </para> The #NiceAgent Object The ID of the stream The ID of the component The minimum port to use The maximum port to use Sets the settings for using a relay server during the candidate discovery. This may be called multiple times to add multiple relay servers to the discovery process; one TCP and one UDP, for example. %TRUE if the TURN settings were accepted. %FALSE if the address was invalid. The #NiceAgent Object The ID of the stream The ID of the component The address of the TURN server The port of the TURN server The TURN username to use for the allocate The TURN password to use for the allocate The type of relay to use Sets, adds or updates the remote candidates for a component of a stream. <note> <para> NICE_AGENT_MAX_REMOTE_CANDIDATES is the absolute maximum limit for remote candidates. </para> <para> You must first call nice_agent_gather_candidates() and wait for the #NiceAgent::candidate-gathering-done signale before calling nice_agent_set_remote_candidates() </para> <para> 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. Newly discovered local candidates will automatically be paired with existing remote candidates. </para> </note> The number of candidates added, negative on errors (memory allocation error or invalid component) The #NiceAgent Object The ID of the stream the candidates are for The ID of the component the candidates are for a #GSList of #NiceCandidate items describing each candidate to add Sets the remote credentials for stream @stream_id. <note> <para> Stream credentials do not override per-candidate credentials if set </para> <para> Due to the native of peer-reflexive candidates, any agent using a per-stream credentials (RFC5245, WLM2009, OC2007R2 and DRAFT19) instead of per-candidate credentials (GOOGLE, MSN, OC2007), must use the nice_agent_set_remote_credentials() API instead of setting the username and password on the candidates. </para> </note> %TRUE on success, %FALSE on error. The #NiceAgent Object The ID of the stream nul-terminated string containing an ICE username fragment (length must be between 22 and 256 chars) nul-terminated string containing an ICE password (length must be between 4 and 256 chars) Sets the selected candidate pair for media transmission for a given stream's component. Calling this function will disable all further ICE processing (connection check, state machine updates, etc). Note that keepalives will continue to be sent. %TRUE on success, %FALSE if the candidate pair cannot be found The #NiceAgent Object The ID of the stream The ID of the component The local foundation of the candidate to use The remote foundation of the candidate to use Sets the selected remote candidate for media transmission for a given stream's component. This is used to force the selection of a specific remote candidate even when connectivity checks are failing (e.g. non-ICE compatible candidates). Calling this function will disable all further ICE processing (connection check, state machine updates, etc). Note that keepalives will continue to be sent. %TRUE on success, %FALSE on failure The #NiceAgent Object The ID of the stream The ID of the component The #NiceCandidate to select This function will set the value of the SOFTWARE attribute to be added to STUN requests, responses and error responses sent during connectivity checks. <para> The SOFTWARE attribute will only be added in the #NICE_COMPATIBILITY_RFC5245 and #NICE_COMPATIBILITY_WLM2009 compatibility modes. </para> <note> <para> The @software argument will be appended with the libnice version before being sent. </para> <para> The @software argument must be in UTF-8 encoding and only the first 128 characters will be sent. </para> </note> The #NiceAgent Object The value of the SOFTWARE attribute to add. This function will assign a media type to a stream. The only values that can be used to produce a valid SDP are: "audio", "video", "text", "application", "image" and "message". 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> %TRUE if the name has been set. %FALSE in case of error (invalid stream or duplicate name). The #NiceAgent Object The ID of the stream to change The new name of the stream or %NULL Sets the IP_TOS and/or IPV6_TCLASS field on the stream's sockets' options The #NiceAgent Object The ID of the stream The ToS to set This property defines whether receive/send operations over a TCP socket, in reliable mode, are considered as packetized or as bytestream. In unreliable mode, every send/recv is considered as packetized, and this property is ignored and cannot be set. <para> In reliable mode, this property will always return %TRUE in the %NICE_COMPATIBILITY_GOOGLE compatibility mode. </para> If the property is %TRUE, the stream is considered in bytestream mode and data can be read with any receive size. If the property is %FALSE, then the stream is considered packetized and each receive will return one packet of the same size as what was sent from the peer. If in packetized mode, then doing a receive with a size smaller than the packet, will cause the remaining bytes in the packet to be dropped, breaking the reliability of the stream. The Nice agent can work in various compatibility modes depending on what the application/peer needs. <para> See also: #NiceCompatibility</para> Whether to perform periodic consent freshness checks as specified in RFC 7675. When %TRUE, the agent will periodically send binding requests to the peer to maintain the consent to send with the peer. On receipt of any authenticated error response, a component will immediately move to the failed state. Setting this property to %TRUE implies that 'keepalive-conncheck' should be %TRUE as well. Whether the agent has the controlling role. This property should be modified before gathering candidates, any modification occuring later will be hold until ICE is restarted. Force all traffic to go through a relay for added privacy, this allows hiding the local IP address. When this is enabled, so local candidates are available before relay servers have been set with nice_agent_set_relay_info(). Whether the agent should use ICE-TCP when gathering candidates. If the option is disabled, no TCP candidates will be generated. If the agent is in reliable mode, then pseudotcp will need to be used over UDP candidates. <para> This option should be set before gathering candidates and should not be modified afterwards. </para> The #NiceAgent:ice-tcp property can be set at the same time as the #NiceAgent:ice-udp property, but both cannot be unset at the same time. If #NiceAgent:ice-udp is set to %FALSE, then this property cannot be set to %FALSE as well. <note> <para> ICE-TCP is only supported for %NICE_COMPATIBILITY_RFC5245, %NICE_COMPATIBILITY_OC2007 and %NICE_COMPATIBILITY_OC2007R2 compatibility modes. </para> </note> Whether to perform Trickle ICE as per draft-ietf-ice-trickle-ice-21. When %TRUE, the agent will postpone changing a component state to %NICE_COMPONENT_STATE_FAILED until nice_agent_peer_candidate_gathering_done() has been called with the ID of the component's stream. Whether the agent should use ICE-UDP when gathering candidates. If the option is disabled, no UDP candidates will be generated. If the agent is in reliable mode, then pseudotcp will not be used since pseudotcp works on top of UDP candidates. <para> This option should be set before gathering candidates and should not be modified afterwards. </para> The #NiceAgent:ice-udp property can be set at the same time as the #NiceAgent:ice-tcp property, but both cannot be unset at the same time. If #NiceAgent:ice-tcp is set to %FALSE, then this property cannot be set to %FALSE as well. A final timeout in msec, launched when the agent becomes idle, before stopping its activity. This timer will delay the decision to set a component as failed. This delay is added to reduce the chance to see the agent receiving new stun activity just after the conncheck list has been declared failed (some valid pairs, no nominated pair, and no in-progress pairs), reactiviting conncheck activity, and causing a (valid) state transitions like that: connecting -> failed -> connecting -> connected -> ready. Such transitions are not buggy per-se, but may break the test-suite, that counts precisely the number of time each state has been set, and doesnt expect these transcient failed states. This timer is also useful when the agent is in controlled mode and the other controlling peer takes some time to elect its nominated pair (this may be the case for SfB peers). This timer is *NOT* part if the RFC5245, as this situation is not covered in sect 8.1.2 "Updating States", but deals with a real use-case, where a controlled agent can not wait forever for the other peer to make a nomination decision. Also note that the value of this timeout will not delay the emission of 'connected' and 'ready' agent signals, and will not slow down the behaviour of the agent when the peer agent works in a timely manner. Use binding requests as keepalives instead of binding indications. This means that the keepalives may time out which will change the component state to %NICE_COMPONENT_STATE_FAILED. Enabing this is a slight violation of RFC 5245 section 10 which recommends using Binding Indications for keepalives. This is always enabled if the compatibility mode is %NICE_COMPATIBILITY_GOOGLE. This is always enabled if the 'consent-freshness' property is %TRUE A GLib main context is needed for all timeouts used by libnice. This is a property being set by the nice_agent_new() call. The nomination mode used in the ICE specification for describing the selection of valid pairs to be used upstream. <para> See also: #NiceNominationMode </para> Optional extra headers to append to the HTTP proxy CONNECT request. Provided as key/value-pairs in hash table corresponding to header-name/header-value. The proxy server IP used to bypass a proxy firewall The password used to authenticate with the proxy The proxy server port used to bypass a proxy firewall The type of proxy set in the proxy-ip property The username used to authenticate with the proxy Whether the agent is providing a reliable transport of messages (through ICE-TCP or PseudoTCP over ICE-UDP) The initial timeout (msecs) of the STUN binding requests used in the gathering stage, to find our local candidates. This property is described as 'RTO' in the RFC 5389 and RFC 5245. This timeout is doubled for each retransmission, until #NiceAgent:stun-max-retransmissions have been done, with an exception for the last restransmission, where the timeout is divided by two instead (RFC 5389 indicates that a customisable multiplier 'Rm' to 'RTO' should be used). The maximum number of retransmissions of the STUN binding requests used in the gathering stage, to find our local candidates, and used in the connection check stage, to test the validity of each constructed pair. This property is described as 'Rc' in the RFC 5389, with a default value of 7. The timeout of each STUN request is doubled for each retransmission, so the choice of this value has a direct impact on the time needed to move from the CONNECTED state to the READY state, and on the time needed to complete the GATHERING state. The initial timeout of the STUN binding requests used for a reliable timer. Support RENOMINATION STUN attribute proposed here: https://tools.ietf.org/html/draft-thatcher-ice-renomination-00 As soon as RENOMINATION attribute is received from remote candidate's address, corresponding candidates pair gets selected. This is specific to Google Chrome/libWebRTC. Whether the agent should use UPnP to open a port in the router and get the external IP The maximum amount of time (in milliseconds) to wait for UPnP discovery to finish before signaling the #NiceAgent::candidate-gathering-done signal This signal is fired whenever a stream has finished gathering its candidates after a call to nice_agent_gather_candidates() The ID of the stream This signal is fired whenever a component’s state changes. There are many valid state transitions. ![State transition diagram](states.png) The ID of the stream The ID of the component The new #NiceComponentState of the component This signal is fired when we received our first binding request from the peer. The ID of the stream This signal is fired when the agent discovers a new local candidate. When this signal is emitted, a matching #NiceAgent::new-candidate-full is also emitted with the candidate. See also: #NiceAgent::candidate-gathering-done, #NiceAgent::new-candidate-full Use #NiceAgent::new-candidate-full The ID of the stream The ID of the component The foundation of the new candidate This signal is fired when the agent discovers a new local candidate. When this signal is emitted, a matching #NiceAgent::new-candidate is also emitted with the candidate's foundation. See also: #NiceAgent::candidate-gathering-done, #NiceAgent::new-candidate The new #NiceCandidate This signal is fired when the agent discovers a new remote candidate. This can happen with peer reflexive candidates. When this signal is emitted, a matching #NiceAgent::new-remote-candidate-full is also emitted with the candidate. See also: #NiceAgent::new-remote-candidate-full Use #NiceAgent::new-remote-candidate-full The ID of the stream The ID of the component The foundation of the new candidate This signal is fired when the agent discovers a new remote candidate. This can happen with peer reflexive candidates. When this signal is emitted, a matching #NiceAgent::new-remote-candidate is also emitted with the candidate's foundation. See also: #NiceAgent::new-remote-candidate The new #NiceCandidate This signal is fired once a candidate pair is selected for data transfer for a stream's component This is emitted along with #NiceAgent::new-selected-pair-full which has the whole candidate, the Foundation of a Candidate is not a unique identifier. See also: #NiceAgent::new-selected-pair-full Use #NiceAgent::new-selected-pair-full The ID of the stream The ID of the component The local foundation of the selected candidate pair The remote foundation of the selected candidate pair This signal is fired once a candidate pair is selected for data transfer for a stream's component. This is emitted along with #NiceAgent::new-selected-pair. See also: #NiceAgent::new-selected-pair The ID of the stream The ID of the component The local #NiceCandidate of the selected candidate pair The remote #NiceCandidate of the selected candidate pair This signal is fired on the reliable #NiceAgent when the underlying reliable transport becomes writable. This signal is only emitted when the nice_agent_send() function returns less bytes than requested to send (or -1) and once when the connection is established. The ID of the stream The ID of the component This signal is fired whenever one or more streams are removed from the @agent. An array of unsigned integer stream IDs, ending with a 0 ID These are options that can be passed to nice_agent_new_full(). They set various properties on the agent. Not including them sets the property to the other value. No enabled options (Since: 0.1.19) Enables regular nomination, default is aggrssive mode (see #NiceNominationMode). Enables reliable mode, possibly using PseudoTCP, * see nice_agent_new_reliable(). Enable lite mode Enable ICE trickle mode Enable renomination triggered by NOMINATION STUN attribute proposed here: https://tools.ietf.org/html/draft-thatcher-ice-renomination-00 Enable RFC 7675 consent freshness support. (Since: 0.1.19) Use bytestream mode for reliable TCP connections. (Since: 0.1.20) Callback function when data is received on a component The #NiceAgent Object The id of the stream The id of the component of the stream which received the data The length of the data The buffer containing the data received The user data set in nice_agent_attach_recv() The maximum size a candidate foundation can have. The maximum number of local addresses. The constraint is that the maximum number of local addresses and number of turn servers must fit on 9 bits, to ensure candidate priority uniqueness. See also @NICE_CANDIDATE_MAX_TURN_SERVERS. We choose 6 bits for the number of local addresses, and 3 bits for the number of turn servers. The maximum number of turns servers. A structure to represent an ICE candidate <note> <para> The @priority is an integer as specified in the ICE draft 19. If you are using the MSN or the GOOGLE compatibility mode (which are based on ICE draft 6, which uses a floating point qvalue as priority), then the @priority value will represent the qvalue multiplied by 1000. </para> </note> The type of candidate The transport being used for the candidate The #NiceAddress of the candidate The #NiceAddress of the base address used by the candidate The priority of the candidate <emphasis> see note </emphasis> The ID of the stream to which belongs the candidate The ID of the component to which belongs the candidate The foundation of the candidate The candidate-specific username to use (overrides the one set by nice_agent_set_local_credentials() or nice_agent_set_remote_credentials()) The candidate-specific password to use (overrides the one set by nice_agent_set_local_credentials() or nice_agent_set_remote_credentials()) Creates a new candidate. Must be freed with nice_candidate_free() A new #NiceCandidate The #NiceCandidateType of the candidate to create Makes a copy of a #NiceCandidate A new #NiceCandidate, a copy of @candidate The candidate to copy Verifies that the candidates point to the same place, meaning they have the same transport and the same address. It ignores all other aspects. %TRUE if the candidates point to the same place A candidate A candidate Frees a #NiceCandidate The candidate to free In case the given candidate is relayed through a TURN server, use this utility function to get its address. A relay candidate The #NiceAddress to fill In case the given candidate server-reflexive, use this utility function to get its address. The address will be filled only if the candidate was generated using an STUN server. TRUE if it's a STUN created ICE candidate, or FALSE if the reflexed's server was not STUN. A server-reflexive candidate The #NiceAddress to fill Useful for debugging functions, just returns a static string with the candidate transport. a static string with the candidate transport a #NiceCandidateTransport Useful for debugging functions, just returns a static string with the candidate type. a static string with the candidate type a #NiceCandidateType An enum representing the type of transport to use UDP transport TCP Active transport TCP Passive transport TCP Simultaneous-Open transport An enum representing the type of a candidate A host candidate A server reflexive candidate (or a NAT-assisted candidate) A peer reflexive candidate A relay candidate An enum to specify which compatible specifications the #NiceAgent should use. Use with nice_agent_new() <warning>@NICE_COMPATIBILITY_DRAFT19 is deprecated and should not be used in newly-written code. It is kept for compatibility reasons and represents the same compatibility as @NICE_COMPATIBILITY_RFC5245 </warning> <note> <para> If @NICE_COMPATIBILITY_RFC5245 compatibility mode is used for a non-reliable agent, then ICE-UDP will be used with higher priority and ICE-TCP will also be used when the UDP connectivity fails. If it is used with a reliable agent, then ICE-UDP will be used with the TCP-Over-UDP (#PseudoTcpSocket) if ICE-TCP fails and ICE-UDP succeeds. </para> </note> Use compatibility with the RFC5245 ICE-UDP specs and RFC6544 ICE-TCP specs Use compatibility for ICE Draft 19 specs Use compatibility for Google Talk specs Use compatibility for MSN Messenger specs Use compatibility with Windows Live Messenger 2009 Use compatibility with Microsoft Office Communicator 2007 Use compatibility with Microsoft Office Communicator 2007 R2 Dummy last compatibility mode An enum representing the state of a component. <para> See also: #NiceAgent::component-state-changed </para> No activity scheduled Gathering local candidates Establishing connectivity At least one working candidate pair ICE concluded, candidate pair selection is now final Connectivity checks have been completed, but connectivity was not established Dummy state Convenience enum representing the type of a component for use as the component_id for RTP/RTCP usages. <example> <title>Example of use.</title> <programlisting> nice_agent_send (agent, stream_id, NICE_COMPONENT_TYPE_RTP, len, buf); </programlisting> </example> RTP Component type RTCP Component type Represents a single message received off the network. For reliable connections, this is essentially just an array of buffers (specifically, @from can be ignored). for non-reliable connections, it represents a single packet as received from the OS. @n_buffers may be -1 to indicate that @buffers is terminated by a #GInputVector with a %NULL buffer pointer. By providing arrays of #NiceInputMessages to functions like nice_agent_recv_messages(), multiple messages may be received with a single call, which is more efficient than making multiple calls in a loop. In this manner, nice_agent_recv_messages() is analogous to recvmmsg(); and #NiceInputMessage to struct mmsghdr. unowned array of #GInputVector buffers to store data in for this message number of #GInputVectors in @buffers, or -1 to indicate @buffers is %NULL-terminated return location to store the address of the peer who transmitted the message, or %NULL total number of valid bytes contiguously stored in @buffers An enum to specity the kind of nomination mode to use by the agent, as described in RFC 5245. Two modes exists, regular and aggressive. They differ by the way the controlling agent chooses to put the USE-CANDIDATE attribute in its STUN messages. The aggressive mode is supposed to nominate a pair faster, than the regular mode, potentially causing the nominated pair to change until the connection check completes. Regular nomination mode Aggressive nomination mode Represents a single message to transmit on the network. For reliable connections, this is essentially just an array of buffer. for non-reliable connections, it represents a single packet to send to the OS. @n_buffers may be -1 to indicate that @buffers is terminated by a #GOutputVector with a %NULL buffer pointer. By providing arrays of #NiceOutputMessages to functions like nice_agent_send_messages_nonblocking(), multiple messages may be transmitted with a single call, which is more efficient than making multiple calls in a loop. In this manner, nice_agent_send_messages_nonblocking() is analogous to sendmmsg(); and #NiceOutputMessage to struct mmsghdr. unowned array of #GOutputVector buffers which contain data to transmit for this message number of #GOutputVectors in @buffers, or -1 to indicate @buffers is %NULL-terminated An enum to specify which proxy type to use for relaying. Note that the proxies will only be used with TCP TURN relaying. <para> See also: #NiceAgent:proxy-type </para> Do not use a proxy Use a SOCKS5 proxy Use an HTTP proxy Dummy last proxy type A structure containing callbacks functions that will be called by the #PseudoTcpSocket when some events happen. <para> See also: #PseudoTcpWriteResult </para> A user defined pointer to be passed to the callbacks The #PseudoTcpSocket is now connected The socket is readable The socket is writable The socket was closed (both sides) This callback is called when the socket needs to send data. Valid values of debug levels to be set. Disable debug messages Enable basic debug messages Enable verbose debug messages Options for which parts of a connection to shut down when calling pseudo_tcp_socket_shutdown(). These correspond to the values passed to POSIX shutdown(). Shut down the local reader only Shut down the local writer only Shut down both reading and writing The #PseudoTcpSocket is the GObject implementing the Pseudo TCP Socket Creates a new #PseudoTcpSocket for the specified conversation <note> <para> The @callbacks must be non-NULL, in order to get notified of packets the socket needs to send. </para> <para> If the @callbacks structure was dynamicly allocated, it can be freed after the call @pseudo_tcp_socket_new </para> </note> The new #PseudoTcpSocket object, %NULL on error The conversation id for the socket. A pointer to the #PseudoTcpCallbacks structure for getting notified of the #PseudoTcpSocket events. Returns if there is space in the send buffer to send any data. %TRUE if data can be sent, %FALSE otherwise The #PseudoTcpSocket object. Close the socket for sending. If @force is set to %FALSE, the socket will finish sending pending data before closing. If it is set to %TRUE, the socket will discard pending data and close the connection immediately (sending a TCP RST segment). The socket will be closed in both directions – sending and receiving – and any pending received data must be read before calling this function, by calling pseudo_tcp_socket_recv() until it blocks. If any pending data is in the receive buffer when pseudo_tcp_socket_close() is called, a TCP RST segment will be sent to the peer to notify it of the data loss. <note> <para> The %PseudoTcpCallbacks:PseudoTcpClosed callback will not be called once the socket gets closed. It is only used for aborted connection. Instead, the socket gets closed when the pseudo_tcp_socket_get_next_clock() function returns FALSE. </para> </note> <para> See also: pseudo_tcp_socket_get_next_clock() </para> The #PseudoTcpSocket object. %TRUE to close the socket forcefully, %FALSE to close it gracefully Connects the #PseudoTcpSocket to the peer with the same conversation id. The connection will only be successful after the %PseudoTcpCallbacks:PseudoTcpOpened callback is called %TRUE on success, %FALSE on failure (not in %TCP_LISTEN state) <para> See also: pseudo_tcp_socket_get_error() </para> The #PseudoTcpSocket object. Gets the number of bytes of data in the buffer that can be read without receiving more packets from the network. The number of bytes or -1 if the connection is not established The #PseudoTcpSocket object. Gets the number of bytes of space available in the transmission buffer. The number of bytes, or 0 if the connection is not established. The #PseudoTcpSocket object. Return the last encountered error. <note> <para> The return value can be : <para> EINVAL (for pseudo_tcp_socket_connect()). </para> <para> EWOULDBLOCK or ENOTCONN (for pseudo_tcp_socket_recv() and pseudo_tcp_socket_send()). </para> </para> </note> The error code <para> See also: pseudo_tcp_socket_connect() </para> <para> See also: pseudo_tcp_socket_recv() </para> <para> See also: pseudo_tcp_socket_send() </para> The #PseudoTcpSocket object. Call this to determine the timeout needed before the next time call to pseudo_tcp_socket_notify_clock() should be made. %TRUE if @timeout was filled, %FALSE if the socket is closed and ready to be destroyed. <para> See also: pseudo_tcp_socket_notify_clock() </para> The #PseudoTcpSocket object. A pointer to be filled with the new timeout. Gets whether the socket is closed, with the shutdown handshake completed, and both peers no longer able to read or write data to the connection. %TRUE if the socket is closed in both directions, %FALSE otherwise The #PseudoTcpSocket object. Gets whether the socket has been closed on the remote peer’s side of the connection (i.e. whether pseudo_tcp_socket_close() has been called there). This is guaranteed to return %TRUE if pseudo_tcp_socket_is_closed() returns %TRUE. It will not return %TRUE after pseudo_tcp_socket_close() is called until a FIN segment is received from the remote peer. %TRUE if the remote peer has closed its side of the connection, %FALSE otherwise The #PseudoTcpSocket object. Start the processing of receiving data, pending data or syn/acks. Call this based on timeout value returned by pseudo_tcp_socket_get_next_clock(). It's ok to call this too frequently. <para> See also: pseudo_tcp_socket_get_next_clock() </para> The #PseudoTcpSocket object. Notify the #PseudoTcpSocket that a new message has arrived, and enqueue the data in its buffers to the #PseudoTcpSocket’s receive buffer. %TRUE if the packet was processed successfully, %FALSE otherwise The #PseudoTcpSocket object. A #NiceInputMessage containing the received data. Set the MTU of the socket The #PseudoTcpSocket object. The new MTU of the socket Notify the #PseudoTcpSocket when a new packet arrives %TRUE if the packet was processed successfully, %FALSE otherwise The #PseudoTcpSocket object. The buffer containing the received data The length of @buffer Receive data from the socket. <note> <para> Only call this on the %PseudoTcpCallbacks:PseudoTcpReadable callback. </para> <para> This function should be called in a loop. If this function does not return -1 with EWOULDBLOCK as the error, the %PseudoTcpCallbacks:PseudoTcpReadable callback will not be called again. </para> </note> The number of bytes received or -1 in case of error <para> See also: pseudo_tcp_socket_get_error() </para> The #PseudoTcpSocket object. The buffer to fill with received data The length of @buffer Send data on the socket. <note> <para> If this function return -1 with EWOULDBLOCK as the error, or if the return value is lower than @len, then the %PseudoTcpCallbacks:PseudoTcpWritable callback will be called when the socket will become writable. </para> </note> The number of bytes sent or -1 in case of error <para> See also: pseudo_tcp_socket_get_error() </para> The #PseudoTcpSocket object. The buffer with data to send The length of @buffer Sets the current monotonic time to be used by the TCP socket when calculating timeouts and expiry times. If this function is not called, or is called with @current_time as zero, g_get_monotonic_time() will be used. Otherwise, the specified @current_time will be used until it is updated by calling this function again. This function is intended for testing only, and should not be used in production code. The #PseudoTcpSocket object. Current monotonic time, in milliseconds; or zero to use the system monotonic clock. Shut down sending, receiving, or both on the socket, depending on the value of @how. The behaviour of pseudo_tcp_socket_send() and pseudo_tcp_socket_recv() will immediately change after this function returns (depending on the value of @how), though the socket may continue to process network traffic in the background even if sending or receiving data is forbidden. This is equivalent to the POSIX shutdown() function. Setting @how to %PSEUDO_TCP_SHUTDOWN_RDWR is equivalent to calling pseudo_tcp_socket_close(). The #PseudoTcpSocket object. The directions of the connection to shut down. Whether to support the FIN–ACK extension to the pseudo-TCP protocol for this socket. The extension is only compatible with other libnice pseudo-TCP stacks, and not with Jingle pseudo-TCP stacks. If enabled, support is negotiatied on connection setup, so it is safe for a #PseudoTcpSocket with support enabled to be used with one with it disabled, or with a Jingle pseudo-TCP socket which doesn’t support it at all. Support is enabled by default. An enum representing the state of the #PseudoTcpSocket. These states correspond to the TCP states in RFC 793. <para> See also: #PseudoTcpSocket:state </para> The socket's initial state. The socket isn't connected and is listening for an incoming connection The socket has sent a connection request (SYN) packet and is waiting for an answer The socket has received a connection request (SYN) packet. The socket is connected The socket has been closed The socket has been closed locally but not remotely (Since: 0.1.8) The socket has been closed locally but not remotely (Since: 0.1.8) The socket has been closed locally and remotely (Since: 0.1.8) The socket has been closed locally and remotely (Since: 0.1.8) The socket has been closed remotely but not locally (Since: 0.1.8) The socket has been closed locally and remotely (Since: 0.1.8) An enum representing the result value of the write operation requested by the #PseudoTcpSocket. <para> See also: %PseudoTcpCallbacks:WritePacket </para> The write operation was successful The socket type requires that message be sent atomically and the size of the message to be sent made this impossible. There was an error sending the message An enum representing the type of relay to use A TURN relay using UDP A TURN relay using TCP A TURN relay using TLS over TCP The #NiceAddress structure will allow you to easily set/get and modify an IPv4 or IPv6 address in order to communicate with the #NiceAgent. The #NiceAgent is your main object when using libnice. It is the agent that will take care of everything relating to ICE. It will take care of discovering your local candidates and do connectivity checks to create a stream of data between you and your peer. A #NiceAgent must always be used with a #GMainLoop running the #GMainContext passed into nice_agent_new() (or nice_agent_new_reliable()). Without the #GMainContext being iterated, the agent’s timers will not fire, etc. Streams and their components are referenced by integer IDs (with respect to a given #NiceAgent). These IDs are guaranteed to be positive (i.e. non-zero) for valid streams/components. To complete the ICE connectivity checks, the user must either register an I/O callback (with nice_agent_attach_recv()) or call nice_agent_recv_messages() in a loop on a dedicated thread. Technically, #NiceAgent does not poll the streams on its own, since user data could arrive at any time; to receive STUN packets required for establishing ICE connectivity, it is backpiggying on the facility chosen by the user. #NiceAgent will handle all STUN packets internally; they're never actually passed to the I/O callback or returned from nice_agent_recv_messages() and related functions. Each stream can receive data in one of two ways: using nice_agent_attach_recv() or nice_agent_recv_messages() (and the derived #NiceInputStream and #NiceIOStream classes accessible using nice_agent_get_io_stream()). nice_agent_attach_recv() is non-blocking: it takes a user-provided callback function and attaches the stream’s socket to the provided #GMainContext, invoking the callback in that context for every packet received. nice_agent_recv_messages() instead blocks on receiving a packet, and writes it directly into a user-provided buffer. This reduces the number of callback invokations and (potentially) buffer copies required to receive packets. nice_agent_recv_messages() (or #NiceInputStream) is designed to be used in a blocking loop in a separate thread. <example> <title>Simple example on how to use libnice</title> <programlisting> guint stream_id; gchar buffer[] = "hello world!"; gchar *ufrag = NULL, *pwd = NULL; gchar *remote_ufrag, *remote_pwd; GSList *lcands = NULL; // Create a nice agent, passing in the global default GMainContext. NiceAgent *agent = nice_agent_new (NULL, NICE_COMPATIBILITY_RFC5245); spawn_thread_to_run_main_loop (g_main_loop_new (NULL, FALSE)); // Connect the signals g_signal_connect (G_OBJECT (agent), "candidate-gathering-done", G_CALLBACK (cb_candidate_gathering_done), NULL); g_signal_connect (G_OBJECT (agent), "component-state-changed", G_CALLBACK (cb_component_state_changed), NULL); g_signal_connect (G_OBJECT (agent), "new-selected-pair", G_CALLBACK (cb_new_selected_pair), NULL); // Create a new stream with one component and start gathering candidates stream_id = nice_agent_add_stream (agent, 1); nice_agent_gather_candidates (agent, stream_id); // Attach I/O callback the component to ensure that: // 1) agent gets its STUN packets (not delivered to cb_nice_recv) // 2) you get your own data nice_agent_attach_recv (agent, stream_id, 1, NULL, cb_nice_recv, NULL); // ... Wait until the signal candidate-gathering-done is fired ... lcands = nice_agent_get_local_candidates(agent, stream_id, 1); nice_agent_get_local_credentials(agent, stream_id, &ufrag, &pwd); // ... Send local candidates and credentials to the peer // Set the peer's remote credentials and remote candidates nice_agent_set_remote_credentials (agent, stream_id, remote_ufrag, remote_pwd); nice_agent_set_remote_candidates (agent, stream_id, 1, rcands); // ... Wait until the signal new-selected-pair is fired ... // Send our message! nice_agent_send (agent, stream_id, 1, sizeof(buffer), buffer); // Anything received will be received through the cb_nice_recv callback. // You must be running a GMainLoop on the global default GMainContext in // another thread for this to work. // Destroy the object g_object_unref(agent); </programlisting> </example> Refer to the examples in the examples/ subdirectory of the libnice source for more complete examples. A representation of an ICE candidate. Make sure you read the ICE drafts[1] to understand correctly the concept of ICE candidates. [1] http://tools.ietf.org/wg/mmusic/draft-ietf-mmusic-ice/ Useful for debugging functions, just returns a static string with the candidate transport. a static string with the candidate transport a #NiceCandidateTransport Useful for debugging functions, just returns a static string with the candidate type. a static string with the candidate type a #NiceCandidateType Returns a string representation of the state, generally to use in debug messages. a string representation of @state a #NiceComponentState <para>Libnice can output a lot of information when debug messages are enabled. 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_enable() or nice_debug_disable() and choosing whether you want only ICE debug messages or also stun debug messages.</para> <para>By default, the debug messages are disabled, unless the environment variable NICE_DEBUG is set, in which case, it must contain a comma separated 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 without having verbose messages from pseudotcp. You can enable verbose debug messages 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> Disables libnice debug output to the terminal Also disable stun debugging messages Enables libnice debug output to the terminal. Note that the `G_MESSAGES_DEBUG` and `NICE_DEBUG` environment variables must be set to the set of logging domains to print, in order for any output to be printed. Set them to `all` to print all debugging messages, or any of the following domains: - `libnice-stun` - `libnice-tests` - `libnice-socket` - `libnice` - `libnice-pseudotcp` - `libnice-pseudotcp-verbose` Also enable STUN debugging messages These utility functions allow the discovery of local network interfaces in a portable manner, they also allow finding the local ip addresses or the address allocated to a network interface. Returns the interface index match the local address passed. This can by used for APIs that need a specific address. The interface index or 0 on error A #NiceAddress for a local interface Retrieves the IP address of an interface by its name. If this fails, %NULL is returned. a newly-allocated string with the IP address name of local interface Get the list of local interfaces a newly-allocated #GList of strings. The caller must free it. Get a list of local ipv4 interface addresses a newly-allocated #GList of strings. The caller must free it. Include any loopback devices Sets the debug level to enable/disable normal/verbose debug messages. The level of debug to set The #PseudoTcpSocket is an object implementing a Pseudo Tcp Socket for use over UDP. The socket will implement a subset of the TCP stack to allow for a reliable transport over non-reliable sockets (such as UDP). See the file tests/test-pseudotcp.c in the source package for an example of how to use the object.