debug.h | debug.h | |||
---|---|---|---|---|
/* | /* | |||
* This file is part of the Nice GLib ICE library. | * This file is part of the Nice GLib ICE library. | |||
* | * | |||
* (C) 2008 Collabora Ltd. | * (C) 2008-2009 Collabora Ltd. | |||
* Contact: Youness Alaoui | * Contact: Youness Alaoui | |||
* (C) 2008 Nokia Corporation. All rights reserved. | * (C) 2007 Nokia Corporation. All rights reserved. | |||
* | * | |||
* The contents of this file are subject to the Mozilla Public License Vers ion | * The contents of this file are subject to the Mozilla Public License Vers ion | |||
* 1.1 (the "License"); you may not use this file except in compliance with | * 1.1 (the "License"); you may not use this file except in compliance with | |||
* the License. You may obtain a copy of the License at | * the License. You may obtain a copy of the License at | |||
* http://www.mozilla.org/MPL/ | * http://www.mozilla.org/MPL/ | |||
* | * | |||
* Software distributed under the License is distributed on an "AS IS" basi s, | * Software distributed under the License is distributed on an "AS IS" basi s, | |||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | |||
* for the specific language governing rights and limitations under the | * for the specific language governing rights and limitations under the | |||
* License. | * License. | |||
skipping to change at line 37 | skipping to change at line 37 | |||
* the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which | * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which | |||
* case the provisions of LGPL are applicable instead of those above. If yo u | * case the provisions of LGPL are applicable instead of those above. If yo u | |||
* wish to allow use of your version of this file only under the terms of t he | * wish to allow use of your version of this file only under the terms of t he | |||
* LGPL and not to allow others to use your version of this file under the | * LGPL and not to allow others to use your version of this file under the | |||
* MPL, indicate your decision by deleting the provisions above and replace | * MPL, indicate your decision by deleting the provisions above and replace | |||
* them with the notice and other provisions required by the LGPL. If you d o | * them with the notice and other provisions required by the LGPL. If you d o | |||
* not delete the provisions above, a recipient may use your version of thi s | * not delete the provisions above, a recipient may use your version of thi s | |||
* file under either the MPL or the LGPL. | * file under either the MPL or the LGPL. | |||
*/ | */ | |||
#ifndef __LIBNICE_DEBUG_H__ | #ifndef STUN_DEBUG_H | |||
#define __LIBNICE_DEBUG_H__ | #define STUN_DEBUG_H | |||
#include <stddef.h> | ||||
#include <stdarg.h> | ||||
#ifdef __cplusplus | ||||
extern "C" { | ||||
#endif | ||||
/** | /** | |||
* SECTION:debug | * stun_debug_enable: | |||
* @short_description: Debug messages utility functions | * | |||
* @stability: Unstable | * Enable debug messages to stderr | |||
* | ||||
* <para>Libnice can output a lot of information when debug messages are en | ||||
abled. | ||||
* This can significantly help track down problems and/or understand what | ||||
* it's doing.</para> | ||||
* | ||||
* <para>You can enable/disable the debug messages by calling nice_debug_en | ||||
able() | ||||
* or nice_debug_disable() and choosing whether you want only ICE debug mes | ||||
sages | ||||
* or also stun debug messages.</para> | ||||
* | ||||
* <para>By default, the debug messages are disabled, unless the environmen | ||||
t | ||||
* variable NICE_DEBUG is set, in which case, it must contain a comma separ | ||||
ated | ||||
* 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 witho | ||||
ut | ||||
* having verbose messages from pseudotcp. You can enable verbose debug mes | ||||
sages | ||||
* 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> | ||||
*/ | */ | |||
void stun_debug_enable (void); | ||||
#include <glib.h> | /** | |||
* stun_debug_disable: | ||||
G_BEGIN_DECLS | * | |||
* Disable debug messages to stderr | ||||
*/ | ||||
void stun_debug_disable (void); | ||||
/** | /** | |||
* nice_debug_enable: | * StunDebugHandler: | |||
* @with_stun: Also enable STUN debugging messages | * @format: printf()-style debug message format string | |||
* @ap: Parameters to substitute into message placeholders | ||||
* | * | |||
* Enables libnice debug output to the terminal. Note that the | * Callback for a debug message from the STUN code. | |||
* `G_MESSAGES_DEBUG` and `NICE_DEBUG` environment variables must be set to | ||||
the | ||||
* set of logging domains to print, in order for any output to be printed. | ||||
Set | ||||
* them to `all` to print all debugging messages, or any of the following | ||||
* domains: | ||||
* - `libnice-stun` | ||||
* - `libnice-tests` | ||||
* - `libnice-socket` | ||||
* - `libnice` | ||||
* - `libnice-pseudotcp` | ||||
* - `libnice-pseudotcp-verbose` | ||||
*/ | */ | |||
void nice_debug_enable (gboolean with_stun); | #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ | |||
> 4)) | ||||
typedef void (*StunDebugHandler) (const char *format, va_list ap) | ||||
__attribute__((__format__ (__printf__, 1, 0))); | ||||
#else | ||||
typedef void (*StunDebugHandler) (const char *format, va_list ap); | ||||
#endif | ||||
/** | /** | |||
* nice_debug_disable: | * stun_set_debug_handler: | |||
* @with_stun: Also disable stun debugging messages | * @handler: (nullable): Handler for STUN debug messages, or %NULL to use t | |||
he | ||||
* default | ||||
* | ||||
* Set a callback function to be invoked for each debug message from the ST | ||||
UN | ||||
* code. The callback will only be invoked if STUN debugging is enabled usi | ||||
ng | ||||
* stun_debug_enable(). | ||||
* | * | |||
* Disables libnice debug output to the terminal | * The default callback prints the formatted debug message to stderr. | |||
*/ | */ | |||
void nice_debug_disable (gboolean with_stun); | void stun_set_debug_handler (StunDebugHandler handler); | |||
G_END_DECLS | #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ | |||
> 4)) | ||||
void stun_debug (const char *fmt, ...) | ||||
__attribute__((__format__ (__printf__, 1, 2))); | ||||
#else | ||||
void stun_debug (const char *fmt, ...); | ||||
#endif | ||||
void stun_debug_bytes (const char *prefix, const void *data, size_t len); | ||||
# ifdef __cplusplus | ||||
} | ||||
# endif | ||||
#endif /* __LIBNICE_DEBUG_H__ */ | #endif /* STUN_DEBUG_H */ | |||
End of changes. 14 change blocks. | ||||
62 lines changed or deleted | 56 lines changed or added | |||