or_circuit_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 OR_CIRCUIT_ST_H
  7. #define OR_CIRCUIT_ST_H
  8. #include "core/or/or.h"
  9. #include "core/or/circuit_st.h"
  10. #include "core/or/crypt_path_st.h"
  11. struct onion_queue_t;
  12. /** An or_circuit_t holds information needed to implement a circuit at an
  13. * OR. */
  14. struct or_circuit_t {
  15. circuit_t base_;
  16. /** Pointer to an entry on the onion queue, if this circuit is waiting for a
  17. * chance to give an onionskin to a cpuworker. Used only in onion.c */
  18. struct onion_queue_t *onionqueue_entry;
  19. /** Pointer to a workqueue entry, if this circuit has given an onionskin to
  20. * a cpuworker and is waiting for a response. Used to decide whether it is
  21. * safe to free a circuit or if it is still in use by a cpuworker. */
  22. struct workqueue_entry_s *workqueue_entry;
  23. /** The circuit_id used in the previous (backward) hop of this circuit. */
  24. circid_t p_circ_id;
  25. /** Queue of cells waiting to be transmitted on p_conn. */
  26. cell_queue_t p_chan_cells;
  27. /** The channel that is previous in this circuit. */
  28. channel_t *p_chan;
  29. /** Linked list of Exit streams associated with this circuit. */
  30. edge_connection_t *n_streams;
  31. /** Linked list of Exit streams associated with this circuit that are
  32. * still being resolved. */
  33. edge_connection_t *resolving_streams;
  34. /** Cryptographic state used for encrypting and authenticating relay
  35. * cells to and from this hop. */
  36. relay_crypto_t crypto;
  37. /** Points to spliced circuit if purpose is REND_ESTABLISHED, and circuit
  38. * is not marked for close. */
  39. struct or_circuit_t *rend_splice;
  40. /** Stores KH for the handshake. */
  41. char rend_circ_nonce[DIGEST_LEN];/* KH in tor-spec.txt */
  42. /** How many more relay_early cells can we send on this circuit, according
  43. * to the specification? */
  44. unsigned int remaining_relay_early_cells : 4;
  45. /* We have already received an INTRODUCE1 cell on this circuit. */
  46. unsigned int already_received_introduce1 : 1;
  47. /** If set, this circuit carries HS traffic. Consider it in any HS
  48. * statistics. */
  49. unsigned int circuit_carries_hs_traffic_stats : 1;
  50. /** Number of cells that were removed from circuit queue; reset every
  51. * time when writing buffer stats to disk. */
  52. uint32_t processed_cells;
  53. /** Total time in milliseconds that cells spent in both app-ward and
  54. * exit-ward queues of this circuit; reset every time when writing
  55. * buffer stats to disk. */
  56. uint64_t total_cell_waiting_time;
  57. };
  58. #endif /* !defined(OR_CIRCUIT_ST_H) */