the rdf is return in the first argument
* ldns_resolver_new_frm_fp: same treatment: return status and
the new resolver in the first argument
+ * ldns_pkt_query_new_frm_str(): same: return status and the
+ packet in the first arg
* tsig.h: internal used functions are now static:
ldns_digest_name and ldns_tsig_mac_new
* ldns_key_rr2ds has an extra argument to specify the hash to
/**
* creates a query packet for the given name, type, class.
+ * \param[out] p the packet to be returned
* \param[in] rr_name the name to query for (as string)
* \param[in] rr_type the type to query for
* \param[in] rr_class the class to query for
* \param[in] flags packet flags
- * \return ldns_pkt* a pointer to the new pkt
+ * \return LDNS_STATUS_OK or a ldns_status mesg with the error
*/
-ldns_pkt *ldns_pkt_query_new_frm_str(const char *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class , uint16_t flags);
+ldns_status ldns_pkt_query_new_frm_str(ldns_pkt **p, const char *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class , uint16_t flags);
/**
* creates a packet with a query in it for the given name, type and class.
return true;
}
-ldns_pkt *
-ldns_pkt_query_new_frm_str(const char *name, ldns_rr_type rr_type, ldns_rr_class rr_class,
- uint16_t flags)
+ldns_status
+ldns_pkt_query_new_frm_str(ldns_pkt **p, const char *name, ldns_rr_type rr_type,
+ ldns_rr_class rr_class, uint16_t flags)
{
ldns_pkt *packet;
ldns_rr *question_rr;
packet = ldns_pkt_new();
if (!packet) {
- return NULL;
+ return LDNS_STATUS_MEM_ERR;
}
if (!ldns_pkt_set_flags(packet, flags)) {
- return NULL;
+ return LDNS_STATUS_ERR;
}
question_rr = ldns_rr_new();
if (!question_rr) {
- return NULL;
+ return LDNS_STATUS_MEM_ERR;
}
if (rr_type == 0) {
} else {
ldns_rr_free(question_rr);
ldns_pkt_free(packet);
- return NULL;
+ return LDNS_STATUS_ERR;
}
packet->_tsig_rr = NULL;
ldns_pkt_set_answerfrom(packet, NULL);
-
- return packet;
+ if (p) {
+ *p = packet;
+ return LDNS_STATUS_OK;
+ } else {
+ return LDNS_STATUS_NULL;
+ }
}
ldns_pkt *