wolfSSL SSL/TLS library, support up to TLS1.3

Dependents:   CyaSSL-Twitter-OAuth4Tw Example-client-tls-cert TwitterReader TweetTest ... more

Committer:
wolfSSL
Date:
Tue May 30 01:44:10 2017 +0000
Revision:
11:cee25a834751
wolfSSL 3.11.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wolfSSL 11:cee25a834751 1 /* logging.h
wolfSSL 11:cee25a834751 2 *
wolfSSL 11:cee25a834751 3 * Copyright (C) 2006-2016 wolfSSL Inc.
wolfSSL 11:cee25a834751 4 *
wolfSSL 11:cee25a834751 5 * This file is part of wolfSSL.
wolfSSL 11:cee25a834751 6 *
wolfSSL 11:cee25a834751 7 * wolfSSL is free software; you can redistribute it and/or modify
wolfSSL 11:cee25a834751 8 * it under the terms of the GNU General Public License as published by
wolfSSL 11:cee25a834751 9 * the Free Software Foundation; either version 2 of the License, or
wolfSSL 11:cee25a834751 10 * (at your option) any later version.
wolfSSL 11:cee25a834751 11 *
wolfSSL 11:cee25a834751 12 * wolfSSL is distributed in the hope that it will be useful,
wolfSSL 11:cee25a834751 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
wolfSSL 11:cee25a834751 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
wolfSSL 11:cee25a834751 15 * GNU General Public License for more details.
wolfSSL 11:cee25a834751 16 *
wolfSSL 11:cee25a834751 17 * You should have received a copy of the GNU General Public License
wolfSSL 11:cee25a834751 18 * along with this program; if not, write to the Free Software
wolfSSL 11:cee25a834751 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
wolfSSL 11:cee25a834751 20 */
wolfSSL 11:cee25a834751 21
wolfSSL 11:cee25a834751 22
wolfSSL 11:cee25a834751 23 /* submitted by eof */
wolfSSL 11:cee25a834751 24
wolfSSL 11:cee25a834751 25
wolfSSL 11:cee25a834751 26 #ifndef WOLFSSL_LOGGING_H
wolfSSL 11:cee25a834751 27 #define WOLFSSL_LOGGING_H
wolfSSL 11:cee25a834751 28
wolfSSL 11:cee25a834751 29 #include <wolfssl/wolfcrypt/types.h>
wolfSSL 11:cee25a834751 30
wolfSSL 11:cee25a834751 31 #ifdef __cplusplus
wolfSSL 11:cee25a834751 32 extern "C" {
wolfSSL 11:cee25a834751 33 #endif
wolfSSL 11:cee25a834751 34
wolfSSL 11:cee25a834751 35
wolfSSL 11:cee25a834751 36 enum CYA_Log_Levels {
wolfSSL 11:cee25a834751 37 ERROR_LOG = 0,
wolfSSL 11:cee25a834751 38 INFO_LOG,
wolfSSL 11:cee25a834751 39 ENTER_LOG,
wolfSSL 11:cee25a834751 40 LEAVE_LOG,
wolfSSL 11:cee25a834751 41 OTHER_LOG
wolfSSL 11:cee25a834751 42 };
wolfSSL 11:cee25a834751 43
wolfSSL 11:cee25a834751 44 typedef void (*wolfSSL_Logging_cb)(const int logLevel,
wolfSSL 11:cee25a834751 45 const char *const logMessage);
wolfSSL 11:cee25a834751 46
wolfSSL 11:cee25a834751 47 WOLFSSL_API int wolfSSL_SetLoggingCb(wolfSSL_Logging_cb log_function);
wolfSSL 11:cee25a834751 48
wolfSSL 11:cee25a834751 49 #if defined(OPENSSL_EXTRA) || defined(DEBUG_WOLFSSL_VERBOSE)
wolfSSL 11:cee25a834751 50 WOLFSSL_LOCAL int wc_LoggingInit(void);
wolfSSL 11:cee25a834751 51 WOLFSSL_LOCAL int wc_LoggingCleanup(void);
wolfSSL 11:cee25a834751 52 WOLFSSL_LOCAL int wc_AddErrorNode(int error, int line, char* buf,
wolfSSL 11:cee25a834751 53 char* file);
wolfSSL 11:cee25a834751 54 WOLFSSL_LOCAL int wc_PeekErrorNode(int index, const char **file,
wolfSSL 11:cee25a834751 55 const char **reason, int *line);
wolfSSL 11:cee25a834751 56 WOLFSSL_LOCAL void wc_RemoveErrorNode(int index);
wolfSSL 11:cee25a834751 57 WOLFSSL_LOCAL void wc_ClearErrorNodes(void);
wolfSSL 11:cee25a834751 58 WOLFSSL_API int wc_SetLoggingHeap(void* h);
wolfSSL 11:cee25a834751 59 #if !defined(NO_FILESYSTEM) && !defined(NO_STDIO_FILESYSTEM)
wolfSSL 11:cee25a834751 60 WOLFSSL_API void wc_ERR_print_errors_fp(FILE* fp);
wolfSSL 11:cee25a834751 61 #endif
wolfSSL 11:cee25a834751 62 #endif /* defined(OPENSSL_EXTRA) || defined(DEBUG_WOLFSSL_VERBOSE) */
wolfSSL 11:cee25a834751 63
wolfSSL 11:cee25a834751 64 #ifdef DEBUG_WOLFSSL
wolfSSL 11:cee25a834751 65 #if defined(_WIN32)
wolfSSL 11:cee25a834751 66 #if defined(INTIME_RTOS)
wolfSSL 11:cee25a834751 67 #define __func__ NULL
wolfSSL 11:cee25a834751 68 #else
wolfSSL 11:cee25a834751 69 #define __func__ __FUNCTION__
wolfSSL 11:cee25a834751 70 #endif
wolfSSL 11:cee25a834751 71 #endif
wolfSSL 11:cee25a834751 72
wolfSSL 11:cee25a834751 73 /* a is prepended to m and b is appended, creating a log msg a + m + b */
wolfSSL 11:cee25a834751 74 #define WOLFSSL_LOG_CAT(a, m, b) #a " " m " " #b
wolfSSL 11:cee25a834751 75
wolfSSL 11:cee25a834751 76 void WOLFSSL_ENTER(const char* msg);
wolfSSL 11:cee25a834751 77 void WOLFSSL_LEAVE(const char* msg, int ret);
wolfSSL 11:cee25a834751 78 #define WOLFSSL_STUB(m) \
wolfSSL 11:cee25a834751 79 WOLFSSL_MSG(WOLFSSL_LOG_CAT(wolfSSL Stub, m, not implemented))
wolfSSL 11:cee25a834751 80
wolfSSL 11:cee25a834751 81 void WOLFSSL_MSG(const char* msg);
wolfSSL 11:cee25a834751 82 void WOLFSSL_BUFFER(byte* buffer, word32 length);
wolfSSL 11:cee25a834751 83
wolfSSL 11:cee25a834751 84 #else /* DEBUG_WOLFSSL */
wolfSSL 11:cee25a834751 85
wolfSSL 11:cee25a834751 86 #define WOLFSSL_ENTER(m)
wolfSSL 11:cee25a834751 87 #define WOLFSSL_LEAVE(m, r)
wolfSSL 11:cee25a834751 88 #define WOLFSSL_STUB(m)
wolfSSL 11:cee25a834751 89
wolfSSL 11:cee25a834751 90 #define WOLFSSL_MSG(m)
wolfSSL 11:cee25a834751 91 #define WOLFSSL_BUFFER(b, l)
wolfSSL 11:cee25a834751 92
wolfSSL 11:cee25a834751 93 #endif /* DEBUG_WOLFSSL */
wolfSSL 11:cee25a834751 94
wolfSSL 11:cee25a834751 95 #if (defined(DEBUG_WOLFSSL) || defined(WOLFSSL_NGINX)) || defined(WOLFSSL_HAPROXY)
wolfSSL 11:cee25a834751 96 #if (defined(OPENSSL_EXTRA) || defined(DEBUG_WOLFSSL_VERBOSE))
wolfSSL 11:cee25a834751 97 void WOLFSSL_ERROR_LINE(int err, const char* func, unsigned int line,
wolfSSL 11:cee25a834751 98 const char* file, void* ctx);
wolfSSL 11:cee25a834751 99 #define WOLFSSL_ERROR(x) WOLFSSL_ERROR_LINE((x), __func__, __LINE__, __FILE__,NULL)
wolfSSL 11:cee25a834751 100 #else
wolfSSL 11:cee25a834751 101 void WOLFSSL_ERROR(int);
wolfSSL 11:cee25a834751 102 #endif
wolfSSL 11:cee25a834751 103 #else
wolfSSL 11:cee25a834751 104 #define WOLFSSL_ERROR(e)
wolfSSL 11:cee25a834751 105 #endif
wolfSSL 11:cee25a834751 106
wolfSSL 11:cee25a834751 107 #ifdef __cplusplus
wolfSSL 11:cee25a834751 108 }
wolfSSL 11:cee25a834751 109 #endif
wolfSSL 11:cee25a834751 110 #endif /* WOLFSSL_LOGGING_H */
wolfSSL 11:cee25a834751 111
wolfSSL 11:cee25a834751 112