]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/lua: api to manipulate resolution plan
authorMarek Vavruša <marek.vavrusa@nic.cz>
Tue, 13 Oct 2015 17:02:43 +0000 (19:02 +0200)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Tue, 13 Oct 2015 17:02:43 +0000 (19:02 +0200)
daemon/lua/kres.lua

index 5441a49fbe64bda171bac5b82f47e6307e1151b1..efd12d2eb1bc6a04fb781fd85e14b14dde9318fe 100644 (file)
@@ -90,6 +90,7 @@ struct query_flag {
        static const int NO_MINIMIZE = 1 << 0;
        static const int NO_IPV6     = 1 << 2;
        static const int NO_IPV4     = 1 << 3;
+       static const int AWAIT_CUT   = 1 << 8;
        static const int CACHED      = 1 << 10;
        static const int NO_CACHE    = 1 << 11;
        static const int EXPIRING    = 1 << 12;
@@ -224,6 +225,8 @@ const knot_rrset_t *knot_pkt_rr(const knot_pktsection_t *section, uint16_t i);
 /* Resolution request */
 struct kr_rplan *kr_resolve_plan(struct kr_request *request);
 /* Resolution plan */
+struct kr_query *kr_rplan_push(struct kr_rplan *rplan, struct kr_query *parent,
+                               const knot_dname_t *name, uint16_t cls, uint16_t type);
 /* Query */
 /* Utils */
 unsigned kr_rand_uint(unsigned max);
@@ -324,6 +327,15 @@ ffi.metatype( kr_request_t, {
                        assert(req)
                        return req.current_query
                end,
+               push = function(req, qname, qtype, qclass, flags, parent)
+                       assert(req)
+                       local rplan = C.kr_resolve_plan(req)
+                       local qry = C.kr_rplan_push(rplan, parent, qname, qclass, qtype)
+                       if qry ~= nil and flags ~= nil then
+                               qry.flags = bor(qry.flags, flags)
+                       end
+                       return qry
+               end,
        },
 })