Dependencies:   mbed

Committer:
robertcook
Date:
Wed Jun 13 18:39:46 2012 +0000
Revision:
0:32a0996dff0f

        

Who changed what in which revision?

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