or_circuit_st.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. /**
  30. * Circuit mux associated with p_chan to which this circuit is attached;
  31. * NULL if we have no p_chan.
  32. */
  33. circuitmux_t *p_mux;
  34. /** Linked list of Exit streams associated with this circuit. */
  35. edge_connection_t *n_streams;
  36. /** Linked list of Exit streams associated with this circuit that are
  37. * still being resolved. */
  38. edge_connection_t *resolving_streams;
  39. /** Cryptographic state used for encrypting and authenticating relay
  40. * cells to and from this hop. */
  41. relay_crypto_t crypto;
  42. /** Points to spliced circuit if purpose is REND_ESTABLISHED, and circuit
  43. * is not marked for close. */
  44. struct or_circuit_t *rend_splice;
  45. /** Stores KH for the handshake. */
  46. char rend_circ_nonce[DIGEST_LEN];/* KH in tor-spec.txt */
  47. /** How many more relay_early cells can we send on this circuit, according
  48. * to the specification? */
  49. unsigned int remaining_relay_early_cells : 4;
  50. /* We have already received an INTRODUCE1 cell on this circuit. */
  51. unsigned int already_received_introduce1 : 1;
  52. /** If set, this circuit carries HS traffic. Consider it in any HS
  53. * statistics. */
  54. unsigned int circuit_carries_hs_traffic_stats : 1;
  55. /** Number of cells that were removed from circuit queue; reset every
  56. * time when writing buffer stats to disk. */
  57. uint32_t processed_cells;
  58. /** Total time in milliseconds that cells spent in both app-ward and
  59. * exit-ward queues of this circuit; reset every time when writing
  60. * buffer stats to disk. */
  61. uint64_t total_cell_waiting_time;
  62. };
  63. #endif