00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef __LWIP_NETDB_H__
00030 #define __LWIP_NETDB_H__
00031
00032 #include "lwip/opt.h"
00033
00034 #if LWIP_DNS && LWIP_SOCKET
00035
00036 #include <stddef.h>
00037
00038 #include "lwip/inet.h"
00039 #include "lwip/sockets.h"
00040
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif
00044
00045
00046 #ifndef LWIP_DNS_API_DECLARE_H_ERRNO
00047 #define LWIP_DNS_API_DECLARE_H_ERRNO 1
00048 #endif
00049
00050 #ifndef LWIP_DNS_API_DEFINE_ERRORS
00051 #define LWIP_DNS_API_DEFINE_ERRORS 1
00052 #endif
00053
00054 #ifndef LWIP_DNS_API_DECLARE_STRUCTS
00055 #define LWIP_DNS_API_DECLARE_STRUCTS 1
00056 #endif
00057
00058 #if LWIP_DNS_API_DEFINE_ERRORS
00059
00060 #define EAI_NONAME 200
00061 #define EAI_SERVICE 201
00062 #define EAI_FAIL 202
00063 #define EAI_MEMORY 203
00064
00065 #define HOST_NOT_FOUND 210
00066 #define NO_DATA 211
00067 #define NO_RECOVERY 212
00068 #define TRY_AGAIN 213
00069 #endif
00070
00071 #if LWIP_DNS_API_DECLARE_STRUCTS
00072 struct hostent {
00073 char *h_name;
00074 char **h_aliases;
00075
00076 int h_addrtype;
00077 int h_length;
00078 char **h_addr_list;
00079
00080 #define h_addr h_addr_list[0]
00081 };
00082
00083 struct addrinfo {
00084 int ai_flags;
00085 int ai_family;
00086 int ai_socktype;
00087 int ai_protocol;
00088 socklen_t ai_addrlen;
00089 struct sockaddr *ai_addr;
00090 char *ai_canonname;
00091 struct addrinfo *ai_next;
00092 };
00093 #endif
00094
00095 #if LWIP_DNS_API_DECLARE_H_ERRNO
00096
00097 extern int h_errno;
00098 #endif
00099
00100 struct hostent *lwip_gethostbyname(const char *name);
00101 int lwip_gethostbyname_r(const char *name, struct hostent *ret, char *buf,
00102 size_t buflen, struct hostent **result, int *h_errnop);
00103 void lwip_freeaddrinfo(struct addrinfo *ai);
00104 int lwip_getaddrinfo(const char *nodename,
00105 const char *servname,
00106 const struct addrinfo *hints,
00107 struct addrinfo **res);
00108
00109 #if LWIP_COMPAT_SOCKETS
00110 #define gethostbyname(name) lwip_gethostbyname(name)
00111 #define gethostbyname_r(name, ret, buf, buflen, result, h_errnop) \
00112 lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop)
00113 #define freeaddrinfo(addrinfo) lwip_freeaddrinfo(addrinfo)
00114 #define getaddrinfo(nodname, servname, hints, res) \
00115 lwip_getaddrinfo(nodname, servname, hints, res)
00116 #endif
00117
00118 #ifdef __cplusplus
00119 }
00120 #endif
00121
00122 #endif
00123
00124 #endif