Commit daa1b9f0 authored by Dafydd Harries's avatar Dafydd Harries

add stream/component/username/password to nice_agent_remote_candidate_new

darcs-hash:20070131162228-c9803-412321b4b6209009c7f9d3d1de64fe82a035235e.gz
parent ea3cbb5f
......@@ -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);
......
......@@ -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,
......
#include <string.h>
#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);
......
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