tor  0.4.2.0-alpha-dev
Data Structures | Macros | Typedefs
dns_structs.h File Reference

Go to the source code of this file.

Data Structures

struct  pending_connection_t
 
struct  cached_resolve_t
 

Macros

#define MAX_ADDRESSLEN   256
 
#define CACHED_RESOLVE_MAGIC   0x1234F00D
 
#define CACHE_STATE_PENDING   0
 
#define CACHE_STATE_DONE   1
 
#define CACHE_STATE_CACHED   2
 
status values for a single DNS request.
#define RES_STATUS_INFLIGHT   1
 
#define RES_STATUS_DONE_OK   2
 
#define RES_STATUS_DONE_ERR   3
 

Typedefs

typedef struct pending_connection_t pending_connection_t
 
typedef struct cached_resolve_t cached_resolve_t
 

Detailed Description

Structures used in dns.c. Exposed to dns.c, and to the unit tests that declare DNS_PRIVATE.

Definition in file dns_structs.h.

Macro Definition Documentation

◆ CACHE_STATE_CACHED

#define CACHE_STATE_CACHED   2

We are caching an answer for this address. This should have no pending connections, and should appear in the hash table.

Definition at line 43 of file dns_structs.h.

◆ CACHE_STATE_DONE

#define CACHE_STATE_DONE   1

This used to be a pending cached_resolve_t, and we got an answer for it. Now we're waiting for this cached_resolve_t to expire. This should have no pending connections, and should not appear in the hash table.

Definition at line 40 of file dns_structs.h.

◆ CACHE_STATE_PENDING

#define CACHE_STATE_PENDING   0

We are waiting for the resolver system to tell us an answer here. When we get one, or when we time out, the state of this cached_resolve_t will become "DONE" and we'll possibly add a CACHED entry. This cached_resolve_t will be in the hash table so that we will know not to launch more requests for this addr, but rather to add more connections to the pending list for the addr.

Definition at line 36 of file dns_structs.h.

◆ CACHED_RESOLVE_MAGIC

#define CACHED_RESOLVE_MAGIC   0x1234F00D

Value of 'magic' field for cached_resolve_t. Used to try to catch bad pointers and memory stomping.

Definition at line 27 of file dns_structs.h.

◆ MAX_ADDRESSLEN

#define MAX_ADDRESSLEN   256

Longest hostname we're willing to resolve.

Definition at line 17 of file dns_structs.h.

◆ RES_STATUS_DONE_ERR

#define RES_STATUS_DONE_ERR   3

The DNS request finished and gave an error

Definition at line 53 of file dns_structs.h.

◆ RES_STATUS_DONE_OK

#define RES_STATUS_DONE_OK   2

The DNS request finished and gave an answer

Definition at line 51 of file dns_structs.h.

◆ RES_STATUS_INFLIGHT

#define RES_STATUS_INFLIGHT   1

The DNS request is in progress.

Definition at line 49 of file dns_structs.h.

Typedef Documentation

◆ cached_resolve_t

A DNS request: possibly completed, possibly pending; cached_resolve structs are stored at the OR side in a hash table, and as a linked list from oldest to newest.

◆ pending_connection_t

Linked list of connections waiting for a DNS answer.