tor  master
dns_structs.h
Go to the documentation of this file.
1 /* Copyright (c) 2003-2004, Roger Dingledine.
2  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
3  * Copyright (c) 2007-2017, The Tor Project, Inc. */
4 /* See LICENSE for licensing information */
5 
13 #ifndef TOR_DNS_STRUCTS_H
14 #define TOR_DNS_STRUCTS_H
15 
17 #define MAX_ADDRESSLEN 256
18 
20 typedef struct pending_connection_t {
21  edge_connection_t *conn;
22  struct pending_connection_t *next;
24 
27 #define CACHED_RESOLVE_MAGIC 0x1234F00D
28 
29 /* Possible states for a cached resolve_t */
36 #define CACHE_STATE_PENDING 0
37 
40 #define CACHE_STATE_DONE 1
41 
43 #define CACHE_STATE_CACHED 2
44 
49 #define RES_STATUS_INFLIGHT 1
50 
51 #define RES_STATUS_DONE_OK 2
52 
53 #define RES_STATUS_DONE_ERR 3
54 
60 typedef struct cached_resolve_t {
61  HT_ENTRY(cached_resolve_t) node;
62  uint32_t magic;
63  char address[MAX_ADDRESSLEN];
65  union {
66  uint32_t addr_ipv4;
68  int err_ipv4;
69  } result_ipv4;
70  union {
71  struct in6_addr addr_ipv6;
73  int err_ipv6;
74  } result_ipv6;
75  union {
76  char *hostname;
78  } result_ptr;
85  unsigned int res_status_ipv4 : 2;
86  unsigned int res_status_ipv6 : 2;
87  unsigned int res_status_hostname : 2;
89  uint8_t state;
91  time_t expire;
92  uint32_t ttl_ipv4;
93  uint32_t ttl_ipv6;
94  uint32_t ttl_hostname;
100 
101 #endif /* !defined(TOR_DNS_STRUCTS_H) */
102 
struct cached_resolve_t cached_resolve_t
int err_ipv6
Definition: dns_structs.h:73
uint32_t ttl_ipv6
Definition: dns_structs.h:93
#define MAX_ADDRESSLEN
Definition: dns_structs.h:17
uint32_t addr_ipv4
Definition: dns_structs.h:66
int minheap_idx
Definition: dns_structs.h:98
uint32_t magic
Definition: dns_structs.h:62
int err_hostname
Definition: dns_structs.h:77
time_t expire
Definition: dns_structs.h:91
uint32_t ttl_ipv4
Definition: dns_structs.h:92
Definition: compat.h:524
struct pending_connection_t pending_connection_t
int err_ipv4
Definition: dns_structs.h:68
Definition: dns_structs.h:20
pending_connection_t * pending_connections
Definition: dns_structs.h:96
uint32_t ttl_hostname
Definition: dns_structs.h:94
uint8_t state
Definition: dns_structs.h:89
Definition: dns_structs.h:60
Definition: or.h:1687