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 02 08:44:47 2017 +0000
Revision:
7:481bce714567
wolfSSL3.10.2

Who changed what in which revision?

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