Worked on dns: local host-list can be put into FLASH (by defining storage target/linker section), external function can be defined for lookup, combined dns_local_removehostname/removehostaddr to dns_local_removehost

This commit is contained in:
goldsimon
2009-05-07 15:27:02 +00:00
parent 72e9cf53e7
commit c752e5731c
4 changed files with 78 additions and 65 deletions

View File

@@ -88,8 +88,7 @@ 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);
int dns_local_removehost(const char *hostname, 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 */

View File

@@ -677,6 +677,10 @@
* #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).
*
* Instead, you can also use an external function:
* #define DNS_LOOKUP_LOCAL_EXTERN(x) extern u32_t my_lookup_function(const char *name)
* that returns the IP address or INADDR_NONE if not found.
*/
#ifndef DNS_LOCAL_HOSTLIST
#define DNS_LOCAL_HOSTLIST 0