dir_connection_st.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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-2019, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. #ifndef DIR_CONNECTION_ST_H
  7. #define DIR_CONNECTION_ST_H
  8. #include "core/or/connection_st.h"
  9. struct tor_compress_state_t;
  10. typedef enum {
  11. PIRCLIENT_STATE_NONE,
  12. PIRCLIENT_STATE_AWAITING_PARAMS,
  13. PIRCLIENT_STATE_AWAITING_PIRREPLY
  14. } dir_connection_pirclient_state_t;
  15. /** Subtype of connection_t for an "directory connection" -- that is, an HTTP
  16. * connection to retrieve or serve directory material. */
  17. struct dir_connection_t {
  18. connection_t base_;
  19. /** Which 'resource' did we ask the directory for? This is typically the part
  20. * of the URL string that defines, relative to the directory conn purpose,
  21. * what thing we want. For example, in router descriptor downloads by
  22. * descriptor digest, it contains "d/", then one or more +-separated
  23. * fingerprints.
  24. **/
  25. char *requested_resource;
  26. unsigned int dirconn_direct:1; /**< Is this dirconn direct, or via Tor? */
  27. /** If we're fetching descriptors, what router purpose shall we assign
  28. * to them? */
  29. uint8_t router_purpose;
  30. /** List of spooled_resource_t for objects that we're spooling. We use
  31. * it from back to front. */
  32. smartlist_t *spool;
  33. /** The compression object doing on-the-fly compression for spooled data. */
  34. struct tor_compress_state_t *compress_state;
  35. /** What rendezvous service are we querying for? */
  36. rend_data_t *rend_data;
  37. /* Hidden service connection identifier for dir connections: Used by HS
  38. client-side code to fetch HS descriptors, and by the service-side code to
  39. upload descriptors. */
  40. struct hs_ident_dir_conn_t *hs_ident;
  41. /** If this is a one-hop connection, tracks the state of the directory guard
  42. * for this connection (if any). */
  43. struct circuit_guard_state_t *guard_state;
  44. char identity_digest[DIGEST_LEN]; /**< Hash of the public RSA key for
  45. * the directory server's signing key. */
  46. /** Unique ID for directory requests; this used to be in connection_t, but
  47. * that's going away and being used on channels instead. The dirserver still
  48. * needs this for the incoming side, so it's moved here. */
  49. uint64_t dirreq_id;
  50. dir_connection_pirclient_state_t pirclient_state;
  51. #ifdef MEASUREMENTS_21206
  52. /** Number of RELAY_DATA cells received. */
  53. uint32_t data_cells_received;
  54. /** Number of RELAY_DATA cells sent. */
  55. uint32_t data_cells_sent;
  56. #endif /* defined(MEASUREMENTS_21206) */
  57. };
  58. #endif