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 SOLIDSYSLOGOPENSSLPEMFILECREDENTIALSPRIVATE_H
6 : #define SOLIDSYSLOGOPENSSLPEMFILECREDENTIALSPRIVATE_H
7 :
8 : #include <stdint.h>
9 :
10 : #include "SolidSyslogError.h"
11 : #include "SolidSyslogOpenSslCredentialsDefinition.h"
12 : #include "SolidSyslogOpenSslPemFileCredentials.h"
13 : #include "SolidSyslogOpenSslPemFileCredentialsErrors.h"
14 : #include "SolidSyslogPrival.h"
15 : #include "SolidSyslogStreamOpenHealth.h"
16 :
17 : struct SolidSyslogOpenSslPemFileCredentials
18 : {
19 : struct SolidSyslogOpenSslCredentials Base;
20 : struct SolidSyslogOpenSslPemFileCredentialsConfig 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 SolidSyslogOpenSslPemFileCredentials_Initialise(
28 : struct SolidSyslogOpenSslCredentials* base,
29 : const struct SolidSyslogOpenSslPemFileCredentialsConfig* config
30 : );
31 :
32 15 : static inline void OpenSslPemFileCredentials_Report(
33 : enum SolidSyslogSeverity severity,
34 : uint16_t category,
35 : enum SolidSyslogTlsCredentialsErrors code
36 : )
37 : {
38 15 : SolidSyslog_Error(severity, &SolidSyslogOpenSslPemFileCredentialsErrorSource, category, (int32_t) code);
39 15 : }
40 :
41 8 : static inline void OpenSslPemFileCredentials_ReportInstallFailure(
42 : struct SolidSyslogOpenSslPemFileCredentials* self,
43 : enum SolidSyslogSeverity severity,
44 : uint16_t category,
45 : enum SolidSyslogTlsCredentialsErrors code
46 : )
47 : {
48 8 : SolidSyslogStreamOpenHealth_ReportFailure(
49 : &self->InstallHealth,
50 : &SolidSyslogOpenSslPemFileCredentialsErrorSource,
51 : severity,
52 : category,
53 : (int32_t) code
54 : );
55 8 : }
56 :
57 : #endif /* SOLIDSYSLOGOPENSSLPEMFILECREDENTIALSPRIVATE_H */
|