Skip to content
Snippets Groups Projects
Commit 31f73110 authored by Youness Alaoui's avatar Youness Alaoui
Browse files

Add pseudotcp and pseudotcp-verbose flags to the NICE_DEBUG env var to enable...

Add pseudotcp and pseudotcp-verbose flags to the NICE_DEBUG env var to enable debug messages from pseudotcp socket too. And update the docs
parent 76dd8782
No related branches found
No related tags found
No related merge requests found
......@@ -41,16 +41,20 @@
#include "debug.h"
#include "stunagent.h"
#include "pseudotcp.h"
static int debug_enabled = 0;
#define NICE_DEBUG_STUN 1
#define NICE_DEBUG_NICE 2
#define NICE_DEBUG_PSEUDOTCP 4
#define NICE_DEBUG_PSEUDOTCP_VERBOSE 8
static const GDebugKey keys[] = {
{ (gchar *)"stun", NICE_DEBUG_STUN },
{ (gchar *)"nice", NICE_DEBUG_NICE },
{ (gchar *)"pseudotcp", NICE_DEBUG_PSEUDOTCP },
{ (gchar *)"pseudotcp-verbose", NICE_DEBUG_PSEUDOTCP_VERBOSE },
{ NULL, 0},
};
......@@ -65,13 +69,21 @@ void nice_debug_init ()
nice_debug_disable (TRUE);
if (flags_string != NULL) {
flags = g_parse_debug_string (flags_string, keys, 2);
flags = g_parse_debug_string (flags_string, keys, 4);
if (flags & NICE_DEBUG_NICE)
nice_debug_enable (FALSE);
if (flags & NICE_DEBUG_STUN)
stun_debug_enable ();
/* Set verbose before normal so that if we use 'all', then only
normal debug is enabled, we'd need to set pseudotcp-verbose without the
pseudotcp flag in order to actually enable verbose pseudotcp */
if (flags & NICE_DEBUG_PSEUDOTCP_VERBOSE)
pseudo_tcp_set_debug_level (PSEUDO_TCP_DEBUG_VERBOSE);
if (flags & NICE_DEBUG_PSEUDOTCP)
pseudo_tcp_set_debug_level (PSEUDO_TCP_DEBUG_NORMAL);
}
}
......
......@@ -41,19 +41,31 @@
/**
* SECTION:debug
* @short_description: Debug messages utility functions
* @stability: More flags are to come and a better API to
* enable/disable each flag should be added. Unstable
* @stability: Unstable
*
* Libnice can output a lot of information when debug messages are enabled.
* <para>Libnice can output a lot of information when debug messages are enabled.
* This can significantly help track down problems and/or understand what
* it's doing.
* You can enable/disable the debug messages by calling nice_debug_enable()
* it's doing.</para>
*
* <para>You can enable/disable the debug messages by calling nice_debug_enable()
* or nice_debug_disable() and choosing whether you want only ICE debug messages
* or also stun debug messages.
* By default, the debug messages are disabled, unless the environment variable
* NICE_DEBUG is set, in which case, it must contain a comma separated list of
* flags specifying which debug to enable. The flags can be "nice", "stun",
* or "all" to enable all debug messages.
* or also stun debug messages.</para>
*
* <para>By default, the debug messages are disabled, unless the environment
* variable NICE_DEBUG is set, in which case, it must contain a comma separated
* list of flags specifying which debug to enable.</para>
* <para> The currently available flags are "nice", "stun", "pseudotcp",
* "pseudotcp-verbose" or "all" to enable all debug messages.</para>
* <para> If the 'pseudotcp' flag is enabled, then 'pseudotcp-verbose' gets
* automatically disabled. This is to allow the use of the 'all' flag without
* having verbose messages from pseudotcp. You can enable verbose debug messages
* from the pseudotcp layer by specifying 'pseudotcp-verbose' without the
* 'pseudotcp' flag.</para>
*
*
* <para>This API is unstable and is subject to change at any time...
* More flags are to come and a better API to enable/disable each flag
* should be added.</para>
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment