From daa1b9f0e97a598199fe0aa6caa2c2e31cddb425 Mon Sep 17 00:00:00 2001 From: Dafydd Harries Date: Wed, 31 Jan 2007 16:22:00 +0000 Subject: add stream/component/username/password to nice_agent_remote_candidate_new darcs-hash:20070131162228-c9803-412321b4b6209009c7f9d3d1de64fe82a035235e.gz --- agent/agent.c | 24 ++++++++++++++++++++++-- agent/agent.h | 6 +++++- agent/test.c | 11 +++++++++-- 3 files changed, 36 insertions(+), 5 deletions(-) (limited to 'agent') diff --git a/agent/agent.c b/agent/agent.c index 37ce4b0..1031abe 100644 --- a/agent/agent.c +++ b/agent/agent.c @@ -287,23 +287,43 @@ nice_agent_add_local_address (NiceAgent *agent, NiceAddress *addr) */ } - +/** + * nice_agent_add_remote_candidate + * @agent: The agent + * @stream_id: The ID of the stream the candidate is for + * @candidate_id: The ID of the candidate the candidate is for + * @type: The type of the new candidate + * @addr: The new candidate's IP address + * @port: The new candidate's port + * @username: The new candidate's username + * @password: The new candidate's password + * + * Add a candidate our peer has informed us about to the agent's list. + **/ void nice_agent_add_remote_candidate ( NiceAgent *agent, + guint stream_id, + guint component_id, NiceCandidateType type, NiceAddress *addr, - guint port) + guint port, + gchar *username, + gchar *password) { /* append to agent->remote_candidates */ NiceCandidate *candidate; candidate = nice_candidate_new (type); + candidate->stream_id = stream_id; + candidate->component_id = component_id; /* do remote candidates need IDs? */ candidate->id = 0; candidate->addr = *addr; candidate->port = port; + strncpy (candidate->username, username, sizeof (candidate->username)); + strncpy (candidate->password, password, sizeof (candidate->password)); agent->remote_candidates = g_slist_append (agent->remote_candidates, candidate); diff --git a/agent/agent.h b/agent/agent.h index 1d0abe2..1eb3737 100644 --- a/agent/agent.h +++ b/agent/agent.h @@ -87,9 +87,13 @@ nice_agent_free (NiceAgent *agent); void nice_agent_add_remote_candidate ( NiceAgent *agent, + guint stream_id, + guint component_id, NiceCandidateType type, NiceAddress *addr, - guint port); + guint port, + gchar *username, + gchar *password); void nice_agent_recv ( NiceAgent *agent, diff --git a/agent/test.c b/agent/test.c index d7668d6..d4309d4 100644 --- a/agent/test.c +++ b/agent/test.c @@ -1,4 +1,6 @@ +#include + #include "udp-fake.h" #include "agent.h" @@ -56,13 +58,18 @@ main (void) g_assert (candidate->port == 1); /* add remote candidate */ - nice_agent_add_remote_candidate (agent, NICE_CANDIDATE_TYPE_HOST, - &addr_remote, 2345); + nice_agent_add_remote_candidate (agent, 1, 1, NICE_CANDIDATE_TYPE_HOST, + &addr_remote, 2345, "username", "password"); g_assert (agent->remote_candidates != NULL); g_assert (g_slist_length (agent->remote_candidates) == 1); candidate = agent->remote_candidates->data; g_assert (nice_address_equal (&(candidate->addr), &addr_remote)); g_assert (candidate->port == 2345); + g_assert (candidate->stream_id == 1); + g_assert (candidate->component_id == 1); + g_assert (candidate->type == NICE_CANDIDATE_TYPE_HOST); + g_assert (0 == strcmp (candidate->username, "username")); + g_assert (0 == strcmp (candidate->password, "password")); /* check there's no unexpected events, and clean up */ g_assert (nice_agent_pop_event (agent) == NULL); -- cgit v1.2.1