]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
change this prototype too, pkt in the first arg and return status
authorMiek Gieben <miekg@NLnetLabs.nl>
Thu, 6 Apr 2006 09:14:26 +0000 (09:14 +0000)
committerMiek Gieben <miekg@NLnetLabs.nl>
Thu, 6 Apr 2006 09:14:26 +0000 (09:14 +0000)
Changelog
ldns/packet.h
packet.c

index 0fb014e8a75172fa78e03f365c23e8036350541f..348a3e362c104b351e05f28ed2850064f7e89c65 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -53,6 +53,8 @@ XX Jan 2006: 1.1.0: ldns-team
          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
index e3e227b04c1b5ba8269375b1491da9d118e8a582..9e0087b7fd8d711a14242e1f0f63a03a5ad42985 100644 (file)
@@ -602,13 +602,14 @@ void ldns_pkt_free(ldns_pkt *packet);
 
 /**
  * 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.
index 288c3916b94773880d94337c938a1f08a3c907fd..2a84fe23b81398095c48905cc1b487b6e2d72fc8 100644 (file)
--- a/packet.c
+++ b/packet.c
@@ -783,9 +783,9 @@ ldns_pkt_set_flags(ldns_pkt *packet, uint16_t flags)
        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;
@@ -793,16 +793,16 @@ ldns_pkt_query_new_frm_str(const char *name, ldns_rr_type rr_type, ldns_rr_class
 
        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) {
@@ -821,14 +821,18 @@ ldns_pkt_query_new_frm_str(const char *name, ldns_rr_type rr_type, ldns_rr_class
        } 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 *