diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-01-20 21:30:59 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-01-25 15:59:40 +0100 |
commit | d07b43a18e2234e8abebc1cd4d93bfd78ab62001 (patch) | |
tree | 0d0237fb1141a60659e181023a2629e4ffbc3fce /src/resolve/dns-type.c | |
parent | edbcc1fdd94355c5cf22263ba2c1cfa4ec2eb010 (diff) |
resolved: move dns_type_to_af() to dns-type.c
Diffstat (limited to 'src/resolve/dns-type.c')
-rw-r--r-- | src/resolve/dns-type.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/resolve/dns-type.c b/src/resolve/dns-type.c index 058d14009a..56720646ca 100644 --- a/src/resolve/dns-type.c +++ b/src/resolve/dns-type.c @@ -19,6 +19,8 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include <sys/socket.h> + #include "dns-type.h" #include "string-util.h" @@ -183,6 +185,23 @@ bool dns_type_is_obsolete(uint16_t type) { DNS_TYPE_NULL); } +int dns_type_to_af(uint16_t t) { + switch (t) { + + case DNS_TYPE_A: + return AF_INET; + + case DNS_TYPE_AAAA: + return AF_INET6; + + case DNS_TYPE_ANY: + return AF_UNSPEC; + + default: + return -EINVAL; + } +} + const char *dns_class_to_string(uint16_t class) { switch (class) { |