Commit 8d4a4929 authored by Olivier Crête's avatar Olivier Crête

Add function to copy candidates

parent 6d178168
......@@ -45,6 +45,8 @@
# include <config.h>
#endif
#include <string.h>
#include "agent.h"
#include "component.h"
......@@ -165,3 +167,19 @@ nice_candidate_pair_priority (guint32 o_prio, guint32 a_prio)
return ((guint64)1 << 32) * min + 2 * max + (o_prio > a_prio ? 1 : 0);
}
/**
* Copies a candidate
*/
NICEAPI_EXPORT NiceCandidate *
nice_candidate_copy (const NiceCandidate *candidate)
{
NiceCandidate *copy = nice_candidate_new (candidate->type);
memcpy (copy, candidate, sizeof(NiceCandidate));
copy->username = g_strdup (copy->username);
copy->password = g_strdup (copy->password);
return copy;
}
......@@ -103,6 +103,9 @@ nice_candidate_ice_priority (const NiceCandidate *candidate);
guint64
nice_candidate_pair_priority (guint32 o_prio, guint32 a_prio);
NiceCandidate *
nice_candidate_copy (const NiceCandidate *candidate);
G_END_DECLS
#endif /* _CANDIDATE_H */
......
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