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