Logo Search packages:      
Sourcecode: ldns version File versions  Download package

int ldns_rr_compare ( const ldns_rr rr1,
const ldns_rr rr2 
)

compares two rrs.

Parameters:
[in] rr1 the first one
[in] rr2 the second one
Returns:
0 if equal -1 if rr1 comes before rr2 +1 if rr2 comes before rr1

Definition at line 1365 of file rr.c.

References ldns_rr_compare(), ldns_rr_compare_no_rdata(), ldns_rr_compare_wire(), ldns_rr_uncompressed_size(), and LDNS_SECTION_ANY.

Referenced by ldns_pkt_rr(), ldns_rr_compare(), ldns_rr_compare_ds(), ldns_rr_list_compare(), ldns_rr_list_contains_rr(), ldns_rr_set_push_rr(), and match_list().

{
      int result;
      size_t rr1_len, rr2_len;
      
      ldns_buffer *rr1_buf;
      ldns_buffer *rr2_buf;

      result = ldns_rr_compare_no_rdata(rr1, rr2);
      if (result == 0) {
            rr1_len = ldns_rr_uncompressed_size(rr1);
            rr2_len = ldns_rr_uncompressed_size(rr2);

            rr1_buf = ldns_buffer_new(rr1_len);
            rr2_buf = ldns_buffer_new(rr2_len);

            if (ldns_rr2buffer_wire(rr1_buf, rr1, LDNS_SECTION_ANY) != LDNS_STATUS_OK) {
                  ldns_buffer_free(rr1_buf);
                  ldns_buffer_free(rr2_buf);
                  return 0; 
            }
            if (ldns_rr2buffer_wire(rr2_buf, rr2, LDNS_SECTION_ANY) != LDNS_STATUS_OK) {
                  ldns_buffer_free(rr1_buf);
                  ldns_buffer_free(rr2_buf);
                  return 0;
            }

            result = ldns_rr_compare_wire(rr1_buf, rr2_buf);

            ldns_buffer_free(rr1_buf);
            ldns_buffer_free(rr2_buf);
      }

      return result;
}


Generated by  Doxygen 1.6.0   Back to index