Renesas / SecureDweet
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers logging.h Source File

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 #ifdef DEBUG_WOLFSSL
00050     /* a is prepended to m and b is appended, creating a log msg a + m + b */
00051     #define WOLFSSL_LOG_CAT(a, m, b) #a " " m " "  #b
00052 
00053     void WOLFSSL_ENTER(const char* msg);
00054     void WOLFSSL_LEAVE(const char* msg, int ret);
00055     #define WOLFSSL_STUB(m) \
00056         WOLFSSL_MSG(WOLFSSL_LOG_CAT(wolfSSL Stub, m, not implemented))
00057 
00058     void WOLFSSL_ERROR(int);
00059     void WOLFSSL_MSG(const char* msg);
00060     void WOLFSSL_BUFFER(byte* buffer, word32 length);
00061 
00062 #else /* DEBUG_WOLFSSL   */
00063 
00064     #define WOLFSSL_ENTER(m)
00065     #define WOLFSSL_LEAVE(m, r)
00066     #define WOLFSSL_STUB(m)
00067 
00068     #define WOLFSSL_ERROR(e)
00069     #define WOLFSSL_MSG(m)
00070     #define WOLFSSL_BUFFER(b, l)
00071 
00072 #endif /* DEBUG_WOLFSSL  */
00073 
00074 #ifdef __cplusplus
00075 }
00076 #endif
00077 #endif /* WOLFSSL_LOGGING_H */
00078 
00079