]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
host2str TODO's fixed
authorMiek Gieben <miekg@NLnetLabs.nl>
Thu, 8 Sep 2005 12:32:54 +0000 (12:32 +0000)
committerMiek Gieben <miekg@NLnetLabs.nl>
Thu, 8 Sep 2005 12:32:54 +0000 (12:32 +0000)
host2str.c
ldns/host2str.h
libdns.vim

index ec0bf7e2fd616ebaca4673bdf87ac4662b781627..f49ff01e5a4bde3938eaf82184ed2d5d3305e6f6 100644 (file)
@@ -525,15 +525,12 @@ ldns_rdf2buffer_str_apl(ldns_buffer *output, ldns_rdf *rdf)
        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, "!");
@@ -552,7 +549,7 @@ ldns_rdf2buffer_str_apl(ldns_buffer *output, ldns_rdf *rdf)
                                }
                        }
                        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, "!");
index 4b588f0759d767695ff5e59dd67ac299bc8046da..6a8589bf932046a974167cff937a2eb8cf1a572f 100644 (file)
 
 #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
index be73aa985256070be29f72d579dc82c9c768ade0..e0d35532b36330edc96928e01348d1924901a0ba 100644 (file)
@@ -261,6 +261,8 @@ syn keyword  ldnsConstant   LDNS_MIN_BUFLEN
 
 " 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