Line data Source code
1 : /* SPDX-FileCopyrightText: Copyright 2026 Cozens Software Solutions Limited
2 : * SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0 OR LicenseRef-PolyForm-Internal-Use-1.0.0 OR LicenseRef-COSOSO-Commercial
3 : */
4 :
5 : #ifndef SOLIDSYSLOGWOLFSSLPEMBUFFERCREDENTIALSPRIVATE_H
6 : #define SOLIDSYSLOGWOLFSSLPEMBUFFERCREDENTIALSPRIVATE_H
7 :
8 : #include <stdint.h>
9 :
10 : #include "SolidSyslogError.h"
11 : #include "SolidSyslogPrival.h"
12 : #include "SolidSyslogStreamOpenHealth.h"
13 : #include "SolidSyslogWolfSslCredentialsDefinition.h"
14 : #include "SolidSyslogWolfSslPemBufferCredentials.h"
15 : #include "SolidSyslogWolfSslPemBufferCredentialsErrors.h"
16 :
17 : struct SolidSyslogWolfSslPemBufferCredentials
18 : {
19 : struct SolidSyslogWolfSslCredentials Base;
20 : struct SolidSyslogWolfSslPemBufferCredentialsConfig Config;
21 : /* A refusal that fails Install is reported once per run of the same
22 : * detail, as a stream's failed Open is: the stream asks on every attempt.
23 : * An Install that succeeds re-arms it. */
24 : struct SolidSyslogStreamOpenHealth InstallHealth;
25 : };
26 :
27 : void SolidSyslogWolfSslPemBufferCredentials_Initialise(
28 : struct SolidSyslogWolfSslCredentials* base,
29 : const struct SolidSyslogWolfSslPemBufferCredentialsConfig* config
30 : );
31 : void SolidSyslogWolfSslPemBufferCredentials_Cleanup(struct SolidSyslogWolfSslCredentials* base);
32 :
33 17 : static inline void WolfSslPemBufferCredentials_Report(
34 : enum SolidSyslogSeverity severity,
35 : uint16_t category,
36 : enum SolidSyslogTlsCredentialsErrors code
37 : )
38 : {
39 17 : SolidSyslog_Error(severity, &SolidSyslogWolfSslPemBufferCredentialsErrorSource, category, (int32_t) code);
40 17 : }
41 :
42 8 : static inline void WolfSslPemBufferCredentials_ReportInstallFailure(
43 : struct SolidSyslogWolfSslPemBufferCredentials* self,
44 : enum SolidSyslogSeverity severity,
45 : uint16_t category,
46 : enum SolidSyslogTlsCredentialsErrors code
47 : )
48 : {
49 8 : SolidSyslogStreamOpenHealth_ReportFailure(
50 : &self->InstallHealth,
51 : &SolidSyslogWolfSslPemBufferCredentialsErrorSource,
52 : severity,
53 : category,
54 : (int32_t) code
55 : );
56 8 : }
57 :
58 : #endif /* SOLIDSYSLOGWOLFSSLPEMBUFFERCREDENTIALSPRIVATE_H */
|