dir_connection_st.h (2895B)
1 /* Copyright (c) 2001 Matej Pfajfar. 2 * Copyright (c) 2001-2004, Roger Dingledine. 3 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. 4 * Copyright (c) 2007-2021, The Tor Project, Inc. */ 5 /* See LICENSE for licensing information */ 6 7 /** 8 * @file dir_connection_st.h 9 * @brief Client/server directory connection structure. 10 **/ 11 12 #ifndef DIR_CONNECTION_ST_H 13 #define DIR_CONNECTION_ST_H 14 15 #include "core/or/connection_st.h" 16 17 struct tor_compress_state_t; 18 19 /** Subtype of connection_t for an "directory connection" -- that is, an HTTP 20 * connection to retrieve or serve directory material. */ 21 struct dir_connection_t { 22 connection_t base_; 23 24 /** Which 'resource' did we ask the directory for? This is typically the part 25 * of the URL string that defines, relative to the directory conn purpose, 26 * what thing we want. For example, in router descriptor downloads by 27 * descriptor digest, it contains "d/", then one or more +-separated 28 * fingerprints. 29 **/ 30 char *requested_resource; 31 /** Is this dirconn direct, or via a multi-hop Tor circuit? 32 * Direct connections can use the DirPort, or BEGINDIR over the ORPort. */ 33 unsigned int dirconn_direct:1; 34 35 /** If we're fetching descriptors, what router purpose shall we assign 36 * to them? */ 37 uint8_t router_purpose; 38 39 /** List of spooled_resource_t for objects that we're spooling. We use 40 * it from back to front. */ 41 smartlist_t *spool; 42 /** The compression object doing on-the-fly compression for spooled data. */ 43 struct tor_compress_state_t *compress_state; 44 45 /* Hidden service connection identifier for dir connections: Used by HS 46 client-side code to fetch HS descriptors, and by the service-side code to 47 upload descriptors. Also used by the HSDir, setting only the blinded key, 48 in order to locate back the descriptor in the cache once the dir stream is 49 closed. */ 50 struct hs_ident_dir_conn_t *hs_ident; 51 52 /** If this is a one-hop connection, tracks the state of the directory guard 53 * for this connection (if any). */ 54 struct circuit_guard_state_t *guard_state; 55 56 char identity_digest[DIGEST_LEN]; /**< Hash of the public RSA key for 57 * the directory server's signing key. */ 58 59 /** Unique ID for directory requests; this used to be in connection_t, but 60 * that's going away and being used on channels instead. The dirserver still 61 * needs this for the incoming side, so it's moved here. */ 62 uint64_t dirreq_id; 63 64 /** 0 normally, 1 if we're serving a consensus and we're delaying counting 65 * geoip until we've served the final bytes. */ 66 bool should_count_geoip_when_finished; 67 68 #ifdef MEASUREMENTS_21206 69 /** Number of RELAY_DATA cells received. */ 70 uint32_t data_cells_received; 71 72 /** Number of RELAY_DATA cells sent. */ 73 uint32_t data_cells_sent; 74 #endif /* defined(MEASUREMENTS_21206) */ 75 }; 76 77 #endif /* !defined(DIR_CONNECTION_ST_H) */