]> git.meshlink.io Git - catta/blob - libavahi-core/dns-test.c
move the sources to libavahi-core/
[catta] / libavahi-core / dns-test.c
1 #include "dns.h"
2 #include "util.h"
3
4 int main(int argc, char *argv[]) {
5     gchar t[256], *a, *b, *c, *d;
6     AvahiDnsPacket *p;
7
8     p = avahi_dns_packet_new(8000);
9
10     avahi_dns_packet_append_name(p, a = "hello.hello.hello.de.");
11     avahi_dns_packet_append_name(p, b = "this is a test.hello.de."); 
12     avahi_dns_packet_append_name(p, c = "this\\.is\\.a\\.test\\.with\\.dots.hello.de."); 
13     avahi_dns_packet_append_name(p, d = "this\\\\is another\\ \\test.hello.de."); 
14
15     avahi_hexdump(AVAHI_DNS_PACKET_DATA(p), p->size);
16
17     avahi_dns_packet_consume_name(p, t, sizeof(t));
18     g_message(">%s<", t);
19     g_assert(avahi_domain_equal(a, t));
20     
21     avahi_dns_packet_consume_name(p, t, sizeof(t));
22     g_message(">%s<", t);
23     g_assert(avahi_domain_equal(b, t));
24
25     avahi_dns_packet_consume_name(p, t, sizeof(t));
26     g_message(">%s<", t);
27     g_assert(avahi_domain_equal(c, t));
28
29     avahi_dns_packet_consume_name(p, t, sizeof(t));
30     g_message(">%s<", t);
31     g_assert(avahi_domain_equal(d, t));
32     
33     avahi_dns_packet_free(p);
34     return 0;
35 }