Skip to content
Snippets Groups Projects

Add useful lua functions to handle knot types

Merged vendemiat requested to merge vendemiat/extend_kres_lua into master
Files
7
+ 23
0
@@ -3,6 +3,8 @@ local ffi = require('ffi')
typedef struct knot_dump_style knot_dump_style_t;
extern const knot_dump_style_t KNOT_DUMP_STYLE_DEFAULT;
typedef void knot_db_t;
struct kr_cdb_api {};
typedef struct knot_mm {
void *ctx, *alloc, *free;
@@ -163,6 +165,21 @@ struct kr_request {
knot_mm_t pool;
};
enum kr_rank {KR_RANK_INITIAL, KR_RANK_OMIT, KR_RANK_TRY, KR_RANK_INDET = 4, KR_RANK_BOGUS, KR_RANK_MISMATCH, KR_RANK_MISSING, KR_RANK_INSECURE, KR_RANK_AUTH = 16, KR_RANK_SECURE = 32};
struct kr_cache
{
knot_db_t *db;
const struct kr_cdb_api *api;
struct {
uint32_t hit;
uint32_t miss;
uint32_t insert;
uint32_t delete;
} stats;
uint32_t ttl_min, ttl_max;
struct timeval last_clear_walltime;
uint64_t last_clear_monotime;
};
struct knot_rrset {
knot_dname_t *_owner;
uint16_t type;
@@ -203,8 +220,10 @@ struct kr_context {
map_t trust_anchors;
map_t negative_anchors;
struct kr_zonecut root_hints;
struct kr_cache cache;
char _stub[];
};
const char *knot_strerror(int code);
knot_dname_t *knot_dname_from_str(uint8_t *, const char *, size_t);
_Bool knot_dname_is_equal(const knot_dname_t *, const knot_dname_t *);
_Bool knot_dname_is_sub(const knot_dname_t *, const knot_dname_t *);
@@ -229,6 +248,9 @@ int knot_pkt_begin(knot_pkt_t *, knot_section_t);
int knot_pkt_put_question(knot_pkt_t *, const knot_dname_t *, uint16_t, uint16_t);
const knot_rrset_t *knot_pkt_rr(const knot_pktsection_t *, uint16_t);
const knot_pktsection_t *knot_pkt_section(const knot_pkt_t *, knot_section_t);
knot_pkt_t *knot_pkt_new(void *wire, uint16_t len, knot_mm_t *mm);
void knot_pkt_free(knot_pkt_t **pkt);
int knot_pkt_parse(knot_pkt_t *pkt, unsigned flags);
struct kr_rplan *kr_resolve_plan(struct kr_request *);
knot_mm_t *kr_resolve_pool(struct kr_request *);
struct kr_query *kr_rplan_push(struct kr_rplan *, struct kr_query *, const knot_dname_t *, uint16_t, uint16_t);
@@ -242,6 +264,7 @@ int kr_pkt_recycle(knot_pkt_t *);
const char *kr_inaddr(const struct sockaddr *);
int kr_inaddr_family(const struct sockaddr *);
int kr_inaddr_len(const struct sockaddr *);
uint16_t kr_inaddr_port(const struct sockaddr *);
int kr_straddr_family(const char *);
int kr_straddr_subnet(void *, const char *);
int kr_bitcmp(const char *, const char *, int);
Loading