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

ldns_rr_list* ldns_rr_list_subtype_by_rdf ( ldns_rr_list l,
ldns_rdf r,
size_t  pos 
)

Return the rr_list which matches the rdf at position field. Think type-covered stuff for RRSIG

Parameters:
[in] l the rr_list to look in
[in] r the rdf to use for the comparison
[in] pos at which position can we find the rdf
Returns:
a new rr list with only the RRs that match

Definition at line 834 of file rr.c.

References ldns_rdf_compare(), ldns_rr_list_new(), ldns_rr_list_push_rr(), ldns_rr_list_rr(), ldns_rr_list_rr_count(), ldns_rr_list_subtype_by_rdf(), and ldns_rr_rdf().

Referenced by ldns_rr_list_subtype_by_rdf().

{
      size_t i;
      ldns_rr_list *subtyped;
      ldns_rdf *list_rdf;

      subtyped = ldns_rr_list_new();

      for(i = 0; i < ldns_rr_list_rr_count(l); i++) {
            list_rdf = ldns_rr_rdf(
                  ldns_rr_list_rr(l, i),
                  pos);
            if (!list_rdf) {
                  /* pos is too large or any other error */
                  return NULL;
            }

            if (ldns_rdf_compare(list_rdf, r) == 0) {
                  /* a match */
                  ldns_rr_list_push_rr(subtyped, 
                              ldns_rr_list_rr(l, i));
            }
      }

      if (ldns_rr_list_rr_count(subtyped) > 0) {
            return subtyped;
      } else {
            return NULL;
      }
}


Generated by  Doxygen 1.6.0   Back to index