1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-polkit.h"
#include "varlink-io.systemd.Resolve.Monitor.h"
/* We want to reuse the ResourceKey and ResourceRecord structures from the io.systemd.Resolve interface,
* hence import them here. */
#include "varlink-io.systemd.Resolve.h"
static SD_VARLINK_DEFINE_STRUCT_TYPE(
ResourceRecordArray,
SD_VARLINK_DEFINE_FIELD_BY_TYPE(rr, ResourceRecord, SD_VARLINK_NULLABLE),
SD_VARLINK_DEFINE_FIELD(raw, SD_VARLINK_STRING, 0));
static SD_VARLINK_DEFINE_STRUCT_TYPE(
Answer,
SD_VARLINK_DEFINE_FIELD_BY_TYPE(rr, ResourceRecord, SD_VARLINK_NULLABLE),
SD_VARLINK_DEFINE_FIELD(raw, SD_VARLINK_STRING, 0),
SD_VARLINK_DEFINE_FIELD(ifindex, SD_VARLINK_INT, SD_VARLINK_NULLABLE));
static SD_VARLINK_DEFINE_METHOD_FULL(
SubscribeQueryResults,
SD_VARLINK_REQUIRES_MORE,
VARLINK_DEFINE_POLKIT_INPUT,
/* First reply */
SD_VARLINK_DEFINE_OUTPUT(ready, SD_VARLINK_BOOL, SD_VARLINK_NULLABLE),
/* Subsequent replies */
SD_VARLINK_DEFINE_OUTPUT(state, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
SD_VARLINK_DEFINE_OUTPUT(result, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
SD_VARLINK_DEFINE_OUTPUT(rcode, SD_VARLINK_INT, SD_VARLINK_NULLABLE),
SD_VARLINK_DEFINE_OUTPUT(errno, SD_VARLINK_INT, SD_VARLINK_NULLABLE),
SD_VARLINK_DEFINE_OUTPUT(extendedDNSErrorCode, SD_VARLINK_INT, SD_VARLINK_NULLABLE),
SD_VARLINK_DEFINE_OUTPUT(extendedDNSErrorMessage, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
SD_VARLINK_DEFINE_OUTPUT_BY_TYPE(question, ResourceKey, SD_VARLINK_NULLABLE|SD_VARLINK_ARRAY),
SD_VARLINK_DEFINE_OUTPUT_BY_TYPE(collectedQuestions, ResourceKey, SD_VARLINK_NULLABLE|SD_VARLINK_ARRAY),
SD_VARLINK_DEFINE_OUTPUT_BY_TYPE(answer, Answer, SD_VARLINK_NULLABLE|SD_VARLINK_ARRAY));
static SD_VARLINK_DEFINE_STRUCT_TYPE(
CacheEntry,
SD_VARLINK_DEFINE_FIELD_BY_TYPE(key, ResourceKey, 0),
SD_VARLINK_DEFINE_FIELD_BY_TYPE(rrs, ResourceRecordArray, SD_VARLINK_NULLABLE|SD_VARLINK_ARRAY),
SD_VARLINK_DEFINE_FIELD(type, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
SD_VARLINK_DEFINE_FIELD(until, SD_VARLINK_INT, 0));
static SD_VARLINK_DEFINE_STRUCT_TYPE(
ScopeCache,
SD_VARLINK_DEFINE_FIELD(protocol, SD_VARLINK_STRING, 0),
SD_VARLINK_DEFINE_FIELD(family, SD_VARLINK_INT, SD_VARLINK_NULLABLE),
SD_VARLINK_DEFINE_FIELD(ifindex, SD_VARLINK_INT, SD_VARLINK_NULLABLE),
SD_VARLINK_DEFINE_FIELD(ifname, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
SD_VARLINK_DEFINE_FIELD_BY_TYPE(cache, CacheEntry, SD_VARLINK_ARRAY));
static SD_VARLINK_DEFINE_METHOD(
DumpCache,
VARLINK_DEFINE_POLKIT_INPUT,
SD_VARLINK_DEFINE_OUTPUT_BY_TYPE(dump, ScopeCache, SD_VARLINK_ARRAY));
static SD_VARLINK_DEFINE_STRUCT_TYPE(
ServerState,
SD_VARLINK_DEFINE_FIELD(Server, SD_VARLINK_STRING, 0),
SD_VARLINK_DEFINE_FIELD(Type, SD_VARLINK_STRING, 0),
SD_VARLINK_DEFINE_FIELD(Interface, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
SD_VARLINK_DEFINE_FIELD(InterfaceIndex, SD_VARLINK_INT, SD_VARLINK_NULLABLE),
SD_VARLINK_DEFINE_FIELD(VerifiedFeatureLevel, SD_VARLINK_STRING, 0),
SD_VARLINK_DEFINE_FIELD(PossibleFeatureLevel, SD_VARLINK_STRING, 0),
SD_VARLINK_DEFINE_FIELD(DNSSECMode, SD_VARLINK_STRING, 0),
SD_VARLINK_DEFINE_FIELD(DNSSECSupported, SD_VARLINK_BOOL, 0),
SD_VARLINK_DEFINE_FIELD(ReceivedUDPFragmentMax, SD_VARLINK_INT, 0),
SD_VARLINK_DEFINE_FIELD(FailedUDPAttempts, SD_VARLINK_INT, 0),
SD_VARLINK_DEFINE_FIELD(FailedTCPAttempts, SD_VARLINK_INT, 0),
SD_VARLINK_DEFINE_FIELD(PacketTruncated, SD_VARLINK_BOOL, 0),
SD_VARLINK_DEFINE_FIELD(PacketBadOpt, SD_VARLINK_BOOL, 0),
SD_VARLINK_DEFINE_FIELD(PacketRRSIGMissing, SD_VARLINK_BOOL, 0),
SD_VARLINK_DEFINE_FIELD(PacketInvalid, SD_VARLINK_BOOL, 0),
SD_VARLINK_DEFINE_FIELD(PacketDoOff, SD_VARLINK_BOOL, 0));
static SD_VARLINK_DEFINE_METHOD(
DumpServerState,
VARLINK_DEFINE_POLKIT_INPUT,
SD_VARLINK_DEFINE_OUTPUT_BY_TYPE(dump, ServerState, SD_VARLINK_ARRAY));
static SD_VARLINK_DEFINE_STRUCT_TYPE(
TransactionStatistics,
SD_VARLINK_DEFINE_FIELD(currentTransactions, SD_VARLINK_INT, 0),
SD_VARLINK_DEFINE_FIELD(totalTransactions, SD_VARLINK_INT, 0),
SD_VARLINK_DEFINE_FIELD(totalTimeouts, SD_VARLINK_INT, 0),
SD_VARLINK_DEFINE_FIELD(totalTimeoutsServedStale, SD_VARLINK_INT, 0),
SD_VARLINK_DEFINE_FIELD(totalFailedResponses, SD_VARLINK_INT, 0),
SD_VARLINK_DEFINE_FIELD(totalFailedResponsesServedStale, SD_VARLINK_INT, 0));
static SD_VARLINK_DEFINE_STRUCT_TYPE(
CacheStatistics,
SD_VARLINK_DEFINE_FIELD(size, SD_VARLINK_INT, 0),
SD_VARLINK_DEFINE_FIELD(hits, SD_VARLINK_INT, 0),
SD_VARLINK_DEFINE_FIELD(misses, SD_VARLINK_INT, 0));
static SD_VARLINK_DEFINE_STRUCT_TYPE(
DnssecStatistics,
SD_VARLINK_DEFINE_FIELD(secure, SD_VARLINK_INT, 0),
SD_VARLINK_DEFINE_FIELD(insecure, SD_VARLINK_INT, 0),
SD_VARLINK_DEFINE_FIELD(bogus, SD_VARLINK_INT, 0),
SD_VARLINK_DEFINE_FIELD(indeterminate, SD_VARLINK_INT, 0));
static SD_VARLINK_DEFINE_METHOD(
DumpStatistics,
VARLINK_DEFINE_POLKIT_INPUT,
SD_VARLINK_DEFINE_OUTPUT_BY_TYPE(transactions, TransactionStatistics, 0),
SD_VARLINK_DEFINE_OUTPUT_BY_TYPE(cache, CacheStatistics, 0),
SD_VARLINK_DEFINE_OUTPUT_BY_TYPE(dnssec, DnssecStatistics, 0));
static SD_VARLINK_DEFINE_METHOD(
ResetStatistics,
VARLINK_DEFINE_POLKIT_INPUT);
SD_VARLINK_DEFINE_INTERFACE(
io_systemd_Resolve_Monitor,
"io.systemd.Resolve.Monitor",
&vl_method_SubscribeQueryResults,
&vl_method_DumpCache,
&vl_method_DumpServerState,
&vl_method_DumpStatistics,
&vl_method_ResetStatistics,
&vl_type_ResourceKey,
&vl_type_ResourceRecord,
&vl_type_ResourceRecordArray,
&vl_type_Answer,
&vl_type_CacheEntry,
&vl_type_ScopeCache,
&vl_type_TransactionStatistics,
&vl_type_CacheStatistics,
&vl_type_DnssecStatistics,
&vl_type_ServerState);
|