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

bool ldns_is_rrset ( ldns_rr_list rr_list  ) 

checks if an rr_list is a rrset.

Parameters:
[in] rr_list the rr_list to check
Returns:
true if it is an rrset otherwise false

Definition at line 987 of file rr.c.

References ldns_is_rrset(), ldns_rdf_compare(), ldns_rr_get_class(), ldns_rr_get_type(), ldns_rr_list_rr(), ldns_rr_list_rr_count(), and ldns_rr_owner().

Referenced by ldns_is_rrset().

{
      ldns_rr_type t; 
      ldns_rr_class c;
      ldns_rdf *o;
      ldns_rr *tmp;
      size_t i;
      
      if (!rr_list) {
            return false;
      }

      tmp = ldns_rr_list_rr(rr_list, 0);

      t = ldns_rr_get_type(tmp);
      c = ldns_rr_get_class(tmp);
      o = ldns_rr_owner(tmp);

      /* compare these with the rest of the rr_list, start with 1 */
      for (i = 1; i < ldns_rr_list_rr_count(rr_list); i++) {
            tmp = ldns_rr_list_rr(rr_list, 1);
            if (t != ldns_rr_get_type(tmp)) {
                  return false;
            }
            if (c != ldns_rr_get_class(tmp)) {
                  return false;
            }
            if (ldns_rdf_compare(o, ldns_rr_owner(tmp)) != 0) {
                  return false;
            }
      }
      return true;
}


Generated by  Doxygen 1.6.0   Back to index