Tor  0.4.3.0-alpha-dev
or_state_st.h
Go to the documentation of this file.
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 
7 /**
8  * \file or_state_st.h
9  *
10  * \brief The or_state_t structure, which represents Tor's state file.
11  */
12 
13 #ifndef TOR_OR_STATE_ST_H
14 #define TOR_OR_STATE_ST_H
15 
16 #include "lib/cc/torint.h"
17 struct smartlist_t;
18 struct config_suite_t;
19 
20 /** Persistent state for an onion router, as saved to disk. */
21 struct or_state_t {
22  uint32_t magic_;
23  /** The time at which we next plan to write the state to the disk. Equal to
24  * TIME_MAX if there are no savable changes, 0 if there are changes that
25  * should be saved right away. */
26  time_t next_write;
27 
28  /** When was the state last written to disk? */
29  time_t LastWritten;
30 
31  /** Fields for accounting bandwidth use. */
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;
40 
41  /** A list of Entry Guard-related configuration lines. (pre-prop271) */
43 
44  /** A list of guard-related configuration lines. (post-prop271) */
46 
47  struct config_line_t *TransportProxies;
48 
49  /** Cached revision counters for active hidden services on this host */
51 
52  /** These fields hold information on the history of bandwidth usage for
53  * servers. The "Ends" fields hold the time when we last updated the
54  * bandwidth usage. The "Interval" fields hold the granularity, in seconds,
55  * of the entries of Values. The "Values" lists hold decimal string
56  * representations of the number of bytes read or written in each
57  * interval. The "Maxima" list holds decimal strings describing the highest
58  * rate achieved during the interval.
59  */
61  int BWHistoryReadInterval;
62  struct smartlist_t *BWHistoryReadValues;
63  struct smartlist_t *BWHistoryReadMaxima;
64  time_t BWHistoryWriteEnds;
65  int BWHistoryWriteInterval;
66  struct smartlist_t *BWHistoryWriteValues;
67  struct smartlist_t *BWHistoryWriteMaxima;
68  time_t BWHistoryDirReadEnds;
69  int BWHistoryDirReadInterval;
70  struct smartlist_t *BWHistoryDirReadValues;
71  struct smartlist_t *BWHistoryDirReadMaxima;
72  time_t BWHistoryDirWriteEnds;
73  int BWHistoryDirWriteInterval;
74  struct smartlist_t *BWHistoryDirWriteValues;
75  struct smartlist_t *BWHistoryDirWriteMaxima;
76 
77  /** Build time histogram */
79  int TotalBuildTimes;
80  int CircuitBuildAbandonedCount;
81 
82  /** What version of Tor wrote this state file? */
83  char *TorVersion;
84 
85  /** Holds any unrecognized values we found in the state file, in the order
86  * in which we found them. */
88 
89  /** When did we last rotate our onion key? "0" for 'no idea'. */
91 
92  /**
93  * State objects for individual modules.
94  *
95  * Never access this field or its members directly: instead, use the module
96  * in question to get its relevant state object if you must.
97  */
99 };
100 
101 #endif /* !defined(TOR_OR_STATE_ST_H) */
struct config_line_t * EntryGuards
Definition: or_state_st.h:42
struct config_line_t * Guard
Definition: or_state_st.h:45
time_t LastRotatedOnionKey
Definition: or_state_st.h:90
time_t next_write
Definition: or_state_st.h:26
time_t LastWritten
Definition: or_state_st.h:29
struct config_line_t * HidServRevCounter
Definition: or_state_st.h:50
struct config_line_t * BuildtimeHistogram
Definition: or_state_st.h:78
Integer definitions used throughout Tor.
struct config_line_t * ExtraLines
Definition: or_state_st.h:87
time_t BWHistoryReadEnds
Definition: or_state_st.h:60
char * TorVersion
Definition: or_state_st.h:83
time_t AccountingIntervalStart
Definition: or_state_st.h:32
struct config_suite_t * substates_
Definition: or_state_st.h:98