Commit 84f02a57 authored by Petr Špaček's avatar Petr Špaček

daemon/lua: add ability to read DO bit from packet

parent b529f1aa
......@@ -341,6 +341,7 @@ void kr_pkt_make_auth_header(knot_pkt_t *);
int kr_pkt_put(knot_pkt_t *, const knot_dname_t *, uint32_t, uint16_t, uint16_t, const uint8_t *, uint16_t);
int kr_pkt_recycle(knot_pkt_t *);
int kr_pkt_clear_payload(knot_pkt_t *);
uint16_t kr_pkt_has_dnssec(const knot_pkt_t *);
uint16_t kr_pkt_qclass(const knot_pkt_t *);
uint16_t kr_pkt_qtype(const knot_pkt_t *);
char *kr_pkt_text(const knot_pkt_t *);
......
......@@ -187,6 +187,7 @@ ${CDEFS} ${LIBKRES} functions <<-EOF
kr_pkt_put
kr_pkt_recycle
kr_pkt_clear_payload
kr_pkt_has_dnssec
kr_pkt_qclass
kr_pkt_qtype
kr_pkt_text
......
......@@ -548,6 +548,12 @@ ffi.metatype( knot_pkt_t, {
cd = function (pkt, val) return pkt_bit(pkt, 3, 0x10, val) end,
ad = function (pkt, val) return pkt_bit(pkt, 3, 0x20, val) end,
ra = function (pkt, val) return pkt_bit(pkt, 3, 0x80, val) end,
-- "do" is a reserved word in Lua; only getter
dobit = function(pkt, val)
assert(val == nil, 'dobit is getter only')
assert(ffi.istype(knot_pkt_t, pkt))
return C.kr_pkt_has_dnssec(pkt)
end,
-- Question
qname = function(pkt)
assert(ffi.istype(knot_pkt_t, pkt))
......
......@@ -1081,6 +1081,10 @@ void kr_rrset_init(knot_rrset_t *rrset, knot_dname_t *owner,
assert(rrset);
knot_rrset_init(rrset, owner, type, rclass, ttl);
}
uint16_t kr_pkt_has_dnssec(const knot_pkt_t *pkt)
{
return knot_pkt_has_dnssec(pkt);
}
uint16_t kr_pkt_qclass(const knot_pkt_t *pkt)
{
return knot_pkt_qclass(pkt);
......
......@@ -528,6 +528,7 @@ const char *kr_strptime_diff(const char *format, const char *time1_str,
/* Trivial non-inline wrappers, to be used in lua. */
KR_EXPORT void kr_rrset_init(knot_rrset_t *rrset, knot_dname_t *owner,
uint16_t type, uint16_t rclass, uint32_t ttl);
KR_EXPORT uint16_t kr_pkt_has_dnssec(const knot_pkt_t *pkt);
KR_EXPORT uint16_t kr_pkt_qclass(const knot_pkt_t *pkt);
KR_EXPORT uint16_t kr_pkt_qtype(const knot_pkt_t *pkt);
KR_EXPORT uint32_t kr_rrsig_sig_inception(const knot_rdata_t *rdata);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment