From c95c57e2069473825935defdbf02d2831c1979f6 Mon Sep 17 00:00:00 2001 From: Olivier CrĂȘte Date: Sun, 5 Oct 2014 13:34:22 -0400 Subject: agent: Add function to retrieve the current component state --- agent/agent.c | 17 +++++++++++++++++ agent/agent.h | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) (limited to 'agent') diff --git a/agent/agent.c b/agent/agent.c index a11f55b..d17f3d2 100644 --- a/agent/agent.c +++ b/agent/agent.c @@ -5866,3 +5866,20 @@ agent_socket_send (NiceSocket *sock, const NiceAddress *addr, gsize len, return ret; } } + +NiceComponentState +nice_agent_get_component_state (NiceAgent *agent, + guint stream_id, guint component_id) +{ + NiceComponentState state = NICE_COMPONENT_STATE_FAILED; + Component *component; + + agent_lock (); + + if (agent_find_component (agent, stream_id, component_id, NULL, &component)) + state = component->state; + + agent_unlock (); + + return state; +} diff --git a/agent/agent.h b/agent/agent.h index da59b45..501933f 100644 --- a/agent/agent.h +++ b/agent/agent.h @@ -1487,6 +1487,24 @@ nice_agent_forget_relays (NiceAgent *agent, guint stream_id, guint component_id); +/** + * nice_agent_get_component_state: + * @agent: The #NiceAgent Object + * @stream_id: The ID of the stream + * @component_id: The ID of the component + * + * Retrieves the current state of a component. + * + * Returns: the #NiceComponentState of the component and + * %NICE_COMPONENT_STATE_FAILED if the component was invalid. + * + * Since: 0.1.7 + */ +NiceComponentState +nice_agent_get_component_state (NiceAgent *agent, + guint stream_id, + guint component_id); + G_END_DECLS #endif /* _AGENT_H */ -- cgit v1.2.3