Go to the documentation of this file.00001 #ifndef HEADER_CURL_HOSTIP_H
00002 #define HEADER_CURL_HOSTIP_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "curl_setup.h"
00026 #include "hash.h"
00027 #include "curl_addrinfo.h"
00028 #include "asyn.h"
00029
00030 #ifdef HAVE_SETJMP_H
00031 #include <setjmp.h>
00032 #endif
00033
00034 #ifdef NETWARE
00035 #undef in_addr_t
00036 #define in_addr_t unsigned long
00037 #endif
00038
00039
00040
00041
00042
00043
00044 #define CURL_HOSTENT_SIZE 9000
00045
00046 #define CURL_TIMEOUT_RESOLVE 300
00047
00048
00049 #define CURL_ASYNC_SUCCESS CURLE_OK
00050
00051 struct addrinfo;
00052 struct hostent;
00053 struct Curl_easy;
00054 struct connectdata;
00055
00056
00057
00058
00059
00060
00061
00062
00063 struct curl_hash *Curl_global_host_cache_init(void);
00064 void Curl_global_host_cache_dtor(void);
00065
00066 struct Curl_dns_entry {
00067 Curl_addrinfo *addr;
00068
00069 time_t timestamp;
00070
00071 long inuse;
00072 };
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082 #define CURLRESOLV_TIMEDOUT -2
00083 #define CURLRESOLV_ERROR -1
00084 #define CURLRESOLV_RESOLVED 0
00085 #define CURLRESOLV_PENDING 1
00086 int Curl_resolv(struct connectdata *conn, const char *hostname,
00087 int port, struct Curl_dns_entry **dnsentry);
00088 int Curl_resolv_timeout(struct connectdata *conn, const char *hostname,
00089 int port, struct Curl_dns_entry **dnsentry,
00090 time_t timeoutms);
00091
00092 #ifdef CURLRES_IPV6
00093
00094
00095
00096 bool Curl_ipv6works(void);
00097 #else
00098 #define Curl_ipv6works() FALSE
00099 #endif
00100
00101
00102
00103
00104
00105 bool Curl_ipvalid(struct connectdata *conn);
00106
00107
00108
00109
00110
00111
00112
00113
00114 Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
00115 const char *hostname,
00116 int port,
00117 int *waitp);
00118
00119
00120
00121 void Curl_resolv_unlock(struct Curl_easy *data,
00122 struct Curl_dns_entry *dns);
00123
00124
00125 void Curl_scan_cache_used(void *user, void *ptr);
00126
00127
00128 int Curl_mk_dnscache(struct curl_hash *hash);
00129
00130
00131 void Curl_hostcache_prune(struct Curl_easy *data);
00132
00133
00134 int Curl_num_addresses(const Curl_addrinfo *addr);
00135
00136 #if defined(CURLDEBUG) && defined(HAVE_GETNAMEINFO)
00137 int curl_dogetnameinfo(GETNAMEINFO_QUAL_ARG1 GETNAMEINFO_TYPE_ARG1 sa,
00138 GETNAMEINFO_TYPE_ARG2 salen,
00139 char *host, GETNAMEINFO_TYPE_ARG46 hostlen,
00140 char *serv, GETNAMEINFO_TYPE_ARG46 servlen,
00141 GETNAMEINFO_TYPE_ARG7 flags,
00142 int line, const char *source);
00143 #endif
00144
00145
00146 Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname, int port);
00147
00148 CURLcode Curl_async_resolved(struct connectdata *conn,
00149 bool *protocol_connect);
00150
00151 #ifndef CURLRES_ASYNCH
00152 #define Curl_async_resolved(x,y) CURLE_OK
00153 #endif
00154
00155
00156
00157
00158
00159
00160
00161 CURLcode Curl_addrinfo_callback(struct connectdata *conn,
00162 int status,
00163 Curl_addrinfo *ai);
00164
00165
00166
00167
00168
00169
00170 const char *Curl_printable_address(const Curl_addrinfo *ip,
00171 char *buf, size_t bufsize);
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181 struct Curl_dns_entry *
00182 Curl_fetch_addr(struct connectdata *conn,
00183 const char *hostname,
00184 int port);
00185
00186
00187
00188
00189
00190 struct Curl_dns_entry *
00191 Curl_cache_addr(struct Curl_easy *data, Curl_addrinfo *addr,
00192 const char *hostname, int port);
00193
00194 #ifndef INADDR_NONE
00195 #define CURL_INADDR_NONE (in_addr_t) ~0
00196 #else
00197 #define CURL_INADDR_NONE INADDR_NONE
00198 #endif
00199
00200 #ifdef HAVE_SIGSETJMP
00201
00202
00203
00204
00205
00206 extern sigjmp_buf curl_jmpenv;
00207 #endif
00208
00209
00210
00211
00212 CURLcode Curl_set_dns_servers(struct Curl_easy *data, char *servers);
00213
00214
00215
00216
00217
00218 CURLcode Curl_set_dns_interface(struct Curl_easy *data,
00219 const char *interf);
00220
00221
00222
00223
00224
00225 CURLcode Curl_set_dns_local_ip4(struct Curl_easy *data,
00226 const char *local_ip4);
00227
00228
00229
00230
00231
00232 CURLcode Curl_set_dns_local_ip6(struct Curl_easy *data,
00233 const char *local_ip6);
00234
00235
00236
00237
00238 void Curl_hostcache_clean(struct Curl_easy *data, struct curl_hash *hash);
00239
00240
00241
00242
00243 void Curl_hostcache_destroy(struct Curl_easy *data);
00244
00245
00246
00247
00248 CURLcode Curl_loadhostpairs(struct Curl_easy *data);
00249
00250 #endif