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 SOLIDSYSLOGLWIPRAWDNSRESOLVERPRIVATE_H
6 : #define SOLIDSYSLOGLWIPRAWDNSRESOLVERPRIVATE_H
7 :
8 : #include <stdint.h>
9 :
10 : #include <stdbool.h>
11 :
12 : #include "SolidSyslogError.h"
13 : #include "SolidSyslogLwipRawDnsResolver.h"
14 : #include "SolidSyslogLwipRawDnsResolverErrors.h"
15 : #include "SolidSyslogPrival.h"
16 : #include "SolidSyslogResolverDefinition.h"
17 : #include "lwip/ip_addr.h"
18 :
19 : struct SolidSyslogLwipRawDnsResolver
20 : {
21 : struct SolidSyslogResolver Base;
22 : struct SolidSyslogLwipRawDnsResolverConfig Config;
23 : /* In-flight async-resolve state. The bounded spin polls Done on the
24 : * caller's thread; the dns_found_callback writes Done + ResolvedOk +
25 : * ResolvedIp on the lwIP (tcpip) thread. Done is volatile because the two
26 : * threads are different - the synchronous ERR_OK path writes them too,
27 : * on the caller's thread, before any spin. */
28 : volatile bool Done;
29 : bool ResolvedOk;
30 : ip_addr_t ResolvedIp;
31 : };
32 :
33 : void SolidSyslogLwipRawDnsResolver_Initialise(
34 : struct SolidSyslogResolver* base,
35 : const struct SolidSyslogLwipRawDnsResolverConfig* config
36 : );
37 : void SolidSyslogLwipRawDnsResolver_Cleanup(struct SolidSyslogResolver* base);
38 :
39 27 : static inline void LwipRawDnsResolver_Report(
40 : enum SolidSyslogSeverity severity,
41 : uint16_t category,
42 : enum SolidSyslogResolverErrors code
43 : )
44 : {
45 27 : SolidSyslog_Error(severity, &SolidSyslogLwipRawDnsResolverErrorSource, category, (int32_t) code);
46 27 : }
47 :
48 : #endif /* SOLIDSYSLOGLWIPRAWDNSRESOLVERPRIVATE_H */
|