Commit 81d0d6c4 authored by Vladimír Čunát's avatar Vladimír Čunát

qflags: WIP refactor

parent 743dfde6
......@@ -1036,7 +1036,8 @@ int worker_process_tcp(struct worker_ctx *worker, uv_stream_t *handle, const uin
return submitted;
}
int worker_resolve(struct worker_ctx *worker, knot_pkt_t *query, unsigned options, worker_cb_t on_complete, void *baton)
int worker_resolve(struct worker_ctx *worker, knot_pkt_t *query, struct kr_qflags options,
worker_cb_t on_complete, void *baton)
{
if (!worker || !query) {
return kr_error(EINVAL);
......
......@@ -60,8 +60,8 @@ int worker_end_tcp(struct worker_ctx *worker, uv_handle_t *handle);
* @note the options passed are |-combined with struct kr_context::options
* @todo maybe better semantics for this?
*/
int worker_resolve(struct worker_ctx *worker, knot_pkt_t *query, unsigned options,
worker_cb_t on_complete, void *baton);
int worker_resolve(struct worker_ctx *worker, knot_pkt_t *query, struct kr_qflags options,
worker_cb_t on_complete, void *baton);
/** Collect worker mempools */
void worker_reclaim(struct worker_ctx *worker);
......
......@@ -82,7 +82,8 @@ static void update_nsrep_set(struct kr_nsrep *ns, const knot_dname_t *name, uint
#undef ADDR_SET
static unsigned eval_addr_set(pack_t *addr_set, kr_nsrep_lru_t *rttcache, unsigned score, uint8_t *addr[], uint32_t opts)
static unsigned eval_addr_set(pack_t *addr_set, kr_nsrep_lru_t *rttcache, unsigned score,
uint8_t *addr[], struct kr_qflags opts)
{
/* Name server is better candidate if it has address record. */
uint8_t *it = pack_head(*addr_set);
......
......@@ -147,7 +147,7 @@ typedef array_t(struct kr_module *) module_array_t;
*/
struct kr_context
{
uint32_t options;
struct kr_qflags options;
knot_rrset_t *opt_rr;
map_t trust_anchors;
map_t negative_anchors;
......@@ -190,7 +190,7 @@ struct kr_request {
unsigned rtt; /**< Current upstream RTT */
const struct sockaddr *addr; /**< Current upstream address */
} upstream; /**< Upstream information, valid only in consume() phase */
uint32_t options;
struct kr_qflags options;
int state;
ranked_rr_array_t answ_selected;
ranked_rr_array_t auth_selected;
......
......@@ -28,10 +28,10 @@
((q)->sclass == (cls) && (q)->stype == type && knot_dname_is_equal((q)->sname, name))
/** @internal LUT of query flag names. */
const knot_lookup_t query_flag_names[] = {
#define X(flag, _) { QUERY_ ## flag, #flag },
QUERY_FLAGS(X)
#undef X
const knot_lookup_t query_flag_names[] = { // FIXME
//#define X(flag, _) { QUERY_ ## flag, #flag },
//QUERY_FLAGS(X)
//#undef X
{ 0, NULL }
};
......
......@@ -61,8 +61,8 @@
X(DNS64_MARK, 1u << 31) /**< Internal to ../modules/dns64/dns64.lua */
/** Query flags */
enum kr_query_flag {
#define X(flag, val) QUERY_ ## flag = val,
struct kr_qflags {
#define X(flag, val) bool flag : 1;
QUERY_FLAGS(X)
#undef X
};
......@@ -80,7 +80,7 @@ struct kr_query {
uint16_t stype;
uint16_t sclass;
uint16_t id;
uint32_t flags;
struct kr_qflags flags, forward_flags;
uint32_t secret;
uint16_t fails;
uint16_t reorder; /**< Seed to reorder (cached) RRs in answer or zero. */
......@@ -89,7 +89,6 @@ struct kr_query {
struct kr_nsrep ns;
struct kr_layer_pickle *deferred;
uint32_t uid; /**< Query iteration number, unique within the kr_rplan. */
uint32_t forward_flags;
/** Pointer to the query that originated this one because of following a CNAME (or NULL). */
struct kr_query *cname_parent;
};
......
......@@ -44,7 +44,7 @@ static void test_rplan_push(void **state)
test_mm_ctx_init(&mm);
struct kr_request request = {
.pool = mm,
.options = 0,
.options = {},
};
struct kr_rplan rplan;
......
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