1 // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 #ifndef _ESP_DEBUG_H_
15 #define _ESP_DEBUG_H_
16 
17 #include "mbedtls/ssl.h"
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #include "sdkconfig.h"
24 #ifdef CONFIG_MBEDTLS_DEBUG
25 
26 /** @brief Enable mbedTLS debug logging via the esp_log mechanism.
27  *
28  * mbedTLS internal debugging is filtered from a specified mbedTLS
29  * threshold level to esp_log level at runtime:
30  *
31  * - 1 - Warning
32  * - 2 - Info
33  * - 3 - Debug
34  * - 4 - Verbose
35  *
36  * (Note that mbedTLS debug thresholds are not always consistently used.)
37  *
38  * This function will set the esp log level for "mbedtls" to the specified mbedTLS
39  * threshold level that matches. However, the overall max ESP log level must be set high
40  * enough in menuconfig, or some messages may be filtered at compile time.
41  *
42  * @param conf mbedtls_ssl_config structure
43  * @param mbedTLS debug threshold, 0-4. Messages are filtered at runtime.
44  */
45 void mbedtls_esp_enable_debug_log(mbedtls_ssl_config *conf, int threshold);
46 
47 /** @brief Disable mbedTLS debug logging via the esp_log mechanism.
48  *
49  */
50 void mbedtls_esp_disable_debug_log(mbedtls_ssl_config *conf);
51 
52 
53 #endif
54 
55 #ifdef __cplusplus
56 }
57 #endif
58 
59 #endif /* __ESP_DEBUG_H__ */
60