]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Change unbound-event.h to use void* buffer, length idiom.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 24 Jan 2014 08:16:56 +0000 (08:16 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 24 Jan 2014 08:16:56 +0000 (08:16 +0000)
git-svn-id: file:///svn/unbound/trunk@3045 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
libunbound/libworker.c
libunbound/unbound-event.h

index 81ae43b93c4fc46337260f50fa815b4805024508..7332fb6fe8641cd4c6e9d8ed098695a44e4eb932 100644 (file)
@@ -1,3 +1,6 @@
+24 January 2014: Wouter
+       - Change unbound-event.h to use void* buffer, length idiom.
+
 21 January 2014: Wouter
        - Fix #547: no trustanchor written if filesystem full, fclose checked.
 
index 2f20d830e52b0c03dc95fdfc52cfadaa34d887c0..9a767a53c2b6abd0cc57d3627eece73af2fa8e5e 100644 (file)
@@ -649,7 +649,8 @@ libworker_event_done_cb(void* arg, int rcode, sldns_buffer* buf,
                        sec = 1;
                else if(s == sec_status_secure)
                        sec = 2;
-               (*cb)(cb_arg, rcode, (void*)buf, sec, why_bogus);
+               (*cb)(cb_arg, rcode, (void*)sldns_buffer_begin(buf),
+                       (int)sldns_buffer_limit(buf), sec, why_bogus);
        }
 }
 
index c49005eec8142f424fb3e6f0c8473914af437a1b..92e5d38c45d87f5400dcf0b8d351bb65f5be0af8 100644 (file)
@@ -41,8 +41,6 @@
  * otherwise it wouldn't work, the event and event_base structures would
  * be different.  If unbound is compiled without libevent support then
  * this header file is not supposed to be installed on the system.
- * The ldns_buffer is the same buffer format as the ldnsbuffers that
- * are used in unbound's sourcecode.
  *
  * Use ub_ctx_create_event_base() to create an unbound context that uses
  * the event base that you have made.  Then, use the ub_resolve_event call
@@ -63,9 +61,8 @@ extern "C" {
 struct ub_ctx;
 struct ub_result;
 struct event_base;
-struct ldns_struct_buffer;
 
-typedef void (*ub_event_callback_t)(void*, int, struct ldns_struct_buffer*, int, char*);
+typedef void (*ub_event_callback_t)(void*, int, void*, int, int, char*);
 
 /**
  * Create a resolving and validation context.
@@ -104,13 +101,16 @@ int ub_ctx_set_event(struct ub_ctx* ctx, struct event_base* base);
  *     and is passed on to the callback function.
  * @param callback: this is called on completion of the resolution.
  *     It is called as:
- *     void callback(void* mydata, int rcode, ldns_buffer* packet, int sec,
- *             char* why_bogus)
+ *     void callback(void* mydata, int rcode, void* packet, int packet_len,
+ *             int sec, char* why_bogus)
  *     with mydata: the same as passed here, you may pass NULL,
  *     with rcode: 0 on no error, nonzero for mostly SERVFAIL situations,
  *             this is a DNS rcode.
- *     with packet: ldns_buffer of a DNS wireformat packet with the answer.
+ *     with packet: a buffer with DNS wireformat packet with the answer.
  *             do not inspect if rcode != 0.
+ *             do not write or free the packet buffer, it is used internally
+ *             in unbound (for other callbacks that want the same data).
+ *     with packet_len: length in bytes of the packet buffer.
  *     with sec: 0 if insecure, 1 if bogus, 2 if DNSSEC secure.
  *     with why_bogus: text string explaining why it is bogus (or NULL).
  *     These point to buffers inside unbound; do not deallocate the packet or