Implements threaded DNS resolution. More...
#include <string>
#include <vector>
#include <stack>
#include <list>
#include <map>
#include <time.h>
#include "utils/memleak.h"
#include "utils/my_assert.h"
#include "utils.h"
#include "threads.h"
#include "params.h"
#include "match.h"
#include "log.h"
#include "sock_shared.h"
#include "sock.h"
#include "shared.h"
#include "modules.h"
#include "thread/mutex.h"
#include "log/c_logger.h"
#include "utils/precomp.h"
Go to the source code of this file.
Classes | |
class | c_connect_thread_data |
Stores data for thread (connect). More... | |
class | c_dns_entry_ipv4 |
Stores DNS chache entry (IPv4). More... | |
class | c_dns_entry_ipv6 |
Stores DNS chache entry (IPv6). More... | |
class | c_dns_entry_r |
Stores DNS chache entry, for reverse lookup (IPv4). More... | |
class | c_resolv_thread_data |
Stores data for thread. More... | |
Defines | |
#define | INET6_HASH_MULTIMAP(second) hash_multimap<in_addr6_,second,inet6_hasher> |
#define | STRING_HASH_MULTIMAP(second) hash_multimap<string,second,string_hasher> |
Functions | |
void | connect_schedule (c_connect_thread_data *data, bool add=true) |
Creates thread for connect. | |
void * | connect_thread (void *d) |
Thread function for connect. | |
static void | resolv_schedule (c_resolv_thread_data *data, bool add=true) |
Creates thread for DNS resolution. | |
void * | resolv_thread (void *d) |
Thread function for DNS resolution. | |
threaded_connect_id | threads_connect (const string &localIP, const string &remote, unsigned short remote_port, const string &comment, bool async) |
Connects to remote host (create separate thread). | |
void | threads_done () |
Does an epilog for all running threads. | |
void | threads_flushdns () |
Flushes the DNS cache. | |
bool | threads_get_connect (threaded_connect_id id, int &ec, c_socket &s) |
Check if connect was made already in thread. | |
void | threads_loop () |
Processes results from threads (should be called in a loop). | |
e_resolv_result | threads_resolve4 (const char *domain, vector< in_addr > &result, e_resolv_time request_type) |
Resolves DNS name or text IPv4 address to IPv4 address via DNS. | |
e_resolv_result | threads_resolve4 (const char *domain, in_addr &result, e_resolv_time request_type) |
Resolves DNS name or text IPv4 address to IPv4 address via DNS. | |
e_resolv_result | threads_resolve6 (const char *domain, vector< in_addr6_ > &result, e_resolv_time request_type) |
Resolves DNS name or text IPv6 address to IPv6 address via DNS. | |
e_resolv_result | threads_resolve6 (const char *domain, in_addr6_ &result, e_resolv_time request_type) |
Resolves DNS name or text IPv6 address to IPv6 address via DNS. | |
e_resolv_result | threads_reverse4 (const char *address, char *dns_name, size_t dns_max_size, e_resolv_time request_type) |
Resolves IPv4 address to DNS name via DNS (reverse lookup). | |
e_resolv_result | threads_reverse6 (in_addr6_ address, char *dns_name, size_t dns_max_size, e_resolv_time request_type) |
Resolves IPv6 address to DNS name via DNS (reverse lookup). | |
Variables | |
vector< c_connect_thread_data * > | connect_threads |
Connect threads. | |
static hash_multimap< string, c_dns_entry_ipv4,string_hasher > | resolv_ipv4_cache |
Resolver cache for IPv4. | |
static hash_multimap< string, c_dns_entry_r,string_hasher > | resolv_ipv4_cache_r |
Resolver (reverse lookup) cache for IPv4. | |
static hash_multimap< string, c_dns_entry_ipv6,string_hasher > | resolv_ipv6_cache |
Resolver cache for IPv6. | |
static hash_multimap < in_addr6_, c_dns_entry_r,inet6_hasher > | resolv_ipv6_cache_r |
Resolver (reverse lookup) cache for IPv6. | |
vector< c_resolv_thread_data * > | resolv_threads |
Resolver threads. | |
static unsigned | resolv_threads_count = 0 |
static c_mutex | resolv_threads_count_mutex |
static bool | threads_exit = false |
Implements threaded DNS resolution.
Definition in file threads.cpp.