source: arduino-1-6-7/trunk/fuentes/arduino-ide-amd64/hardware/arduino/avr/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/SERVICES/LWIP/lwip-1.3.2/src/include/lwip/netdb.h @ 4837

Last change on this file since 4837 was 4837, checked in by daduve, 2 years ago

Adding new version

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