Dependents:   TimeZoneDemo EthernetJackTestCode MMEx_Challenge ntp_mem ... more

Committer:
segundo
Date:
Tue Nov 09 20:54:15 2010 +0000
Revision:
0:ac1725ba162c

        

Who changed what in which revision?

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