hattori&ide

Dependencies:   mbed

Committer:
hattori_atsushi
Date:
Sun Dec 18 08:16:01 2022 +0000
Revision:
0:f77369cabd75
hattori

Who changed what in which revision?

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