|
||||
Warning, cross-references for /kernel/include/lwip/netdb.h need to be fixed.
0001 /* 0002 * Redistribution and use in source and binary forms, with or without modification, 0003 * are permitted provided that the following conditions are met: 0004 * 0005 * 1. Redistributions of source code must retain the above copyright notice, 0006 * this list of conditions and the following disclaimer. 0007 * 2. Redistributions in binary form must reproduce the above copyright notice, 0008 * this list of conditions and the following disclaimer in the documentation 0009 * and/or other materials provided with the distribution. 0010 * 3. The name of the author may not be used to endorse or promote products 0011 * derived from this software without specific prior written permission. 0012 * 0013 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 0014 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 0015 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 0016 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 0017 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 0018 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 0019 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 0020 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 0021 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 0022 * OF SUCH DAMAGE. 0023 * 0024 * This file is part of the lwIP TCP/IP stack. 0025 * 0026 * Author: Simon Goldschmidt 0027 * 0028 */ 0029 0030 #include "lwip/opt.h" 0031 0032 #if LWIP_DNS && LWIP_SOCKET 0033 0034 #include <stddef.h> 0035 0036 #include "lwip/sockets.h" 0037 0038 /* some rarely used options */ 0039 #ifndef LWIP_DNS_API_DECLARE_H_ERRNO 0040 #define LWIP_DNS_API_DECLARE_H_ERRNO 1 0041 #endif 0042 0043 #ifndef LWIP_DNS_API_DEFINE_ERRORS 0044 #define LWIP_DNS_API_DEFINE_ERRORS 1 0045 #endif 0046 0047 #ifndef LWIP_DNS_API_DECLARE_STRUCTS 0048 #define LWIP_DNS_API_DECLARE_STRUCTS 1 0049 #endif 0050 0051 #if LWIP_DNS_API_DEFINE_ERRORS 0052 /** Errors used by the DNS API functions, h_errno can be one of them */ 0053 #define EAI_NONAME 200 0054 #define EAI_SERVICE 201 0055 #define EAI_FAIL 202 0056 #define EAI_MEMORY 203 0057 0058 #define HOST_NOT_FOUND 210 0059 #define NO_DATA 211 0060 #define NO_RECOVERY 212 0061 #define TRY_AGAIN 213 0062 #endif /* LWIP_DNS_API_DEFINE_ERRORS */ 0063 0064 #if LWIP_DNS_API_DECLARE_STRUCTS 0065 struct hostent { 0066 char *h_name; /* Official name of the host. */ 0067 char **h_aliases; /* A pointer to an array of pointers to alternative host names, 0068 terminated by a null pointer. */ 0069 int h_addrtype; /* Address type. */ 0070 int h_length; /* The length, in bytes, of the address. */ 0071 char **h_addr_list; /* A pointer to an array of pointers to network addresses (in 0072 network byte order) for the host, terminated by a null pointer. */ 0073 #define h_addr h_addr_list[0] /* for backward compatibility */ 0074 }; 0075 0076 struct addrinfo { 0077 int ai_flags; /* Input flags. */ 0078 int ai_family; /* Address family of socket. */ 0079 int ai_socktype; /* Socket type. */ 0080 int ai_protocol; /* Protocol of socket. */ 0081 socklen_t ai_addrlen; /* Length of socket address. */ 0082 struct sockaddr *ai_addr; /* Socket address of socket. */ 0083 char *ai_canonname; /* Canonical name of service location. */ 0084 struct addrinfo *ai_next; /* Pointer to next in list. */ 0085 }; 0086 #endif /* LWIP_DNS_API_DECLARE_STRUCTS */ 0087 0088 #if LWIP_DNS_API_DECLARE_H_ERRNO 0089 /* application accessable error code set by the DNS API functions */ 0090 extern int h_errno; 0091 #endif /* LWIP_DNS_API_DECLARE_H_ERRNO*/ 0092 0093 struct hostent *lwip_gethostbyname(const char *name); 0094 int lwip_gethostbyname_r(const char *name, struct hostent *ret, char *buf, 0095 size_t buflen, struct hostent **result, int *h_errnop); 0096 void lwip_freeaddrinfo(struct addrinfo *ai); 0097 int lwip_getaddrinfo(const char *nodename, 0098 const char *servname, 0099 const struct addrinfo *hints, 0100 struct addrinfo **res); 0101 0102 #if LWIP_COMPAT_SOCKETS 0103 #define gethostbyname(name) lwip_gethostbyname(name) 0104 #define gethostbyname_r(name, ret, buf, buflen, result, h_errnop) \ 0105 lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop) 0106 #define freeaddrinfo(addrinfo) lwip_freeaddrinfo(addrinfo) 0107 #define getaddrinfo(nodname, servname, hints, res) \ 0108 lwip_getaddrinfo(nodname, servname, hints, res) 0109 #endif /* LWIP_COMPAT_SOCKETS */ 0110 0111 #endif /* LWIP_DNS && LWIP_SOCKET */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 1.2.0 LXR engine. |