1*5d5fbe79SDavid van Moolenbroek /** 2*5d5fbe79SDavid van Moolenbroek * @file 3*5d5fbe79SDavid van Moolenbroek * MDNS responder 4*5d5fbe79SDavid van Moolenbroek */ 5*5d5fbe79SDavid van Moolenbroek 6*5d5fbe79SDavid van Moolenbroek /* 7*5d5fbe79SDavid van Moolenbroek * Copyright (c) 2015 Verisure Innovation AB 8*5d5fbe79SDavid van Moolenbroek * All rights reserved. 9*5d5fbe79SDavid van Moolenbroek * 10*5d5fbe79SDavid van Moolenbroek * Redistribution and use in source and binary forms, with or without modification, 11*5d5fbe79SDavid van Moolenbroek * are permitted provided that the following conditions are met: 12*5d5fbe79SDavid van Moolenbroek * 13*5d5fbe79SDavid van Moolenbroek * 1. Redistributions of source code must retain the above copyright notice, 14*5d5fbe79SDavid van Moolenbroek * this list of conditions and the following disclaimer. 15*5d5fbe79SDavid van Moolenbroek * 2. Redistributions in binary form must reproduce the above copyright notice, 16*5d5fbe79SDavid van Moolenbroek * this list of conditions and the following disclaimer in the documentation 17*5d5fbe79SDavid van Moolenbroek * and/or other materials provided with the distribution. 18*5d5fbe79SDavid van Moolenbroek * 3. The name of the author may not be used to endorse or promote products 19*5d5fbe79SDavid van Moolenbroek * derived from this software without specific prior written permission. 20*5d5fbe79SDavid van Moolenbroek * 21*5d5fbe79SDavid van Moolenbroek * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22*5d5fbe79SDavid van Moolenbroek * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23*5d5fbe79SDavid van Moolenbroek * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24*5d5fbe79SDavid van Moolenbroek * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25*5d5fbe79SDavid van Moolenbroek * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26*5d5fbe79SDavid van Moolenbroek * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27*5d5fbe79SDavid van Moolenbroek * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28*5d5fbe79SDavid van Moolenbroek * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29*5d5fbe79SDavid van Moolenbroek * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30*5d5fbe79SDavid van Moolenbroek * OF SUCH DAMAGE. 31*5d5fbe79SDavid van Moolenbroek * 32*5d5fbe79SDavid van Moolenbroek * This file is part of the lwIP TCP/IP stack. 33*5d5fbe79SDavid van Moolenbroek * 34*5d5fbe79SDavid van Moolenbroek * Author: Erik Ekman <erik@kryo.se> 35*5d5fbe79SDavid van Moolenbroek * 36*5d5fbe79SDavid van Moolenbroek */ 37*5d5fbe79SDavid van Moolenbroek #ifndef LWIP_HDR_MDNS_H 38*5d5fbe79SDavid van Moolenbroek #define LWIP_HDR_MDNS_H 39*5d5fbe79SDavid van Moolenbroek 40*5d5fbe79SDavid van Moolenbroek #include "lwip/apps/mdns_opts.h" 41*5d5fbe79SDavid van Moolenbroek #include "lwip/netif.h" 42*5d5fbe79SDavid van Moolenbroek 43*5d5fbe79SDavid van Moolenbroek #if LWIP_MDNS_RESPONDER 44*5d5fbe79SDavid van Moolenbroek 45*5d5fbe79SDavid van Moolenbroek enum mdns_sd_proto { 46*5d5fbe79SDavid van Moolenbroek DNSSD_PROTO_UDP = 0, 47*5d5fbe79SDavid van Moolenbroek DNSSD_PROTO_TCP = 1 48*5d5fbe79SDavid van Moolenbroek }; 49*5d5fbe79SDavid van Moolenbroek 50*5d5fbe79SDavid van Moolenbroek #define MDNS_LABEL_MAXLEN 63 51*5d5fbe79SDavid van Moolenbroek 52*5d5fbe79SDavid van Moolenbroek struct mdns_host; 53*5d5fbe79SDavid van Moolenbroek struct mdns_service; 54*5d5fbe79SDavid van Moolenbroek 55*5d5fbe79SDavid van Moolenbroek /** Callback function to add text to a reply, called when generating the reply */ 56*5d5fbe79SDavid van Moolenbroek typedef void (*service_get_txt_fn_t)(struct mdns_service *service, void *txt_userdata); 57*5d5fbe79SDavid van Moolenbroek 58*5d5fbe79SDavid van Moolenbroek void mdns_resp_init(void); 59*5d5fbe79SDavid van Moolenbroek 60*5d5fbe79SDavid van Moolenbroek err_t mdns_resp_add_netif(struct netif *netif, const char *hostname, u32_t dns_ttl); 61*5d5fbe79SDavid van Moolenbroek err_t mdns_resp_remove_netif(struct netif *netif); 62*5d5fbe79SDavid van Moolenbroek 63*5d5fbe79SDavid van Moolenbroek err_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_userdata); 64*5d5fbe79SDavid van Moolenbroek err_t mdns_resp_add_service_txtitem(struct mdns_service *service, const char *txt, u8_t txt_len); 65*5d5fbe79SDavid van Moolenbroek void mdns_resp_netif_settings_changed(struct netif *netif); 66*5d5fbe79SDavid van Moolenbroek 67*5d5fbe79SDavid van Moolenbroek #endif /* LWIP_MDNS_RESPONDER */ 68*5d5fbe79SDavid van Moolenbroek 69*5d5fbe79SDavid van Moolenbroek #endif /* LWIP_HDR_MDNS_H */ 70