Navigation


Changeset 793:ada5366bca4e in freeDiameter for tests


Ignore:
Timestamp:
Jul 14, 2012, 5:28:43 PM (12 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

allow gnutls debug in tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/tests.h

    r740 r793  
    130130GCRY_THREAD_OPTION_PTHREAD_IMPL;
    131131
     132/* gnutls debug */
     133static void fd_gnutls_debug(int level, const char * str) {
     134        fd_log_debug(" [gnutls:%d] %s", level, str);
     135}
     136static int gnutls_debug = 0;
     137
     138
    132139static inline void parse_cmdline(int argc, char * argv[]) {
    133140        int c;
    134141        int no_timeout = 0;
    135         while ((c = getopt (argc, argv, "dqnf:F:")) != -1) {
     142        while ((c = getopt (argc, argv, "dqnf:F:g:")) != -1) {
    136143                switch (c) {
    137144                        case 'd':       /* Increase verbosity of debug messages.  */
     
    161168                                TRACE_DEBUG(INFO, "Error: must compile with DEBUG support to use this feature");
    162169                                #endif /* DEBUG */
     170                                break;
     171                               
     172                        case 'g':       /* Set a debug level and function for GNU TLS calls.  */
     173                                gnutls_debug = (int)atoi(optarg);
    163174                                break;
    164175                               
     
    194205        (void) gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
    195206        CHECK( 0, gnutls_global_init());
     207        /* Set gnutls debug level ? */
     208        if (gnutls_debug) {
     209                gnutls_global_set_log_function((gnutls_log_func)fd_gnutls_debug);
     210                gnutls_global_set_log_level (gnutls_debug);
     211                TRACE_DEBUG(INFO, "Enabled GNUTLS debug at level %d", gnutls_debug);
     212        }
    196213       
    197214        /* Initialize the config */
Note: See TracChangeset for help on using the changeset viewer.