#include "setup.h"#include <string.h>#include "urldata.h"#include "sendf.h"#include "hostip.h"#include "hash.h"#include "share.h"#include "strerror.h"#include "url.h"#include "inet_ntop.h"#include <curl/mprintf.h>#include "memory.h"#include "memdebug.h"Go to the source code of this file.
Classes | |
| struct | hostcache_prune_data |
| struct | namebuf |
Defines | |
| #define | _MPRINTF_REPLACE |
| #define | MEMALIGN(x) ((x)+(8-(((unsigned long)(x))&0x7))) |
Functions | |
| static void | freednsentry (void *freethis) |
| void | Curl_global_host_cache_init (void) |
| struct curl_hash * | Curl_global_host_cache_get (void) |
| void | Curl_global_host_cache_dtor (void) |
| int | Curl_num_addresses (const Curl_addrinfo *addr) |
| const char * | Curl_printable_address (const Curl_addrinfo *ip, char *buf, size_t bufsize) |
| static char * | create_hostcache_id (const char *server, int port) |
| static int | hostcache_timestamp_remove (void *datap, void *hc) |
| static void | hostcache_prune (struct curl_hash *hostcache, int cache_timeout, time_t now) |
| void | Curl_hostcache_prune (struct SessionHandle *data) |
| static int | remove_entry_if_stale (struct SessionHandle *data, struct Curl_dns_entry *dns) |
| struct Curl_dns_entry * | Curl_cache_addr (struct SessionHandle *data, Curl_addrinfo *addr, const char *hostname, int port) |
| int | Curl_resolv (struct connectdata *conn, const char *hostname, int port, struct Curl_dns_entry **entry) |
| void | Curl_resolv_unlock (struct SessionHandle *data, struct Curl_dns_entry *dns) |
| struct curl_hash * | Curl_mk_dnscache (void) |
| Curl_addrinfo * | Curl_addrinfo_copy (const void *org, int port) |
| void | Curl_freeaddrinfo (Curl_addrinfo *ai) |
| Curl_addrinfo * | Curl_ip2addr (in_addr_t num, const char *hostname, int port) |
Variables | |
| static struct curl_hash | hostname_cache |
| static int | host_cache_initialized |
| #define MEMALIGN | ( | x | ) | ((x)+(8-(((unsigned long)(x))&0x7))) |
| static char* create_hostcache_id | ( | const char * | server, | |
| int | port | |||
| ) | [static] |
| Curl_addrinfo* Curl_addrinfo_copy | ( | const void * | org, | |
| int | port | |||
| ) |
| struct Curl_dns_entry* Curl_cache_addr | ( | struct SessionHandle * | data, | |
| Curl_addrinfo * | addr, | |||
| const char * | hostname, | |||
| int | port | |||
| ) | [read] |
Definition at line 325 of file hostip.c.
References Curl_dns_entry::addr, calloc, create_hostcache_id(), Curl_hash_add(), SessionHandle::dns, free, Names::hostcache, Curl_dns_entry::inuse, NULL, and Curl_dns_entry::timestamp.
Referenced by Curl_resolv().
| void Curl_freeaddrinfo | ( | Curl_addrinfo * | ai | ) |
Definition at line 571 of file hostip.c.
References Curl_addrinfo::ai_canonname, Curl_addrinfo::ai_next, and free.
Referenced by Curl_resolv(), freednsentry(), and ftp_state_use_port().
| void Curl_global_host_cache_dtor | ( | void | ) |
Definition at line 151 of file hostip.c.
References Curl_hash_clean(), host_cache_initialized, and hostname_cache.
Referenced by curl_global_cleanup().
| struct curl_hash* Curl_global_host_cache_get | ( | void | ) | [read] |
Definition at line 143 of file hostip.c.
References hostname_cache.
Referenced by curl_easy_perform().
| void Curl_global_host_cache_init | ( | void | ) |
Definition at line 131 of file hostip.c.
References Curl_hash_init(), Curl_hash_str(), Curl_str_key_compare(), freednsentry(), host_cache_initialized, and hostname_cache.
Referenced by Curl_setopt().
| void Curl_hostcache_prune | ( | struct SessionHandle * | data | ) |
Definition at line 251 of file hostip.c.
References CURL_LOCK_ACCESS_SINGLE, CURL_LOCK_DATA_DNS, Curl_share_lock(), Curl_share_unlock(), SessionHandle::dns, UserDefined::dns_cache_timeout, Names::hostcache, hostcache_prune(), hostcache_prune_data::now, SessionHandle::set, and SessionHandle::share.
Referenced by Curl_disconnect().
| Curl_addrinfo* Curl_ip2addr | ( | in_addr_t | num, | |
| const char * | hostname, | |||
| int | port | |||
| ) |
Definition at line 601 of file hostip.c.
References namebuf::addrentry, Curl_he2ai(), simple_client::h, namebuf::h_addr_list, namebuf::h_name, namebuf::hostentry, and NULL.
Referenced by Curl_getaddrinfo(), and ftp_state_use_port().
| struct curl_hash* Curl_mk_dnscache | ( | void | ) | [read] |
Definition at line 539 of file hostip.c.
References Curl_hash_alloc(), Curl_hash_str(), Curl_str_key_compare(), and freednsentry().
Referenced by curl_easy_perform(), curl_multi_init(), and curl_share_setopt().
| int Curl_num_addresses | ( | const Curl_addrinfo * | addr | ) |
Definition at line 162 of file hostip.c.
References Curl_addrinfo::ai_next.
Referenced by Curl_connecthost().
| const char* Curl_printable_address | ( | const Curl_addrinfo * | ip, | |
| char * | buf, | |||
| size_t | bufsize | |||
| ) |
Definition at line 177 of file hostip.c.
References Curl_addrinfo::ai_addr, Curl_addrinfo::ai_family, Curl_inet_ntop(), and NULL.
Referenced by Curl_SOCKS4(), Curl_SOCKS5(), Curl_store_ip_addr(), ftp_pasv_verbose(), ftp_state_use_port(), and singleipconnect().
| int Curl_resolv | ( | struct connectdata * | conn, | |
| const char * | hostname, | |||
| int | port, | |||
| struct Curl_dns_entry ** | entry | |||
| ) |
Definition at line 393 of file hostip.c.
References create_hostcache_id(), Curl_cache_addr(), Curl_freeaddrinfo(), Curl_getaddrinfo(), Curl_hash_pick(), Curl_ipvalid(), Curl_is_resolved(), CURL_LOCK_ACCESS_SINGLE, CURL_LOCK_DATA_DNS, Curl_share_lock(), Curl_share_unlock(), CURLRESOLV_ERROR, CURLRESOLV_PENDING, CURLRESOLV_RESOLVED, connectdata::data, SessionHandle::dns, failf, free, Names::hostcache, Curl_dns_entry::inuse, UserDefined::no_signal, NULL, remove_entry_if_stale(), SessionHandle::set, and SessionHandle::share.
Referenced by bindlocal(), CreateConnection(), Curl_SOCKS4(), Curl_SOCKS5(), ftp_state_pasv_resp(), and ftp_state_use_port().
| void Curl_resolv_unlock | ( | struct SessionHandle * | data, | |
| struct Curl_dns_entry * | dns | |||
| ) |
Definition at line 511 of file hostip.c.
References CURL_LOCK_ACCESS_SINGLE, CURL_LOCK_DATA_DNS, Curl_share_lock(), Curl_share_unlock(), DEBUGASSERT, Curl_dns_entry::inuse, and SessionHandle::share.
Referenced by bindlocal(), Curl_done(), Curl_SOCKS4(), Curl_SOCKS5(), ftp_state_pasv_resp(), and ftp_state_use_port().
| static void freednsentry | ( | void * | freethis | ) | [static] |
Definition at line 527 of file hostip.c.
References Curl_dns_entry::addr, Curl_freeaddrinfo(), and free.
Referenced by Curl_global_host_cache_init(), and Curl_mk_dnscache().
| static void hostcache_prune | ( | struct curl_hash * | hostcache, | |
| int | cache_timeout, | |||
| time_t | now | |||
| ) | [static] |
Definition at line 235 of file hostip.c.
References hostcache_prune_data::cache_timeout, Curl_hash_clean_with_criterium(), hostcache_timestamp_remove(), and hostcache_prune_data::now.
Referenced by Curl_hostcache_prune().
| static int hostcache_timestamp_remove | ( | void * | datap, | |
| void * | hc | |||
| ) | [static] |
Definition at line 215 of file hostip.c.
References c, hostcache_prune_data::cache_timeout, Curl_dns_entry::inuse, hostcache_prune_data::now, and Curl_dns_entry::timestamp.
Referenced by hostcache_prune(), and remove_entry_if_stale().
| static int remove_entry_if_stale | ( | struct SessionHandle * | data, | |
| struct Curl_dns_entry * | dns | |||
| ) | [static] |
Definition at line 275 of file hostip.c.
References hostcache_prune_data::cache_timeout, Curl_hash_clean_with_criterium(), CURL_LOCK_ACCESS_SINGLE, CURL_LOCK_DATA_DNS, Curl_share_lock(), Curl_share_unlock(), SessionHandle::dns, UserDefined::dns_cache_timeout, Names::hostcache, hostcache_timestamp_remove(), hostcache_prune_data::now, SessionHandle::set, and SessionHandle::share.
Referenced by Curl_resolv().
int host_cache_initialized [static] |
Definition at line 122 of file hostip.c.
Referenced by Curl_global_host_cache_dtor(), and Curl_global_host_cache_init().
struct curl_hash hostname_cache [static] |
Definition at line 121 of file hostip.c.
Referenced by Curl_global_host_cache_dtor(), Curl_global_host_cache_get(), and Curl_global_host_cache_init().
1.5.6