Commit 4a1a0b47 authored by Youness Alaoui's avatar Youness Alaoui

Add API to enable/disable debug from libstun

parent 53cccf94
......@@ -1199,6 +1199,10 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
agent->tie_breaker,
priv_agent_to_usage_compatibility (agent));
if (agent->compatibility == NICE_COMPATIBILITY_MSN) {
g_free (password);
}
stun_timer_start (&pair->timer);
/* send the conncheck */
......@@ -1787,6 +1791,9 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
valid = stun_agent_validate (&agent->stun_agent, &req, (uint8_t *) buf, len,
stun_agent_default_validater, validater_data);
if (agent->compatibility == NICE_COMPATIBILITY_MSN) {
g_free (validater_data[0].password);
}
if (valid == STUN_VALIDATION_NOT_STUN ||
valid == STUN_VALIDATION_INCOMPLETE_STUN ||
......@@ -1885,6 +1892,10 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
&control, agent->tie_breaker,
priv_agent_to_usage_compatibility (agent));
if (agent->compatibility == NICE_COMPATIBILITY_MSN) {
g_free (req.key);
}
if (res == EACCES)
priv_check_for_role_conflict (agent, control);
......
......@@ -131,12 +131,23 @@ uint16_t stun_getw (const uint8_t *ptr)
/* return stun_find_unknown (msg, &dummy, 1); */
/* } */
static int debug_enabled = 0;
void stun_debug_enable (void) {
debug_enabled = 1;
}
void stun_debug_disable (void) {
debug_enabled = 0;
}
void stun_debug (const char *fmt, ...)
{
va_list ap;
if (debug_enabled) {
va_start (ap, fmt);
vfprintf (stderr, fmt, ap);
va_end (ap);
}
}
void stun_debug_bytes (const void *data, size_t len)
......
......@@ -58,8 +58,9 @@ size_t stun_align (size_t l);
uint16_t stun_getw (const uint8_t *ptr);
void stun_debug_enable (void);
void stun_debug_disable (void);
void stun_debug (const char *fmt, ...);
void stun_debug_bytes (const void *data, size_t len);
int stun_xor_address (const StunMessage *msg,
......
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