]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/varlink-io.systemd.Resolve.Monitor.c
Merge pull request #30661 from rpigott/resolved-https-record
[thirdparty/systemd.git] / src / shared / varlink-io.systemd.Resolve.Monitor.c
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2
3 #include "varlink-io.systemd.Resolve.Monitor.h"
4
5 VARLINK_DEFINE_STRUCT_TYPE(
6 ResourceKey,
7 VARLINK_DEFINE_FIELD(class, VARLINK_INT, 0),
8 VARLINK_DEFINE_FIELD(type, VARLINK_INT, 0),
9 VARLINK_DEFINE_FIELD(name, VARLINK_STRING, 0));
10
11 VARLINK_DEFINE_STRUCT_TYPE(
12 ResourceRecord,
13 VARLINK_DEFINE_FIELD_BY_TYPE(key, ResourceKey, 0),
14 VARLINK_DEFINE_FIELD(priority, VARLINK_INT, VARLINK_NULLABLE),
15 VARLINK_DEFINE_FIELD(weight, VARLINK_INT, VARLINK_NULLABLE),
16 VARLINK_DEFINE_FIELD(port, VARLINK_INT, VARLINK_NULLABLE),
17 VARLINK_DEFINE_FIELD(name, VARLINK_STRING, VARLINK_NULLABLE),
18 VARLINK_DEFINE_FIELD(cpu, VARLINK_STRING, VARLINK_NULLABLE),
19 VARLINK_DEFINE_FIELD(os, VARLINK_STRING, VARLINK_NULLABLE),
20 VARLINK_DEFINE_FIELD(items, VARLINK_STRING, VARLINK_NULLABLE|VARLINK_ARRAY),
21 VARLINK_DEFINE_FIELD(address, VARLINK_INT, VARLINK_NULLABLE|VARLINK_ARRAY),
22 VARLINK_DEFINE_FIELD(mname, VARLINK_STRING, VARLINK_NULLABLE),
23 VARLINK_DEFINE_FIELD(rname, VARLINK_STRING, VARLINK_NULLABLE),
24 VARLINK_DEFINE_FIELD(serial, VARLINK_INT, VARLINK_NULLABLE),
25 VARLINK_DEFINE_FIELD(refresh, VARLINK_INT, VARLINK_NULLABLE),
26 VARLINK_DEFINE_FIELD(expire, VARLINK_INT, VARLINK_NULLABLE),
27 VARLINK_DEFINE_FIELD(minimum, VARLINK_INT, VARLINK_NULLABLE),
28 VARLINK_DEFINE_FIELD(exchange, VARLINK_STRING, VARLINK_NULLABLE),
29 VARLINK_DEFINE_FIELD(version, VARLINK_INT, VARLINK_NULLABLE),
30 VARLINK_DEFINE_FIELD(size, VARLINK_INT, VARLINK_NULLABLE),
31 VARLINK_DEFINE_FIELD(horiz_pre, VARLINK_INT, VARLINK_NULLABLE),
32 VARLINK_DEFINE_FIELD(vert_pre, VARLINK_INT, VARLINK_NULLABLE),
33 VARLINK_DEFINE_FIELD(latitude, VARLINK_INT, VARLINK_NULLABLE),
34 VARLINK_DEFINE_FIELD(longitude, VARLINK_INT, VARLINK_NULLABLE),
35 VARLINK_DEFINE_FIELD(altitude, VARLINK_INT, VARLINK_NULLABLE),
36 VARLINK_DEFINE_FIELD(keyTag, VARLINK_INT, VARLINK_NULLABLE),
37 VARLINK_DEFINE_FIELD(algorithm, VARLINK_INT, VARLINK_NULLABLE),
38 VARLINK_DEFINE_FIELD(digestType, VARLINK_INT, VARLINK_NULLABLE),
39 VARLINK_DEFINE_FIELD(digest, VARLINK_STRING, VARLINK_NULLABLE),
40 VARLINK_DEFINE_FIELD(fptype, VARLINK_INT, VARLINK_NULLABLE),
41 VARLINK_DEFINE_FIELD(fingerprint, VARLINK_STRING, VARLINK_NULLABLE),
42 VARLINK_DEFINE_FIELD(flags, VARLINK_INT, VARLINK_NULLABLE),
43 VARLINK_DEFINE_FIELD(protocol, VARLINK_INT, VARLINK_NULLABLE),
44 VARLINK_DEFINE_FIELD(dnskey, VARLINK_STRING, VARLINK_NULLABLE),
45 VARLINK_DEFINE_FIELD(signer, VARLINK_STRING, VARLINK_NULLABLE),
46 VARLINK_DEFINE_FIELD(typeCovered, VARLINK_INT, VARLINK_NULLABLE),
47 VARLINK_DEFINE_FIELD(labels, VARLINK_INT, VARLINK_NULLABLE),
48 VARLINK_DEFINE_FIELD(originalTtl, VARLINK_INT, VARLINK_NULLABLE),
49 VARLINK_DEFINE_FIELD(expiration, VARLINK_INT, VARLINK_NULLABLE),
50 VARLINK_DEFINE_FIELD(inception, VARLINK_INT, VARLINK_NULLABLE),
51 VARLINK_DEFINE_FIELD(signature, VARLINK_STRING, VARLINK_NULLABLE),
52 VARLINK_DEFINE_FIELD(nextDomain, VARLINK_STRING, VARLINK_NULLABLE),
53 VARLINK_DEFINE_FIELD(types, VARLINK_INT, VARLINK_NULLABLE|VARLINK_ARRAY),
54 VARLINK_DEFINE_FIELD(iterations, VARLINK_INT, VARLINK_NULLABLE),
55 VARLINK_DEFINE_FIELD(salt, VARLINK_STRING, VARLINK_NULLABLE),
56 VARLINK_DEFINE_FIELD(hash, VARLINK_STRING, VARLINK_NULLABLE),
57 VARLINK_DEFINE_FIELD(certUsage, VARLINK_INT, VARLINK_NULLABLE),
58 VARLINK_DEFINE_FIELD(selector, VARLINK_INT, VARLINK_NULLABLE),
59 VARLINK_DEFINE_FIELD(matchingType, VARLINK_INT, VARLINK_NULLABLE),
60 VARLINK_DEFINE_FIELD(data, VARLINK_STRING, VARLINK_NULLABLE),
61 VARLINK_DEFINE_FIELD(tag, VARLINK_STRING, VARLINK_NULLABLE),
62 VARLINK_DEFINE_FIELD(value, VARLINK_STRING, VARLINK_NULLABLE),
63 VARLINK_DEFINE_FIELD(target, VARLINK_STRING, VARLINK_NULLABLE),
64 VARLINK_DEFINE_FIELD(params, VARLINK_STRING, VARLINK_NULLABLE|VARLINK_ARRAY));
65
66 VARLINK_DEFINE_STRUCT_TYPE(
67 ResourceRecordArray,
68 VARLINK_DEFINE_FIELD_BY_TYPE(rr, ResourceRecord, VARLINK_NULLABLE),
69 VARLINK_DEFINE_FIELD(raw, VARLINK_STRING, 0));
70
71 VARLINK_DEFINE_STRUCT_TYPE(
72 Answer,
73 VARLINK_DEFINE_FIELD_BY_TYPE(rr, ResourceRecord, VARLINK_NULLABLE),
74 VARLINK_DEFINE_FIELD(raw, VARLINK_STRING, 0),
75 VARLINK_DEFINE_FIELD(ifindex, VARLINK_INT, VARLINK_NULLABLE));
76
77 VARLINK_DEFINE_METHOD(
78 SubscribeQueryResults,
79 /* First reply */
80 VARLINK_DEFINE_OUTPUT(ready, VARLINK_BOOL, VARLINK_NULLABLE),
81 /* Subsequent replies */
82 VARLINK_DEFINE_OUTPUT(state, VARLINK_STRING, VARLINK_NULLABLE),
83 VARLINK_DEFINE_OUTPUT(result, VARLINK_STRING, VARLINK_NULLABLE),
84 VARLINK_DEFINE_OUTPUT(rcode, VARLINK_INT, VARLINK_NULLABLE),
85 VARLINK_DEFINE_OUTPUT(errno, VARLINK_INT, VARLINK_NULLABLE),
86 VARLINK_DEFINE_OUTPUT(extendedDNSErrorCode, VARLINK_INT, VARLINK_NULLABLE),
87 VARLINK_DEFINE_OUTPUT(extendedDNSErrorMessage, VARLINK_STRING, VARLINK_NULLABLE),
88 VARLINK_DEFINE_OUTPUT_BY_TYPE(question, ResourceKey, VARLINK_NULLABLE|VARLINK_ARRAY),
89 VARLINK_DEFINE_OUTPUT_BY_TYPE(collectedQuestions, ResourceKey, VARLINK_NULLABLE|VARLINK_ARRAY),
90 VARLINK_DEFINE_OUTPUT_BY_TYPE(answer, Answer, VARLINK_NULLABLE|VARLINK_ARRAY));
91
92 VARLINK_DEFINE_STRUCT_TYPE(
93 CacheEntry,
94 VARLINK_DEFINE_FIELD_BY_TYPE(key, ResourceKey, 0),
95 VARLINK_DEFINE_FIELD_BY_TYPE(rrs, ResourceRecordArray, VARLINK_NULLABLE|VARLINK_ARRAY),
96 VARLINK_DEFINE_FIELD(type, VARLINK_STRING, VARLINK_NULLABLE),
97 VARLINK_DEFINE_FIELD(until, VARLINK_INT, 0));
98
99 VARLINK_DEFINE_STRUCT_TYPE(
100 ScopeCache,
101 VARLINK_DEFINE_FIELD(protocol, VARLINK_STRING, 0),
102 VARLINK_DEFINE_FIELD(family, VARLINK_INT, VARLINK_NULLABLE),
103 VARLINK_DEFINE_FIELD(ifindex, VARLINK_INT, VARLINK_NULLABLE),
104 VARLINK_DEFINE_FIELD(ifname, VARLINK_STRING, VARLINK_NULLABLE),
105 VARLINK_DEFINE_FIELD_BY_TYPE(cache, CacheEntry, VARLINK_ARRAY));
106
107 VARLINK_DEFINE_METHOD(
108 DumpCache,
109 VARLINK_DEFINE_OUTPUT_BY_TYPE(dump, ScopeCache, VARLINK_ARRAY));
110
111 VARLINK_DEFINE_STRUCT_TYPE(
112 ServerState,
113 VARLINK_DEFINE_FIELD(Server, VARLINK_STRING, 0),
114 VARLINK_DEFINE_FIELD(Type, VARLINK_STRING, 0),
115 VARLINK_DEFINE_FIELD(Interface, VARLINK_STRING, VARLINK_NULLABLE),
116 VARLINK_DEFINE_FIELD(InterfaceIndex, VARLINK_INT, VARLINK_NULLABLE),
117 VARLINK_DEFINE_FIELD(VerifiedFeatureLevel, VARLINK_STRING, 0),
118 VARLINK_DEFINE_FIELD(PossibleFeatureLevel, VARLINK_STRING, 0),
119 VARLINK_DEFINE_FIELD(DNSSECMode, VARLINK_STRING, 0),
120 VARLINK_DEFINE_FIELD(DNSSECSupported, VARLINK_BOOL, 0),
121 VARLINK_DEFINE_FIELD(ReceivedUDPFragmentMax, VARLINK_INT, 0),
122 VARLINK_DEFINE_FIELD(FailedUDPAttempts, VARLINK_INT, 0),
123 VARLINK_DEFINE_FIELD(FailedTCPAttempts, VARLINK_INT, 0),
124 VARLINK_DEFINE_FIELD(PacketTruncated, VARLINK_BOOL, 0),
125 VARLINK_DEFINE_FIELD(PacketBadOpt, VARLINK_BOOL, 0),
126 VARLINK_DEFINE_FIELD(PacketRRSIGMissing, VARLINK_BOOL, 0),
127 VARLINK_DEFINE_FIELD(PacketInvalid, VARLINK_BOOL, 0),
128 VARLINK_DEFINE_FIELD(PacketDoOff, VARLINK_BOOL, 0));
129
130 VARLINK_DEFINE_METHOD(
131 DumpServerState,
132 VARLINK_DEFINE_OUTPUT_BY_TYPE(dump, ServerState, VARLINK_ARRAY));
133
134 VARLINK_DEFINE_STRUCT_TYPE(
135 TransactionStatistics,
136 VARLINK_DEFINE_FIELD(currentTransactions, VARLINK_INT, 0),
137 VARLINK_DEFINE_FIELD(totalTransactions, VARLINK_INT, 0),
138 VARLINK_DEFINE_FIELD(totalTimeouts, VARLINK_INT, 0),
139 VARLINK_DEFINE_FIELD(totalTimeoutsServedStale, VARLINK_INT, 0),
140 VARLINK_DEFINE_FIELD(totalFailedResponses, VARLINK_INT, 0),
141 VARLINK_DEFINE_FIELD(totalFailedResponsesServedStale, VARLINK_INT, 0));
142
143 VARLINK_DEFINE_STRUCT_TYPE(
144 CacheStatistics,
145 VARLINK_DEFINE_FIELD(size, VARLINK_INT, 0),
146 VARLINK_DEFINE_FIELD(hits, VARLINK_INT, 0),
147 VARLINK_DEFINE_FIELD(misses, VARLINK_INT, 0));
148
149 VARLINK_DEFINE_STRUCT_TYPE(
150 DnssecStatistics,
151 VARLINK_DEFINE_FIELD(secure, VARLINK_INT, 0),
152 VARLINK_DEFINE_FIELD(insecure, VARLINK_INT, 0),
153 VARLINK_DEFINE_FIELD(bogus, VARLINK_INT, 0),
154 VARLINK_DEFINE_FIELD(indeterminate, VARLINK_INT, 0));
155
156 VARLINK_DEFINE_METHOD(
157 DumpStatistics,
158 VARLINK_DEFINE_OUTPUT_BY_TYPE(transactions, TransactionStatistics, 0),
159 VARLINK_DEFINE_OUTPUT_BY_TYPE(cache, CacheStatistics, 0),
160 VARLINK_DEFINE_OUTPUT_BY_TYPE(dnssec, DnssecStatistics, 0));
161
162 VARLINK_DEFINE_METHOD(ResetStatistics);
163
164 VARLINK_DEFINE_INTERFACE(
165 io_systemd_Resolve_Monitor,
166 "io.systemd.Resolve.Monitor",
167 &vl_method_SubscribeQueryResults,
168 &vl_method_DumpCache,
169 &vl_method_DumpServerState,
170 &vl_method_DumpStatistics,
171 &vl_method_ResetStatistics,
172 &vl_type_ResourceKey,
173 &vl_type_ResourceRecord,
174 &vl_type_ResourceRecordArray,
175 &vl_type_Answer,
176 &vl_type_CacheEntry,
177 &vl_type_ScopeCache,
178 &vl_type_TransactionStatistics,
179 &vl_type_CacheStatistics,
180 &vl_type_DnssecStatistics,
181 &vl_type_ServerState);