tor  master
Data Structures | Macros | Typedefs
dns_structs.h File Reference

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

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.

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.

◆ 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.

◆ 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.

◆ 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.

◆ MAX_ADDRESSLEN

#define MAX_ADDRESSLEN   256

Longest hostname we're willing to resolve.

◆ RES_STATUS_DONE_ERR

#define RES_STATUS_DONE_ERR   3

The DNS request finished and gave an error

◆ RES_STATUS_DONE_OK

#define RES_STATUS_DONE_OK   2

The DNS request finished and gave an answer

◆ RES_STATUS_INFLIGHT

#define RES_STATUS_INFLIGHT   1

The DNS request is in progress.

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.