Commit 11073352 authored by Youness Alaoui's avatar Youness Alaoui

Adding a nice_agent_set_software API

parent 27c22fb8
...@@ -119,6 +119,7 @@ struct _NiceAgent ...@@ -119,6 +119,7 @@ struct _NiceAgent
GSList *upnp_mapping; /* list of Candidates being mapped */ GSList *upnp_mapping; /* list of Candidates being mapped */
GSource *upnp_timer_source; /* source of upnp timeout timer */ GSource *upnp_timer_source; /* source of upnp timeout timer */
#endif #endif
gchar *software_attribute; /* SOFTWARE attribute */
/* XXX: add pointer to internal data struct for ABI-safe extensions */ /* XXX: add pointer to internal data struct for ABI-safe extensions */
}; };
......
...@@ -553,6 +553,7 @@ nice_agent_init (NiceAgent *agent) ...@@ -553,6 +553,7 @@ nice_agent_init (NiceAgent *agent)
agent->keepalive_timer_source = NULL; agent->keepalive_timer_source = NULL;
agent->refresh_list = NULL; agent->refresh_list = NULL;
agent->media_after_tick = FALSE; agent->media_after_tick = FALSE;
agent->software_attribute = NULL;
agent->compatibility = NICE_COMPATIBILITY_DRAFT19; agent->compatibility = NICE_COMPATIBILITY_DRAFT19;
...@@ -702,6 +703,7 @@ nice_agent_set_property ( ...@@ -702,6 +703,7 @@ nice_agent_set_property (
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS | STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS |
STUN_AGENT_USAGE_USE_FINGERPRINT); STUN_AGENT_USAGE_USE_FINGERPRINT);
} }
stun_agent_set_software (&agent->stun_agent, agent->software_attribute);
break; break;
...@@ -1055,6 +1057,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent, ...@@ -1055,6 +1057,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
STUN_AGENT_USAGE_ADD_SOFTWARE | STUN_AGENT_USAGE_ADD_SOFTWARE |
STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS); STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS);
} }
stun_agent_set_software (&cdisco->stun_agent, agent->software_attribute);
nice_debug ("Agent %p : Adding new relay-rflx candidate discovery %p\n", nice_debug ("Agent %p : Adding new relay-rflx candidate discovery %p\n",
agent, cdisco); agent, cdisco);
...@@ -2369,3 +2372,17 @@ void nice_agent_set_stream_tos (NiceAgent *agent, ...@@ -2369,3 +2372,17 @@ void nice_agent_set_stream_tos (NiceAgent *agent,
agent_unlock(); agent_unlock();
} }
void nice_agent_set_software (NiceAgent *agent, gchar *software)
{
agent_lock();
g_free (agent->software_attribute);
if (software)
agent->software_attribute = g_strdup_printf ("%s/%s",
software, PACKAGE_STRING);
stun_agent_set_software (&agent->stun_agent, agent->software_attribute);
agent_unlock ();
}
...@@ -636,6 +636,32 @@ void nice_agent_set_stream_tos ( ...@@ -636,6 +636,32 @@ void nice_agent_set_stream_tos (
gint tos); gint tos);
/**
* nice_agent_set_software:
* @agent: The #NiceAgent Object
* @software: The value of the SOFTWARE attribute to add.
*
* This function will set the value of the SOFTWARE attribute to be added to
* STUN requests, responses and error responses sent during connectivity checks.
* <para>
* The SOFTWARE attribute will only be added in the #NICE_COMPATIBILITY_DRAFT19
* and #NICE_COMPATIBILITY_WLM2009 compatibility modes.
* </para>
* <note>
<para>
The @software argument will be appended with the libnice version before
being sent.
</para>
<para>
The @software argument must be in UTF-8 encoding and only the first
128 characters will be sent.
</para>
</note>
*
*/
void nice_agent_set_software (NiceAgent *agent, gchar *software);
G_END_DECLS G_END_DECLS
#endif /* _AGENT_H */ #endif /* _AGENT_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