2009-01-03 22:22:43 +01:00
|
|
|
/**
|
|
|
|
* \file debug.h
|
2009-01-04 17:27:10 +01:00
|
|
|
*
|
2011-01-06 13:28:03 +01:00
|
|
|
* \brief Debug functions
|
|
|
|
*
|
2010-07-18 12:13:04 +02:00
|
|
|
* Copyright (C) 2006-2010, Brainspark B.V.
|
2010-07-18 22:36:00 +02:00
|
|
|
*
|
|
|
|
* This file is part of PolarSSL (http://www.polarssl.org)
|
2010-07-18 12:13:04 +02:00
|
|
|
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
2010-07-18 22:36:00 +02:00
|
|
|
*
|
2009-07-28 19:23:11 +02:00
|
|
|
* All rights reserved.
|
2009-01-04 17:27:10 +01:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2009-01-03 22:22:43 +01:00
|
|
|
*/
|
|
|
|
#ifndef SSL_DEBUG_H
|
|
|
|
#define SSL_DEBUG_H
|
|
|
|
|
2009-01-03 22:24:11 +01:00
|
|
|
#include "polarssl/config.h"
|
|
|
|
#include "polarssl/ssl.h"
|
2009-01-03 22:22:43 +01:00
|
|
|
|
2009-01-03 22:51:57 +01:00
|
|
|
#if defined(POLARSSL_DEBUG_MSG)
|
2009-01-03 22:22:43 +01:00
|
|
|
|
|
|
|
#define SSL_DEBUG_MSG( level, args ) \
|
|
|
|
debug_print_msg( ssl, level, __FILE__, __LINE__, debug_fmt args );
|
|
|
|
|
|
|
|
#define SSL_DEBUG_RET( level, text, ret ) \
|
|
|
|
debug_print_ret( ssl, level, __FILE__, __LINE__, text, ret );
|
|
|
|
|
|
|
|
#define SSL_DEBUG_BUF( level, text, buf, len ) \
|
|
|
|
debug_print_buf( ssl, level, __FILE__, __LINE__, text, buf, len );
|
|
|
|
|
|
|
|
#define SSL_DEBUG_MPI( level, text, X ) \
|
|
|
|
debug_print_mpi( ssl, level, __FILE__, __LINE__, text, X );
|
|
|
|
|
|
|
|
#define SSL_DEBUG_CRT( level, text, crt ) \
|
|
|
|
debug_print_crt( ssl, level, __FILE__, __LINE__, text, crt );
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define SSL_DEBUG_MSG( level, args ) do { } while( 0 )
|
|
|
|
#define SSL_DEBUG_RET( level, text, ret ) do { } while( 0 )
|
|
|
|
#define SSL_DEBUG_BUF( level, text, buf, len ) do { } while( 0 )
|
|
|
|
#define SSL_DEBUG_MPI( level, text, X ) do { } while( 0 )
|
|
|
|
#define SSL_DEBUG_CRT( level, text, crt ) do { } while( 0 )
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
char *debug_fmt( const char *format, ... );
|
|
|
|
|
2010-03-16 22:09:09 +01:00
|
|
|
void debug_print_msg( const ssl_context *ssl, int level,
|
|
|
|
const char *file, int line, const char *text );
|
2009-01-03 22:22:43 +01:00
|
|
|
|
2010-03-16 22:09:09 +01:00
|
|
|
void debug_print_ret( const ssl_context *ssl, int level,
|
|
|
|
const char *file, int line,
|
|
|
|
const char *text, int ret );
|
2009-01-03 22:22:43 +01:00
|
|
|
|
2010-03-16 22:09:09 +01:00
|
|
|
void debug_print_buf( const ssl_context *ssl, int level,
|
|
|
|
const char *file, int line, const char *text,
|
2009-01-03 22:22:43 +01:00
|
|
|
unsigned char *buf, int len );
|
|
|
|
|
2010-03-16 22:09:09 +01:00
|
|
|
void debug_print_mpi( const ssl_context *ssl, int level,
|
|
|
|
const char *file, int line,
|
|
|
|
const char *text, const mpi *X );
|
2009-01-03 22:22:43 +01:00
|
|
|
|
2010-03-16 22:09:09 +01:00
|
|
|
void debug_print_crt( const ssl_context *ssl, int level,
|
|
|
|
const char *file, int line,
|
|
|
|
const char *text, const x509_cert *crt );
|
2009-01-03 22:22:43 +01:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* debug.h */
|