unsigned short i;
unsigned int pos = 0;
- /* todo: use #defines for address families? */
-
- /* ipv4 */
while (pos < (unsigned int) ldns_rdf_size(rdf)) {
address_family = ldns_read_uint16(&data[pos]);
prefix = data[pos + 2];
- negation = data[pos + 3] & 0x80;
- adf_length = data[pos + 3] & 0x7f;
- if (address_family == 1) {
+ negation = data[pos + 3] & LDNS_APL_NEGATION;
+ adf_length = data[pos + 3] & LDNS_APL_MASK;
+ if (address_family == LDNS_APL_IP4) {
/* check if prefix < 32? */
if (negation) {
ldns_buffer_printf(output, "!");
}
}
ldns_buffer_printf(output, "/%u ", prefix);
- } else if (address_family == 2) {
+ } else if (address_family == LDNS_APL_IP6) {
/* check if prefix < 128? */
if (negation) {
ldns_buffer_printf(output, "!");
#include "ldns/util.h"
+#define LDNS_APL_IP4 1
+#define LDNS_APL_IP6 2
+#define LDNS_APL_MASK 0x7f
+#define LDNS_APL_NEGATION 0x80
+
/**
* Converts an LDNS_RDF_TYPE_A rdata element to string format and adds it to the output buffer
* \param[in] *rdf The rdata to convert
" ldns/host2str.h
syn keyword ldnsType ldns_lookup_table
+syn keyword ldnsConstant LDNS_APL_IP4
+syn keyword ldnsConstant LDNS_APL_IP6
" ldns/keys.h
syn keyword ldnsType ldns_key