Tor  0.4.7.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-2021, 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 saveable 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 guard-related configuration lines. */
43 
44  struct config_line_t *TransportProxies;
45 
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.
53  */
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;
78 
79  /** Build time histogram */
81  int TotalBuildTimes;
82  int CircuitBuildAbandonedCount;
83 
84  /** What version of Tor wrote this state file? */
85  char *TorVersion;
86 
87  /** Holds any unrecognized values we found in the state file, in the order
88  * in which we found them. */
90 
91  /** When did we last rotate our onion key? "0" for 'no idea'. */
93 
94  /**
95  * State objects for individual modules.
96  *
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.
99  */
101 };
102 
103 #endif /* !defined(TOR_OR_STATE_ST_H) */
time_t next_write
Definition: or_state_st.h:26
time_t AccountingIntervalStart
Definition: or_state_st.h:32
time_t LastRotatedOnionKey
Definition: or_state_st.h:92
char * TorVersion
Definition: or_state_st.h:85
time_t LastWritten
Definition: or_state_st.h:29
struct config_suite_t * substates_
Definition: or_state_st.h:100
time_t BWHistoryReadEnds
Definition: or_state_st.h:54
struct config_line_t * Guard
Definition: or_state_st.h:42
struct config_line_t * BuildtimeHistogram
Definition: or_state_st.h:80
struct config_line_t * ExtraLines
Definition: or_state_st.h:89
Integer definitions used throughout Tor.