]> git.meshlink.io Git - catta/blob - main.c
add prioq abstract data type
[catta] / main.c
1 #include <sys/socket.h>
2 #include <netinet/in.h>
3 #include <arpa/inet.h>
4
5 #include "flx.h"
6
7 static GMainLoop *loop = NULL;
8
9 static gboolean timeout(gpointer data) {
10     g_main_loop_quit(loop);
11     return FALSE;
12 }
13
14 int main(int argc, char *argv[]) {
15     flxServer *flx;
16     flxLocalAddrSource *l;
17     flxAddress a;
18     gchar *r;
19
20     flx = flx_server_new(NULL);
21
22     l = flx_local_addr_source_new(flx);
23
24     flx_address_parse("127.0.0.1", AF_INET, &a);
25     flx_server_add_address(flx, 0, 0, AF_UNSPEC, "localhost", &a);
26
27     flx_address_parse("::1", AF_INET6, &a);
28     flx_server_add_address(flx, 0, 0, AF_UNSPEC, "ip6-localhost", &a);
29
30     g_timeout_add(1000, timeout, NULL);
31     
32     loop = g_main_loop_new(NULL, FALSE);
33     g_main_loop_run(loop);
34     g_main_loop_unref(loop);
35
36     flx_server_dump(flx, stdout);
37
38     flx_local_addr_source_free(l);
39     flx_server_free(flx);
40     return 0;
41 }