Mercurial > hg > freeDiameter
changeset 501:e5f06199cee7
New command-line option to enable GNUTLS debugging
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Wed, 18 Aug 2010 18:13:09 +0900 |
parents | d4fc98a3b79c |
children | a9a938287b49 |
files | freeDiameter/main.c |
diffstat | 1 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/freeDiameter/main.c Tue Aug 17 16:35:19 2010 +0900 +++ b/freeDiameter/main.c Wed Aug 18 18:13:09 2010 +0900 @@ -179,6 +179,11 @@ return ret; } +/* gnutls debug */ +static void fd_gnutls_debug(int level, const char * str) { + fd_log_debug(" [gnutls:%d] %s", level, str); +} + /* Parse the command-line */ static int main_cmdline(int argc, char *argv[]) { @@ -195,6 +200,7 @@ { "dbglocale", optional_argument, NULL, 'l' }, { "dbg_func", required_argument, NULL, 'f' }, { "dbg_file", required_argument, NULL, 'F' }, + { "dbg_gnutls", required_argument, NULL, 'g' }, { NULL, 0, NULL, 0 } }; @@ -252,6 +258,22 @@ #endif /* DEBUG */ break; + case 'g': /* Full debug for the function with this name. */ + #ifdef DEBUG + { + int l = (int)atoi(optarg); + if (l) { + gnutls_global_set_log_function((gnutls_log_func)fd_gnutls_debug); + gnutls_global_set_log_level (l); + TRACE_DEBUG(INFO, "Enabled GNUTLS debug at level %d", l); + } + } + #else /* DEBUG */ + TRACE_DEBUG(INFO, "Error: must compile with DEBUG support to use this feature"); + return EINVAL; + #endif /* DEBUG */ + break; + case 'q': /* Decrease verbosity then remove debug messages. */ fd_g_debug_lvl--; break;