lwIP 2.1.2 Lightweight IP stack

Data Structures | Functions
mdns.c File Reference
`#include "lwip/apps/mdns.h"`
`#include "lwip/apps/mdns_priv.h"`
`#include "lwip/netif.h"`
`#include "lwip/udp.h"`
`#include "lwip/ip_addr.h"`
`#include "lwip/mem.h"`
`#include "lwip/prot/dns.h"`
`#include "lwip/prot/iana.h"`
`#include "lwip/timeouts.h"`
`#include <string.h>`
`#include "lwip/igmp.h"`
`#include "lwip/mld6.h"`

## Data Structures
struct | mdns_service
struct | mdns_host
struct | mdns_packet
struct | mdns_outpacket
struct | mdns_rr_info

## Functions
err_t | mdns_domain_add_label (struct mdns_domain *domain, const char *label, u8_t len)
u16_t | mdns_readname (struct pbuf *p, u16_t offset, struct mdns_domain *domain)
int | mdns_domain_eq (struct mdns_domain *a, struct mdns_domain *b)
u16_t | mdns_compress_domain (struct pbuf *pbuf, u16_t *offset, struct mdns_domain *domain)
err_t | mdns_resp_add_netif (struct netif *netif, const char *hostname, u32_t dns_ttl)
err_t | mdns_resp_remove_netif (struct netif *netif)
err_t | mdns_resp_rename_netif (struct netif *netif, const char *hostname)
s8_t | mdns_resp_add_service (struct netif *netif, const char *name, const char *service, enum mdns_sd_proto proto, u16_t port, u32_t dns_ttl, service_get_txt_fn_t txt_fn, void *txt_data)
err_t | mdns_resp_del_service (struct netif *netif, s8_t slot)
err_t | mdns_resp_rename_service (struct netif *netif, s8_t slot, const char *name)
err_t | mdns_resp_add_service_txtitem (struct mdns_service *service, const char *txt, u8_t txt_len)
void | mdns_resp_announce (struct netif *netif)
void | mdns_resp_register_name_result_cb (mdns_name_result_cb_t cb)
void | mdns_resp_restart (struct netif *netif)
void | mdns_resp_init (void)

## Detailed Description

MDNS responder implementation

## Function Documentation

## ◆ mdns_compress_domain()

u16_t mdns_compress_domain | ( | struct pbuf * | pbuf,
|  | u16_t * | offset,
|  | struct mdns_domain * | domain
| ) |  |

Return bytes needed to write before jump for best result of compressing supplied domain against domain in outpacket starting at specified offset. If a match is found, offset is updated to where to jump to

Parameters

  pbuf | Pointer to pbuf with the partially constructed DNS packet
  offset | Start position of a domain written earlier. If this location is suitable for compression, the pointer is updated to where in the domain to jump to.
  domain | The domain to write

Returns
  Number of bytes to write of the new domain before writing a jump to the offset. If compression can not be done against this previous domain name, the full new domain length is returned.

## ◆ mdns_domain_add_label()

err_t mdns_domain_add_label | ( | struct mdns_domain * | domain,
|  | const char * | label,
|  | u8_t | len
| ) |  |

Add a label part to a domain

Parameters

  domain | The domain to add a label to
  label | The label to add, like <hostname>, 'local', 'com' or ''
  len | The length of the label

Returns
  ERR_OK on success, an err_t otherwise if label too long

## ◆ mdns_domain_eq()

int mdns_domain_eq | ( | struct mdns_domain * | a,
|  | struct mdns_domain * | b
| ) |  |

Return 1 if contents of domains match (case-insensitive)

Parameters

  a | Domain name to compare 1
  b | Domain name to compare 2

Returns
  1 if domains are equal ignoring case, 0 otherwise

## ◆ mdns_readname()

u16_t mdns_readname | ( | struct pbuf * | p,
|  | u16_t | offset,
|  | struct mdns_domain * | domain
| ) |  |

Read possibly compressed domain name from packet buffer

Parameters

  p | The packet
  offset | start position of domain name in packet
  domain | The domain name destination

Returns
  The new offset after the domain, or MDNS_READNAME_ERROR if reading failed

## ◆ mdns_resp_register_name_result_cb()

void mdns_resp_register_name_result_cb | ( | mdns_name_result_cb_t | cb | ) |

Register a callback function that is called if probing is completed successfully or with a conflict.