task #7507, patch #6786: DNS supports static hosts table. New configuration options DNS_LOCAL_HOSTLIST and DNS_LOCAL_HOSTLIST_IS_DYNAMIC.

This commit is contained in:
goldsimon
2009-04-21 18:35:18 +00:00
parent ed65d9cd75
commit 51e02176da
5 changed files with 188 additions and 4 deletions

View File

@@ -87,6 +87,12 @@ struct ip_addr dns_getserver(u8_t numdns);
err_t dns_gethostbyname(const char *hostname, struct ip_addr *addr,
dns_found_callback found, void *callback_arg);
#if DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC
int dns_local_removehostname(const char *hostname);
int dns_local_removehostaddr(const struct ip_addr *addr);
err_t dns_local_addhost(const char *hostname, const struct ip_addr *addr);
#endif /* DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
#endif /* LWIP_DNS */
#endif /* __LWIP_DNS_H__ */

View File

@@ -148,7 +148,7 @@
/**
* MEM_USE_POOLS==1: Use an alternative to malloc() by allocating from a set
* of memory pools of various sizes. When mem_malloc is called, an element of
* the smallest pool that can provide the lenght needed is returned.
* the smallest pool that can provide the length needed is returned.
*/
#ifndef MEM_USE_POOLS
#define MEM_USE_POOLS 0
@@ -635,6 +635,22 @@
#define DNS_MSG_SIZE 512
#endif
/** DNS_LOCAL_HOSTLIST: Implements a local host-to-address list. If enabled,
* you have to define
* #define DNS_LOCAL_HOSTLIST_INIT {{"host1", 0x123}, {"host2", 0x234}}
* (an array of structs name/address, where address is an u32_t in network
* byte order).
*/
#ifndef DNS_LOCAL_HOSTLIST
#define DNS_LOCAL_HOSTLIST 0
#endif /* DNS_LOCAL_HOSTLIST */
/** If this is turned on, the local host-list can be dynamically changed
* at runtime. */
#ifndef DNS_LOCAL_HOSTLIST_IS_DYNAMIC
#define DNS_LOCAL_HOSTLIST_IS_DYNAMIC 0
#endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
/*
---------------------------------
---------- UDP options ----------