diff options
Diffstat (limited to 'src/shared/varlink-io.systemd.Resolve.Monitor.c')
-rw-r--r-- | src/shared/varlink-io.systemd.Resolve.Monitor.c | 92 |
1 files changed, 20 insertions, 72 deletions
diff --git a/src/shared/varlink-io.systemd.Resolve.Monitor.c b/src/shared/varlink-io.systemd.Resolve.Monitor.c index d95b613..ba928fa 100644 --- a/src/shared/varlink-io.systemd.Resolve.Monitor.c +++ b/src/shared/varlink-io.systemd.Resolve.Monitor.c @@ -2,96 +2,44 @@ #include "varlink-io.systemd.Resolve.Monitor.h" -VARLINK_DEFINE_STRUCT_TYPE( - ResourceKey, - VARLINK_DEFINE_FIELD(class, VARLINK_INT, 0), - VARLINK_DEFINE_FIELD(type, VARLINK_INT, 0), - VARLINK_DEFINE_FIELD(name, VARLINK_STRING, 0)); - -VARLINK_DEFINE_STRUCT_TYPE( - ResourceRecord, - VARLINK_DEFINE_FIELD_BY_TYPE(key, ResourceKey, 0), - VARLINK_DEFINE_FIELD(priority, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(weight, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(port, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(name, VARLINK_STRING, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(cpu, VARLINK_STRING, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(os, VARLINK_STRING, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(items, VARLINK_STRING, VARLINK_NULLABLE|VARLINK_ARRAY), - VARLINK_DEFINE_FIELD(address, VARLINK_INT, VARLINK_NULLABLE|VARLINK_ARRAY), - VARLINK_DEFINE_FIELD(mname, VARLINK_STRING, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(rname, VARLINK_STRING, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(serial, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(refresh, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(expire, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(minimum, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(exchange, VARLINK_STRING, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(version, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(size, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(horiz_pre, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(vert_pre, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(latitude, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(longitude, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(altitude, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(keyTag, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(algorithm, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(digestType, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(digest, VARLINK_STRING, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(fptype, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(fingerprint, VARLINK_STRING, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(flags, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(protocol, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(dnskey, VARLINK_STRING, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(signer, VARLINK_STRING, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(typeCovered, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(labels, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(originalTtl, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(expiration, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(inception, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(signature, VARLINK_STRING, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(nextDomain, VARLINK_STRING, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(types, VARLINK_INT, VARLINK_NULLABLE|VARLINK_ARRAY), - VARLINK_DEFINE_FIELD(iterations, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(salt, VARLINK_STRING, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(hash, VARLINK_STRING, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(certUsage, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(selector, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(matchingType, VARLINK_INT, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(data, VARLINK_STRING, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(tag, VARLINK_STRING, VARLINK_NULLABLE), - VARLINK_DEFINE_FIELD(value, VARLINK_STRING, VARLINK_NULLABLE)); - -VARLINK_DEFINE_STRUCT_TYPE( +/* 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 VARLINK_DEFINE_STRUCT_TYPE( ResourceRecordArray, VARLINK_DEFINE_FIELD_BY_TYPE(rr, ResourceRecord, VARLINK_NULLABLE), VARLINK_DEFINE_FIELD(raw, VARLINK_STRING, 0)); -VARLINK_DEFINE_STRUCT_TYPE( +static VARLINK_DEFINE_STRUCT_TYPE( Answer, VARLINK_DEFINE_FIELD_BY_TYPE(rr, ResourceRecord, VARLINK_NULLABLE), VARLINK_DEFINE_FIELD(raw, VARLINK_STRING, 0), VARLINK_DEFINE_FIELD(ifindex, VARLINK_INT, VARLINK_NULLABLE)); -VARLINK_DEFINE_METHOD( +static VARLINK_DEFINE_METHOD( SubscribeQueryResults, /* First reply */ VARLINK_DEFINE_OUTPUT(ready, VARLINK_BOOL, VARLINK_NULLABLE), /* Subsequent replies */ VARLINK_DEFINE_OUTPUT(state, VARLINK_STRING, VARLINK_NULLABLE), + VARLINK_DEFINE_OUTPUT(result, VARLINK_STRING, VARLINK_NULLABLE), VARLINK_DEFINE_OUTPUT(rcode, VARLINK_INT, VARLINK_NULLABLE), VARLINK_DEFINE_OUTPUT(errno, VARLINK_INT, VARLINK_NULLABLE), + VARLINK_DEFINE_OUTPUT(extendedDNSErrorCode, VARLINK_INT, VARLINK_NULLABLE), + VARLINK_DEFINE_OUTPUT(extendedDNSErrorMessage, VARLINK_STRING, VARLINK_NULLABLE), VARLINK_DEFINE_OUTPUT_BY_TYPE(question, ResourceKey, VARLINK_NULLABLE|VARLINK_ARRAY), VARLINK_DEFINE_OUTPUT_BY_TYPE(collectedQuestions, ResourceKey, VARLINK_NULLABLE|VARLINK_ARRAY), VARLINK_DEFINE_OUTPUT_BY_TYPE(answer, Answer, VARLINK_NULLABLE|VARLINK_ARRAY)); -VARLINK_DEFINE_STRUCT_TYPE( +static VARLINK_DEFINE_STRUCT_TYPE( CacheEntry, VARLINK_DEFINE_FIELD_BY_TYPE(key, ResourceKey, 0), VARLINK_DEFINE_FIELD_BY_TYPE(rrs, ResourceRecordArray, VARLINK_NULLABLE|VARLINK_ARRAY), VARLINK_DEFINE_FIELD(type, VARLINK_STRING, VARLINK_NULLABLE), VARLINK_DEFINE_FIELD(until, VARLINK_INT, 0)); -VARLINK_DEFINE_STRUCT_TYPE( +static VARLINK_DEFINE_STRUCT_TYPE( ScopeCache, VARLINK_DEFINE_FIELD(protocol, VARLINK_STRING, 0), VARLINK_DEFINE_FIELD(family, VARLINK_INT, VARLINK_NULLABLE), @@ -99,11 +47,11 @@ VARLINK_DEFINE_STRUCT_TYPE( VARLINK_DEFINE_FIELD(ifname, VARLINK_STRING, VARLINK_NULLABLE), VARLINK_DEFINE_FIELD_BY_TYPE(cache, CacheEntry, VARLINK_ARRAY)); -VARLINK_DEFINE_METHOD( +static VARLINK_DEFINE_METHOD( DumpCache, VARLINK_DEFINE_OUTPUT_BY_TYPE(dump, ScopeCache, VARLINK_ARRAY)); -VARLINK_DEFINE_STRUCT_TYPE( +static VARLINK_DEFINE_STRUCT_TYPE( ServerState, VARLINK_DEFINE_FIELD(Server, VARLINK_STRING, 0), VARLINK_DEFINE_FIELD(Type, VARLINK_STRING, 0), @@ -122,11 +70,11 @@ VARLINK_DEFINE_STRUCT_TYPE( VARLINK_DEFINE_FIELD(PacketInvalid, VARLINK_BOOL, 0), VARLINK_DEFINE_FIELD(PacketDoOff, VARLINK_BOOL, 0)); -VARLINK_DEFINE_METHOD( +static VARLINK_DEFINE_METHOD( DumpServerState, VARLINK_DEFINE_OUTPUT_BY_TYPE(dump, ServerState, VARLINK_ARRAY)); -VARLINK_DEFINE_STRUCT_TYPE( +static VARLINK_DEFINE_STRUCT_TYPE( TransactionStatistics, VARLINK_DEFINE_FIELD(currentTransactions, VARLINK_INT, 0), VARLINK_DEFINE_FIELD(totalTransactions, VARLINK_INT, 0), @@ -135,26 +83,26 @@ VARLINK_DEFINE_STRUCT_TYPE( VARLINK_DEFINE_FIELD(totalFailedResponses, VARLINK_INT, 0), VARLINK_DEFINE_FIELD(totalFailedResponsesServedStale, VARLINK_INT, 0)); -VARLINK_DEFINE_STRUCT_TYPE( +static VARLINK_DEFINE_STRUCT_TYPE( CacheStatistics, VARLINK_DEFINE_FIELD(size, VARLINK_INT, 0), VARLINK_DEFINE_FIELD(hits, VARLINK_INT, 0), VARLINK_DEFINE_FIELD(misses, VARLINK_INT, 0)); -VARLINK_DEFINE_STRUCT_TYPE( +static VARLINK_DEFINE_STRUCT_TYPE( DnssecStatistics, VARLINK_DEFINE_FIELD(secure, VARLINK_INT, 0), VARLINK_DEFINE_FIELD(insecure, VARLINK_INT, 0), VARLINK_DEFINE_FIELD(bogus, VARLINK_INT, 0), VARLINK_DEFINE_FIELD(indeterminate, VARLINK_INT, 0)); -VARLINK_DEFINE_METHOD( +static VARLINK_DEFINE_METHOD( DumpStatistics, VARLINK_DEFINE_OUTPUT_BY_TYPE(transactions, TransactionStatistics, 0), VARLINK_DEFINE_OUTPUT_BY_TYPE(cache, CacheStatistics, 0), VARLINK_DEFINE_OUTPUT_BY_TYPE(dnssec, DnssecStatistics, 0)); -VARLINK_DEFINE_METHOD(ResetStatistics); +static VARLINK_DEFINE_METHOD(ResetStatistics); VARLINK_DEFINE_INTERFACE( io_systemd_Resolve_Monitor, |