Commit bf978f30 authored by Philippe Normand's avatar Philippe Normand Committed by Olivier Crête

candidate: Add utility function to get TURN relay address

Can be useful to know which TURN server is being used as relay server for a given candidate.
parent 41ac7386
......@@ -463,3 +463,14 @@ nice_candidate_transport_to_string (NiceCandidateTransport transport)
g_assert_not_reached ();
}
}
NICEAPI_EXPORT void
nice_candidate_relay_address (const NiceCandidate *candidate, NiceAddress *addr)
{
const NiceCandidateImpl *c = (NiceCandidateImpl *) candidate;
g_return_if_fail (candidate != NULL);
g_return_if_fail (candidate->type != NICE_CANDIDATE_TYPE_RELAYED);
*addr = c->turn->server;
}
......@@ -40,6 +40,7 @@
#ifndef __LIBNICE_CANDIDATE_H__
#define __LIBNICE_CANDIDATE_H__
#include "address.h"
#include <glib.h>
#include <glib-object.h>
......@@ -254,6 +255,18 @@ nice_candidate_type_to_string (NiceCandidateType type);
const gchar *
nice_candidate_transport_to_string (NiceCandidateTransport transport);
/**
* nice_candidate_relay_address:
* @candidate: A relay candidate
* @addr: The #NiceAddress to fill
*
* In case the given candidate is relayed through a TURN server, use this utility function to get
* its address.
*
* Since: 0.1.19
*/
void
nice_candidate_relay_address (const NiceCandidate *candidate, NiceAddress *addr);
/**
* NICE_TYPE_CANDIDATE:
......
......@@ -99,6 +99,7 @@ nice_candidate_copy
nice_candidate_equal_target
nice_candidate_transport_to_string
nice_candidate_type_to_string
nice_candidate_relay_address
<SUBSECTION Standard>
NICE_TYPE_CANDIDATE
nice_candidate_get_type
......
......@@ -72,6 +72,7 @@ nice_candidate_transport_get_type
nice_candidate_transport_to_string
nice_candidate_type_get_type
nice_candidate_type_to_string
nice_candidate_relay_address
nice_compatibility_get_type
nice_component_state_get_type
nice_component_state_to_string
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment