Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
debug.h
00001 /** 00002 * \file debug.h 00003 * 00004 * \brief Debug functions 00005 * 00006 * Copyright (C) 2006-2011, Brainspark B.V. 00007 * 00008 * This file is part of PolarSSL (http://www.polarssl.org) 00009 * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> 00010 * 00011 * All rights reserved. 00012 * 00013 * This program is free software; you can redistribute it and/or modify 00014 * it under the terms of the GNU General Public License as published by 00015 * the Free Software Foundation; either version 2 of the License, or 00016 * (at your option) any later version. 00017 * 00018 * This program is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 * GNU General Public License for more details. 00022 * 00023 * You should have received a copy of the GNU General Public License along 00024 * with this program; if not, write to the Free Software Foundation, Inc., 00025 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00026 */ 00027 #ifndef POLARSSL_DEBUG_H 00028 #define POLARSSL_DEBUG_H 00029 00030 #if !defined(POLARSSL_CONFIG_FILE) 00031 #include "config.h" 00032 #else 00033 #include POLARSSL_CONFIG_FILE 00034 #endif 00035 #include "ssl.h" 00036 #if defined(POLARSSL_ECP_C) 00037 #include "ecp.h" 00038 #endif 00039 00040 #if defined(POLARSSL_DEBUG_C) 00041 00042 #define POLARSSL_DEBUG_LOG_FULL 0 /**< Include file:line in log lines */ 00043 #define POLARSSL_DEBUG_LOG_RAW 1 /**< Only log raw debug lines */ 00044 00045 /** 00046 * \name SECTION: Module settings 00047 * 00048 * The configuration options you can set for this module are in this section. 00049 * Either change them in config.h or define them on the compiler command line. 00050 * \{ 00051 */ 00052 00053 #if !defined(POLARSSL_DEBUG_DFL_MODE) 00054 #define POLARSSL_DEBUG_DFL_MODE POLARSSL_DEBUG_LOG_FULL /**< Default log: Full or Raw */ 00055 #endif 00056 00057 /* \} name SECTION: Module settings */ 00058 00059 00060 #define SSL_DEBUG_MSG( level, args ) \ 00061 debug_print_msg( ssl, level, __FILE__, __LINE__, debug_fmt args ); 00062 00063 #define SSL_DEBUG_RET( level, text, ret ) \ 00064 debug_print_ret( ssl, level, __FILE__, __LINE__, text, ret ); 00065 00066 #define SSL_DEBUG_BUF( level, text, buf, len ) \ 00067 debug_print_buf( ssl, level, __FILE__, __LINE__, text, buf, len ); 00068 00069 #if defined(POLARSSL_BIGNUM_C) 00070 #define SSL_DEBUG_MPI( level, text, X ) \ 00071 debug_print_mpi( ssl, level, __FILE__, __LINE__, text, X ); 00072 #endif 00073 00074 #if defined(POLARSSL_ECP_C) 00075 #define SSL_DEBUG_ECP( level, text, X ) \ 00076 debug_print_ecp( ssl, level, __FILE__, __LINE__, text, X ); 00077 #endif 00078 00079 #if defined(POLARSSL_X509_CRT_PARSE_C) 00080 #define SSL_DEBUG_CRT( level, text, crt ) \ 00081 debug_print_crt( ssl, level, __FILE__, __LINE__, text, crt ); 00082 #endif 00083 00084 #else /* POLARSSL_DEBUG_ C */ 00085 00086 #define SSL_DEBUG_MSG( level, args ) do { } while( 0 ) 00087 #define SSL_DEBUG_RET( level, text, ret ) do { } while( 0 ) 00088 #define SSL_DEBUG_BUF( level, text, buf, len ) do { } while( 0 ) 00089 #define SSL_DEBUG_MPI( level, text, X ) do { } while( 0 ) 00090 #define SSL_DEBUG_ECP( level, text, X ) do { } while( 0 ) 00091 #define SSL_DEBUG_CRT( level, text, crt ) do { } while( 0 ) 00092 00093 #endif /* POLARSSL_DEBUG_C */ 00094 00095 #ifdef __cplusplus 00096 extern "C" { 00097 #endif 00098 00099 /** 00100 * \brief Set the log mode for the debug functions globally 00101 * (Default value: POLARSSL_DEBUG_DFL_MODE) 00102 * 00103 * \param log_mode The log mode to use (POLARSSL_DEBUG_LOG_FULL or 00104 * POLARSSL_DEBUG_LOG_RAW) 00105 */ 00106 void debug_set_log_mode( int log_mode ); 00107 00108 /** 00109 * \brief Set the level threshold to handle globally. Messages that have a 00110 * level over the threshold value are ignored. 00111 * (Default value: 0 (No debug)) 00112 * 00113 * \param threshold maximum level of messages to pass on 00114 */ 00115 void debug_set_threshold( int threshold ); 00116 00117 char *debug_fmt( const char *format, ... ); 00118 00119 void debug_print_msg( const ssl_context *ssl, int level, 00120 const char *file, int line, const char *text ); 00121 00122 void debug_print_ret( const ssl_context *ssl, int level, 00123 const char *file, int line, 00124 const char *text, int ret ); 00125 00126 void debug_print_buf( const ssl_context *ssl, int level, 00127 const char *file, int line, const char *text, 00128 unsigned char *buf, size_t len ); 00129 00130 #if defined(POLARSSL_BIGNUM_C) 00131 void debug_print_mpi( const ssl_context *ssl, int level, 00132 const char *file, int line, 00133 const char *text, const mpi *X ); 00134 #endif 00135 00136 #if defined(POLARSSL_ECP_C) 00137 void debug_print_ecp( const ssl_context *ssl, int level, 00138 const char *file, int line, 00139 const char *text, const ecp_point *X ); 00140 #endif 00141 00142 #if defined(POLARSSL_X509_CRT_PARSE_C) 00143 void debug_print_crt( const ssl_context *ssl, int level, 00144 const char *file, int line, 00145 const char *text, const x509_crt *crt ); 00146 #endif 00147 00148 #ifdef __cplusplus 00149 } 00150 #endif 00151 00152 #endif /* debug.h */ 00153 00154
Generated on Tue Jul 12 2022 19:40:15 by
1.7.2