Navigation


Changeset 501:e5f06199cee7 in freeDiameter


Ignore:
Timestamp:
Aug 18, 2010, 6:13:09 PM (14 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

New command-line option to enable GNUTLS debugging

File:
1 edited

Legend:

Unmodified
Added
Removed
  • freeDiameter/main.c

    r453 r501  
    180180}
    181181
     182/* gnutls debug */
     183static void fd_gnutls_debug(int level, const char * str) {
     184        fd_log_debug(" [gnutls:%d] %s", level, str);
     185}
     186
    182187/* Parse the command-line */
    183188static int main_cmdline(int argc, char *argv[])
     
    196201                { "dbg_func",   required_argument,      NULL, 'f' },
    197202                { "dbg_file",   required_argument,      NULL, 'F' },
     203                { "dbg_gnutls", required_argument,      NULL, 'g' },
    198204                { NULL,         0,                      NULL, 0 }
    199205        };
     
    247253                                #ifdef DEBUG
    248254                                fd_debug_one_file = basename(optarg);
     255                                #else /* DEBUG */
     256                                TRACE_DEBUG(INFO, "Error: must compile with DEBUG support to use this feature");
     257                                return EINVAL;
     258                                #endif /* DEBUG */
     259                                break;
     260                               
     261                        case 'g':       /* Full debug for the function with this name.  */
     262                                #ifdef DEBUG
     263                                {
     264                                        int l = (int)atoi(optarg);
     265                                        if (l) {
     266                                                gnutls_global_set_log_function((gnutls_log_func)fd_gnutls_debug);
     267                                                gnutls_global_set_log_level (l);
     268                                                TRACE_DEBUG(INFO, "Enabled GNUTLS debug at level %d", l);
     269                                        }
     270                                }
    249271                                #else /* DEBUG */
    250272                                TRACE_DEBUG(INFO, "Error: must compile with DEBUG support to use this feature");
Note: See TracChangeset for help on using the changeset viewer.