1. Reduce the size of the heap memory 2. Change the TCP segment size 3. Disable UDP + DHCP + DNS 4. Change the configuration of the TCP/IP thread

Dependents:   EthernetInterface

Fork of lwip by mbed official

Committer:
aos
Date:
Thu Feb 13 17:57:50 2014 +0000
Revision:
16:f159c25d9261
Parent:
0:51ac1d130fd4
Update the heap memory size

Who changed what in which revision?

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