or_state_st.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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-2018, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. #ifndef TOR_OR_STATE_ST_H
  7. #define TOR_OR_STATE_ST_H
  8. #include "lib/cc/torint.h"
  9. struct smartlist_t;
  10. /** Persistent state for an onion router, as saved to disk. */
  11. struct or_state_t {
  12. uint32_t magic_;
  13. /** The time at which we next plan to write the state to the disk. Equal to
  14. * TIME_MAX if there are no savable changes, 0 if there are changes that
  15. * should be saved right away. */
  16. time_t next_write;
  17. /** When was the state last written to disk? */
  18. time_t LastWritten;
  19. /** Fields for accounting bandwidth use. */
  20. time_t AccountingIntervalStart;
  21. uint64_t AccountingBytesReadInInterval;
  22. uint64_t AccountingBytesWrittenInInterval;
  23. int AccountingSecondsActive;
  24. int AccountingSecondsToReachSoftLimit;
  25. time_t AccountingSoftLimitHitAt;
  26. uint64_t AccountingBytesAtSoftLimit;
  27. uint64_t AccountingExpectedUsage;
  28. /** A list of Entry Guard-related configuration lines. (pre-prop271) */
  29. struct config_line_t *EntryGuards;
  30. /** A list of guard-related configuration lines. (post-prop271) */
  31. struct config_line_t *Guard;
  32. struct config_line_t *TransportProxies;
  33. /** Cached revision counters for active hidden services on this host */
  34. struct config_line_t *HidServRevCounter;
  35. /** These fields hold information on the history of bandwidth usage for
  36. * servers. The "Ends" fields hold the time when we last updated the
  37. * bandwidth usage. The "Interval" fields hold the granularity, in seconds,
  38. * of the entries of Values. The "Values" lists hold decimal string
  39. * representations of the number of bytes read or written in each
  40. * interval. The "Maxima" list holds decimal strings describing the highest
  41. * rate achieved during the interval.
  42. */
  43. time_t BWHistoryReadEnds;
  44. int BWHistoryReadInterval;
  45. struct smartlist_t *BWHistoryReadValues;
  46. struct smartlist_t *BWHistoryReadMaxima;
  47. time_t BWHistoryWriteEnds;
  48. int BWHistoryWriteInterval;
  49. struct smartlist_t *BWHistoryWriteValues;
  50. struct smartlist_t *BWHistoryWriteMaxima;
  51. time_t BWHistoryDirReadEnds;
  52. int BWHistoryDirReadInterval;
  53. struct smartlist_t *BWHistoryDirReadValues;
  54. struct smartlist_t *BWHistoryDirReadMaxima;
  55. time_t BWHistoryDirWriteEnds;
  56. int BWHistoryDirWriteInterval;
  57. struct smartlist_t *BWHistoryDirWriteValues;
  58. struct smartlist_t *BWHistoryDirWriteMaxima;
  59. /** Build time histogram */
  60. struct config_line_t * BuildtimeHistogram;
  61. int TotalBuildTimes;
  62. int CircuitBuildAbandonedCount;
  63. /** What version of Tor wrote this state file? */
  64. char *TorVersion;
  65. /** Holds any unrecognized values we found in the state file, in the order
  66. * in which we found them. */
  67. struct config_line_t *ExtraLines;
  68. /** When did we last rotate our onion key? "0" for 'no idea'. */
  69. time_t LastRotatedOnionKey;
  70. };
  71. #endif