DNS-SD Server#
This module includes APIs for DNS-SD server.
Modules#
Enumerations#
Specifies a DNS-SD query type.
Typedefs#
Is called when a DNS-SD query subscribes one of:
Is called when a DNS-SD query unsubscribes one of:
This opaque type represents a DNS-SD query.
Represents information of a discovered service instance for a DNS-SD query.
Represents information of a discovered host for a DNS-SD query.
Represents the count of queries, responses, failures handled by upstream DNS server.
Contains the counters of DNS-SD server.
Functions#
Sets DNS-SD server query callbacks.
Notifies a discovered service instance.
Notifies a discovered host.
Acquires the next query in the DNS-SD server.
Acquires the DNS-SD query type and name for a specific query.
Returns the counters of the DNS-SD server.
Enable or disable forwarding DNS queries to platform DNS upstream API.
Returns whether the DNSSD server will forward DNS queries to the platform DNS upstream API.
Enumeration Documentation#
otDnssdQueryType#
otDnssdQueryType
Specifies a DNS-SD query type.
| Enumerator | |
|---|---|
| OT_DNSSD_QUERY_TYPE_NONE | Service type unspecified. | 
| OT_DNSSD_QUERY_TYPE_BROWSE | Service type browse service. | 
| OT_DNSSD_QUERY_TYPE_RESOLVE | Service type resolve service instance. | 
| OT_DNSSD_QUERY_TYPE_RESOLVE_HOST | Service type resolve hostname. | 
Typedef Documentation#
otDnssdQuerySubscribeCallback#
typedef void(* otDnssdQuerySubscribeCallback) (void *aContext, const char *aFullName) )(void *aContext, const char *aFullName)
Is called when a DNS-SD query subscribes one of:
| Type | Direction | Argument Name | Description | 
|---|---|---|---|
| [in] | aContext | A pointer to the application-specific context. | |
| [in] | aFullName | The null-terminated full service name (e.g. "_ipps._tcp.default.service.arpa."), or full service instance name (e.g. "OpenThread._ipps._tcp.default.service.arpa."), or full host name (e.g. "ot-host.default.service.arpa."). | 
- a service name. 
- a service instance name. 
- a host name. 
The DNS-SD query implementation is responsible for identifying what aFullName is. If aFullName is a service name or service instance name, the DNS-SD query implementation should discover corresponding service instance information and notify the DNS-SD server using otDnssdQueryHandleDiscoveredServiceInstance. If aFullName is a host name, the DNS-SD query implementation should discover the host information and notify the DNS-SD server using otDnssdQueryHandleDiscoveredHost.
Note
- There can be multiple subscription to the same name. DNS-SD query implementation should record the number of active subscriptions and stop notifying when there is no active subscription for - aFullName.
See Also
otDnssdQueryUnsubscribeCallback#
typedef void(* otDnssdQueryUnsubscribeCallback) (void *aContext, const char *aFullName) )(void *aContext, const char *aFullName)
Is called when a DNS-SD query unsubscribes one of:
| Type | Direction | Argument Name | Description | 
|---|---|---|---|
| [in] | aContext | A pointer to the application-specific context. | |
| [in] | aFullName | The null-terminated full service name (e.g. "_ipps._tcp.default.service.arpa."), or full service instance name (e.g. "OpenThread._ipps._tcp.default.service.arpa."). | 
- a service name. 
- a service instance name. 
- a host name. 
The DNS-SD query implementation is responsible for identifying what aFullName is.
Note
- There can be multiple subscription to the same name. DNS-SD query implementation should record the number of active subscriptions and stop notifying when there is no active subscription for - aFullName.
otDnssdServiceInstanceInfo#
typedef struct otDnssdServiceInstanceInfo otDnssdServiceInstanceInfo
Represents information of a discovered service instance for a DNS-SD query.
otDnssdHostInfo#
typedef struct otDnssdHostInfo otDnssdHostInfo
Represents information of a discovered host for a DNS-SD query.
otUpstreamDnsCounters#
typedef struct otUpstreamDnsCounters otUpstreamDnsCounters
Represents the count of queries, responses, failures handled by upstream DNS server.
Requires OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE. 
otDnssdCounters#
typedef struct otDnssdCounters otDnssdCounters
Contains the counters of DNS-SD server.
Function Documentation#
otDnssdQuerySetCallbacks#
void otDnssdQuerySetCallbacks (otInstance * aInstance, otDnssdQuerySubscribeCallback aSubscribe, otDnssdQueryUnsubscribeCallback aUnsubscribe, void * aContext)
Sets DNS-SD server query callbacks.
| Type | Direction | Argument Name | Description | 
|---|---|---|---|
| otInstance * | [in] | aInstance | The OpenThread instance structure. | 
| otDnssdQuerySubscribeCallback | [in] | aSubscribe | A pointer to the callback function to subscribe a service or service instance. | 
| otDnssdQueryUnsubscribeCallback | [in] | aUnsubscribe | A pointer to the callback function to unsubscribe a service or service instance. | 
| void * | [in] | aContext | A pointer to the application-specific context. | 
The DNS-SD server calls aSubscribe to subscribe to a service or service instance to resolve a DNS-SD query and aUnsubscribe to unsubscribe when the query is resolved or timeout.
Note
- aSubscribeand- aUnsubscribemust be both set or unset.
otDnssdQueryHandleDiscoveredServiceInstance#
void otDnssdQueryHandleDiscoveredServiceInstance (otInstance * aInstance, const char * aServiceFullName, otDnssdServiceInstanceInfo * aInstanceInfo)
Notifies a discovered service instance.
| Type | Direction | Argument Name | Description | 
|---|---|---|---|
| otInstance * | [in] | aInstance | The OpenThread instance structure. | 
| const char * | [in] | aServiceFullName | The null-terminated full service name. | 
| otDnssdServiceInstanceInfo * | [in] | aInstanceInfo | A pointer to the discovered service instance information. | 
The external query resolver (e.g. Discovery Proxy) should call this function to notify OpenThread core of the subscribed services or service instances.
Note
- aInstanceInfomust not contain unspecified or link-local or loop-back or multicast IP addresses.
otDnssdQueryHandleDiscoveredHost#
void otDnssdQueryHandleDiscoveredHost (otInstance * aInstance, const char * aHostFullName, otDnssdHostInfo * aHostInfo)
Notifies a discovered host.
| Type | Direction | Argument Name | Description | 
|---|---|---|---|
| otInstance * | [in] | aInstance | The OpenThread instance structure. | 
| const char * | [in] | aHostFullName | The null-terminated full host name. | 
| otDnssdHostInfo * | [in] | aHostInfo | A pointer to the discovered service instance information. | 
The external query resolver (e.g. Discovery Proxy) should call this function to notify OpenThread core of the subscribed hosts.
Note
- aHostInfomust not contain unspecified or link-local or loop-back or multicast IP addresses.
otDnssdGetNextQuery#
const otDnssdQuery * otDnssdGetNextQuery (otInstance * aInstance, const otDnssdQuery * aQuery)
Acquires the next query in the DNS-SD server.
| Type | Direction | Argument Name | Description | 
|---|---|---|---|
| otInstance * | [in] | aInstance | The OpenThread instance structure. | 
| const otDnssdQuery * | [in] | aQuery | The query pointer. Pass NULL to get the first query. | 
Returns
- A pointer to the query or NULL if no more queries. 
otDnssdGetQueryTypeAndName#
otDnssdQueryType otDnssdGetQueryTypeAndName (const otDnssdQuery * aQuery, char(*) aNameOutput)
Acquires the DNS-SD query type and name for a specific query.
| Type | Direction | Argument Name | Description | 
|---|---|---|---|
| const otDnssdQuery * | [in] | aQuery | The query pointer acquired from  | 
| char(*) | [out] | aNameOutput | The name output buffer, which should be  | 
Returns
- The DNS-SD query type. 
otDnssdGetCounters#
const otDnssdCounters * otDnssdGetCounters (otInstance * aInstance)
Returns the counters of the DNS-SD server.
| Type | Direction | Argument Name | Description | 
|---|---|---|---|
| otInstance * | [in] | aInstance | The OpenThread instance structure. | 
Returns
- A pointer to the counters of the DNS-SD server. 
otDnssdUpstreamQuerySetEnabled#
void otDnssdUpstreamQuerySetEnabled (otInstance * aInstance, bool aEnabled)
Enable or disable forwarding DNS queries to platform DNS upstream API.
| Type | Direction | Argument Name | Description | 
|---|---|---|---|
| otInstance * | [in] | aInstance | A pointer to an OpenThread instance. | 
| bool | [in] | aEnabled | A boolean to enable/disable forwarding DNS queries to upstream. | 
Available when OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE is enabled.
See Also
otDnssdUpstreamQueryIsEnabled#
bool otDnssdUpstreamQueryIsEnabled (otInstance * aInstance)
Returns whether the DNSSD server will forward DNS queries to the platform DNS upstream API.
| Type | Direction | Argument Name | Description | 
|---|---|---|---|
| otInstance * | [in] | aInstance | A pointer to an OpenThread instance. | 
Available when OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE is enabled.
See Also