Donatien Garnier / EthernetNetIfBeta
Committer:
donatien
Date:
Mon Jul 26 16:25:55 2010 +0000
Revision:
0:7f97f2ad3030

        

Who changed what in which revision?

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