00001
00004 #ifndef SSL_DEBUG_H
00005 #define SSL_DEBUG_H
00006
00007 #include "xyssl/config.h"
00008 #include "xyssl/ssl.h"
00009
00010 #if defined(XYSSL_DEBUG_MSG)
00011
00012 #define SSL_DEBUG_MSG( level, args ) \
00013 debug_print_msg( ssl, level, __FILE__, __LINE__, debug_fmt args );
00014
00015 #define SSL_DEBUG_RET( level, text, ret ) \
00016 debug_print_ret( ssl, level, __FILE__, __LINE__, text, ret );
00017
00018 #define SSL_DEBUG_BUF( level, text, buf, len ) \
00019 debug_print_buf( ssl, level, __FILE__, __LINE__, text, buf, len );
00020
00021 #define SSL_DEBUG_MPI( level, text, X ) \
00022 debug_print_mpi( ssl, level, __FILE__, __LINE__, text, X );
00023
00024 #define SSL_DEBUG_CRT( level, text, crt ) \
00025 debug_print_crt( ssl, level, __FILE__, __LINE__, text, crt );
00026
00027 #else
00028
00029 #define SSL_DEBUG_MSG( level, args ) do { } while( 0 )
00030 #define SSL_DEBUG_RET( level, text, ret ) do { } while( 0 )
00031 #define SSL_DEBUG_BUF( level, text, buf, len ) do { } while( 0 )
00032 #define SSL_DEBUG_MPI( level, text, X ) do { } while( 0 )
00033 #define SSL_DEBUG_CRT( level, text, crt ) do { } while( 0 )
00034
00035 #endif
00036
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040
00041 char *debug_fmt( const char *format, ... );
00042
00043 void debug_print_msg( ssl_context *ssl, int level,
00044 char *file, int line, char *text );
00045
00046 void debug_print_ret( ssl_context *ssl, int level,
00047 char *file, int line, char *text, int ret );
00048
00049 void debug_print_buf( ssl_context *ssl, int level,
00050 char *file, int line, char *text,
00051 unsigned char *buf, int len );
00052
00053 void debug_print_mpi( ssl_context *ssl, int level,
00054 char *file, int line, char *text, mpi *X );
00055
00056 void debug_print_crt( ssl_context *ssl, int level,
00057 char *file, int line, char *text, x509_cert *crt );
00058
00059 #ifdef __cplusplus
00060 }
00061 #endif
00062
00063 #endif