mdns.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /**
  2. * lwip MDNS resolver header file.
  3. *
  4. * Created on: Jul 29, 2010
  5. * Author: Daniel Toma
  6. * ported from uIP resolv.c Copyright (c) 2002-2003, Adam Dunkels.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. * 1. Redistributions of source code must retain the above copyright
  12. * notice, this list of conditions and the following disclaimer.
  13. * 2. Redistributions in binary form must reproduce the above copyright
  14. * notice, this list of conditions and the following disclaimer in the
  15. * documentation and/or other materials provided with the distribution.
  16. * 3. The name of the author may not be used to endorse or promote
  17. * products derived from this software without specific prior
  18. * written permission.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
  21. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  22. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23. * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  24. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  25. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  26. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  27. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  28. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  29. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  30. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. */
  32. #ifndef __LWIP_MDNS_H__
  33. #define __LWIP_MDNS_H__
  34. #include "lwip/opt.h"
  35. #if LWIP_MDNS /* don't build if not configured for use in lwipopts.h */
  36. /** DNS timer period */
  37. #define DNS_TMR_INTERVAL 1000
  38. /** mDNS Address offset flag*/
  39. #define DNS_OFFSET_FLAG 0xC0 /* the offset flag in the DNS message */
  40. #define DNS_DEFAULT_OFFSET 0x0C /* the offset is set at the beginning of the DNS message */
  41. #define DNS_IP_ADDR_LEN 4
  42. /** DNS field TYPE used for "Resource Records" */
  43. #define DNS_RRTYPE_A 1 /* a host address */
  44. #define DNS_RRTYPE_NS 2 /* an authoritative name server */
  45. #define DNS_RRTYPE_MD 3 /* a mail destination (Obsolete - use MX) */
  46. #define DNS_RRTYPE_MF 4 /* a mail forwarder (Obsolete - use MX) */
  47. #define DNS_RRTYPE_CNAME 5 /* the canonical name for an alias */
  48. #define DNS_RRTYPE_SOA 6 /* marks the start of a zone of authority */
  49. #define DNS_RRTYPE_MB 7 /* a mailbox domain name (EXPERIMENTAL) */
  50. #define DNS_RRTYPE_MG 8 /* a mail group member (EXPERIMENTAL) */
  51. #define DNS_RRTYPE_MR 9 /* a mail rename domain name (EXPERIMENTAL) */
  52. #define DNS_RRTYPE_NULL 10 /* a null RR (EXPERIMENTAL) */
  53. #define DNS_RRTYPE_WKS 11 /* a well known service description */
  54. #define DNS_RRTYPE_PTR 12 /* a domain name pointer */
  55. #define DNS_RRTYPE_HINFO 13 /* host information */
  56. #define DNS_RRTYPE_MINFO 14 /* mailbox or mail list information */
  57. #define DNS_RRTYPE_MX 15 /* mail exchange */
  58. #define DNS_RRTYPE_TXT 16 /* text strings */
  59. #define DNS_RRTYPE_SRV 33 /* Service record */
  60. #define DNS_RRTYPE_OPT 41 /* EDNS0 OPT record */
  61. #define DNS_RRTYPE_TSIG 250 /* Transaction Signature */
  62. #define DNS_RRTYPE_ANY 255 /*Not a DNS type, but a DNS query type, meaning "all types"*/
  63. /* DNS field CLASS used for "Resource Records" */
  64. #define DNS_RRCLASS_IN 1 /* the Internet */
  65. #define DNS_RRCLASS_CS 2 /* the CSNET class (Obsolete - used only for examples in some obsolete RFCs) */
  66. #define DNS_RRCLASS_CH 3 /* the CHAOS class */
  67. #define DNS_RRCLASS_HS 4 /* Hesiod [Dyer 87] */
  68. #define DNS_RRCLASS_FLUSH 0x800 /* Flush bit */
  69. #define DNS_RRCLASS_FLUSH_IN 0x8001/* Flush bit and Internet*/
  70. /** Callback which is invoked when a hostname is found.
  71. * A function of this type must be implemented by the application using the DNS resolver.
  72. * @param name pointer to the name that was looked up.
  73. * @param ipaddr pointer to a struct ip_addr containing the IP address of the hostname,
  74. * or NULL if the name could not be found (or on any other error).
  75. * @param callback_arg a user-specified callback argument passed to dns_gethostbyname
  76. */
  77. #ifndef _MDNS_INFO
  78. #define _MDNS_INFO
  79. struct mdns_info {
  80. char *host_name;
  81. char *server_name;
  82. uint16 server_port;
  83. unsigned long ipAddr;
  84. char *txt_data[10];
  85. };
  86. #endif
  87. //void mdns_enable(void);
  88. //void mdns_disable(void);
  89. //void mdns_init(struct mdns_info *info);
  90. //void mdns_close(void);
  91. //char* mdns_get_hostname(void);
  92. //void mdns_set_hostname(char *name);
  93. //void mdns_set_servername(const char *name);
  94. //char* mdns_get_servername(void);
  95. //void mdns_server_unregister(void);
  96. //void mdns_server_register(void) ;
  97. //void mdns_tmr(void);
  98. //void Delay(unsigned long ulSeconds);
  99. #endif /* LWIP_DNS */
  100. #endif /* __LWIP_DNS_H__ */