Netservices modded to read fragmented HTTP respsonse/payload from special purpose server - 180 bytes only

Committer:
RodColeman
Date:
Thu Sep 08 10:48:09 2011 +0000
Revision:
0:850eacf3e945
revised fixed length to 178 bytes

Who changed what in which revision?

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