summaryrefslogtreecommitdiffstats
path: root/libavahi-core/dns-test.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-05-06 15:31:30 +0000
committerLennart Poettering <lennart@poettering.net>2005-05-06 15:31:30 +0000
commitf93eca3530bef2cc23ffe6c3a04493ad171c2aed (patch)
treeb1053873411a868b751d7471cd4cb02fa54ed29a /libavahi-core/dns-test.c
parent42c9b99f2bb21d0ff1f1918314f9d5dd82a62763 (diff)
move the sources to libavahi-core/
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@50 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'libavahi-core/dns-test.c')
-rw-r--r--libavahi-core/dns-test.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/libavahi-core/dns-test.c b/libavahi-core/dns-test.c
new file mode 100644
index 0000000..d8c7b53
--- /dev/null
+++ b/libavahi-core/dns-test.c
@@ -0,0 +1,35 @@
+#include "dns.h"
+#include "util.h"
+
+int main(int argc, char *argv[]) {
+ gchar t[256], *a, *b, *c, *d;
+ AvahiDnsPacket *p;
+
+ p = avahi_dns_packet_new(8000);
+
+ avahi_dns_packet_append_name(p, a = "hello.hello.hello.de.");
+ avahi_dns_packet_append_name(p, b = "this is a test.hello.de.");
+ avahi_dns_packet_append_name(p, c = "this\\.is\\.a\\.test\\.with\\.dots.hello.de.");
+ avahi_dns_packet_append_name(p, d = "this\\\\is another\\ \\test.hello.de.");
+
+ avahi_hexdump(AVAHI_DNS_PACKET_DATA(p), p->size);
+
+ avahi_dns_packet_consume_name(p, t, sizeof(t));
+ g_message(">%s<", t);
+ g_assert(avahi_domain_equal(a, t));
+
+ avahi_dns_packet_consume_name(p, t, sizeof(t));
+ g_message(">%s<", t);
+ g_assert(avahi_domain_equal(b, t));
+
+ avahi_dns_packet_consume_name(p, t, sizeof(t));
+ g_message(">%s<", t);
+ g_assert(avahi_domain_equal(c, t));
+
+ avahi_dns_packet_consume_name(p, t, sizeof(t));
+ g_message(">%s<", t);
+ g_assert(avahi_domain_equal(d, t));
+
+ avahi_dns_packet_free(p);
+ return 0;
+}