Logging: Fix COAP_MAX_LOGGING_LEVEL == 0 compile errors

This commit is contained in:
Jon Shallow authored and Jon Shallow committed 2023-07-19 09:50:05 +01:00
1 parent b26ef52fca
commit 90c1a98044
2 files changed
+14

No files matched your search

+10
View File
@@ -262,6 +262,7 @@ coap_get_tls_library_version(void) {
static void
coap_gnutls_audit_log_func(gnutls_session_t g_session, const char *text) {
#if COAP_MAX_LOGGING_LEVEL > 0
if (g_session) {
coap_session_t *c_session =
(coap_session_t *)gnutls_transport_get_ptr(g_session);
@@ -270,6 +271,10 @@ coap_gnutls_audit_log_func(gnutls_session_t g_session, const char *text) {
} else {
coap_log_warn("** (null): %s", text);
}
#else /* COAP_MAX_LOGGING_LEVEL == 0 */
(void)g_session;
(void)text;
#endif /* COAP_MAX_LOGGING_LEVEL == 0 */
}
static void
@@ -2098,6 +2103,7 @@ coap_dtls_new_server_session(coap_session_t *c_session) {
static void
log_last_alert(coap_session_t *c_session,
gnutls_session_t g_session) {
#if COAP_MAX_LOGGING_LEVEL > 0
int last_alert = gnutls_alert_get(g_session);
if (last_alert == GNUTLS_A_CLOSE_NOTIFY)
@@ -2108,6 +2114,10 @@ log_last_alert(coap_session_t *c_session,
coap_log_warn("***%s: Alert '%d': %s\n",
coap_session_str(c_session),
last_alert, gnutls_alert_get_name(last_alert));
#else /* COAP_MAX_LOGGING_LEVEL == 0 */
(void)c_session;
(void)g_session;
#endif /* COAP_MAX_LOGGING_LEVEL == 0 */
}
/*
+4
View File
@@ -324,12 +324,14 @@ get_san_or_cn_from_cert(mbedtls_x509_crt *crt) {
return NULL;
}
#if COAP_MAX_LOGGING_LEVEL > 0
static char *
get_error_string(int ret) {
static char buf[128] = {0};
mbedtls_strerror(ret, buf, sizeof(buf)-1);
return buf;
}
#endif /* COAP_MAX_LOGGING_LEVEL */
static int
self_signed_cert_verify_callback_mbedtls(void *data,
@@ -1245,6 +1247,7 @@ coap_dtls_free_mbedtls_env(coap_mbedtls_env_t *m_env) {
}
}
#if COAP_MAX_LOGGING_LEVEL > 0
static const char *
report_mbedtls_alert(unsigned char alert) {
switch (alert) {
@@ -1268,6 +1271,7 @@ report_mbedtls_alert(unsigned char alert) {
return "";
}
}
#endif /* COAP_MAX_LOGGING_LEVEL */
/*
* return -1 failure