]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/rplan: stringified query flags
authorMarek Vavruša <marek.vavrusa@nic.cz>
Tue, 16 Jun 2015 00:08:46 +0000 (02:08 +0200)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Tue, 16 Jun 2015 00:08:46 +0000 (02:08 +0200)
lib/rplan.c
lib/rplan.h

index 4065bfb4eac3157b0df08bad4a5e91de28a3ff1c..16a2fd68745c6deaa91854f32c70f594a8db4304 100644 (file)
 #define QUERY_PROVIDES(q, name, cls, type) \
     ((q)->sclass == (cls) && (q)->stype == type && knot_dname_is_equal((q)->sname, name))
 
+/** @internal LUT of query flag names. */
+const lookup_table_t query_flag_names[] = {
+       #define X(flag, _) { QUERY_ ## flag, #flag },
+       QUERY_FLAGS(X)
+       #undef X
+};
+
 static struct kr_query *query_create(mm_ctx_t *pool, const knot_dname_t *name)
 {
        if (name == NULL) {
index f47bd28ce47acc491fa473abdac113c183397216..447a3956e35139edf1ce78f2e8ebeb76b131d7b1 100644 (file)
 #include "lib/zonecut.h"
 #include "lib/nsrep.h"
 
+#define QUERY_FLAGS(X) \
+       X(NO_MINIMIZE, 1 << 0) /**< Don't minimize QNAME. */ \
+       X(NO_THROTTLE, 1 << 1) /**< No query/slow NS throttling. */ \
+       X(TCP        , 1 << 2) /**< Use TCP for this query. */ \
+       X(RESOLVED   , 1 << 3) /**< Query is resolved. */ \
+       X(AWAIT_IPV4 , 1 << 4) /**< Query is waiting for A address. */ \
+       X(AWAIT_IPV6 , 1 << 5) /**< Query is waiting for AAAA address. */ \
+       X(AWAIT_CUT  , 1 << 6) /**< Query is waiting for zone cut lookup */ \
+       X(SAFEMODE   , 1 << 7) /**< Don't use fancy stuff (EDNS...) */ \
+       X(CACHED     , 1 << 8) /**< Query response is cached. */
+
 /** Query flags */
 enum kr_query_flag {
-       QUERY_NO_MINIMIZE = 1 << 0, /**< Don't minimize QNAME. */
-       QUERY_NO_THROTTLE = 1 << 1, /**< No query/slow NS throttling. */
-       QUERY_TCP         = 1 << 2, /**< Use TCP for this query. */
-       QUERY_RESOLVED    = 1 << 3, /**< Query is resolved. */
-       QUERY_AWAIT_IPV4  = 1 << 4, /**< Query is waiting for A address. */
-       QUERY_AWAIT_IPV6  = 1 << 5, /**< Query is waiting for AAAA address. */
-       QUERY_AWAIT_CUT   = 1 << 6, /**< Query is waiting for zone cut lookup */
-       QUERY_SAFEMODE    = 1 << 7, /**< Don't use fancy stuff (EDNS...) */
-       QUERY_CACHED      = 1 << 8  /**< Query response is cached. */
+       #define X(flag, val) QUERY_ ## flag = val,
+       QUERY_FLAGS(X)
+       #undef X
 };
 
+/** Query flag names table */
+extern const lookup_table_t query_flag_names[];
+
 /**
  * Single query representation.
  */