]> git.meshlink.io Git - catta/blob - rr.h
add known answer suppresion server part
[catta] / rr.h
1 #ifndef foorrhfoo
2 #define foorrhfoo
3
4 #include <glib.h>
5
6 enum {
7     FLX_DNS_TYPE_A = 0x01,
8     FLX_DNS_TYPE_NS = 0x02,
9     FLX_DNS_TYPE_CNAME = 0x05,
10     FLX_DNS_TYPE_SOA = 0x06,
11     FLX_DNS_TYPE_PTR = 0x0C,
12     FLX_DNS_TYPE_HINFO = 0x0D,
13     FLX_DNS_TYPE_MX = 0x0F,
14     FLX_DNS_TYPE_TXT = 0x10,
15     FLX_DNS_TYPE_AAAA = 0x1C,
16     FLX_DNS_TYPE_SRV = 0x21,
17     FLX_DNS_TYPE_ANY = 0xFF
18 };
19
20 enum {
21     FLX_DNS_CLASS_IN = 0x01
22 };
23
24 #define FLX_DEFAULT_TTL (120*60)
25
26 typedef struct {
27     guint ref;
28     gchar *name;
29     guint16 class;
30     guint16 type;
31 } flxKey;
32
33 typedef struct  {
34     guint ref;
35     flxKey *key;
36     
37     gpointer data;
38     guint16 size;
39     guint32 ttl;
40 } flxRecord;
41
42 flxKey *flx_key_new(const gchar *name, guint16 class, guint16 type);
43 flxKey *flx_key_ref(flxKey *k);
44 void flx_key_unref(flxKey *k);
45
46 gboolean flx_key_equal(const flxKey *a, const flxKey *b);  /* Treat FLX_DNS_CLASS_ANY like any other type */
47 gboolean flx_key_pattern_match(const flxKey *pattern, const flxKey *k); /* If pattern.type is FLX_DNS_CLASS_ANY, k.type is ignored */
48
49 gboolean flx_key_is_pattern(const flxKey *k);
50
51 guint flx_key_hash(const flxKey *k);
52
53 flxRecord *flx_record_new(flxKey *k, gconstpointer data, guint16 size, guint32 ttl);
54 flxRecord *flx_record_new_full(const gchar *name, guint16 class, guint16 type, gconstpointer data, guint16 size, guint32 ttl);
55 flxRecord *flx_record_ref(flxRecord *r);
56 void flx_record_unref(flxRecord *r);
57
58 const gchar *flx_dns_class_to_string(guint16 class);
59 const gchar *flx_dns_type_to_string(guint16 type);
60
61 gchar *flx_key_to_string(flxKey *k); /* g_free() the result! */
62 gchar *flx_record_to_string(flxRecord *r);  /* g_free() the result! */
63
64 gboolean flx_record_equal_no_ttl(const flxRecord *a, const flxRecord *b);
65
66 #endif