flxRecord *r;
g_assert(k);
- g_assert(data);
-
+ g_assert(size == 0 || data);
+
r = g_new(flxRecord, 1);
r->ref = 1;
r->key = flx_key_ref(k);
flxRecord *flx_record_new_full(const gchar *name, guint16 class, guint16 type, gconstpointer data, guint16 size, guint32 ttl) {
flxRecord *r;
flxKey *k;
+
+ g_assert(name);
+ g_assert(size == 0 || data);
k = flx_key_new(name, class, type);
r = flx_record_new(k, data, size, ttl);
/* g_message("equal: %p %p", a, b); */
- return strcmp(a->name, b->name) == 0 && a->type == b->type && a->class == b->class;
+ return strcmp(a->name, b->name) == 0 &&
+ a->type == b->type &&
+ a->class == b->class;
+}
+
+gboolean flx_key_pattern_match(const flxKey *pattern, const flxKey *k) {
+ g_assert(pattern);
+ g_assert(k);
+
+/* g_message("equal: %p %p", a, b); */
+
+ g_assert(!flx_key_is_pattern(k));
+
+ return strcmp(pattern->name, k->name) == 0 &&
+ (pattern->type == k->type || pattern->type == FLX_DNS_TYPE_ANY) &&
+ pattern->class == k->class;
+}
+
+gboolean flx_key_is_pattern(const flxKey *k) {
+ g_assert(k);
+
+ return k->type == FLX_DNS_TYPE_ANY;
}
+
guint flx_key_hash(const flxKey *k) {
g_assert(k);