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-2021, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
10 * \brief The or_state_t structure, which represents Tor's state file.
13 #ifndef TOR_OR_STATE_ST_H
14 #define TOR_OR_STATE_ST_H
16 #include "lib/cc/torint.h"
18 struct config_suite_t
;
20 /** Persistent state for an onion router, as saved to disk. */
23 /** The time at which we next plan to write the state to the disk. Equal to
24 * TIME_MAX if there are no saveable changes, 0 if there are changes that
25 * should be saved right away. */
28 /** When was the state last written to disk? */
31 /** Fields for accounting bandwidth use. */
32 time_t AccountingIntervalStart
;
33 uint64_t AccountingBytesReadInInterval
;
34 uint64_t AccountingBytesWrittenInInterval
;
35 int AccountingSecondsActive
;
36 int AccountingSecondsToReachSoftLimit
;
37 time_t AccountingSoftLimitHitAt
;
38 uint64_t AccountingBytesAtSoftLimit
;
39 uint64_t AccountingExpectedUsage
;
41 /** A list of guard-related configuration lines. */
42 struct config_line_t
*Guard
;
44 struct config_line_t
*TransportProxies
;
46 /** These fields hold information on the history of bandwidth usage for
47 * servers. The "Ends" fields hold the time when we last updated the
48 * bandwidth usage. The "Interval" fields hold the granularity, in seconds,
49 * of the entries of Values. The "Values" lists hold decimal string
50 * representations of the number of bytes read or written in each
51 * interval. The "Maxima" list holds decimal strings describing the highest
52 * rate achieved during the interval.
54 time_t BWHistoryReadEnds
;
55 int BWHistoryReadInterval
;
56 struct smartlist_t
*BWHistoryReadValues
;
57 struct smartlist_t
*BWHistoryReadMaxima
;
58 time_t BWHistoryWriteEnds
;
59 int BWHistoryWriteInterval
;
60 struct smartlist_t
*BWHistoryWriteValues
;
61 struct smartlist_t
*BWHistoryWriteMaxima
;
62 time_t BWHistoryIPv6ReadEnds
;
63 int BWHistoryIPv6ReadInterval
;
64 struct smartlist_t
*BWHistoryIPv6ReadValues
;
65 struct smartlist_t
*BWHistoryIPv6ReadMaxima
;
66 time_t BWHistoryIPv6WriteEnds
;
67 int BWHistoryIPv6WriteInterval
;
68 struct smartlist_t
*BWHistoryIPv6WriteValues
;
69 struct smartlist_t
*BWHistoryIPv6WriteMaxima
;
70 time_t BWHistoryDirReadEnds
;
71 int BWHistoryDirReadInterval
;
72 struct smartlist_t
*BWHistoryDirReadValues
;
73 struct smartlist_t
*BWHistoryDirReadMaxima
;
74 time_t BWHistoryDirWriteEnds
;
75 int BWHistoryDirWriteInterval
;
76 struct smartlist_t
*BWHistoryDirWriteValues
;
77 struct smartlist_t
*BWHistoryDirWriteMaxima
;
79 /** Build time histogram */
80 struct config_line_t
* BuildtimeHistogram
;
82 int CircuitBuildAbandonedCount
;
84 /** What version of Tor wrote this state file? */
87 /** Holds any unrecognized values we found in the state file, in the order
88 * in which we found them. */
89 struct config_line_t
*ExtraLines
;
91 /** When did we last rotate our onion key? "0" for 'no idea'. */
92 time_t LastRotatedOnionKey
;
95 * State objects for individual modules.
97 * Never access this field or its members directly: instead, use the module
98 * in question to get its relevant state object if you must.
100 struct config_suite_t
*substates_
;
103 #endif /* !defined(TOR_OR_STATE_ST_H) */