My fork of the HTTPServer (working)

Dependents:   DGWWebServer LAN2

Committer:
screamer
Date:
Mon Aug 06 09:23:14 2012 +0000
Revision:
0:7a64fbb4069d
[mbed] converted /DGWWebServer/HTTPServer

Who changed what in which revision?

UserRevisionLine numberNew contents of line
screamer 0:7a64fbb4069d 1 /*
screamer 0:7a64fbb4069d 2 * Redistribution and use in source and binary forms, with or without modification,
screamer 0:7a64fbb4069d 3 * are permitted provided that the following conditions are met:
screamer 0:7a64fbb4069d 4 *
screamer 0:7a64fbb4069d 5 * 1. Redistributions of source code must retain the above copyright notice,
screamer 0:7a64fbb4069d 6 * this list of conditions and the following disclaimer.
screamer 0:7a64fbb4069d 7 * 2. Redistributions in binary form must reproduce the above copyright notice,
screamer 0:7a64fbb4069d 8 * this list of conditions and the following disclaimer in the documentation
screamer 0:7a64fbb4069d 9 * and/or other materials provided with the distribution.
screamer 0:7a64fbb4069d 10 * 3. The name of the author may not be used to endorse or promote products
screamer 0:7a64fbb4069d 11 * derived from this software without specific prior written permission.
screamer 0:7a64fbb4069d 12 *
screamer 0:7a64fbb4069d 13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
screamer 0:7a64fbb4069d 14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
screamer 0:7a64fbb4069d 15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
screamer 0:7a64fbb4069d 16 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
screamer 0:7a64fbb4069d 17 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
screamer 0:7a64fbb4069d 18 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
screamer 0:7a64fbb4069d 19 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
screamer 0:7a64fbb4069d 20 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
screamer 0:7a64fbb4069d 21 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
screamer 0:7a64fbb4069d 22 * OF SUCH DAMAGE.
screamer 0:7a64fbb4069d 23 *
screamer 0:7a64fbb4069d 24 * This file is part of the lwIP TCP/IP stack.
screamer 0:7a64fbb4069d 25 *
screamer 0:7a64fbb4069d 26 * Author: Simon Goldschmidt
screamer 0:7a64fbb4069d 27 *
screamer 0:7a64fbb4069d 28 */
screamer 0:7a64fbb4069d 29
screamer 0:7a64fbb4069d 30 #include "lwip/opt.h"
screamer 0:7a64fbb4069d 31
screamer 0:7a64fbb4069d 32 #if LWIP_DNS && LWIP_SOCKET
screamer 0:7a64fbb4069d 33
screamer 0:7a64fbb4069d 34 #include "lwip/sockets.h"
screamer 0:7a64fbb4069d 35
screamer 0:7a64fbb4069d 36 #ifdef __cplusplus
screamer 0:7a64fbb4069d 37 extern "C" {
screamer 0:7a64fbb4069d 38 #endif
screamer 0:7a64fbb4069d 39
screamer 0:7a64fbb4069d 40 /* some rarely used options */
screamer 0:7a64fbb4069d 41 #ifndef LWIP_DNS_API_DECLARE_H_ERRNO
screamer 0:7a64fbb4069d 42 #define LWIP_DNS_API_DECLARE_H_ERRNO 1
screamer 0:7a64fbb4069d 43 #endif
screamer 0:7a64fbb4069d 44
screamer 0:7a64fbb4069d 45 #ifndef LWIP_DNS_API_DEFINE_ERRORS
screamer 0:7a64fbb4069d 46 #define LWIP_DNS_API_DEFINE_ERRORS 1
screamer 0:7a64fbb4069d 47 #endif
screamer 0:7a64fbb4069d 48
screamer 0:7a64fbb4069d 49 #ifndef LWIP_DNS_API_DECLARE_STRUCTS
screamer 0:7a64fbb4069d 50 #define LWIP_DNS_API_DECLARE_STRUCTS 1
screamer 0:7a64fbb4069d 51 #endif
screamer 0:7a64fbb4069d 52
screamer 0:7a64fbb4069d 53 #if LWIP_DNS_API_DEFINE_ERRORS
screamer 0:7a64fbb4069d 54 /** Errors used by the DNS API functions, h_errno can be one of them */
screamer 0:7a64fbb4069d 55 #define EAI_NONAME 200
screamer 0:7a64fbb4069d 56 #define EAI_SERVICE 201
screamer 0:7a64fbb4069d 57 #define EAI_FAIL 202
screamer 0:7a64fbb4069d 58 #define EAI_MEMORY 203
screamer 0:7a64fbb4069d 59
screamer 0:7a64fbb4069d 60 #define HOST_NOT_FOUND 210
screamer 0:7a64fbb4069d 61 #define NO_DATA 211
screamer 0:7a64fbb4069d 62 #define NO_RECOVERY 212
screamer 0:7a64fbb4069d 63 #define TRY_AGAIN 213
screamer 0:7a64fbb4069d 64 #endif /* LWIP_DNS_API_DEFINE_ERRORS */
screamer 0:7a64fbb4069d 65
screamer 0:7a64fbb4069d 66 #if LWIP_DNS_API_DECLARE_STRUCTS
screamer 0:7a64fbb4069d 67 struct hostent {
screamer 0:7a64fbb4069d 68 char *h_name; /* Official name of the host. */
screamer 0:7a64fbb4069d 69 char **h_aliases; /* A pointer to an array of pointers to alternative host names,
screamer 0:7a64fbb4069d 70 terminated by a null pointer. */
screamer 0:7a64fbb4069d 71 int h_addrtype; /* Address type. */
screamer 0:7a64fbb4069d 72 int h_length; /* The length, in bytes, of the address. */
screamer 0:7a64fbb4069d 73 char **h_addr_list; /* A pointer to an array of pointers to network addresses (in
screamer 0:7a64fbb4069d 74 network byte order) for the host, terminated by a null pointer. */
screamer 0:7a64fbb4069d 75 #define h_addr h_addr_list[0] /* for backward compatibility */
screamer 0:7a64fbb4069d 76 };
screamer 0:7a64fbb4069d 77
screamer 0:7a64fbb4069d 78 struct addrinfo {
screamer 0:7a64fbb4069d 79 int ai_flags; /* Input flags. */
screamer 0:7a64fbb4069d 80 int ai_family; /* Address family of socket. */
screamer 0:7a64fbb4069d 81 int ai_socktype; /* Socket type. */
screamer 0:7a64fbb4069d 82 int ai_protocol; /* Protocol of socket. */
screamer 0:7a64fbb4069d 83 socklen_t ai_addrlen; /* Length of socket address. */
screamer 0:7a64fbb4069d 84 struct sockaddr *ai_addr; /* Socket address of socket. */
screamer 0:7a64fbb4069d 85 char *ai_canonname; /* Canonical name of service location. */
screamer 0:7a64fbb4069d 86 struct addrinfo *ai_next; /* Pointer to next in list. */
screamer 0:7a64fbb4069d 87 };
screamer 0:7a64fbb4069d 88 #endif /* LWIP_DNS_API_DECLARE_STRUCTS */
screamer 0:7a64fbb4069d 89
screamer 0:7a64fbb4069d 90 #if LWIP_DNS_API_DECLARE_H_ERRNO
screamer 0:7a64fbb4069d 91 /* application accessable error code set by the DNS API functions */
screamer 0:7a64fbb4069d 92 extern int h_errno;
screamer 0:7a64fbb4069d 93 #endif /* LWIP_DNS_API_DECLARE_H_ERRNO*/
screamer 0:7a64fbb4069d 94
screamer 0:7a64fbb4069d 95 struct hostent *lwip_gethostbyname(const char *name);
screamer 0:7a64fbb4069d 96 int lwip_gethostbyname_r(const char *name, struct hostent *ret, char *buf,
screamer 0:7a64fbb4069d 97 size_t buflen, struct hostent **result, int *h_errnop);
screamer 0:7a64fbb4069d 98 void lwip_freeaddrinfo(struct addrinfo *ai);
screamer 0:7a64fbb4069d 99 int lwip_getaddrinfo(const char *nodename,
screamer 0:7a64fbb4069d 100 const char *servname,
screamer 0:7a64fbb4069d 101 const struct addrinfo *hints,
screamer 0:7a64fbb4069d 102 struct addrinfo **res);
screamer 0:7a64fbb4069d 103
screamer 0:7a64fbb4069d 104 #if LWIP_COMPAT_SOCKETS
screamer 0:7a64fbb4069d 105 #define gethostbyname(name) lwip_gethostbyname(name)
screamer 0:7a64fbb4069d 106 #define gethostbyname_r(name, ret, buf, buflen, result, h_errnop) \
screamer 0:7a64fbb4069d 107 lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop)
screamer 0:7a64fbb4069d 108 #define freeaddrinfo(addrinfo) lwip_freeaddrinfo(a)
screamer 0:7a64fbb4069d 109 #define getaddrinfo(nodname, servname, hints, res) \
screamer 0:7a64fbb4069d 110 lwip_getaddrinfo(nodname, servname, hints, res)
screamer 0:7a64fbb4069d 111 #endif /* LWIP_COMPAT_SOCKETS */
screamer 0:7a64fbb4069d 112
screamer 0:7a64fbb4069d 113 #ifdef __cplusplus
screamer 0:7a64fbb4069d 114 }
screamer 0:7a64fbb4069d 115 #endif
screamer 0:7a64fbb4069d 116
screamer 0:7a64fbb4069d 117 #endif /* LWIP_DNS && LWIP_SOCKET */