Dependents:   RTnoV3 RTnoV3_LED RTnoV3_Template RTnoV3_ADC ... more

Committer:
sherckuith
Date:
Sat Dec 31 11:25:27 2011 +0000
Revision:
0:479ce5546098
Ethernet

Who changed what in which revision?

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