ZG2100 Network interface source

Committer:
donatien
Date:
Fri Jul 09 15:37:23 2010 +0000
Revision:
0:b802fc31f1db

        

Who changed what in which revision?

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