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