This section contains APIs for providing MDNSD service for the module.

rsi_mdnsd_init

Prototype int32_t rsi_mdnsd_init(uint8_t ip_version, uint16_t ttl, uint8_t *host_name);
Input Arguments uint8_t ip_version: To select the IP version.

4 – To select IPv4

6 – To select IPv6

uint16_t ttl: time to live , Time in seconds for which service should be active

uint8_t *host_name: Host name which is used as host name in Type A record.

Return Value
  • On Success:  0
  • On Failure:
  • -4 : Buffer not available to serve the command
  • if return value is greater than 0
  • 0x0021, 0x0015, 0x0074
  • Please refer Error! Reference source not found. for description of above error codes.
Description This API  is used to initialize the MDNSD service in the module. It creates MDNS daemon.

Note:

1.      Currently registering only one service is supported

2.      IPv4 is only supported for MDNS/DNS-SD service

Example Usage rsi_mdnsd_init((uint8_t)MDNSD_IP_VERSION,(uint16_t)

MDNSD_INIT_TTL, (uint8_t *)MDNSD_HOST_NAME);

rsi_mdnsd_register_service

Prototype int32_t rsi_mdnsd_register_service(uint8_t port, uint16_t ttl,uint8_t more,uint8_t *service_ptr_name,

uint8_t *service_name, uint8_t *service_text);

Input Arguments uint8_t port: Port number on which service which should be added.

uint16_t ttl: time to live , Time in seconds for which service should be active

uint8_t more: This byte should be set to ‘1’ when there are more services to add.

0 – This is last service, starts MDNS service.

1 – Still more services will be added.

uint8_t *service_ptr_name: Name to be added in Type-PTR record

uint8_t *service_name: Name to be added in Type-SRV record(Service name)

uint8_t *service_text: Text field to be added in Type-TXT record

Return Value
  • On Success:  0
  • On Failure:
  • -4 : Buffer not available to serve the command
  • -6 : Data size exceeded
  • if return value is greater than 0
  • 0x0021, 0x0015, 0x0074
  • Please refer Error Codes for description of above error codes.
Description This API is used to add a service/ start service discovery.

Note:

1. Currently registering only one service is supported

Example Usage rsi_mdnsd_register_service(MDNSD_SERVICE_PORT, MDNSD_SERVICE_TTL, MDNSD_SERVICE_MORE, MDNSD_POINTER_NAME, MDNSD_SERVICE_NAME, MDNSD_SERVICE_TEXT);

rsi_mdnsd_deinit

Prototype int32_t rsi_mdnsd_deinit(void);
Input Arguments Void : None
Return Value
  • On Success :  0
  • On Failure   :
  • if return value is less than 0
  • -4 : Buffer not available to serve the command
  • if return value is greater than 0
  • 0x0021, 0x0015, 0x0074,0xFF2B
  • Please refer Error Codes for description of above error codes.
Description This API  is used to delete the mdnsd service.
Example Usage rsi_mdnsd_deinit();