void knot_pkt_free(knot_pkt_t *);
int knot_pkt_parse(knot_pkt_t *, unsigned int);
int knot_pkt_reserve(knot_pkt_t *pkt, uint16_t size);
+int knot_pkt_reclaim(knot_pkt_t *pkt, uint16_t size);
uint8_t knot_edns_get_version(const knot_rrset_t *);
uint16_t knot_edns_get_payload(const knot_rrset_t *);
bool knot_edns_has_option(const knot_rrset_t *, uint16_t);
int kr_cache_insert_rr(struct kr_cache *, const knot_rrset_t *, const knot_rrset_t *, uint8_t, uint32_t);
int kr_cache_remove(struct kr_cache *, const knot_dname_t *, uint16_t);
int kr_cache_remove_subtree(struct kr_cache *, const knot_dname_t *, _Bool, int);
+int kr_cache_insert_rr(struct kr_cache *, const knot_rrset_t *, const knot_rrset_t *, uint8_t, uint32_t, const uint8_t *, int);
int kr_cache_sync(struct kr_cache *);
typedef struct {
uint8_t bitmap[32];
local kr_cache_t = ffi.typeof('struct kr_cache')
ffi.metatype( kr_cache_t, {
__index = {
- insert = function (self, rr, rrsig, rank, timestamp)
+ insert = function (self, rr, rrsig, rank, timestamp, scope, scope_bits)
assert(ffi.istype(kr_cache_t, self))
assert(ffi.istype(knot_rrset_t, rr), 'RR must be a rrset type')
assert(not rrsig or ffi.istype(knot_rrset_t, rrsig), 'RRSIG must be nil or of the rrset type')
timestamp = tonumber(now.tv_sec)
end
-- Insert record into cache
- local ret = C.kr_cache_insert_rr(self, rr, rrsig, tonumber(rank or 0), timestamp)
+ local ret = C.kr_cache_insert_rr(self, rr, rrsig, tonumber(rank or 0), timestamp, scope, scope_bits or 0)
if ret ~= 0 then return nil, knot_error_t(ret) end
return true
end,