comparison include/freeDiameter/freeDiameter.h @ 214:5a1b93f59f8f

Added trace facility for GNUTLS calls
author Sebastien Decugis <sdecugis@nict.go.jp>
date Thu, 18 Feb 2010 15:20:00 +0900
parents 79768bf7d208
children ad6c0118fb50
comparison
equal deleted inserted replaced
213:890a9b6379f0 214:5a1b93f59f8f
44 /* GNUTLS version */ 44 /* GNUTLS version */
45 #ifndef GNUTLS_VERSION 45 #ifndef GNUTLS_VERSION
46 #define GNUTLS_VERSION LIBGNUTLS_VERSION 46 #define GNUTLS_VERSION LIBGNUTLS_VERSION
47 #endif /* GNUTLS_VERSION */ 47 #endif /* GNUTLS_VERSION */
48 48
49 /* GNUTLS calls debug level */
50 #ifndef GNUTLS_DBG_LEVEL
51 #define GNUTLS_DBG_LEVEL ANNOYING
52 #endif /* GNUTLS_DBG_LEVEL */
53
49 /* Check the return value of a GNUTLS function, log and propagate */ 54 /* Check the return value of a GNUTLS function, log and propagate */
50 #define CHECK_GNUTLS_DO( __call__, __fallback__ ) { \ 55 #define CHECK_GNUTLS_DO( __call__, __fallback__ ) { \
51 int __ret__; \ 56 int __ret__; \
52 TRACE_DEBUG_ALL( "Check FCT: " #__call__ ); \ 57 TRACE_DEBUG(GNUTLS_DBG_LEVEL, "GNUTLS call: " #__call__ ); \
53 __ret__ = (__call__); \ 58 __ret__ = (__call__); \
54 if (__ret__ < 0) { \ 59 if (__ret__ < 0) { \
55 TRACE_DEBUG(INFO, "Error in '" #__call__ "':\t%s", gnutls_strerror(__ret__)); \ 60 TRACE_DEBUG(INFO, "Error in '" #__call__ "':\t%s", gnutls_strerror(__ret__)); \
56 __fallback__; \ 61 __fallback__; \
57 } \ 62 } \
58 } 63 }
64
65 /* For GNUTLS routines that do not return a value */
66 #define GNUTLS_TRACE( __call__) { \
67 TRACE_DEBUG(GNUTLS_DBG_LEVEL, "GNUTLS call: " #__call__ ); \
68 (__call__); \
69 }
70
59 71
60 72
61 /* Structure to hold the configuration of the freeDiameter daemon */ 73 /* Structure to hold the configuration of the freeDiameter daemon */
62 struct fd_config { 74 struct fd_config {
63 int cnf_eyec; /* Eye catcher: EYEC_CONFIG */ 75 int cnf_eyec; /* Eye catcher: EYEC_CONFIG */
"Welcome to our mercurial repository"