summaryrefslogtreecommitdiffstats
path: root/avahi-common/domain.c
diff options
context:
space:
mode:
Diffstat (limited to 'avahi-common/domain.c')
-rw-r--r--avahi-common/domain.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/avahi-common/domain.c b/avahi-common/domain.c
index 5a51a39..3703a04 100644
--- a/avahi-common/domain.c
+++ b/avahi-common/domain.c
@@ -320,3 +320,20 @@ int avahi_is_valid_host_name(const char *t) {
return 1;
}
+
+unsigned avahi_domain_hash(const char *s) {
+ unsigned hash = 0;
+
+ for (;;) {
+ char c[65], *p;
+
+ if (!avahi_unescape_label(&s, c, sizeof(c)))
+ return hash;
+
+ if (!c[0])
+ continue;
+
+ for (p = c; *p; p++)
+ hash = 31 * hash + tolower(*p);
+ }
+}