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