X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fresolve%2Fresolved-dns-packet.h;h=c5867386c67fa9f1dbd4f597a29b99e0ca0241df;hb=32a568fb90bf0a22a3007fa670305403a5d0bb72;hp=26a2e7646a50e8a9f9e676dde02b821f556a4a9b;hpb=151226ab4bf276d60d51864330a99f886b923697;p=elogind.git diff --git a/src/resolve/resolved-dns-packet.h b/src/resolve/resolved-dns-packet.h index 26a2e7646..c5867386c 100644 --- a/src/resolve/resolved-dns-packet.h +++ b/src/resolve/resolved-dns-packet.h @@ -21,7 +21,6 @@ along with systemd; If not, see . ***/ -#include #include "macro.h" #include "sparse-endian.h" @@ -34,6 +33,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, @@ -81,6 +81,8 @@ struct DnsPacket { union in_addr_union sender, destination; uint16_t sender_port, destination_port; uint32_t ttl; + + bool extracted; }; static inline uint8_t* DNS_PACKET_DATA(DnsPacket *p) { @@ -218,3 +220,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; +}