Advertisement
170
SWRU455A – February 2017 – Revised March 2017
Copyright © 2017, Texas Instruments Incorporated
mDNS
SL_NETAPP_FULL_SERVICE_WITH_TEXT_IPV6_TYPE,
/* receive full ipv6 services with text */
(_i8*) &listMdns6[0],
sizeof
(listMdns));
if
( Status )
{
/* Error */
}
10.6 Advertisement
10.6.1 Registering mDNS Services
Registration of a new service should be performed only if the mDNS service is enabled (it is enabled by
default). Services can be registered as IPv4 or IPv6 services, or both. All registered services are
advertised at once. Each service includes a name, text description, port number, and TTL (time to live)
value. The registered service is persistent by default, unless set otherwise by using the flag
SL_NETAPP_MDNS_OPTIONS_IS_NOT_PERSISTENT.
The maximum number of registered services is five (or six if the internal web server is not running). The
following flags can be set when registering the service:
•
SL_NETAPP_MDNS_OPTIONS_IS_UNIQUE_BIT – Set service as unique.
•
SL_NETAPP_MDNS_IPV6_IPV4_SERVICE – Service is set for IPV4 and IPV6 interfaces (IPV6 should
be enabled).
•
SL_NETAPP_MDNS_IPV4_ONLY_SERVICE – Service is set for IPV4 interface only (default mode).
•
SL_NETAPP_MDNS_IPV6_ONLY_SERVICE – Service is set for IPV6 interface only (IPV6 should be
enabled).
•
SL_NETAPP_MDNS_OPTION_UPDATE_TEXT – Update text fields (without reregistering the service).
•
SL_NETAPP_MDNS_OPTIONS_IS_NOT_PERSISTENT – Set a nonpersistent service.
Example:
_i16 Status;
_u32 Options;
const signed char
AddService[40] = "printer._ipp._tcp.local";
Options = SL_NETAPP_MDNS_OPTIONS_IS_NOT_PERSISTENT | SL_NETAPP_MDNS_IPV4_ONLY_SERVICE;
Status
= sl_NetAppMDNSRegisterService(AddService, strlen(AddService),
"Service 5;payper=A4;size=10",strlen("Service 5;payper=A4;size=10"),4578,120,Options);
if
( Status )
{
/* Error */
}
10.6.2 Unregistering mDNS Services
A registered service can be unregistered according to its registered name. Setting the length variable to
zero deletes all services at once.
If the service was originally created as persistent, it is optional to unregister it as persistent or as
nonpersistent:
•
Unregister the service with the nonpersistent flag to cause the service to be currently deleted (send
advertisement with TTL set to 0) until the device resets, which then returns to advertise the service
with the original configured TTL.
•
Unregister the service as persistent, to cause the service to be permanently deleted (send
advertisement with TTL set to 0); also after reset.
If the service was originally created as nonpersistent, unregister should apply with the nonpersistent flag
accordingly, otherwise an error returns.
Example:
_i16 Status;
_u32 Options;