dns-domain: add calls to join/split SRV/DNS-SD service domains

This adds dns_service_join() and dns_service_split() which may be used
to concatenate a DNS-SD service name, am SRV service type string, and a
domain name into a full resolvable DNS domain name string. If the
service name is specified as NULL, only the type and domain are
appended, to implement classic, non-DNS-SD SRV lookups.

The reverse is dns_service_split() which takes the full name, and split
it into the three components again.
This commit is contained in:
Lennart Poettering
2015-11-23 21:31:29 +01:00
parent a5ef363808
commit 0e8eedbb49
3 changed files with 240 additions and 18 deletions
+3
View File
@@ -73,3 +73,6 @@ int dns_name_to_wire_format(const char *domain, uint8_t *buffer, size_t len);
int dns_srv_type_verify(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);
int dns_service_split(const char *joined, char **name, char **type, char **domain);