From 946546d0c18d7a8b0ad4aa73ba1cf2b98c834261 Mon Sep 17 00:00:00 2001 From: David Cozens Date: Wed, 3 Jun 2026 12:17:17 +0100 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20S12.26=20error=20text=20decoupling?= =?UTF-8?q?=20=E2=80=94=20codes-only=20library?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove every error message string from the library: delete the 43 *Messages.c tables and slim struct SolidSyslogErrorSource to { Name }. Error text now lives in one consumer-side handler (BddTargetErrorText), keyed on the portable category axis; the library carries codes only. - Relocate each error-source symbol to its allocation-agnostic vtable TU (Xxx.c), not the static-allocation Static.c. - Unwind the crypto-policy _Report wrapper to direct SolidSyslog_Error calls, uniform with the other 39 classes. - Retire MISRA deviation D.014 (rule 8.7): the unwind makes the crypto sources cross-TU referenced; cppcheck-misra clean. Co-Authored-By: Claude Opus 4.8 (1M context) --- Bdd/Targets/CMakeLists.txt | 2 + Bdd/Targets/Common/BddTargetErrorText.c | 51 +++++++++++++ Bdd/Targets/Common/BddTargetErrorText.h | 14 ++++ .../Common/BddTargetStderrErrorHandler.c | 8 +- Bdd/Targets/FreeRtos/CMakeLists.txt | 10 +-- Bdd/Targets/FreeRtos/main.c | 7 +- Bdd/Targets/FreeRtosLwip/CMakeLists.txt | 7 +- Bdd/Targets/FreeRtosLwip/main.c | 7 +- Core/Interface/SolidSyslogError.h | 1 - Core/Source/CMakeLists.txt | 11 --- Core/Source/SolidSyslog.c | 2 + Core/Source/SolidSyslogBlockStore.c | 4 + Core/Source/SolidSyslogBlockStoreMessages.c | 22 ------ Core/Source/SolidSyslogCircularBuffer.c | 4 + .../SolidSyslogCircularBufferMessages.c | 23 ------ Core/Source/SolidSyslogFileBlockDevice.c | 4 + .../SolidSyslogFileBlockDeviceMessages.c | 23 ------ Core/Source/SolidSyslogMessages.c | 30 -------- Core/Source/SolidSyslogMetaSd.c | 4 + Core/Source/SolidSyslogMetaSdMessages.c | 23 ------ Core/Source/SolidSyslogOriginSd.c | 4 + Core/Source/SolidSyslogOriginSdMessages.c | 21 ----- Core/Source/SolidSyslogPassthroughBuffer.c | 4 + .../SolidSyslogPassthroughBufferMessages.c | 28 ------- Core/Source/SolidSyslogStreamSender.c | 4 + Core/Source/SolidSyslogStreamSenderMessages.c | 27 ------- Core/Source/SolidSyslogSwitchingSender.c | 4 + .../SolidSyslogSwitchingSenderMessages.c | 26 ------- Core/Source/SolidSyslogTimeQualitySd.c | 4 + .../Source/SolidSyslogTimeQualitySdMessages.c | 23 ------ Core/Source/SolidSyslogUdpSender.c | 2 + Core/Source/SolidSyslogUdpSenderMessages.c | 27 ------- DEVLOG.md | 71 +++++++++++++++++ Platform/Atomics/CMakeLists.txt | 1 - .../Source/SolidSyslogStdAtomicCounter.c | 4 + .../SolidSyslogStdAtomicCounterMessages.c | 23 ------ Platform/FatFs/Source/SolidSyslogFatFsFile.c | 4 + .../Source/SolidSyslogFatFsFileMessages.c | 21 ----- .../Source/SolidSyslogFreeRtosMutex.c | 4 + .../Source/SolidSyslogFreeRtosMutexMessages.c | 23 ------ .../Source/SolidSyslogLwipRawAddress.c | 4 + .../SolidSyslogLwipRawAddressMessages.c | 23 ------ .../Source/SolidSyslogLwipRawDatagram.c | 12 ++- .../SolidSyslogLwipRawDatagramMessages.c | 23 ------ .../Source/SolidSyslogLwipRawDnsResolver.c | 2 + .../SolidSyslogLwipRawDnsResolverMessages.c | 28 ------- .../Source/SolidSyslogLwipRawResolver.c | 8 +- .../SolidSyslogLwipRawResolverMessages.c | 23 ------ .../Source/SolidSyslogLwipRawTcpStream.c | 14 ++-- .../SolidSyslogLwipRawTcpStreamMessages.c | 23 ------ .../Source/SolidSyslogMbedTlsAesGcmPolicy.c | 23 ++++-- .../SolidSyslogMbedTlsAesGcmPolicyMessages.c | 47 ------------ .../SolidSyslogMbedTlsAesGcmPolicyPrivate.h | 11 --- .../SolidSyslogMbedTlsAesGcmPolicyStatic.c | 16 ++-- .../SolidSyslogMbedTlsHmacSha256Policy.c | 13 +++- ...lidSyslogMbedTlsHmacSha256PolicyMessages.c | 43 ----------- ...olidSyslogMbedTlsHmacSha256PolicyPrivate.h | 11 --- ...SolidSyslogMbedTlsHmacSha256PolicyStatic.c | 16 ++-- .../MbedTls/Source/SolidSyslogMbedTlsStream.c | 2 + .../Source/SolidSyslogMbedTlsStreamMessages.c | 33 -------- Platform/OpenSsl/CMakeLists.txt | 3 - .../Source/SolidSyslogOpenSslAesGcmPolicy.c | 23 ++++-- .../SolidSyslogOpenSslAesGcmPolicyMessages.c | 47 ------------ .../SolidSyslogOpenSslAesGcmPolicyPrivate.h | 11 --- .../SolidSyslogOpenSslAesGcmPolicyStatic.c | 16 ++-- .../SolidSyslogOpenSslHmacSha256Policy.c | 13 +++- ...lidSyslogOpenSslHmacSha256PolicyMessages.c | 43 ----------- ...olidSyslogOpenSslHmacSha256PolicyPrivate.h | 11 --- ...SolidSyslogOpenSslHmacSha256PolicyStatic.c | 16 ++-- .../OpenSsl/Source/SolidSyslogTlsStream.c | 2 + .../Source/SolidSyslogTlsStreamMessages.c | 31 -------- .../Source/SolidSyslogPlusTcpAddress.c | 6 +- .../SolidSyslogPlusTcpAddressMessages.c | 23 ------ .../Source/SolidSyslogPlusTcpDatagram.c | 10 ++- .../SolidSyslogPlusTcpDatagramMessages.c | 23 ------ .../Source/SolidSyslogPlusTcpResolver.c | 6 +- .../SolidSyslogPlusTcpResolverMessages.c | 23 ------ .../Source/SolidSyslogPlusTcpTcpStream.c | 8 +- .../SolidSyslogPlusTcpTcpStreamMessages.c | 23 ------ Platform/Posix/CMakeLists.txt | 7 -- .../Source/SolidSyslogGetAddrInfoResolver.c | 6 +- .../SolidSyslogGetAddrInfoResolverMessages.c | 26 ------- .../Posix/Source/SolidSyslogPosixAddress.c | 4 + .../Source/SolidSyslogPosixAddressMessages.c | 23 ------ .../Posix/Source/SolidSyslogPosixDatagram.c | 4 + .../Source/SolidSyslogPosixDatagramMessages.c | 23 ------ Platform/Posix/Source/SolidSyslogPosixFile.c | 4 + .../Source/SolidSyslogPosixFileMessages.c | 21 ----- .../SolidSyslogPosixMessageQueueBuffer.c | 2 + ...lidSyslogPosixMessageQueueBufferMessages.c | 31 -------- Platform/Posix/Source/SolidSyslogPosixMutex.c | 4 + .../Source/SolidSyslogPosixMutexMessages.c | 22 ------ .../Posix/Source/SolidSyslogPosixTcpStream.c | 4 + .../SolidSyslogPosixTcpStreamMessages.c | 23 ------ Platform/Windows/CMakeLists.txt | 7 -- .../Source/SolidSyslogWindowsAtomicCounter.c | 4 + .../SolidSyslogWindowsAtomicCounterMessages.c | 26 ------- .../Windows/Source/SolidSyslogWindowsFile.c | 4 + .../Source/SolidSyslogWindowsFileMessages.c | 22 ------ .../Windows/Source/SolidSyslogWindowsMutex.c | 4 + .../Source/SolidSyslogWindowsMutexMessages.c | 22 ------ .../Source/SolidSyslogWinsockAddress.c | 4 + .../SolidSyslogWinsockAddressMessages.c | 23 ------ .../Source/SolidSyslogWinsockDatagram.c | 4 + .../SolidSyslogWinsockDatagramMessages.c | 23 ------ .../Source/SolidSyslogWinsockResolver.c | 6 +- .../SolidSyslogWinsockResolverMessages.c | 23 ------ .../Source/SolidSyslogWinsockTcpStream.c | 4 + .../SolidSyslogWinsockTcpStreamMessages.c | 23 ------ Tests/Bdd/Targets/BddTargetErrorTextTest.cpp | 69 +++++++++++++++++ Tests/Bdd/Targets/CMakeLists.txt | 2 + Tests/FatFs/CMakeLists.txt | 1 - Tests/FreeRtos/CMakeLists.txt | 8 -- Tests/Lwip/CMakeLists.txt | 9 --- Tests/MbedTls/CMakeLists.txt | 4 - Tests/MbedTlsIntegration/CMakeLists.txt | 2 - Tests/SolidSyslogErrorTest.cpp | 6 +- Tests/SolidSyslogUdpSenderTest.cpp | 20 ----- docs/misra-deviations.md | 76 ++++--------------- misra_suppressions.txt | 7 -- 120 files changed, 487 insertions(+), 1415 deletions(-) create mode 100644 Bdd/Targets/Common/BddTargetErrorText.c create mode 100644 Bdd/Targets/Common/BddTargetErrorText.h delete mode 100644 Core/Source/SolidSyslogBlockStoreMessages.c delete mode 100644 Core/Source/SolidSyslogCircularBufferMessages.c delete mode 100644 Core/Source/SolidSyslogFileBlockDeviceMessages.c delete mode 100644 Core/Source/SolidSyslogMessages.c delete mode 100644 Core/Source/SolidSyslogMetaSdMessages.c delete mode 100644 Core/Source/SolidSyslogOriginSdMessages.c delete mode 100644 Core/Source/SolidSyslogPassthroughBufferMessages.c delete mode 100644 Core/Source/SolidSyslogStreamSenderMessages.c delete mode 100644 Core/Source/SolidSyslogSwitchingSenderMessages.c delete mode 100644 Core/Source/SolidSyslogTimeQualitySdMessages.c delete mode 100644 Core/Source/SolidSyslogUdpSenderMessages.c delete mode 100644 Platform/Atomics/Source/SolidSyslogStdAtomicCounterMessages.c delete mode 100644 Platform/FatFs/Source/SolidSyslogFatFsFileMessages.c delete mode 100644 Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexMessages.c delete mode 100644 Platform/LwipRaw/Source/SolidSyslogLwipRawAddressMessages.c delete mode 100644 Platform/LwipRaw/Source/SolidSyslogLwipRawDatagramMessages.c delete mode 100644 Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolverMessages.c delete mode 100644 Platform/LwipRaw/Source/SolidSyslogLwipRawResolverMessages.c delete mode 100644 Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStreamMessages.c delete mode 100644 Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyMessages.c delete mode 100644 Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyMessages.c delete mode 100644 Platform/MbedTls/Source/SolidSyslogMbedTlsStreamMessages.c delete mode 100644 Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyMessages.c delete mode 100644 Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyMessages.c delete mode 100644 Platform/OpenSsl/Source/SolidSyslogTlsStreamMessages.c delete mode 100644 Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressMessages.c delete mode 100644 Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagramMessages.c delete mode 100644 Platform/PlusTcp/Source/SolidSyslogPlusTcpResolverMessages.c delete mode 100644 Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStreamMessages.c delete mode 100644 Platform/Posix/Source/SolidSyslogGetAddrInfoResolverMessages.c delete mode 100644 Platform/Posix/Source/SolidSyslogPosixAddressMessages.c delete mode 100644 Platform/Posix/Source/SolidSyslogPosixDatagramMessages.c delete mode 100644 Platform/Posix/Source/SolidSyslogPosixFileMessages.c delete mode 100644 Platform/Posix/Source/SolidSyslogPosixMessageQueueBufferMessages.c delete mode 100644 Platform/Posix/Source/SolidSyslogPosixMutexMessages.c delete mode 100644 Platform/Posix/Source/SolidSyslogPosixTcpStreamMessages.c delete mode 100644 Platform/Windows/Source/SolidSyslogWindowsAtomicCounterMessages.c delete mode 100644 Platform/Windows/Source/SolidSyslogWindowsFileMessages.c delete mode 100644 Platform/Windows/Source/SolidSyslogWindowsMutexMessages.c delete mode 100644 Platform/Windows/Source/SolidSyslogWinsockAddressMessages.c delete mode 100644 Platform/Windows/Source/SolidSyslogWinsockDatagramMessages.c delete mode 100644 Platform/Windows/Source/SolidSyslogWinsockResolverMessages.c delete mode 100644 Platform/Windows/Source/SolidSyslogWinsockTcpStreamMessages.c create mode 100644 Tests/Bdd/Targets/BddTargetErrorTextTest.cpp diff --git a/Bdd/Targets/CMakeLists.txt b/Bdd/Targets/CMakeLists.txt index 35482162..f48e7070 100644 --- a/Bdd/Targets/CMakeLists.txt +++ b/Bdd/Targets/CMakeLists.txt @@ -18,6 +18,7 @@ if(SOLIDSYSLOG_POSIX) Linux/BddTargetTcpConfig.c Linux/BddTargetUdpConfig.c Common/BddTargetAppName.c + Common/BddTargetErrorText.c Common/BddTargetInteractive.c Common/BddTargetIps.c Common/BddTargetLanguage.c @@ -52,6 +53,7 @@ elseif(SOLIDSYSLOG_WINSOCK AND HAVE_WINDOWS_PLATFORM) Windows/BddTargetWindows.c Windows/BddTargetWindowsCommandLine.c Common/BddTargetAppName.c + Common/BddTargetErrorText.c Common/BddTargetInteractive.c Common/BddTargetIps.c Common/BddTargetLanguage.c diff --git a/Bdd/Targets/Common/BddTargetErrorText.c b/Bdd/Targets/Common/BddTargetErrorText.c new file mode 100644 index 00000000..97771ef0 --- /dev/null +++ b/Bdd/Targets/Common/BddTargetErrorText.c @@ -0,0 +1,51 @@ +#include "BddTargetErrorText.h" + +#include "SolidSyslogBufferCategories.h" +#include "SolidSyslogErrorCategory.h" +#include "SolidSyslogResolverCategories.h" +#include "SolidSyslogSecurityPolicyCategories.h" +#include "SolidSyslogTlsStreamCategories.h" + +const char* BddTargetErrorText_Category(uint16_t category) +{ + const char* result = "unknown"; + switch (category) + { + case SOLIDSYSLOG_CAT_BAD_CONFIG: + result = "bad config"; + break; + case SOLIDSYSLOG_CAT_BAD_ARGUMENT: + result = "bad argument"; + break; + case SOLIDSYSLOG_CAT_POOL_EXHAUSTED: + result = "pool exhausted"; + break; + case SOLIDSYSLOG_CAT_UNKNOWN_DESTROY: + result = "unknown destroy"; + break; + case SOLIDSYSLOG_CAT_BUFFER_BACKEND_FAILED: + result = "buffer backend failed"; + break; + case SOLIDSYSLOG_CAT_RESOLVER_RESOLVE_FAILED: + result = "resolve failed"; + break; + case SOLIDSYSLOG_CAT_SECURITYPOLICY_KEY_UNAVAILABLE: + result = "key unavailable"; + break; + case SOLIDSYSLOG_CAT_SECURITYPOLICY_SEAL_FAILED: + result = "seal failed"; + break; + case SOLIDSYSLOG_CAT_SECURITYPOLICY_OPEN_FAILED: + result = "open failed"; + break; + case SOLIDSYSLOG_CAT_TLSSTREAM_INIT_FAILED: + result = "TLS init failed"; + break; + case SOLIDSYSLOG_CAT_TLSSTREAM_HANDSHAKE_FAILED: + result = "TLS handshake failed"; + break; + default: + break; + } + return result; +} diff --git a/Bdd/Targets/Common/BddTargetErrorText.h b/Bdd/Targets/Common/BddTargetErrorText.h new file mode 100644 index 00000000..c5be3f76 --- /dev/null +++ b/Bdd/Targets/Common/BddTargetErrorText.h @@ -0,0 +1,14 @@ +#ifndef BDDTARGETERRORTEXT_H +#define BDDTARGETERRORTEXT_H + +#include "ExternC.h" + +#include + +EXTERN_C_BEGIN + + const char* BddTargetErrorText_Category(uint16_t category); + +EXTERN_C_END + +#endif /* BDDTARGETERRORTEXT_H */ diff --git a/Bdd/Targets/Common/BddTargetStderrErrorHandler.c b/Bdd/Targets/Common/BddTargetStderrErrorHandler.c index 07334eb8..cc60a06c 100644 --- a/Bdd/Targets/Common/BddTargetStderrErrorHandler.c +++ b/Bdd/Targets/Common/BddTargetStderrErrorHandler.c @@ -1,9 +1,9 @@ #include "BddTargetStderrErrorHandler.h" -#include #include #include +#include "BddTargetErrorText.h" #include "SolidSyslogError.h" #include "SolidSyslogPrival.h" @@ -11,16 +11,12 @@ static void StderrErrorHandlerEx(void* context, const struct SolidSyslogErrorEve { (void) context; const char* sourceName = ""; - const char* message = ""; const struct SolidSyslogErrorSource* source = event->Source; if (source != NULL) { sourceName = source->Name; - if (source->AsString != NULL) - { - message = source->AsString((uint8_t) event->Detail); - } } + const char* message = BddTargetErrorText_Category(event->Category); if (event->Severity <= SOLIDSYSLOG_SEVERITY_ERROR) { (void) fprintf( diff --git a/Bdd/Targets/FreeRtos/CMakeLists.txt b/Bdd/Targets/FreeRtos/CMakeLists.txt index 15285aeb..62a12b16 100644 --- a/Bdd/Targets/FreeRtos/CMakeLists.txt +++ b/Bdd/Targets/FreeRtos/CMakeLists.txt @@ -260,33 +260,25 @@ add_executable(SolidSyslogBddTarget ${CMAKE_CURRENT_SOURCE_DIR}/Common/CmsdkUart.c ${CMAKE_CURRENT_SOURCE_DIR}/Common/Syscalls.c ${CMAKE_SOURCE_DIR}/Platform/FatFs/Source/SolidSyslogFatFsFile.c - ${CMAKE_SOURCE_DIR}/Platform/FatFs/Source/SolidSyslogFatFsFileMessages.c ${CMAKE_SOURCE_DIR}/Platform/FatFs/Source/SolidSyslogFatFsFileStatic.c ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddress.c - ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressMessages.c ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressStatic.c ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagram.c - ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagramMessages.c ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagramStatic.c ${CMAKE_SOURCE_DIR}/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutex.c - ${CMAKE_SOURCE_DIR}/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexMessages.c ${CMAKE_SOURCE_DIR}/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexStatic.c ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolver.c - ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolverMessages.c ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolverStatic.c ${CMAKE_SOURCE_DIR}/Platform/FreeRtos/Source/SolidSyslogFreeRtosSysUpTime.c ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStream.c - ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStreamMessages.c ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStreamStatic.c ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c - ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamMessages.c ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamStatic.c ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256Policy.c - ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyMessages.c ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyStatic.c ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicy.c - ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyMessages.c ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyStatic.c + ${CMAKE_SOURCE_DIR}/Bdd/Targets/Common/BddTargetErrorText.c ${CMAKE_SOURCE_DIR}/Bdd/Targets/Common/BddTargetInteractive.c ${CMAKE_SOURCE_DIR}/Bdd/Targets/Common/BddTargetIps.c ${CMAKE_SOURCE_DIR}/Bdd/Targets/Common/BddTargetLanguage.c diff --git a/Bdd/Targets/FreeRtos/main.c b/Bdd/Targets/FreeRtos/main.c index f1e9929f..2fc896f5 100644 --- a/Bdd/Targets/FreeRtos/main.c +++ b/Bdd/Targets/FreeRtos/main.c @@ -24,6 +24,7 @@ #include "CmsdkUart.h" #include "BddTargetEnterpriseId.h" +#include "BddTargetErrorText.h" #include "BddTargetInteractive.h" #include "BddTargetIps.h" #include "BddTargetLanguage.h" @@ -489,16 +490,12 @@ static void ErrorHandlerEx(void* context, const struct SolidSyslogErrorEvent* ev { (void) context; const char* sourceName = ""; - const char* message = ""; const struct SolidSyslogErrorSource* source = event->Source; if (source != NULL) { sourceName = source->Name; - if (source->AsString != NULL) - { - message = source->AsString((uint8_t) event->Detail); - } } + const char* message = BddTargetErrorText_Category(event->Category); (void) printf( "[solidsyslog] severity=%d [%s cat=%u detail=%ld] %s\n", (int) event->Severity, diff --git a/Bdd/Targets/FreeRtosLwip/CMakeLists.txt b/Bdd/Targets/FreeRtosLwip/CMakeLists.txt index 3898fede..9c503253 100644 --- a/Bdd/Targets/FreeRtosLwip/CMakeLists.txt +++ b/Bdd/Targets/FreeRtosLwip/CMakeLists.txt @@ -200,25 +200,20 @@ add_executable(SolidSyslogBddTargetLwip ${FREERTOS_COMMON_DIR}/Syscalls.c netif/EthernetIf.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawAddress.c - ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressMessages.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressStatic.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolver.c - ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolverMessages.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolverStatic.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagram.c - ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagramMessages.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagramStatic.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStream.c - ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStreamMessages.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStreamStatic.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawMarshal.c ${CMAKE_SOURCE_DIR}/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutex.c - ${CMAKE_SOURCE_DIR}/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexMessages.c ${CMAKE_SOURCE_DIR}/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexStatic.c ${CMAKE_SOURCE_DIR}/Platform/FreeRtos/Source/SolidSyslogFreeRtosSysUpTime.c ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c - ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamMessages.c ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamStatic.c + ${CMAKE_SOURCE_DIR}/Bdd/Targets/Common/BddTargetErrorText.c ${CMAKE_SOURCE_DIR}/Bdd/Targets/Common/BddTargetInteractive.c ${CMAKE_SOURCE_DIR}/Bdd/Targets/Common/BddTargetIps.c ${CMAKE_SOURCE_DIR}/Bdd/Targets/Common/BddTargetLanguage.c diff --git a/Bdd/Targets/FreeRtosLwip/main.c b/Bdd/Targets/FreeRtosLwip/main.c index d5bb0a66..66f53501 100644 --- a/Bdd/Targets/FreeRtosLwip/main.c +++ b/Bdd/Targets/FreeRtosLwip/main.c @@ -29,6 +29,7 @@ #include "EthernetIf.h" #include "BddTargetEnterpriseId.h" +#include "BddTargetErrorText.h" #include "BddTargetInteractive.h" #include "BddTargetIps.h" #include "BddTargetLanguage.h" @@ -376,16 +377,12 @@ static void ErrorHandlerEx(void* context, const struct SolidSyslogErrorEvent* ev { (void) context; const char* sourceName = ""; - const char* message = ""; const struct SolidSyslogErrorSource* source = event->Source; if (source != NULL) { sourceName = source->Name; - if (source->AsString != NULL) - { - message = source->AsString((uint8_t) event->Detail); - } } + const char* message = BddTargetErrorText_Category(event->Category); (void) printf( "[solidsyslog] severity=%d [%s cat=%u detail=%ld] %s\n", (int) event->Severity, diff --git a/Core/Interface/SolidSyslogError.h b/Core/Interface/SolidSyslogError.h index bb284d84..e31a8894 100644 --- a/Core/Interface/SolidSyslogError.h +++ b/Core/Interface/SolidSyslogError.h @@ -11,7 +11,6 @@ EXTERN_C_BEGIN struct SolidSyslogErrorSource { const char* Name; - const char* (*AsString)(uint8_t code); }; struct SolidSyslogErrorEvent diff --git a/Core/Source/CMakeLists.txt b/Core/Source/CMakeLists.txt index c18daf79..6e3c2109 100644 --- a/Core/Source/CMakeLists.txt +++ b/Core/Source/CMakeLists.txt @@ -1,24 +1,19 @@ set(SOURCES SolidSyslog.c - SolidSyslogMessages.c SolidSyslogStatic.c SolidSyslogError.c SolidSyslogConfigLock.c SolidSyslogSwitchingSender.c - SolidSyslogSwitchingSenderMessages.c SolidSyslogSwitchingSenderStatic.c SolidSyslogBuffer.c SolidSyslogFormatter.c SolidSyslogTimestampFormatter.c SolidSyslogMessageFormatter.c SolidSyslogMetaSd.c - SolidSyslogMetaSdMessages.c SolidSyslogMetaSdStatic.c SolidSyslogPassthroughBuffer.c - SolidSyslogPassthroughBufferMessages.c SolidSyslogPassthroughBufferStatic.c SolidSyslogCircularBuffer.c - SolidSyslogCircularBufferMessages.c SolidSyslogCircularBufferStatic.c SolidSyslogPoolAllocator.c SolidSyslogMutex.c @@ -37,15 +32,12 @@ set(SOURCES SolidSyslogNullStream.c SolidSyslogStructuredData.c SolidSyslogTimeQualitySd.c - SolidSyslogTimeQualitySdMessages.c SolidSyslogTimeQualitySdStatic.c SolidSyslogOriginSd.c - SolidSyslogOriginSdMessages.c SolidSyslogOriginSdStatic.c SolidSyslogFile.c SolidSyslogNullFile.c SolidSyslogBlockStore.c - SolidSyslogBlockStoreMessages.c SolidSyslogBlockStoreStatic.c RecordStore.c RecordStoreStatic.c @@ -53,7 +45,6 @@ set(SOURCES BlockSequenceStatic.c SolidSyslogBlockDevice.c SolidSyslogFileBlockDevice.c - SolidSyslogFileBlockDeviceMessages.c SolidSyslogFileBlockDeviceStatic.c SolidSyslogUdpPayload.c ) @@ -78,10 +69,8 @@ if(SOLIDSYSLOG_POSIX OR SOLIDSYSLOG_WINSOCK OR DEFINED ENV{FREERTOS_KERNEL_PATH} SolidSyslogDatagram.c SolidSyslogNullDatagram.c SolidSyslogUdpSender.c - SolidSyslogUdpSenderMessages.c SolidSyslogUdpSenderStatic.c SolidSyslogStreamSender.c - SolidSyslogStreamSenderMessages.c SolidSyslogStreamSenderStatic.c ) endif() diff --git a/Core/Source/SolidSyslog.c b/Core/Source/SolidSyslog.c index b16372c6..c2ab082b 100644 --- a/Core/Source/SolidSyslog.c +++ b/Core/Source/SolidSyslog.c @@ -21,6 +21,8 @@ #include "SolidSyslogTimestamp.h" #include "SolidSyslogTunables.h" +const struct SolidSyslogErrorSource SolidSyslogErrorSource = {"SolidSyslog"}; + struct SolidSyslogBuffer; struct SolidSyslogFormatter; struct SolidSyslogSender; diff --git a/Core/Source/SolidSyslogBlockStore.c b/Core/Source/SolidSyslogBlockStore.c index 18e50436..aaac42ac 100644 --- a/Core/Source/SolidSyslogBlockStore.c +++ b/Core/Source/SolidSyslogBlockStore.c @@ -6,10 +6,14 @@ #include "BlockSequencePrivate.h" #include "RecordStorePrivate.h" #include "SolidSyslogBlockDevice.h" +#include "SolidSyslogBlockStoreErrors.h" #include "SolidSyslogBlockStorePrivate.h" +#include "SolidSyslogError.h" #include "SolidSyslogNullStore.h" #include "SolidSyslogStoreDefinition.h" +const struct SolidSyslogErrorSource BlockStoreErrorSource = {"BlockStore"}; + /* vtable — forward-declared because BlockStore_InitialiseVtable references them before their definitions */ static bool BlockStore_Write(struct SolidSyslogStore* base, const void* data, size_t size); static bool BlockStore_ReadNextUnsent(struct SolidSyslogStore* base, void* data, size_t maxSize, size_t* bytesRead); diff --git a/Core/Source/SolidSyslogBlockStoreMessages.c b/Core/Source/SolidSyslogBlockStoreMessages.c deleted file mode 100644 index e26bdc32..00000000 --- a/Core/Source/SolidSyslogBlockStoreMessages.c +++ /dev/null @@ -1,22 +0,0 @@ -#include - -#include "SolidSyslogBlockStoreErrors.h" -#include "SolidSyslogError.h" - -static const char* BlockStoreError_AsString(uint8_t code) -{ - static const char* const messages[BLOCKSTORE_ERROR_MAX] = { - [BLOCKSTORE_ERROR_POOL_EXHAUSTED] = "SolidSyslogBlockStore_Create pool exhausted; returning fallback store", - [BLOCKSTORE_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogBlockStore_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) BLOCKSTORE_ERROR_MAX) - { - enum SolidSyslogBlockStoreErrors typed = (enum SolidSyslogBlockStoreErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource BlockStoreErrorSource = {"BlockStore", BlockStoreError_AsString}; diff --git a/Core/Source/SolidSyslogCircularBuffer.c b/Core/Source/SolidSyslogCircularBuffer.c index ef249b57..8299428b 100644 --- a/Core/Source/SolidSyslogCircularBuffer.c +++ b/Core/Source/SolidSyslogCircularBuffer.c @@ -6,11 +6,15 @@ #include #include "SolidSyslogBufferDefinition.h" +#include "SolidSyslogCircularBufferErrors.h" #include "SolidSyslogCircularBufferPrivate.h" +#include "SolidSyslogError.h" #include "SolidSyslogMutex.h" #include "SolidSyslogNullBuffer.h" #include "SolidSyslogTunables.h" +const struct SolidSyslogErrorSource CircularBufferErrorSource = {"CircularBuffer"}; + enum { HEADER_BYTES = SOLIDSYSLOG_CIRCULAR_BUFFER_HEADER_BYTES diff --git a/Core/Source/SolidSyslogCircularBufferMessages.c b/Core/Source/SolidSyslogCircularBufferMessages.c deleted file mode 100644 index 03a6d11e..00000000 --- a/Core/Source/SolidSyslogCircularBufferMessages.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "SolidSyslogCircularBufferErrors.h" -#include "SolidSyslogError.h" - -static const char* CircularBufferError_AsString(uint8_t code) -{ - static const char* const messages[CIRCULARBUFFER_ERROR_MAX] = { - [CIRCULARBUFFER_ERROR_POOL_EXHAUSTED] = - "SolidSyslogCircularBuffer_Create pool exhausted; returning fallback buffer", - [CIRCULARBUFFER_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogCircularBuffer_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) CIRCULARBUFFER_ERROR_MAX) - { - enum SolidSyslogCircularBufferErrors typed = (enum SolidSyslogCircularBufferErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource CircularBufferErrorSource = {"CircularBuffer", CircularBufferError_AsString}; diff --git a/Core/Source/SolidSyslogFileBlockDevice.c b/Core/Source/SolidSyslogFileBlockDevice.c index 00afdce3..fb66c5cb 100644 --- a/Core/Source/SolidSyslogFileBlockDevice.c +++ b/Core/Source/SolidSyslogFileBlockDevice.c @@ -5,12 +5,16 @@ #include #include "SolidSyslogBlockDeviceDefinition.h" +#include "SolidSyslogError.h" #include "SolidSyslogFile.h" +#include "SolidSyslogFileBlockDeviceErrors.h" #include "SolidSyslogFileBlockDevicePrivate.h" #include "SolidSyslogFormatter.h" #include "SolidSyslogNullBlockDevice.h" #include "SolidSyslogTunables.h" +const struct SolidSyslogErrorSource FileBlockDeviceErrorSource = {"FileBlockDevice"}; + struct SolidSyslogFile; static const char FILE_EXTENSION[] = ".log"; diff --git a/Core/Source/SolidSyslogFileBlockDeviceMessages.c b/Core/Source/SolidSyslogFileBlockDeviceMessages.c deleted file mode 100644 index 8d32a1fc..00000000 --- a/Core/Source/SolidSyslogFileBlockDeviceMessages.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogFileBlockDeviceErrors.h" - -static const char* FileBlockDeviceError_AsString(uint8_t code) -{ - static const char* const messages[FILEBLOCKDEVICE_ERROR_MAX] = { - [FILEBLOCKDEVICE_ERROR_POOL_EXHAUSTED] = - "SolidSyslogFileBlockDevice_Create pool exhausted; returning fallback block device", - [FILEBLOCKDEVICE_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogFileBlockDevice_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) FILEBLOCKDEVICE_ERROR_MAX) - { - enum SolidSyslogFileBlockDeviceErrors typed = (enum SolidSyslogFileBlockDeviceErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource FileBlockDeviceErrorSource = {"FileBlockDevice", FileBlockDeviceError_AsString}; diff --git a/Core/Source/SolidSyslogMessages.c b/Core/Source/SolidSyslogMessages.c deleted file mode 100644 index b3eaf51e..00000000 --- a/Core/Source/SolidSyslogMessages.c +++ /dev/null @@ -1,30 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogErrors.h" - -static const char* SolidSyslogError_AsString(uint8_t code) -{ - static const char* const messages[SOLIDSYSLOG_ERROR_MAX] = { - [SOLIDSYSLOG_ERROR_CREATE_NULL_CONFIG] = "SolidSyslog_Create called with NULL config", - [SOLIDSYSLOG_ERROR_CREATE_NULL_BUFFER] = "SolidSyslog_Create config.Buffer is NULL", - [SOLIDSYSLOG_ERROR_CREATE_NULL_SENDER] = "SolidSyslog_Create config.Sender is NULL", - [SOLIDSYSLOG_ERROR_CREATE_NULL_STORE] = "SolidSyslog_Create config.Store is NULL", - [SOLIDSYSLOG_ERROR_CREATE_INCONSISTENT_SD] = - "SolidSyslog_Create config.Sd is NULL but config.SdCount is non-zero", - [SOLIDSYSLOG_ERROR_LOG_NULL_MESSAGE] = "SolidSyslog_Log called with NULL message", - [SOLIDSYSLOG_ERROR_LOG_NULL_HANDLE] = "SolidSyslog_Log called with NULL handle", - [SOLIDSYSLOG_ERROR_SERVICE_NULL_HANDLE] = "SolidSyslog_Service called with NULL handle", - [SOLIDSYSLOG_ERROR_POOL_EXHAUSTED] = "SolidSyslog_Create pool exhausted; returning fallback instance", - [SOLIDSYSLOG_ERROR_UNKNOWN_DESTROY] = "SolidSyslog_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) SOLIDSYSLOG_ERROR_MAX) - { - enum SolidSyslogErrors typed = (enum SolidSyslogErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource SolidSyslogErrorSource = {"SolidSyslog", SolidSyslogError_AsString}; diff --git a/Core/Source/SolidSyslogMetaSd.c b/Core/Source/SolidSyslogMetaSd.c index 046e4d6f..0993cbdc 100644 --- a/Core/Source/SolidSyslogMetaSd.c +++ b/Core/Source/SolidSyslogMetaSd.c @@ -3,11 +3,15 @@ #include #include "SolidSyslogAtomicCounter.h" +#include "SolidSyslogError.h" #include "SolidSyslogFormatter.h" +#include "SolidSyslogMetaSdErrors.h" #include "SolidSyslogMetaSdPrivate.h" #include "SolidSyslogNullSd.h" #include "SolidSyslogStructuredDataDefinition.h" +const struct SolidSyslogErrorSource MetaSdErrorSource = {"MetaSd"}; + struct SolidSyslogFormatter; static void MetaSd_Format(struct SolidSyslogStructuredData* base, struct SolidSyslogFormatter* formatter); diff --git a/Core/Source/SolidSyslogMetaSdMessages.c b/Core/Source/SolidSyslogMetaSdMessages.c deleted file mode 100644 index 0810f9b3..00000000 --- a/Core/Source/SolidSyslogMetaSdMessages.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogMetaSdErrors.h" - -static const char* MetaSdError_AsString(uint8_t code) -{ - static const char* const messages[METASD_ERROR_MAX] = { - [METASD_ERROR_NULL_CONFIG] = "SolidSyslogMetaSd_Create called with NULL config", - [METASD_ERROR_NULL_COUNTER] = "SolidSyslogMetaSd_Create config.Counter is NULL", - [METASD_ERROR_POOL_EXHAUSTED] = "SolidSyslogMetaSd_Create pool exhausted; returning fallback SD", - [METASD_ERROR_UNKNOWN_DESTROY] = "SolidSyslogMetaSd_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) METASD_ERROR_MAX) - { - enum SolidSyslogMetaSdErrors typed = (enum SolidSyslogMetaSdErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource MetaSdErrorSource = {"MetaSd", MetaSdError_AsString}; diff --git a/Core/Source/SolidSyslogOriginSd.c b/Core/Source/SolidSyslogOriginSd.c index d44a1396..75238990 100644 --- a/Core/Source/SolidSyslogOriginSd.c +++ b/Core/Source/SolidSyslogOriginSd.c @@ -2,11 +2,15 @@ #include +#include "SolidSyslogError.h" #include "SolidSyslogFormatter.h" #include "SolidSyslogNullSd.h" +#include "SolidSyslogOriginSdErrors.h" #include "SolidSyslogOriginSdPrivate.h" #include "SolidSyslogStructuredDataDefinition.h" +const struct SolidSyslogErrorSource OriginSdErrorSource = {"OriginSd"}; + static void OriginSd_Format(struct SolidSyslogStructuredData* base, struct SolidSyslogFormatter* formatter); static inline struct SolidSyslogOriginSd* OriginSd_SelfFromBase(struct SolidSyslogStructuredData* base); diff --git a/Core/Source/SolidSyslogOriginSdMessages.c b/Core/Source/SolidSyslogOriginSdMessages.c deleted file mode 100644 index 86173f7f..00000000 --- a/Core/Source/SolidSyslogOriginSdMessages.c +++ /dev/null @@ -1,21 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogOriginSdErrors.h" - -static const char* OriginSdError_AsString(uint8_t code) -{ - static const char* const messages[ORIGINSD_ERROR_MAX] = { - [ORIGINSD_ERROR_POOL_EXHAUSTED] = "SolidSyslogOriginSd_Create pool exhausted; returning fallback SD", - [ORIGINSD_ERROR_UNKNOWN_DESTROY] = "SolidSyslogOriginSd_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) ORIGINSD_ERROR_MAX) - { - enum SolidSyslogOriginSdErrors typed = (enum SolidSyslogOriginSdErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource OriginSdErrorSource = {"OriginSd", OriginSdError_AsString}; diff --git a/Core/Source/SolidSyslogPassthroughBuffer.c b/Core/Source/SolidSyslogPassthroughBuffer.c index bfec7e2b..0bac3117 100644 --- a/Core/Source/SolidSyslogPassthroughBuffer.c +++ b/Core/Source/SolidSyslogPassthroughBuffer.c @@ -4,10 +4,14 @@ #include #include "SolidSyslogBufferDefinition.h" +#include "SolidSyslogError.h" #include "SolidSyslogNullBuffer.h" +#include "SolidSyslogPassthroughBufferErrors.h" #include "SolidSyslogPassthroughBufferPrivate.h" #include "SolidSyslogSender.h" +const struct SolidSyslogErrorSource PassthroughBufferErrorSource = {"PassthroughBuffer"}; + static bool PassthroughBuffer_Read(struct SolidSyslogBuffer* base, void* data, size_t maxSize, size_t* bytesRead); static void PassthroughBuffer_Write(struct SolidSyslogBuffer* base, const void* data, size_t size); diff --git a/Core/Source/SolidSyslogPassthroughBufferMessages.c b/Core/Source/SolidSyslogPassthroughBufferMessages.c deleted file mode 100644 index 8fdd9ea7..00000000 --- a/Core/Source/SolidSyslogPassthroughBufferMessages.c +++ /dev/null @@ -1,28 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogPassthroughBufferErrors.h" - -static const char* PassthroughBufferError_AsString(uint8_t code) -{ - static const char* const messages[PASSTHROUGHBUFFER_ERROR_MAX] = { - [PASSTHROUGHBUFFER_ERROR_POOL_EXHAUSTED] = - "SolidSyslogPassthroughBuffer_Create pool exhausted; returning fallback buffer", - [PASSTHROUGHBUFFER_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogPassthroughBuffer_Destroy called with a handle not issued by this pool", - [PASSTHROUGHBUFFER_ERROR_NULL_SENDER] = - "SolidSyslogPassthroughBuffer_Create called with NULL sender; returning fallback buffer", - }; - const char* result = "unknown"; - if (code < (uint8_t) PASSTHROUGHBUFFER_ERROR_MAX) - { - enum SolidSyslogPassthroughBufferErrors typed = (enum SolidSyslogPassthroughBufferErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource PassthroughBufferErrorSource = { - "PassthroughBuffer", - PassthroughBufferError_AsString -}; diff --git a/Core/Source/SolidSyslogStreamSender.c b/Core/Source/SolidSyslogStreamSender.c index ead6ac36..8efbc01b 100644 --- a/Core/Source/SolidSyslogStreamSender.c +++ b/Core/Source/SolidSyslogStreamSender.c @@ -3,15 +3,19 @@ #include #include "SolidSyslogEndpoint.h" +#include "SolidSyslogError.h" #include "SolidSyslogFormatter.h" #include "SolidSyslogNullSender.h" #include "SolidSyslogResolver.h" #include "SolidSyslogSenderDefinition.h" #include "SolidSyslogStream.h" #include "SolidSyslogStreamSender.h" +#include "SolidSyslogStreamSenderErrors.h" #include "SolidSyslogStreamSenderPrivate.h" #include "SolidSyslogTransport.h" +const struct SolidSyslogErrorSource StreamSenderErrorSource = {"StreamSender"}; + struct SolidSyslogAddress; struct SolidSyslogFormatter; diff --git a/Core/Source/SolidSyslogStreamSenderMessages.c b/Core/Source/SolidSyslogStreamSenderMessages.c deleted file mode 100644 index df40ca8a..00000000 --- a/Core/Source/SolidSyslogStreamSenderMessages.c +++ /dev/null @@ -1,27 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogStreamSenderErrors.h" - -static const char* StreamSenderError_AsString(uint8_t code) -{ - static const char* const messages[STREAMSENDER_ERROR_MAX] = { - [STREAMSENDER_ERROR_NULL_CONFIG] = "SolidSyslogStreamSender_Create called with NULL config", - [STREAMSENDER_ERROR_NULL_RESOLVER] = "SolidSyslogStreamSender_Create config.Resolver is NULL", - [STREAMSENDER_ERROR_NULL_STREAM] = "SolidSyslogStreamSender_Create config.Stream is NULL", - [STREAMSENDER_ERROR_NULL_ADDRESS] = "SolidSyslogStreamSender_Create config.Address is NULL", - [STREAMSENDER_ERROR_POOL_EXHAUSTED] = - "SolidSyslogStreamSender_Create pool exhausted; returning fallback sender", - [STREAMSENDER_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogStreamSender_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) STREAMSENDER_ERROR_MAX) - { - enum SolidSyslogStreamSenderErrors typed = (enum SolidSyslogStreamSenderErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource StreamSenderErrorSource = {"StreamSender", StreamSenderError_AsString}; diff --git a/Core/Source/SolidSyslogSwitchingSender.c b/Core/Source/SolidSyslogSwitchingSender.c index 820be7af..3a922eb5 100644 --- a/Core/Source/SolidSyslogSwitchingSender.c +++ b/Core/Source/SolidSyslogSwitchingSender.c @@ -2,12 +2,16 @@ #include #include +#include "SolidSyslogError.h" #include "SolidSyslogNullSender.h" #include "SolidSyslogSender.h" #include "SolidSyslogSenderDefinition.h" #include "SolidSyslogSwitchingSender.h" +#include "SolidSyslogSwitchingSenderErrors.h" #include "SolidSyslogSwitchingSenderPrivate.h" +const struct SolidSyslogErrorSource SwitchingSenderErrorSource = {"SwitchingSender"}; + static bool SwitchingSender_Send(struct SolidSyslogSender* base, const void* buffer, size_t size); static void SwitchingSender_Disconnect(struct SolidSyslogSender* base); diff --git a/Core/Source/SolidSyslogSwitchingSenderMessages.c b/Core/Source/SolidSyslogSwitchingSenderMessages.c deleted file mode 100644 index 895f7e70..00000000 --- a/Core/Source/SolidSyslogSwitchingSenderMessages.c +++ /dev/null @@ -1,26 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogSwitchingSenderErrors.h" - -static const char* SwitchingSenderError_AsString(uint8_t code) -{ - static const char* const messages[SWITCHINGSENDER_ERROR_MAX] = { - [SWITCHINGSENDER_ERROR_NULL_CONFIG] = "SolidSyslogSwitchingSender_Create called with NULL config", - [SWITCHINGSENDER_ERROR_NULL_SENDERS] = "SolidSyslogSwitchingSender_Create config.Senders is NULL", - [SWITCHINGSENDER_ERROR_NULL_SELECTOR] = "SolidSyslogSwitchingSender_Create config.Selector is NULL", - [SWITCHINGSENDER_ERROR_POOL_EXHAUSTED] = - "SolidSyslogSwitchingSender_Create pool exhausted; returning fallback sender", - [SWITCHINGSENDER_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogSwitchingSender_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) SWITCHINGSENDER_ERROR_MAX) - { - enum SolidSyslogSwitchingSenderErrors typed = (enum SolidSyslogSwitchingSenderErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource SwitchingSenderErrorSource = {"SwitchingSender", SwitchingSenderError_AsString}; diff --git a/Core/Source/SolidSyslogTimeQualitySd.c b/Core/Source/SolidSyslogTimeQualitySd.c index 7d279cbd..16be0975 100644 --- a/Core/Source/SolidSyslogTimeQualitySd.c +++ b/Core/Source/SolidSyslogTimeQualitySd.c @@ -4,11 +4,15 @@ #include #include +#include "SolidSyslogError.h" #include "SolidSyslogFormatter.h" #include "SolidSyslogNullSd.h" #include "SolidSyslogStructuredDataDefinition.h" +#include "SolidSyslogTimeQualitySdErrors.h" #include "SolidSyslogTimeQualitySdPrivate.h" +const struct SolidSyslogErrorSource TimeQualitySdErrorSource = {"TimeQualitySd"}; + struct SolidSyslogFormatter; static void TimeQualitySd_Format(struct SolidSyslogStructuredData* base, struct SolidSyslogFormatter* formatter); diff --git a/Core/Source/SolidSyslogTimeQualitySdMessages.c b/Core/Source/SolidSyslogTimeQualitySdMessages.c deleted file mode 100644 index 29144a28..00000000 --- a/Core/Source/SolidSyslogTimeQualitySdMessages.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogTimeQualitySdErrors.h" - -static const char* TimeQualitySdError_AsString(uint8_t code) -{ - static const char* const messages[TIMEQUALITYSD_ERROR_MAX] = { - [TIMEQUALITYSD_ERROR_NULL_CALLBACK] = "SolidSyslogTimeQualitySd_Create called with NULL getTimeQuality", - [TIMEQUALITYSD_ERROR_POOL_EXHAUSTED] = "SolidSyslogTimeQualitySd_Create pool exhausted; returning fallback SD", - [TIMEQUALITYSD_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogTimeQualitySd_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) TIMEQUALITYSD_ERROR_MAX) - { - enum SolidSyslogTimeQualitySdErrors typed = (enum SolidSyslogTimeQualitySdErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource TimeQualitySdErrorSource = {"TimeQualitySd", TimeQualitySdError_AsString}; diff --git a/Core/Source/SolidSyslogUdpSender.c b/Core/Source/SolidSyslogUdpSender.c index 6b21613b..65e2daf1 100644 --- a/Core/Source/SolidSyslogUdpSender.c +++ b/Core/Source/SolidSyslogUdpSender.c @@ -19,6 +19,8 @@ struct SolidSyslogFormatter; +const struct SolidSyslogErrorSource UdpSenderErrorSource = {"UdpSender"}; + static bool UdpSender_Send(struct SolidSyslogSender* base, const void* buffer, size_t size); static void UdpSender_Disconnect(struct SolidSyslogSender* base); diff --git a/Core/Source/SolidSyslogUdpSenderMessages.c b/Core/Source/SolidSyslogUdpSenderMessages.c deleted file mode 100644 index 93a3be38..00000000 --- a/Core/Source/SolidSyslogUdpSenderMessages.c +++ /dev/null @@ -1,27 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogUdpSenderErrors.h" - -static const char* UdpSenderError_AsString(uint8_t code) -{ - static const char* const messages[UDPSENDER_ERROR_MAX] = { - [UDPSENDER_ERROR_NULL_CONFIG] = "SolidSyslogUdpSender_Create called with NULL config", - [UDPSENDER_ERROR_NULL_RESOLVER] = "SolidSyslogUdpSender_Create config.Resolver is NULL", - [UDPSENDER_ERROR_NULL_DATAGRAM] = "SolidSyslogUdpSender_Create config.Datagram is NULL", - [UDPSENDER_ERROR_NULL_ADDRESS] = "SolidSyslogUdpSender_Create config.Address is NULL", - [UDPSENDER_ERROR_NULL_ENDPOINT] = "SolidSyslogUdpSender_Create config.Endpoint is NULL", - [UDPSENDER_ERROR_SEND_NULL_BUFFER] = "SolidSyslogUdpSender_Send called with NULL buffer", - [UDPSENDER_ERROR_POOL_EXHAUSTED] = "SolidSyslogUdpSender_Create pool exhausted; returning fallback sender", - [UDPSENDER_ERROR_UNKNOWN_DESTROY] = "SolidSyslogUdpSender_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) UDPSENDER_ERROR_MAX) - { - enum SolidSyslogUdpSenderErrors typed = (enum SolidSyslogUdpSenderErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource UdpSenderErrorSource = {"UdpSender", UdpSenderError_AsString}; diff --git a/DEVLOG.md b/DEVLOG.md index 768c9164..4654527a 100644 --- a/DEVLOG.md +++ b/DEVLOG.md @@ -1,5 +1,76 @@ # Dev Log +## 2026-06-03 — S12.26 Error text decoupling — codes-only library + +Completed the error-reporting redesign begun in S12.25: the library is now +**codes-only**. The 43 `*Messages.c` translation units — every error message +string table — are deleted. `struct SolidSyslogErrorSource` slims to +`{ const char* Name; }`; `AsString` is gone. + +### Decisions + +- **Slim struct over the link-seam override.** The original intent (recalled by + David) was that `AsString` stay on the struct as an *overridable* per-class + symbol, so an integrator could substitute their own and the library's strings + would never link. The implementation had drifted — the resolver was `static` + and co-located with the source symbol, so referencing a source always linked + its table. We could have restored the seam, but it was judged overkill: its + only payoff is free per-detail dispatch in the bundled handler, and it forces a + `TextNull.c` workaround to reach true zero-text (no weak symbols allowed). The + slim struct gives zero-text **by construction** — strings link only if some + code calls a text function, and none does. +- **Consumer-lens reframing.** A library *user* has one hook: install one + `SolidSyslogErrorHandler` and react on the four event axes + (Severity / Source / Category / Detail). Those reaction axes were all delivered + by S12.25; S12.26 only moves *text*, which only the log path wants — an HMI + keys on the portable `Category`, and a codes-only build links nothing. So text + decoupling is invisible to the user and actively helps the flash-constrained / + i18n integrator. +- **One consumer-side text owner.** `BddTargetErrorText_Category(uint16_t)` (12 + categories, TDD'd) is the single place mapping the portable category axis to + prose. The three BDD/FreeRtos handlers print `Source->Name` + category text + + numeric `Detail`; no per-source dispatch table needed. Lives in + `Bdd/Targets/Common/` for now — promotable to a top-level `Example/` for the + future SL1/SL2/SL3 worked examples without touching the library. +- **Source symbol relocates to the vtable TU `Xxx.c`, never `Static.c`.** The + error identity is allocation-agnostic; `Static.c` is the static-allocation TU + (a future `Dynamic.c` would emit the same source). Each `Xxx.c` gains + `SolidSyslogError.h` + its `*Errors.h` (MISRA 8.4). +- **`_Report` wrapper unwound.** The 4 crypto-policy classes were the only ones + routing emission through an `Xxx_Report(sev, cat, code)` indirection; inlined + all 24 call sites to the direct `SolidSyslog_Error(...)` the other 39 use, so + they're uniform. A *uniform* wrapper, if ever wanted, is a clean separate + refactor. +- **D.014 (MISRA 8.7) retired.** It existed because `_Report` confined each + crypto source's use to one TU; the unwind makes them cross-TU referenced like + every other source. cppcheck-misra reports no 8.7; the 4 suppressions and the + deviation are gone (tombstoned). +- **Validation:** gcc + clang `1391` tests; freertos-host all platform suites + (FreeRtos/Lwip/MbedTls/FatFs); both FreeRTOS cross BDD ELFs built; clang-tidy, + clang-format, cppcheck-misra all clean. Windows/MSVC left to CI. + +### Deferred + +- **Delivery-health events.** Tracing the consumer use cases surfaced a real gap: + "server down" raises *no* event today — the Sender/Stream category bases are + reserved-but-unallocated and `PosixTcpStream` is silent on connect/send + failure, so a user cannot react to "can't reach the server". Worth more than + any text decision; proposed as the next E12 story (edge-triggered + stalled/resumed categories + documented handler execution contract). Out of + scope here. +- **Rich per-detail prose** in the text handler — shipped category-only + + numeric detail; per-class prose is addable later as deletable example code. +- **Codes-only CI gate** — dropped. With the strings physically removed (not + hidden behind a link choice), codes-only is true by construction; a regression + would be a visible code addition in review, not a silent link inclusion. + +### Open questions + +- CI to confirm Windows/MSVC and the exact cppcheck / freertos-analysis lane + scoping. `misra_renumber.py` bails `AMBIGUOUS` (new 2.4 *analysis* findings on + now-unused enum tags confuse its count-matching), but the actual cppcheck-misra + gate is green, so nothing is gate-failing to renumber. + ## 2026-06-01 — S12.24 Report inconsistent SD config Closed the SD config-pair consistency gap CodeRabbit re-raised on PR #502 (deferred diff --git a/Platform/Atomics/CMakeLists.txt b/Platform/Atomics/CMakeLists.txt index 77a461d8..2f68b5f8 100644 --- a/Platform/Atomics/CMakeLists.txt +++ b/Platform/Atomics/CMakeLists.txt @@ -1,7 +1,6 @@ if(HAVE_STDATOMIC_H) target_sources(${PROJECT_NAME} PRIVATE Source/SolidSyslogStdAtomicCounter.c - Source/SolidSyslogStdAtomicCounterMessages.c Source/SolidSyslogStdAtomicCounterStatic.c ) endif() diff --git a/Platform/Atomics/Source/SolidSyslogStdAtomicCounter.c b/Platform/Atomics/Source/SolidSyslogStdAtomicCounter.c index d4e61a87..555fe663 100644 --- a/Platform/Atomics/Source/SolidSyslogStdAtomicCounter.c +++ b/Platform/Atomics/Source/SolidSyslogStdAtomicCounter.c @@ -5,9 +5,13 @@ #include "SolidSyslogAtomicCounter.h" #include "SolidSyslogAtomicCounterDefinition.h" +#include "SolidSyslogError.h" #include "SolidSyslogNullAtomicCounter.h" +#include "SolidSyslogStdAtomicCounterErrors.h" #include "SolidSyslogStdAtomicCounterPrivate.h" +const struct SolidSyslogErrorSource StdAtomicCounterErrorSource = {"StdAtomicCounter"}; + static uint32_t StdAtomicCounter_Increment(struct SolidSyslogAtomicCounter* base); static void StdAtomicCounter_Init(struct SolidSyslogStdAtomicCounter* self, uint32_t value); diff --git a/Platform/Atomics/Source/SolidSyslogStdAtomicCounterMessages.c b/Platform/Atomics/Source/SolidSyslogStdAtomicCounterMessages.c deleted file mode 100644 index dafa6b05..00000000 --- a/Platform/Atomics/Source/SolidSyslogStdAtomicCounterMessages.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogStdAtomicCounterErrors.h" - -static const char* StdAtomicCounterError_AsString(uint8_t code) -{ - static const char* const messages[STDATOMICCOUNTER_ERROR_MAX] = { - [STDATOMICCOUNTER_ERROR_POOL_EXHAUSTED] = - "SolidSyslogStdAtomicCounter_Create pool exhausted; returning fallback counter", - [STDATOMICCOUNTER_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogStdAtomicCounter_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) STDATOMICCOUNTER_ERROR_MAX) - { - enum SolidSyslogStdAtomicCounterErrors typed = (enum SolidSyslogStdAtomicCounterErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource StdAtomicCounterErrorSource = {"StdAtomicCounter", StdAtomicCounterError_AsString}; diff --git a/Platform/FatFs/Source/SolidSyslogFatFsFile.c b/Platform/FatFs/Source/SolidSyslogFatFsFile.c index e3ee64fa..e60de6bb 100644 --- a/Platform/FatFs/Source/SolidSyslogFatFsFile.c +++ b/Platform/FatFs/Source/SolidSyslogFatFsFile.c @@ -3,11 +3,15 @@ #include #include +#include "SolidSyslogError.h" +#include "SolidSyslogFatFsFileErrors.h" #include "SolidSyslogFatFsFilePrivate.h" #include "SolidSyslogFileDefinition.h" #include "SolidSyslogNullFile.h" #include "ff.h" +const struct SolidSyslogErrorSource FatFsFileErrorSource = {"FatFsFile"}; + #define READ_WRITE_OR_CREATE (FA_READ | FA_WRITE | FA_OPEN_ALWAYS) static bool FatFsFile_Open(struct SolidSyslogFile* base, const char* path); diff --git a/Platform/FatFs/Source/SolidSyslogFatFsFileMessages.c b/Platform/FatFs/Source/SolidSyslogFatFsFileMessages.c deleted file mode 100644 index dda8464c..00000000 --- a/Platform/FatFs/Source/SolidSyslogFatFsFileMessages.c +++ /dev/null @@ -1,21 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogFatFsFileErrors.h" - -static const char* FatFsFileError_AsString(uint8_t code) -{ - static const char* const messages[FATFSFILE_ERROR_MAX] = { - [FATFSFILE_ERROR_POOL_EXHAUSTED] = "SolidSyslogFatFsFile_Create pool exhausted; returning fallback file", - [FATFSFILE_ERROR_UNKNOWN_DESTROY] = "SolidSyslogFatFsFile_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) FATFSFILE_ERROR_MAX) - { - enum SolidSyslogFatFsFileErrors typed = (enum SolidSyslogFatFsFileErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource FatFsFileErrorSource = {"FatFsFile", FatFsFileError_AsString}; diff --git a/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutex.c b/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutex.c index c95a4df7..1e417e09 100644 --- a/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutex.c +++ b/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutex.c @@ -5,10 +5,14 @@ #include "FreeRTOS.h" #include "semphr.h" +#include "SolidSyslogError.h" +#include "SolidSyslogFreeRtosMutexErrors.h" #include "SolidSyslogFreeRtosMutexPrivate.h" #include "SolidSyslogMutexDefinition.h" #include "SolidSyslogNullMutex.h" +const struct SolidSyslogErrorSource FreeRtosMutexErrorSource = {"FreeRtosMutex"}; + static void FreeRtosMutex_Lock(struct SolidSyslogMutex* base); static void FreeRtosMutex_Unlock(struct SolidSyslogMutex* base); diff --git a/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexMessages.c b/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexMessages.c deleted file mode 100644 index 231dde76..00000000 --- a/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexMessages.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogFreeRtosMutexErrors.h" - -static const char* FreeRtosMutexError_AsString(uint8_t code) -{ - static const char* const messages[FREERTOSMUTEX_ERROR_MAX] = { - [FREERTOSMUTEX_ERROR_POOL_EXHAUSTED] = - "SolidSyslogFreeRtosMutex_Create pool exhausted; returning fallback mutex", - [FREERTOSMUTEX_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogFreeRtosMutex_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) FREERTOSMUTEX_ERROR_MAX) - { - enum SolidSyslogFreeRtosMutexErrors typed = (enum SolidSyslogFreeRtosMutexErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource FreeRtosMutexErrorSource = {"FreeRtosMutex", FreeRtosMutexError_AsString}; diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawAddress.c b/Platform/LwipRaw/Source/SolidSyslogLwipRawAddress.c index 4b509651..a3ae5eff 100644 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawAddress.c +++ b/Platform/LwipRaw/Source/SolidSyslogLwipRawAddress.c @@ -1,7 +1,11 @@ +#include "SolidSyslogError.h" +#include "SolidSyslogLwipRawAddressErrors.h" #include "SolidSyslogLwipRawAddressPrivate.h" #include +const struct SolidSyslogErrorSource LwipRawAddressErrorSource = {"LwipRawAddress"}; + struct SolidSyslogAddress; void LwipRawAddress_Initialise(struct SolidSyslogAddress* base) diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressMessages.c b/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressMessages.c deleted file mode 100644 index 2032a52c..00000000 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressMessages.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogLwipRawAddressErrors.h" - -static const char* LwipRawAddressError_AsString(uint8_t code) -{ - static const char* const messages[LWIPRAWADDRESS_ERROR_MAX] = { - [LWIPRAWADDRESS_ERROR_POOL_EXHAUSTED] = - "SolidSyslogLwipRawAddress_Create pool exhausted; returning fallback address", - [LWIPRAWADDRESS_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogLwipRawAddress_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) LWIPRAWADDRESS_ERROR_MAX) - { - enum SolidSyslogLwipRawAddressErrors typed = (enum SolidSyslogLwipRawAddressErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource LwipRawAddressErrorSource = {"LwipRawAddress", LwipRawAddressError_AsString}; diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagram.c b/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagram.c index aa66cd9a..2f4e3635 100644 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagram.c +++ b/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagram.c @@ -3,16 +3,20 @@ #include #include -#include "lwip/arch.h" -#include "lwip/err.h" -#include "lwip/pbuf.h" -#include "lwip/udp.h" #include "SolidSyslogDatagram.h" #include "SolidSyslogDatagramDefinition.h" +#include "SolidSyslogError.h" #include "SolidSyslogLwipRawAddressPrivate.h" +#include "SolidSyslogLwipRawDatagramErrors.h" #include "SolidSyslogLwipRawMarshalPrivate.h" #include "SolidSyslogNullDatagram.h" #include "SolidSyslogUdpPayload.h" +#include "lwip/arch.h" +#include "lwip/err.h" +#include "lwip/pbuf.h" +#include "lwip/udp.h" + +const struct SolidSyslogErrorSource LwipRawDatagramErrorSource = {"LwipRawDatagram"}; struct SolidSyslogAddress; diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagramMessages.c b/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagramMessages.c deleted file mode 100644 index de56f0c5..00000000 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagramMessages.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogLwipRawDatagramErrors.h" - -static const char* LwipRawDatagramError_AsString(uint8_t code) -{ - static const char* const messages[LWIPRAWDATAGRAM_ERROR_MAX] = { - [LWIPRAWDATAGRAM_ERROR_POOL_EXHAUSTED] = - "SolidSyslogLwipRawDatagram_Create pool exhausted; returning fallback NullDatagram", - [LWIPRAWDATAGRAM_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogLwipRawDatagram_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) LWIPRAWDATAGRAM_ERROR_MAX) - { - enum SolidSyslogLwipRawDatagramErrors typed = (enum SolidSyslogLwipRawDatagramErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource LwipRawDatagramErrorSource = {"LwipRawDatagram", LwipRawDatagramError_AsString}; diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolver.c b/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolver.c index cd02a7c7..85734cf3 100644 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolver.c +++ b/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolver.c @@ -18,6 +18,8 @@ #include "lwip/err.h" #include "lwip/ip_addr.h" +const struct SolidSyslogErrorSource LwipRawDnsResolverErrorSource = {"LwipRawDnsResolver"}; + struct SolidSyslogAddress; /* Per-resolve parameters carried across the marshal hops. The dns_gethostbyname diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolverMessages.c b/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolverMessages.c deleted file mode 100644 index 13f6b78e..00000000 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolverMessages.c +++ /dev/null @@ -1,28 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogLwipRawDnsResolverErrors.h" - -static const char* LwipRawDnsResolverError_AsString(uint8_t code) -{ - static const char* const messages[LWIPRAWDNSRESOLVER_ERROR_MAX] = { - [LWIPRAWDNSRESOLVER_ERROR_POOL_EXHAUSTED] = - "SolidSyslogLwipRawDnsResolver_Create pool exhausted; returning fallback NullResolver", - [LWIPRAWDNSRESOLVER_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogLwipRawDnsResolver_Destroy called with a handle not issued by this pool", - [LWIPRAWDNSRESOLVER_ERROR_RESOLVE_TIMEOUT] = - "SolidSyslogLwipRawDnsResolver_Resolve timed out waiting for dns_gethostbyname; reporting failed lookup", - }; - const char* result = "unknown"; - if (code < (uint8_t) LWIPRAWDNSRESOLVER_ERROR_MAX) - { - enum SolidSyslogLwipRawDnsResolverErrors typed = (enum SolidSyslogLwipRawDnsResolverErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource LwipRawDnsResolverErrorSource = { - "LwipRawDnsResolver", - LwipRawDnsResolverError_AsString -}; diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawResolver.c b/Platform/LwipRaw/Source/SolidSyslogLwipRawResolver.c index 5bba83a9..3caa9b1b 100644 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawResolver.c +++ b/Platform/LwipRaw/Source/SolidSyslogLwipRawResolver.c @@ -1,12 +1,16 @@ #include #include -#include "SolidSyslogLwipRawResolverPrivate.h" -#include "lwip/ip_addr.h" +#include "SolidSyslogError.h" #include "SolidSyslogLwipRawAddressPrivate.h" +#include "SolidSyslogLwipRawResolverErrors.h" +#include "SolidSyslogLwipRawResolverPrivate.h" #include "SolidSyslogNullResolver.h" #include "SolidSyslogResolverDefinition.h" #include "SolidSyslogTransport.h" +#include "lwip/ip_addr.h" + +const struct SolidSyslogErrorSource LwipRawResolverErrorSource = {"LwipRawResolver"}; struct SolidSyslogAddress; diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawResolverMessages.c b/Platform/LwipRaw/Source/SolidSyslogLwipRawResolverMessages.c deleted file mode 100644 index 1084d65c..00000000 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawResolverMessages.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogLwipRawResolverErrors.h" - -static const char* LwipRawResolverError_AsString(uint8_t code) -{ - static const char* const messages[LWIPRAWRESOLVER_ERROR_MAX] = { - [LWIPRAWRESOLVER_ERROR_POOL_EXHAUSTED] = - "SolidSyslogLwipRawResolver_Create pool exhausted; returning fallback NullResolver", - [LWIPRAWRESOLVER_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogLwipRawResolver_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) LWIPRAWRESOLVER_ERROR_MAX) - { - enum SolidSyslogLwipRawResolverErrors typed = (enum SolidSyslogLwipRawResolverErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource LwipRawResolverErrorSource = {"LwipRawResolver", LwipRawResolverError_AsString}; diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStream.c b/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStream.c index 21fa45a3..a42fca41 100644 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStream.c +++ b/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStream.c @@ -6,17 +6,21 @@ #include #include +#include "SolidSyslogError.h" +#include "SolidSyslogLwipRawAddressPrivate.h" +#include "SolidSyslogLwipRawMarshalPrivate.h" +#include "SolidSyslogLwipRawTcpStreamErrors.h" +#include "SolidSyslogNullStream.h" +#include "SolidSyslogStream.h" +#include "SolidSyslogTunables.h" #include "lwip/arch.h" #include "lwip/err.h" #include "lwip/ip.h" #include "lwip/pbuf.h" #include "lwip/tcp.h" #include "lwip/tcpbase.h" -#include "SolidSyslogLwipRawAddressPrivate.h" -#include "SolidSyslogLwipRawMarshalPrivate.h" -#include "SolidSyslogNullStream.h" -#include "SolidSyslogStream.h" -#include "SolidSyslogTunables.h" + +const struct SolidSyslogErrorSource LwipRawTcpStreamErrorSource = {"LwipRawTcpStream"}; struct SolidSyslogAddress; struct SolidSyslogStream; diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStreamMessages.c b/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStreamMessages.c deleted file mode 100644 index dc3054e0..00000000 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStreamMessages.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogLwipRawTcpStreamErrors.h" - -static const char* LwipRawTcpStreamError_AsString(uint8_t code) -{ - static const char* const messages[LWIPRAWTCPSTREAM_ERROR_MAX] = { - [LWIPRAWTCPSTREAM_ERROR_POOL_EXHAUSTED] = - "SolidSyslogLwipRawTcpStream_Create pool exhausted; returning fallback NullStream", - [LWIPRAWTCPSTREAM_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogLwipRawTcpStream_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) LWIPRAWTCPSTREAM_ERROR_MAX) - { - enum SolidSyslogLwipRawTcpStreamErrors typed = (enum SolidSyslogLwipRawTcpStreamErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource LwipRawTcpStreamErrorSource = {"LwipRawTcpStream", LwipRawTcpStreamError_AsString}; diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicy.c b/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicy.c index d2dc089c..2dcd25c9 100644 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicy.c +++ b/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicy.c @@ -8,6 +8,7 @@ #include #include +#include "SolidSyslogError.h" #include "SolidSyslogErrorCategory.h" #include "SolidSyslogMacros.h" #include "SolidSyslogMbedTlsAesGcmPolicyErrors.h" @@ -17,6 +18,8 @@ #include "SolidSyslogSecurityPolicyDefinition.h" #include "SolidSyslogTunables.h" +const struct SolidSyslogErrorSource MbedTlsAesGcmPolicyErrorSource = {"MbedTlsAesGcmPolicy"}; + enum { AES_256_KEY_SIZE = 32, @@ -103,19 +106,21 @@ static bool MbedTlsAesGcmPolicy_SealRecord( } else { - MbedTlsAesGcmPolicy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_ERROR, + &MbedTlsAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_SECURITYPOLICY_SEAL_FAILED, - MBEDTLSAESGCMPOLICY_ERROR_ENCRYPT_FAILED + (int32_t) MBEDTLSAESGCMPOLICY_ERROR_ENCRYPT_FAILED ); } } else { - MbedTlsAesGcmPolicy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_ERROR, + &MbedTlsAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_SECURITYPOLICY_SEAL_FAILED, - MBEDTLSAESGCMPOLICY_ERROR_NONCE_FAILED + (int32_t) MBEDTLSAESGCMPOLICY_ERROR_NONCE_FAILED ); } } @@ -132,10 +137,11 @@ static bool MbedTlsAesGcmPolicy_FetchKey(struct SolidSyslogMbedTlsAesGcmPolicy* (keyLength == (size_t) AES_256_KEY_SIZE); if (!fetched) { - MbedTlsAesGcmPolicy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_ERROR, + &MbedTlsAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_SECURITYPOLICY_KEY_UNAVAILABLE, - MBEDTLSAESGCMPOLICY_ERROR_KEY_UNAVAILABLE + (int32_t) MBEDTLSAESGCMPOLICY_ERROR_KEY_UNAVAILABLE ); } return fetched; @@ -243,10 +249,11 @@ static bool MbedTlsAesGcmPolicy_GcmDecrypt(const struct SolidSyslogSecurityRecor mbedtls_gcm_free(&ctx); if (errored) { - MbedTlsAesGcmPolicy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_ERROR, + &MbedTlsAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_SECURITYPOLICY_OPEN_FAILED, - MBEDTLSAESGCMPOLICY_ERROR_DECRYPT_FAILED + (int32_t) MBEDTLSAESGCMPOLICY_ERROR_DECRYPT_FAILED ); } return opened; diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyMessages.c b/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyMessages.c deleted file mode 100644 index 3002cd46..00000000 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyMessages.c +++ /dev/null @@ -1,47 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogMbedTlsAesGcmPolicyErrors.h" -#include "SolidSyslogMbedTlsAesGcmPolicyPrivate.h" -#include "SolidSyslogPrival.h" - -static const char* MbedTlsAesGcmPolicyError_AsString(uint8_t code) -{ - static const char* const messages[MBEDTLSAESGCMPOLICY_ERROR_MAX] = { - [MBEDTLSAESGCMPOLICY_ERROR_POOL_EXHAUSTED] = - "SolidSyslogMbedTlsAesGcmPolicy_Create pool exhausted; returning fallback policy", - [MBEDTLSAESGCMPOLICY_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogMbedTlsAesGcmPolicy_Destroy called with a handle not issued by this pool", - [MBEDTLSAESGCMPOLICY_ERROR_BAD_CONFIG] = - "SolidSyslogMbedTlsAesGcmPolicy_Create given a NULL config, GetKey, or Rng; returning fallback policy", - [MBEDTLSAESGCMPOLICY_ERROR_KEY_UNAVAILABLE] = - "GetKey reported the AES-256 key is unavailable or not 32 bytes; record could not be sealed or opened", - [MBEDTLSAESGCMPOLICY_ERROR_NONCE_FAILED] = - "mbedTLS CTR-DRBG failed to generate a nonce; record could not be sealed", - [MBEDTLSAESGCMPOLICY_ERROR_ENCRYPT_FAILED] = - "mbedTLS AES-256-GCM encryption failed; record could not be sealed", - [MBEDTLSAESGCMPOLICY_ERROR_DECRYPT_FAILED] = - "mbedTLS AES-256-GCM decryption failed; record could not be opened", - }; - const char* result = "unknown"; - if (code < (uint8_t) MBEDTLSAESGCMPOLICY_ERROR_MAX) - { - enum SolidSyslogMbedTlsAesGcmPolicyErrors typed = (enum SolidSyslogMbedTlsAesGcmPolicyErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource MbedTlsAesGcmPolicyErrorSource = { - "MbedTlsAesGcmPolicy", - MbedTlsAesGcmPolicyError_AsString -}; - -void MbedTlsAesGcmPolicy_Report( - enum SolidSyslogSeverity severity, - uint16_t category, - enum SolidSyslogMbedTlsAesGcmPolicyErrors code -) -{ - SolidSyslog_Error(severity, &MbedTlsAesGcmPolicyErrorSource, category, (int32_t) code); -} diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyPrivate.h b/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyPrivate.h index 4faba16c..ed2c2f11 100644 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyPrivate.h +++ b/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyPrivate.h @@ -2,8 +2,6 @@ #define SOLIDSYSLOGMBEDTLSAESGCMPOLICYPRIVATE_H #include "SolidSyslogMbedTlsAesGcmPolicy.h" -#include "SolidSyslogMbedTlsAesGcmPolicyErrors.h" -#include "SolidSyslogPrival.h" #include "SolidSyslogSecurityPolicyDefinition.h" struct SolidSyslogMbedTlsAesGcmPolicy @@ -18,13 +16,4 @@ void MbedTlsAesGcmPolicy_Initialise( ); void MbedTlsAesGcmPolicy_Cleanup(struct SolidSyslogSecurityPolicy* base); -/* Emits one error from this class's source — hides the source pointer and the - * enum-to-uint8 cast from every call site (seal/open in Policy.c, the pool in - * Static.c). */ -void MbedTlsAesGcmPolicy_Report( - enum SolidSyslogSeverity severity, - uint16_t category, - enum SolidSyslogMbedTlsAesGcmPolicyErrors code -); - #endif /* SOLIDSYSLOGMBEDTLSAESGCMPOLICYPRIVATE_H */ diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyStatic.c b/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyStatic.c index 5e4c3e27..cc8d85f0 100644 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyStatic.c +++ b/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyStatic.c @@ -4,6 +4,7 @@ #include #include +#include "SolidSyslogError.h" #include "SolidSyslogErrorCategory.h" #include "SolidSyslogMbedTlsAesGcmPolicyErrors.h" #include "SolidSyslogMbedTlsAesGcmPolicyPrivate.h" @@ -39,19 +40,21 @@ struct SolidSyslogSecurityPolicy* SolidSyslogMbedTlsAesGcmPolicy_Create( } else { - MbedTlsAesGcmPolicy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_ERROR, + &MbedTlsAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - MBEDTLSAESGCMPOLICY_ERROR_POOL_EXHAUSTED + (int32_t) MBEDTLSAESGCMPOLICY_ERROR_POOL_EXHAUSTED ); } } else { - MbedTlsAesGcmPolicy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_ERROR, + &MbedTlsAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_BAD_CONFIG, - MBEDTLSAESGCMPOLICY_ERROR_BAD_CONFIG + (int32_t) MBEDTLSAESGCMPOLICY_ERROR_BAD_CONFIG ); } return handle; @@ -69,10 +72,11 @@ void SolidSyslogMbedTlsAesGcmPolicy_Destroy(struct SolidSyslogSecurityPolicy* ba ); if (!released) { - MbedTlsAesGcmPolicy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_WARNING, + &MbedTlsAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - MBEDTLSAESGCMPOLICY_ERROR_UNKNOWN_DESTROY + (int32_t) MBEDTLSAESGCMPOLICY_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256Policy.c b/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256Policy.c index 4b25b2a7..430830c3 100644 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256Policy.c +++ b/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256Policy.c @@ -6,6 +6,7 @@ #include #include +#include "SolidSyslogError.h" #include "SolidSyslogErrorCategory.h" #include "SolidSyslogMbedTlsHmacSha256PolicyErrors.h" #include "SolidSyslogMbedTlsHmacSha256PolicyPrivate.h" @@ -14,6 +15,8 @@ #include "SolidSyslogSecurityPolicyDefinition.h" #include "SolidSyslogTunables.h" +const struct SolidSyslogErrorSource MbedTlsHmacSha256PolicyErrorSource = {"MbedTlsHmacSha256Policy"}; + enum { HMAC_SHA256_TAG_SIZE = 32 @@ -110,19 +113,21 @@ static bool MbedTlsHmacSha256Policy_ComputeTag( } else { - MbedTlsHmacSha256Policy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_ERROR, + &MbedTlsHmacSha256PolicyErrorSource, failureCategory, - MBEDTLSHMACSHA256POLICY_ERROR_HMAC_FAILED + (int32_t) MBEDTLSHMACSHA256POLICY_ERROR_HMAC_FAILED ); } } else { - MbedTlsHmacSha256Policy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_ERROR, + &MbedTlsHmacSha256PolicyErrorSource, SOLIDSYSLOG_CAT_SECURITYPOLICY_KEY_UNAVAILABLE, - MBEDTLSHMACSHA256POLICY_ERROR_KEY_UNAVAILABLE + (int32_t) MBEDTLSHMACSHA256POLICY_ERROR_KEY_UNAVAILABLE ); } /* Wipe the whole key buffer — the full region GetKey was handed, not just diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyMessages.c b/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyMessages.c deleted file mode 100644 index c9bf4f84..00000000 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyMessages.c +++ /dev/null @@ -1,43 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogMbedTlsHmacSha256PolicyErrors.h" -#include "SolidSyslogMbedTlsHmacSha256PolicyPrivate.h" -#include "SolidSyslogPrival.h" - -static const char* MbedTlsHmacSha256PolicyError_AsString(uint8_t code) -{ - static const char* const messages[MBEDTLSHMACSHA256POLICY_ERROR_MAX] = { - [MBEDTLSHMACSHA256POLICY_ERROR_POOL_EXHAUSTED] = - "SolidSyslogMbedTlsHmacSha256Policy_Create pool exhausted; returning fallback policy", - [MBEDTLSHMACSHA256POLICY_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogMbedTlsHmacSha256Policy_Destroy called with a handle not issued by this pool", - [MBEDTLSHMACSHA256POLICY_ERROR_BAD_CONFIG] = - "SolidSyslogMbedTlsHmacSha256Policy_Create given a NULL config or NULL GetKey; returning fallback policy", - [MBEDTLSHMACSHA256POLICY_ERROR_KEY_UNAVAILABLE] = - "GetKey reported the HMAC key is unavailable; record integrity could not be sealed or verified", - [MBEDTLSHMACSHA256POLICY_ERROR_HMAC_FAILED] = - "mbedTLS HMAC-SHA256 computation failed; record integrity could not be sealed or verified", - }; - const char* result = "unknown"; - if (code < (uint8_t) MBEDTLSHMACSHA256POLICY_ERROR_MAX) - { - enum SolidSyslogMbedTlsHmacSha256PolicyErrors typed = (enum SolidSyslogMbedTlsHmacSha256PolicyErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource MbedTlsHmacSha256PolicyErrorSource = { - "MbedTlsHmacSha256Policy", - MbedTlsHmacSha256PolicyError_AsString -}; - -void MbedTlsHmacSha256Policy_Report( - enum SolidSyslogSeverity severity, - uint16_t category, - enum SolidSyslogMbedTlsHmacSha256PolicyErrors code -) -{ - SolidSyslog_Error(severity, &MbedTlsHmacSha256PolicyErrorSource, category, (int32_t) code); -} diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyPrivate.h b/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyPrivate.h index 0db0ef7d..809e9c77 100644 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyPrivate.h +++ b/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyPrivate.h @@ -2,8 +2,6 @@ #define SOLIDSYSLOGMBEDTLSHMACSHA256POLICYPRIVATE_H #include "SolidSyslogMbedTlsHmacSha256Policy.h" -#include "SolidSyslogMbedTlsHmacSha256PolicyErrors.h" -#include "SolidSyslogPrival.h" #include "SolidSyslogSecurityPolicyDefinition.h" struct SolidSyslogMbedTlsHmacSha256Policy @@ -18,13 +16,4 @@ void MbedTlsHmacSha256Policy_Initialise( ); void MbedTlsHmacSha256Policy_Cleanup(struct SolidSyslogSecurityPolicy* base); -/* Emits one error from this class's source — hides the source pointer and the - * enum-to-uint8 cast from every call site (seal/verify in Policy.c, the pool in - * Static.c). */ -void MbedTlsHmacSha256Policy_Report( - enum SolidSyslogSeverity severity, - uint16_t category, - enum SolidSyslogMbedTlsHmacSha256PolicyErrors code -); - #endif /* SOLIDSYSLOGMBEDTLSHMACSHA256POLICYPRIVATE_H */ diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyStatic.c b/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyStatic.c index 1de42806..599c04d5 100644 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyStatic.c +++ b/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyStatic.c @@ -4,6 +4,7 @@ #include #include +#include "SolidSyslogError.h" #include "SolidSyslogErrorCategory.h" #include "SolidSyslogMbedTlsHmacSha256PolicyErrors.h" #include "SolidSyslogMbedTlsHmacSha256PolicyPrivate.h" @@ -39,19 +40,21 @@ struct SolidSyslogSecurityPolicy* SolidSyslogMbedTlsHmacSha256Policy_Create( } else { - MbedTlsHmacSha256Policy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_ERROR, + &MbedTlsHmacSha256PolicyErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - MBEDTLSHMACSHA256POLICY_ERROR_POOL_EXHAUSTED + (int32_t) MBEDTLSHMACSHA256POLICY_ERROR_POOL_EXHAUSTED ); } } else { - MbedTlsHmacSha256Policy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_ERROR, + &MbedTlsHmacSha256PolicyErrorSource, SOLIDSYSLOG_CAT_BAD_CONFIG, - MBEDTLSHMACSHA256POLICY_ERROR_BAD_CONFIG + (int32_t) MBEDTLSHMACSHA256POLICY_ERROR_BAD_CONFIG ); } return handle; @@ -69,10 +72,11 @@ void SolidSyslogMbedTlsHmacSha256Policy_Destroy(struct SolidSyslogSecurityPolicy ); if (!released) { - MbedTlsHmacSha256Policy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_WARNING, + &MbedTlsHmacSha256PolicyErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - MBEDTLSHMACSHA256POLICY_ERROR_UNKNOWN_DESTROY + (int32_t) MBEDTLSHMACSHA256POLICY_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c b/Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c index 3a3839b2..96b44438 100644 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c +++ b/Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c @@ -17,6 +17,8 @@ #include "SolidSyslogTlsStreamCategories.h" #include "SolidSyslogTunables.h" +const struct SolidSyslogErrorSource MbedTlsStreamErrorSource = {"MbedTlsStream"}; + enum { HANDSHAKE_POLL_INTERVAL_MILLISECONDS = 1 diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamMessages.c b/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamMessages.c deleted file mode 100644 index eb8abb14..00000000 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamMessages.c +++ /dev/null @@ -1,33 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogMbedTlsStreamErrors.h" - -static const char* MbedTlsStreamError_AsString(uint8_t code) -{ - static const char* const messages[MBEDTLSSTREAM_ERROR_MAX] = { - [MBEDTLSSTREAM_ERROR_POOL_EXHAUSTED] = - "SolidSyslogMbedTlsStream_Create pool exhausted; returning fallback stream", - [MBEDTLSSTREAM_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogMbedTlsStream_Destroy called with a handle not issued by this pool", - [MBEDTLSSTREAM_ERROR_DEFAULTS_NOT_APPLIED] = - "TLS client could not be configured with its default protocol settings; connection not established", - [MBEDTLSSTREAM_ERROR_SESSION_INIT_FAILED] = - "TLS session could not be initialised against the configured context; connection not established", - [MBEDTLSSTREAM_ERROR_SERVER_NAME_NOT_SET] = - "TLS server name (SNI / cert match) could not be configured; connection not established", - [MBEDTLSSTREAM_ERROR_HANDSHAKE_REJECTED] = - "TLS handshake rejected by peer or local verification; connection not established", - [MBEDTLSSTREAM_ERROR_HANDSHAKE_TIMEOUT] = - "TLS handshake did not complete within the bounded retry budget; connection not established", - }; - const char* result = "unknown"; - if (code < (uint8_t) MBEDTLSSTREAM_ERROR_MAX) - { - enum SolidSyslogMbedTlsStreamErrors typed = (enum SolidSyslogMbedTlsStreamErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource MbedTlsStreamErrorSource = {"MbedTlsStream", MbedTlsStreamError_AsString}; diff --git a/Platform/OpenSsl/CMakeLists.txt b/Platform/OpenSsl/CMakeLists.txt index ef9dc3f4..a72390f2 100644 --- a/Platform/OpenSsl/CMakeLists.txt +++ b/Platform/OpenSsl/CMakeLists.txt @@ -4,13 +4,10 @@ target_sources(${PROJECT_NAME} PRIVATE Source/SolidSyslogTlsStream.c - Source/SolidSyslogTlsStreamMessages.c Source/SolidSyslogTlsStreamStatic.c Source/SolidSyslogOpenSslHmacSha256Policy.c - Source/SolidSyslogOpenSslHmacSha256PolicyMessages.c Source/SolidSyslogOpenSslHmacSha256PolicyStatic.c Source/SolidSyslogOpenSslAesGcmPolicy.c - Source/SolidSyslogOpenSslAesGcmPolicyMessages.c Source/SolidSyslogOpenSslAesGcmPolicyStatic.c ) diff --git a/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicy.c b/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicy.c index 909ffe81..76b99d73 100644 --- a/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicy.c +++ b/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicy.c @@ -8,6 +8,7 @@ #include #include +#include "SolidSyslogError.h" #include "SolidSyslogErrorCategory.h" #include "SolidSyslogOpenSslAesGcmPolicyErrors.h" #include "SolidSyslogOpenSslAesGcmPolicyPrivate.h" @@ -15,6 +16,8 @@ #include "SolidSyslogSecurityPolicyCategories.h" #include "SolidSyslogSecurityPolicyDefinition.h" +const struct SolidSyslogErrorSource OpenSslAesGcmPolicyErrorSource = {"OpenSslAesGcmPolicy"}; + enum { AES_256_KEY_SIZE = 32, @@ -117,19 +120,21 @@ static bool OpenSslAesGcmPolicy_SealRecord( } else { - OpenSslAesGcmPolicy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_ERROR, + &OpenSslAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_SECURITYPOLICY_SEAL_FAILED, - OPENSSLAESGCMPOLICY_ERROR_ENCRYPT_FAILED + (int32_t) OPENSSLAESGCMPOLICY_ERROR_ENCRYPT_FAILED ); } } else { - OpenSslAesGcmPolicy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_ERROR, + &OpenSslAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_SECURITYPOLICY_SEAL_FAILED, - OPENSSLAESGCMPOLICY_ERROR_NONCE_FAILED + (int32_t) OPENSSLAESGCMPOLICY_ERROR_NONCE_FAILED ); } } @@ -146,10 +151,11 @@ static bool OpenSslAesGcmPolicy_FetchKey(struct SolidSyslogOpenSslAesGcmPolicy* (keyLength == (size_t) AES_256_KEY_SIZE); if (!fetched) { - OpenSslAesGcmPolicy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_ERROR, + &OpenSslAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_SECURITYPOLICY_KEY_UNAVAILABLE, - OPENSSLAESGCMPOLICY_ERROR_KEY_UNAVAILABLE + (int32_t) OPENSSLAESGCMPOLICY_ERROR_KEY_UNAVAILABLE ); } return fetched; @@ -249,10 +255,11 @@ static bool OpenSslAesGcmPolicy_GcmDecrypt( } if (errored) { - OpenSslAesGcmPolicy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_ERROR, + &OpenSslAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_SECURITYPOLICY_OPEN_FAILED, - OPENSSLAESGCMPOLICY_ERROR_DECRYPT_FAILED + (int32_t) OPENSSLAESGCMPOLICY_ERROR_DECRYPT_FAILED ); } return opened; diff --git a/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyMessages.c b/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyMessages.c deleted file mode 100644 index 64a6f159..00000000 --- a/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyMessages.c +++ /dev/null @@ -1,47 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogOpenSslAesGcmPolicyErrors.h" -#include "SolidSyslogOpenSslAesGcmPolicyPrivate.h" -#include "SolidSyslogPrival.h" - -static const char* OpenSslAesGcmPolicyError_AsString(uint8_t code) -{ - static const char* const messages[OPENSSLAESGCMPOLICY_ERROR_MAX] = { - [OPENSSLAESGCMPOLICY_ERROR_POOL_EXHAUSTED] = - "SolidSyslogOpenSslAesGcmPolicy_Create pool exhausted; returning fallback policy", - [OPENSSLAESGCMPOLICY_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogOpenSslAesGcmPolicy_Destroy called with a handle not issued by this pool", - [OPENSSLAESGCMPOLICY_ERROR_BAD_CONFIG] = - "SolidSyslogOpenSslAesGcmPolicy_Create given a NULL config or NULL GetKey; returning fallback policy", - [OPENSSLAESGCMPOLICY_ERROR_KEY_UNAVAILABLE] = - "GetKey reported the AES-256 key is unavailable or not 32 bytes; record could not be sealed or opened", - [OPENSSLAESGCMPOLICY_ERROR_NONCE_FAILED] = - "OpenSSL RAND_bytes failed to generate a nonce; record could not be sealed", - [OPENSSLAESGCMPOLICY_ERROR_ENCRYPT_FAILED] = - "OpenSSL AES-256-GCM encryption failed; record could not be sealed", - [OPENSSLAESGCMPOLICY_ERROR_DECRYPT_FAILED] = - "OpenSSL AES-256-GCM decryption failed; record could not be opened", - }; - const char* result = "unknown"; - if (code < (uint8_t) OPENSSLAESGCMPOLICY_ERROR_MAX) - { - enum SolidSyslogOpenSslAesGcmPolicyErrors typed = (enum SolidSyslogOpenSslAesGcmPolicyErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource OpenSslAesGcmPolicyErrorSource = { - "OpenSslAesGcmPolicy", - OpenSslAesGcmPolicyError_AsString -}; - -void OpenSslAesGcmPolicy_Report( - enum SolidSyslogSeverity severity, - uint16_t category, - enum SolidSyslogOpenSslAesGcmPolicyErrors code -) -{ - SolidSyslog_Error(severity, &OpenSslAesGcmPolicyErrorSource, category, (int32_t) code); -} diff --git a/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyPrivate.h b/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyPrivate.h index 507d7c29..bfcfafa3 100644 --- a/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyPrivate.h +++ b/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyPrivate.h @@ -2,8 +2,6 @@ #define SOLIDSYSLOGOPENSSLAESGCMPOLICYPRIVATE_H #include "SolidSyslogOpenSslAesGcmPolicy.h" -#include "SolidSyslogOpenSslAesGcmPolicyErrors.h" -#include "SolidSyslogPrival.h" #include "SolidSyslogSecurityPolicyDefinition.h" struct SolidSyslogOpenSslAesGcmPolicy @@ -18,13 +16,4 @@ void OpenSslAesGcmPolicy_Initialise( ); void OpenSslAesGcmPolicy_Cleanup(struct SolidSyslogSecurityPolicy* base); -/* Emits one error from this class's source — hides the source pointer and the - * enum-to-uint8 cast from every call site (seal/open in Policy.c, the pool in - * Static.c). */ -void OpenSslAesGcmPolicy_Report( - enum SolidSyslogSeverity severity, - uint16_t category, - enum SolidSyslogOpenSslAesGcmPolicyErrors code -); - #endif /* SOLIDSYSLOGOPENSSLAESGCMPOLICYPRIVATE_H */ diff --git a/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyStatic.c b/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyStatic.c index 1687bca5..c3968c45 100644 --- a/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyStatic.c +++ b/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyStatic.c @@ -4,6 +4,7 @@ #include #include +#include "SolidSyslogError.h" #include "SolidSyslogErrorCategory.h" #include "SolidSyslogNullSecurityPolicy.h" #include "SolidSyslogOpenSslAesGcmPolicyErrors.h" @@ -39,19 +40,21 @@ struct SolidSyslogSecurityPolicy* SolidSyslogOpenSslAesGcmPolicy_Create( } else { - OpenSslAesGcmPolicy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_ERROR, + &OpenSslAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - OPENSSLAESGCMPOLICY_ERROR_POOL_EXHAUSTED + (int32_t) OPENSSLAESGCMPOLICY_ERROR_POOL_EXHAUSTED ); } } else { - OpenSslAesGcmPolicy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_ERROR, + &OpenSslAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_BAD_CONFIG, - OPENSSLAESGCMPOLICY_ERROR_BAD_CONFIG + (int32_t) OPENSSLAESGCMPOLICY_ERROR_BAD_CONFIG ); } return handle; @@ -69,10 +72,11 @@ void SolidSyslogOpenSslAesGcmPolicy_Destroy(struct SolidSyslogSecurityPolicy* ba ); if (!released) { - OpenSslAesGcmPolicy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_WARNING, + &OpenSslAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - OPENSSLAESGCMPOLICY_ERROR_UNKNOWN_DESTROY + (int32_t) OPENSSLAESGCMPOLICY_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256Policy.c b/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256Policy.c index e5120027..f59b7cd9 100644 --- a/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256Policy.c +++ b/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256Policy.c @@ -7,6 +7,7 @@ #include #include +#include "SolidSyslogError.h" #include "SolidSyslogErrorCategory.h" #include "SolidSyslogOpenSslHmacSha256PolicyErrors.h" #include "SolidSyslogOpenSslHmacSha256PolicyPrivate.h" @@ -15,6 +16,8 @@ #include "SolidSyslogSecurityPolicyDefinition.h" #include "SolidSyslogTunables.h" +const struct SolidSyslogErrorSource OpenSslHmacSha256PolicyErrorSource = {"OpenSslHmacSha256Policy"}; + enum { HMAC_SHA256_TAG_SIZE = 32 @@ -110,19 +113,21 @@ static bool OpenSslHmacSha256Policy_ComputeTag( } else { - OpenSslHmacSha256Policy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_ERROR, + &OpenSslHmacSha256PolicyErrorSource, failureCategory, - OPENSSLHMACSHA256POLICY_ERROR_HMAC_FAILED + (int32_t) OPENSSLHMACSHA256POLICY_ERROR_HMAC_FAILED ); } } else { - OpenSslHmacSha256Policy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_ERROR, + &OpenSslHmacSha256PolicyErrorSource, SOLIDSYSLOG_CAT_SECURITYPOLICY_KEY_UNAVAILABLE, - OPENSSLHMACSHA256POLICY_ERROR_KEY_UNAVAILABLE + (int32_t) OPENSSLHMACSHA256POLICY_ERROR_KEY_UNAVAILABLE ); } /* Wipe the whole key buffer — the full region GetKey was handed, not just diff --git a/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyMessages.c b/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyMessages.c deleted file mode 100644 index 70ad8ce3..00000000 --- a/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyMessages.c +++ /dev/null @@ -1,43 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogOpenSslHmacSha256PolicyErrors.h" -#include "SolidSyslogOpenSslHmacSha256PolicyPrivate.h" -#include "SolidSyslogPrival.h" - -static const char* OpenSslHmacSha256PolicyError_AsString(uint8_t code) -{ - static const char* const messages[OPENSSLHMACSHA256POLICY_ERROR_MAX] = { - [OPENSSLHMACSHA256POLICY_ERROR_POOL_EXHAUSTED] = - "SolidSyslogOpenSslHmacSha256Policy_Create pool exhausted; returning fallback policy", - [OPENSSLHMACSHA256POLICY_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogOpenSslHmacSha256Policy_Destroy called with a handle not issued by this pool", - [OPENSSLHMACSHA256POLICY_ERROR_BAD_CONFIG] = - "SolidSyslogOpenSslHmacSha256Policy_Create given a NULL config or NULL GetKey; returning fallback policy", - [OPENSSLHMACSHA256POLICY_ERROR_KEY_UNAVAILABLE] = - "GetKey reported the HMAC key is unavailable; record integrity could not be sealed or verified", - [OPENSSLHMACSHA256POLICY_ERROR_HMAC_FAILED] = - "OpenSSL HMAC-SHA256 computation failed; record integrity could not be sealed or verified", - }; - const char* result = "unknown"; - if (code < (uint8_t) OPENSSLHMACSHA256POLICY_ERROR_MAX) - { - enum SolidSyslogOpenSslHmacSha256PolicyErrors typed = (enum SolidSyslogOpenSslHmacSha256PolicyErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource OpenSslHmacSha256PolicyErrorSource = { - "OpenSslHmacSha256Policy", - OpenSslHmacSha256PolicyError_AsString -}; - -void OpenSslHmacSha256Policy_Report( - enum SolidSyslogSeverity severity, - uint16_t category, - enum SolidSyslogOpenSslHmacSha256PolicyErrors code -) -{ - SolidSyslog_Error(severity, &OpenSslHmacSha256PolicyErrorSource, category, (int32_t) code); -} diff --git a/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyPrivate.h b/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyPrivate.h index a500eb38..c2aa8845 100644 --- a/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyPrivate.h +++ b/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyPrivate.h @@ -2,8 +2,6 @@ #define SOLIDSYSLOGOPENSSLHMACSHA256POLICYPRIVATE_H #include "SolidSyslogOpenSslHmacSha256Policy.h" -#include "SolidSyslogOpenSslHmacSha256PolicyErrors.h" -#include "SolidSyslogPrival.h" #include "SolidSyslogSecurityPolicyDefinition.h" struct SolidSyslogOpenSslHmacSha256Policy @@ -18,13 +16,4 @@ void OpenSslHmacSha256Policy_Initialise( ); void OpenSslHmacSha256Policy_Cleanup(struct SolidSyslogSecurityPolicy* base); -/* Emits one error from this class's source — hides the source pointer and the - * enum-to-uint8 cast from every call site (seal/verify in Policy.c, the pool in - * Static.c). */ -void OpenSslHmacSha256Policy_Report( - enum SolidSyslogSeverity severity, - uint16_t category, - enum SolidSyslogOpenSslHmacSha256PolicyErrors code -); - #endif /* SOLIDSYSLOGOPENSSLHMACSHA256POLICYPRIVATE_H */ diff --git a/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyStatic.c b/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyStatic.c index 812c9590..bc9e44e5 100644 --- a/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyStatic.c +++ b/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyStatic.c @@ -4,6 +4,7 @@ #include #include +#include "SolidSyslogError.h" #include "SolidSyslogErrorCategory.h" #include "SolidSyslogNullSecurityPolicy.h" #include "SolidSyslogOpenSslHmacSha256PolicyErrors.h" @@ -39,19 +40,21 @@ struct SolidSyslogSecurityPolicy* SolidSyslogOpenSslHmacSha256Policy_Create( } else { - OpenSslHmacSha256Policy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_ERROR, + &OpenSslHmacSha256PolicyErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - OPENSSLHMACSHA256POLICY_ERROR_POOL_EXHAUSTED + (int32_t) OPENSSLHMACSHA256POLICY_ERROR_POOL_EXHAUSTED ); } } else { - OpenSslHmacSha256Policy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_ERROR, + &OpenSslHmacSha256PolicyErrorSource, SOLIDSYSLOG_CAT_BAD_CONFIG, - OPENSSLHMACSHA256POLICY_ERROR_BAD_CONFIG + (int32_t) OPENSSLHMACSHA256POLICY_ERROR_BAD_CONFIG ); } return handle; @@ -69,10 +72,11 @@ void SolidSyslogOpenSslHmacSha256Policy_Destroy(struct SolidSyslogSecurityPolicy ); if (!released) { - OpenSslHmacSha256Policy_Report( + SolidSyslog_Error( SOLIDSYSLOG_SEVERITY_WARNING, + &OpenSslHmacSha256PolicyErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - OPENSSLHMACSHA256POLICY_ERROR_UNKNOWN_DESTROY + (int32_t) OPENSSLHMACSHA256POLICY_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/OpenSsl/Source/SolidSyslogTlsStream.c b/Platform/OpenSsl/Source/SolidSyslogTlsStream.c index 145efa78..c6619270 100644 --- a/Platform/OpenSsl/Source/SolidSyslogTlsStream.c +++ b/Platform/OpenSsl/Source/SolidSyslogTlsStream.c @@ -19,6 +19,8 @@ #include "SolidSyslogTlsStreamPrivate.h" #include "SolidSyslogTunables.h" +const struct SolidSyslogErrorSource TlsStreamErrorSource = {"TlsStream"}; + enum { HANDSHAKE_POLL_INTERVAL_MILLISECONDS = 1 diff --git a/Platform/OpenSsl/Source/SolidSyslogTlsStreamMessages.c b/Platform/OpenSsl/Source/SolidSyslogTlsStreamMessages.c deleted file mode 100644 index 953c6d88..00000000 --- a/Platform/OpenSsl/Source/SolidSyslogTlsStreamMessages.c +++ /dev/null @@ -1,31 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogTlsStreamErrors.h" - -static const char* TlsStreamError_AsString(uint8_t code) -{ - static const char* const messages[TLSSTREAM_ERROR_MAX] = { - [TLSSTREAM_ERROR_POOL_EXHAUSTED] = "SolidSyslogTlsStream_Create pool exhausted; returning fallback stream", - [TLSSTREAM_ERROR_UNKNOWN_DESTROY] = "SolidSyslogTlsStream_Destroy called with a handle not issued by this pool", - [TLSSTREAM_ERROR_CONTEXT_INIT_FAILED] = - "TLS client context could not be configured; connection not established", - [TLSSTREAM_ERROR_SESSION_INIT_FAILED] = - "TLS session could not be initialised against the configured context; connection not established", - [TLSSTREAM_ERROR_SERVER_NAME_NOT_SET] = - "TLS server name (SNI / cert match) could not be configured; connection not established", - [TLSSTREAM_ERROR_HANDSHAKE_REJECTED] = - "TLS handshake rejected by peer or local verification; connection not established", - [TLSSTREAM_ERROR_HANDSHAKE_TIMEOUT] = - "TLS handshake did not complete within the bounded retry budget; connection not established", - }; - const char* result = "unknown"; - if (code < (uint8_t) TLSSTREAM_ERROR_MAX) - { - enum SolidSyslogTlsStreamErrors typed = (enum SolidSyslogTlsStreamErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource TlsStreamErrorSource = {"TlsStream", TlsStreamError_AsString}; diff --git a/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddress.c b/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddress.c index 9fdaf6a9..025e6d73 100644 --- a/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddress.c +++ b/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddress.c @@ -1,7 +1,11 @@ #include -#include "SolidSyslogPlusTcpAddressPrivate.h" #include "FreeRTOS_Sockets.h" +#include "SolidSyslogError.h" +#include "SolidSyslogPlusTcpAddressErrors.h" +#include "SolidSyslogPlusTcpAddressPrivate.h" + +const struct SolidSyslogErrorSource PlusTcpAddressErrorSource = {"PlusTcpAddress"}; struct SolidSyslogAddress; diff --git a/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressMessages.c b/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressMessages.c deleted file mode 100644 index 530cdb42..00000000 --- a/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressMessages.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogPlusTcpAddressErrors.h" - -static const char* PlusTcpAddressError_AsString(uint8_t code) -{ - static const char* const messages[PLUSTCPADDRESS_ERROR_MAX] = { - [PLUSTCPADDRESS_ERROR_POOL_EXHAUSTED] = - "SolidSyslogPlusTcpAddress_Create pool exhausted; returning fallback address", - [PLUSTCPADDRESS_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogPlusTcpAddress_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) PLUSTCPADDRESS_ERROR_MAX) - { - enum SolidSyslogPlusTcpAddressErrors typed = (enum SolidSyslogPlusTcpAddressErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource PlusTcpAddressErrorSource = {"PlusTcpAddress", PlusTcpAddressError_AsString}; diff --git a/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagram.c b/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagram.c index cbea5812..f505d603 100644 --- a/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagram.c +++ b/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagram.c @@ -10,13 +10,17 @@ #include "FreeRTOS.h" #include "FreeRTOS_ARP.h" #include "FreeRTOS_Sockets.h" -#include "task.h" +#include "SolidSyslogDatagram.h" #include "SolidSyslogDatagramDefinition.h" +#include "SolidSyslogError.h" +#include "SolidSyslogNullDatagram.h" #include "SolidSyslogPlusTcpAddressPrivate.h" +#include "SolidSyslogPlusTcpDatagramErrors.h" #include "SolidSyslogPlusTcpDatagramPrivate.h" -#include "SolidSyslogNullDatagram.h" #include "SolidSyslogUdpPayload.h" -#include "SolidSyslogDatagram.h" +#include "task.h" + +const struct SolidSyslogErrorSource PlusTcpDatagramErrorSource = {"PlusTcpDatagram"}; struct SolidSyslogAddress; diff --git a/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagramMessages.c b/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagramMessages.c deleted file mode 100644 index 5411a324..00000000 --- a/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagramMessages.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogPlusTcpDatagramErrors.h" - -static const char* PlusTcpDatagramError_AsString(uint8_t code) -{ - static const char* const messages[PLUSTCPDATAGRAM_ERROR_MAX] = { - [PLUSTCPDATAGRAM_ERROR_POOL_EXHAUSTED] = - "SolidSyslogPlusTcpDatagram_Create pool exhausted; returning fallback datagram", - [PLUSTCPDATAGRAM_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogPlusTcpDatagram_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) PLUSTCPDATAGRAM_ERROR_MAX) - { - enum SolidSyslogPlusTcpDatagramErrors typed = (enum SolidSyslogPlusTcpDatagramErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource PlusTcpDatagramErrorSource = {"PlusTcpDatagram", PlusTcpDatagramError_AsString}; diff --git a/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolver.c b/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolver.c index be2eba6d..1af47491 100644 --- a/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolver.c +++ b/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolver.c @@ -9,12 +9,16 @@ #include "FreeRTOS_IP.h" #include "FreeRTOS_Sockets.h" +#include "SolidSyslogError.h" +#include "SolidSyslogNullResolver.h" #include "SolidSyslogPlusTcpAddressPrivate.h" +#include "SolidSyslogPlusTcpResolverErrors.h" #include "SolidSyslogPlusTcpResolverPrivate.h" -#include "SolidSyslogNullResolver.h" #include "SolidSyslogResolverDefinition.h" #include "SolidSyslogTransport.h" +const struct SolidSyslogErrorSource PlusTcpResolverErrorSource = {"PlusTcpResolver"}; + struct SolidSyslogAddress; enum diff --git a/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolverMessages.c b/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolverMessages.c deleted file mode 100644 index 7a912313..00000000 --- a/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolverMessages.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogPlusTcpResolverErrors.h" - -static const char* PlusTcpResolverError_AsString(uint8_t code) -{ - static const char* const messages[PLUSTCPRESOLVER_ERROR_MAX] = { - [PLUSTCPRESOLVER_ERROR_POOL_EXHAUSTED] = - "SolidSyslogPlusTcpResolver_Create pool exhausted; returning fallback resolver", - [PLUSTCPRESOLVER_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogPlusTcpResolver_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) PLUSTCPRESOLVER_ERROR_MAX) - { - enum SolidSyslogPlusTcpResolverErrors typed = (enum SolidSyslogPlusTcpResolverErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource PlusTcpResolverErrorSource = {"PlusTcpResolver", PlusTcpResolverError_AsString}; diff --git a/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStream.c b/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStream.c index 88369d6e..fea929d3 100644 --- a/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStream.c +++ b/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStream.c @@ -11,12 +11,16 @@ #include "FreeRTOS_ARP.h" #include "FreeRTOS_IP.h" #include "FreeRTOS_Sockets.h" -#include "task.h" +#include "SolidSyslogError.h" +#include "SolidSyslogNullStream.h" #include "SolidSyslogPlusTcpAddressPrivate.h" +#include "SolidSyslogPlusTcpTcpStreamErrors.h" #include "SolidSyslogPlusTcpTcpStreamPrivate.h" -#include "SolidSyslogNullStream.h" #include "SolidSyslogStream.h" #include "SolidSyslogTunables.h" +#include "task.h" + +const struct SolidSyslogErrorSource PlusTcpTcpStreamErrorSource = {"PlusTcpTcpStream"}; struct SolidSyslogAddress; diff --git a/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStreamMessages.c b/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStreamMessages.c deleted file mode 100644 index 3513e291..00000000 --- a/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStreamMessages.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogPlusTcpTcpStreamErrors.h" - -static const char* PlusTcpTcpStreamError_AsString(uint8_t code) -{ - static const char* const messages[PLUSTCPTCPSTREAM_ERROR_MAX] = { - [PLUSTCPTCPSTREAM_ERROR_POOL_EXHAUSTED] = - "SolidSyslogPlusTcpTcpStream_Create pool exhausted; returning fallback stream", - [PLUSTCPTCPSTREAM_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogPlusTcpTcpStream_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) PLUSTCPTCPSTREAM_ERROR_MAX) - { - enum SolidSyslogPlusTcpTcpStreamErrors typed = (enum SolidSyslogPlusTcpTcpStreamErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource PlusTcpTcpStreamErrorSource = {"PlusTcpTcpStream", PlusTcpTcpStreamError_AsString}; diff --git a/Platform/Posix/CMakeLists.txt b/Platform/Posix/CMakeLists.txt index 18f08e80..505ff1e5 100644 --- a/Platform/Posix/CMakeLists.txt +++ b/Platform/Posix/CMakeLists.txt @@ -2,28 +2,21 @@ target_sources(${PROJECT_NAME} PRIVATE Source/SolidSyslogPosixClock.c Source/SolidSyslogPosixHostname.c Source/SolidSyslogPosixMessageQueueBuffer.c - Source/SolidSyslogPosixMessageQueueBufferMessages.c Source/SolidSyslogPosixMessageQueueBufferStatic.c Source/SolidSyslogPosixMutex.c - Source/SolidSyslogPosixMutexMessages.c Source/SolidSyslogPosixMutexStatic.c Source/SolidSyslogPosixProcessId.c Source/SolidSyslogPosixSysUpTime.c Source/SolidSyslogPosixSleep.c Source/SolidSyslogPosixAddress.c - Source/SolidSyslogPosixAddressMessages.c Source/SolidSyslogPosixAddressStatic.c Source/SolidSyslogGetAddrInfoResolver.c - Source/SolidSyslogGetAddrInfoResolverMessages.c Source/SolidSyslogGetAddrInfoResolverStatic.c Source/SolidSyslogPosixDatagram.c - Source/SolidSyslogPosixDatagramMessages.c Source/SolidSyslogPosixDatagramStatic.c Source/SolidSyslogPosixTcpStream.c - Source/SolidSyslogPosixTcpStreamMessages.c Source/SolidSyslogPosixTcpStreamStatic.c Source/SolidSyslogPosixFile.c - Source/SolidSyslogPosixFileMessages.c Source/SolidSyslogPosixFileStatic.c ) diff --git a/Platform/Posix/Source/SolidSyslogGetAddrInfoResolver.c b/Platform/Posix/Source/SolidSyslogGetAddrInfoResolver.c index 3e2d195c..84a9c738 100644 --- a/Platform/Posix/Source/SolidSyslogGetAddrInfoResolver.c +++ b/Platform/Posix/Source/SolidSyslogGetAddrInfoResolver.c @@ -8,12 +8,16 @@ #include #include -#include "SolidSyslogPosixAddressPrivate.h" +#include "SolidSyslogError.h" +#include "SolidSyslogGetAddrInfoResolverErrors.h" #include "SolidSyslogGetAddrInfoResolverPrivate.h" #include "SolidSyslogNullResolver.h" +#include "SolidSyslogPosixAddressPrivate.h" #include "SolidSyslogResolverDefinition.h" #include "SolidSyslogTransport.h" +const struct SolidSyslogErrorSource GetAddrInfoResolverErrorSource = {"GetAddrInfoResolver"}; + struct SolidSyslogAddress; enum diff --git a/Platform/Posix/Source/SolidSyslogGetAddrInfoResolverMessages.c b/Platform/Posix/Source/SolidSyslogGetAddrInfoResolverMessages.c deleted file mode 100644 index 5a11c2b6..00000000 --- a/Platform/Posix/Source/SolidSyslogGetAddrInfoResolverMessages.c +++ /dev/null @@ -1,26 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogGetAddrInfoResolverErrors.h" - -static const char* GetAddrInfoResolverError_AsString(uint8_t code) -{ - static const char* const messages[GETADDRINFORESOLVER_ERROR_MAX] = { - [GETADDRINFORESOLVER_ERROR_POOL_EXHAUSTED] = - "SolidSyslogGetAddrInfoResolver_Create pool exhausted; returning fallback resolver", - [GETADDRINFORESOLVER_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogGetAddrInfoResolver_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) GETADDRINFORESOLVER_ERROR_MAX) - { - enum SolidSyslogGetAddrInfoResolverErrors typed = (enum SolidSyslogGetAddrInfoResolverErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource GetAddrInfoResolverErrorSource = { - "GetAddrInfoResolver", - GetAddrInfoResolverError_AsString -}; diff --git a/Platform/Posix/Source/SolidSyslogPosixAddress.c b/Platform/Posix/Source/SolidSyslogPosixAddress.c index 8b6ea172..2611b5be 100644 --- a/Platform/Posix/Source/SolidSyslogPosixAddress.c +++ b/Platform/Posix/Source/SolidSyslogPosixAddress.c @@ -1,8 +1,12 @@ +#include "SolidSyslogError.h" +#include "SolidSyslogPosixAddressErrors.h" #include "SolidSyslogPosixAddressPrivate.h" #include #include +const struct SolidSyslogErrorSource PosixAddressErrorSource = {"PosixAddress"}; + struct SolidSyslogAddress; void PosixAddress_Initialise(struct SolidSyslogAddress* base) diff --git a/Platform/Posix/Source/SolidSyslogPosixAddressMessages.c b/Platform/Posix/Source/SolidSyslogPosixAddressMessages.c deleted file mode 100644 index dbb67173..00000000 --- a/Platform/Posix/Source/SolidSyslogPosixAddressMessages.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogPosixAddressErrors.h" - -static const char* PosixAddressError_AsString(uint8_t code) -{ - static const char* const messages[POSIXADDRESS_ERROR_MAX] = { - [POSIXADDRESS_ERROR_POOL_EXHAUSTED] = - "SolidSyslogPosixAddress_Create pool exhausted; returning fallback address", - [POSIXADDRESS_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogPosixAddress_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) POSIXADDRESS_ERROR_MAX) - { - enum SolidSyslogPosixAddressErrors typed = (enum SolidSyslogPosixAddressErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource PosixAddressErrorSource = {"PosixAddress", PosixAddressError_AsString}; diff --git a/Platform/Posix/Source/SolidSyslogPosixDatagram.c b/Platform/Posix/Source/SolidSyslogPosixDatagram.c index 87692499..6e0b806c 100644 --- a/Platform/Posix/Source/SolidSyslogPosixDatagram.c +++ b/Platform/Posix/Source/SolidSyslogPosixDatagram.c @@ -10,11 +10,15 @@ #include "SolidSyslogDatagram.h" #include "SolidSyslogDatagramDefinition.h" +#include "SolidSyslogError.h" #include "SolidSyslogNullDatagram.h" #include "SolidSyslogPosixAddressPrivate.h" +#include "SolidSyslogPosixDatagramErrors.h" #include "SolidSyslogPosixDatagramPrivate.h" #include "SolidSyslogUdpPayload.h" +const struct SolidSyslogErrorSource PosixDatagramErrorSource = {"PosixDatagram"}; + struct SolidSyslogAddress; enum diff --git a/Platform/Posix/Source/SolidSyslogPosixDatagramMessages.c b/Platform/Posix/Source/SolidSyslogPosixDatagramMessages.c deleted file mode 100644 index bb90032c..00000000 --- a/Platform/Posix/Source/SolidSyslogPosixDatagramMessages.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogPosixDatagramErrors.h" - -static const char* PosixDatagramError_AsString(uint8_t code) -{ - static const char* const messages[POSIXDATAGRAM_ERROR_MAX] = { - [POSIXDATAGRAM_ERROR_POOL_EXHAUSTED] = - "SolidSyslogPosixDatagram_Create pool exhausted; returning fallback datagram", - [POSIXDATAGRAM_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogPosixDatagram_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) POSIXDATAGRAM_ERROR_MAX) - { - enum SolidSyslogPosixDatagramErrors typed = (enum SolidSyslogPosixDatagramErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource PosixDatagramErrorSource = {"PosixDatagram", PosixDatagramError_AsString}; diff --git a/Platform/Posix/Source/SolidSyslogPosixFile.c b/Platform/Posix/Source/SolidSyslogPosixFile.c index cb8c9423..e438a849 100644 --- a/Platform/Posix/Source/SolidSyslogPosixFile.c +++ b/Platform/Posix/Source/SolidSyslogPosixFile.c @@ -7,10 +7,14 @@ #include #include +#include "SolidSyslogError.h" #include "SolidSyslogFileDefinition.h" #include "SolidSyslogNullFile.h" +#include "SolidSyslogPosixFileErrors.h" #include "SolidSyslogPosixFilePrivate.h" +const struct SolidSyslogErrorSource PosixFileErrorSource = {"PosixFile"}; + #define OWNER_READ_WRITE (S_IRUSR | S_IWUSR) #define DEFAULT_FILE_PERMISSIONS OWNER_READ_WRITE diff --git a/Platform/Posix/Source/SolidSyslogPosixFileMessages.c b/Platform/Posix/Source/SolidSyslogPosixFileMessages.c deleted file mode 100644 index 256c8dfa..00000000 --- a/Platform/Posix/Source/SolidSyslogPosixFileMessages.c +++ /dev/null @@ -1,21 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogPosixFileErrors.h" - -static const char* PosixFileError_AsString(uint8_t code) -{ - static const char* const messages[POSIXFILE_ERROR_MAX] = { - [POSIXFILE_ERROR_POOL_EXHAUSTED] = "SolidSyslogPosixFile_Create pool exhausted; returning fallback file", - [POSIXFILE_ERROR_UNKNOWN_DESTROY] = "SolidSyslogPosixFile_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) POSIXFILE_ERROR_MAX) - { - enum SolidSyslogPosixFileErrors typed = (enum SolidSyslogPosixFileErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource PosixFileErrorSource = {"PosixFile", PosixFileError_AsString}; diff --git a/Platform/Posix/Source/SolidSyslogPosixMessageQueueBuffer.c b/Platform/Posix/Source/SolidSyslogPosixMessageQueueBuffer.c index 34893bc8..209437b0 100644 --- a/Platform/Posix/Source/SolidSyslogPosixMessageQueueBuffer.c +++ b/Platform/Posix/Source/SolidSyslogPosixMessageQueueBuffer.c @@ -19,6 +19,8 @@ #include "SolidSyslogPosixProcessId.h" #include "SolidSyslogPrival.h" +const struct SolidSyslogErrorSource PosixMessageQueueBufferErrorSource = {"PosixMessageQueueBuffer"}; + enum { /* 0600 in octal — owner read/write, equivalent to S_IRUSR | S_IWUSR. Hex form avoids MISRA 7.1. */ diff --git a/Platform/Posix/Source/SolidSyslogPosixMessageQueueBufferMessages.c b/Platform/Posix/Source/SolidSyslogPosixMessageQueueBufferMessages.c deleted file mode 100644 index 437beddb..00000000 --- a/Platform/Posix/Source/SolidSyslogPosixMessageQueueBufferMessages.c +++ /dev/null @@ -1,31 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogPosixMessageQueueBufferErrors.h" - -static const char* PosixMessageQueueBufferError_AsString(uint8_t code) -{ - static const char* const messages[POSIXMESSAGEQUEUEBUFFER_ERROR_MAX] = { - [POSIXMESSAGEQUEUEBUFFER_ERROR_POOL_EXHAUSTED] = - "SolidSyslogPosixMessageQueueBuffer_Create pool exhausted; returning fallback buffer", - [POSIXMESSAGEQUEUEBUFFER_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogPosixMessageQueueBuffer_Destroy called with a handle not issued by this pool", - [POSIXMESSAGEQUEUEBUFFER_ERROR_MQ_OPEN_FAILED] = - "SolidSyslogPosixMessageQueueBuffer_Create mq_open failed; returning fallback buffer", - [POSIXMESSAGEQUEUEBUFFER_ERROR_SEND_FAILED] = - "SolidSyslogPosixMessageQueueBuffer_Write mq_send failed; record dropped", - [POSIXMESSAGEQUEUEBUFFER_ERROR_RECEIVE_FAILED] = "SolidSyslogPosixMessageQueueBuffer_Read mq_receive failed", - }; - const char* result = "unknown"; - if (code < (uint8_t) POSIXMESSAGEQUEUEBUFFER_ERROR_MAX) - { - enum SolidSyslogPosixMessageQueueBufferErrors typed = (enum SolidSyslogPosixMessageQueueBufferErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource PosixMessageQueueBufferErrorSource = { - "PosixMessageQueueBuffer", - PosixMessageQueueBufferError_AsString -}; diff --git a/Platform/Posix/Source/SolidSyslogPosixMutex.c b/Platform/Posix/Source/SolidSyslogPosixMutex.c index 523ff809..1fe6c1fc 100644 --- a/Platform/Posix/Source/SolidSyslogPosixMutex.c +++ b/Platform/Posix/Source/SolidSyslogPosixMutex.c @@ -3,10 +3,14 @@ #include #include +#include "SolidSyslogError.h" #include "SolidSyslogMutexDefinition.h" #include "SolidSyslogNullMutex.h" +#include "SolidSyslogPosixMutexErrors.h" #include "SolidSyslogPosixMutexPrivate.h" +const struct SolidSyslogErrorSource PosixMutexErrorSource = {"PosixMutex"}; + static void PosixMutex_Lock(struct SolidSyslogMutex* base); static void PosixMutex_Unlock(struct SolidSyslogMutex* base); diff --git a/Platform/Posix/Source/SolidSyslogPosixMutexMessages.c b/Platform/Posix/Source/SolidSyslogPosixMutexMessages.c deleted file mode 100644 index 53fa5071..00000000 --- a/Platform/Posix/Source/SolidSyslogPosixMutexMessages.c +++ /dev/null @@ -1,22 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogPosixMutexErrors.h" - -static const char* PosixMutexError_AsString(uint8_t code) -{ - static const char* const messages[POSIXMUTEX_ERROR_MAX] = { - [POSIXMUTEX_ERROR_POOL_EXHAUSTED] = "SolidSyslogPosixMutex_Create pool exhausted; returning fallback mutex", - [POSIXMUTEX_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogPosixMutex_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) POSIXMUTEX_ERROR_MAX) - { - enum SolidSyslogPosixMutexErrors typed = (enum SolidSyslogPosixMutexErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource PosixMutexErrorSource = {"PosixMutex", PosixMutexError_AsString}; diff --git a/Platform/Posix/Source/SolidSyslogPosixTcpStream.c b/Platform/Posix/Source/SolidSyslogPosixTcpStream.c index cc4af021..e3c6367f 100644 --- a/Platform/Posix/Source/SolidSyslogPosixTcpStream.c +++ b/Platform/Posix/Source/SolidSyslogPosixTcpStream.c @@ -13,12 +13,16 @@ #include #include +#include "SolidSyslogError.h" #include "SolidSyslogNullStream.h" #include "SolidSyslogPosixAddressPrivate.h" +#include "SolidSyslogPosixTcpStreamErrors.h" #include "SolidSyslogPosixTcpStreamPrivate.h" #include "SolidSyslogStream.h" #include "SolidSyslogTunables.h" +const struct SolidSyslogErrorSource PosixTcpStreamErrorSource = {"PosixTcpStream"}; + struct SolidSyslogAddress; enum diff --git a/Platform/Posix/Source/SolidSyslogPosixTcpStreamMessages.c b/Platform/Posix/Source/SolidSyslogPosixTcpStreamMessages.c deleted file mode 100644 index ae697df9..00000000 --- a/Platform/Posix/Source/SolidSyslogPosixTcpStreamMessages.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogPosixTcpStreamErrors.h" - -static const char* PosixTcpStreamError_AsString(uint8_t code) -{ - static const char* const messages[POSIXTCPSTREAM_ERROR_MAX] = { - [POSIXTCPSTREAM_ERROR_POOL_EXHAUSTED] = - "SolidSyslogPosixTcpStream_Create pool exhausted; returning fallback stream", - [POSIXTCPSTREAM_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogPosixTcpStream_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) POSIXTCPSTREAM_ERROR_MAX) - { - enum SolidSyslogPosixTcpStreamErrors typed = (enum SolidSyslogPosixTcpStreamErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource PosixTcpStreamErrorSource = {"PosixTcpStream", PosixTcpStreamError_AsString}; diff --git a/Platform/Windows/CMakeLists.txt b/Platform/Windows/CMakeLists.txt index 77fc2e4e..ca6107eb 100644 --- a/Platform/Windows/CMakeLists.txt +++ b/Platform/Windows/CMakeLists.txt @@ -1,7 +1,6 @@ if(HAVE_WINDOWS_INTERLOCKED) target_sources(${PROJECT_NAME} PRIVATE Source/SolidSyslogWindowsAtomicCounter.c - Source/SolidSyslogWindowsAtomicCounterMessages.c Source/SolidSyslogWindowsAtomicCounterStatic.c ) endif() @@ -10,11 +9,9 @@ if(HAVE_WINDOWS_PLATFORM) target_sources(${PROJECT_NAME} PRIVATE Source/SolidSyslogWindowsClock.c Source/SolidSyslogWindowsFile.c - Source/SolidSyslogWindowsFileMessages.c Source/SolidSyslogWindowsFileStatic.c Source/SolidSyslogWindowsHostname.c Source/SolidSyslogWindowsMutex.c - Source/SolidSyslogWindowsMutexMessages.c Source/SolidSyslogWindowsMutexStatic.c Source/SolidSyslogWindowsProcessId.c Source/SolidSyslogWindowsSleep.c @@ -33,16 +30,12 @@ endif() if(SOLIDSYSLOG_WINSOCK) target_sources(${PROJECT_NAME} PRIVATE Source/SolidSyslogWinsockAddress.c - Source/SolidSyslogWinsockAddressMessages.c Source/SolidSyslogWinsockAddressStatic.c Source/SolidSyslogWinsockResolver.c - Source/SolidSyslogWinsockResolverMessages.c Source/SolidSyslogWinsockResolverStatic.c Source/SolidSyslogWinsockDatagram.c - Source/SolidSyslogWinsockDatagramMessages.c Source/SolidSyslogWinsockDatagramStatic.c Source/SolidSyslogWinsockTcpStream.c - Source/SolidSyslogWinsockTcpStreamMessages.c Source/SolidSyslogWinsockTcpStreamStatic.c ) target_link_libraries(${PROJECT_NAME} PUBLIC ws2_32) diff --git a/Platform/Windows/Source/SolidSyslogWindowsAtomicCounter.c b/Platform/Windows/Source/SolidSyslogWindowsAtomicCounter.c index f45f4fd7..9ed1fb1c 100644 --- a/Platform/Windows/Source/SolidSyslogWindowsAtomicCounter.c +++ b/Platform/Windows/Source/SolidSyslogWindowsAtomicCounter.c @@ -5,9 +5,13 @@ #include "SolidSyslogAtomicCounter.h" #include "SolidSyslogAtomicCounterDefinition.h" +#include "SolidSyslogError.h" #include "SolidSyslogNullAtomicCounter.h" +#include "SolidSyslogWindowsAtomicCounterErrors.h" #include "SolidSyslogWindowsAtomicCounterPrivate.h" +const struct SolidSyslogErrorSource WindowsAtomicCounterErrorSource = {"WindowsAtomicCounter"}; + static uint32_t WindowsAtomicCounter_Increment(struct SolidSyslogAtomicCounter* base); static void WindowsAtomicCounter_Init(struct SolidSyslogWindowsAtomicCounter* self, uint32_t value); diff --git a/Platform/Windows/Source/SolidSyslogWindowsAtomicCounterMessages.c b/Platform/Windows/Source/SolidSyslogWindowsAtomicCounterMessages.c deleted file mode 100644 index 99cdb26e..00000000 --- a/Platform/Windows/Source/SolidSyslogWindowsAtomicCounterMessages.c +++ /dev/null @@ -1,26 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogWindowsAtomicCounterErrors.h" - -static const char* WindowsAtomicCounterError_AsString(uint8_t code) -{ - static const char* const messages[WINDOWSATOMICCOUNTER_ERROR_MAX] = { - [WINDOWSATOMICCOUNTER_ERROR_POOL_EXHAUSTED] = - "SolidSyslogWindowsAtomicCounter_Create pool exhausted; returning fallback counter", - [WINDOWSATOMICCOUNTER_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogWindowsAtomicCounter_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) WINDOWSATOMICCOUNTER_ERROR_MAX) - { - enum SolidSyslogWindowsAtomicCounterErrors typed = (enum SolidSyslogWindowsAtomicCounterErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource WindowsAtomicCounterErrorSource = { - "WindowsAtomicCounter", - WindowsAtomicCounterError_AsString -}; diff --git a/Platform/Windows/Source/SolidSyslogWindowsFile.c b/Platform/Windows/Source/SolidSyslogWindowsFile.c index e68f8dac..3f78fbf9 100644 --- a/Platform/Windows/Source/SolidSyslogWindowsFile.c +++ b/Platform/Windows/Source/SolidSyslogWindowsFile.c @@ -8,10 +8,14 @@ #include #include +#include "SolidSyslogError.h" #include "SolidSyslogFileDefinition.h" #include "SolidSyslogNullFile.h" +#include "SolidSyslogWindowsFileErrors.h" #include "SolidSyslogWindowsFilePrivate.h" +const struct SolidSyslogErrorSource WindowsFileErrorSource = {"WindowsFile"}; + /* _O_BINARY disables the MSVC CRT's CR/LF translation on read/write so * arbitrary binary content (e.g. SolidSyslogBlockStore frames) round-trips * unchanged. Without it the CRT substitutes 0x0D 0x0A for 0x0A on write diff --git a/Platform/Windows/Source/SolidSyslogWindowsFileMessages.c b/Platform/Windows/Source/SolidSyslogWindowsFileMessages.c deleted file mode 100644 index 83e9bd0b..00000000 --- a/Platform/Windows/Source/SolidSyslogWindowsFileMessages.c +++ /dev/null @@ -1,22 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogWindowsFileErrors.h" - -static const char* WindowsFileError_AsString(uint8_t code) -{ - static const char* const messages[WINDOWSFILE_ERROR_MAX] = { - [WINDOWSFILE_ERROR_POOL_EXHAUSTED] = "SolidSyslogWindowsFile_Create pool exhausted; returning fallback file", - [WINDOWSFILE_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogWindowsFile_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) WINDOWSFILE_ERROR_MAX) - { - enum SolidSyslogWindowsFileErrors typed = (enum SolidSyslogWindowsFileErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource WindowsFileErrorSource = {"WindowsFile", WindowsFileError_AsString}; diff --git a/Platform/Windows/Source/SolidSyslogWindowsMutex.c b/Platform/Windows/Source/SolidSyslogWindowsMutex.c index b0164332..de6b1b70 100644 --- a/Platform/Windows/Source/SolidSyslogWindowsMutex.c +++ b/Platform/Windows/Source/SolidSyslogWindowsMutex.c @@ -3,10 +3,14 @@ #include #include +#include "SolidSyslogError.h" #include "SolidSyslogMutexDefinition.h" #include "SolidSyslogNullMutex.h" +#include "SolidSyslogWindowsMutexErrors.h" #include "SolidSyslogWindowsMutexPrivate.h" +const struct SolidSyslogErrorSource WindowsMutexErrorSource = {"WindowsMutex"}; + static void WindowsMutex_Lock(struct SolidSyslogMutex* base); static void WindowsMutex_Unlock(struct SolidSyslogMutex* base); diff --git a/Platform/Windows/Source/SolidSyslogWindowsMutexMessages.c b/Platform/Windows/Source/SolidSyslogWindowsMutexMessages.c deleted file mode 100644 index de0a3c2f..00000000 --- a/Platform/Windows/Source/SolidSyslogWindowsMutexMessages.c +++ /dev/null @@ -1,22 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogWindowsMutexErrors.h" - -static const char* WindowsMutexError_AsString(uint8_t code) -{ - static const char* const messages[WINDOWSMUTEX_ERROR_MAX] = { - [WINDOWSMUTEX_ERROR_POOL_EXHAUSTED] = "SolidSyslogWindowsMutex_Create pool exhausted; returning fallback mutex", - [WINDOWSMUTEX_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogWindowsMutex_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) WINDOWSMUTEX_ERROR_MAX) - { - enum SolidSyslogWindowsMutexErrors typed = (enum SolidSyslogWindowsMutexErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource WindowsMutexErrorSource = {"WindowsMutex", WindowsMutexError_AsString}; diff --git a/Platform/Windows/Source/SolidSyslogWinsockAddress.c b/Platform/Windows/Source/SolidSyslogWinsockAddress.c index 7578de76..58f39c96 100644 --- a/Platform/Windows/Source/SolidSyslogWinsockAddress.c +++ b/Platform/Windows/Source/SolidSyslogWinsockAddress.c @@ -1,7 +1,11 @@ +#include "SolidSyslogError.h" +#include "SolidSyslogWinsockAddressErrors.h" #include "SolidSyslogWinsockAddressPrivate.h" #include +const struct SolidSyslogErrorSource WinsockAddressErrorSource = {"WinsockAddress"}; + struct SolidSyslogAddress; void WinsockAddress_Initialise(struct SolidSyslogAddress* base) diff --git a/Platform/Windows/Source/SolidSyslogWinsockAddressMessages.c b/Platform/Windows/Source/SolidSyslogWinsockAddressMessages.c deleted file mode 100644 index d359e788..00000000 --- a/Platform/Windows/Source/SolidSyslogWinsockAddressMessages.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogWinsockAddressErrors.h" - -static const char* WinsockAddressError_AsString(uint8_t code) -{ - static const char* const messages[WINSOCKADDRESS_ERROR_MAX] = { - [WINSOCKADDRESS_ERROR_POOL_EXHAUSTED] = - "SolidSyslogWinsockAddress_Create pool exhausted; returning fallback address", - [WINSOCKADDRESS_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogWinsockAddress_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) WINSOCKADDRESS_ERROR_MAX) - { - enum SolidSyslogWinsockAddressErrors typed = (enum SolidSyslogWinsockAddressErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource WinsockAddressErrorSource = {"WinsockAddress", WinsockAddressError_AsString}; diff --git a/Platform/Windows/Source/SolidSyslogWinsockDatagram.c b/Platform/Windows/Source/SolidSyslogWinsockDatagram.c index 7661074d..36b8529e 100644 --- a/Platform/Windows/Source/SolidSyslogWinsockDatagram.c +++ b/Platform/Windows/Source/SolidSyslogWinsockDatagram.c @@ -5,12 +5,16 @@ #include #include "SolidSyslogDatagramDefinition.h" +#include "SolidSyslogError.h" #include "SolidSyslogNullDatagram.h" #include "SolidSyslogUdpPayload.h" #include "SolidSyslogWinsockAddressPrivate.h" +#include "SolidSyslogWinsockDatagramErrors.h" #include "SolidSyslogWinsockDatagramInternal.h" #include "SolidSyslogWinsockDatagramPrivate.h" +const struct SolidSyslogErrorSource WinsockDatagramErrorSource = {"WinsockDatagram"}; + /* File-local forwarders. Taking the address of a __declspec(dllimport) Winsock function for static initialisation triggers MSVC C4232 (the address isn't a compile-time constant); forwarding through a static function whose diff --git a/Platform/Windows/Source/SolidSyslogWinsockDatagramMessages.c b/Platform/Windows/Source/SolidSyslogWinsockDatagramMessages.c deleted file mode 100644 index 2da67e07..00000000 --- a/Platform/Windows/Source/SolidSyslogWinsockDatagramMessages.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogWinsockDatagramErrors.h" - -static const char* WinsockDatagramError_AsString(uint8_t code) -{ - static const char* const messages[WINSOCKDATAGRAM_ERROR_MAX] = { - [WINSOCKDATAGRAM_ERROR_POOL_EXHAUSTED] = - "SolidSyslogWinsockDatagram_Create pool exhausted; returning fallback datagram", - [WINSOCKDATAGRAM_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogWinsockDatagram_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) WINSOCKDATAGRAM_ERROR_MAX) - { - enum SolidSyslogWinsockDatagramErrors typed = (enum SolidSyslogWinsockDatagramErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource WinsockDatagramErrorSource = {"WinsockDatagram", WinsockDatagramError_AsString}; diff --git a/Platform/Windows/Source/SolidSyslogWinsockResolver.c b/Platform/Windows/Source/SolidSyslogWinsockResolver.c index b1da89fa..1736538c 100644 --- a/Platform/Windows/Source/SolidSyslogWinsockResolver.c +++ b/Platform/Windows/Source/SolidSyslogWinsockResolver.c @@ -4,13 +4,17 @@ #include #include -#include "SolidSyslogWinsockAddressPrivate.h" +#include "SolidSyslogError.h" #include "SolidSyslogNullResolver.h" #include "SolidSyslogResolverDefinition.h" #include "SolidSyslogTransport.h" +#include "SolidSyslogWinsockAddressPrivate.h" +#include "SolidSyslogWinsockResolverErrors.h" #include "SolidSyslogWinsockResolverInternal.h" #include "SolidSyslogWinsockResolverPrivate.h" +const struct SolidSyslogErrorSource WinsockResolverErrorSource = {"WinsockResolver"}; + /* File-local forwarders. Taking the address of a __declspec(dllimport) Winsock function for static initialisation triggers MSVC C4232 (the address isn't a compile-time constant); forwarding through a static function whose diff --git a/Platform/Windows/Source/SolidSyslogWinsockResolverMessages.c b/Platform/Windows/Source/SolidSyslogWinsockResolverMessages.c deleted file mode 100644 index f774adb1..00000000 --- a/Platform/Windows/Source/SolidSyslogWinsockResolverMessages.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogWinsockResolverErrors.h" - -static const char* WinsockResolverError_AsString(uint8_t code) -{ - static const char* const messages[WINSOCKRESOLVER_ERROR_MAX] = { - [WINSOCKRESOLVER_ERROR_POOL_EXHAUSTED] = - "SolidSyslogWinsockResolver_Create pool exhausted; returning fallback resolver", - [WINSOCKRESOLVER_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogWinsockResolver_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) WINSOCKRESOLVER_ERROR_MAX) - { - enum SolidSyslogWinsockResolverErrors typed = (enum SolidSyslogWinsockResolverErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource WinsockResolverErrorSource = {"WinsockResolver", WinsockResolverError_AsString}; diff --git a/Platform/Windows/Source/SolidSyslogWinsockTcpStream.c b/Platform/Windows/Source/SolidSyslogWinsockTcpStream.c index f9f2a70d..5cd53fe4 100644 --- a/Platform/Windows/Source/SolidSyslogWinsockTcpStream.c +++ b/Platform/Windows/Source/SolidSyslogWinsockTcpStream.c @@ -11,13 +11,17 @@ #include #include +#include "SolidSyslogError.h" #include "SolidSyslogNullStream.h" #include "SolidSyslogStreamDefinition.h" #include "SolidSyslogTunables.h" #include "SolidSyslogWinsockAddressPrivate.h" +#include "SolidSyslogWinsockTcpStreamErrors.h" #include "SolidSyslogWinsockTcpStreamInternal.h" #include "SolidSyslogWinsockTcpStreamPrivate.h" +const struct SolidSyslogErrorSource WinsockTcpStreamErrorSource = {"WinsockTcpStream"}; + /* File-local forwarders. Taking the address of a __declspec(dllimport) Winsock function for static initialisation triggers MSVC C4232 (the address isn't a compile-time constant); forwarding through a static function whose diff --git a/Platform/Windows/Source/SolidSyslogWinsockTcpStreamMessages.c b/Platform/Windows/Source/SolidSyslogWinsockTcpStreamMessages.c deleted file mode 100644 index 2168a0af..00000000 --- a/Platform/Windows/Source/SolidSyslogWinsockTcpStreamMessages.c +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include "SolidSyslogError.h" -#include "SolidSyslogWinsockTcpStreamErrors.h" - -static const char* WinsockTcpStreamError_AsString(uint8_t code) -{ - static const char* const messages[WINSOCKTCPSTREAM_ERROR_MAX] = { - [WINSOCKTCPSTREAM_ERROR_POOL_EXHAUSTED] = - "SolidSyslogWinsockTcpStream_Create pool exhausted; returning fallback stream", - [WINSOCKTCPSTREAM_ERROR_UNKNOWN_DESTROY] = - "SolidSyslogWinsockTcpStream_Destroy called with a handle not issued by this pool", - }; - const char* result = "unknown"; - if (code < (uint8_t) WINSOCKTCPSTREAM_ERROR_MAX) - { - enum SolidSyslogWinsockTcpStreamErrors typed = (enum SolidSyslogWinsockTcpStreamErrors) code; - result = messages[typed]; - } - return result; -} - -const struct SolidSyslogErrorSource WinsockTcpStreamErrorSource = {"WinsockTcpStream", WinsockTcpStreamError_AsString}; diff --git a/Tests/Bdd/Targets/BddTargetErrorTextTest.cpp b/Tests/Bdd/Targets/BddTargetErrorTextTest.cpp new file mode 100644 index 00000000..cb7ee5f0 --- /dev/null +++ b/Tests/Bdd/Targets/BddTargetErrorTextTest.cpp @@ -0,0 +1,69 @@ +#include "BddTargetErrorText.h" +#include "SolidSyslogBufferCategories.h" +#include "SolidSyslogErrorCategory.h" +#include "SolidSyslogResolverCategories.h" +#include "SolidSyslogSecurityPolicyCategories.h" +#include "SolidSyslogTlsStreamCategories.h" +#include "CppUTest/TestHarness.h" + +TEST_GROUP(BddTargetErrorText){}; + +TEST(BddTargetErrorText, BadConfigCategoryMapsToText) +{ + STRCMP_EQUAL("bad config", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_BAD_CONFIG)); +} + +TEST(BddTargetErrorText, BadArgumentCategoryMapsToText) +{ + STRCMP_EQUAL("bad argument", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_BAD_ARGUMENT)); +} + +TEST(BddTargetErrorText, PoolExhaustedCategoryMapsToText) +{ + STRCMP_EQUAL("pool exhausted", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_POOL_EXHAUSTED)); +} + +TEST(BddTargetErrorText, UnknownDestroyCategoryMapsToText) +{ + STRCMP_EQUAL("unknown destroy", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_UNKNOWN_DESTROY)); +} + +TEST(BddTargetErrorText, BufferBackendFailedCategoryMapsToText) +{ + STRCMP_EQUAL("buffer backend failed", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_BUFFER_BACKEND_FAILED)); +} + +TEST(BddTargetErrorText, ResolverResolveFailedCategoryMapsToText) +{ + STRCMP_EQUAL("resolve failed", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_RESOLVER_RESOLVE_FAILED)); +} + +TEST(BddTargetErrorText, SecurityPolicyKeyUnavailableCategoryMapsToText) +{ + STRCMP_EQUAL("key unavailable", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_SECURITYPOLICY_KEY_UNAVAILABLE)); +} + +TEST(BddTargetErrorText, SecurityPolicySealFailedCategoryMapsToText) +{ + STRCMP_EQUAL("seal failed", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_SECURITYPOLICY_SEAL_FAILED)); +} + +TEST(BddTargetErrorText, SecurityPolicyOpenFailedCategoryMapsToText) +{ + STRCMP_EQUAL("open failed", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_SECURITYPOLICY_OPEN_FAILED)); +} + +TEST(BddTargetErrorText, TlsStreamInitFailedCategoryMapsToText) +{ + STRCMP_EQUAL("TLS init failed", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_TLSSTREAM_INIT_FAILED)); +} + +TEST(BddTargetErrorText, TlsStreamHandshakeFailedCategoryMapsToText) +{ + STRCMP_EQUAL("TLS handshake failed", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_TLSSTREAM_HANDSHAKE_FAILED)); +} + +TEST(BddTargetErrorText, UnrecognisedCategoryMapsToUnknown) +{ + STRCMP_EQUAL("unknown", BddTargetErrorText_Category((uint16_t) 0xFFFFU)); +} diff --git a/Tests/Bdd/Targets/CMakeLists.txt b/Tests/Bdd/Targets/CMakeLists.txt index 4a7ac988..844f9186 100644 --- a/Tests/Bdd/Targets/CMakeLists.txt +++ b/Tests/Bdd/Targets/CMakeLists.txt @@ -1,6 +1,7 @@ # Platform-agnostic tests always included. set(BDD_TARGET_TEST_SOURCES BddTargetAppNameTest.cpp + BddTargetErrorTextTest.cpp BddTargetIpsTest.cpp BddTargetLanguageTest.cpp main.cpp @@ -8,6 +9,7 @@ set(BDD_TARGET_TEST_SOURCES set(BDD_TARGET_PRODUCTION_SOURCES ${CMAKE_SOURCE_DIR}/Bdd/Targets/Common/BddTargetAppName.c + ${CMAKE_SOURCE_DIR}/Bdd/Targets/Common/BddTargetErrorText.c ${CMAKE_SOURCE_DIR}/Bdd/Targets/Common/BddTargetIps.c ${CMAKE_SOURCE_DIR}/Bdd/Targets/Common/BddTargetLanguage.c ) diff --git a/Tests/FatFs/CMakeLists.txt b/Tests/FatFs/CMakeLists.txt index 0adb48f8..a379863f 100644 --- a/Tests/FatFs/CMakeLists.txt +++ b/Tests/FatFs/CMakeLists.txt @@ -13,7 +13,6 @@ add_executable(SolidSyslogFatFsFileTest SolidSyslogFatFsFilePoolTest.cpp main.cpp ${CMAKE_SOURCE_DIR}/Platform/FatFs/Source/SolidSyslogFatFsFile.c - ${CMAKE_SOURCE_DIR}/Platform/FatFs/Source/SolidSyslogFatFsFileMessages.c ${CMAKE_SOURCE_DIR}/Platform/FatFs/Source/SolidSyslogFatFsFileStatic.c ${CMAKE_SOURCE_DIR}/Tests/Support/FatFsFakes/Source/FatFsFake.c ) diff --git a/Tests/FreeRtos/CMakeLists.txt b/Tests/FreeRtos/CMakeLists.txt index 34817e41..4d634d05 100644 --- a/Tests/FreeRtos/CMakeLists.txt +++ b/Tests/FreeRtos/CMakeLists.txt @@ -15,10 +15,8 @@ else() SolidSyslogPlusTcpDatagramTest.cpp main.cpp ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddress.c - ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressMessages.c ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressStatic.c ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagram.c - ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagramMessages.c ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagramStatic.c ${CMAKE_SOURCE_DIR}/Tests/Support/FreeRtosFakes/Source/FreeRtosSocketsFake.c ${CMAKE_SOURCE_DIR}/Tests/Support/FreeRtosFakes/Source/FreeRtosArpFake.c @@ -52,10 +50,8 @@ else() SolidSyslogPlusTcpTcpStreamTest.cpp main.cpp ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddress.c - ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressMessages.c ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressStatic.c ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStream.c - ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStreamMessages.c ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStreamStatic.c ${CMAKE_SOURCE_DIR}/Tests/Support/FreeRtosFakes/Source/FreeRtosSocketsFake.c ${CMAKE_SOURCE_DIR}/Tests/Support/FreeRtosFakes/Source/FreeRtosArpFake.c @@ -89,10 +85,8 @@ else() SolidSyslogPlusTcpResolverTest.cpp main.cpp ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddress.c - ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressMessages.c ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressStatic.c ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolver.c - ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolverMessages.c ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolverStatic.c ${CMAKE_SOURCE_DIR}/Tests/Support/FreeRtosFakes/Source/FreeRtosDnsFake.c ${CMAKE_SOURCE_DIR}/Tests/Support/SafeStringStandard.c @@ -125,7 +119,6 @@ else() SolidSyslogPlusTcpAddressTest.cpp main.cpp ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddress.c - ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressMessages.c ${CMAKE_SOURCE_DIR}/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressStatic.c ) @@ -160,7 +153,6 @@ add_executable(SolidSyslogFreeRtosMutexTest SolidSyslogFreeRtosMutexTest.cpp main.cpp ${CMAKE_SOURCE_DIR}/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutex.c - ${CMAKE_SOURCE_DIR}/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexMessages.c ${CMAKE_SOURCE_DIR}/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexStatic.c ${CMAKE_SOURCE_DIR}/Tests/Support/FreeRtosFakes/Source/FreeRtosSemaphoreFake.c ) diff --git a/Tests/Lwip/CMakeLists.txt b/Tests/Lwip/CMakeLists.txt index bc42b67f..867c3708 100644 --- a/Tests/Lwip/CMakeLists.txt +++ b/Tests/Lwip/CMakeLists.txt @@ -57,7 +57,6 @@ add_executable(SolidSyslogLwipRawAddressTest SolidSyslogLwipRawAddressTest.cpp main.cpp ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawAddress.c - ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressMessages.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressStatic.c ) @@ -87,10 +86,8 @@ add_executable(SolidSyslogLwipRawResolverTest SolidSyslogLwipRawResolverTest.cpp main.cpp ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawAddress.c - ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressMessages.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressStatic.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawResolver.c - ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawResolverMessages.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawResolverStatic.c ) @@ -119,11 +116,9 @@ add_executable(SolidSyslogLwipRawDnsResolverTest ${CMAKE_SOURCE_DIR}/Tests/Support/LwipFakes/Source/LwipFakeMarshalGuard.cpp ${CMAKE_SOURCE_DIR}/Tests/Support/LwipFakes/Source/LwipDnsFake.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawAddress.c - ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressMessages.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressStatic.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawMarshal.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolver.c - ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolverMessages.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolverStatic.c ) # NB LwipDnsFake.c + the marshal are listed now (not slice-1 strict-minimal) so @@ -153,10 +148,8 @@ add_executable(SolidSyslogLwipRawDatagramTest main.cpp ${LWIP_FAKE_SOURCES} ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawAddress.c - ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressMessages.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressStatic.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagram.c - ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagramMessages.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagramStatic.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawMarshal.c ) @@ -186,11 +179,9 @@ add_executable(SolidSyslogLwipRawTcpStreamTest ${CMAKE_SOURCE_DIR}/Tests/Support/LwipFakes/Source/LwipPbufFake.c ${CMAKE_SOURCE_DIR}/Tests/Support/LwipFakes/Source/LwipTcpFake.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawAddress.c - ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressMessages.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressStatic.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawMarshal.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStream.c - ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStreamMessages.c ${CMAKE_SOURCE_DIR}/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStreamStatic.c ) diff --git a/Tests/MbedTls/CMakeLists.txt b/Tests/MbedTls/CMakeLists.txt index 249f3472..1e8cdccc 100644 --- a/Tests/MbedTls/CMakeLists.txt +++ b/Tests/MbedTls/CMakeLists.txt @@ -12,7 +12,6 @@ add_executable(SolidSyslogMbedTlsStreamPoolTest SolidSyslogMbedTlsStreamPoolTest.cpp main.cpp ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c - ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamMessages.c ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamStatic.c ${CMAKE_SOURCE_DIR}/Tests/StreamFake.c ) @@ -51,7 +50,6 @@ add_executable(SolidSyslogMbedTlsStreamTest SolidSyslogMbedTlsStreamTest.cpp main.cpp ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c - ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamMessages.c ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamStatic.c ${CMAKE_SOURCE_DIR}/Tests/AddressFake.c ${CMAKE_SOURCE_DIR}/Tests/StreamFake.c @@ -89,7 +87,6 @@ add_executable(SolidSyslogMbedTlsHmacSha256PolicyTest SolidSyslogMbedTlsHmacSha256PolicyTest.cpp main.cpp ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256Policy.c - ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyMessages.c ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyStatic.c ) @@ -128,7 +125,6 @@ add_executable(SolidSyslogMbedTlsAesGcmPolicyTest SolidSyslogMbedTlsAesGcmPolicyTest.cpp main.cpp ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicy.c - ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyMessages.c ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyStatic.c ) diff --git a/Tests/MbedTlsIntegration/CMakeLists.txt b/Tests/MbedTlsIntegration/CMakeLists.txt index 16312cb4..cde0625b 100644 --- a/Tests/MbedTlsIntegration/CMakeLists.txt +++ b/Tests/MbedTlsIntegration/CMakeLists.txt @@ -54,10 +54,8 @@ add_executable(MbedTlsIntegrationTests ${CMAKE_SOURCE_DIR}/Tests/AddressFake.c ${CMAKE_SOURCE_DIR}/Tests/Support/SafeStringStandard.c ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c - ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamMessages.c ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamStatic.c ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicy.c - ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyMessages.c ${CMAKE_SOURCE_DIR}/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyStatic.c ) diff --git a/Tests/SolidSyslogErrorTest.cpp b/Tests/SolidSyslogErrorTest.cpp index aad13f20..8b1f6aec 100644 --- a/Tests/SolidSyslogErrorTest.cpp +++ b/Tests/SolidSyslogErrorTest.cpp @@ -17,13 +17,13 @@ TEST_GROUP(SolidSyslogErrorEx) TEST(SolidSyslogErrorEx, ErrorExWithDefaultHandlerDoesNotCrash) { - static const struct SolidSyslogErrorSource source = {"test", nullptr}; + static const struct SolidSyslogErrorSource source = {"test"}; SolidSyslog_Error(SOLIDSYSLOG_SEVERITY_ERROR, &source, 0U, 0); } TEST(SolidSyslogErrorEx, InstalledHandlerReceivesEventFieldsAndContext) { - static const struct SolidSyslogErrorSource source = {"test", nullptr}; + static const struct SolidSyslogErrorSource source = {"test"}; ErrorHandlerFake_Install(&sentinel); SolidSyslog_Error(SOLIDSYSLOG_SEVERITY_WARNING, &source, 7U, 42); @@ -38,7 +38,7 @@ TEST(SolidSyslogErrorEx, InstalledHandlerReceivesEventFieldsAndContext) TEST(SolidSyslogErrorEx, SetErrorHandlerExWithNullHandlerRestoresDefault) { - static const struct SolidSyslogErrorSource source = {"test", nullptr}; + static const struct SolidSyslogErrorSource source = {"test"}; ErrorHandlerFake_Install(&sentinel); SolidSyslog_SetErrorHandler(nullptr, &sentinel); diff --git a/Tests/SolidSyslogUdpSenderTest.cpp b/Tests/SolidSyslogUdpSenderTest.cpp index 1703d716..f10c03ca 100644 --- a/Tests/SolidSyslogUdpSenderTest.cpp +++ b/Tests/SolidSyslogUdpSenderTest.cpp @@ -10,7 +10,6 @@ #include "SocketFake.h" #include "SolidSyslogDatagram.h" #include "SolidSyslogEndpoint.h" -#include "SolidSyslogError.h" #include "SolidSyslogErrorCategory.h" #include "SolidSyslogFormatter.h" #include "SolidSyslogGetAddrInfoResolver.h" @@ -920,22 +919,3 @@ TEST(SolidSyslogUdpSenderPool, ExhaustedCreateReportsError) UNSIGNED_LONGS_EQUAL(SOLIDSYSLOG_CAT_POOL_EXHAUSTED, ErrorHandlerFake_LastCategory()); UNSIGNED_LONGS_EQUAL(UDPSENDER_ERROR_POOL_EXHAUSTED, ErrorHandlerFake_LastDetail()); } - -TEST_GROUP(SolidSyslogUdpSenderErrorSource){}; - -TEST(SolidSyslogUdpSenderErrorSource, AsStringReturnsMessageForKnownCode) -{ - STRCMP_EQUAL( - "SolidSyslogUdpSender_Create called with NULL config", - UdpSenderErrorSource.AsString(UDPSENDER_ERROR_NULL_CONFIG) - ); - STRCMP_EQUAL( - "SolidSyslogUdpSender_Create pool exhausted; returning fallback sender", - UdpSenderErrorSource.AsString(UDPSENDER_ERROR_POOL_EXHAUSTED) - ); -} - -TEST(SolidSyslogUdpSenderErrorSource, AsStringReturnsFallbackForOutOfRangeCode) -{ - STRCMP_EQUAL("unknown", UdpSenderErrorSource.AsString(UDPSENDER_ERROR_MAX)); -} diff --git a/docs/misra-deviations.md b/docs/misra-deviations.md index 50c7870f..380c5f9b 100644 --- a/docs/misra-deviations.md +++ b/docs/misra-deviations.md @@ -1006,64 +1006,18 @@ The cast is well-defined: `unsigned char` may alias any object type Project owner — David Cozens. Recorded under [S10.20](https://github.com/DavidCozens/solid-syslog/issues/437). -## D.014 — Rule 8.7: public-API `SolidSyslogErrorSource` objects with external linkage - -### Rule - -> **Rule 8.7 (Advisory)** — Functions and objects should not be defined with -> external linkage if they are referenced in only one translation unit. - -### Deviation - -Each error-reporting class exposes a single `const struct SolidSyslogErrorSource` -instance (e.g. `MbedTlsHmacSha256PolicyErrorSource`) with external linkage, -declared `extern` in the class's public `*Errors.h` header. The external linkage -is part of the public API: an integrator installs one `SolidSyslogErrorHandler` -and attributes an event to a library component by matching the handler's `source` -argument against these objects by pointer identity, then switches on the -per-source error enum: - -```c -if (source == &MbedTlsHmacSha256PolicyErrorSource) { switch (code) { ... } } -``` - -Those references live in integrator code, outside the library's translation -units, so cppcheck-misra cannot see them and reports the object as referenced in -only one TU. - -### Scope - -- `Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyMessages.c` — - `MbedTlsHmacSha256PolicyErrorSource`. -- `Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyMessages.c` — - `OpenSslHmacSha256PolicyErrorSource` (the OpenSSL sibling; S17.01). - -The deviation extends to any `SolidSyslogErrorSource` instance whose internal -references are confined to a single TU. Most error sources escape rule 8.7 -incidentally because their `*Static.c` lifecycle code emits through the same -source; this class routes every emission through one internal helper -(`MbedTlsHmacSha256Policy_Report`) co-located with the source in `*Messages.c`, -leaving it referenced from that one TU. The external linkage is required either -way by the public error-handler API. - -### Rationale - -| Alternative | Why rejected | -|---|---| -| Make the object `static` | Breaks the public error-handler API — integrators could no longer pointer-match the source to attribute an event to this component. | -| Scatter `SolidSyslog_Error(&…ErrorSource, …)` calls back across `*Static.c` and the policy `.c` so the source is referenced cross-TU | Re-introduces the duplicated severity/source/cast argument lists the `_Report` helper removed, and couples error emission to the static-pool TU — a dynamic-allocation variant would replace `*Static.c` and lose the references again. | -| Inline `cppcheck-suppress` at the definition | Inline suppressions are weaker per MISRA Compliance:2020 §4.2; project preference is structural deviations recorded here. | - -### Risk and mitigation - -- The object is `const` — read-only, no mutable shared state across TUs. -- Rule 8.7 is Advisory; the external linkage is a deliberate API choice. -- If a future revision references the source from a second library TU (e.g. a - dynamic-allocation lifecycle file that emits its own errors), the finding - disappears and the suppression line can be retired. - -### Approval - -Project owner — David Cozens. Recorded under -[S17.02](https://github.com/DavidCozens/solid-syslog/issues/493). - +## D.014 — Rule 8.7: public-API `SolidSyslogErrorSource` objects (retired) + +**Retired in S12.26.** This deviation covered the crypto-policy +`SolidSyslogErrorSource` objects, which rule 8.7 flagged because the +`Xxx_Report` wrapper confined every emission to the source's own `*Messages.c` +— a single translation unit. S12.26 decoupled error text from the library +(deleting the `*Messages.c` message tables) and unwound the `_Report` wrapper, +so each source is now defined in its class's vtable TU and referenced from both +that TU's emit sites and its `*Static.c` lifecycle code — genuinely cross-TU, +exactly the resolution this deviation's "Risk and mitigation" anticipated. +cppcheck-misra reports no 8.7 finding for any error source; the suppression +lines were removed. + +Recorded under [S17.02](https://github.com/DavidCozens/solid-syslog/issues/493), +retired under [S12.26](https://github.com/DavidCozens/solid-syslog/issues/507). diff --git a/misra_suppressions.txt b/misra_suppressions.txt index 4e6c3138..7a151138 100644 --- a/misra_suppressions.txt +++ b/misra_suppressions.txt @@ -198,10 +198,3 @@ misra-c2012-8.9:Core/Source/SolidSyslogFileBlockDevice.c:16 # See docs/misra-deviations.md#d013 misra-c2012-11.5:Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c:315 misra-c2012-11.5:Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c:334 - -# D.014 — Rule 8.7: public-API SolidSyslogErrorSource objects with external linkage -# See docs/misra-deviations.md#d014 -misra-c2012-8.7:Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyMessages.c:31 -misra-c2012-8.7:Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyMessages.c:35 -misra-c2012-8.7:Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyMessages.c:35 -misra-c2012-8.7:Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyMessages.c:31 From b6026b406a3aa387f0f53c178fa3c63f2654b174 Mon Sep 17 00:00:00 2001 From: David Cozens Date: Wed, 3 Jun 2026 13:02:07 +0100 Subject: [PATCH 2/3] refactor: S12.26 uniform typed _Report wrapper + suppression renumber Resolve the cppcheck-misra fallout from the codes-only change: - Add a static inline Xxx_Report(severity, uint16_t category, enum SolidSyslogErrors code) to each class's Private.h; route all 134 emit sites through it. The typed param keeps each per-class error enum tag referenced (deleting the message tables had orphaned them -> MISRA 2.4), static inline avoids 8.7, and the uncast enum->int32_t body (value-preserving, no 10.3) drops the (int32_t) cast from every call site. Supersedes the crypto-only _Report unwind. - Renumber the suppressions shifted by the relocation + emit-site collapse (misra_renumber.py --apply + 8 manual Address-Private.h 11.3 fixes). - Extract CHECK_CATEGORY_TEXT macro in BddTargetErrorTextTest (CodeRabbit). cppcheck-misra full Core+Platform scope exit 0; tidy + format clean; freertos-host all suites green. Co-Authored-By: Claude Opus 4.8 (1M context) --- Core/Source/SolidSyslog.c | 39 ++-- Core/Source/SolidSyslogBlockStorePrivate.h | 14 ++ Core/Source/SolidSyslogBlockStoreStatic.c | 12 +- .../Source/SolidSyslogCircularBufferPrivate.h | 12 ++ Core/Source/SolidSyslogCircularBufferStatic.c | 10 +- .../SolidSyslogFileBlockDevicePrivate.h | 14 ++ .../Source/SolidSyslogFileBlockDeviceStatic.c | 10 +- Core/Source/SolidSyslogMetaSdPrivate.h | 14 ++ Core/Source/SolidSyslogMetaSdStatic.c | 28 +-- Core/Source/SolidSyslogOriginSdPrivate.h | 14 ++ Core/Source/SolidSyslogOriginSdStatic.c | 14 +- .../SolidSyslogPassthroughBufferPrivate.h | 14 ++ .../SolidSyslogPassthroughBufferStatic.c | 15 +- Core/Source/SolidSyslogPrivate.h | 8 + Core/Source/SolidSyslogStatic.c | 15 +- Core/Source/SolidSyslogStreamSenderPrivate.h | 12 ++ Core/Source/SolidSyslogStreamSenderStatic.c | 38 +--- .../SolidSyslogSwitchingSenderPrivate.h | 14 ++ .../Source/SolidSyslogSwitchingSenderStatic.c | 25 +-- Core/Source/SolidSyslogTimeQualitySdPrivate.h | 14 ++ Core/Source/SolidSyslogTimeQualitySdStatic.c | 17 +- Core/Source/SolidSyslogUdpSender.c | 7 +- Core/Source/SolidSyslogUdpSenderPrivate.h | 12 ++ Core/Source/SolidSyslogUdpSenderStatic.c | 45 +--- DEVLOG.md | 41 ++-- .../SolidSyslogStdAtomicCounterPrivate.h | 12 ++ .../SolidSyslogStdAtomicCounterStatic.c | 10 +- .../Source/SolidSyslogFatFsFilePrivate.h | 14 ++ .../FatFs/Source/SolidSyslogFatFsFileStatic.c | 12 +- .../Source/SolidSyslogFreeRtosMutexPrivate.h | 14 ++ .../Source/SolidSyslogFreeRtosMutexStatic.c | 10 +- .../Source/SolidSyslogLwipRawAddressPrivate.h | 14 ++ .../Source/SolidSyslogLwipRawAddressStatic.c | 10 +- .../SolidSyslogLwipRawDatagramPrivate.h | 14 ++ .../Source/SolidSyslogLwipRawDatagramStatic.c | 10 +- .../Source/SolidSyslogLwipRawDnsResolver.c | 5 +- .../SolidSyslogLwipRawDnsResolverPrivate.h | 14 ++ .../SolidSyslogLwipRawDnsResolverStatic.c | 10 +- .../SolidSyslogLwipRawResolverPrivate.h | 14 ++ .../Source/SolidSyslogLwipRawResolverStatic.c | 10 +- .../SolidSyslogLwipRawTcpStreamPrivate.h | 14 ++ .../SolidSyslogLwipRawTcpStreamStatic.c | 10 +- .../Source/SolidSyslogMbedTlsAesGcmPolicy.c | 20 +- .../SolidSyslogMbedTlsAesGcmPolicyPrivate.h | 14 ++ .../SolidSyslogMbedTlsAesGcmPolicyStatic.c | 15 +- .../SolidSyslogMbedTlsHmacSha256Policy.c | 10 +- ...olidSyslogMbedTlsHmacSha256PolicyPrivate.h | 14 ++ ...SolidSyslogMbedTlsHmacSha256PolicyStatic.c | 15 +- .../MbedTls/Source/SolidSyslogMbedTlsStream.c | 25 +-- .../Source/SolidSyslogMbedTlsStreamPrivate.h | 14 ++ .../Source/SolidSyslogMbedTlsStreamStatic.c | 10 +- .../Source/SolidSyslogOpenSslAesGcmPolicy.c | 20 +- .../SolidSyslogOpenSslAesGcmPolicyPrivate.h | 14 ++ .../SolidSyslogOpenSslAesGcmPolicyStatic.c | 15 +- .../SolidSyslogOpenSslHmacSha256Policy.c | 10 +- ...olidSyslogOpenSslHmacSha256PolicyPrivate.h | 14 ++ ...SolidSyslogOpenSslHmacSha256PolicyStatic.c | 15 +- .../OpenSsl/Source/SolidSyslogTlsStream.c | 30 ++- .../Source/SolidSyslogTlsStreamPrivate.h | 14 ++ .../Source/SolidSyslogTlsStreamStatic.c | 12 +- .../Source/SolidSyslogPlusTcpAddressPrivate.h | 14 ++ .../Source/SolidSyslogPlusTcpAddressStatic.c | 10 +- .../SolidSyslogPlusTcpDatagramPrivate.h | 14 ++ .../Source/SolidSyslogPlusTcpDatagramStatic.c | 10 +- .../SolidSyslogPlusTcpResolverPrivate.h | 14 ++ .../Source/SolidSyslogPlusTcpResolverStatic.c | 10 +- .../SolidSyslogPlusTcpTcpStreamPrivate.h | 14 ++ .../SolidSyslogPlusTcpTcpStreamStatic.c | 10 +- .../SolidSyslogGetAddrInfoResolverPrivate.h | 14 ++ .../SolidSyslogGetAddrInfoResolverStatic.c | 10 +- .../Source/SolidSyslogPosixAddressPrivate.h | 13 ++ .../Source/SolidSyslogPosixAddressStatic.c | 10 +- .../Source/SolidSyslogPosixDatagramPrivate.h | 14 ++ .../Source/SolidSyslogPosixDatagramStatic.c | 10 +- .../Source/SolidSyslogPosixFilePrivate.h | 14 ++ .../Posix/Source/SolidSyslogPosixFileStatic.c | 12 +- .../SolidSyslogPosixMessageQueueBuffer.c | 10 +- ...olidSyslogPosixMessageQueueBufferPrivate.h | 14 ++ ...SolidSyslogPosixMessageQueueBufferStatic.c | 15 +- .../Source/SolidSyslogPosixMutexPrivate.h | 14 ++ .../Source/SolidSyslogPosixMutexStatic.c | 12 +- .../Source/SolidSyslogPosixTcpStreamPrivate.h | 14 ++ .../Source/SolidSyslogPosixTcpStreamStatic.c | 10 +- .../SolidSyslogWindowsAtomicCounterPrivate.h | 12 ++ .../SolidSyslogWindowsAtomicCounterStatic.c | 10 +- .../Source/SolidSyslogWindowsFilePrivate.h | 14 ++ .../Source/SolidSyslogWindowsFileStatic.c | 10 +- .../Source/SolidSyslogWindowsMutexPrivate.h | 14 ++ .../Source/SolidSyslogWindowsMutexStatic.c | 10 +- .../Source/SolidSyslogWinsockAddressPrivate.h | 13 ++ .../Source/SolidSyslogWinsockAddressStatic.c | 10 +- .../SolidSyslogWinsockDatagramPrivate.h | 14 ++ .../Source/SolidSyslogWinsockDatagramStatic.c | 10 +- .../SolidSyslogWinsockResolverPrivate.h | 14 ++ .../Source/SolidSyslogWinsockResolverStatic.c | 10 +- .../SolidSyslogWinsockTcpStreamPrivate.h | 14 ++ .../SolidSyslogWinsockTcpStreamStatic.c | 10 +- Tests/Bdd/Targets/BddTargetErrorTextTest.cpp | 33 +-- misra_suppressions.txt | 198 +++++++++--------- 99 files changed, 990 insertions(+), 624 deletions(-) diff --git a/Core/Source/SolidSyslog.c b/Core/Source/SolidSyslog.c index c2ab082b..9de89395 100644 --- a/Core/Source/SolidSyslog.c +++ b/Core/Source/SolidSyslog.c @@ -85,11 +85,10 @@ static void SolidSyslog_InstallBuffer(struct SolidSyslog* self, struct SolidSysl { if (configured == NULL) { - SolidSyslog_Error( + SolidSyslog_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &SolidSyslogErrorSource, SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) SOLIDSYSLOG_ERROR_CREATE_NULL_BUFFER + SOLIDSYSLOG_ERROR_CREATE_NULL_BUFFER ); } else @@ -102,11 +101,10 @@ static void SolidSyslog_InstallSender(struct SolidSyslog* self, struct SolidSysl { if (configured == NULL) { - SolidSyslog_Error( + SolidSyslog_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &SolidSyslogErrorSource, SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) SOLIDSYSLOG_ERROR_CREATE_NULL_SENDER + SOLIDSYSLOG_ERROR_CREATE_NULL_SENDER ); } else @@ -119,12 +117,7 @@ static void SolidSyslog_InstallStore(struct SolidSyslog* self, struct SolidSyslo { if (configured == NULL) { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_ERROR, - &SolidSyslogErrorSource, - SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) SOLIDSYSLOG_ERROR_CREATE_NULL_STORE - ); + SolidSyslog_Report(SOLIDSYSLOG_SEVERITY_ERROR, SOLIDSYSLOG_CAT_BAD_CONFIG, SOLIDSYSLOG_ERROR_CREATE_NULL_STORE); } else { @@ -175,11 +168,10 @@ static void SolidSyslog_InstallStructuredData( /* Inconsistent pairing — the formatter would dereference Sd[i] for * i < SdCount against a NULL array. Report and leave the reset * defaults (no SD) in place so Log() degrades safely. */ - SolidSyslog_Error( + SolidSyslog_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &SolidSyslogErrorSource, SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) SOLIDSYSLOG_ERROR_CREATE_INCONSISTENT_SD + SOLIDSYSLOG_ERROR_CREATE_INCONSISTENT_SD ); } else @@ -193,11 +185,10 @@ void SolidSyslog_Service(struct SolidSyslog* handle) { if (handle == NULL) { - SolidSyslog_Error( + SolidSyslog_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &SolidSyslogErrorSource, SOLIDSYSLOG_CAT_BAD_ARGUMENT, - (int32_t) SOLIDSYSLOG_ERROR_SERVICE_NULL_HANDLE + SOLIDSYSLOG_ERROR_SERVICE_NULL_HANDLE ); } else if (SolidSyslog_IsServiceEnabled(handle)) @@ -260,20 +251,14 @@ void SolidSyslog_Log(struct SolidSyslog* handle, const struct SolidSyslogMessage { if (handle == NULL) { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_ERROR, - &SolidSyslogErrorSource, - SOLIDSYSLOG_CAT_BAD_ARGUMENT, - (int32_t) SOLIDSYSLOG_ERROR_LOG_NULL_HANDLE - ); + SolidSyslog_Report(SOLIDSYSLOG_SEVERITY_ERROR, SOLIDSYSLOG_CAT_BAD_ARGUMENT, SOLIDSYSLOG_ERROR_LOG_NULL_HANDLE); } else if (message == NULL) { - SolidSyslog_Error( + SolidSyslog_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &SolidSyslogErrorSource, SOLIDSYSLOG_CAT_BAD_ARGUMENT, - (int32_t) SOLIDSYSLOG_ERROR_LOG_NULL_MESSAGE + SOLIDSYSLOG_ERROR_LOG_NULL_MESSAGE ); } else diff --git a/Core/Source/SolidSyslogBlockStorePrivate.h b/Core/Source/SolidSyslogBlockStorePrivate.h index b17d8f50..f8b329f3 100644 --- a/Core/Source/SolidSyslogBlockStorePrivate.h +++ b/Core/Source/SolidSyslogBlockStorePrivate.h @@ -1,6 +1,11 @@ #ifndef SOLIDSYSLOGBLOCKSTOREPRIVATE_H #define SOLIDSYSLOGBLOCKSTOREPRIVATE_H +#include + +#include "SolidSyslogBlockStoreErrors.h" +#include "SolidSyslogError.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogStoreDefinition.h" struct RecordStore; @@ -26,4 +31,13 @@ void BlockStore_Initialise( ); void BlockStore_Cleanup(struct SolidSyslogStore* base); +static inline void BlockStore_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogBlockStoreErrors code +) +{ + SolidSyslog_Error(severity, &BlockStoreErrorSource, category, code); +} + #endif /* SOLIDSYSLOGBLOCKSTOREPRIVATE_H */ diff --git a/Core/Source/SolidSyslogBlockStoreStatic.c b/Core/Source/SolidSyslogBlockStoreStatic.c index 993293b5..cba0b28b 100644 --- a/Core/Source/SolidSyslogBlockStoreStatic.c +++ b/Core/Source/SolidSyslogBlockStoreStatic.c @@ -65,12 +65,7 @@ struct SolidSyslogStore* SolidSyslogBlockStore_Create(const struct SolidSyslogBl if (result == SolidSyslogNullStore_Get()) { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_ERROR, - &BlockStoreErrorSource, - SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) BLOCKSTORE_ERROR_POOL_EXHAUSTED - ); + BlockStore_Report(SOLIDSYSLOG_SEVERITY_ERROR, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, BLOCKSTORE_ERROR_POOL_EXHAUSTED); } return result; @@ -137,11 +132,10 @@ void SolidSyslogBlockStore_Destroy(struct SolidSyslogStore* base) if (!released) { - SolidSyslog_Error( + BlockStore_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &BlockStoreErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) BLOCKSTORE_ERROR_UNKNOWN_DESTROY + BLOCKSTORE_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Core/Source/SolidSyslogCircularBufferPrivate.h b/Core/Source/SolidSyslogCircularBufferPrivate.h index e4b59b6f..24d6d2f8 100644 --- a/Core/Source/SolidSyslogCircularBufferPrivate.h +++ b/Core/Source/SolidSyslogCircularBufferPrivate.h @@ -5,6 +5,9 @@ #include #include "SolidSyslogBufferDefinition.h" +#include "SolidSyslogCircularBufferErrors.h" +#include "SolidSyslogError.h" +#include "SolidSyslogPrival.h" struct SolidSyslogMutex; @@ -27,4 +30,13 @@ void CircularBuffer_Initialise( ); void CircularBuffer_Cleanup(struct SolidSyslogBuffer* base); +static inline void CircularBuffer_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogCircularBufferErrors code +) +{ + SolidSyslog_Error(severity, &CircularBufferErrorSource, category, code); +} + #endif /* SOLIDSYSLOGCIRCULARBUFFERPRIVATE_H */ diff --git a/Core/Source/SolidSyslogCircularBufferStatic.c b/Core/Source/SolidSyslogCircularBufferStatic.c index fbb5df20..6e948d39 100644 --- a/Core/Source/SolidSyslogCircularBufferStatic.c +++ b/Core/Source/SolidSyslogCircularBufferStatic.c @@ -41,11 +41,10 @@ struct SolidSyslogBuffer* SolidSyslogCircularBuffer_Create( } else { - SolidSyslog_Error( + CircularBuffer_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &CircularBufferErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) CIRCULARBUFFER_ERROR_POOL_EXHAUSTED + CIRCULARBUFFER_ERROR_POOL_EXHAUSTED ); } return handle; @@ -59,11 +58,10 @@ void SolidSyslogCircularBuffer_Destroy(struct SolidSyslogBuffer* base) SolidSyslogPoolAllocator_FreeIfInUse(&CircularBuffer_Allocator, index, CircularBuffer_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + CircularBuffer_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &CircularBufferErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) CIRCULARBUFFER_ERROR_UNKNOWN_DESTROY + CIRCULARBUFFER_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Core/Source/SolidSyslogFileBlockDevicePrivate.h b/Core/Source/SolidSyslogFileBlockDevicePrivate.h index d1e780a3..c9b59119 100644 --- a/Core/Source/SolidSyslogFileBlockDevicePrivate.h +++ b/Core/Source/SolidSyslogFileBlockDevicePrivate.h @@ -1,10 +1,15 @@ #ifndef SOLIDSYSLOGFILEBLOCKDEVICEPRIVATE_H #define SOLIDSYSLOGFILEBLOCKDEVICEPRIVATE_H +#include + #include #include #include "SolidSyslogBlockDeviceDefinition.h" +#include "SolidSyslogError.h" +#include "SolidSyslogFileBlockDeviceErrors.h" +#include "SolidSyslogPrival.h" struct SolidSyslogFile; @@ -33,4 +38,13 @@ void FileBlockDevice_Initialise( ); void FileBlockDevice_Cleanup(struct SolidSyslogBlockDevice* base); +static inline void FileBlockDevice_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogFileBlockDeviceErrors code +) +{ + SolidSyslog_Error(severity, &FileBlockDeviceErrorSource, category, code); +} + #endif /* SOLIDSYSLOGFILEBLOCKDEVICEPRIVATE_H */ diff --git a/Core/Source/SolidSyslogFileBlockDeviceStatic.c b/Core/Source/SolidSyslogFileBlockDeviceStatic.c index de18c887..3257496c 100644 --- a/Core/Source/SolidSyslogFileBlockDeviceStatic.c +++ b/Core/Source/SolidSyslogFileBlockDeviceStatic.c @@ -37,11 +37,10 @@ struct SolidSyslogBlockDevice* SolidSyslogFileBlockDevice_Create(struct SolidSys } else { - SolidSyslog_Error( + FileBlockDevice_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &FileBlockDeviceErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) FILEBLOCKDEVICE_ERROR_POOL_EXHAUSTED + FILEBLOCKDEVICE_ERROR_POOL_EXHAUSTED ); } return result; @@ -55,11 +54,10 @@ void SolidSyslogFileBlockDevice_Destroy(struct SolidSyslogBlockDevice* base) SolidSyslogPoolAllocator_FreeIfInUse(&FileBlockDevice_Allocator, index, FileBlockDevice_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + FileBlockDevice_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &FileBlockDeviceErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) FILEBLOCKDEVICE_ERROR_UNKNOWN_DESTROY + FILEBLOCKDEVICE_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Core/Source/SolidSyslogMetaSdPrivate.h b/Core/Source/SolidSyslogMetaSdPrivate.h index c7695997..6362cc8d 100644 --- a/Core/Source/SolidSyslogMetaSdPrivate.h +++ b/Core/Source/SolidSyslogMetaSdPrivate.h @@ -1,7 +1,12 @@ #ifndef SOLIDSYSLOGMETASDPRIVATE_H #define SOLIDSYSLOGMETASDPRIVATE_H +#include + +#include "SolidSyslogError.h" #include "SolidSyslogMetaSd.h" +#include "SolidSyslogMetaSdErrors.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogStringFunction.h" #include "SolidSyslogStructuredDataDefinition.h" @@ -18,4 +23,13 @@ struct SolidSyslogMetaSd void MetaSd_Initialise(struct SolidSyslogStructuredData* base, const struct SolidSyslogMetaSdConfig* config); void MetaSd_Cleanup(struct SolidSyslogStructuredData* base); +static inline void MetaSd_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogMetaSdErrors code +) +{ + SolidSyslog_Error(severity, &MetaSdErrorSource, category, code); +} + #endif /* SOLIDSYSLOGMETASDPRIVATE_H */ diff --git a/Core/Source/SolidSyslogMetaSdStatic.c b/Core/Source/SolidSyslogMetaSdStatic.c index 420f5638..7cc26eab 100644 --- a/Core/Source/SolidSyslogMetaSdStatic.c +++ b/Core/Source/SolidSyslogMetaSdStatic.c @@ -36,12 +36,7 @@ struct SolidSyslogStructuredData* SolidSyslogMetaSd_Create(const struct SolidSys } else { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_ERROR, - &MetaSdErrorSource, - SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) METASD_ERROR_POOL_EXHAUSTED - ); + MetaSd_Report(SOLIDSYSLOG_SEVERITY_ERROR, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, METASD_ERROR_POOL_EXHAUSTED); } } return result; @@ -52,21 +47,11 @@ static bool MetaSd_IsValidConfig(const struct SolidSyslogMetaSdConfig* config) bool valid = false; if (config == NULL) { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_WARNING, - &MetaSdErrorSource, - SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) METASD_ERROR_NULL_CONFIG - ); + MetaSd_Report(SOLIDSYSLOG_SEVERITY_WARNING, SOLIDSYSLOG_CAT_BAD_CONFIG, METASD_ERROR_NULL_CONFIG); } else if (config->Counter == NULL) { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_WARNING, - &MetaSdErrorSource, - SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) METASD_ERROR_NULL_COUNTER - ); + MetaSd_Report(SOLIDSYSLOG_SEVERITY_WARNING, SOLIDSYSLOG_CAT_BAD_CONFIG, METASD_ERROR_NULL_COUNTER); } else { @@ -82,12 +67,7 @@ void SolidSyslogMetaSd_Destroy(struct SolidSyslogStructuredData* base) SolidSyslogPoolAllocator_FreeIfInUse(&MetaSd_Allocator, index, MetaSd_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_WARNING, - &MetaSdErrorSource, - SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) METASD_ERROR_UNKNOWN_DESTROY - ); + MetaSd_Report(SOLIDSYSLOG_SEVERITY_WARNING, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, METASD_ERROR_UNKNOWN_DESTROY); } } diff --git a/Core/Source/SolidSyslogOriginSdPrivate.h b/Core/Source/SolidSyslogOriginSdPrivate.h index be90f6dc..78ef3308 100644 --- a/Core/Source/SolidSyslogOriginSdPrivate.h +++ b/Core/Source/SolidSyslogOriginSdPrivate.h @@ -1,8 +1,13 @@ #ifndef SOLIDSYSLOGORIGINSDPRIVATE_H #define SOLIDSYSLOGORIGINSDPRIVATE_H +#include + +#include "SolidSyslogError.h" #include "SolidSyslogFormatter.h" #include "SolidSyslogOriginSd.h" +#include "SolidSyslogOriginSdErrors.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogStructuredDataDefinition.h" enum @@ -30,4 +35,13 @@ struct SolidSyslogOriginSd void OriginSd_Initialise(struct SolidSyslogStructuredData* base, const struct SolidSyslogOriginSdConfig* config); void OriginSd_Cleanup(struct SolidSyslogStructuredData* base); +static inline void OriginSd_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogOriginSdErrors code +) +{ + SolidSyslog_Error(severity, &OriginSdErrorSource, category, code); +} + #endif /* SOLIDSYSLOGORIGINSDPRIVATE_H */ diff --git a/Core/Source/SolidSyslogOriginSdStatic.c b/Core/Source/SolidSyslogOriginSdStatic.c index 054cb5bc..cb9ccc00 100644 --- a/Core/Source/SolidSyslogOriginSdStatic.c +++ b/Core/Source/SolidSyslogOriginSdStatic.c @@ -33,12 +33,7 @@ struct SolidSyslogStructuredData* SolidSyslogOriginSd_Create(const struct SolidS } else { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_ERROR, - &OriginSdErrorSource, - SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) ORIGINSD_ERROR_POOL_EXHAUSTED - ); + OriginSd_Report(SOLIDSYSLOG_SEVERITY_ERROR, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, ORIGINSD_ERROR_POOL_EXHAUSTED); } return handle; } @@ -50,12 +45,7 @@ void SolidSyslogOriginSd_Destroy(struct SolidSyslogStructuredData* base) SolidSyslogPoolAllocator_FreeIfInUse(&OriginSd_Allocator, index, OriginSd_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_WARNING, - &OriginSdErrorSource, - SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) ORIGINSD_ERROR_UNKNOWN_DESTROY - ); + OriginSd_Report(SOLIDSYSLOG_SEVERITY_WARNING, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, ORIGINSD_ERROR_UNKNOWN_DESTROY); } } diff --git a/Core/Source/SolidSyslogPassthroughBufferPrivate.h b/Core/Source/SolidSyslogPassthroughBufferPrivate.h index 5cb8fdb7..274982b0 100644 --- a/Core/Source/SolidSyslogPassthroughBufferPrivate.h +++ b/Core/Source/SolidSyslogPassthroughBufferPrivate.h @@ -1,7 +1,12 @@ #ifndef SOLIDSYSLOGPASSTHROUGHBUFFERPRIVATE_H #define SOLIDSYSLOGPASSTHROUGHBUFFERPRIVATE_H +#include + #include "SolidSyslogBufferDefinition.h" +#include "SolidSyslogError.h" +#include "SolidSyslogPassthroughBufferErrors.h" +#include "SolidSyslogPrival.h" struct SolidSyslogSender; @@ -14,4 +19,13 @@ struct SolidSyslogPassthroughBuffer void PassthroughBuffer_Initialise(struct SolidSyslogBuffer* base, struct SolidSyslogSender* sender); void PassthroughBuffer_Cleanup(struct SolidSyslogBuffer* base); +static inline void PassthroughBuffer_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogPassthroughBufferErrors code +) +{ + SolidSyslog_Error(severity, &PassthroughBufferErrorSource, category, code); +} + #endif /* SOLIDSYSLOGPASSTHROUGHBUFFERPRIVATE_H */ diff --git a/Core/Source/SolidSyslogPassthroughBufferStatic.c b/Core/Source/SolidSyslogPassthroughBufferStatic.c index 59d32d65..18f4f9f6 100644 --- a/Core/Source/SolidSyslogPassthroughBufferStatic.c +++ b/Core/Source/SolidSyslogPassthroughBufferStatic.c @@ -31,11 +31,10 @@ struct SolidSyslogBuffer* SolidSyslogPassthroughBuffer_Create(struct SolidSyslog struct SolidSyslogBuffer* handle = SolidSyslogNullBuffer_Get(); if (sender == NULL) { - SolidSyslog_Error( + PassthroughBuffer_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &PassthroughBufferErrorSource, SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) PASSTHROUGHBUFFER_ERROR_NULL_SENDER + PASSTHROUGHBUFFER_ERROR_NULL_SENDER ); } else @@ -48,11 +47,10 @@ struct SolidSyslogBuffer* SolidSyslogPassthroughBuffer_Create(struct SolidSyslog } else { - SolidSyslog_Error( + PassthroughBuffer_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &PassthroughBufferErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) PASSTHROUGHBUFFER_ERROR_POOL_EXHAUSTED + PASSTHROUGHBUFFER_ERROR_POOL_EXHAUSTED ); } } @@ -71,11 +69,10 @@ void SolidSyslogPassthroughBuffer_Destroy(struct SolidSyslogBuffer* base) ); if (!released) { - SolidSyslog_Error( + PassthroughBuffer_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &PassthroughBufferErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) PASSTHROUGHBUFFER_ERROR_UNKNOWN_DESTROY + PASSTHROUGHBUFFER_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Core/Source/SolidSyslogPrivate.h b/Core/Source/SolidSyslogPrivate.h index b41037bc..43c1c79c 100644 --- a/Core/Source/SolidSyslogPrivate.h +++ b/Core/Source/SolidSyslogPrivate.h @@ -1,7 +1,10 @@ #ifndef SOLIDSYSLOGPRIVATE_H #define SOLIDSYSLOGPRIVATE_H +#include "SolidSyslogError.h" +#include "SolidSyslogErrors.h" #include "SolidSyslogMessageFormatter.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogTimestamp.h" struct SolidSyslogBuffer; @@ -28,4 +31,9 @@ void SolidSyslog_Cleanup(struct SolidSyslog* self); void SolidSyslog_NullClock(struct SolidSyslogTimestamp* ts); void SolidSyslog_NullStringFunction(struct SolidSyslogFormatter* formatter); +static inline void SolidSyslog_Report(enum SolidSyslogSeverity severity, uint16_t category, enum SolidSyslogErrors code) +{ + SolidSyslog_Error(severity, &SolidSyslogErrorSource, category, code); +} + #endif /* SOLIDSYSLOGPRIVATE_H */ diff --git a/Core/Source/SolidSyslogStatic.c b/Core/Source/SolidSyslogStatic.c index 9b248b19..7b71d391 100644 --- a/Core/Source/SolidSyslogStatic.c +++ b/Core/Source/SolidSyslogStatic.c @@ -37,11 +37,10 @@ struct SolidSyslog* SolidSyslog_Create(const struct SolidSyslogConfig* config) struct SolidSyslog* result = &SolidSyslog_NullInstance; if (config == NULL) { - SolidSyslog_Error( + SolidSyslog_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &SolidSyslogErrorSource, SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) SOLIDSYSLOG_ERROR_CREATE_NULL_CONFIG + SOLIDSYSLOG_ERROR_CREATE_NULL_CONFIG ); } else @@ -54,11 +53,10 @@ struct SolidSyslog* SolidSyslog_Create(const struct SolidSyslogConfig* config) } else { - SolidSyslog_Error( + SolidSyslog_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &SolidSyslogErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) SOLIDSYSLOG_ERROR_POOL_EXHAUSTED + SOLIDSYSLOG_ERROR_POOL_EXHAUSTED ); } } @@ -91,11 +89,10 @@ void SolidSyslog_Destroy(struct SolidSyslog* handle) SolidSyslogPoolAllocator_FreeIfInUse(&SolidSyslog_Allocator, index, SolidSyslog_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + SolidSyslog_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &SolidSyslogErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) SOLIDSYSLOG_ERROR_UNKNOWN_DESTROY + SOLIDSYSLOG_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Core/Source/SolidSyslogStreamSenderPrivate.h b/Core/Source/SolidSyslogStreamSenderPrivate.h index d502eb2f..5c14bb29 100644 --- a/Core/Source/SolidSyslogStreamSenderPrivate.h +++ b/Core/Source/SolidSyslogStreamSenderPrivate.h @@ -4,8 +4,11 @@ #include #include +#include "SolidSyslogError.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogSenderDefinition.h" #include "SolidSyslogStreamSender.h" +#include "SolidSyslogStreamSenderErrors.h" struct SolidSyslogStreamSender { @@ -18,4 +21,13 @@ struct SolidSyslogStreamSender void StreamSender_Initialise(struct SolidSyslogSender* base, const struct SolidSyslogStreamSenderConfig* config); void StreamSender_Cleanup(struct SolidSyslogSender* base); +static inline void StreamSender_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogStreamSenderErrors code +) +{ + SolidSyslog_Error(severity, &StreamSenderErrorSource, category, code); +} + #endif /* SOLIDSYSLOGSTREAMSENDERPRIVATE_H */ diff --git a/Core/Source/SolidSyslogStreamSenderStatic.c b/Core/Source/SolidSyslogStreamSenderStatic.c index 882c5667..95e19115 100644 --- a/Core/Source/SolidSyslogStreamSenderStatic.c +++ b/Core/Source/SolidSyslogStreamSenderStatic.c @@ -39,11 +39,10 @@ struct SolidSyslogSender* SolidSyslogStreamSender_Create(const struct SolidSyslo } else { - SolidSyslog_Error( + StreamSender_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &StreamSenderErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) STREAMSENDER_ERROR_POOL_EXHAUSTED + STREAMSENDER_ERROR_POOL_EXHAUSTED ); } } @@ -55,39 +54,19 @@ static bool StreamSender_IsValidConfig(const struct SolidSyslogStreamSenderConfi bool valid = false; if (config == NULL) { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_ERROR, - &StreamSenderErrorSource, - SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) STREAMSENDER_ERROR_NULL_CONFIG - ); + StreamSender_Report(SOLIDSYSLOG_SEVERITY_ERROR, SOLIDSYSLOG_CAT_BAD_CONFIG, STREAMSENDER_ERROR_NULL_CONFIG); } else if (config->Resolver == NULL) { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_ERROR, - &StreamSenderErrorSource, - SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) STREAMSENDER_ERROR_NULL_RESOLVER - ); + StreamSender_Report(SOLIDSYSLOG_SEVERITY_ERROR, SOLIDSYSLOG_CAT_BAD_CONFIG, STREAMSENDER_ERROR_NULL_RESOLVER); } else if (config->Stream == NULL) { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_ERROR, - &StreamSenderErrorSource, - SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) STREAMSENDER_ERROR_NULL_STREAM - ); + StreamSender_Report(SOLIDSYSLOG_SEVERITY_ERROR, SOLIDSYSLOG_CAT_BAD_CONFIG, STREAMSENDER_ERROR_NULL_STREAM); } else if (config->Address == NULL) { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_ERROR, - &StreamSenderErrorSource, - SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) STREAMSENDER_ERROR_NULL_ADDRESS - ); + StreamSender_Report(SOLIDSYSLOG_SEVERITY_ERROR, SOLIDSYSLOG_CAT_BAD_CONFIG, STREAMSENDER_ERROR_NULL_ADDRESS); } else { @@ -104,11 +83,10 @@ void SolidSyslogStreamSender_Destroy(struct SolidSyslogSender* base) SolidSyslogPoolAllocator_FreeIfInUse(&StreamSender_Allocator, index, StreamSender_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + StreamSender_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &StreamSenderErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) STREAMSENDER_ERROR_UNKNOWN_DESTROY + STREAMSENDER_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Core/Source/SolidSyslogSwitchingSenderPrivate.h b/Core/Source/SolidSyslogSwitchingSenderPrivate.h index 2319284d..b2fd4c40 100644 --- a/Core/Source/SolidSyslogSwitchingSenderPrivate.h +++ b/Core/Source/SolidSyslogSwitchingSenderPrivate.h @@ -1,8 +1,13 @@ #ifndef SOLIDSYSLOGSWITCHINGSENDERPRIVATE_H #define SOLIDSYSLOGSWITCHINGSENDERPRIVATE_H +#include + +#include "SolidSyslogError.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogSenderDefinition.h" #include "SolidSyslogSwitchingSender.h" +#include "SolidSyslogSwitchingSenderErrors.h" struct SolidSyslogSwitchingSender { @@ -14,4 +19,13 @@ struct SolidSyslogSwitchingSender void SwitchingSender_Initialise(struct SolidSyslogSender* base, const struct SolidSyslogSwitchingSenderConfig* config); void SwitchingSender_Cleanup(struct SolidSyslogSender* base); +static inline void SwitchingSender_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogSwitchingSenderErrors code +) +{ + SolidSyslog_Error(severity, &SwitchingSenderErrorSource, category, code); +} + #endif /* SOLIDSYSLOGSWITCHINGSENDERPRIVATE_H */ diff --git a/Core/Source/SolidSyslogSwitchingSenderStatic.c b/Core/Source/SolidSyslogSwitchingSenderStatic.c index b01cd7a2..b5b21727 100644 --- a/Core/Source/SolidSyslogSwitchingSenderStatic.c +++ b/Core/Source/SolidSyslogSwitchingSenderStatic.c @@ -39,11 +39,10 @@ struct SolidSyslogSender* SolidSyslogSwitchingSender_Create(const struct SolidSy } else { - SolidSyslog_Error( + SwitchingSender_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &SwitchingSenderErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) SWITCHINGSENDER_ERROR_POOL_EXHAUSTED + SWITCHINGSENDER_ERROR_POOL_EXHAUSTED ); } } @@ -55,29 +54,26 @@ static bool SwitchingSender_IsValidConfig(const struct SolidSyslogSwitchingSende bool valid = false; if (config == NULL) { - SolidSyslog_Error( + SwitchingSender_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &SwitchingSenderErrorSource, SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) SWITCHINGSENDER_ERROR_NULL_CONFIG + SWITCHINGSENDER_ERROR_NULL_CONFIG ); } else if (config->Senders == NULL) { - SolidSyslog_Error( + SwitchingSender_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &SwitchingSenderErrorSource, SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) SWITCHINGSENDER_ERROR_NULL_SENDERS + SWITCHINGSENDER_ERROR_NULL_SENDERS ); } else if (config->Selector == NULL) { - SolidSyslog_Error( + SwitchingSender_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &SwitchingSenderErrorSource, SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) SWITCHINGSENDER_ERROR_NULL_SELECTOR + SWITCHINGSENDER_ERROR_NULL_SELECTOR ); } else @@ -95,11 +91,10 @@ void SolidSyslogSwitchingSender_Destroy(struct SolidSyslogSender* base) SolidSyslogPoolAllocator_FreeIfInUse(&SwitchingSender_Allocator, index, SwitchingSender_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + SwitchingSender_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &SwitchingSenderErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) SWITCHINGSENDER_ERROR_UNKNOWN_DESTROY + SWITCHINGSENDER_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Core/Source/SolidSyslogTimeQualitySdPrivate.h b/Core/Source/SolidSyslogTimeQualitySdPrivate.h index 5f318057..44a3c606 100644 --- a/Core/Source/SolidSyslogTimeQualitySdPrivate.h +++ b/Core/Source/SolidSyslogTimeQualitySdPrivate.h @@ -1,8 +1,13 @@ #ifndef SOLIDSYSLOGTIMEQUALITYSDPRIVATE_H #define SOLIDSYSLOGTIMEQUALITYSDPRIVATE_H +#include + +#include "SolidSyslogError.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogStructuredDataDefinition.h" #include "SolidSyslogTimeQuality.h" +#include "SolidSyslogTimeQualitySdErrors.h" struct SolidSyslogTimeQualitySd { @@ -13,4 +18,13 @@ struct SolidSyslogTimeQualitySd void TimeQualitySd_Initialise(struct SolidSyslogStructuredData* base, SolidSyslogTimeQualityFunction getTimeQuality); void TimeQualitySd_Cleanup(struct SolidSyslogStructuredData* base); +static inline void TimeQualitySd_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogTimeQualitySdErrors code +) +{ + SolidSyslog_Error(severity, &TimeQualitySdErrorSource, category, code); +} + #endif /* SOLIDSYSLOGTIMEQUALITYSDPRIVATE_H */ diff --git a/Core/Source/SolidSyslogTimeQualitySdStatic.c b/Core/Source/SolidSyslogTimeQualitySdStatic.c index a48616ae..deb455f5 100644 --- a/Core/Source/SolidSyslogTimeQualitySdStatic.c +++ b/Core/Source/SolidSyslogTimeQualitySdStatic.c @@ -31,12 +31,7 @@ struct SolidSyslogStructuredData* SolidSyslogTimeQualitySd_Create(SolidSyslogTim struct SolidSyslogStructuredData* handle = SolidSyslogNullSd_Get(); if (getTimeQuality == NULL) { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_ERROR, - &TimeQualitySdErrorSource, - SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) TIMEQUALITYSD_ERROR_NULL_CALLBACK - ); + TimeQualitySd_Report(SOLIDSYSLOG_SEVERITY_ERROR, SOLIDSYSLOG_CAT_BAD_CONFIG, TIMEQUALITYSD_ERROR_NULL_CALLBACK); } else { @@ -48,11 +43,10 @@ struct SolidSyslogStructuredData* SolidSyslogTimeQualitySd_Create(SolidSyslogTim } else { - SolidSyslog_Error( + TimeQualitySd_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &TimeQualitySdErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) TIMEQUALITYSD_ERROR_POOL_EXHAUSTED + TIMEQUALITYSD_ERROR_POOL_EXHAUSTED ); } } @@ -67,11 +61,10 @@ void SolidSyslogTimeQualitySd_Destroy(struct SolidSyslogStructuredData* base) SolidSyslogPoolAllocator_FreeIfInUse(&TimeQualitySd_Allocator, index, TimeQualitySd_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + TimeQualitySd_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &TimeQualitySdErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) TIMEQUALITYSD_ERROR_UNKNOWN_DESTROY + TIMEQUALITYSD_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Core/Source/SolidSyslogUdpSender.c b/Core/Source/SolidSyslogUdpSender.c index 65e2daf1..5e62322a 100644 --- a/Core/Source/SolidSyslogUdpSender.c +++ b/Core/Source/SolidSyslogUdpSender.c @@ -75,12 +75,7 @@ static bool UdpSender_Send(struct SolidSyslogSender* base, const void* buffer, s bool result = false; if (buffer == NULL) { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_ERROR, - &UdpSenderErrorSource, - SOLIDSYSLOG_CAT_BAD_ARGUMENT, - (int32_t) UDPSENDER_ERROR_SEND_NULL_BUFFER - ); + UdpSender_Report(SOLIDSYSLOG_SEVERITY_ERROR, SOLIDSYSLOG_CAT_BAD_ARGUMENT, UDPSENDER_ERROR_SEND_NULL_BUFFER); } else { diff --git a/Core/Source/SolidSyslogUdpSenderPrivate.h b/Core/Source/SolidSyslogUdpSenderPrivate.h index 84bc4418..54de8800 100644 --- a/Core/Source/SolidSyslogUdpSenderPrivate.h +++ b/Core/Source/SolidSyslogUdpSenderPrivate.h @@ -4,8 +4,11 @@ #include #include +#include "SolidSyslogError.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogSenderDefinition.h" #include "SolidSyslogUdpSender.h" +#include "SolidSyslogUdpSenderErrors.h" struct SolidSyslogUdpSender { @@ -18,4 +21,13 @@ struct SolidSyslogUdpSender void UdpSender_Initialise(struct SolidSyslogSender* base, const struct SolidSyslogUdpSenderConfig* config); void UdpSender_Cleanup(struct SolidSyslogSender* base); +static inline void UdpSender_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogUdpSenderErrors code +) +{ + SolidSyslog_Error(severity, &UdpSenderErrorSource, category, code); +} + #endif /* SOLIDSYSLOGUDPSENDERPRIVATE_H */ diff --git a/Core/Source/SolidSyslogUdpSenderStatic.c b/Core/Source/SolidSyslogUdpSenderStatic.c index cb2d1d8a..e1ee5b32 100644 --- a/Core/Source/SolidSyslogUdpSenderStatic.c +++ b/Core/Source/SolidSyslogUdpSenderStatic.c @@ -36,11 +36,10 @@ struct SolidSyslogSender* SolidSyslogUdpSender_Create(const struct SolidSyslogUd } else { - SolidSyslog_Error( + UdpSender_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &UdpSenderErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) UDPSENDER_ERROR_POOL_EXHAUSTED + UDPSENDER_ERROR_POOL_EXHAUSTED ); } } @@ -52,48 +51,23 @@ static bool UdpSender_IsValidConfig(const struct SolidSyslogUdpSenderConfig* con bool valid = false; if (config == NULL) { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_ERROR, - &UdpSenderErrorSource, - SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) UDPSENDER_ERROR_NULL_CONFIG - ); + UdpSender_Report(SOLIDSYSLOG_SEVERITY_ERROR, SOLIDSYSLOG_CAT_BAD_CONFIG, UDPSENDER_ERROR_NULL_CONFIG); } else if (config->Resolver == NULL) { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_ERROR, - &UdpSenderErrorSource, - SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) UDPSENDER_ERROR_NULL_RESOLVER - ); + UdpSender_Report(SOLIDSYSLOG_SEVERITY_ERROR, SOLIDSYSLOG_CAT_BAD_CONFIG, UDPSENDER_ERROR_NULL_RESOLVER); } else if (config->Datagram == NULL) { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_ERROR, - &UdpSenderErrorSource, - SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) UDPSENDER_ERROR_NULL_DATAGRAM - ); + UdpSender_Report(SOLIDSYSLOG_SEVERITY_ERROR, SOLIDSYSLOG_CAT_BAD_CONFIG, UDPSENDER_ERROR_NULL_DATAGRAM); } else if (config->Address == NULL) { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_ERROR, - &UdpSenderErrorSource, - SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) UDPSENDER_ERROR_NULL_ADDRESS - ); + UdpSender_Report(SOLIDSYSLOG_SEVERITY_ERROR, SOLIDSYSLOG_CAT_BAD_CONFIG, UDPSENDER_ERROR_NULL_ADDRESS); } else if (config->Endpoint == NULL) { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_ERROR, - &UdpSenderErrorSource, - SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) UDPSENDER_ERROR_NULL_ENDPOINT - ); + UdpSender_Report(SOLIDSYSLOG_SEVERITY_ERROR, SOLIDSYSLOG_CAT_BAD_CONFIG, UDPSENDER_ERROR_NULL_ENDPOINT); } else { @@ -109,11 +83,10 @@ void SolidSyslogUdpSender_Destroy(struct SolidSyslogSender* base) SolidSyslogPoolAllocator_FreeIfInUse(&UdpSender_Allocator, index, UdpSender_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + UdpSender_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &UdpSenderErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) UDPSENDER_ERROR_UNKNOWN_DESTROY + UDPSENDER_ERROR_UNKNOWN_DESTROY ); } } diff --git a/DEVLOG.md b/DEVLOG.md index 4654527a..9c6d0560 100644 --- a/DEVLOG.md +++ b/DEVLOG.md @@ -36,18 +36,27 @@ string table — are deleted. `struct SolidSyslogErrorSource` slims to error identity is allocation-agnostic; `Static.c` is the static-allocation TU (a future `Dynamic.c` would emit the same source). Each `Xxx.c` gains `SolidSyslogError.h` + its `*Errors.h` (MISRA 8.4). -- **`_Report` wrapper unwound.** The 4 crypto-policy classes were the only ones - routing emission through an `Xxx_Report(sev, cat, code)` indirection; inlined - all 24 call sites to the direct `SolidSyslog_Error(...)` the other 39 use, so - they're uniform. A *uniform* wrapper, if ever wanted, is a clean separate - refactor. -- **D.014 (MISRA 8.7) retired.** It existed because `_Report` confined each - crypto source's use to one TU; the unwind makes them cross-TU referenced like - every other source. cppcheck-misra reports no 8.7; the 4 suppressions and the - deviation are gone (tombstoned). -- **Validation:** gcc + clang `1391` tests; freertos-host all platform suites +- **Uniform typed `_Report` emit wrapper.** Each class gets a `static inline + Xxx_Report(severity, uint16_t category, enum SolidSyslogErrors code)` in + its `Private.h`; all 134 emit sites call it instead of `SolidSyslog_Error` + directly. Three problems fall out at once: the typed `code` parameter keeps + each per-class error enum's *tag* referenced (deleting the message tables had + orphaned them — MISRA 2.4 ×43), `static inline` gives internal linkage (no + 8.7), and the body passes `code` to the `int32_t` detail param **uncast** — + enum→int32 is value-preserving (both signed, `int32_t` wide enough) and does + not trip essential-type 10.3 — so the `(int32_t)` cast disappears from every + call site. This *supersedes* an earlier crypto-only `_Report` unwind: the 2.4 + fallout forced the uniformly-wrapped direction, which is the better end-state + (MISRA-clean tags, cast-free call sites, no suppressions). A *separate* report + fn can be added later if a future site needs a non-enum detail. +- **D.014 (MISRA 8.7) retired.** It existed because the crypto-policy source + symbols were referenced from a single TU; relocation + the wrapper make every + source cross-TU referenced. cppcheck-misra reports no 8.7; the 4 suppressions + and the deviation are gone (tombstoned). +- **Validation:** gcc + clang full unit suites; freertos-host all platform suites (FreeRtos/Lwip/MbedTls/FatFs); both FreeRTOS cross BDD ELFs built; clang-tidy, - clang-format, cppcheck-misra all clean. Windows/MSVC left to CI. + clang-format, and cppcheck-misra (full Core+Platform scope, suppressions + renumbered) all clean. Windows/MSVC left to CI; IWYU is advisory. ### Deferred @@ -66,10 +75,12 @@ string table — are deleted. `struct SolidSyslogErrorSource` slims to ### Open questions -- CI to confirm Windows/MSVC and the exact cppcheck / freertos-analysis lane - scoping. `misra_renumber.py` bails `AMBIGUOUS` (new 2.4 *analysis* findings on - now-unused enum tags confuse its count-matching), but the actual cppcheck-misra - gate is green, so nothing is gate-failing to renumber. +- CI to confirm Windows/MSVC (the only tree not built locally). The first CI run + failed `analyze-cppcheck` on stale suppression lines (the relocation + + emit-site collapse shifted ~90 sites) plus the 43 new 2.4 findings; resolved by + the uniform wrapper (2.4) + `misra_renumber.py --apply` and a manual fix of 8 + Address-`Private.h` 11.3 lines the script left `AMBIGUOUS` (11.2/11.3 coincide + on the same line). Gate now exit 0 in full scope. ## 2026-06-01 — S12.24 Report inconsistent SD config diff --git a/Platform/Atomics/Source/SolidSyslogStdAtomicCounterPrivate.h b/Platform/Atomics/Source/SolidSyslogStdAtomicCounterPrivate.h index 716d4f77..479c83d6 100644 --- a/Platform/Atomics/Source/SolidSyslogStdAtomicCounterPrivate.h +++ b/Platform/Atomics/Source/SolidSyslogStdAtomicCounterPrivate.h @@ -5,6 +5,9 @@ #include #include "SolidSyslogAtomicCounterDefinition.h" +#include "SolidSyslogError.h" +#include "SolidSyslogPrival.h" +#include "SolidSyslogStdAtomicCounterErrors.h" struct SolidSyslogStdAtomicCounter { @@ -15,4 +18,13 @@ struct SolidSyslogStdAtomicCounter void StdAtomicCounter_Initialise(struct SolidSyslogAtomicCounter* base); void StdAtomicCounter_Cleanup(struct SolidSyslogAtomicCounter* base); +static inline void StdAtomicCounter_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogStdAtomicCounterErrors code +) +{ + SolidSyslog_Error(severity, &StdAtomicCounterErrorSource, category, code); +} + #endif /* SOLIDSYSLOGSTDATOMICCOUNTERPRIVATE_H */ diff --git a/Platform/Atomics/Source/SolidSyslogStdAtomicCounterStatic.c b/Platform/Atomics/Source/SolidSyslogStdAtomicCounterStatic.c index 1fd29dd0..85bf1af2 100644 --- a/Platform/Atomics/Source/SolidSyslogStdAtomicCounterStatic.c +++ b/Platform/Atomics/Source/SolidSyslogStdAtomicCounterStatic.c @@ -36,11 +36,10 @@ struct SolidSyslogAtomicCounter* SolidSyslogStdAtomicCounter_Create(void) } else { - SolidSyslog_Error( + StdAtomicCounter_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &StdAtomicCounterErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) STDATOMICCOUNTER_ERROR_POOL_EXHAUSTED + STDATOMICCOUNTER_ERROR_POOL_EXHAUSTED ); } return handle; @@ -54,11 +53,10 @@ void SolidSyslogStdAtomicCounter_Destroy(struct SolidSyslogAtomicCounter* base) SolidSyslogPoolAllocator_FreeIfInUse(&StdAtomicCounter_Allocator, index, StdAtomicCounter_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + StdAtomicCounter_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &StdAtomicCounterErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) STDATOMICCOUNTER_ERROR_UNKNOWN_DESTROY + STDATOMICCOUNTER_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/FatFs/Source/SolidSyslogFatFsFilePrivate.h b/Platform/FatFs/Source/SolidSyslogFatFsFilePrivate.h index 954a95b3..c9c24d03 100644 --- a/Platform/FatFs/Source/SolidSyslogFatFsFilePrivate.h +++ b/Platform/FatFs/Source/SolidSyslogFatFsFilePrivate.h @@ -1,9 +1,14 @@ #ifndef SOLIDSYSLOGFATFSFILEPRIVATE_H #define SOLIDSYSLOGFATFSFILEPRIVATE_H +#include + #include +#include "SolidSyslogError.h" +#include "SolidSyslogFatFsFileErrors.h" #include "SolidSyslogFileDefinition.h" +#include "SolidSyslogPrival.h" #include "ff.h" struct SolidSyslogFatFsFile @@ -16,4 +21,13 @@ struct SolidSyslogFatFsFile void FatFsFile_Initialise(struct SolidSyslogFile* base); void FatFsFile_Cleanup(struct SolidSyslogFile* base); +static inline void FatFsFile_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogFatFsFileErrors code +) +{ + SolidSyslog_Error(severity, &FatFsFileErrorSource, category, code); +} + #endif /* SOLIDSYSLOGFATFSFILEPRIVATE_H */ diff --git a/Platform/FatFs/Source/SolidSyslogFatFsFileStatic.c b/Platform/FatFs/Source/SolidSyslogFatFsFileStatic.c index a07c4a8d..7dced55a 100644 --- a/Platform/FatFs/Source/SolidSyslogFatFsFileStatic.c +++ b/Platform/FatFs/Source/SolidSyslogFatFsFileStatic.c @@ -33,12 +33,7 @@ struct SolidSyslogFile* SolidSyslogFatFsFile_Create(void) } else { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_ERROR, - &FatFsFileErrorSource, - SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) FATFSFILE_ERROR_POOL_EXHAUSTED - ); + FatFsFile_Report(SOLIDSYSLOG_SEVERITY_ERROR, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, FATFSFILE_ERROR_POOL_EXHAUSTED); } return handle; } @@ -50,11 +45,10 @@ void SolidSyslogFatFsFile_Destroy(struct SolidSyslogFile* base) SolidSyslogPoolAllocator_FreeIfInUse(&FatFsFile_Allocator, index, FatFsFile_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + FatFsFile_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &FatFsFileErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) FATFSFILE_ERROR_UNKNOWN_DESTROY + FATFSFILE_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexPrivate.h b/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexPrivate.h index a1226698..9c6519b5 100644 --- a/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexPrivate.h +++ b/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexPrivate.h @@ -1,6 +1,11 @@ #ifndef SOLIDSYSLOGFREERTOSMUTEXPRIVATE_H #define SOLIDSYSLOGFREERTOSMUTEXPRIVATE_H +#include +#include "SolidSyslogError.h" +#include "SolidSyslogPrival.h" +#include "SolidSyslogFreeRtosMutexErrors.h" + #include "FreeRTOS.h" #include "semphr.h" @@ -19,4 +24,13 @@ struct SolidSyslogFreeRtosMutex void FreeRtosMutex_Initialise(struct SolidSyslogMutex* base); void FreeRtosMutex_Cleanup(struct SolidSyslogMutex* base); +static inline void FreeRtosMutex_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogFreeRtosMutexErrors code +) +{ + SolidSyslog_Error(severity, &FreeRtosMutexErrorSource, category, code); +} + #endif /* SOLIDSYSLOGFREERTOSMUTEXPRIVATE_H */ diff --git a/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexStatic.c b/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexStatic.c index 2f36bc7b..c7a33d06 100644 --- a/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexStatic.c +++ b/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexStatic.c @@ -33,11 +33,10 @@ struct SolidSyslogMutex* SolidSyslogFreeRtosMutex_Create(void) } else { - SolidSyslog_Error( + FreeRtosMutex_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &FreeRtosMutexErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) FREERTOSMUTEX_ERROR_POOL_EXHAUSTED + FREERTOSMUTEX_ERROR_POOL_EXHAUSTED ); } return handle; @@ -51,11 +50,10 @@ void SolidSyslogFreeRtosMutex_Destroy(struct SolidSyslogMutex* base) SolidSyslogPoolAllocator_FreeIfInUse(&FreeRtosMutex_Allocator, index, FreeRtosMutex_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + FreeRtosMutex_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &FreeRtosMutexErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) FREERTOSMUTEX_ERROR_UNKNOWN_DESTROY + FREERTOSMUTEX_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressPrivate.h b/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressPrivate.h index dee3fc5b..0f418cec 100644 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressPrivate.h +++ b/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressPrivate.h @@ -1,6 +1,11 @@ #ifndef SOLIDSYSLOGLWIPRAWADDRESSPRIVATE_H #define SOLIDSYSLOGLWIPRAWADDRESSPRIVATE_H +#include + +#include "SolidSyslogError.h" +#include "SolidSyslogLwipRawAddressErrors.h" +#include "SolidSyslogPrival.h" #include "lwip/ip_addr.h" struct SolidSyslogAddress; @@ -31,4 +36,13 @@ static inline const struct SolidSyslogLwipRawAddress* SolidSyslogLwipRawAddress_ return (const struct SolidSyslogLwipRawAddress*) base; } +static inline void LwipRawAddress_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogLwipRawAddressErrors code +) +{ + SolidSyslog_Error(severity, &LwipRawAddressErrorSource, category, code); +} + #endif /* SOLIDSYSLOGLWIPRAWADDRESSPRIVATE_H */ diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressStatic.c b/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressStatic.c index b1f47d47..db4eb070 100644 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressStatic.c +++ b/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressStatic.c @@ -40,11 +40,10 @@ struct SolidSyslogAddress* SolidSyslogLwipRawAddress_Create(void) } else { - SolidSyslog_Error( + LwipRawAddress_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &LwipRawAddressErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) LWIPRAWADDRESS_ERROR_POOL_EXHAUSTED + LWIPRAWADDRESS_ERROR_POOL_EXHAUSTED ); } return handle; @@ -64,11 +63,10 @@ void SolidSyslogLwipRawAddress_Destroy(struct SolidSyslogAddress* base) SolidSyslogPoolAllocator_FreeIfInUse(&LwipRawAddress_Allocator, index, LwipRawAddress_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + LwipRawAddress_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &LwipRawAddressErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) LWIPRAWADDRESS_ERROR_UNKNOWN_DESTROY + LWIPRAWADDRESS_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagramPrivate.h b/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagramPrivate.h index 514f87fa..cf516227 100644 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagramPrivate.h +++ b/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagramPrivate.h @@ -1,7 +1,12 @@ #ifndef SOLIDSYSLOGLWIPRAWDATAGRAMPRIVATE_H #define SOLIDSYSLOGLWIPRAWDATAGRAMPRIVATE_H +#include + #include "SolidSyslogDatagramDefinition.h" +#include "SolidSyslogError.h" +#include "SolidSyslogLwipRawDatagramErrors.h" +#include "SolidSyslogPrival.h" struct udp_pcb; @@ -14,4 +19,13 @@ struct SolidSyslogLwipRawDatagram void LwipRawDatagram_Initialise(struct SolidSyslogDatagram* base); void LwipRawDatagram_Cleanup(struct SolidSyslogDatagram* base); +static inline void LwipRawDatagram_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogLwipRawDatagramErrors code +) +{ + SolidSyslog_Error(severity, &LwipRawDatagramErrorSource, category, code); +} + #endif /* SOLIDSYSLOGLWIPRAWDATAGRAMPRIVATE_H */ diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagramStatic.c b/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagramStatic.c index 78aed27f..d9cb87ca 100644 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagramStatic.c +++ b/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagramStatic.c @@ -36,11 +36,10 @@ struct SolidSyslogDatagram* SolidSyslogLwipRawDatagram_Create(void) } else { - SolidSyslog_Error( + LwipRawDatagram_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &LwipRawDatagramErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) LWIPRAWDATAGRAM_ERROR_POOL_EXHAUSTED + LWIPRAWDATAGRAM_ERROR_POOL_EXHAUSTED ); } return handle; @@ -54,11 +53,10 @@ void SolidSyslogLwipRawDatagram_Destroy(struct SolidSyslogDatagram* base) SolidSyslogPoolAllocator_FreeIfInUse(&LwipRawDatagram_Allocator, index, LwipRawDatagram_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + LwipRawDatagram_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &LwipRawDatagramErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) LWIPRAWDATAGRAM_ERROR_UNKNOWN_DESTROY + LWIPRAWDATAGRAM_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolver.c b/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolver.c index 85734cf3..c7b6928b 100644 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolver.c +++ b/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolver.c @@ -174,11 +174,10 @@ static bool LwipRawDnsResolver_WaitForCallback(struct SolidSyslogLwipRawDnsResol } if (!self->Done) { - SolidSyslog_Error( + LwipRawDnsResolver_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &LwipRawDnsResolverErrorSource, SOLIDSYSLOG_CAT_RESOLVER_RESOLVE_FAILED, - (int32_t) LWIPRAWDNSRESOLVER_ERROR_RESOLVE_TIMEOUT + LWIPRAWDNSRESOLVER_ERROR_RESOLVE_TIMEOUT ); } return self->Done; diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolverPrivate.h b/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolverPrivate.h index 6ef62534..aa728907 100644 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolverPrivate.h +++ b/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolverPrivate.h @@ -1,9 +1,14 @@ #ifndef SOLIDSYSLOGLWIPRAWDNSRESOLVERPRIVATE_H #define SOLIDSYSLOGLWIPRAWDNSRESOLVERPRIVATE_H +#include + #include +#include "SolidSyslogError.h" #include "SolidSyslogLwipRawDnsResolver.h" +#include "SolidSyslogLwipRawDnsResolverErrors.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogResolverDefinition.h" #include "lwip/ip_addr.h" @@ -27,4 +32,13 @@ void LwipRawDnsResolver_Initialise( ); void LwipRawDnsResolver_Cleanup(struct SolidSyslogResolver* base); +static inline void LwipRawDnsResolver_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogLwipRawDnsResolverErrors code +) +{ + SolidSyslog_Error(severity, &LwipRawDnsResolverErrorSource, category, code); +} + #endif /* SOLIDSYSLOGLWIPRAWDNSRESOLVERPRIVATE_H */ diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolverStatic.c b/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolverStatic.c index 0710e064..61812965 100644 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolverStatic.c +++ b/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolverStatic.c @@ -41,11 +41,10 @@ struct SolidSyslogResolver* SolidSyslogLwipRawDnsResolver_Create( } else { - SolidSyslog_Error( + LwipRawDnsResolver_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &LwipRawDnsResolverErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) LWIPRAWDNSRESOLVER_ERROR_POOL_EXHAUSTED + LWIPRAWDNSRESOLVER_ERROR_POOL_EXHAUSTED ); } } @@ -64,11 +63,10 @@ void SolidSyslogLwipRawDnsResolver_Destroy(struct SolidSyslogResolver* base) ); if (!released) { - SolidSyslog_Error( + LwipRawDnsResolver_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &LwipRawDnsResolverErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) LWIPRAWDNSRESOLVER_ERROR_UNKNOWN_DESTROY + LWIPRAWDNSRESOLVER_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawResolverPrivate.h b/Platform/LwipRaw/Source/SolidSyslogLwipRawResolverPrivate.h index 79a97018..6c930478 100644 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawResolverPrivate.h +++ b/Platform/LwipRaw/Source/SolidSyslogLwipRawResolverPrivate.h @@ -1,6 +1,11 @@ #ifndef SOLIDSYSLOGLWIPRAWRESOLVERPRIVATE_H #define SOLIDSYSLOGLWIPRAWRESOLVERPRIVATE_H +#include + +#include "SolidSyslogError.h" +#include "SolidSyslogLwipRawResolverErrors.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogResolverDefinition.h" struct SolidSyslogLwipRawResolver @@ -11,4 +16,13 @@ struct SolidSyslogLwipRawResolver void LwipRawResolver_Initialise(struct SolidSyslogResolver* base); void LwipRawResolver_Cleanup(struct SolidSyslogResolver* base); +static inline void LwipRawResolver_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogLwipRawResolverErrors code +) +{ + SolidSyslog_Error(severity, &LwipRawResolverErrorSource, category, code); +} + #endif /* SOLIDSYSLOGLWIPRAWRESOLVERPRIVATE_H */ diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawResolverStatic.c b/Platform/LwipRaw/Source/SolidSyslogLwipRawResolverStatic.c index 55537d72..3b6d0315 100644 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawResolverStatic.c +++ b/Platform/LwipRaw/Source/SolidSyslogLwipRawResolverStatic.c @@ -36,11 +36,10 @@ struct SolidSyslogResolver* SolidSyslogLwipRawResolver_Create(void) } else { - SolidSyslog_Error( + LwipRawResolver_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &LwipRawResolverErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) LWIPRAWRESOLVER_ERROR_POOL_EXHAUSTED + LWIPRAWRESOLVER_ERROR_POOL_EXHAUSTED ); } return handle; @@ -54,11 +53,10 @@ void SolidSyslogLwipRawResolver_Destroy(struct SolidSyslogResolver* base) SolidSyslogPoolAllocator_FreeIfInUse(&LwipRawResolver_Allocator, index, LwipRawResolver_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + LwipRawResolver_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &LwipRawResolverErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) LWIPRAWRESOLVER_ERROR_UNKNOWN_DESTROY + LWIPRAWRESOLVER_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStreamPrivate.h b/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStreamPrivate.h index d5d81ba4..ea43712c 100644 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStreamPrivate.h +++ b/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStreamPrivate.h @@ -1,10 +1,15 @@ #ifndef SOLIDSYSLOGLWIPRAWTCPSTREAMPRIVATE_H #define SOLIDSYSLOGLWIPRAWTCPSTREAMPRIVATE_H +#include + #include #include +#include "SolidSyslogError.h" #include "SolidSyslogLwipRawTcpStream.h" +#include "SolidSyslogLwipRawTcpStreamErrors.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogStreamDefinition.h" #include "SolidSyslogTunables.h" @@ -30,4 +35,13 @@ void LwipRawTcpStream_Initialise( ); void LwipRawTcpStream_Cleanup(struct SolidSyslogStream* base); +static inline void LwipRawTcpStream_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogLwipRawTcpStreamErrors code +) +{ + SolidSyslog_Error(severity, &LwipRawTcpStreamErrorSource, category, code); +} + #endif /* SOLIDSYSLOGLWIPRAWTCPSTREAMPRIVATE_H */ diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStreamStatic.c b/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStreamStatic.c index 93543d35..479248e3 100644 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStreamStatic.c +++ b/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStreamStatic.c @@ -39,11 +39,10 @@ struct SolidSyslogStream* SolidSyslogLwipRawTcpStream_Create(const struct SolidS } else { - SolidSyslog_Error( + LwipRawTcpStream_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &LwipRawTcpStreamErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) LWIPRAWTCPSTREAM_ERROR_POOL_EXHAUSTED + LWIPRAWTCPSTREAM_ERROR_POOL_EXHAUSTED ); } } @@ -58,11 +57,10 @@ void SolidSyslogLwipRawTcpStream_Destroy(struct SolidSyslogStream* base) SolidSyslogPoolAllocator_FreeIfInUse(&LwipRawTcpStream_Allocator, index, LwipRawTcpStream_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + LwipRawTcpStream_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &LwipRawTcpStreamErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) LWIPRAWTCPSTREAM_ERROR_UNKNOWN_DESTROY + LWIPRAWTCPSTREAM_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicy.c b/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicy.c index 2dcd25c9..27e17c19 100644 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicy.c +++ b/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicy.c @@ -106,21 +106,19 @@ static bool MbedTlsAesGcmPolicy_SealRecord( } else { - SolidSyslog_Error( + MbedTlsAesGcmPolicy_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &MbedTlsAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_SECURITYPOLICY_SEAL_FAILED, - (int32_t) MBEDTLSAESGCMPOLICY_ERROR_ENCRYPT_FAILED + MBEDTLSAESGCMPOLICY_ERROR_ENCRYPT_FAILED ); } } else { - SolidSyslog_Error( + MbedTlsAesGcmPolicy_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &MbedTlsAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_SECURITYPOLICY_SEAL_FAILED, - (int32_t) MBEDTLSAESGCMPOLICY_ERROR_NONCE_FAILED + MBEDTLSAESGCMPOLICY_ERROR_NONCE_FAILED ); } } @@ -137,11 +135,10 @@ static bool MbedTlsAesGcmPolicy_FetchKey(struct SolidSyslogMbedTlsAesGcmPolicy* (keyLength == (size_t) AES_256_KEY_SIZE); if (!fetched) { - SolidSyslog_Error( + MbedTlsAesGcmPolicy_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &MbedTlsAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_SECURITYPOLICY_KEY_UNAVAILABLE, - (int32_t) MBEDTLSAESGCMPOLICY_ERROR_KEY_UNAVAILABLE + MBEDTLSAESGCMPOLICY_ERROR_KEY_UNAVAILABLE ); } return fetched; @@ -249,11 +246,10 @@ static bool MbedTlsAesGcmPolicy_GcmDecrypt(const struct SolidSyslogSecurityRecor mbedtls_gcm_free(&ctx); if (errored) { - SolidSyslog_Error( + MbedTlsAesGcmPolicy_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &MbedTlsAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_SECURITYPOLICY_OPEN_FAILED, - (int32_t) MBEDTLSAESGCMPOLICY_ERROR_DECRYPT_FAILED + MBEDTLSAESGCMPOLICY_ERROR_DECRYPT_FAILED ); } return opened; diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyPrivate.h b/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyPrivate.h index ed2c2f11..b809f72f 100644 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyPrivate.h +++ b/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyPrivate.h @@ -1,7 +1,12 @@ #ifndef SOLIDSYSLOGMBEDTLSAESGCMPOLICYPRIVATE_H #define SOLIDSYSLOGMBEDTLSAESGCMPOLICYPRIVATE_H +#include + +#include "SolidSyslogError.h" #include "SolidSyslogMbedTlsAesGcmPolicy.h" +#include "SolidSyslogMbedTlsAesGcmPolicyErrors.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogSecurityPolicyDefinition.h" struct SolidSyslogMbedTlsAesGcmPolicy @@ -16,4 +21,13 @@ void MbedTlsAesGcmPolicy_Initialise( ); void MbedTlsAesGcmPolicy_Cleanup(struct SolidSyslogSecurityPolicy* base); +static inline void MbedTlsAesGcmPolicy_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogMbedTlsAesGcmPolicyErrors code +) +{ + SolidSyslog_Error(severity, &MbedTlsAesGcmPolicyErrorSource, category, code); +} + #endif /* SOLIDSYSLOGMBEDTLSAESGCMPOLICYPRIVATE_H */ diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyStatic.c b/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyStatic.c index cc8d85f0..09d1c197 100644 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyStatic.c +++ b/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyStatic.c @@ -40,21 +40,19 @@ struct SolidSyslogSecurityPolicy* SolidSyslogMbedTlsAesGcmPolicy_Create( } else { - SolidSyslog_Error( + MbedTlsAesGcmPolicy_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &MbedTlsAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) MBEDTLSAESGCMPOLICY_ERROR_POOL_EXHAUSTED + MBEDTLSAESGCMPOLICY_ERROR_POOL_EXHAUSTED ); } } else { - SolidSyslog_Error( + MbedTlsAesGcmPolicy_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &MbedTlsAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) MBEDTLSAESGCMPOLICY_ERROR_BAD_CONFIG + MBEDTLSAESGCMPOLICY_ERROR_BAD_CONFIG ); } return handle; @@ -72,11 +70,10 @@ void SolidSyslogMbedTlsAesGcmPolicy_Destroy(struct SolidSyslogSecurityPolicy* ba ); if (!released) { - SolidSyslog_Error( + MbedTlsAesGcmPolicy_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &MbedTlsAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) MBEDTLSAESGCMPOLICY_ERROR_UNKNOWN_DESTROY + MBEDTLSAESGCMPOLICY_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256Policy.c b/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256Policy.c index 430830c3..1e2b436e 100644 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256Policy.c +++ b/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256Policy.c @@ -113,21 +113,19 @@ static bool MbedTlsHmacSha256Policy_ComputeTag( } else { - SolidSyslog_Error( + MbedTlsHmacSha256Policy_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &MbedTlsHmacSha256PolicyErrorSource, failureCategory, - (int32_t) MBEDTLSHMACSHA256POLICY_ERROR_HMAC_FAILED + MBEDTLSHMACSHA256POLICY_ERROR_HMAC_FAILED ); } } else { - SolidSyslog_Error( + MbedTlsHmacSha256Policy_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &MbedTlsHmacSha256PolicyErrorSource, SOLIDSYSLOG_CAT_SECURITYPOLICY_KEY_UNAVAILABLE, - (int32_t) MBEDTLSHMACSHA256POLICY_ERROR_KEY_UNAVAILABLE + MBEDTLSHMACSHA256POLICY_ERROR_KEY_UNAVAILABLE ); } /* Wipe the whole key buffer — the full region GetKey was handed, not just diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyPrivate.h b/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyPrivate.h index 809e9c77..7eb44ffd 100644 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyPrivate.h +++ b/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyPrivate.h @@ -1,7 +1,12 @@ #ifndef SOLIDSYSLOGMBEDTLSHMACSHA256POLICYPRIVATE_H #define SOLIDSYSLOGMBEDTLSHMACSHA256POLICYPRIVATE_H +#include + +#include "SolidSyslogError.h" #include "SolidSyslogMbedTlsHmacSha256Policy.h" +#include "SolidSyslogMbedTlsHmacSha256PolicyErrors.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogSecurityPolicyDefinition.h" struct SolidSyslogMbedTlsHmacSha256Policy @@ -16,4 +21,13 @@ void MbedTlsHmacSha256Policy_Initialise( ); void MbedTlsHmacSha256Policy_Cleanup(struct SolidSyslogSecurityPolicy* base); +static inline void MbedTlsHmacSha256Policy_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogMbedTlsHmacSha256PolicyErrors code +) +{ + SolidSyslog_Error(severity, &MbedTlsHmacSha256PolicyErrorSource, category, code); +} + #endif /* SOLIDSYSLOGMBEDTLSHMACSHA256POLICYPRIVATE_H */ diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyStatic.c b/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyStatic.c index 599c04d5..a40953d0 100644 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyStatic.c +++ b/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyStatic.c @@ -40,21 +40,19 @@ struct SolidSyslogSecurityPolicy* SolidSyslogMbedTlsHmacSha256Policy_Create( } else { - SolidSyslog_Error( + MbedTlsHmacSha256Policy_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &MbedTlsHmacSha256PolicyErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) MBEDTLSHMACSHA256POLICY_ERROR_POOL_EXHAUSTED + MBEDTLSHMACSHA256POLICY_ERROR_POOL_EXHAUSTED ); } } else { - SolidSyslog_Error( + MbedTlsHmacSha256Policy_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &MbedTlsHmacSha256PolicyErrorSource, SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) MBEDTLSHMACSHA256POLICY_ERROR_BAD_CONFIG + MBEDTLSHMACSHA256POLICY_ERROR_BAD_CONFIG ); } return handle; @@ -72,11 +70,10 @@ void SolidSyslogMbedTlsHmacSha256Policy_Destroy(struct SolidSyslogSecurityPolicy ); if (!released) { - SolidSyslog_Error( + MbedTlsHmacSha256Policy_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &MbedTlsHmacSha256PolicyErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) MBEDTLSHMACSHA256POLICY_ERROR_UNKNOWN_DESTROY + MBEDTLSHMACSHA256POLICY_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c b/Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c index 96b44438..3343fe6d 100644 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c +++ b/Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c @@ -152,11 +152,10 @@ static inline bool MbedTlsStream_ApplySslConfigDefaults(struct SolidSyslogMbedTl ) == 0; if (!ok) { - SolidSyslog_Error( + MbedTlsStream_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &MbedTlsStreamErrorSource, SOLIDSYSLOG_CAT_TLSSTREAM_INIT_FAILED, - (int32_t) MBEDTLSSTREAM_ERROR_DEFAULTS_NOT_APPLIED + MBEDTLSSTREAM_ERROR_DEFAULTS_NOT_APPLIED ); } return ok; @@ -180,11 +179,10 @@ static inline bool MbedTlsStream_BindContextToConfig(struct SolidSyslogMbedTlsSt bool ok = mbedtls_ssl_setup(&self->SslContext, &self->SslConfig) == 0; if (!ok) { - SolidSyslog_Error( + MbedTlsStream_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &MbedTlsStreamErrorSource, SOLIDSYSLOG_CAT_TLSSTREAM_INIT_FAILED, - (int32_t) MBEDTLSSTREAM_ERROR_SESSION_INIT_FAILED + MBEDTLSSTREAM_ERROR_SESSION_INIT_FAILED ); } return ok; @@ -198,11 +196,10 @@ static inline bool MbedTlsStream_ConfigureExpectedHostname(struct SolidSyslogMbe ok = mbedtls_ssl_set_hostname(&self->SslContext, self->Config.ServerName) == 0; if (!ok) { - SolidSyslog_Error( + MbedTlsStream_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &MbedTlsStreamErrorSource, SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) MBEDTLSSTREAM_ERROR_SERVER_NAME_NOT_SET + MBEDTLSSTREAM_ERROR_SERVER_NAME_NOT_SET ); } } @@ -238,21 +235,19 @@ static inline bool MbedTlsStream_PerformHandshake(struct SolidSyslogMbedTlsStrea } else if (!MbedTlsStream_IsRetryableHandshakeRc(rc)) { - SolidSyslog_Error( + MbedTlsStream_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &MbedTlsStreamErrorSource, SOLIDSYSLOG_CAT_TLSSTREAM_HANDSHAKE_FAILED, - (int32_t) MBEDTLSSTREAM_ERROR_HANDSHAKE_REJECTED + MBEDTLSSTREAM_ERROR_HANDSHAKE_REJECTED ); done = true; } else if (MbedTlsStream_IsHandshakeBudgetExhausted(totalSleptMs, budgetMs)) { - SolidSyslog_Error( + MbedTlsStream_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &MbedTlsStreamErrorSource, SOLIDSYSLOG_CAT_TLSSTREAM_HANDSHAKE_FAILED, - (int32_t) MBEDTLSSTREAM_ERROR_HANDSHAKE_TIMEOUT + MBEDTLSSTREAM_ERROR_HANDSHAKE_TIMEOUT ); done = true; } diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamPrivate.h b/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamPrivate.h index e6661a89..b8011b2c 100644 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamPrivate.h +++ b/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamPrivate.h @@ -1,9 +1,14 @@ #ifndef SOLIDSYSLOGMBEDTLSSTREAMPRIVATE_H #define SOLIDSYSLOGMBEDTLSSTREAMPRIVATE_H +#include + #include +#include "SolidSyslogError.h" #include "SolidSyslogMbedTlsStream.h" +#include "SolidSyslogMbedTlsStreamErrors.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogStreamDefinition.h" struct SolidSyslogMbedTlsStream @@ -17,4 +22,13 @@ struct SolidSyslogMbedTlsStream void MbedTlsStream_Initialise(struct SolidSyslogStream* base, const struct SolidSyslogMbedTlsStreamConfig* config); void MbedTlsStream_Cleanup(struct SolidSyslogStream* base); +static inline void MbedTlsStream_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogMbedTlsStreamErrors code +) +{ + SolidSyslog_Error(severity, &MbedTlsStreamErrorSource, category, code); +} + #endif /* SOLIDSYSLOGMBEDTLSSTREAMPRIVATE_H */ diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamStatic.c b/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamStatic.c index 89625b27..296684ed 100644 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamStatic.c +++ b/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamStatic.c @@ -36,11 +36,10 @@ struct SolidSyslogStream* SolidSyslogMbedTlsStream_Create(const struct SolidSysl } else { - SolidSyslog_Error( + MbedTlsStream_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &MbedTlsStreamErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) MBEDTLSSTREAM_ERROR_POOL_EXHAUSTED + MBEDTLSSTREAM_ERROR_POOL_EXHAUSTED ); } return handle; @@ -54,11 +53,10 @@ void SolidSyslogMbedTlsStream_Destroy(struct SolidSyslogStream* base) SolidSyslogPoolAllocator_FreeIfInUse(&MbedTlsStream_Allocator, index, MbedTlsStream_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + MbedTlsStream_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &MbedTlsStreamErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) MBEDTLSSTREAM_ERROR_UNKNOWN_DESTROY + MBEDTLSSTREAM_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicy.c b/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicy.c index 76b99d73..13fbbacc 100644 --- a/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicy.c +++ b/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicy.c @@ -120,21 +120,19 @@ static bool OpenSslAesGcmPolicy_SealRecord( } else { - SolidSyslog_Error( + OpenSslAesGcmPolicy_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &OpenSslAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_SECURITYPOLICY_SEAL_FAILED, - (int32_t) OPENSSLAESGCMPOLICY_ERROR_ENCRYPT_FAILED + OPENSSLAESGCMPOLICY_ERROR_ENCRYPT_FAILED ); } } else { - SolidSyslog_Error( + OpenSslAesGcmPolicy_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &OpenSslAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_SECURITYPOLICY_SEAL_FAILED, - (int32_t) OPENSSLAESGCMPOLICY_ERROR_NONCE_FAILED + OPENSSLAESGCMPOLICY_ERROR_NONCE_FAILED ); } } @@ -151,11 +149,10 @@ static bool OpenSslAesGcmPolicy_FetchKey(struct SolidSyslogOpenSslAesGcmPolicy* (keyLength == (size_t) AES_256_KEY_SIZE); if (!fetched) { - SolidSyslog_Error( + OpenSslAesGcmPolicy_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &OpenSslAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_SECURITYPOLICY_KEY_UNAVAILABLE, - (int32_t) OPENSSLAESGCMPOLICY_ERROR_KEY_UNAVAILABLE + OPENSSLAESGCMPOLICY_ERROR_KEY_UNAVAILABLE ); } return fetched; @@ -255,11 +252,10 @@ static bool OpenSslAesGcmPolicy_GcmDecrypt( } if (errored) { - SolidSyslog_Error( + OpenSslAesGcmPolicy_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &OpenSslAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_SECURITYPOLICY_OPEN_FAILED, - (int32_t) OPENSSLAESGCMPOLICY_ERROR_DECRYPT_FAILED + OPENSSLAESGCMPOLICY_ERROR_DECRYPT_FAILED ); } return opened; diff --git a/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyPrivate.h b/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyPrivate.h index bfcfafa3..23dcb370 100644 --- a/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyPrivate.h +++ b/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyPrivate.h @@ -1,7 +1,12 @@ #ifndef SOLIDSYSLOGOPENSSLAESGCMPOLICYPRIVATE_H #define SOLIDSYSLOGOPENSSLAESGCMPOLICYPRIVATE_H +#include + +#include "SolidSyslogError.h" #include "SolidSyslogOpenSslAesGcmPolicy.h" +#include "SolidSyslogOpenSslAesGcmPolicyErrors.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogSecurityPolicyDefinition.h" struct SolidSyslogOpenSslAesGcmPolicy @@ -16,4 +21,13 @@ void OpenSslAesGcmPolicy_Initialise( ); void OpenSslAesGcmPolicy_Cleanup(struct SolidSyslogSecurityPolicy* base); +static inline void OpenSslAesGcmPolicy_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogOpenSslAesGcmPolicyErrors code +) +{ + SolidSyslog_Error(severity, &OpenSslAesGcmPolicyErrorSource, category, code); +} + #endif /* SOLIDSYSLOGOPENSSLAESGCMPOLICYPRIVATE_H */ diff --git a/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyStatic.c b/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyStatic.c index c3968c45..dd277b4e 100644 --- a/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyStatic.c +++ b/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyStatic.c @@ -40,21 +40,19 @@ struct SolidSyslogSecurityPolicy* SolidSyslogOpenSslAesGcmPolicy_Create( } else { - SolidSyslog_Error( + OpenSslAesGcmPolicy_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &OpenSslAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) OPENSSLAESGCMPOLICY_ERROR_POOL_EXHAUSTED + OPENSSLAESGCMPOLICY_ERROR_POOL_EXHAUSTED ); } } else { - SolidSyslog_Error( + OpenSslAesGcmPolicy_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &OpenSslAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) OPENSSLAESGCMPOLICY_ERROR_BAD_CONFIG + OPENSSLAESGCMPOLICY_ERROR_BAD_CONFIG ); } return handle; @@ -72,11 +70,10 @@ void SolidSyslogOpenSslAesGcmPolicy_Destroy(struct SolidSyslogSecurityPolicy* ba ); if (!released) { - SolidSyslog_Error( + OpenSslAesGcmPolicy_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &OpenSslAesGcmPolicyErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) OPENSSLAESGCMPOLICY_ERROR_UNKNOWN_DESTROY + OPENSSLAESGCMPOLICY_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256Policy.c b/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256Policy.c index f59b7cd9..160eb941 100644 --- a/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256Policy.c +++ b/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256Policy.c @@ -113,21 +113,19 @@ static bool OpenSslHmacSha256Policy_ComputeTag( } else { - SolidSyslog_Error( + OpenSslHmacSha256Policy_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &OpenSslHmacSha256PolicyErrorSource, failureCategory, - (int32_t) OPENSSLHMACSHA256POLICY_ERROR_HMAC_FAILED + OPENSSLHMACSHA256POLICY_ERROR_HMAC_FAILED ); } } else { - SolidSyslog_Error( + OpenSslHmacSha256Policy_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &OpenSslHmacSha256PolicyErrorSource, SOLIDSYSLOG_CAT_SECURITYPOLICY_KEY_UNAVAILABLE, - (int32_t) OPENSSLHMACSHA256POLICY_ERROR_KEY_UNAVAILABLE + OPENSSLHMACSHA256POLICY_ERROR_KEY_UNAVAILABLE ); } /* Wipe the whole key buffer — the full region GetKey was handed, not just diff --git a/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyPrivate.h b/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyPrivate.h index c2aa8845..914cbb7e 100644 --- a/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyPrivate.h +++ b/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyPrivate.h @@ -1,7 +1,12 @@ #ifndef SOLIDSYSLOGOPENSSLHMACSHA256POLICYPRIVATE_H #define SOLIDSYSLOGOPENSSLHMACSHA256POLICYPRIVATE_H +#include + +#include "SolidSyslogError.h" #include "SolidSyslogOpenSslHmacSha256Policy.h" +#include "SolidSyslogOpenSslHmacSha256PolicyErrors.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogSecurityPolicyDefinition.h" struct SolidSyslogOpenSslHmacSha256Policy @@ -16,4 +21,13 @@ void OpenSslHmacSha256Policy_Initialise( ); void OpenSslHmacSha256Policy_Cleanup(struct SolidSyslogSecurityPolicy* base); +static inline void OpenSslHmacSha256Policy_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogOpenSslHmacSha256PolicyErrors code +) +{ + SolidSyslog_Error(severity, &OpenSslHmacSha256PolicyErrorSource, category, code); +} + #endif /* SOLIDSYSLOGOPENSSLHMACSHA256POLICYPRIVATE_H */ diff --git a/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyStatic.c b/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyStatic.c index bc9e44e5..4d9cb7d7 100644 --- a/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyStatic.c +++ b/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyStatic.c @@ -40,21 +40,19 @@ struct SolidSyslogSecurityPolicy* SolidSyslogOpenSslHmacSha256Policy_Create( } else { - SolidSyslog_Error( + OpenSslHmacSha256Policy_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &OpenSslHmacSha256PolicyErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) OPENSSLHMACSHA256POLICY_ERROR_POOL_EXHAUSTED + OPENSSLHMACSHA256POLICY_ERROR_POOL_EXHAUSTED ); } } else { - SolidSyslog_Error( + OpenSslHmacSha256Policy_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &OpenSslHmacSha256PolicyErrorSource, SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) OPENSSLHMACSHA256POLICY_ERROR_BAD_CONFIG + OPENSSLHMACSHA256POLICY_ERROR_BAD_CONFIG ); } return handle; @@ -72,11 +70,10 @@ void SolidSyslogOpenSslHmacSha256Policy_Destroy(struct SolidSyslogSecurityPolicy ); if (!released) { - SolidSyslog_Error( + OpenSslHmacSha256Policy_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &OpenSslHmacSha256PolicyErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) OPENSSLHMACSHA256POLICY_ERROR_UNKNOWN_DESTROY + OPENSSLHMACSHA256POLICY_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/OpenSsl/Source/SolidSyslogTlsStream.c b/Platform/OpenSsl/Source/SolidSyslogTlsStream.c index c6619270..e8cc817b 100644 --- a/Platform/OpenSsl/Source/SolidSyslogTlsStream.c +++ b/Platform/OpenSsl/Source/SolidSyslogTlsStream.c @@ -170,11 +170,10 @@ static inline bool TlsStream_InitSslContext(struct SolidSyslogTlsStream* self) bool ok = self->Ctx != NULL; if (!ok) { - SolidSyslog_Error( + TlsStream_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &TlsStreamErrorSource, SOLIDSYSLOG_CAT_TLSSTREAM_INIT_FAILED, - (int32_t) TLSSTREAM_ERROR_CONTEXT_INIT_FAILED + TLSSTREAM_ERROR_CONTEXT_INIT_FAILED ); } return ok; @@ -251,11 +250,10 @@ static inline bool TlsStream_InitSslSession(struct SolidSyslogTlsStream* self) bool ok = self->Ssl != NULL; if (!ok) { - SolidSyslog_Error( + TlsStream_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &TlsStreamErrorSource, SOLIDSYSLOG_CAT_TLSSTREAM_INIT_FAILED, - (int32_t) TLSSTREAM_ERROR_SESSION_INIT_FAILED + TLSSTREAM_ERROR_SESSION_INIT_FAILED ); } return ok; @@ -272,11 +270,10 @@ static inline bool TlsStream_AttachTransportBio(struct SolidSyslogTlsStream* sel } else { - SolidSyslog_Error( + TlsStream_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &TlsStreamErrorSource, SOLIDSYSLOG_CAT_TLSSTREAM_INIT_FAILED, - (int32_t) TLSSTREAM_ERROR_SESSION_INIT_FAILED + TLSSTREAM_ERROR_SESSION_INIT_FAILED ); } return ok; @@ -396,11 +393,10 @@ static inline bool TlsStream_ConfigureExpectedHostname(struct SolidSyslogTlsStre (SSL_set1_host(self->Ssl, self->Config.ServerName) == 1); if (!ok) { - SolidSyslog_Error( + TlsStream_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &TlsStreamErrorSource, SOLIDSYSLOG_CAT_BAD_CONFIG, - (int32_t) TLSSTREAM_ERROR_SERVER_NAME_NOT_SET + TLSSTREAM_ERROR_SERVER_NAME_NOT_SET ); } } @@ -465,21 +461,19 @@ static inline bool TlsStream_PerformHandshake(struct SolidSyslogTlsStream* self) int err = SSL_get_error(self->Ssl, rc); if (!TlsStream_IsRetryableSslError(err)) { - SolidSyslog_Error( + TlsStream_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &TlsStreamErrorSource, SOLIDSYSLOG_CAT_TLSSTREAM_HANDSHAKE_FAILED, - (int32_t) TLSSTREAM_ERROR_HANDSHAKE_REJECTED + TLSSTREAM_ERROR_HANDSHAKE_REJECTED ); done = true; } else if (TlsStream_IsHandshakeBudgetExhausted(totalSleptMs, budgetMs)) { - SolidSyslog_Error( + TlsStream_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &TlsStreamErrorSource, SOLIDSYSLOG_CAT_TLSSTREAM_HANDSHAKE_FAILED, - (int32_t) TLSSTREAM_ERROR_HANDSHAKE_TIMEOUT + TLSSTREAM_ERROR_HANDSHAKE_TIMEOUT ); done = true; } diff --git a/Platform/OpenSsl/Source/SolidSyslogTlsStreamPrivate.h b/Platform/OpenSsl/Source/SolidSyslogTlsStreamPrivate.h index 58f596d8..1db1a866 100644 --- a/Platform/OpenSsl/Source/SolidSyslogTlsStreamPrivate.h +++ b/Platform/OpenSsl/Source/SolidSyslogTlsStreamPrivate.h @@ -1,11 +1,16 @@ #ifndef SOLIDSYSLOGTLSSTREAMPRIVATE_H #define SOLIDSYSLOGTLSSTREAMPRIVATE_H +#include + #include #include +#include "SolidSyslogError.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogStreamDefinition.h" #include "SolidSyslogTlsStream.h" +#include "SolidSyslogTlsStreamErrors.h" struct SolidSyslogTlsStream { @@ -19,4 +24,13 @@ struct SolidSyslogTlsStream void TlsStream_Initialise(struct SolidSyslogStream* base, const struct SolidSyslogTlsStreamConfig* config); void TlsStream_Cleanup(struct SolidSyslogStream* base); +static inline void TlsStream_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogTlsStreamErrors code +) +{ + SolidSyslog_Error(severity, &TlsStreamErrorSource, category, code); +} + #endif /* SOLIDSYSLOGTLSSTREAMPRIVATE_H */ diff --git a/Platform/OpenSsl/Source/SolidSyslogTlsStreamStatic.c b/Platform/OpenSsl/Source/SolidSyslogTlsStreamStatic.c index 30ffe3cf..0ca91feb 100644 --- a/Platform/OpenSsl/Source/SolidSyslogTlsStreamStatic.c +++ b/Platform/OpenSsl/Source/SolidSyslogTlsStreamStatic.c @@ -33,12 +33,7 @@ struct SolidSyslogStream* SolidSyslogTlsStream_Create(const struct SolidSyslogTl } else { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_ERROR, - &TlsStreamErrorSource, - SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) TLSSTREAM_ERROR_POOL_EXHAUSTED - ); + TlsStream_Report(SOLIDSYSLOG_SEVERITY_ERROR, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, TLSSTREAM_ERROR_POOL_EXHAUSTED); } return handle; } @@ -50,11 +45,10 @@ void SolidSyslogTlsStream_Destroy(struct SolidSyslogStream* base) SolidSyslogPoolAllocator_FreeIfInUse(&TlsStream_Allocator, index, TlsStream_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + TlsStream_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &TlsStreamErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) TLSSTREAM_ERROR_UNKNOWN_DESTROY + TLSSTREAM_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressPrivate.h b/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressPrivate.h index 8f4763d0..1b2921ba 100644 --- a/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressPrivate.h +++ b/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressPrivate.h @@ -1,8 +1,13 @@ #ifndef SOLIDSYSLOGPLUSTCPADDRESSPRIVATE_H #define SOLIDSYSLOGPLUSTCPADDRESSPRIVATE_H +#include + #include "FreeRTOS.h" #include "FreeRTOS_Sockets.h" +#include "SolidSyslogError.h" +#include "SolidSyslogPlusTcpAddressErrors.h" +#include "SolidSyslogPrival.h" struct SolidSyslogAddress; @@ -26,4 +31,13 @@ static inline const struct freertos_sockaddr* SolidSyslogPlusTcpAddress_AsConstF return &((const struct SolidSyslogPlusTcpAddress*) base)->Sockaddr; } +static inline void PlusTcpAddress_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogPlusTcpAddressErrors code +) +{ + SolidSyslog_Error(severity, &PlusTcpAddressErrorSource, category, code); +} + #endif /* SOLIDSYSLOGPLUSTCPADDRESSPRIVATE_H */ diff --git a/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressStatic.c b/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressStatic.c index 707e4f2b..33f4da37 100644 --- a/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressStatic.c +++ b/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressStatic.c @@ -40,11 +40,10 @@ struct SolidSyslogAddress* SolidSyslogPlusTcpAddress_Create(void) } else { - SolidSyslog_Error( + PlusTcpAddress_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &PlusTcpAddressErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) PLUSTCPADDRESS_ERROR_POOL_EXHAUSTED + PLUSTCPADDRESS_ERROR_POOL_EXHAUSTED ); } return handle; @@ -64,11 +63,10 @@ void SolidSyslogPlusTcpAddress_Destroy(struct SolidSyslogAddress* base) SolidSyslogPoolAllocator_FreeIfInUse(&PlusTcpAddress_Allocator, index, PlusTcpAddress_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + PlusTcpAddress_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &PlusTcpAddressErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) PLUSTCPADDRESS_ERROR_UNKNOWN_DESTROY + PLUSTCPADDRESS_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagramPrivate.h b/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagramPrivate.h index 04ecbbe0..d95e3ad7 100644 --- a/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagramPrivate.h +++ b/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagramPrivate.h @@ -1,6 +1,11 @@ #ifndef SOLIDSYSLOGPLUSTCPDATAGRAMPRIVATE_H #define SOLIDSYSLOGPLUSTCPDATAGRAMPRIVATE_H +#include +#include "SolidSyslogError.h" +#include "SolidSyslogPrival.h" +#include "SolidSyslogPlusTcpDatagramErrors.h" + #include "FreeRTOS.h" #include "FreeRTOS_Sockets.h" @@ -15,4 +20,13 @@ struct SolidSyslogPlusTcpDatagram void PlusTcpDatagram_Initialise(struct SolidSyslogDatagram* base); void PlusTcpDatagram_Cleanup(struct SolidSyslogDatagram* base); +static inline void PlusTcpDatagram_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogPlusTcpDatagramErrors code +) +{ + SolidSyslog_Error(severity, &PlusTcpDatagramErrorSource, category, code); +} + #endif /* SOLIDSYSLOGPLUSTCPDATAGRAMPRIVATE_H */ diff --git a/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagramStatic.c b/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagramStatic.c index 5842c002..f2817fa2 100644 --- a/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagramStatic.c +++ b/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagramStatic.c @@ -36,11 +36,10 @@ struct SolidSyslogDatagram* SolidSyslogPlusTcpDatagram_Create(void) } else { - SolidSyslog_Error( + PlusTcpDatagram_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &PlusTcpDatagramErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) PLUSTCPDATAGRAM_ERROR_POOL_EXHAUSTED + PLUSTCPDATAGRAM_ERROR_POOL_EXHAUSTED ); } return handle; @@ -54,11 +53,10 @@ void SolidSyslogPlusTcpDatagram_Destroy(struct SolidSyslogDatagram* base) SolidSyslogPoolAllocator_FreeIfInUse(&PlusTcpDatagram_Allocator, index, PlusTcpDatagram_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + PlusTcpDatagram_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &PlusTcpDatagramErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) PLUSTCPDATAGRAM_ERROR_UNKNOWN_DESTROY + PLUSTCPDATAGRAM_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolverPrivate.h b/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolverPrivate.h index 709f9770..9c957071 100644 --- a/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolverPrivate.h +++ b/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolverPrivate.h @@ -1,6 +1,11 @@ #ifndef SOLIDSYSLOGPLUSTCPRESOLVERPRIVATE_H #define SOLIDSYSLOGPLUSTCPRESOLVERPRIVATE_H +#include + +#include "SolidSyslogError.h" +#include "SolidSyslogPlusTcpResolverErrors.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogResolverDefinition.h" struct SolidSyslogPlusTcpResolver @@ -11,4 +16,13 @@ struct SolidSyslogPlusTcpResolver void PlusTcpResolver_Initialise(struct SolidSyslogResolver* base); void PlusTcpResolver_Cleanup(struct SolidSyslogResolver* base); +static inline void PlusTcpResolver_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogPlusTcpResolverErrors code +) +{ + SolidSyslog_Error(severity, &PlusTcpResolverErrorSource, category, code); +} + #endif /* SOLIDSYSLOGPLUSTCPRESOLVERPRIVATE_H */ diff --git a/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolverStatic.c b/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolverStatic.c index b8cb6cb7..110777fa 100644 --- a/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolverStatic.c +++ b/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolverStatic.c @@ -36,11 +36,10 @@ struct SolidSyslogResolver* SolidSyslogPlusTcpResolver_Create(void) } else { - SolidSyslog_Error( + PlusTcpResolver_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &PlusTcpResolverErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) PLUSTCPRESOLVER_ERROR_POOL_EXHAUSTED + PLUSTCPRESOLVER_ERROR_POOL_EXHAUSTED ); } return handle; @@ -54,11 +53,10 @@ void SolidSyslogPlusTcpResolver_Destroy(struct SolidSyslogResolver* base) SolidSyslogPoolAllocator_FreeIfInUse(&PlusTcpResolver_Allocator, index, PlusTcpResolver_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + PlusTcpResolver_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &PlusTcpResolverErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) PLUSTCPRESOLVER_ERROR_UNKNOWN_DESTROY + PLUSTCPRESOLVER_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStreamPrivate.h b/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStreamPrivate.h index d315cfc0..559e2022 100644 --- a/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStreamPrivate.h +++ b/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStreamPrivate.h @@ -1,6 +1,11 @@ #ifndef SOLIDSYSLOGPLUSTCPTCPSTREAMPRIVATE_H #define SOLIDSYSLOGPLUSTCPTCPSTREAMPRIVATE_H +#include +#include "SolidSyslogError.h" +#include "SolidSyslogPrival.h" +#include "SolidSyslogPlusTcpTcpStreamErrors.h" + #include "FreeRTOS.h" #include "FreeRTOS_Sockets.h" @@ -20,4 +25,13 @@ void PlusTcpTcpStream_Initialise( ); void PlusTcpTcpStream_Cleanup(struct SolidSyslogStream* base); +static inline void PlusTcpTcpStream_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogPlusTcpTcpStreamErrors code +) +{ + SolidSyslog_Error(severity, &PlusTcpTcpStreamErrorSource, category, code); +} + #endif /* SOLIDSYSLOGPLUSTCPTCPSTREAMPRIVATE_H */ diff --git a/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStreamStatic.c b/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStreamStatic.c index 53e6b633..9df4e860 100644 --- a/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStreamStatic.c +++ b/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStreamStatic.c @@ -36,11 +36,10 @@ struct SolidSyslogStream* SolidSyslogPlusTcpTcpStream_Create(const struct SolidS } else { - SolidSyslog_Error( + PlusTcpTcpStream_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &PlusTcpTcpStreamErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) PLUSTCPTCPSTREAM_ERROR_POOL_EXHAUSTED + PLUSTCPTCPSTREAM_ERROR_POOL_EXHAUSTED ); } return handle; @@ -54,11 +53,10 @@ void SolidSyslogPlusTcpTcpStream_Destroy(struct SolidSyslogStream* base) SolidSyslogPoolAllocator_FreeIfInUse(&PlusTcpTcpStream_Allocator, index, PlusTcpTcpStream_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + PlusTcpTcpStream_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &PlusTcpTcpStreamErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) PLUSTCPTCPSTREAM_ERROR_UNKNOWN_DESTROY + PLUSTCPTCPSTREAM_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/Posix/Source/SolidSyslogGetAddrInfoResolverPrivate.h b/Platform/Posix/Source/SolidSyslogGetAddrInfoResolverPrivate.h index 2aeb8df6..9d552733 100644 --- a/Platform/Posix/Source/SolidSyslogGetAddrInfoResolverPrivate.h +++ b/Platform/Posix/Source/SolidSyslogGetAddrInfoResolverPrivate.h @@ -1,6 +1,11 @@ #ifndef SOLIDSYSLOGGETADDRINFORESOLVERPRIVATE_H #define SOLIDSYSLOGGETADDRINFORESOLVERPRIVATE_H +#include + +#include "SolidSyslogError.h" +#include "SolidSyslogGetAddrInfoResolverErrors.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogResolverDefinition.h" struct SolidSyslogGetAddrInfoResolver @@ -11,4 +16,13 @@ struct SolidSyslogGetAddrInfoResolver void GetAddrInfoResolver_Initialise(struct SolidSyslogResolver* base); void GetAddrInfoResolver_Cleanup(struct SolidSyslogResolver* base); +static inline void GetAddrInfoResolver_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogGetAddrInfoResolverErrors code +) +{ + SolidSyslog_Error(severity, &GetAddrInfoResolverErrorSource, category, code); +} + #endif /* SOLIDSYSLOGGETADDRINFORESOLVERPRIVATE_H */ diff --git a/Platform/Posix/Source/SolidSyslogGetAddrInfoResolverStatic.c b/Platform/Posix/Source/SolidSyslogGetAddrInfoResolverStatic.c index 4778f430..ad0d2724 100644 --- a/Platform/Posix/Source/SolidSyslogGetAddrInfoResolverStatic.c +++ b/Platform/Posix/Source/SolidSyslogGetAddrInfoResolverStatic.c @@ -36,11 +36,10 @@ struct SolidSyslogResolver* SolidSyslogGetAddrInfoResolver_Create(void) } else { - SolidSyslog_Error( + GetAddrInfoResolver_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &GetAddrInfoResolverErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) GETADDRINFORESOLVER_ERROR_POOL_EXHAUSTED + GETADDRINFORESOLVER_ERROR_POOL_EXHAUSTED ); } return handle; @@ -58,11 +57,10 @@ void SolidSyslogGetAddrInfoResolver_Destroy(struct SolidSyslogResolver* base) ); if (!released) { - SolidSyslog_Error( + GetAddrInfoResolver_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &GetAddrInfoResolverErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) GETADDRINFORESOLVER_ERROR_UNKNOWN_DESTROY + GETADDRINFORESOLVER_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/Posix/Source/SolidSyslogPosixAddressPrivate.h b/Platform/Posix/Source/SolidSyslogPosixAddressPrivate.h index 30cf79fa..369c9b4d 100644 --- a/Platform/Posix/Source/SolidSyslogPosixAddressPrivate.h +++ b/Platform/Posix/Source/SolidSyslogPosixAddressPrivate.h @@ -1,6 +1,10 @@ #ifndef SOLIDSYSLOGPOSIXADDRESSPRIVATE_H #define SOLIDSYSLOGPOSIXADDRESSPRIVATE_H +#include "SolidSyslogError.h" +#include "SolidSyslogPrival.h" +#include "SolidSyslogPosixAddressErrors.h" + #include #include @@ -24,4 +28,13 @@ static inline const struct sockaddr_in* SolidSyslogPosixAddress_AsConstSockaddrI return &((const struct SolidSyslogPosixAddress*) base)->Sockaddr; } +static inline void PosixAddress_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogPosixAddressErrors code +) +{ + SolidSyslog_Error(severity, &PosixAddressErrorSource, category, code); +} + #endif /* SOLIDSYSLOGPOSIXADDRESSPRIVATE_H */ diff --git a/Platform/Posix/Source/SolidSyslogPosixAddressStatic.c b/Platform/Posix/Source/SolidSyslogPosixAddressStatic.c index 804ad8cb..ac82bbc3 100644 --- a/Platform/Posix/Source/SolidSyslogPosixAddressStatic.c +++ b/Platform/Posix/Source/SolidSyslogPosixAddressStatic.c @@ -40,11 +40,10 @@ struct SolidSyslogAddress* SolidSyslogPosixAddress_Create(void) } else { - SolidSyslog_Error( + PosixAddress_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &PosixAddressErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) POSIXADDRESS_ERROR_POOL_EXHAUSTED + POSIXADDRESS_ERROR_POOL_EXHAUSTED ); } return handle; @@ -64,11 +63,10 @@ void SolidSyslogPosixAddress_Destroy(struct SolidSyslogAddress* base) SolidSyslogPoolAllocator_FreeIfInUse(&PosixAddress_Allocator, index, PosixAddress_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + PosixAddress_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &PosixAddressErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) POSIXADDRESS_ERROR_UNKNOWN_DESTROY + POSIXADDRESS_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/Posix/Source/SolidSyslogPosixDatagramPrivate.h b/Platform/Posix/Source/SolidSyslogPosixDatagramPrivate.h index bf9951c8..5b74aacc 100644 --- a/Platform/Posix/Source/SolidSyslogPosixDatagramPrivate.h +++ b/Platform/Posix/Source/SolidSyslogPosixDatagramPrivate.h @@ -1,9 +1,14 @@ #ifndef SOLIDSYSLOGPOSIXDATAGRAMPRIVATE_H #define SOLIDSYSLOGPOSIXDATAGRAMPRIVATE_H +#include + #include #include "SolidSyslogDatagramDefinition.h" +#include "SolidSyslogError.h" +#include "SolidSyslogPosixDatagramErrors.h" +#include "SolidSyslogPrival.h" struct SolidSyslogPosixDatagram { @@ -15,4 +20,13 @@ struct SolidSyslogPosixDatagram void PosixDatagram_Initialise(struct SolidSyslogDatagram* base); void PosixDatagram_Cleanup(struct SolidSyslogDatagram* base); +static inline void PosixDatagram_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogPosixDatagramErrors code +) +{ + SolidSyslog_Error(severity, &PosixDatagramErrorSource, category, code); +} + #endif /* SOLIDSYSLOGPOSIXDATAGRAMPRIVATE_H */ diff --git a/Platform/Posix/Source/SolidSyslogPosixDatagramStatic.c b/Platform/Posix/Source/SolidSyslogPosixDatagramStatic.c index bd096ed1..d84ff2d9 100644 --- a/Platform/Posix/Source/SolidSyslogPosixDatagramStatic.c +++ b/Platform/Posix/Source/SolidSyslogPosixDatagramStatic.c @@ -33,11 +33,10 @@ struct SolidSyslogDatagram* SolidSyslogPosixDatagram_Create(void) } else { - SolidSyslog_Error( + PosixDatagram_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &PosixDatagramErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) POSIXDATAGRAM_ERROR_POOL_EXHAUSTED + POSIXDATAGRAM_ERROR_POOL_EXHAUSTED ); } return handle; @@ -51,11 +50,10 @@ void SolidSyslogPosixDatagram_Destroy(struct SolidSyslogDatagram* base) SolidSyslogPoolAllocator_FreeIfInUse(&PosixDatagram_Allocator, index, PosixDatagram_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + PosixDatagram_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &PosixDatagramErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) POSIXDATAGRAM_ERROR_UNKNOWN_DESTROY + POSIXDATAGRAM_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/Posix/Source/SolidSyslogPosixFilePrivate.h b/Platform/Posix/Source/SolidSyslogPosixFilePrivate.h index 2ed3b584..cb36a963 100644 --- a/Platform/Posix/Source/SolidSyslogPosixFilePrivate.h +++ b/Platform/Posix/Source/SolidSyslogPosixFilePrivate.h @@ -1,7 +1,12 @@ #ifndef SOLIDSYSLOGPOSIXFILEPRIVATE_H #define SOLIDSYSLOGPOSIXFILEPRIVATE_H +#include + +#include "SolidSyslogError.h" #include "SolidSyslogFileDefinition.h" +#include "SolidSyslogPosixFileErrors.h" +#include "SolidSyslogPrival.h" struct SolidSyslogPosixFile { @@ -12,4 +17,13 @@ struct SolidSyslogPosixFile void PosixFile_Initialise(struct SolidSyslogFile* base); void PosixFile_Cleanup(struct SolidSyslogFile* base); +static inline void PosixFile_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogPosixFileErrors code +) +{ + SolidSyslog_Error(severity, &PosixFileErrorSource, category, code); +} + #endif /* SOLIDSYSLOGPOSIXFILEPRIVATE_H */ diff --git a/Platform/Posix/Source/SolidSyslogPosixFileStatic.c b/Platform/Posix/Source/SolidSyslogPosixFileStatic.c index 0a4a7825..90bf52f3 100644 --- a/Platform/Posix/Source/SolidSyslogPosixFileStatic.c +++ b/Platform/Posix/Source/SolidSyslogPosixFileStatic.c @@ -33,12 +33,7 @@ struct SolidSyslogFile* SolidSyslogPosixFile_Create(void) } else { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_ERROR, - &PosixFileErrorSource, - SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) POSIXFILE_ERROR_POOL_EXHAUSTED - ); + PosixFile_Report(SOLIDSYSLOG_SEVERITY_ERROR, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, POSIXFILE_ERROR_POOL_EXHAUSTED); } return handle; } @@ -50,11 +45,10 @@ void SolidSyslogPosixFile_Destroy(struct SolidSyslogFile* base) SolidSyslogPoolAllocator_FreeIfInUse(&PosixFile_Allocator, index, PosixFile_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + PosixFile_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &PosixFileErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) POSIXFILE_ERROR_UNKNOWN_DESTROY + POSIXFILE_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/Posix/Source/SolidSyslogPosixMessageQueueBuffer.c b/Platform/Posix/Source/SolidSyslogPosixMessageQueueBuffer.c index 209437b0..f7bc5dda 100644 --- a/Platform/Posix/Source/SolidSyslogPosixMessageQueueBuffer.c +++ b/Platform/Posix/Source/SolidSyslogPosixMessageQueueBuffer.c @@ -101,11 +101,10 @@ static bool PosixMessageQueueBuffer_Read(struct SolidSyslogBuffer* base, void* d int receiveErrno = success ? 0 : errno; if (!success && (receiveErrno != EAGAIN)) { - SolidSyslog_Error( + PosixMessageQueueBuffer_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &PosixMessageQueueBufferErrorSource, SOLIDSYSLOG_CAT_BUFFER_BACKEND_FAILED, - (int32_t) POSIXMESSAGEQUEUEBUFFER_ERROR_RECEIVE_FAILED + POSIXMESSAGEQUEUEBUFFER_ERROR_RECEIVE_FAILED ); } @@ -119,11 +118,10 @@ static void PosixMessageQueueBuffer_Write(struct SolidSyslogBuffer* base, const struct SolidSyslogPosixMessageQueueBuffer* self = PosixMessageQueueBuffer_SelfFromBase(base); if (mq_send(self->Mq, data, size, 0) != 0) { - SolidSyslog_Error( + PosixMessageQueueBuffer_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &PosixMessageQueueBufferErrorSource, SOLIDSYSLOG_CAT_BUFFER_BACKEND_FAILED, - (int32_t) POSIXMESSAGEQUEUEBUFFER_ERROR_SEND_FAILED + POSIXMESSAGEQUEUEBUFFER_ERROR_SEND_FAILED ); } } diff --git a/Platform/Posix/Source/SolidSyslogPosixMessageQueueBufferPrivate.h b/Platform/Posix/Source/SolidSyslogPosixMessageQueueBufferPrivate.h index f1be91bd..acd9f0e3 100644 --- a/Platform/Posix/Source/SolidSyslogPosixMessageQueueBufferPrivate.h +++ b/Platform/Posix/Source/SolidSyslogPosixMessageQueueBufferPrivate.h @@ -1,12 +1,17 @@ #ifndef SOLIDSYSLOGPOSIXMESSAGEQUEUEBUFFERPRIVATE_H #define SOLIDSYSLOGPOSIXMESSAGEQUEUEBUFFERPRIVATE_H +#include + #include #include #include #include "SolidSyslogBufferDefinition.h" +#include "SolidSyslogError.h" #include "SolidSyslogFormatter.h" +#include "SolidSyslogPosixMessageQueueBufferErrors.h" +#include "SolidSyslogPrival.h" enum { @@ -30,4 +35,13 @@ bool PosixMessageQueueBuffer_Initialise( ); void PosixMessageQueueBuffer_Cleanup(struct SolidSyslogBuffer* base); +static inline void PosixMessageQueueBuffer_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogPosixMessageQueueBufferErrors code +) +{ + SolidSyslog_Error(severity, &PosixMessageQueueBufferErrorSource, category, code); +} + #endif /* SOLIDSYSLOGPOSIXMESSAGEQUEUEBUFFERPRIVATE_H */ diff --git a/Platform/Posix/Source/SolidSyslogPosixMessageQueueBufferStatic.c b/Platform/Posix/Source/SolidSyslogPosixMessageQueueBufferStatic.c index 963d3cc1..820f08b6 100644 --- a/Platform/Posix/Source/SolidSyslogPosixMessageQueueBufferStatic.c +++ b/Platform/Posix/Source/SolidSyslogPosixMessageQueueBufferStatic.c @@ -57,21 +57,19 @@ struct SolidSyslogBuffer* SolidSyslogPosixMessageQueueBuffer_Create(size_t maxMe PosixMessageQueueBuffer_CleanupAtIndex, NULL ); - SolidSyslog_Error( + PosixMessageQueueBuffer_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &PosixMessageQueueBufferErrorSource, SOLIDSYSLOG_CAT_BUFFER_BACKEND_FAILED, - (int32_t) POSIXMESSAGEQUEUEBUFFER_ERROR_MQ_OPEN_FAILED + POSIXMESSAGEQUEUEBUFFER_ERROR_MQ_OPEN_FAILED ); } } else { - SolidSyslog_Error( + PosixMessageQueueBuffer_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &PosixMessageQueueBufferErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) POSIXMESSAGEQUEUEBUFFER_ERROR_POOL_EXHAUSTED + POSIXMESSAGEQUEUEBUFFER_ERROR_POOL_EXHAUSTED ); } return handle; @@ -89,11 +87,10 @@ void SolidSyslogPosixMessageQueueBuffer_Destroy(struct SolidSyslogBuffer* base) ); if (!released) { - SolidSyslog_Error( + PosixMessageQueueBuffer_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &PosixMessageQueueBufferErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) POSIXMESSAGEQUEUEBUFFER_ERROR_UNKNOWN_DESTROY + POSIXMESSAGEQUEUEBUFFER_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/Posix/Source/SolidSyslogPosixMutexPrivate.h b/Platform/Posix/Source/SolidSyslogPosixMutexPrivate.h index 94e9b87e..e170ddfe 100644 --- a/Platform/Posix/Source/SolidSyslogPosixMutexPrivate.h +++ b/Platform/Posix/Source/SolidSyslogPosixMutexPrivate.h @@ -1,9 +1,14 @@ #ifndef SOLIDSYSLOGPOSIXMUTEXPRIVATE_H #define SOLIDSYSLOGPOSIXMUTEXPRIVATE_H +#include + #include +#include "SolidSyslogError.h" #include "SolidSyslogMutexDefinition.h" +#include "SolidSyslogPosixMutexErrors.h" +#include "SolidSyslogPrival.h" struct SolidSyslogPosixMutex { @@ -14,4 +19,13 @@ struct SolidSyslogPosixMutex void PosixMutex_Initialise(struct SolidSyslogMutex* base); void PosixMutex_Cleanup(struct SolidSyslogMutex* base); +static inline void PosixMutex_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogPosixMutexErrors code +) +{ + SolidSyslog_Error(severity, &PosixMutexErrorSource, category, code); +} + #endif /* SOLIDSYSLOGPOSIXMUTEXPRIVATE_H */ diff --git a/Platform/Posix/Source/SolidSyslogPosixMutexStatic.c b/Platform/Posix/Source/SolidSyslogPosixMutexStatic.c index 5a799930..ac953c05 100644 --- a/Platform/Posix/Source/SolidSyslogPosixMutexStatic.c +++ b/Platform/Posix/Source/SolidSyslogPosixMutexStatic.c @@ -33,12 +33,7 @@ struct SolidSyslogMutex* SolidSyslogPosixMutex_Create(void) } else { - SolidSyslog_Error( - SOLIDSYSLOG_SEVERITY_ERROR, - &PosixMutexErrorSource, - SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) POSIXMUTEX_ERROR_POOL_EXHAUSTED - ); + PosixMutex_Report(SOLIDSYSLOG_SEVERITY_ERROR, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, POSIXMUTEX_ERROR_POOL_EXHAUSTED); } return handle; } @@ -50,11 +45,10 @@ void SolidSyslogPosixMutex_Destroy(struct SolidSyslogMutex* base) SolidSyslogPoolAllocator_FreeIfInUse(&PosixMutex_Allocator, index, PosixMutex_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + PosixMutex_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &PosixMutexErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) POSIXMUTEX_ERROR_UNKNOWN_DESTROY + POSIXMUTEX_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/Posix/Source/SolidSyslogPosixTcpStreamPrivate.h b/Platform/Posix/Source/SolidSyslogPosixTcpStreamPrivate.h index 8cc5f9d4..e975ceee 100644 --- a/Platform/Posix/Source/SolidSyslogPosixTcpStreamPrivate.h +++ b/Platform/Posix/Source/SolidSyslogPosixTcpStreamPrivate.h @@ -1,7 +1,12 @@ #ifndef SOLIDSYSLOGPOSIXTCPSTREAMPRIVATE_H #define SOLIDSYSLOGPOSIXTCPSTREAMPRIVATE_H +#include + +#include "SolidSyslogError.h" #include "SolidSyslogPosixTcpStream.h" +#include "SolidSyslogPosixTcpStreamErrors.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogStreamDefinition.h" struct SolidSyslogPosixTcpStream @@ -14,4 +19,13 @@ struct SolidSyslogPosixTcpStream void PosixTcpStream_Initialise(struct SolidSyslogStream* base, const struct SolidSyslogPosixTcpStreamConfig* config); void PosixTcpStream_Cleanup(struct SolidSyslogStream* base); +static inline void PosixTcpStream_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogPosixTcpStreamErrors code +) +{ + SolidSyslog_Error(severity, &PosixTcpStreamErrorSource, category, code); +} + #endif /* SOLIDSYSLOGPOSIXTCPSTREAMPRIVATE_H */ diff --git a/Platform/Posix/Source/SolidSyslogPosixTcpStreamStatic.c b/Platform/Posix/Source/SolidSyslogPosixTcpStreamStatic.c index 6ab278e9..a7114a9d 100644 --- a/Platform/Posix/Source/SolidSyslogPosixTcpStreamStatic.c +++ b/Platform/Posix/Source/SolidSyslogPosixTcpStreamStatic.c @@ -36,11 +36,10 @@ struct SolidSyslogStream* SolidSyslogPosixTcpStream_Create(const struct SolidSys } else { - SolidSyslog_Error( + PosixTcpStream_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &PosixTcpStreamErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) POSIXTCPSTREAM_ERROR_POOL_EXHAUSTED + POSIXTCPSTREAM_ERROR_POOL_EXHAUSTED ); } return handle; @@ -54,11 +53,10 @@ void SolidSyslogPosixTcpStream_Destroy(struct SolidSyslogStream* base) SolidSyslogPoolAllocator_FreeIfInUse(&PosixTcpStream_Allocator, index, PosixTcpStream_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + PosixTcpStream_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &PosixTcpStreamErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) POSIXTCPSTREAM_ERROR_UNKNOWN_DESTROY + POSIXTCPSTREAM_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/Windows/Source/SolidSyslogWindowsAtomicCounterPrivate.h b/Platform/Windows/Source/SolidSyslogWindowsAtomicCounterPrivate.h index e6dceff7..6f02b51e 100644 --- a/Platform/Windows/Source/SolidSyslogWindowsAtomicCounterPrivate.h +++ b/Platform/Windows/Source/SolidSyslogWindowsAtomicCounterPrivate.h @@ -5,6 +5,9 @@ #include #include "SolidSyslogAtomicCounterDefinition.h" +#include "SolidSyslogError.h" +#include "SolidSyslogPrival.h" +#include "SolidSyslogWindowsAtomicCounterErrors.h" struct SolidSyslogWindowsAtomicCounter { @@ -15,4 +18,13 @@ struct SolidSyslogWindowsAtomicCounter void WindowsAtomicCounter_Initialise(struct SolidSyslogAtomicCounter* base); void WindowsAtomicCounter_Cleanup(struct SolidSyslogAtomicCounter* base); +static inline void WindowsAtomicCounter_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogWindowsAtomicCounterErrors code +) +{ + SolidSyslog_Error(severity, &WindowsAtomicCounterErrorSource, category, code); +} + #endif /* SOLIDSYSLOGWINDOWSATOMICCOUNTERPRIVATE_H */ diff --git a/Platform/Windows/Source/SolidSyslogWindowsAtomicCounterStatic.c b/Platform/Windows/Source/SolidSyslogWindowsAtomicCounterStatic.c index 6e5d259c..87fa3824 100644 --- a/Platform/Windows/Source/SolidSyslogWindowsAtomicCounterStatic.c +++ b/Platform/Windows/Source/SolidSyslogWindowsAtomicCounterStatic.c @@ -36,11 +36,10 @@ struct SolidSyslogAtomicCounter* SolidSyslogWindowsAtomicCounter_Create(void) } else { - SolidSyslog_Error( + WindowsAtomicCounter_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &WindowsAtomicCounterErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) WINDOWSATOMICCOUNTER_ERROR_POOL_EXHAUSTED + WINDOWSATOMICCOUNTER_ERROR_POOL_EXHAUSTED ); } return handle; @@ -58,11 +57,10 @@ void SolidSyslogWindowsAtomicCounter_Destroy(struct SolidSyslogAtomicCounter* ba ); if (!released) { - SolidSyslog_Error( + WindowsAtomicCounter_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &WindowsAtomicCounterErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) WINDOWSATOMICCOUNTER_ERROR_UNKNOWN_DESTROY + WINDOWSATOMICCOUNTER_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/Windows/Source/SolidSyslogWindowsFilePrivate.h b/Platform/Windows/Source/SolidSyslogWindowsFilePrivate.h index 494fc1c9..074b7ab0 100644 --- a/Platform/Windows/Source/SolidSyslogWindowsFilePrivate.h +++ b/Platform/Windows/Source/SolidSyslogWindowsFilePrivate.h @@ -1,7 +1,12 @@ #ifndef SOLIDSYSLOGWINDOWSFILEPRIVATE_H #define SOLIDSYSLOGWINDOWSFILEPRIVATE_H +#include + +#include "SolidSyslogError.h" #include "SolidSyslogFileDefinition.h" +#include "SolidSyslogPrival.h" +#include "SolidSyslogWindowsFileErrors.h" struct SolidSyslogWindowsFile { @@ -12,4 +17,13 @@ struct SolidSyslogWindowsFile void WindowsFile_Initialise(struct SolidSyslogFile* base); void WindowsFile_Cleanup(struct SolidSyslogFile* base); +static inline void WindowsFile_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogWindowsFileErrors code +) +{ + SolidSyslog_Error(severity, &WindowsFileErrorSource, category, code); +} + #endif /* SOLIDSYSLOGWINDOWSFILEPRIVATE_H */ diff --git a/Platform/Windows/Source/SolidSyslogWindowsFileStatic.c b/Platform/Windows/Source/SolidSyslogWindowsFileStatic.c index 2df449cd..8d38e4e1 100644 --- a/Platform/Windows/Source/SolidSyslogWindowsFileStatic.c +++ b/Platform/Windows/Source/SolidSyslogWindowsFileStatic.c @@ -33,11 +33,10 @@ struct SolidSyslogFile* SolidSyslogWindowsFile_Create(void) } else { - SolidSyslog_Error( + WindowsFile_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &WindowsFileErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) WINDOWSFILE_ERROR_POOL_EXHAUSTED + WINDOWSFILE_ERROR_POOL_EXHAUSTED ); } return handle; @@ -51,11 +50,10 @@ void SolidSyslogWindowsFile_Destroy(struct SolidSyslogFile* base) SolidSyslogPoolAllocator_FreeIfInUse(&WindowsFile_Allocator, index, WindowsFile_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + WindowsFile_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &WindowsFileErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) WINDOWSFILE_ERROR_UNKNOWN_DESTROY + WINDOWSFILE_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/Windows/Source/SolidSyslogWindowsMutexPrivate.h b/Platform/Windows/Source/SolidSyslogWindowsMutexPrivate.h index 899f9543..597fd830 100644 --- a/Platform/Windows/Source/SolidSyslogWindowsMutexPrivate.h +++ b/Platform/Windows/Source/SolidSyslogWindowsMutexPrivate.h @@ -1,9 +1,14 @@ #ifndef SOLIDSYSLOGWINDOWSMUTEXPRIVATE_H #define SOLIDSYSLOGWINDOWSMUTEXPRIVATE_H +#include + #include +#include "SolidSyslogError.h" #include "SolidSyslogMutexDefinition.h" +#include "SolidSyslogPrival.h" +#include "SolidSyslogWindowsMutexErrors.h" struct SolidSyslogWindowsMutex { @@ -14,4 +19,13 @@ struct SolidSyslogWindowsMutex void WindowsMutex_Initialise(struct SolidSyslogMutex* base); void WindowsMutex_Cleanup(struct SolidSyslogMutex* base); +static inline void WindowsMutex_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogWindowsMutexErrors code +) +{ + SolidSyslog_Error(severity, &WindowsMutexErrorSource, category, code); +} + #endif /* SOLIDSYSLOGWINDOWSMUTEXPRIVATE_H */ diff --git a/Platform/Windows/Source/SolidSyslogWindowsMutexStatic.c b/Platform/Windows/Source/SolidSyslogWindowsMutexStatic.c index e3e288d3..b1e76368 100644 --- a/Platform/Windows/Source/SolidSyslogWindowsMutexStatic.c +++ b/Platform/Windows/Source/SolidSyslogWindowsMutexStatic.c @@ -33,11 +33,10 @@ struct SolidSyslogMutex* SolidSyslogWindowsMutex_Create(void) } else { - SolidSyslog_Error( + WindowsMutex_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &WindowsMutexErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) WINDOWSMUTEX_ERROR_POOL_EXHAUSTED + WINDOWSMUTEX_ERROR_POOL_EXHAUSTED ); } return handle; @@ -51,11 +50,10 @@ void SolidSyslogWindowsMutex_Destroy(struct SolidSyslogMutex* base) SolidSyslogPoolAllocator_FreeIfInUse(&WindowsMutex_Allocator, index, WindowsMutex_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + WindowsMutex_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &WindowsMutexErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) WINDOWSMUTEX_ERROR_UNKNOWN_DESTROY + WINDOWSMUTEX_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/Windows/Source/SolidSyslogWinsockAddressPrivate.h b/Platform/Windows/Source/SolidSyslogWinsockAddressPrivate.h index 8df1e233..51445432 100644 --- a/Platform/Windows/Source/SolidSyslogWinsockAddressPrivate.h +++ b/Platform/Windows/Source/SolidSyslogWinsockAddressPrivate.h @@ -1,6 +1,10 @@ #ifndef SOLIDSYSLOGWINSOCKADDRESSPRIVATE_H #define SOLIDSYSLOGWINSOCKADDRESSPRIVATE_H +#include "SolidSyslogError.h" +#include "SolidSyslogPrival.h" +#include "SolidSyslogWinsockAddressErrors.h" + #include #include @@ -26,4 +30,13 @@ static inline const struct sockaddr_in* SolidSyslogWinsockAddress_AsConstSockadd return &((const struct SolidSyslogWinsockAddress*) base)->Sockaddr; } +static inline void WinsockAddress_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogWinsockAddressErrors code +) +{ + SolidSyslog_Error(severity, &WinsockAddressErrorSource, category, code); +} + #endif /* SOLIDSYSLOGWINSOCKADDRESSPRIVATE_H */ diff --git a/Platform/Windows/Source/SolidSyslogWinsockAddressStatic.c b/Platform/Windows/Source/SolidSyslogWinsockAddressStatic.c index 0f8e958a..5585f502 100644 --- a/Platform/Windows/Source/SolidSyslogWinsockAddressStatic.c +++ b/Platform/Windows/Source/SolidSyslogWinsockAddressStatic.c @@ -40,11 +40,10 @@ struct SolidSyslogAddress* SolidSyslogWinsockAddress_Create(void) } else { - SolidSyslog_Error( + WinsockAddress_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &WinsockAddressErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) WINSOCKADDRESS_ERROR_POOL_EXHAUSTED + WINSOCKADDRESS_ERROR_POOL_EXHAUSTED ); } return handle; @@ -64,11 +63,10 @@ void SolidSyslogWinsockAddress_Destroy(struct SolidSyslogAddress* base) SolidSyslogPoolAllocator_FreeIfInUse(&WinsockAddress_Allocator, index, WinsockAddress_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + WinsockAddress_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &WinsockAddressErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) WINSOCKADDRESS_ERROR_UNKNOWN_DESTROY + WINSOCKADDRESS_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/Windows/Source/SolidSyslogWinsockDatagramPrivate.h b/Platform/Windows/Source/SolidSyslogWinsockDatagramPrivate.h index 728b78ec..022be341 100644 --- a/Platform/Windows/Source/SolidSyslogWinsockDatagramPrivate.h +++ b/Platform/Windows/Source/SolidSyslogWinsockDatagramPrivate.h @@ -1,10 +1,15 @@ #ifndef SOLIDSYSLOGWINSOCKDATAGRAMPRIVATE_H #define SOLIDSYSLOGWINSOCKDATAGRAMPRIVATE_H +#include + #include #include #include "SolidSyslogDatagramDefinition.h" +#include "SolidSyslogError.h" +#include "SolidSyslogPrival.h" +#include "SolidSyslogWinsockDatagramErrors.h" struct SolidSyslogWinsockDatagram { @@ -16,4 +21,13 @@ struct SolidSyslogWinsockDatagram void WinsockDatagram_Initialise(struct SolidSyslogDatagram* base); void WinsockDatagram_Cleanup(struct SolidSyslogDatagram* base); +static inline void WinsockDatagram_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogWinsockDatagramErrors code +) +{ + SolidSyslog_Error(severity, &WinsockDatagramErrorSource, category, code); +} + #endif /* SOLIDSYSLOGWINSOCKDATAGRAMPRIVATE_H */ diff --git a/Platform/Windows/Source/SolidSyslogWinsockDatagramStatic.c b/Platform/Windows/Source/SolidSyslogWinsockDatagramStatic.c index ad1ae23d..ee3feb6d 100644 --- a/Platform/Windows/Source/SolidSyslogWinsockDatagramStatic.c +++ b/Platform/Windows/Source/SolidSyslogWinsockDatagramStatic.c @@ -36,11 +36,10 @@ struct SolidSyslogDatagram* SolidSyslogWinsockDatagram_Create(void) } else { - SolidSyslog_Error( + WinsockDatagram_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &WinsockDatagramErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) WINSOCKDATAGRAM_ERROR_POOL_EXHAUSTED + WINSOCKDATAGRAM_ERROR_POOL_EXHAUSTED ); } return handle; @@ -54,11 +53,10 @@ void SolidSyslogWinsockDatagram_Destroy(struct SolidSyslogDatagram* base) SolidSyslogPoolAllocator_FreeIfInUse(&WinsockDatagram_Allocator, index, WinsockDatagram_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + WinsockDatagram_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &WinsockDatagramErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) WINSOCKDATAGRAM_ERROR_UNKNOWN_DESTROY + WINSOCKDATAGRAM_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/Windows/Source/SolidSyslogWinsockResolverPrivate.h b/Platform/Windows/Source/SolidSyslogWinsockResolverPrivate.h index 702692c9..f73f7d35 100644 --- a/Platform/Windows/Source/SolidSyslogWinsockResolverPrivate.h +++ b/Platform/Windows/Source/SolidSyslogWinsockResolverPrivate.h @@ -1,7 +1,12 @@ #ifndef SOLIDSYSLOGWINSOCKRESOLVERPRIVATE_H #define SOLIDSYSLOGWINSOCKRESOLVERPRIVATE_H +#include + +#include "SolidSyslogError.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogResolverDefinition.h" +#include "SolidSyslogWinsockResolverErrors.h" struct SolidSyslogWinsockResolver { @@ -11,4 +16,13 @@ struct SolidSyslogWinsockResolver void WinsockResolver_Initialise(struct SolidSyslogResolver* base); void WinsockResolver_Cleanup(struct SolidSyslogResolver* base); +static inline void WinsockResolver_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogWinsockResolverErrors code +) +{ + SolidSyslog_Error(severity, &WinsockResolverErrorSource, category, code); +} + #endif /* SOLIDSYSLOGWINSOCKRESOLVERPRIVATE_H */ diff --git a/Platform/Windows/Source/SolidSyslogWinsockResolverStatic.c b/Platform/Windows/Source/SolidSyslogWinsockResolverStatic.c index b449abcb..b825b047 100644 --- a/Platform/Windows/Source/SolidSyslogWinsockResolverStatic.c +++ b/Platform/Windows/Source/SolidSyslogWinsockResolverStatic.c @@ -36,11 +36,10 @@ struct SolidSyslogResolver* SolidSyslogWinsockResolver_Create(void) } else { - SolidSyslog_Error( + WinsockResolver_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &WinsockResolverErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) WINSOCKRESOLVER_ERROR_POOL_EXHAUSTED + WINSOCKRESOLVER_ERROR_POOL_EXHAUSTED ); } return handle; @@ -54,11 +53,10 @@ void SolidSyslogWinsockResolver_Destroy(struct SolidSyslogResolver* base) SolidSyslogPoolAllocator_FreeIfInUse(&WinsockResolver_Allocator, index, WinsockResolver_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + WinsockResolver_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &WinsockResolverErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) WINSOCKRESOLVER_ERROR_UNKNOWN_DESTROY + WINSOCKRESOLVER_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Platform/Windows/Source/SolidSyslogWinsockTcpStreamPrivate.h b/Platform/Windows/Source/SolidSyslogWinsockTcpStreamPrivate.h index 492f6822..a2b1ea52 100644 --- a/Platform/Windows/Source/SolidSyslogWinsockTcpStreamPrivate.h +++ b/Platform/Windows/Source/SolidSyslogWinsockTcpStreamPrivate.h @@ -1,10 +1,15 @@ #ifndef SOLIDSYSLOGWINSOCKTCPSTREAMPRIVATE_H #define SOLIDSYSLOGWINSOCKTCPSTREAMPRIVATE_H +#include + #include +#include "SolidSyslogError.h" +#include "SolidSyslogPrival.h" #include "SolidSyslogStreamDefinition.h" #include "SolidSyslogWinsockTcpStream.h" +#include "SolidSyslogWinsockTcpStreamErrors.h" struct SolidSyslogWinsockTcpStream { @@ -19,4 +24,13 @@ void WinsockTcpStream_Initialise( ); void WinsockTcpStream_Cleanup(struct SolidSyslogStream* base); +static inline void WinsockTcpStream_Report( + enum SolidSyslogSeverity severity, + uint16_t category, + enum SolidSyslogWinsockTcpStreamErrors code +) +{ + SolidSyslog_Error(severity, &WinsockTcpStreamErrorSource, category, code); +} + #endif /* SOLIDSYSLOGWINSOCKTCPSTREAMPRIVATE_H */ diff --git a/Platform/Windows/Source/SolidSyslogWinsockTcpStreamStatic.c b/Platform/Windows/Source/SolidSyslogWinsockTcpStreamStatic.c index 5add0396..437fc2eb 100644 --- a/Platform/Windows/Source/SolidSyslogWinsockTcpStreamStatic.c +++ b/Platform/Windows/Source/SolidSyslogWinsockTcpStreamStatic.c @@ -36,11 +36,10 @@ struct SolidSyslogStream* SolidSyslogWinsockTcpStream_Create(const struct SolidS } else { - SolidSyslog_Error( + WinsockTcpStream_Report( SOLIDSYSLOG_SEVERITY_ERROR, - &WinsockTcpStreamErrorSource, SOLIDSYSLOG_CAT_POOL_EXHAUSTED, - (int32_t) WINSOCKTCPSTREAM_ERROR_POOL_EXHAUSTED + WINSOCKTCPSTREAM_ERROR_POOL_EXHAUSTED ); } return handle; @@ -54,11 +53,10 @@ void SolidSyslogWinsockTcpStream_Destroy(struct SolidSyslogStream* base) SolidSyslogPoolAllocator_FreeIfInUse(&WinsockTcpStream_Allocator, index, WinsockTcpStream_CleanupAtIndex, NULL); if (!released) { - SolidSyslog_Error( + WinsockTcpStream_Report( SOLIDSYSLOG_SEVERITY_WARNING, - &WinsockTcpStreamErrorSource, SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, - (int32_t) WINSOCKTCPSTREAM_ERROR_UNKNOWN_DESTROY + WINSOCKTCPSTREAM_ERROR_UNKNOWN_DESTROY ); } } diff --git a/Tests/Bdd/Targets/BddTargetErrorTextTest.cpp b/Tests/Bdd/Targets/BddTargetErrorTextTest.cpp index cb7ee5f0..16539445 100644 --- a/Tests/Bdd/Targets/BddTargetErrorTextTest.cpp +++ b/Tests/Bdd/Targets/BddTargetErrorTextTest.cpp @@ -8,62 +8,71 @@ TEST_GROUP(BddTargetErrorText){}; +// NOLINTBEGIN(cppcoreguidelines-macro-usage,cppcoreguidelines-avoid-do-while) +#define CHECK_CATEGORY_TEXT(category, expectedText) \ + do \ + { \ + STRCMP_EQUAL((expectedText), BddTargetErrorText_Category((category))); \ + } while (0) + +// NOLINTEND(cppcoreguidelines-macro-usage,cppcoreguidelines-avoid-do-while) + TEST(BddTargetErrorText, BadConfigCategoryMapsToText) { - STRCMP_EQUAL("bad config", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_BAD_CONFIG)); + CHECK_CATEGORY_TEXT(SOLIDSYSLOG_CAT_BAD_CONFIG, "bad config"); } TEST(BddTargetErrorText, BadArgumentCategoryMapsToText) { - STRCMP_EQUAL("bad argument", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_BAD_ARGUMENT)); + CHECK_CATEGORY_TEXT(SOLIDSYSLOG_CAT_BAD_ARGUMENT, "bad argument"); } TEST(BddTargetErrorText, PoolExhaustedCategoryMapsToText) { - STRCMP_EQUAL("pool exhausted", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_POOL_EXHAUSTED)); + CHECK_CATEGORY_TEXT(SOLIDSYSLOG_CAT_POOL_EXHAUSTED, "pool exhausted"); } TEST(BddTargetErrorText, UnknownDestroyCategoryMapsToText) { - STRCMP_EQUAL("unknown destroy", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_UNKNOWN_DESTROY)); + CHECK_CATEGORY_TEXT(SOLIDSYSLOG_CAT_UNKNOWN_DESTROY, "unknown destroy"); } TEST(BddTargetErrorText, BufferBackendFailedCategoryMapsToText) { - STRCMP_EQUAL("buffer backend failed", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_BUFFER_BACKEND_FAILED)); + CHECK_CATEGORY_TEXT(SOLIDSYSLOG_CAT_BUFFER_BACKEND_FAILED, "buffer backend failed"); } TEST(BddTargetErrorText, ResolverResolveFailedCategoryMapsToText) { - STRCMP_EQUAL("resolve failed", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_RESOLVER_RESOLVE_FAILED)); + CHECK_CATEGORY_TEXT(SOLIDSYSLOG_CAT_RESOLVER_RESOLVE_FAILED, "resolve failed"); } TEST(BddTargetErrorText, SecurityPolicyKeyUnavailableCategoryMapsToText) { - STRCMP_EQUAL("key unavailable", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_SECURITYPOLICY_KEY_UNAVAILABLE)); + CHECK_CATEGORY_TEXT(SOLIDSYSLOG_CAT_SECURITYPOLICY_KEY_UNAVAILABLE, "key unavailable"); } TEST(BddTargetErrorText, SecurityPolicySealFailedCategoryMapsToText) { - STRCMP_EQUAL("seal failed", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_SECURITYPOLICY_SEAL_FAILED)); + CHECK_CATEGORY_TEXT(SOLIDSYSLOG_CAT_SECURITYPOLICY_SEAL_FAILED, "seal failed"); } TEST(BddTargetErrorText, SecurityPolicyOpenFailedCategoryMapsToText) { - STRCMP_EQUAL("open failed", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_SECURITYPOLICY_OPEN_FAILED)); + CHECK_CATEGORY_TEXT(SOLIDSYSLOG_CAT_SECURITYPOLICY_OPEN_FAILED, "open failed"); } TEST(BddTargetErrorText, TlsStreamInitFailedCategoryMapsToText) { - STRCMP_EQUAL("TLS init failed", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_TLSSTREAM_INIT_FAILED)); + CHECK_CATEGORY_TEXT(SOLIDSYSLOG_CAT_TLSSTREAM_INIT_FAILED, "TLS init failed"); } TEST(BddTargetErrorText, TlsStreamHandshakeFailedCategoryMapsToText) { - STRCMP_EQUAL("TLS handshake failed", BddTargetErrorText_Category(SOLIDSYSLOG_CAT_TLSSTREAM_HANDSHAKE_FAILED)); + CHECK_CATEGORY_TEXT(SOLIDSYSLOG_CAT_TLSSTREAM_HANDSHAKE_FAILED, "TLS handshake failed"); } TEST(BddTargetErrorText, UnrecognisedCategoryMapsToUnknown) { - STRCMP_EQUAL("unknown", BddTargetErrorText_Category((uint16_t) 0xFFFFU)); + CHECK_CATEGORY_TEXT((uint16_t) 0xFFFFU, "unknown"); } diff --git a/misra_suppressions.txt b/misra_suppressions.txt index 7a151138..b12ce644 100644 --- a/misra_suppressions.txt +++ b/misra_suppressions.txt @@ -12,84 +12,84 @@ # D.002 — Rules 11.2 / 11.3 / 11.5: vtable downcasts + Formatter # See docs/misra-deviations.md#d002 misra-c2012-11.2:Core/Interface/SolidSyslogFormatter.h:28 -misra-c2012-11.2:Platform/LwipRaw/Source/SolidSyslogLwipRawAddressPrivate.h:24 -misra-c2012-11.2:Platform/LwipRaw/Source/SolidSyslogLwipRawAddressPrivate.h:31 -misra-c2012-11.2:Platform/PlusTcp/Source/SolidSyslogPlusTcpAddress.c:10 -misra-c2012-11.2:Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressPrivate.h:19 -misra-c2012-11.2:Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressPrivate.h:26 -misra-c2012-11.2:Platform/Posix/Source/SolidSyslogPosixAddress.c:10 -misra-c2012-11.2:Platform/Posix/Source/SolidSyslogPosixAddressPrivate.h:19 -misra-c2012-11.2:Platform/Posix/Source/SolidSyslogPosixAddressPrivate.h:24 -misra-c2012-11.2:Platform/Windows/Source/SolidSyslogWinsockAddress.c:9 -misra-c2012-11.2:Platform/Windows/Source/SolidSyslogWinsockAddressPrivate.h:19 -misra-c2012-11.2:Platform/Windows/Source/SolidSyslogWinsockAddressPrivate.h:26 +misra-c2012-11.2:Platform/LwipRaw/Source/SolidSyslogLwipRawAddressPrivate.h:29 +misra-c2012-11.2:Platform/LwipRaw/Source/SolidSyslogLwipRawAddressPrivate.h:36 +misra-c2012-11.2:Platform/PlusTcp/Source/SolidSyslogPlusTcpAddress.c:14 +misra-c2012-11.2:Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressPrivate.h:24 +misra-c2012-11.2:Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressPrivate.h:31 +misra-c2012-11.2:Platform/Posix/Source/SolidSyslogPosixAddress.c:14 +misra-c2012-11.2:Platform/Posix/Source/SolidSyslogPosixAddressPrivate.h:23 +misra-c2012-11.2:Platform/Posix/Source/SolidSyslogPosixAddressPrivate.h:28 +misra-c2012-11.2:Platform/Windows/Source/SolidSyslogWinsockAddress.c:13 +misra-c2012-11.2:Platform/Windows/Source/SolidSyslogWinsockAddressPrivate.h:23 +misra-c2012-11.2:Platform/Windows/Source/SolidSyslogWinsockAddressPrivate.h:30 misra-c2012-11.3:Core/Interface/SolidSyslogFormatter.h:28 -misra-c2012-11.3:Core/Source/SolidSyslogBlockStore.c:69 -misra-c2012-11.3:Core/Source/SolidSyslogCircularBuffer.c:87 -misra-c2012-11.3:Core/Source/SolidSyslogFileBlockDevice.c:98 +misra-c2012-11.3:Core/Source/SolidSyslogBlockStore.c:73 +misra-c2012-11.3:Core/Source/SolidSyslogCircularBuffer.c:91 +misra-c2012-11.3:Core/Source/SolidSyslogFileBlockDevice.c:102 misra-c2012-11.3:Core/Source/SolidSyslogFormatter.c:79 -misra-c2012-11.3:Core/Source/SolidSyslogMetaSd.c:51 -misra-c2012-11.3:Core/Source/SolidSyslogOriginSd.c:69 -misra-c2012-11.3:Core/Source/SolidSyslogPassthroughBuffer.c:49 -misra-c2012-11.3:Core/Source/SolidSyslogStreamSender.c:147 -misra-c2012-11.3:Core/Source/SolidSyslogSwitchingSender.c:59 -misra-c2012-11.3:Core/Source/SolidSyslogTimeQualitySd.c:59 -misra-c2012-11.3:Core/Source/SolidSyslogUdpSender.c:103 -misra-c2012-11.3:Platform/Atomics/Source/SolidSyslogStdAtomicCounter.c:25 -misra-c2012-11.3:Platform/FatFs/Source/SolidSyslogFatFsFile.c:45 -misra-c2012-11.3:Platform/LwipRaw/Source/SolidSyslogLwipRawAddressPrivate.h:24 -misra-c2012-11.3:Platform/LwipRaw/Source/SolidSyslogLwipRawAddressPrivate.h:31 +misra-c2012-11.3:Core/Source/SolidSyslogMetaSd.c:55 +misra-c2012-11.3:Core/Source/SolidSyslogOriginSd.c:73 +misra-c2012-11.3:Core/Source/SolidSyslogPassthroughBuffer.c:53 +misra-c2012-11.3:Core/Source/SolidSyslogStreamSender.c:151 +misra-c2012-11.3:Core/Source/SolidSyslogSwitchingSender.c:63 +misra-c2012-11.3:Core/Source/SolidSyslogTimeQualitySd.c:63 +misra-c2012-11.3:Core/Source/SolidSyslogUdpSender.c:100 +misra-c2012-11.3:Platform/Atomics/Source/SolidSyslogStdAtomicCounter.c:29 +misra-c2012-11.3:Platform/FatFs/Source/SolidSyslogFatFsFile.c:49 +misra-c2012-11.3:Platform/LwipRaw/Source/SolidSyslogLwipRawAddressPrivate.h:29 +misra-c2012-11.3:Platform/LwipRaw/Source/SolidSyslogLwipRawAddressPrivate.h:36 misra-c2012-11.3:Platform/LwipRaw/Source/SolidSyslogLwipRawAddressStatic.c:35 -misra-c2012-11.3:Platform/LwipRaw/Source/SolidSyslogLwipRawAddressStatic.c:56 -misra-c2012-11.3:Platform/LwipRaw/Source/SolidSyslogLwipRawDatagram.c:61 -misra-c2012-11.3:Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolver.c:205 -misra-c2012-11.3:Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStream.c:130 -misra-c2012-11.3:Platform/PlusTcp/Source/SolidSyslogPlusTcpAddress.c:10 -misra-c2012-11.3:Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressPrivate.h:19 -misra-c2012-11.3:Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressPrivate.h:26 +misra-c2012-11.3:Platform/LwipRaw/Source/SolidSyslogLwipRawAddressStatic.c:55 +misra-c2012-11.3:Platform/LwipRaw/Source/SolidSyslogLwipRawDatagram.c:65 +misra-c2012-11.3:Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolver.c:206 +misra-c2012-11.3:Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStream.c:134 +misra-c2012-11.3:Platform/PlusTcp/Source/SolidSyslogPlusTcpAddress.c:14 +misra-c2012-11.3:Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressPrivate.h:24 +misra-c2012-11.3:Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressPrivate.h:31 misra-c2012-11.3:Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressStatic.c:35 -misra-c2012-11.3:Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressStatic.c:56 -misra-c2012-11.3:Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagram.c:49 -misra-c2012-11.3:Platform/FreeRtos/Source/SolidSyslogFreeRtosMutex.c:40 +misra-c2012-11.3:Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressStatic.c:55 +misra-c2012-11.3:Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagram.c:53 +misra-c2012-11.3:Platform/FreeRtos/Source/SolidSyslogFreeRtosMutex.c:44 misra-c2012-11.3:Platform/PlusTcp/Source/SolidSyslogPlusTcpResolver.c:44 -misra-c2012-11.3:Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStream.c:114 -misra-c2012-11.3:Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c:96 -misra-c2012-11.3:Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256Policy.c:66 -misra-c2012-11.3:Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicy.c:78 -misra-c2012-11.3:Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicy.c:82 -misra-c2012-11.3:Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256Policy.c:67 -misra-c2012-11.3:Platform/OpenSsl/Source/SolidSyslogTlsStream.c:84 -misra-c2012-11.3:Platform/Posix/Source/SolidSyslogPosixAddress.c:10 -misra-c2012-11.3:Platform/Posix/Source/SolidSyslogPosixAddressPrivate.h:19 -misra-c2012-11.3:Platform/Posix/Source/SolidSyslogPosixAddressPrivate.h:24 +misra-c2012-11.3:Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStream.c:118 +misra-c2012-11.3:Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c:98 +misra-c2012-11.3:Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256Policy.c:69 +misra-c2012-11.3:Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicy.c:81 +misra-c2012-11.3:Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicy.c:85 +misra-c2012-11.3:Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256Policy.c:70 +misra-c2012-11.3:Platform/OpenSsl/Source/SolidSyslogTlsStream.c:86 +misra-c2012-11.3:Platform/Posix/Source/SolidSyslogPosixAddress.c:14 +misra-c2012-11.3:Platform/Posix/Source/SolidSyslogPosixAddressPrivate.h:23 +misra-c2012-11.3:Platform/Posix/Source/SolidSyslogPosixAddressPrivate.h:28 misra-c2012-11.3:Platform/Posix/Source/SolidSyslogPosixAddressStatic.c:35 -misra-c2012-11.3:Platform/Posix/Source/SolidSyslogPosixAddressStatic.c:56 -misra-c2012-11.3:Platform/Posix/Source/SolidSyslogPosixDatagram.c:55 -misra-c2012-11.3:Platform/Posix/Source/SolidSyslogPosixFile.c:66 +misra-c2012-11.3:Platform/Posix/Source/SolidSyslogPosixAddressStatic.c:55 +misra-c2012-11.3:Platform/Posix/Source/SolidSyslogPosixDatagram.c:59 +misra-c2012-11.3:Platform/Posix/Source/SolidSyslogPosixFile.c:70 misra-c2012-11.3:Platform/Posix/Source/SolidSyslogPosixMessageQueueBuffer.c:133 -misra-c2012-11.3:Platform/Posix/Source/SolidSyslogPosixMutex.c:47 -misra-c2012-11.3:Platform/Posix/Source/SolidSyslogPosixTcpStream.c:100 -misra-c2012-11.3:Platform/Windows/Source/SolidSyslogWinsockAddress.c:9 -misra-c2012-11.3:Platform/Windows/Source/SolidSyslogWinsockAddressPrivate.h:19 -misra-c2012-11.3:Platform/Windows/Source/SolidSyslogWinsockAddressPrivate.h:26 +misra-c2012-11.3:Platform/Posix/Source/SolidSyslogPosixMutex.c:51 +misra-c2012-11.3:Platform/Posix/Source/SolidSyslogPosixTcpStream.c:104 +misra-c2012-11.3:Platform/Windows/Source/SolidSyslogWinsockAddress.c:13 +misra-c2012-11.3:Platform/Windows/Source/SolidSyslogWinsockAddressPrivate.h:23 +misra-c2012-11.3:Platform/Windows/Source/SolidSyslogWinsockAddressPrivate.h:30 misra-c2012-11.3:Platform/Windows/Source/SolidSyslogWinsockAddressStatic.c:35 -misra-c2012-11.3:Platform/Windows/Source/SolidSyslogWinsockAddressStatic.c:56 -misra-c2012-11.3:Platform/Windows/Source/SolidSyslogWindowsAtomicCounter.c:29 -misra-c2012-11.3:Platform/Windows/Source/SolidSyslogWindowsFile.c:73 -misra-c2012-11.3:Platform/Windows/Source/SolidSyslogWindowsMutex.c:34 -misra-c2012-11.3:Platform/Windows/Source/SolidSyslogWinsockDatagram.c:94 -misra-c2012-11.3:Platform/Windows/Source/SolidSyslogWinsockTcpStream.c:181 -misra-c2012-11.5:Core/Source/SolidSyslogUdpSender.c:207 -misra-c2012-11.5:Platform/LwipRaw/Source/SolidSyslogLwipRawDatagram.c:70 -misra-c2012-11.5:Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolver.c:147 -misra-c2012-11.5:Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolver.c:210 -misra-c2012-11.5:Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStream.c:139 -misra-c2012-11.5:Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStream.c:147 -misra-c2012-11.5:Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c:278 -misra-c2012-11.5:Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c:290 -misra-c2012-11.5:Platform/Windows/Source/SolidSyslogWinsockDatagram.c:138 -misra-c2012-11.5:Platform/Windows/Source/SolidSyslogWinsockTcpStream.c:353 -misra-c2012-11.5:Platform/Windows/Source/SolidSyslogWinsockTcpStream.c:373 +misra-c2012-11.3:Platform/Windows/Source/SolidSyslogWinsockAddressStatic.c:55 +misra-c2012-11.3:Platform/Windows/Source/SolidSyslogWindowsAtomicCounter.c:33 +misra-c2012-11.3:Platform/Windows/Source/SolidSyslogWindowsFile.c:77 +misra-c2012-11.3:Platform/Windows/Source/SolidSyslogWindowsMutex.c:38 +misra-c2012-11.3:Platform/Windows/Source/SolidSyslogWinsockDatagram.c:98 +misra-c2012-11.3:Platform/Windows/Source/SolidSyslogWinsockTcpStream.c:185 +misra-c2012-11.5:Core/Source/SolidSyslogUdpSender.c:204 +misra-c2012-11.5:Platform/LwipRaw/Source/SolidSyslogLwipRawDatagram.c:74 +misra-c2012-11.5:Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolver.c:149 +misra-c2012-11.5:Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolver.c:211 +misra-c2012-11.5:Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStream.c:143 +misra-c2012-11.5:Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStream.c:151 +misra-c2012-11.5:Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c:275 +misra-c2012-11.5:Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c:287 +misra-c2012-11.5:Platform/Windows/Source/SolidSyslogWinsockDatagram.c:142 +misra-c2012-11.5:Platform/Windows/Source/SolidSyslogWinsockTcpStream.c:357 +misra-c2012-11.5:Platform/Windows/Source/SolidSyslogWinsockTcpStream.c:377 # D.003 — Rule 5.7: repeating struct tags (no-typedef-struct convention) # See docs/misra-deviations.md#d003 @@ -102,22 +102,22 @@ misra-c2012-18.7:Core/Source/SolidSyslogFormatter.c:12 # D.006 — Rule 11.8: const-strip false-positives + platform-API (Winsock, lwIP) # See docs/misra-deviations.md#d006 misra-c2012-11.8:Core/Source/BlockSequence.c:465 -misra-c2012-11.8:Core/Source/SolidSyslog.c:51 -misra-c2012-11.8:Core/Source/SolidSyslog.c:52 misra-c2012-11.8:Core/Source/SolidSyslog.c:53 misra-c2012-11.8:Core/Source/SolidSyslog.c:54 misra-c2012-11.8:Core/Source/SolidSyslog.c:55 misra-c2012-11.8:Core/Source/SolidSyslog.c:56 misra-c2012-11.8:Core/Source/SolidSyslog.c:57 misra-c2012-11.8:Core/Source/SolidSyslog.c:58 +misra-c2012-11.8:Core/Source/SolidSyslog.c:59 +misra-c2012-11.8:Core/Source/SolidSyslog.c:60 misra-c2012-11.8:Core/Source/SolidSyslogMessageFormatter.c:57 misra-c2012-11.8:Core/Source/SolidSyslogMessageFormatter.c:59 misra-c2012-11.8:Core/Source/SolidSyslogMessageFormatter.c:61 misra-c2012-11.8:Core/Source/SolidSyslogMessageFormatter.c:63 misra-c2012-11.8:Core/Source/SolidSyslogMessageFormatter.c:67 misra-c2012-11.8:Core/Source/SolidSyslogBlockStoreStatic.c:41 -misra-c2012-11.8:Platform/LwipRaw/Source/SolidSyslogLwipRawDatagram.c:155 -misra-c2012-11.8:Platform/Windows/Source/SolidSyslogWinsockTcpStream.c:93 +misra-c2012-11.8:Platform/LwipRaw/Source/SolidSyslogLwipRawDatagram.c:159 +misra-c2012-11.8:Platform/Windows/Source/SolidSyslogWinsockTcpStream.c:97 # D.007 — Rule 21.10: transitive via # See docs/misra-deviations.md#d007 @@ -135,32 +135,32 @@ misra-c2012-2.4:Core/Interface/SolidSyslogTransport.h:5 misra-c2012-2.4:Core/Source/BlockSequence.c:13 misra-c2012-2.4:Core/Source/BlockSequence.c:107 misra-c2012-2.4:Core/Source/RecordStore.c:14 -misra-c2012-2.4:Core/Source/SolidSyslogStreamSender.c:19 +misra-c2012-2.4:Core/Source/SolidSyslogStreamSender.c:23 misra-c2012-2.4:Core/Interface/SolidSyslogUdpPayload.h:15 misra-c2012-5.7:Core/Interface/SolidSyslogUdpPayload.h:15 -misra-c2012-5.7:Core/Source/SolidSyslogStreamSender.c:19 +misra-c2012-5.7:Core/Source/SolidSyslogStreamSender.c:23 misra-c2012-5.7:Core/Source/SolidSyslogUdpPayload.c:5 -misra-c2012-5.7:Platform/PlusTcp/Source/SolidSyslogPlusTcpResolver.c:21 -misra-c2012-5.7:Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStream.c:28 -misra-c2012-5.7:Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c:21 -misra-c2012-5.7:Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256Policy.c:18 -misra-c2012-5.7:Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicy.c:21 -misra-c2012-5.7:Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicy.c:19 -misra-c2012-5.7:Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256Policy.c:19 -misra-c2012-5.7:Platform/OpenSsl/Source/SolidSyslogTlsStream.c:23 -misra-c2012-5.7:Platform/Posix/Source/SolidSyslogGetAddrInfoResolver.c:20 -misra-c2012-5.7:Platform/Posix/Source/SolidSyslogPosixDatagram.c:21 +misra-c2012-5.7:Platform/PlusTcp/Source/SolidSyslogPlusTcpResolver.c:25 +misra-c2012-5.7:Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStream.c:32 +misra-c2012-5.7:Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c:23 +misra-c2012-5.7:Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256Policy.c:21 +misra-c2012-5.7:Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicy.c:24 +misra-c2012-5.7:Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicy.c:22 +misra-c2012-5.7:Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256Policy.c:22 +misra-c2012-5.7:Platform/OpenSsl/Source/SolidSyslogTlsStream.c:25 +misra-c2012-5.7:Platform/Posix/Source/SolidSyslogGetAddrInfoResolver.c:24 +misra-c2012-5.7:Platform/Posix/Source/SolidSyslogPosixDatagram.c:25 misra-c2012-5.7:Platform/Posix/Source/SolidSyslogPosixSleep.c:6 -misra-c2012-5.7:Platform/Posix/Source/SolidSyslogPosixTcpStream.c:25 -misra-c2012-5.7:Platform/Windows/Source/SolidSyslogWinsockResolver.c:37 -misra-c2012-5.7:Platform/Windows/Source/SolidSyslogWinsockTcpStream.c:102 +misra-c2012-5.7:Platform/Posix/Source/SolidSyslogPosixTcpStream.c:29 +misra-c2012-5.7:Platform/Windows/Source/SolidSyslogWinsockResolver.c:41 +misra-c2012-5.7:Platform/Windows/Source/SolidSyslogWinsockTcpStream.c:106 misra-c2012-5.7:Core/Source/BlockSequence.c:13 misra-c2012-5.7:Core/Source/BlockSequence.c:107 misra-c2012-5.7:Core/Source/RecordStore.c:14 misra-c2012-5.7:Core/Source/RecordStorePrivate.h:14 -misra-c2012-5.7:Core/Source/SolidSyslogFileBlockDevice.c:19 -misra-c2012-5.7:Platform/Posix/Source/SolidSyslogPosixFile.c:18 -misra-c2012-5.7:Platform/Windows/Source/SolidSyslogWindowsFile.c:24 +misra-c2012-5.7:Core/Source/SolidSyslogFileBlockDevice.c:23 +misra-c2012-5.7:Platform/Posix/Source/SolidSyslogPosixFile.c:22 +misra-c2012-5.7:Platform/Windows/Source/SolidSyslogWindowsFile.c:28 misra-c2012-5.7:Core/Interface/SolidSyslogAtomicCounter.h:11 misra-c2012-5.7:Core/Interface/SolidSyslogCircularBuffer.h:17 misra-c2012-5.7:Core/Interface/SolidSyslogEndpoint.h:11 @@ -169,14 +169,14 @@ misra-c2012-5.7:Core/Interface/SolidSyslogSecurityPolicyDefinition.h:13 misra-c2012-5.7:Core/Interface/SolidSyslogTimeQuality.h:12 misra-c2012-5.7:Core/Interface/SolidSyslogTransport.h:5 misra-c2012-5.7:Core/Source/SolidSyslogMessageFormatter.c:19 -misra-c2012-5.7:Core/Source/SolidSyslogCircularBuffer.c:15 +misra-c2012-5.7:Core/Source/SolidSyslogCircularBuffer.c:19 misra-c2012-5.7:Core/Source/SolidSyslogCrc16.c:12 misra-c2012-5.7:Core/Source/SolidSyslogCrc16Policy.c:10 -misra-c2012-5.7:Core/Source/SolidSyslogOriginSdPrivate.h:9 +misra-c2012-5.7:Core/Source/SolidSyslogOriginSdPrivate.h:14 misra-c2012-5.7:Platform/FreeRtos/Source/SolidSyslogFreeRtosSysUpTime.c:7 misra-c2012-5.7:Platform/Posix/Source/SolidSyslogPosixHostname.c:10 -misra-c2012-5.7:Platform/Posix/Source/SolidSyslogPosixMessageQueueBuffer.c:23 -misra-c2012-5.7:Platform/Posix/Source/SolidSyslogPosixMessageQueueBufferPrivate.h:12 +misra-c2012-5.7:Platform/Posix/Source/SolidSyslogPosixMessageQueueBuffer.c:25 +misra-c2012-5.7:Platform/Posix/Source/SolidSyslogPosixMessageQueueBufferPrivate.h:17 misra-c2012-5.7:Platform/Posix/Source/SolidSyslogPosixSysUpTime.c:6 misra-c2012-5.7:Platform/Windows/Source/SolidSyslogWindowsClock.c:21 misra-c2012-5.7:Platform/Windows/Source/SolidSyslogWindowsHostname.c:19 @@ -192,9 +192,9 @@ misra-c2012-2.5:Core/Interface/SolidSyslogCircularBuffer.h:21 # D.012 — Rule 8.9: file-scope static const referenced from a file-scope enum + one function # See docs/misra-deviations.md#d012 -misra-c2012-8.9:Core/Source/SolidSyslogFileBlockDevice.c:16 +misra-c2012-8.9:Core/Source/SolidSyslogFileBlockDevice.c:20 # D.013 — Rule 11.5: void* ↔ unsigned char* at third-party byte-buffer API boundaries # See docs/misra-deviations.md#d013 -misra-c2012-11.5:Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c:315 -misra-c2012-11.5:Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c:334 +misra-c2012-11.5:Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c:312 +misra-c2012-11.5:Platform/MbedTls/Source/SolidSyslogMbedTlsStream.c:331 From f8c775e893da5250c1cc69be3d4654e964400374 Mon Sep 17 00:00:00 2001 From: David Cozens Date: Wed, 3 Jun 2026 14:03:50 +0100 Subject: [PATCH 3/3] fix: S12.26 keep (int32_t) cast inside _Report wrapper for clang MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit clang -Wsign-conversion treats the unscoped error enums' underlying type as unsigned, so the enum->int32_t conversion must stay explicit. Move the cast from the (removed) call sites into the one wrapper body per class — call sites stay cast-free, 2.4 still fixed by the typed param. clang/gcc/cppcheck green. Co-Authored-By: Claude Opus 4.8 (1M context) --- Core/Source/SolidSyslogBlockStorePrivate.h | 2 +- Core/Source/SolidSyslogCircularBufferPrivate.h | 2 +- Core/Source/SolidSyslogFileBlockDevicePrivate.h | 2 +- Core/Source/SolidSyslogMetaSdPrivate.h | 2 +- Core/Source/SolidSyslogOriginSdPrivate.h | 2 +- Core/Source/SolidSyslogPassthroughBufferPrivate.h | 2 +- Core/Source/SolidSyslogPrivate.h | 2 +- Core/Source/SolidSyslogStreamSenderPrivate.h | 2 +- Core/Source/SolidSyslogSwitchingSenderPrivate.h | 2 +- Core/Source/SolidSyslogTimeQualitySdPrivate.h | 2 +- Core/Source/SolidSyslogUdpSenderPrivate.h | 2 +- DEVLOG.md | 9 +++++---- .../Atomics/Source/SolidSyslogStdAtomicCounterPrivate.h | 2 +- Platform/FatFs/Source/SolidSyslogFatFsFilePrivate.h | 2 +- .../FreeRtos/Source/SolidSyslogFreeRtosMutexPrivate.h | 2 +- .../LwipRaw/Source/SolidSyslogLwipRawAddressPrivate.h | 2 +- .../LwipRaw/Source/SolidSyslogLwipRawDatagramPrivate.h | 2 +- .../Source/SolidSyslogLwipRawDnsResolverPrivate.h | 2 +- .../LwipRaw/Source/SolidSyslogLwipRawResolverPrivate.h | 2 +- .../LwipRaw/Source/SolidSyslogLwipRawTcpStreamPrivate.h | 2 +- .../Source/SolidSyslogMbedTlsAesGcmPolicyPrivate.h | 2 +- .../Source/SolidSyslogMbedTlsHmacSha256PolicyPrivate.h | 2 +- .../MbedTls/Source/SolidSyslogMbedTlsStreamPrivate.h | 2 +- .../Source/SolidSyslogOpenSslAesGcmPolicyPrivate.h | 2 +- .../Source/SolidSyslogOpenSslHmacSha256PolicyPrivate.h | 2 +- Platform/OpenSsl/Source/SolidSyslogTlsStreamPrivate.h | 2 +- .../PlusTcp/Source/SolidSyslogPlusTcpAddressPrivate.h | 2 +- .../PlusTcp/Source/SolidSyslogPlusTcpDatagramPrivate.h | 2 +- .../PlusTcp/Source/SolidSyslogPlusTcpResolverPrivate.h | 2 +- .../PlusTcp/Source/SolidSyslogPlusTcpTcpStreamPrivate.h | 2 +- .../Posix/Source/SolidSyslogGetAddrInfoResolverPrivate.h | 2 +- Platform/Posix/Source/SolidSyslogPosixAddressPrivate.h | 2 +- Platform/Posix/Source/SolidSyslogPosixDatagramPrivate.h | 2 +- Platform/Posix/Source/SolidSyslogPosixFilePrivate.h | 2 +- .../Source/SolidSyslogPosixMessageQueueBufferPrivate.h | 2 +- Platform/Posix/Source/SolidSyslogPosixMutexPrivate.h | 2 +- Platform/Posix/Source/SolidSyslogPosixTcpStreamPrivate.h | 2 +- .../Source/SolidSyslogWindowsAtomicCounterPrivate.h | 2 +- Platform/Windows/Source/SolidSyslogWindowsFilePrivate.h | 2 +- Platform/Windows/Source/SolidSyslogWindowsMutexPrivate.h | 2 +- .../Windows/Source/SolidSyslogWinsockAddressPrivate.h | 2 +- .../Windows/Source/SolidSyslogWinsockDatagramPrivate.h | 2 +- .../Windows/Source/SolidSyslogWinsockResolverPrivate.h | 2 +- .../Windows/Source/SolidSyslogWinsockTcpStreamPrivate.h | 2 +- 44 files changed, 48 insertions(+), 47 deletions(-) diff --git a/Core/Source/SolidSyslogBlockStorePrivate.h b/Core/Source/SolidSyslogBlockStorePrivate.h index f8b329f3..75c327d9 100644 --- a/Core/Source/SolidSyslogBlockStorePrivate.h +++ b/Core/Source/SolidSyslogBlockStorePrivate.h @@ -37,7 +37,7 @@ static inline void BlockStore_Report( enum SolidSyslogBlockStoreErrors code ) { - SolidSyslog_Error(severity, &BlockStoreErrorSource, category, code); + SolidSyslog_Error(severity, &BlockStoreErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGBLOCKSTOREPRIVATE_H */ diff --git a/Core/Source/SolidSyslogCircularBufferPrivate.h b/Core/Source/SolidSyslogCircularBufferPrivate.h index 24d6d2f8..692d1b41 100644 --- a/Core/Source/SolidSyslogCircularBufferPrivate.h +++ b/Core/Source/SolidSyslogCircularBufferPrivate.h @@ -36,7 +36,7 @@ static inline void CircularBuffer_Report( enum SolidSyslogCircularBufferErrors code ) { - SolidSyslog_Error(severity, &CircularBufferErrorSource, category, code); + SolidSyslog_Error(severity, &CircularBufferErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGCIRCULARBUFFERPRIVATE_H */ diff --git a/Core/Source/SolidSyslogFileBlockDevicePrivate.h b/Core/Source/SolidSyslogFileBlockDevicePrivate.h index c9b59119..c59f7ea5 100644 --- a/Core/Source/SolidSyslogFileBlockDevicePrivate.h +++ b/Core/Source/SolidSyslogFileBlockDevicePrivate.h @@ -44,7 +44,7 @@ static inline void FileBlockDevice_Report( enum SolidSyslogFileBlockDeviceErrors code ) { - SolidSyslog_Error(severity, &FileBlockDeviceErrorSource, category, code); + SolidSyslog_Error(severity, &FileBlockDeviceErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGFILEBLOCKDEVICEPRIVATE_H */ diff --git a/Core/Source/SolidSyslogMetaSdPrivate.h b/Core/Source/SolidSyslogMetaSdPrivate.h index 6362cc8d..02a45134 100644 --- a/Core/Source/SolidSyslogMetaSdPrivate.h +++ b/Core/Source/SolidSyslogMetaSdPrivate.h @@ -29,7 +29,7 @@ static inline void MetaSd_Report( enum SolidSyslogMetaSdErrors code ) { - SolidSyslog_Error(severity, &MetaSdErrorSource, category, code); + SolidSyslog_Error(severity, &MetaSdErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGMETASDPRIVATE_H */ diff --git a/Core/Source/SolidSyslogOriginSdPrivate.h b/Core/Source/SolidSyslogOriginSdPrivate.h index 78ef3308..b1835397 100644 --- a/Core/Source/SolidSyslogOriginSdPrivate.h +++ b/Core/Source/SolidSyslogOriginSdPrivate.h @@ -41,7 +41,7 @@ static inline void OriginSd_Report( enum SolidSyslogOriginSdErrors code ) { - SolidSyslog_Error(severity, &OriginSdErrorSource, category, code); + SolidSyslog_Error(severity, &OriginSdErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGORIGINSDPRIVATE_H */ diff --git a/Core/Source/SolidSyslogPassthroughBufferPrivate.h b/Core/Source/SolidSyslogPassthroughBufferPrivate.h index 274982b0..a7bb3249 100644 --- a/Core/Source/SolidSyslogPassthroughBufferPrivate.h +++ b/Core/Source/SolidSyslogPassthroughBufferPrivate.h @@ -25,7 +25,7 @@ static inline void PassthroughBuffer_Report( enum SolidSyslogPassthroughBufferErrors code ) { - SolidSyslog_Error(severity, &PassthroughBufferErrorSource, category, code); + SolidSyslog_Error(severity, &PassthroughBufferErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGPASSTHROUGHBUFFERPRIVATE_H */ diff --git a/Core/Source/SolidSyslogPrivate.h b/Core/Source/SolidSyslogPrivate.h index 43c1c79c..66f56653 100644 --- a/Core/Source/SolidSyslogPrivate.h +++ b/Core/Source/SolidSyslogPrivate.h @@ -33,7 +33,7 @@ void SolidSyslog_NullStringFunction(struct SolidSyslogFormatter* formatter); static inline void SolidSyslog_Report(enum SolidSyslogSeverity severity, uint16_t category, enum SolidSyslogErrors code) { - SolidSyslog_Error(severity, &SolidSyslogErrorSource, category, code); + SolidSyslog_Error(severity, &SolidSyslogErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGPRIVATE_H */ diff --git a/Core/Source/SolidSyslogStreamSenderPrivate.h b/Core/Source/SolidSyslogStreamSenderPrivate.h index 5c14bb29..744bd2ce 100644 --- a/Core/Source/SolidSyslogStreamSenderPrivate.h +++ b/Core/Source/SolidSyslogStreamSenderPrivate.h @@ -27,7 +27,7 @@ static inline void StreamSender_Report( enum SolidSyslogStreamSenderErrors code ) { - SolidSyslog_Error(severity, &StreamSenderErrorSource, category, code); + SolidSyslog_Error(severity, &StreamSenderErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGSTREAMSENDERPRIVATE_H */ diff --git a/Core/Source/SolidSyslogSwitchingSenderPrivate.h b/Core/Source/SolidSyslogSwitchingSenderPrivate.h index b2fd4c40..0a3f1632 100644 --- a/Core/Source/SolidSyslogSwitchingSenderPrivate.h +++ b/Core/Source/SolidSyslogSwitchingSenderPrivate.h @@ -25,7 +25,7 @@ static inline void SwitchingSender_Report( enum SolidSyslogSwitchingSenderErrors code ) { - SolidSyslog_Error(severity, &SwitchingSenderErrorSource, category, code); + SolidSyslog_Error(severity, &SwitchingSenderErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGSWITCHINGSENDERPRIVATE_H */ diff --git a/Core/Source/SolidSyslogTimeQualitySdPrivate.h b/Core/Source/SolidSyslogTimeQualitySdPrivate.h index 44a3c606..82339361 100644 --- a/Core/Source/SolidSyslogTimeQualitySdPrivate.h +++ b/Core/Source/SolidSyslogTimeQualitySdPrivate.h @@ -24,7 +24,7 @@ static inline void TimeQualitySd_Report( enum SolidSyslogTimeQualitySdErrors code ) { - SolidSyslog_Error(severity, &TimeQualitySdErrorSource, category, code); + SolidSyslog_Error(severity, &TimeQualitySdErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGTIMEQUALITYSDPRIVATE_H */ diff --git a/Core/Source/SolidSyslogUdpSenderPrivate.h b/Core/Source/SolidSyslogUdpSenderPrivate.h index 54de8800..58414593 100644 --- a/Core/Source/SolidSyslogUdpSenderPrivate.h +++ b/Core/Source/SolidSyslogUdpSenderPrivate.h @@ -27,7 +27,7 @@ static inline void UdpSender_Report( enum SolidSyslogUdpSenderErrors code ) { - SolidSyslog_Error(severity, &UdpSenderErrorSource, category, code); + SolidSyslog_Error(severity, &UdpSenderErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGUDPSENDERPRIVATE_H */ diff --git a/DEVLOG.md b/DEVLOG.md index 9c6d0560..725a3e93 100644 --- a/DEVLOG.md +++ b/DEVLOG.md @@ -42,10 +42,11 @@ string table — are deleted. `struct SolidSyslogErrorSource` slims to directly. Three problems fall out at once: the typed `code` parameter keeps each per-class error enum's *tag* referenced (deleting the message tables had orphaned them — MISRA 2.4 ×43), `static inline` gives internal linkage (no - 8.7), and the body passes `code` to the `int32_t` detail param **uncast** — - enum→int32 is value-preserving (both signed, `int32_t` wide enough) and does - not trip essential-type 10.3 — so the `(int32_t)` cast disappears from every - call site. This *supersedes* an earlier crypto-only `_Report` unwind: the 2.4 + 8.7), and the single `(int32_t)` cast moves out of all 134 call sites into the + one wrapper body per class (clang's `-Wsign-conversion` treats the unscoped + enum's underlying type as unsigned, so the enum→`int32_t` conversion must stay + explicit — but now it lives in exactly one place per class). This *supersedes* + an earlier crypto-only `_Report` unwind: the 2.4 fallout forced the uniformly-wrapped direction, which is the better end-state (MISRA-clean tags, cast-free call sites, no suppressions). A *separate* report fn can be added later if a future site needs a non-enum detail. diff --git a/Platform/Atomics/Source/SolidSyslogStdAtomicCounterPrivate.h b/Platform/Atomics/Source/SolidSyslogStdAtomicCounterPrivate.h index 479c83d6..ed739bf9 100644 --- a/Platform/Atomics/Source/SolidSyslogStdAtomicCounterPrivate.h +++ b/Platform/Atomics/Source/SolidSyslogStdAtomicCounterPrivate.h @@ -24,7 +24,7 @@ static inline void StdAtomicCounter_Report( enum SolidSyslogStdAtomicCounterErrors code ) { - SolidSyslog_Error(severity, &StdAtomicCounterErrorSource, category, code); + SolidSyslog_Error(severity, &StdAtomicCounterErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGSTDATOMICCOUNTERPRIVATE_H */ diff --git a/Platform/FatFs/Source/SolidSyslogFatFsFilePrivate.h b/Platform/FatFs/Source/SolidSyslogFatFsFilePrivate.h index c9c24d03..4473a26f 100644 --- a/Platform/FatFs/Source/SolidSyslogFatFsFilePrivate.h +++ b/Platform/FatFs/Source/SolidSyslogFatFsFilePrivate.h @@ -27,7 +27,7 @@ static inline void FatFsFile_Report( enum SolidSyslogFatFsFileErrors code ) { - SolidSyslog_Error(severity, &FatFsFileErrorSource, category, code); + SolidSyslog_Error(severity, &FatFsFileErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGFATFSFILEPRIVATE_H */ diff --git a/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexPrivate.h b/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexPrivate.h index 9c6519b5..b0e3eff3 100644 --- a/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexPrivate.h +++ b/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexPrivate.h @@ -30,7 +30,7 @@ static inline void FreeRtosMutex_Report( enum SolidSyslogFreeRtosMutexErrors code ) { - SolidSyslog_Error(severity, &FreeRtosMutexErrorSource, category, code); + SolidSyslog_Error(severity, &FreeRtosMutexErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGFREERTOSMUTEXPRIVATE_H */ diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressPrivate.h b/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressPrivate.h index 0f418cec..ac0f55f6 100644 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressPrivate.h +++ b/Platform/LwipRaw/Source/SolidSyslogLwipRawAddressPrivate.h @@ -42,7 +42,7 @@ static inline void LwipRawAddress_Report( enum SolidSyslogLwipRawAddressErrors code ) { - SolidSyslog_Error(severity, &LwipRawAddressErrorSource, category, code); + SolidSyslog_Error(severity, &LwipRawAddressErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGLWIPRAWADDRESSPRIVATE_H */ diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagramPrivate.h b/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagramPrivate.h index cf516227..0a9ba921 100644 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagramPrivate.h +++ b/Platform/LwipRaw/Source/SolidSyslogLwipRawDatagramPrivate.h @@ -25,7 +25,7 @@ static inline void LwipRawDatagram_Report( enum SolidSyslogLwipRawDatagramErrors code ) { - SolidSyslog_Error(severity, &LwipRawDatagramErrorSource, category, code); + SolidSyslog_Error(severity, &LwipRawDatagramErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGLWIPRAWDATAGRAMPRIVATE_H */ diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolverPrivate.h b/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolverPrivate.h index aa728907..51140f9f 100644 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolverPrivate.h +++ b/Platform/LwipRaw/Source/SolidSyslogLwipRawDnsResolverPrivate.h @@ -38,7 +38,7 @@ static inline void LwipRawDnsResolver_Report( enum SolidSyslogLwipRawDnsResolverErrors code ) { - SolidSyslog_Error(severity, &LwipRawDnsResolverErrorSource, category, code); + SolidSyslog_Error(severity, &LwipRawDnsResolverErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGLWIPRAWDNSRESOLVERPRIVATE_H */ diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawResolverPrivate.h b/Platform/LwipRaw/Source/SolidSyslogLwipRawResolverPrivate.h index 6c930478..b7999d47 100644 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawResolverPrivate.h +++ b/Platform/LwipRaw/Source/SolidSyslogLwipRawResolverPrivate.h @@ -22,7 +22,7 @@ static inline void LwipRawResolver_Report( enum SolidSyslogLwipRawResolverErrors code ) { - SolidSyslog_Error(severity, &LwipRawResolverErrorSource, category, code); + SolidSyslog_Error(severity, &LwipRawResolverErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGLWIPRAWRESOLVERPRIVATE_H */ diff --git a/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStreamPrivate.h b/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStreamPrivate.h index ea43712c..8935f26f 100644 --- a/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStreamPrivate.h +++ b/Platform/LwipRaw/Source/SolidSyslogLwipRawTcpStreamPrivate.h @@ -41,7 +41,7 @@ static inline void LwipRawTcpStream_Report( enum SolidSyslogLwipRawTcpStreamErrors code ) { - SolidSyslog_Error(severity, &LwipRawTcpStreamErrorSource, category, code); + SolidSyslog_Error(severity, &LwipRawTcpStreamErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGLWIPRAWTCPSTREAMPRIVATE_H */ diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyPrivate.h b/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyPrivate.h index b809f72f..5b8b303f 100644 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyPrivate.h +++ b/Platform/MbedTls/Source/SolidSyslogMbedTlsAesGcmPolicyPrivate.h @@ -27,7 +27,7 @@ static inline void MbedTlsAesGcmPolicy_Report( enum SolidSyslogMbedTlsAesGcmPolicyErrors code ) { - SolidSyslog_Error(severity, &MbedTlsAesGcmPolicyErrorSource, category, code); + SolidSyslog_Error(severity, &MbedTlsAesGcmPolicyErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGMBEDTLSAESGCMPOLICYPRIVATE_H */ diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyPrivate.h b/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyPrivate.h index 7eb44ffd..7d6ce25f 100644 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyPrivate.h +++ b/Platform/MbedTls/Source/SolidSyslogMbedTlsHmacSha256PolicyPrivate.h @@ -27,7 +27,7 @@ static inline void MbedTlsHmacSha256Policy_Report( enum SolidSyslogMbedTlsHmacSha256PolicyErrors code ) { - SolidSyslog_Error(severity, &MbedTlsHmacSha256PolicyErrorSource, category, code); + SolidSyslog_Error(severity, &MbedTlsHmacSha256PolicyErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGMBEDTLSHMACSHA256POLICYPRIVATE_H */ diff --git a/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamPrivate.h b/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamPrivate.h index b8011b2c..cc99d530 100644 --- a/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamPrivate.h +++ b/Platform/MbedTls/Source/SolidSyslogMbedTlsStreamPrivate.h @@ -28,7 +28,7 @@ static inline void MbedTlsStream_Report( enum SolidSyslogMbedTlsStreamErrors code ) { - SolidSyslog_Error(severity, &MbedTlsStreamErrorSource, category, code); + SolidSyslog_Error(severity, &MbedTlsStreamErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGMBEDTLSSTREAMPRIVATE_H */ diff --git a/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyPrivate.h b/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyPrivate.h index 23dcb370..a6fb8cc6 100644 --- a/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyPrivate.h +++ b/Platform/OpenSsl/Source/SolidSyslogOpenSslAesGcmPolicyPrivate.h @@ -27,7 +27,7 @@ static inline void OpenSslAesGcmPolicy_Report( enum SolidSyslogOpenSslAesGcmPolicyErrors code ) { - SolidSyslog_Error(severity, &OpenSslAesGcmPolicyErrorSource, category, code); + SolidSyslog_Error(severity, &OpenSslAesGcmPolicyErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGOPENSSLAESGCMPOLICYPRIVATE_H */ diff --git a/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyPrivate.h b/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyPrivate.h index 914cbb7e..76fa186b 100644 --- a/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyPrivate.h +++ b/Platform/OpenSsl/Source/SolidSyslogOpenSslHmacSha256PolicyPrivate.h @@ -27,7 +27,7 @@ static inline void OpenSslHmacSha256Policy_Report( enum SolidSyslogOpenSslHmacSha256PolicyErrors code ) { - SolidSyslog_Error(severity, &OpenSslHmacSha256PolicyErrorSource, category, code); + SolidSyslog_Error(severity, &OpenSslHmacSha256PolicyErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGOPENSSLHMACSHA256POLICYPRIVATE_H */ diff --git a/Platform/OpenSsl/Source/SolidSyslogTlsStreamPrivate.h b/Platform/OpenSsl/Source/SolidSyslogTlsStreamPrivate.h index 1db1a866..61eea8b9 100644 --- a/Platform/OpenSsl/Source/SolidSyslogTlsStreamPrivate.h +++ b/Platform/OpenSsl/Source/SolidSyslogTlsStreamPrivate.h @@ -30,7 +30,7 @@ static inline void TlsStream_Report( enum SolidSyslogTlsStreamErrors code ) { - SolidSyslog_Error(severity, &TlsStreamErrorSource, category, code); + SolidSyslog_Error(severity, &TlsStreamErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGTLSSTREAMPRIVATE_H */ diff --git a/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressPrivate.h b/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressPrivate.h index 1b2921ba..fd19a762 100644 --- a/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressPrivate.h +++ b/Platform/PlusTcp/Source/SolidSyslogPlusTcpAddressPrivate.h @@ -37,7 +37,7 @@ static inline void PlusTcpAddress_Report( enum SolidSyslogPlusTcpAddressErrors code ) { - SolidSyslog_Error(severity, &PlusTcpAddressErrorSource, category, code); + SolidSyslog_Error(severity, &PlusTcpAddressErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGPLUSTCPADDRESSPRIVATE_H */ diff --git a/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagramPrivate.h b/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagramPrivate.h index d95e3ad7..61fec59f 100644 --- a/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagramPrivate.h +++ b/Platform/PlusTcp/Source/SolidSyslogPlusTcpDatagramPrivate.h @@ -26,7 +26,7 @@ static inline void PlusTcpDatagram_Report( enum SolidSyslogPlusTcpDatagramErrors code ) { - SolidSyslog_Error(severity, &PlusTcpDatagramErrorSource, category, code); + SolidSyslog_Error(severity, &PlusTcpDatagramErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGPLUSTCPDATAGRAMPRIVATE_H */ diff --git a/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolverPrivate.h b/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolverPrivate.h index 9c957071..fdb8361c 100644 --- a/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolverPrivate.h +++ b/Platform/PlusTcp/Source/SolidSyslogPlusTcpResolverPrivate.h @@ -22,7 +22,7 @@ static inline void PlusTcpResolver_Report( enum SolidSyslogPlusTcpResolverErrors code ) { - SolidSyslog_Error(severity, &PlusTcpResolverErrorSource, category, code); + SolidSyslog_Error(severity, &PlusTcpResolverErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGPLUSTCPRESOLVERPRIVATE_H */ diff --git a/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStreamPrivate.h b/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStreamPrivate.h index 559e2022..ed922182 100644 --- a/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStreamPrivate.h +++ b/Platform/PlusTcp/Source/SolidSyslogPlusTcpTcpStreamPrivate.h @@ -31,7 +31,7 @@ static inline void PlusTcpTcpStream_Report( enum SolidSyslogPlusTcpTcpStreamErrors code ) { - SolidSyslog_Error(severity, &PlusTcpTcpStreamErrorSource, category, code); + SolidSyslog_Error(severity, &PlusTcpTcpStreamErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGPLUSTCPTCPSTREAMPRIVATE_H */ diff --git a/Platform/Posix/Source/SolidSyslogGetAddrInfoResolverPrivate.h b/Platform/Posix/Source/SolidSyslogGetAddrInfoResolverPrivate.h index 9d552733..1308f0dd 100644 --- a/Platform/Posix/Source/SolidSyslogGetAddrInfoResolverPrivate.h +++ b/Platform/Posix/Source/SolidSyslogGetAddrInfoResolverPrivate.h @@ -22,7 +22,7 @@ static inline void GetAddrInfoResolver_Report( enum SolidSyslogGetAddrInfoResolverErrors code ) { - SolidSyslog_Error(severity, &GetAddrInfoResolverErrorSource, category, code); + SolidSyslog_Error(severity, &GetAddrInfoResolverErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGGETADDRINFORESOLVERPRIVATE_H */ diff --git a/Platform/Posix/Source/SolidSyslogPosixAddressPrivate.h b/Platform/Posix/Source/SolidSyslogPosixAddressPrivate.h index 369c9b4d..e7dd8a1b 100644 --- a/Platform/Posix/Source/SolidSyslogPosixAddressPrivate.h +++ b/Platform/Posix/Source/SolidSyslogPosixAddressPrivate.h @@ -34,7 +34,7 @@ static inline void PosixAddress_Report( enum SolidSyslogPosixAddressErrors code ) { - SolidSyslog_Error(severity, &PosixAddressErrorSource, category, code); + SolidSyslog_Error(severity, &PosixAddressErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGPOSIXADDRESSPRIVATE_H */ diff --git a/Platform/Posix/Source/SolidSyslogPosixDatagramPrivate.h b/Platform/Posix/Source/SolidSyslogPosixDatagramPrivate.h index 5b74aacc..34f09044 100644 --- a/Platform/Posix/Source/SolidSyslogPosixDatagramPrivate.h +++ b/Platform/Posix/Source/SolidSyslogPosixDatagramPrivate.h @@ -26,7 +26,7 @@ static inline void PosixDatagram_Report( enum SolidSyslogPosixDatagramErrors code ) { - SolidSyslog_Error(severity, &PosixDatagramErrorSource, category, code); + SolidSyslog_Error(severity, &PosixDatagramErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGPOSIXDATAGRAMPRIVATE_H */ diff --git a/Platform/Posix/Source/SolidSyslogPosixFilePrivate.h b/Platform/Posix/Source/SolidSyslogPosixFilePrivate.h index cb36a963..f474a7df 100644 --- a/Platform/Posix/Source/SolidSyslogPosixFilePrivate.h +++ b/Platform/Posix/Source/SolidSyslogPosixFilePrivate.h @@ -23,7 +23,7 @@ static inline void PosixFile_Report( enum SolidSyslogPosixFileErrors code ) { - SolidSyslog_Error(severity, &PosixFileErrorSource, category, code); + SolidSyslog_Error(severity, &PosixFileErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGPOSIXFILEPRIVATE_H */ diff --git a/Platform/Posix/Source/SolidSyslogPosixMessageQueueBufferPrivate.h b/Platform/Posix/Source/SolidSyslogPosixMessageQueueBufferPrivate.h index acd9f0e3..45296f2b 100644 --- a/Platform/Posix/Source/SolidSyslogPosixMessageQueueBufferPrivate.h +++ b/Platform/Posix/Source/SolidSyslogPosixMessageQueueBufferPrivate.h @@ -41,7 +41,7 @@ static inline void PosixMessageQueueBuffer_Report( enum SolidSyslogPosixMessageQueueBufferErrors code ) { - SolidSyslog_Error(severity, &PosixMessageQueueBufferErrorSource, category, code); + SolidSyslog_Error(severity, &PosixMessageQueueBufferErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGPOSIXMESSAGEQUEUEBUFFERPRIVATE_H */ diff --git a/Platform/Posix/Source/SolidSyslogPosixMutexPrivate.h b/Platform/Posix/Source/SolidSyslogPosixMutexPrivate.h index e170ddfe..0f6789bf 100644 --- a/Platform/Posix/Source/SolidSyslogPosixMutexPrivate.h +++ b/Platform/Posix/Source/SolidSyslogPosixMutexPrivate.h @@ -25,7 +25,7 @@ static inline void PosixMutex_Report( enum SolidSyslogPosixMutexErrors code ) { - SolidSyslog_Error(severity, &PosixMutexErrorSource, category, code); + SolidSyslog_Error(severity, &PosixMutexErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGPOSIXMUTEXPRIVATE_H */ diff --git a/Platform/Posix/Source/SolidSyslogPosixTcpStreamPrivate.h b/Platform/Posix/Source/SolidSyslogPosixTcpStreamPrivate.h index e975ceee..c0d9693d 100644 --- a/Platform/Posix/Source/SolidSyslogPosixTcpStreamPrivate.h +++ b/Platform/Posix/Source/SolidSyslogPosixTcpStreamPrivate.h @@ -25,7 +25,7 @@ static inline void PosixTcpStream_Report( enum SolidSyslogPosixTcpStreamErrors code ) { - SolidSyslog_Error(severity, &PosixTcpStreamErrorSource, category, code); + SolidSyslog_Error(severity, &PosixTcpStreamErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGPOSIXTCPSTREAMPRIVATE_H */ diff --git a/Platform/Windows/Source/SolidSyslogWindowsAtomicCounterPrivate.h b/Platform/Windows/Source/SolidSyslogWindowsAtomicCounterPrivate.h index 6f02b51e..45bc07fd 100644 --- a/Platform/Windows/Source/SolidSyslogWindowsAtomicCounterPrivate.h +++ b/Platform/Windows/Source/SolidSyslogWindowsAtomicCounterPrivate.h @@ -24,7 +24,7 @@ static inline void WindowsAtomicCounter_Report( enum SolidSyslogWindowsAtomicCounterErrors code ) { - SolidSyslog_Error(severity, &WindowsAtomicCounterErrorSource, category, code); + SolidSyslog_Error(severity, &WindowsAtomicCounterErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGWINDOWSATOMICCOUNTERPRIVATE_H */ diff --git a/Platform/Windows/Source/SolidSyslogWindowsFilePrivate.h b/Platform/Windows/Source/SolidSyslogWindowsFilePrivate.h index 074b7ab0..1ca05163 100644 --- a/Platform/Windows/Source/SolidSyslogWindowsFilePrivate.h +++ b/Platform/Windows/Source/SolidSyslogWindowsFilePrivate.h @@ -23,7 +23,7 @@ static inline void WindowsFile_Report( enum SolidSyslogWindowsFileErrors code ) { - SolidSyslog_Error(severity, &WindowsFileErrorSource, category, code); + SolidSyslog_Error(severity, &WindowsFileErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGWINDOWSFILEPRIVATE_H */ diff --git a/Platform/Windows/Source/SolidSyslogWindowsMutexPrivate.h b/Platform/Windows/Source/SolidSyslogWindowsMutexPrivate.h index 597fd830..b3e6c7a1 100644 --- a/Platform/Windows/Source/SolidSyslogWindowsMutexPrivate.h +++ b/Platform/Windows/Source/SolidSyslogWindowsMutexPrivate.h @@ -25,7 +25,7 @@ static inline void WindowsMutex_Report( enum SolidSyslogWindowsMutexErrors code ) { - SolidSyslog_Error(severity, &WindowsMutexErrorSource, category, code); + SolidSyslog_Error(severity, &WindowsMutexErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGWINDOWSMUTEXPRIVATE_H */ diff --git a/Platform/Windows/Source/SolidSyslogWinsockAddressPrivate.h b/Platform/Windows/Source/SolidSyslogWinsockAddressPrivate.h index 51445432..e79d053a 100644 --- a/Platform/Windows/Source/SolidSyslogWinsockAddressPrivate.h +++ b/Platform/Windows/Source/SolidSyslogWinsockAddressPrivate.h @@ -36,7 +36,7 @@ static inline void WinsockAddress_Report( enum SolidSyslogWinsockAddressErrors code ) { - SolidSyslog_Error(severity, &WinsockAddressErrorSource, category, code); + SolidSyslog_Error(severity, &WinsockAddressErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGWINSOCKADDRESSPRIVATE_H */ diff --git a/Platform/Windows/Source/SolidSyslogWinsockDatagramPrivate.h b/Platform/Windows/Source/SolidSyslogWinsockDatagramPrivate.h index 022be341..b5a5d399 100644 --- a/Platform/Windows/Source/SolidSyslogWinsockDatagramPrivate.h +++ b/Platform/Windows/Source/SolidSyslogWinsockDatagramPrivate.h @@ -27,7 +27,7 @@ static inline void WinsockDatagram_Report( enum SolidSyslogWinsockDatagramErrors code ) { - SolidSyslog_Error(severity, &WinsockDatagramErrorSource, category, code); + SolidSyslog_Error(severity, &WinsockDatagramErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGWINSOCKDATAGRAMPRIVATE_H */ diff --git a/Platform/Windows/Source/SolidSyslogWinsockResolverPrivate.h b/Platform/Windows/Source/SolidSyslogWinsockResolverPrivate.h index f73f7d35..197a5169 100644 --- a/Platform/Windows/Source/SolidSyslogWinsockResolverPrivate.h +++ b/Platform/Windows/Source/SolidSyslogWinsockResolverPrivate.h @@ -22,7 +22,7 @@ static inline void WinsockResolver_Report( enum SolidSyslogWinsockResolverErrors code ) { - SolidSyslog_Error(severity, &WinsockResolverErrorSource, category, code); + SolidSyslog_Error(severity, &WinsockResolverErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGWINSOCKRESOLVERPRIVATE_H */ diff --git a/Platform/Windows/Source/SolidSyslogWinsockTcpStreamPrivate.h b/Platform/Windows/Source/SolidSyslogWinsockTcpStreamPrivate.h index a2b1ea52..64748f21 100644 --- a/Platform/Windows/Source/SolidSyslogWinsockTcpStreamPrivate.h +++ b/Platform/Windows/Source/SolidSyslogWinsockTcpStreamPrivate.h @@ -30,7 +30,7 @@ static inline void WinsockTcpStream_Report( enum SolidSyslogWinsockTcpStreamErrors code ) { - SolidSyslog_Error(severity, &WinsockTcpStreamErrorSource, category, code); + SolidSyslog_Error(severity, &WinsockTcpStreamErrorSource, category, (int32_t) code); } #endif /* SOLIDSYSLOGWINSOCKTCPSTREAMPRIVATE_H */