shared: introduce dnssd_srv_type_is_valid() function

This commit is contained in:
Dmitry Rozhkov
2017-12-08 14:29:27 +02:00
parent 9c5e7b73f7
commit 154ae08781
3 changed files with 32 additions and 0 deletions
+6
View File
@@ -959,6 +959,12 @@ bool dns_srv_type_is_valid(const char *name) {
return c == 2; /* exactly two labels */
}
bool dnssd_srv_type_is_valid(const char *name) {
return dns_srv_type_is_valid(name) &&
((dns_name_endswith(name, "_tcp") > 0) ||
(dns_name_endswith(name, "_udp") > 0)); /* Specific to DNS-SD. RFC 6763, Section 7 */
}
bool dns_service_name_is_valid(const char *name) {
size_t l;
+1
View File
@@ -96,6 +96,7 @@ bool dns_name_is_single_label(const char *name);
int dns_name_to_wire_format(const char *domain, uint8_t *buffer, size_t len, bool canonical);
bool dns_srv_type_is_valid(const char *name);
bool dnssd_srv_type_is_valid(const char *name);
bool dns_service_name_is_valid(const char *name);
int dns_service_join(const char *name, const char *type, const char *domain, char **ret);