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