]> git.meshlink.io Git - catta/blob - main.c
make the daemon response to queries
[catta] / main.c
1 #include <sys/socket.h>
2 #include <netinet/in.h>
3 #include <arpa/inet.h>
4
5 #include "flx.h"
6 #include "server.h"
7
8 static gboolean quit_timeout(gpointer data) {
9     g_main_loop_quit(data);
10     return FALSE;
11 }
12
13 static gboolean send_timeout(gpointer data) {
14     flxServer *flx = data;
15     flxKey *k;
16
17     flx_server_dump(flx, stdout);
18
19
20     k = flx_key_new("cocaine.local.", FLX_DNS_CLASS_IN, FLX_DNS_TYPE_A);
21     flx_server_send_query(flx, 0, AF_UNSPEC, k);
22     flx_key_unref(k);
23
24     return FALSE;
25 }
26
27 int main(int argc, char *argv[]) {
28     flxServer *flx;
29     gchar *r;
30     GMainLoop *loop = NULL;
31
32     flx = flx_server_new(NULL);
33
34     flx_server_add_text(flx, 0, 0, AF_UNSPEC, FALSE, NULL, "hallo");
35
36     loop = g_main_loop_new(NULL, FALSE);
37     
38     /*g_timeout_add(1000*5, quit_timeout, loop);*/
39     g_timeout_add(1000, send_timeout, flx);
40     
41     g_main_loop_run(loop);
42
43     g_main_loop_unref(loop);
44
45
46     flx_server_free(flx);
47     
48     return 0;
49 }