mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-23 17:34:00 +03:00
resolved: move dns_type_to_af() to dns-type.c
This commit is contained in:
parent
edbcc1fdd9
commit
d07b43a18e
@ -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) {
|
||||
|
@ -133,6 +133,7 @@ bool dns_type_is_dnssec(uint16_t type);
|
||||
bool dns_type_is_obsolete(uint16_t type);
|
||||
bool dns_type_may_wildcard(uint16_t type);
|
||||
bool dns_type_apex_only(uint16_t type);
|
||||
int dns_type_to_af(uint16_t t);
|
||||
|
||||
bool dns_class_is_pseudo(uint16_t class);
|
||||
bool dns_class_is_valid_rr(uint16_t class);
|
||||
|
@ -595,23 +595,6 @@ static DnsProtocol SYNTHESIZE_PROTOCOL(uint64_t flags) {
|
||||
return DNS_PROTOCOL_DNS;
|
||||
}
|
||||
|
||||
static 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;
|
||||
}
|
||||
}
|
||||
|
||||
static int synthesize_localhost_rr(DnsQuery *q, const DnsResourceKey *key, DnsAnswer **answer) {
|
||||
int r;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user