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

ldns_rr* ldns_rr_new_frm_type ( ldns_rr_type  t  ) 

creates a new rr structure, based on the given type. alloc enough space to hold all the rdf's

Definition at line 41 of file rr.c.

References ldns_struct_rr::_rdata_fields, LDNS_RR_CLASS_IN, ldns_rr_descript(), ldns_rr_descriptor_minimum(), ldns_rr_new_frm_type(), ldns_rr_set_class(), ldns_rr_set_rd_count(), ldns_rr_set_ttl(), and ldns_rr_set_type().

Referenced by ldns_rr_new_frm_type().

{
      ldns_rr *rr;
      const ldns_rr_descriptor *desc;
      size_t i;

      rr = LDNS_MALLOC(ldns_rr);
        if (!rr) {
                return NULL;
      }
      
      desc = ldns_rr_descript(t);

      rr->_rdata_fields = LDNS_XMALLOC(ldns_rdf *, ldns_rr_descriptor_minimum(desc));
      for (i = 0; i < ldns_rr_descriptor_minimum(desc); i++) {
            rr->_rdata_fields[i] = NULL;
      }
      
      /* set the count to minimum */
      ldns_rr_set_rd_count(rr, ldns_rr_descriptor_minimum(desc));
      ldns_rr_set_class(rr, LDNS_RR_CLASS_IN);
      ldns_rr_set_ttl(rr, LDNS_DEFAULT_TTL);
      ldns_rr_set_type(rr, t);
      return rr;
}


Generated by  Doxygen 1.6.0   Back to index