summaryrefslogtreecommitdiff
path: root/agent
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2017-04-04 14:41:51 -0400
committerOlivier CrĂȘte <olivier.crete@collabora.com>2017-04-11 17:50:40 -0400
commit1e9e28dbc98b4f6a7cf4bda0ca73b5abc2735ddc (patch)
tree2327d6b3d07268bfeb3052849201c636bcbf1955 /agent
parent10c557f23f8337f1304fff27bd85d2eb713cb249 (diff)
downloadlibnice-1e9e28dbc98b4f6a7cf4bda0ca73b5abc2735ddc.tar.gz
candidate: Add equality check function
Add a function that can check if two candidates point to the same place. https://phabricator.freedesktop.org/T104 Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk> Differential Revision: https://phabricator.freedesktop.org/D1715
Diffstat (limited to 'agent')
-rw-r--r--agent/candidate.c11
-rw-r--r--agent/candidate.h18
2 files changed, 28 insertions, 1 deletions
diff --git a/agent/candidate.c b/agent/candidate.c
index 27966ef..85f8f65 100644
--- a/agent/candidate.c
+++ b/agent/candidate.c
@@ -360,3 +360,14 @@ nice_candidate_copy (const NiceCandidate *candidate)
return copy;
}
+
+NICEAPI_EXPORT gboolean
+nice_candidate_equal_target (const NiceCandidate *candidate1,
+ const NiceCandidate *candidate2)
+{
+ g_return_val_if_fail (candidate1 != NULL, FALSE);
+ g_return_val_if_fail (candidate2 != NULL, FALSE);
+
+ return (candidate1->transport == candidate2->transport &&
+ nice_address_equal (&candidate1->addr, &candidate2->addr));
+}
diff --git a/agent/candidate.h b/agent/candidate.h
index fadfce3..e556c16 100644
--- a/agent/candidate.h
+++ b/agent/candidate.h
@@ -230,7 +230,23 @@ nice_candidate_free (NiceCandidate *candidate);
NiceCandidate *
nice_candidate_copy (const NiceCandidate *candidate);
-GType nice_candidate_get_type (void);
+/**
+ * nice_candidate_equal_target:
+ * @candidate1: A candidate
+ * @candidate2: A candidate
+ *
+ * Verifies that the candidates point to the same place, meaning they have
+ * the same transport and the same address. It ignores all other aspects.
+ *
+ * Returns: %TRUE if the candidates point to the same place
+ *
+ * Since: 0.1.15
+ */
+gboolean
+nice_candidate_equal_target (const NiceCandidate *candidate1,
+ const NiceCandidate *candidate2);
+
+ GType nice_candidate_get_type (void);
/**
* NICE_TYPE_CANDIDATE: