tor  0.4.0.0-alpha-dev
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-2018, 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;
65  union {
66  uint32_t addr_ipv4;
68  int err_ipv4;
69  } result_ipv4;
70  union {
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
#define MAX_ADDRESSLEN
Definition: dns_structs.h:17
union cached_resolve_t::@22 result_ipv6
uint32_t ttl_hostname
Definition: dns_structs.h:94
uint32_t magic
Definition: dns_structs.h:62
struct pending_connection_t pending_connection_t
char address[MAX_ADDRESSLEN]
Definition: dns_structs.h:63
uint32_t ttl_ipv6
Definition: dns_structs.h:93
struct in6_addr addr_ipv6
Definition: dns_structs.h:71
uint32_t addr_ipv4
Definition: dns_structs.h:66
union cached_resolve_t::@21 result_ipv4
uint32_t ttl_ipv4
Definition: dns_structs.h:92
pending_connection_t * pending_connections
Definition: dns_structs.h:96