X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-common%2Fdomain.h;h=c9cc39ebf2630dd1d4c3b453611465765e94fd44;hb=80c97b69cc8fb2663296182514d993036e4caaa5;hp=4a94be12a931e2a31d610f20bc03fc81eeeba964;hpb=5ebf655c85076f200955458673a8bbf0dd927407;p=catta diff --git a/avahi-common/domain.h b/avahi-common/domain.h index 4a94be1..c9cc39e 100644 --- a/avahi-common/domain.h +++ b/avahi-common/domain.h @@ -22,6 +22,9 @@ USA. ***/ +/** \file domain.h Domain name handling functions */ + + #include #include @@ -29,29 +32,43 @@ AVAHI_C_DECL_BEGIN -char *avahi_normalize_name(const char *s); /* avahi_free() the result! */ -char *avahi_get_host_name(void); /* avahi_free() the result! */ +/** Normalize a domain name into canonical form. This drops trailing + * dots and removes useless backslash escapes. avahi_free() the + * result! */ +char *avahi_normalize_name(const char *s); +/** Return the local host name. avahi_free() the result! */ +char *avahi_get_host_name(void); + +/** Return 1 when the specified domain names are equal, 0 otherwise */ int avahi_domain_equal(const char *a, const char *b); + +/** Do a binary comparison of to specified domain names, return -1, 0, or 1, depending on the order. */ int avahi_binary_domain_cmp(const char *a, const char *b); -/* Read the first label from the textual domain name *name, unescape +/** Read the first label from the textual domain name *name, unescape * it and write it to dest, *name is changed to point to the next label*/ char *avahi_unescape_label(const char **name, char *dest, size_t size); -/* Escape the domain name in *src and write it to *ret_name */ +/** Escape the domain name in *src and write it to *ret_name */ char *avahi_escape_label(const uint8_t* src, size_t src_length, char **ret_name, size_t *ret_size); -unsigned avahi_strhash(const char *p); -unsigned avahi_domain_hash(const char *s); +/** Return 1 when the specified string contains a valid service type, 0 otherwise */ +int avahi_is_valid_service_type(const char *t); + +/** Return 1 when the specified string contains a valid domain name, 0 otherwise */ +int avahi_is_valid_domain_name(const char *t); + +/** Return 1 when the specified string contains a valid service name, 0 otherwise */ +int avahi_is_valid_service_name(const char *t); + +/** Return 1 when the specified string contains a valid non-FQDN host name (i.e. without dots), 0 otherwise */ +int avahi_is_valid_host_name(const char *t); + +/** Return some kind of hash value for the domain, useful for using domains as hash table keys. */ +unsigned avahi_domain_hash(const char *name); -int avahi_valid_service_type(const char *t); -int avahi_valid_domain_name(const char *t); -int avahi_valid_service_name(const char *t); -int avahi_valid_host_name(const char *t); -char *avahi_strup(char *s); -char *avahi_strdown(char *s); AVAHI_C_DECL_END