Tor  0.4.5.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-2020, 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 BWHistoryIPv6ReadEnds;
69  int BWHistoryIPv6ReadInterval;
70  struct smartlist_t *BWHistoryIPv6ReadValues;
71  struct smartlist_t *BWHistoryIPv6ReadMaxima;
72  time_t BWHistoryIPv6WriteEnds;
73  int BWHistoryIPv6WriteInterval;
74  struct smartlist_t *BWHistoryIPv6WriteValues;
75  struct smartlist_t *BWHistoryIPv6WriteMaxima;
76  time_t BWHistoryDirReadEnds;
77  int BWHistoryDirReadInterval;
78  struct smartlist_t *BWHistoryDirReadValues;
79  struct smartlist_t *BWHistoryDirReadMaxima;
80  time_t BWHistoryDirWriteEnds;
81  int BWHistoryDirWriteInterval;
82  struct smartlist_t *BWHistoryDirWriteValues;
83  struct smartlist_t *BWHistoryDirWriteMaxima;
84 
85  /** Build time histogram */
87  int TotalBuildTimes;
88  int CircuitBuildAbandonedCount;
89 
90  /** What version of Tor wrote this state file? */
91  char *TorVersion;
92 
93  /** Holds any unrecognized values we found in the state file, in the order
94  * in which we found them. */
96 
97  /** When did we last rotate our onion key? "0" for 'no idea'. */
99 
100  /**
101  * State objects for individual modules.
102  *
103  * Never access this field or its members directly: instead, use the module
104  * in question to get its relevant state object if you must.
105  */
107 };
108 
109 #endif /* !defined(TOR_OR_STATE_ST_H) */
or_state_t::AccountingIntervalStart
time_t AccountingIntervalStart
Definition: or_state_st.h:32
or_state_t
Definition: or_state_st.h:21
or_state_t::TorVersion
char * TorVersion
Definition: or_state_st.h:91
config_suite_t
Definition: confmgt.c:75
or_state_t::LastWritten
time_t LastWritten
Definition: or_state_st.h:29
torint.h
Integer definitions used throughout Tor.
or_state_t::Guard
struct config_line_t * Guard
Definition: or_state_st.h:45
or_state_t::BWHistoryReadEnds
time_t BWHistoryReadEnds
Definition: or_state_st.h:60
or_state_t::substates_
struct config_suite_t * substates_
Definition: or_state_st.h:106
or_state_t::next_write
time_t next_write
Definition: or_state_st.h:26
or_state_t::HidServRevCounter
struct config_line_t * HidServRevCounter
Definition: or_state_st.h:50
or_state_t::LastRotatedOnionKey
time_t LastRotatedOnionKey
Definition: or_state_st.h:98
config_line_t
Definition: confline.h:29
or_state_t::ExtraLines
struct config_line_t * ExtraLines
Definition: or_state_st.h:95
or_state_t::EntryGuards
struct config_line_t * EntryGuards
Definition: or_state_st.h:42
smartlist_t
Definition: smartlist_core.h:26
or_state_t::BuildtimeHistogram
struct config_line_t * BuildtimeHistogram
Definition: or_state_st.h:86