30#ifndef WOLFSSL_LOGGING_H
31#define WOLFSSL_LOGGING_H
48#ifdef WOLFSSL_FUNC_TIME
54 WC_FUNC_HELLO_REQUEST_SEND = 0,
55 WC_FUNC_HELLO_REQUEST_DO,
56 WC_FUNC_CLIENT_HELLO_SEND,
57 WC_FUNC_CLIENT_HELLO_DO,
58 WC_FUNC_SERVER_HELLO_SEND,
59 WC_FUNC_SERVER_HELLO_DO,
60 WC_FUNC_ENCRYPTED_EXTENSIONS_SEND,
61 WC_FUNC_ENCRYPTED_EXTENSIONS_DO,
62 WC_FUNC_CERTIFICATE_REQUEST_SEND,
63 WC_FUNC_CERTIFICATE_REQUEST_DO,
64 WC_FUNC_CERTIFICATE_SEND,
65 WC_FUNC_CERTIFICATE_DO,
66 WC_FUNC_CERTIFICATE_VERIFY_SEND,
67 WC_FUNC_CERTIFICATE_VERIFY_DO,
68 WC_FUNC_FINISHED_SEND,
70 WC_FUNC_KEY_UPDATE_SEND,
71 WC_FUNC_KEY_UPDATE_DO,
72 WC_FUNC_EARLY_DATA_SEND,
73 WC_FUNC_EARLY_DATA_DO,
74 WC_FUNC_NEW_SESSION_TICKET_SEND,
75 WC_FUNC_NEW_SESSION_TICKET_DO,
76 WC_FUNC_SERVER_HELLO_DONE_SEND,
77 WC_FUNC_SERVER_HELLO_DONE_DO,
80 WC_FUNC_CLIENT_KEY_EXCHANGE_SEND,
81 WC_FUNC_CLIENT_KEY_EXCHANGE_DO,
82 WC_FUNC_CERTIFICATE_STATUS_SEND,
83 WC_FUNC_CERTIFICATE_STATUS_DO,
84 WC_FUNC_SERVER_KEY_EXCHANGE_SEND,
85 WC_FUNC_SERVER_KEY_EXCHANGE_DO,
86 WC_FUNC_END_OF_EARLY_DATA_SEND,
87 WC_FUNC_END_OF_EARLY_DATA_DO,
92typedef void (*wolfSSL_Logging_cb)(
const int logLevel,
93 const char *
const logMessage);
96WOLFSSL_API wolfSSL_Logging_cb wolfSSL_GetLoggingCb(
void);
104#if defined(OPENSSL_EXTRA) || defined(DEBUG_WOLFSSL_VERBOSE)
105 WOLFSSL_LOCAL
int wc_LoggingInit(
void);
106 WOLFSSL_LOCAL
int wc_LoggingCleanup(
void);
107 WOLFSSL_LOCAL
int wc_AddErrorNode(
int error,
int line,
char* buf,
109 WOLFSSL_LOCAL
int wc_PeekErrorNode(
int index,
const char **file,
110 const char **reason,
int *line);
111 WOLFSSL_LOCAL
void wc_RemoveErrorNode(
int index);
112 WOLFSSL_LOCAL
void wc_ClearErrorNodes(
void);
113 WOLFSSL_LOCAL
int wc_PullErrorNode(
const char **file,
const char **reason,
115 WOLFSSL_API
int wc_SetLoggingHeap(
void* h);
116 WOLFSSL_API
int wc_ERR_remove_state(
void);
117 #if !defined(NO_FILESYSTEM) && !defined(NO_STDIO_FILESYSTEM)
118 WOLFSSL_API
void wc_ERR_print_errors_fp(XFILE fp);
119 WOLFSSL_API
void wc_ERR_print_errors_cb(
int (*cb)(
const char *str,
120 size_t len,
void *u),
void *u);
124#ifdef WOLFSSL_FUNC_TIME
129 WOLFSSL_API
void WOLFSSL_START(
int funcNum);
130 WOLFSSL_API
void WOLFSSL_END(
int funcNum);
131 WOLFSSL_API
void WOLFSSL_TIME(
int count);
133 #define WOLFSSL_START(n)
134 #define WOLFSSL_END(n)
135 #define WOLFSSL_TIME(n)
138#if defined(DEBUG_WOLFSSL) && !defined(WOLFSSL_DEBUG_ERRORS_ONLY)
140 #if defined(INTIME_RTOS)
141 #define __func__ NULL
143 #define __func__ __FUNCTION__
148 #define WOLFSSL_LOG_CAT(a, m, b) #a " " m " " #b
150 WOLFSSL_API
void WOLFSSL_ENTER(
const char* msg);
151 WOLFSSL_API
void WOLFSSL_LEAVE(
const char* msg,
int ret);
152 #define WOLFSSL_STUB(m) \
153 WOLFSSL_MSG(WOLFSSL_LOG_CAT(wolfSSL Stub, m, not implemented))
154 WOLFSSL_API
int WOLFSSL_IS_DEBUG_ON(
void);
156 WOLFSSL_API
void WOLFSSL_MSG(
const char* msg);
157 WOLFSSL_API
void WOLFSSL_BUFFER(
const byte* buffer, word32 length);
161 #define WOLFSSL_ENTER(m)
162 #define WOLFSSL_LEAVE(m, r)
163 #define WOLFSSL_STUB(m)
164 #define WOLFSSL_IS_DEBUG_ON() 0
166 #define WOLFSSL_MSG(m)
167 #define WOLFSSL_BUFFER(b, l)
171#if defined(DEBUG_WOLFSSL) || defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX) ||\
172 defined(WOLFSSL_HAPROXY) || defined(OPENSSL_EXTRA)
174 #if (!defined(NO_ERROR_QUEUE) && defined(OPENSSL_EXTRA) && !defined(_WIN32))\
175 || defined(DEBUG_WOLFSSL_VERBOSE)
176 WOLFSSL_API
void WOLFSSL_ERROR_LINE(
int err,
const char* func,
unsigned int line,
177 const char* file,
void* ctx);
178 #define WOLFSSL_ERROR(x) \
179 WOLFSSL_ERROR_LINE((x), __func__, __LINE__, __FILE__, NULL)
181 WOLFSSL_API
void WOLFSSL_ERROR(
int err);
183 WOLFSSL_API
void WOLFSSL_ERROR_MSG(
const char* msg);
186 #define WOLFSSL_ERROR(e)
187 #define WOLFSSL_ERROR_MSG(m)
WOLFSSL_API void wolfSSL_Debugging_OFF(void)
This function turns off runtime logging messages. If they’re already off, no action is taken.
Definition logging.c:165
WOLFSSL_API int wolfSSL_Debugging_ON(void)
If logging has been enabled at build time this function turns on logging at runtime....
Definition logging.c:151
WOLFSSL_API int wolfSSL_SetLoggingCb(wolfSSL_Logging_cb log_function)
This function registers a logging callback that will be used to handle the wolfSSL log message....
Definition logging.c:129