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.
Fork of wolfSSL by
logging.h
00001 /* logging.h 00002 * 00003 * Copyright (C) 2006-2016 wolfSSL Inc. 00004 * 00005 * This file is part of wolfSSL. 00006 * 00007 * wolfSSL is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * wolfSSL is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA 00020 */ 00021 00022 00023 /* submitted by eof */ 00024 00025 00026 #ifndef WOLFSSL_LOGGING_H 00027 #define WOLFSSL_LOGGING_H 00028 00029 #include <wolfssl/wolfcrypt/types.h> 00030 00031 #ifdef __cplusplus 00032 extern "C" { 00033 #endif 00034 00035 00036 enum CYA_Log_Levels { 00037 ERROR_LOG = 0, 00038 INFO_LOG, 00039 ENTER_LOG, 00040 LEAVE_LOG, 00041 OTHER_LOG 00042 }; 00043 00044 typedef void (*wolfSSL_Logging_cb)(const int logLevel, 00045 const char *const logMessage); 00046 00047 WOLFSSL_API int wolfSSL_SetLoggingCb(wolfSSL_Logging_cb log_function); 00048 00049 #if defined(OPENSSL_EXTRA) || defined(DEBUG_WOLFSSL_VERBOSE) 00050 WOLFSSL_LOCAL int wc_LoggingInit(void); 00051 WOLFSSL_LOCAL int wc_LoggingCleanup(void); 00052 WOLFSSL_LOCAL int wc_AddErrorNode(int error, int line, char* buf, 00053 char* file); 00054 WOLFSSL_LOCAL int wc_PeekErrorNode(int index, const char **file, 00055 const char **reason, int *line); 00056 WOLFSSL_LOCAL void wc_RemoveErrorNode(int index); 00057 WOLFSSL_LOCAL void wc_ClearErrorNodes(void); 00058 WOLFSSL_API int wc_SetLoggingHeap(void* h); 00059 #if !defined(NO_FILESYSTEM) && !defined(NO_STDIO_FILESYSTEM) 00060 WOLFSSL_API void wc_ERR_print_errors_fp(FILE* fp); 00061 #endif 00062 #endif /* defined(OPENSSL_EXTRA) || defined(DEBUG_WOLFSSL_VERBOSE) */ 00063 00064 #ifdef DEBUG_WOLFSSL 00065 #if defined(_WIN32) 00066 #if defined(INTIME_RTOS) 00067 #define __func__ NULL 00068 #else 00069 #define __func__ __FUNCTION__ 00070 #endif 00071 #endif 00072 00073 /* a is prepended to m and b is appended, creating a log msg a + m + b */ 00074 #define WOLFSSL_LOG_CAT(a, m, b) #a " " m " " #b 00075 00076 void WOLFSSL_ENTER(const char* msg); 00077 void WOLFSSL_LEAVE(const char* msg, int ret); 00078 #define WOLFSSL_STUB(m) \ 00079 WOLFSSL_MSG(WOLFSSL_LOG_CAT(wolfSSL Stub, m, not implemented)) 00080 00081 void WOLFSSL_MSG(const char* msg); 00082 void WOLFSSL_BUFFER(const byte* buffer, word32 length); 00083 00084 #else /* DEBUG_WOLFSSL */ 00085 00086 #define WOLFSSL_ENTER(m) 00087 #define WOLFSSL_LEAVE(m, r) 00088 #define WOLFSSL_STUB(m) 00089 00090 #define WOLFSSL_MSG(m) 00091 #define WOLFSSL_BUFFER(b, l) 00092 00093 #endif /* DEBUG_WOLFSSL */ 00094 00095 #if (defined(DEBUG_WOLFSSL) || defined(WOLFSSL_NGINX)) || defined(WOLFSSL_HAPROXY) 00096 #if (defined(OPENSSL_EXTRA) || defined(DEBUG_WOLFSSL_VERBOSE)) 00097 void WOLFSSL_ERROR_LINE(int err, const char* func, unsigned int line, 00098 const char* file, void* ctx); 00099 #define WOLFSSL_ERROR(x) WOLFSSL_ERROR_LINE((x), __func__, __LINE__, __FILE__,NULL) 00100 #else 00101 void WOLFSSL_ERROR(int); 00102 #endif 00103 #else 00104 #define WOLFSSL_ERROR(e) 00105 #endif 00106 00107 #ifdef __cplusplus 00108 } 00109 #endif 00110 #endif /* WOLFSSL_LOGGING_H */ 00111 00112
Generated on Tue Jul 12 2022 23:30:58 by
1.7.2
