RobT fork of EthernetNetIf library

Fork of EthernetNetIf by Donatien Garnier

Committer:
donatien
Date:
Thu Aug 05 15:09:22 2010 +0000
Revision:
5:bc7df6da7589
Parent:
0:422060928e37

        

Who changed what in which revision?

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