or_circuit_st.h 2.7 KB

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