--- /dev/null
+/*
+ * dns.h -- defines for the Domain Name System
+ *
+ * Copyright (c) 2001-2005, NLnet Labs. All rights reserved.
+ *
+ * See LICENSE for the license.
+ *
+ * A bunch of defines that are used in the DNS
+ */
+
+#ifndef _DNS_H_
+#define _DNS_H_
+
+#define IP4ADDRLEN (32/8)
+#define IP6ADDRLEN (128/8)
+
+#endif /* _DNS_H_ */
LDNS_STATUS_INTERNAL_ERR,
LDNS_STATUS_ERR,
LDNS_STATUS_INT_EXP,
- LDNS_STATUS_INVALID_IP4
+ LDNS_STATUS_INVALID_IP4,
+ LDNS_STATUS_INVALID_IP6
};
typedef enum ldns_enum_status ldns_status;
#include <ldns/packet.h>
#include <ldns/wire2host.h>
#include <ldns/host2str.h>
+#include <ldns/dns.h>
#endif /* _LDNS_H */
syn keyword ldnsMacro LDNS_STATUS_INT_EXP
syn keyword ldnsMacro LDNS_STATUS_ERR
syn keyword ldnsMacro LDNS_STATUS_INVALID_IP4
+syn keyword ldnsMacro LDNS_STATUS_INVALID_IP6
" ldns/resolver.h
syn keyword ldnsType ldns_resolver
#include <config.h>
#include <ldns/str2host.h>
+#include <ldns/dns.h>
#include "util.h"
ldns_status
ldns_str2rdf_aaaa(ldns_rdf **rd, const uint8_t* str)
{
+ uint8_t address[IP6ADDRLEN];
+
+ if (inet_pton(AF_INET6, (char*)str, address) != 1) {
+ return LDNS_STATUS_INVALID_IP6;
+ } else {
+ *rd = ldns_rdf_new(sizeof(address), LDNS_RDF_TYPE_AAAA, &address);
+ }
return LDNS_STATUS_OK;
}