diff --git a/src/or/circuitstats.c b/src/or/circuitstats.c
index c090a1e7ac164ede3361b441c281fc2cc39cb85b..32584c26d5cea2d7599d2c48af598748cc365266 100644
--- a/src/or/circuitstats.c
+++ b/src/or/circuitstats.c
@@ -46,6 +46,7 @@
 
 #include "or/crypt_path_st.h"
 #include "or/origin_circuit_st.h"
+#include "or/or_state_st.h"
 
 #undef log
 #include <math.h>
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 41ec7e8bc41cfcb685ecdb38be9c786973f480f7..b3021edf16d4f5b123f805f088fec2beb2315cb5 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -66,6 +66,7 @@
 #include "or/or_connection_st.h"
 #include "or/or_handshake_certs_st.h"
 #include "or/or_handshake_state_st.h"
+#include "or/or_state_st.h"
 #include "or/routerinfo_st.h"
 #include "or/var_cell_st.h"
 #include "lib/crypt_ops/crypto_format.h"
diff --git a/src/or/dirauth/shared_random_state.c b/src/or/dirauth/shared_random_state.c
index 85c02887daec5f9ecd5f340a6fb7bef1ad641ba9..87ddcc073649b2608a151ffac3935a2d136ac477 100644
--- a/src/or/dirauth/shared_random_state.c
+++ b/src/or/dirauth/shared_random_state.c
@@ -23,6 +23,8 @@
 #include "or/voting_schedule.h"
 #include "lib/encoding/confline.h"
 
+#include "or/or_state_st.h"
+
 /* Default filename of the shared random state on disk. */
 static const char default_fname[] = "sr-state";
 
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index 2ed2bc904d6fa496bdd9f5e4dc5796c09703b066..ba9c30f8b3a036f247755e3789321bc260f989c2 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -143,6 +143,7 @@
 
 #include "or/node_st.h"
 #include "or/origin_circuit_st.h"
+#include "or/or_state_st.h"
 
 #include "lib/crypt_ops/digestset.h"
 
diff --git a/src/or/hibernate.c b/src/or/hibernate.c
index 2c43e0f997a28c5823378b18d7258a167be3c925..f98ada02d6c56a7621d9bb09f194a673700cfb6e 100644
--- a/src/or/hibernate.c
+++ b/src/or/hibernate.c
@@ -44,6 +44,7 @@ hibernating, phase 2:
 #include "common/compat_libevent.h"
 
 #include "or/or_connection_st.h"
+#include "or/or_state_st.h"
 
 /** Are we currently awake, asleep, running out of bandwidth, or shutting
  * down? */
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index 6c134136fe721de1a79b54743c62d090344fe303..b651f1e27d9380d826cb58eb7d917bdefa60a0d6 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -45,6 +45,7 @@
 #include "or/networkstatus_st.h"
 #include "or/node_st.h"
 #include "or/origin_circuit_st.h"
+#include "or/or_state_st.h"
 #include "or/routerstatus_st.h"
 
 #include "lib/encoding/confline.h"
diff --git a/src/or/include.am b/src/or/include.am
index ce195c92ed3f2139d31ae33ff782ecc0b8986b28..5475ea17e5fb37f61aad0b2cdf6ec1c5ab2fbdfc 100644
--- a/src/or/include.am
+++ b/src/or/include.am
@@ -75,7 +75,7 @@ LIBTOR_APP_A_SOURCES = \
 	src/or/onion_fast.c				\
 	src/or/onion_tap.c				\
 	src/or/transports.c				\
-	src/or/parsecommon.c			\
+	src/or/parsecommon.c				\
 	src/or/periodic.c				\
 	src/or/protover.c				\
 	src/or/protover_rust.c				\
@@ -275,6 +275,7 @@ ORHEADERS = \
 	src/or/or_connection_st.h			\
 	src/or/or_handshake_certs_st.h			\
 	src/or/or_handshake_state_st.h			\
+	src/or/or_state_st.h				\
 	src/or/origin_circuit_st.h			\
 	src/or/transports.h				\
 	src/or/parsecommon.h				\
diff --git a/src/or/main.c b/src/or/main.c
index 19b30f725ba441e4f438f53836072517ad1f26e5..9851cdb57b653edb457bf59628a9995f825ac851 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -131,6 +131,7 @@
 #include "or/entry_connection_st.h"
 #include "or/networkstatus_st.h"
 #include "or/or_connection_st.h"
+#include "or/or_state_st.h"
 #include "or/port_cfg_st.h"
 #include "or/routerinfo_st.h"
 #include "or/socks_request_st.h"
diff --git a/src/or/or.h b/src/or/or.h
index 1221084afbb0cef8cf8e723567db2c05db1eb61b..0886517dda62d7b38b2f0d139b0b725b167d972e 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -2045,78 +2045,7 @@ typedef struct {
 
 #define LOG_PROTOCOL_WARN (get_protocol_warning_severity_level())
 
-/** Persistent state for an onion router, as saved to disk. */
-typedef struct {
-  uint32_t magic_;
-  /** The time at which we next plan to write the state to the disk.  Equal to
-   * TIME_MAX if there are no savable changes, 0 if there are changes that
-   * should be saved right away. */
-  time_t next_write;
-
-  /** When was the state last written to disk? */
-  time_t LastWritten;
-
-  /** Fields for accounting bandwidth use. */
-  time_t AccountingIntervalStart;
-  uint64_t AccountingBytesReadInInterval;
-  uint64_t AccountingBytesWrittenInInterval;
-  int AccountingSecondsActive;
-  int AccountingSecondsToReachSoftLimit;
-  time_t AccountingSoftLimitHitAt;
-  uint64_t AccountingBytesAtSoftLimit;
-  uint64_t AccountingExpectedUsage;
-
-  /** A list of Entry Guard-related configuration lines. (pre-prop271) */
-  struct config_line_t *EntryGuards;
-
-  /** A list of guard-related configuration lines. (post-prop271) */
-  struct config_line_t *Guard;
-
-  struct config_line_t *TransportProxies;
-
-  /** Cached revision counters for active hidden services on this host */
-  struct config_line_t *HidServRevCounter;
-
-  /** These fields hold information on the history of bandwidth usage for
-   * servers.  The "Ends" fields hold the time when we last updated the
-   * bandwidth usage. The "Interval" fields hold the granularity, in seconds,
-   * of the entries of Values.  The "Values" lists hold decimal string
-   * representations of the number of bytes read or written in each
-   * interval. The "Maxima" list holds decimal strings describing the highest
-   * rate achieved during the interval.
-   */
-  time_t      BWHistoryReadEnds;
-  int         BWHistoryReadInterval;
-  smartlist_t *BWHistoryReadValues;
-  smartlist_t *BWHistoryReadMaxima;
-  time_t      BWHistoryWriteEnds;
-  int         BWHistoryWriteInterval;
-  smartlist_t *BWHistoryWriteValues;
-  smartlist_t *BWHistoryWriteMaxima;
-  time_t      BWHistoryDirReadEnds;
-  int         BWHistoryDirReadInterval;
-  smartlist_t *BWHistoryDirReadValues;
-  smartlist_t *BWHistoryDirReadMaxima;
-  time_t      BWHistoryDirWriteEnds;
-  int         BWHistoryDirWriteInterval;
-  smartlist_t *BWHistoryDirWriteValues;
-  smartlist_t *BWHistoryDirWriteMaxima;
-
-  /** Build time histogram */
-  struct config_line_t * BuildtimeHistogram;
-  int TotalBuildTimes;
-  int CircuitBuildAbandonedCount;
-
-  /** What version of Tor wrote this state file? */
-  char *TorVersion;
-
-  /** Holds any unrecognized values we found in the state file, in the order
-   * in which we found them. */
-  struct config_line_t *ExtraLines;
-
-  /** When did we last rotate our onion key?  "0" for 'no idea'. */
-  time_t LastRotatedOnionKey;
-} or_state_t;
+typedef struct or_state_t or_state_t;
 
 #define MAX_SOCKS_ADDR_LEN 256
 
diff --git a/src/or/or_state_st.h b/src/or/or_state_st.h
new file mode 100644
index 0000000000000000000000000000000000000000..f1d5f981f166766db306425fd126085ad91e6198
--- /dev/null
+++ b/src/or/or_state_st.h
@@ -0,0 +1,86 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef TOR_OR_STATE_ST_H
+#define TOR_OR_STATE_ST_H
+
+#include "lib/cc/torint.h"
+struct smartlist_t;
+
+/** Persistent state for an onion router, as saved to disk. */
+struct or_state_t {
+  uint32_t magic_;
+  /** The time at which we next plan to write the state to the disk.  Equal to
+   * TIME_MAX if there are no savable changes, 0 if there are changes that
+   * should be saved right away. */
+  time_t next_write;
+
+  /** When was the state last written to disk? */
+  time_t LastWritten;
+
+  /** Fields for accounting bandwidth use. */
+  time_t AccountingIntervalStart;
+  uint64_t AccountingBytesReadInInterval;
+  uint64_t AccountingBytesWrittenInInterval;
+  int AccountingSecondsActive;
+  int AccountingSecondsToReachSoftLimit;
+  time_t AccountingSoftLimitHitAt;
+  uint64_t AccountingBytesAtSoftLimit;
+  uint64_t AccountingExpectedUsage;
+
+  /** A list of Entry Guard-related configuration lines. (pre-prop271) */
+  struct config_line_t *EntryGuards;
+
+  /** A list of guard-related configuration lines. (post-prop271) */
+  struct config_line_t *Guard;
+
+  struct config_line_t *TransportProxies;
+
+  /** Cached revision counters for active hidden services on this host */
+  struct config_line_t *HidServRevCounter;
+
+  /** These fields hold information on the history of bandwidth usage for
+   * servers.  The "Ends" fields hold the time when we last updated the
+   * bandwidth usage. The "Interval" fields hold the granularity, in seconds,
+   * of the entries of Values.  The "Values" lists hold decimal string
+   * representations of the number of bytes read or written in each
+   * interval. The "Maxima" list holds decimal strings describing the highest
+   * rate achieved during the interval.
+   */
+  time_t      BWHistoryReadEnds;
+  int         BWHistoryReadInterval;
+  struct smartlist_t *BWHistoryReadValues;
+  struct smartlist_t *BWHistoryReadMaxima;
+  time_t      BWHistoryWriteEnds;
+  int         BWHistoryWriteInterval;
+  struct smartlist_t *BWHistoryWriteValues;
+  struct smartlist_t *BWHistoryWriteMaxima;
+  time_t      BWHistoryDirReadEnds;
+  int         BWHistoryDirReadInterval;
+  struct smartlist_t *BWHistoryDirReadValues;
+  struct smartlist_t *BWHistoryDirReadMaxima;
+  time_t      BWHistoryDirWriteEnds;
+  int         BWHistoryDirWriteInterval;
+  struct smartlist_t *BWHistoryDirWriteValues;
+  struct smartlist_t *BWHistoryDirWriteMaxima;
+
+  /** Build time histogram */
+  struct config_line_t * BuildtimeHistogram;
+  int TotalBuildTimes;
+  int CircuitBuildAbandonedCount;
+
+  /** What version of Tor wrote this state file? */
+  char *TorVersion;
+
+  /** Holds any unrecognized values we found in the state file, in the order
+   * in which we found them. */
+  struct config_line_t *ExtraLines;
+
+  /** When did we last rotate our onion key?  "0" for 'no idea'. */
+  time_t LastRotatedOnionKey;
+};
+
+#endif
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 907b01d68e4cc1a973a5125b3c2305bf1ed5b728..02dc864033caecaeb9682b287bf1139b8e94bfe1 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -91,6 +91,7 @@
 
 #include "or/networkstatus_st.h"
 #include "or/or_circuit_st.h"
+#include "or/or_state_st.h"
 
 #include "lib/container/bloomfilt.h"
 #include "lib/container/order.h"
diff --git a/src/or/router.c b/src/or/router.c
index cc7102228de58374212ae83087049c25cab4f1c3..6420f1e5d1da4afd19990ea124941a57b16a274e 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -47,6 +47,7 @@
 #include "or/extrainfo_st.h"
 #include "or/node_st.h"
 #include "or/origin_circuit_st.h"
+#include "or/or_state_st.h"
 #include "or/port_cfg_st.h"
 #include "or/routerinfo_st.h"
 
diff --git a/src/or/statefile.c b/src/or/statefile.c
index 090e29a189b9cd92ed1cfca72e1b0166baa06e9d..5631001c02fa93e77a5a4c8314323e247fb06efe 100644
--- a/src/or/statefile.c
+++ b/src/or/statefile.c
@@ -44,6 +44,8 @@
 #include "or/statefile.h"
 #include "lib/encoding/confline.h"
 
+#include "or/or_state_st.h"
+
 /** A list of state-file "abbreviations," for compatibility. */
 static config_abbrev_t state_abbrevs_[] = {
   { "AccountingBytesReadInterval", "AccountingBytesReadInInterval", 0, 0 },
diff --git a/src/or/status.c b/src/or/status.c
index 2cb1dc7348fa8bb5fac5ca33c1108662d9c54b03..80b56ac1a829f62980cff94ba45543411de438f8 100644
--- a/src/or/status.c
+++ b/src/or/status.c
@@ -30,6 +30,7 @@
 #include "or/hs_service.h"
 #include "or/dos.h"
 
+#include "or/or_state_st.h"
 #include "or/routerinfo_st.h"
 #include "lib/tls/tortls.h"
 
diff --git a/src/test/test.c b/src/test/test.c
index 64332e2645dad6f81af34a0dbbb5f1399a998180..d6be5ea2e737a296605d78a33c2e90cf520a7cb5 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -12,6 +12,8 @@
 #include "lib/crypt_ops/crypto_dh.h"
 #include "lib/crypt_ops/crypto_rand.h"
 
+#include "or/or_state_st.h"
+
 #include <stdio.h>
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
diff --git a/src/test/test_accounting.c b/src/test/test_accounting.c
index ce8e08f7c9d0f78baca25ce15e3e4a375faa55c3..7b9511dc202bc5903f743218b1ae07b01ea1e6c1 100644
--- a/src/test/test_accounting.c
+++ b/src/test/test_accounting.c
@@ -9,6 +9,8 @@
 #define STATEFILE_PRIVATE
 #include "or/statefile.h"
 
+#include "or/or_state_st.h"
+
 #define NS_MODULE accounting
 
 #define NS_SUBMODULE limits
@@ -102,4 +104,3 @@ struct testcase_t accounting_tests[] = {
   { "bwlimits", test_accounting_limits, TT_FORK, NULL, NULL },
   END_OF_TESTCASES
 };
-
diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c
index f0d649330d61a0f5934a3afee99d43fa289fd9a4..262e2fa680581506d2e9f410aafb5535d9284e49 100644
--- a/src/test/test_entrynodes.c
+++ b/src/test/test_entrynodes.c
@@ -37,6 +37,7 @@
 #include "or/networkstatus_st.h"
 #include "or/node_st.h"
 #include "or/origin_circuit_st.h"
+#include "or/or_state_st.h"
 #include "or/routerinfo_st.h"
 #include "or/routerstatus_st.h"
 
diff --git a/src/test/test_hs_common.c b/src/test/test_hs_common.c
index cf221ca6060dcfb52022a6f706f7a0f97dcdab88..28c6316bd0cbe028351f53d87de8a5ed6cf759be 100644
--- a/src/test/test_hs_common.c
+++ b/src/test/test_hs_common.c
@@ -37,6 +37,7 @@
 #include "or/microdesc_st.h"
 #include "or/networkstatus_st.h"
 #include "or/node_st.h"
+#include "or/or_state_st.h"
 #include "or/routerinfo_st.h"
 #include "or/routerstatus_st.h"
 
diff --git a/src/test/test_hs_service.c b/src/test/test_hs_service.c
index 3ea1e753009bff7976502bd0f86559dfa2513d25..e81a5eff4fbe3adde2e4d40dd1b3d20b642b4550 100644
--- a/src/test/test_hs_service.c
+++ b/src/test/test_hs_service.c
@@ -59,6 +59,7 @@
 #include "or/networkstatus_st.h"
 #include "or/node_st.h"
 #include "or/origin_circuit_st.h"
+#include "or/or_state_st.h"
 #include "or/routerinfo_st.h"
 
 /* Trunnel */
diff --git a/src/test/test_pt.c b/src/test/test_pt.c
index 08704050649e033eb2ec21c0e08e761707e66d3f..e685ab50deedd9578243feb711a1fb99e23c4d7d 100644
--- a/src/test/test_pt.c
+++ b/src/test/test_pt.c
@@ -21,6 +21,8 @@
 #include "lib/process/subprocess.h"
 #include "lib/encoding/confline.h"
 
+#include "or/or_state_st.h"
+
 static void
 reset_mp(managed_proxy_t *mp)
 {
diff --git a/src/test/test_routerlist.c b/src/test/test_routerlist.c
index 804df0f14e44970bd12103c5fada511983bd9262..b25a0be9a4556e080ae6e90b231e2bbc7fae70a5 100644
--- a/src/test/test_routerlist.c
+++ b/src/test/test_routerlist.c
@@ -37,6 +37,7 @@
 #include "or/dir_connection_st.h"
 #include "or/networkstatus_st.h"
 #include "or/node_st.h"
+#include "or/or_state_st.h"
 #include "or/routerstatus_st.h"
 
 #include "lib/encoding/confline.h"
diff --git a/src/test/test_shared_random.c b/src/test/test_shared_random.c
index 91ae20bff8160684d3f7e67f1fa97bad3cd5b778..293ed6cf33cd9bcd87291c41dde2cf5c148556e4 100644
--- a/src/test/test_shared_random.c
+++ b/src/test/test_shared_random.c
@@ -24,6 +24,7 @@
 
 #include "or/dir_server_st.h"
 #include "or/networkstatus_st.h"
+#include "or/or_state_st.h"
 
 static authority_cert_t *mock_cert;
 
@@ -1393,4 +1394,3 @@ struct testcase_t sr_tests[] = {
     NULL, NULL },
   END_OF_TESTCASES
 };
-
diff --git a/src/test/test_status.c b/src/test/test_status.c
index 071b3ba8a7df7b62211828c238e3295086309b35..6c694be57e8d25a6abc9652eff5583c8b4e321fb 100644
--- a/src/test/test_status.c
+++ b/src/test/test_status.c
@@ -27,6 +27,7 @@
 #include "lib/tls/tortls.h"
 
 #include "or/origin_circuit_st.h"
+#include "or/or_state_st.h"
 #include "or/routerinfo_st.h"
 
 #include "test/test.h"
diff --git a/src/test/test_tortls.c b/src/test/test_tortls.c
index b456734684cd003c00fdc69e7f78844890b51a90..9ae9d4dfbdd632f6d78c62f532825897f9f104b2 100644
--- a/src/test/test_tortls.c
+++ b/src/test/test_tortls.c
@@ -34,6 +34,7 @@ ENABLE_GCC_WARNING(redundant-decls)
 #include "lib/log/torlog.h"
 #include "or/config.h"
 #include "lib/tls/tortls.h"
+#include "or/or_state_st.h"
 
 #include "test/test.h"
 #include "test/log_test_helpers.h"