X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fresolve%2Fresolved-dns-packet.h;h=561dd3adfa72fd57187216126a2c9d605ac6ea88;hp=6a865a2d5b524a89f5f33501b566c1ceebc0fe26;hb=0e3434aeb1eed951fdbeddacc6126e10d82a1c8b;hpb=a407657425a3e47fd2b559cd3bc800f791303f63 diff --git a/src/resolve/resolved-dns-packet.h b/src/resolve/resolved-dns-packet.h index 6a865a2d5..561dd3adf 100644 --- a/src/resolve/resolved-dns-packet.h +++ b/src/resolve/resolved-dns-packet.h @@ -34,6 +34,7 @@ typedef struct DnsPacket DnsPacket; #include "resolved-dns-rr.h" #include "resolved-dns-question.h" #include "resolved-dns-answer.h" +#include "resolved-def.h" typedef enum DnsProtocol { DNS_PROTOCOL_DNS, @@ -220,3 +221,16 @@ enum { const char* dnssec_algorithm_to_string(int i) _const_; int dnssec_algorithm_from_string(const char *s) _pure_; + +static inline uint64_t SD_RESOLVED_FLAGS_MAKE(DnsProtocol protocol, int family) { + + /* Converts a protocol + family into a flags field as used in queries */ + + if (protocol == DNS_PROTOCOL_DNS) + return SD_RESOLVED_DNS; + + if (protocol == DNS_PROTOCOL_LLMNR) + return family == AF_INET6 ? SD_RESOLVED_LLMNR_IPV6 : SD_RESOLVED_LLMNR_IPV4; + + return 0; +}