Embedded WebSockets Experiment

Dependencies:   mbed MD5

Committer:
nandgate
Date:
Tue Jul 26 05:30:53 2011 +0000
Revision:
0:6dee052a3fa4

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nandgate 0:6dee052a3fa4 1 /**
nandgate 0:6dee052a3fa4 2 * lwip DNS resolver header file.
nandgate 0:6dee052a3fa4 3
nandgate 0:6dee052a3fa4 4 * Author: Jim Pettinato
nandgate 0:6dee052a3fa4 5 * April 2007
nandgate 0:6dee052a3fa4 6
nandgate 0:6dee052a3fa4 7 * ported from uIP resolv.c Copyright (c) 2002-2003, Adam Dunkels.
nandgate 0:6dee052a3fa4 8 *
nandgate 0:6dee052a3fa4 9 * Redistribution and use in source and binary forms, with or without
nandgate 0:6dee052a3fa4 10 * modification, are permitted provided that the following conditions
nandgate 0:6dee052a3fa4 11 * are met:
nandgate 0:6dee052a3fa4 12 * 1. Redistributions of source code must retain the above copyright
nandgate 0:6dee052a3fa4 13 * notice, this list of conditions and the following disclaimer.
nandgate 0:6dee052a3fa4 14 * 2. Redistributions in binary form must reproduce the above copyright
nandgate 0:6dee052a3fa4 15 * notice, this list of conditions and the following disclaimer in the
nandgate 0:6dee052a3fa4 16 * documentation and/or other materials provided with the distribution.
nandgate 0:6dee052a3fa4 17 * 3. The name of the author may not be used to endorse or promote
nandgate 0:6dee052a3fa4 18 * products derived from this software without specific prior
nandgate 0:6dee052a3fa4 19 * written permission.
nandgate 0:6dee052a3fa4 20 *
nandgate 0:6dee052a3fa4 21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
nandgate 0:6dee052a3fa4 22 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
nandgate 0:6dee052a3fa4 23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
nandgate 0:6dee052a3fa4 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
nandgate 0:6dee052a3fa4 25 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
nandgate 0:6dee052a3fa4 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
nandgate 0:6dee052a3fa4 27 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
nandgate 0:6dee052a3fa4 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
nandgate 0:6dee052a3fa4 29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
nandgate 0:6dee052a3fa4 30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
nandgate 0:6dee052a3fa4 31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
nandgate 0:6dee052a3fa4 32 */
nandgate 0:6dee052a3fa4 33
nandgate 0:6dee052a3fa4 34 #ifndef __LWIP_DNS_H__
nandgate 0:6dee052a3fa4 35 #define __LWIP_DNS_H__
nandgate 0:6dee052a3fa4 36
nandgate 0:6dee052a3fa4 37 #include "lwip/opt.h"
nandgate 0:6dee052a3fa4 38
nandgate 0:6dee052a3fa4 39 #if LWIP_DNS /* don't build if not configured for use in lwipopts.h */
nandgate 0:6dee052a3fa4 40
nandgate 0:6dee052a3fa4 41 #include "lwip/err.h"
nandgate 0:6dee052a3fa4 42
nandgate 0:6dee052a3fa4 43 #ifdef __cplusplus
nandgate 0:6dee052a3fa4 44 extern "C" {
nandgate 0:6dee052a3fa4 45 #endif
nandgate 0:6dee052a3fa4 46
nandgate 0:6dee052a3fa4 47 /** DNS timer period */
nandgate 0:6dee052a3fa4 48 #define DNS_TMR_INTERVAL 1000
nandgate 0:6dee052a3fa4 49
nandgate 0:6dee052a3fa4 50 /** DNS field TYPE used for "Resource Records" */
nandgate 0:6dee052a3fa4 51 #define DNS_RRTYPE_A 1 /* a host address */
nandgate 0:6dee052a3fa4 52 #define DNS_RRTYPE_NS 2 /* an authoritative name server */
nandgate 0:6dee052a3fa4 53 #define DNS_RRTYPE_MD 3 /* a mail destination (Obsolete - use MX) */
nandgate 0:6dee052a3fa4 54 #define DNS_RRTYPE_MF 4 /* a mail forwarder (Obsolete - use MX) */
nandgate 0:6dee052a3fa4 55 #define DNS_RRTYPE_CNAME 5 /* the canonical name for an alias */
nandgate 0:6dee052a3fa4 56 #define DNS_RRTYPE_SOA 6 /* marks the start of a zone of authority */
nandgate 0:6dee052a3fa4 57 #define DNS_RRTYPE_MB 7 /* a mailbox domain name (EXPERIMENTAL) */
nandgate 0:6dee052a3fa4 58 #define DNS_RRTYPE_MG 8 /* a mail group member (EXPERIMENTAL) */
nandgate 0:6dee052a3fa4 59 #define DNS_RRTYPE_MR 9 /* a mail rename domain name (EXPERIMENTAL) */
nandgate 0:6dee052a3fa4 60 #define DNS_RRTYPE_NULL 10 /* a null RR (EXPERIMENTAL) */
nandgate 0:6dee052a3fa4 61 #define DNS_RRTYPE_WKS 11 /* a well known service description */
nandgate 0:6dee052a3fa4 62 #define DNS_RRTYPE_PTR 12 /* a domain name pointer */
nandgate 0:6dee052a3fa4 63 #define DNS_RRTYPE_HINFO 13 /* host information */
nandgate 0:6dee052a3fa4 64 #define DNS_RRTYPE_MINFO 14 /* mailbox or mail list information */
nandgate 0:6dee052a3fa4 65 #define DNS_RRTYPE_MX 15 /* mail exchange */
nandgate 0:6dee052a3fa4 66 #define DNS_RRTYPE_TXT 16 /* text strings */
nandgate 0:6dee052a3fa4 67
nandgate 0:6dee052a3fa4 68 /** DNS field CLASS used for "Resource Records" */
nandgate 0:6dee052a3fa4 69 #define DNS_RRCLASS_IN 1 /* the Internet */
nandgate 0:6dee052a3fa4 70 #define DNS_RRCLASS_CS 2 /* the CSNET class (Obsolete - used only for examples in some obsolete RFCs) */
nandgate 0:6dee052a3fa4 71 #define DNS_RRCLASS_CH 3 /* the CHAOS class */
nandgate 0:6dee052a3fa4 72 #define DNS_RRCLASS_HS 4 /* Hesiod [Dyer 87] */
nandgate 0:6dee052a3fa4 73 #define DNS_RRCLASS_FLUSH 0x800 /* Flush bit */
nandgate 0:6dee052a3fa4 74
nandgate 0:6dee052a3fa4 75 /** Callback which is invoked when a hostname is found.
nandgate 0:6dee052a3fa4 76 * A function of this type must be implemented by the application using the DNS resolver.
nandgate 0:6dee052a3fa4 77 * @param name pointer to the name that was looked up.
nandgate 0:6dee052a3fa4 78 * @param ipaddr pointer to a struct ip_addr containing the IP address of the hostname,
nandgate 0:6dee052a3fa4 79 * or NULL if the name could not be found (or on any other error).
nandgate 0:6dee052a3fa4 80 * @param callback_arg a user-specified callback argument passed to dns_gethostbyname
nandgate 0:6dee052a3fa4 81 */
nandgate 0:6dee052a3fa4 82 typedef void (*dns_found_callback)(const char *name, struct ip_addr *ipaddr, void *callback_arg);
nandgate 0:6dee052a3fa4 83
nandgate 0:6dee052a3fa4 84
nandgate 0:6dee052a3fa4 85 void dns_init(void);
nandgate 0:6dee052a3fa4 86
nandgate 0:6dee052a3fa4 87 void dns_tmr(void);
nandgate 0:6dee052a3fa4 88
nandgate 0:6dee052a3fa4 89 void dns_setserver(u8_t numdns, struct ip_addr *dnsserver);
nandgate 0:6dee052a3fa4 90
nandgate 0:6dee052a3fa4 91 struct ip_addr dns_getserver(u8_t numdns);
nandgate 0:6dee052a3fa4 92
nandgate 0:6dee052a3fa4 93 err_t dns_gethostbyname(const char *hostname, struct ip_addr *addr,
nandgate 0:6dee052a3fa4 94 dns_found_callback found, void *callback_arg);
nandgate 0:6dee052a3fa4 95
nandgate 0:6dee052a3fa4 96 #if DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC
nandgate 0:6dee052a3fa4 97 int dns_local_removehost(const char *hostname, const struct ip_addr *addr);
nandgate 0:6dee052a3fa4 98 err_t dns_local_addhost(const char *hostname, const struct ip_addr *addr);
nandgate 0:6dee052a3fa4 99 #endif /* DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
nandgate 0:6dee052a3fa4 100
nandgate 0:6dee052a3fa4 101 #ifdef __cplusplus
nandgate 0:6dee052a3fa4 102 };
nandgate 0:6dee052a3fa4 103 #endif
nandgate 0:6dee052a3fa4 104
nandgate 0:6dee052a3fa4 105 #endif /* LWIP_DNS */
nandgate 0:6dee052a3fa4 106
nandgate 0:6dee052a3fa4 107 #endif /* __LWIP_DNS_H__ */