X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fbasic%2Fverbs.h;h=7b5e18510f1099001daeea1fc7055dec0ebe18cb;hp=03013beb8292944c2fa2718bbb4d6632842803a9;hb=4a7059686430f596810f0c83e4897154828fd352;hpb=1cfc78c91965df340cdde100ad6cb3ed50b28927 diff --git a/src/basic/verbs.h b/src/basic/verbs.h index 03013beb8..7b5e18510 100644 --- a/src/basic/verbs.h +++ b/src/basic/verbs.h @@ -1,5 +1,3 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - #pragma once /*** @@ -21,45 +19,15 @@ along with systemd; If not, see . ***/ -#include "in-addr-util.h" - -typedef struct DnsServer DnsServer; -typedef enum DnsServerSource DnsServerSource; - -typedef enum DnsServerType { - DNS_SERVER_SYSTEM, - DNS_SERVER_FALLBACK, - DNS_SERVER_LINK, -} DnsServerType; - -#include "resolved-link.h" - -struct DnsServer { - Manager *manager; - - unsigned n_ref; - - DnsServerType type; - - Link *link; - - int family; - union in_addr_union address; - - bool marked:1; - - LIST_FIELDS(DnsServer, servers); -}; - -int dns_server_new( - Manager *m, - DnsServer **s, - DnsServerType type, - Link *l, - int family, - const union in_addr_union *address); +#define VERB_ANY ((unsigned) -1) +#define VERB_DEFAULT 1U +#define VERB_NOCHROOT 2U -DnsServer* dns_server_ref(DnsServer *s); -DnsServer* dns_server_unref(DnsServer *s); +typedef struct { + const char *verb; + unsigned min_args, max_args; + unsigned flags; + int (* const dispatch)(int argc, char *argv[], void *userdata); +} Verb; -extern const struct hash_ops dns_server_hash_ops; +int dispatch_verb(int argc, char *argv[], const Verb verbs[], void *userdata);