[tor-commits] [tor/master] Remove needless includes from or.h

nickm at torproject.org nickm at torproject.org
Tue Jul 3 15:11:29 UTC 2018


commit 471104eaa5e7fbe1b5a32b8be388daae328abd4a
Author: Nick Mathewson <nickm at torproject.org>
Date:   Sun Jul 1 11:32:11 2018 -0400

    Remove needless includes from or.h
    
    or.h should really include only the minimum of stuff from or/*,
    common/*, and lib/*.
---
 src/lib/compress/compress.h          |   4 +-
 src/lib/crypt_ops/crypto_dh.h        |   1 +
 src/or/addressmap.c                  |   4 +-
 src/or/cell_queue_st.h               |   3 +-
 src/or/channel.h                     |   3 +-
 src/or/channeltls.c                  |   3 +-
 src/or/circuit_st.h                  |   5 +-
 src/or/circuitlist.c                 |   3 +-
 src/or/circuitstats.c                |   1 +
 src/or/config.c                      |   1 +
 src/or/config.h                      |  10 +--
 src/or/confparse.c                   |   1 +
 src/or/confparse.h                   |  11 ++-
 src/or/connection.c                  |   3 +
 src/or/connection_edge.c             |   2 +-
 src/or/connection_or.c               |   3 +-
 src/or/conscache.c                   |   2 +-
 src/or/conscache.h                   |   9 +--
 src/or/consdiffmgr.c                 |   4 +-
 src/or/consdiffmgr.h                 |   7 +-
 src/or/control.c                     |   3 +-
 src/or/control.h                     |   3 +-
 src/or/crypt_path_st.h               |   4 +-
 src/or/dir_connection_st.h           |   5 +-
 src/or/dirauth/dirvote.c             |   1 +
 src/or/dirauth/shared_random_state.c |   2 +-
 src/or/dirauth/shared_random_state.h |   7 +-
 src/or/directory.c                   |   3 +-
 src/or/directory.h                   |  15 ++--
 src/or/dirserv.c                     |   2 +
 src/or/dns.c                         |   2 +-
 src/or/dnsserv.c                     |   2 +-
 src/or/entrynodes.c                  |   1 +
 src/or/hibernate.c                   |   2 +-
 src/or/hs_circuit.c                  |   1 +
 src/or/hs_circuitmap.c               |   1 -
 src/or/hs_circuitmap.h               |   5 +-
 src/or/hs_client.c                   |   2 +-
 src/or/hs_config.c                   |   2 +-
 src/or/hs_service.c                  |   3 +-
 src/or/main.c                        |   3 +
 src/or/main.h                        |   7 +-
 src/or/ntmain.c                      |   1 +
 src/or/onion.c                       |   2 +-
 src/or/onion_fast.c                  |   2 +-
 src/or/onion_tap.c                   |   2 +-
 src/or/onion_tap.h                   |  14 ++--
 src/or/or.h                          | 140 +++++++++++++++++------------------
 src/or/or_connection_st.h            |   6 +-
 src/or/or_handshake_certs_st.h       |   9 ++-
 src/or/periodic.c                    |   2 +-
 src/or/policies.c                    |   2 +-
 src/or/policies.h                    |   3 +-
 src/or/reasons.c                     |   2 +-
 src/or/relay_crypto.c                |   2 +-
 src/or/relay_crypto_st.h             |  14 ++--
 src/or/rend_intro_point_st.h         |  10 ++-
 src/or/rendclient.c                  |   3 +-
 src/or/rendcommon.c                  |   2 +-
 src/or/rendservice.c                 |   2 +-
 src/or/rendservice.h                 |   4 +-
 src/or/replaycache.h                 |   5 +-
 src/or/router.c                      |   2 +
 src/or/routerkeys.c                  |   6 +-
 src/or/scheduler.c                   |   2 +-
 src/or/statefile.c                   |   2 +-
 src/or/statefile.h                   |   4 +-
 src/or/status.c                      |   2 +-
 src/or/torcert.c                     |   2 +-
 src/or/torcert.h                     |   9 ++-
 src/test/bench.c                     |   2 +
 src/test/fuzz/fuzzing_common.c       |   2 +-
 src/test/test.c                      |   1 +
 src/test/test_buffers.c              |   3 +-
 src/test/test_cell_formats.c         |   1 -
 src/test/test_channelpadding.c       |   2 +-
 src/test/test_config.c               |   1 +
 src/test/test_conscache.c            |   2 +-
 src/test/test_consdiffmgr.c          |   3 +-
 src/test/test_crypto.c               |   2 +
 src/test/test_dir.c                  |   1 +
 src/test/test_entryconn.c            |   3 +-
 src/test/test_entrynodes.c           |   1 +
 src/test/test_helpers.c              |   2 +-
 src/test/test_hs_client.c            |   3 +-
 src/test/test_hs_service.c           |   2 +-
 src/test/test_link_handshake.c       |   2 +
 src/test/test_options.c              |   1 +
 src/test/test_policy.c               |   2 +-
 src/test/test_pt.c                   |   1 +
 src/test/test_routerlist.c           |   3 +-
 src/test/test_status.c               |   2 +-
 src/test/test_storagedir.c           |   2 +-
 src/test/test_util.c                 |   2 +
 src/test/testing_common.c            |   3 +
 95 files changed, 261 insertions(+), 200 deletions(-)

diff --git a/src/lib/compress/compress.h b/src/lib/compress/compress.h
index ae98e1aae..4466e27c4 100644
--- a/src/lib/compress/compress.h
+++ b/src/lib/compress/compress.h
@@ -18,7 +18,7 @@
  * GZIP_METHOD is guaranteed to be supported by the compress/uncompress
  * functions here. Call tor_compress_supports_method() to check if a given
  * compression schema is supported by Tor. */
-typedef enum {
+typedef enum compress_method_t {
   NO_METHOD=0, // This method must be first.
   GZIP_METHOD=1,
   ZLIB_METHOD=2,
@@ -32,7 +32,7 @@ typedef enum {
  * BEST_COMPRESSION saves the most bandwidth; LOW_COMPRESSION saves the most
  * memory.
  **/
-typedef enum {
+typedef enum compression_level_t {
   BEST_COMPRESSION, HIGH_COMPRESSION, MEDIUM_COMPRESSION, LOW_COMPRESSION
 } compression_level_t;
 
diff --git a/src/lib/crypt_ops/crypto_dh.h b/src/lib/crypt_ops/crypto_dh.h
index 73a7bcb52..88e8a919a 100644
--- a/src/lib/crypt_ops/crypto_dh.h
+++ b/src/lib/crypt_ops/crypto_dh.h
@@ -14,6 +14,7 @@
 #define TOR_CRYPTO_DH_H
 
 #include "orconfig.h"
+#include "lib/cc/torint.h"
 #include "lib/defs/dh_sizes.h"
 
 typedef struct crypto_dh_t crypto_dh_t;
diff --git a/src/or/addressmap.c b/src/or/addressmap.c
index a0df5c986..f622be4d0 100644
--- a/src/or/addressmap.c
+++ b/src/or/addressmap.c
@@ -15,13 +15,14 @@
 
 #define ADDRESSMAP_PRIVATE
 
+#include "lib/crypt_ops/crypto_rand.h"
+
 #include "or/or.h"
 #include "or/addressmap.h"
 #include "or/circuituse.h"
 #include "or/config.h"
 #include "or/connection_edge.h"
 #include "or/control.h"
-#include "lib/crypt_ops/crypto_rand.h"
 #include "or/dns.h"
 #include "or/nodelist.h"
 #include "or/routerset.h"
@@ -1153,4 +1154,3 @@ addressmap_get_mappings(smartlist_t *sl, time_t min_expires,
      iter = strmap_iter_next(addressmap,iter);
    }
 }
-
diff --git a/src/or/cell_queue_st.h b/src/or/cell_queue_st.h
index 4ad98dafb..40110019b 100644
--- a/src/or/cell_queue_st.h
+++ b/src/or/cell_queue_st.h
@@ -7,6 +7,8 @@
 #ifndef PACKED_CELL_ST_H
 #define PACKED_CELL_ST_H
 
+#include "tor_queue.h"
+
 /** A cell as packed for writing to the network. */
 struct packed_cell_t {
   /** Next cell queued on this circuit. */
@@ -25,4 +27,3 @@ struct cell_queue_t {
 };
 
 #endif
-
diff --git a/src/or/channel.h b/src/or/channel.h
index 44b752e2c..6a7b0e7b8 100644
--- a/src/or/channel.h
+++ b/src/or/channel.h
@@ -14,6 +14,8 @@
 #include "common/timers.h"
 #include "common/handles.h"
 
+#include "tor_queue.h"
+
 /* Channel handler function pointer typedefs */
 typedef void (*channel_listener_fn_ptr)(channel_listener_t *, channel_t *);
 typedef void (*channel_cell_handler_fn_ptr)(channel_t *, cell_t *);
@@ -637,4 +639,3 @@ HANDLE_DECL(channel, channel_s,)
   FREE_AND_NULL(channel_handle_t, channel_handle_free_, (h))
 
 #endif /* !defined(TOR_CHANNEL_H) */
-
diff --git a/src/or/channeltls.c b/src/or/channeltls.c
index 5258935ae..b2cab0f55 100644
--- a/src/or/channeltls.c
+++ b/src/or/channeltls.c
@@ -69,6 +69,8 @@
 #include "or/routerinfo_st.h"
 #include "or/var_cell_st.h"
 
+#include "lib/tls/tortls.h"
+
 /** How many CELL_PADDING cells have we received, ever? */
 uint64_t stats_n_padding_cells_processed = 0;
 /** How many CELL_VERSIONS cells have we received, ever? */
@@ -2454,4 +2456,3 @@ channel_tls_process_authenticate_cell(var_cell_t *cell, channel_tls_t *chan)
 
 #undef ERR
 }
-
diff --git a/src/or/circuit_st.h b/src/or/circuit_st.h
index 0ace64f3e..e53e5bf3e 100644
--- a/src/or/circuit_st.h
+++ b/src/or/circuit_st.h
@@ -11,6 +11,8 @@
 
 #include "or/cell_queue_st.h"
 
+struct hs_token_t;
+
 /**
  * A circuit is a path over the onion routing
  * network. Applications can connect to one end of the circuit, and can
@@ -162,11 +164,10 @@ struct circuit_t {
 
   /** If set, points to an HS token that this circuit might be carrying.
    *  Used by the HS circuitmap.  */
-  hs_token_t *hs_token;
+  struct hs_token_t *hs_token;
   /** Hashtable node: used to look up the circuit by its HS token using the HS
       circuitmap. */
   HT_ENTRY(circuit_t) hs_circuitmap_node;
 };
 
 #endif
-
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index a696533ae..441855271 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -67,6 +67,7 @@
 #include "or/control.h"
 #include "lib/crypt_ops/crypto_rand.h"
 #include "lib/crypt_ops/crypto_util.h"
+#include "lib/crypt_ops/crypto_dh.h"
 #include "or/directory.h"
 #include "or/entrynodes.h"
 #include "or/main.h"
@@ -86,6 +87,7 @@
 #include "or/routerlist.h"
 #include "or/routerset.h"
 #include "or/channelpadding.h"
+#include "lib/compress/compress.h"
 #include "lib/compress/compress_lzma.h"
 #include "lib/compress/compress_zlib.h"
 #include "lib/compress/compress_zstd.h"
@@ -2737,4 +2739,3 @@ assert_circuit_ok,(const circuit_t *c))
     tor_assert(!or_circ || !or_circ->rend_splice);
   }
 }
-
diff --git a/src/or/circuitstats.c b/src/or/circuitstats.c
index c2abb2d14..c090a1e7a 100644
--- a/src/or/circuitstats.c
+++ b/src/or/circuitstats.c
@@ -42,6 +42,7 @@
 #include "or/circuituse.h"
 #include "lib/math/fp.h"
 #include "lib/time/tvdiff.h"
+#include "lib/encoding/confline.h"
 
 #include "or/crypt_path_st.h"
 #include "or/origin_circuit_st.h"
diff --git a/src/or/config.c b/src/or/config.c
index e3a4faa31..4fb4489fc 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -71,6 +71,7 @@
 #include "or/circuitstats.h"
 #include "lib/compress/compress.h"
 #include "or/config.h"
+#include "lib/encoding/confline.h"
 #include "or/connection.h"
 #include "or/connection_edge.h"
 #include "or/connection_or.h"
diff --git a/src/or/config.h b/src/or/config.h
index d2faf6c51..762779acf 100644
--- a/src/or/config.h
+++ b/src/or/config.h
@@ -42,7 +42,7 @@ void init_protocol_warning_severity_level(void);
 int get_protocol_warning_severity_level(void);
 const char *get_version(void);
 const char *get_short_version(void);
-setopt_err_t options_trial_assign(config_line_t *list, unsigned flags,
+setopt_err_t options_trial_assign(struct config_line_t *list, unsigned flags,
                                   char **msg);
 
 uint32_t get_last_resolved_addr(void);
@@ -62,7 +62,7 @@ setopt_err_t options_init_from_string(const char *cf_defaults, const char *cf,
                             int command, const char *command_arg, char **msg);
 int option_is_recognized(const char *key);
 const char *option_get_canonical_name(const char *key);
-config_line_t *option_get_assignment(const or_options_t *options,
+struct config_line_t *option_get_assignment(const or_options_t *options,
                                      const char *key);
 int options_save_current(void);
 const char *get_torrc_fname(int defaults_fname);
@@ -180,8 +180,8 @@ int init_cookie_authentication(const char *fname, const char *header,
 or_options_t *options_new(void);
 
 int config_parse_commandline(int argc, char **argv, int ignore_errors,
-                             config_line_t **result,
-                             config_line_t **cmdline_result);
+                             struct config_line_t **result,
+                             struct config_line_t **cmdline_result);
 
 void config_register_addressmaps(const or_options_t *options);
 /* XXXX move to connection_edge.h */
@@ -260,7 +260,7 @@ STATIC int parse_dir_fallback_line(const char *line, int validate_only);
 STATIC int have_enough_mem_for_dircache(const or_options_t *options,
                                         size_t total_mem, char **msg);
 STATIC int parse_port_config(smartlist_t *out,
-                  const config_line_t *ports,
+                  const struct config_line_t *ports,
                   const char *portname,
                   int listener_type,
                   const char *defaultaddr,
diff --git a/src/or/confparse.c b/src/or/confparse.c
index b38e06c6a..60ab32ef8 100644
--- a/src/or/confparse.c
+++ b/src/or/confparse.c
@@ -26,6 +26,7 @@
 #include "or/routerset.h"
 
 #include "lib/container/bitarray.h"
+#include "lib/encoding/confline.h"
 
 static uint64_t config_parse_memunit(const char *s, int *ok);
 static int config_parse_msec_interval(const char *s, int *ok);
diff --git a/src/or/confparse.h b/src/or/confparse.h
index be9785ac1..cbd2ea88e 100644
--- a/src/or/confparse.h
+++ b/src/or/confparse.h
@@ -65,9 +65,9 @@ typedef union {
   time_t *ISOTIME;
   smartlist_t **CSV;
   int *CSV_INTERVAL;
-  config_line_t **LINELIST;
-  config_line_t **LINELIST_S;
-  config_line_t **LINELIST_V;
+  struct config_line_t **LINELIST;
+  struct config_line_t **LINELIST_S;
+  struct config_line_t **LINELIST_V;
   routerset_t **ROUTERSET;
 } confparse_dummy_values_t;
 #endif /* defined(TOR_UNIT_TESTS) */
@@ -185,7 +185,7 @@ void config_free_(const config_format_t *fmt, void *options);
     (options) = NULL;                                 \
   } while (0)
 
-config_line_t *config_get_assigned_option(const config_format_t *fmt,
+struct config_line_t *config_get_assigned_option(const config_format_t *fmt,
                                           const void *options, const char *key,
                                           int escape_val);
 int config_is_same(const config_format_t *fmt,
@@ -197,7 +197,7 @@ char *config_dump(const config_format_t *fmt, const void *default_options,
                   const void *options, int minimal,
                   int comment_defaults);
 int config_assign(const config_format_t *fmt, void *options,
-                  config_line_t *list,
+                  struct config_line_t *list,
                   unsigned flags, char **msg);
 config_var_t *config_find_option_mutable(config_format_t *fmt,
                                          const char *key);
@@ -219,4 +219,3 @@ void warn_deprecated_option(const char *what, const char *why);
 #define CFG_EQ_ROUTERSET(a,b,opt) routerset_equal((a)->opt, (b)->opt)
 
 #endif /* !defined(TOR_CONFPARSE_H) */
-
diff --git a/src/or/connection.c b/src/or/connection.c
index e3e9c313a..e42288579 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -104,6 +104,9 @@
 #include "or/routerparse.h"
 #include "lib/sandbox/sandbox.h"
 #include "lib/net/buffers_net.h"
+#include "lib/tls/tortls.h"
+#include "common/compat_libevent.h"
+#include "lib/compress/compress.h"
 
 #ifdef HAVE_PWD_H
 #include <pwd.h>
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index e8185a5fa..c3c934417 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -106,6 +106,7 @@
 #include "or/or_circuit_st.h"
 #include "or/origin_circuit_st.h"
 #include "or/socks_request_st.h"
+#include "common/compat_libevent.h"
 
 #ifdef HAVE_LINUX_TYPES_H
 #include <linux/types.h>
@@ -4221,4 +4222,3 @@ connection_edge_free_all(void)
   pending_entry_connections = NULL;
   mainloop_event_free(attach_pending_entry_connections_ev);
 }
-
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 9692e5d67..71b3c8a0b 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -69,6 +69,8 @@
 #include "or/routerinfo_st.h"
 #include "or/var_cell_st.h"
 
+#include "lib/tls/tortls.h"
+
 static int connection_tls_finish_handshake(or_connection_t *conn);
 static int connection_or_launch_v3_or_handshake(or_connection_t *conn);
 static int connection_or_process_cells_from_inbuf(or_connection_t *conn);
@@ -2990,4 +2992,3 @@ connection_or_send_authenticate_cell,(or_connection_t *conn, int authtype))
 
   return 0;
 }
-
diff --git a/src/or/conscache.c b/src/or/conscache.c
index bc3a09509..bc5928ff2 100644
--- a/src/or/conscache.c
+++ b/src/or/conscache.c
@@ -7,6 +7,7 @@
 #include "or/conscache.h"
 #include "lib/crypt_ops/crypto_util.h"
 #include "lib/fs/storagedir.h"
+#include "lib/encoding/confline.h"
 
 #define CCE_MAGIC 0x17162253
 
@@ -624,4 +625,3 @@ consensus_cache_entry_is_mapped(consensus_cache_entry_t *ent)
   }
 }
 #endif /* defined(TOR_UNIT_TESTS) */
-
diff --git a/src/or/conscache.h b/src/or/conscache.h
index 20af6402c..c46b82423 100644
--- a/src/or/conscache.h
+++ b/src/or/conscache.h
@@ -27,9 +27,9 @@ void consensus_cache_delete_pending(consensus_cache_t *cache,
                                     int force);
 int consensus_cache_get_n_filenames_available(consensus_cache_t *cache);
 consensus_cache_entry_t *consensus_cache_add(consensus_cache_t *cache,
-                                             const config_line_t *labels,
-                                             const uint8_t *data,
-                                             size_t datalen);
+                                           const struct config_line_t *labels,
+                                           const uint8_t *data,
+                                           size_t datalen);
 
 consensus_cache_entry_t *consensus_cache_find_first(
                                              consensus_cache_t *cache,
@@ -46,7 +46,7 @@ void consensus_cache_filter_list(smartlist_t *lst,
 
 const char *consensus_cache_entry_get_value(const consensus_cache_entry_t *ent,
                                             const char *key);
-const config_line_t *consensus_cache_entry_get_labels(
+const struct config_line_t *consensus_cache_entry_get_labels(
                                           const consensus_cache_entry_t *ent);
 
 void consensus_cache_entry_incref(consensus_cache_entry_t *ent);
@@ -64,4 +64,3 @@ int consensus_cache_entry_is_mapped(consensus_cache_entry_t *ent);
 #endif
 
 #endif /* !defined(TOR_CONSCACHE_H) */
-
diff --git a/src/or/consdiffmgr.c b/src/or/consdiffmgr.c
index 7732cd109..c75b59c1f 100644
--- a/src/or/consdiffmgr.c
+++ b/src/or/consdiffmgr.c
@@ -21,7 +21,10 @@
 #include "or/cpuworker.h"
 #include "or/networkstatus.h"
 #include "or/routerparse.h"
+#include "common/compat_libevent.h"
 #include "common/workqueue.h"
+#include "lib/compress/compress.h"
+#include "lib/encoding/confline.h"
 
 #include "or/networkstatus_st.h"
 #include "or/networkstatus_voter_info_st.h"
@@ -1940,4 +1943,3 @@ consensus_cache_entry_get_valid_after(const consensus_cache_entry_t *ent,
   else
     return 0;
 }
-
diff --git a/src/or/consdiffmgr.h b/src/or/consdiffmgr.h
index d793a7ef1..66c3d6500 100644
--- a/src/or/consdiffmgr.h
+++ b/src/or/consdiffmgr.h
@@ -4,6 +4,8 @@
 #ifndef TOR_CONSDIFFMGR_H
 #define TOR_CONSDIFFMGR_H
 
+enum compress_method_t;
+
 /**
  * Possible outcomes from trying to look up a given consensus diff.
  */
@@ -25,7 +27,7 @@ int consdiffmgr_add_consensus(const char *consensus,
 consdiff_status_t consdiffmgr_find_consensus(
                            struct consensus_cache_entry_t **entry_out,
                            consensus_flavor_t flavor,
-                           compress_method_t method);
+                           enum compress_method_t method);
 
 consdiff_status_t consdiffmgr_find_diff_from(
                            struct consensus_cache_entry_t **entry_out,
@@ -33,7 +35,7 @@ consdiff_status_t consdiffmgr_find_diff_from(
                            int digest_type,
                            const uint8_t *digest,
                            size_t digestlen,
-                           compress_method_t method);
+                           enum compress_method_t method);
 
 int consensus_cache_entry_get_voter_id_digests(
                                   const struct consensus_cache_entry_t *ent,
@@ -71,4 +73,3 @@ STATIC int uncompress_or_copy(char **out, size_t *outlen,
 #endif /* defined(CONSDIFFMGR_PRIVATE) */
 
 #endif /* !defined(TOR_CONSDIFFMGR_H) */
-
diff --git a/src/or/control.c b/src/or/control.c
index af052f756..35e8cacd8 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -80,6 +80,7 @@
 #include "or/routerlist.h"
 #include "or/routerparse.h"
 #include "or/shared_random_client.h"
+#include "lib/encoding/confline.h"
 
 #include "or/cached_dir_st.h"
 #include "or/control_connection_st.h"
@@ -106,6 +107,7 @@
 
 #include "lib/crypt_ops/crypto_s2k.h"
 #include "common/procmon.h"
+#include "common/compat_libevent.h"
 
 /** Yield true iff <b>s</b> is the state of a control_connection_t that has
  * finished authentication and is accepting commands. */
@@ -7791,4 +7793,3 @@ control_testing_set_global_event_mask(uint64_t mask)
   global_event_mask = mask;
 }
 #endif /* defined(TOR_UNIT_TESTS) */
-
diff --git a/src/or/control.h b/src/or/control.h
index 200a88bf6..5d00727c0 100644
--- a/src/or/control.h
+++ b/src/or/control.h
@@ -99,7 +99,7 @@ int control_event_signal(uintptr_t signal);
 
 int init_control_cookie_authentication(int enabled);
 char *get_controller_cookie_file_name(void);
-smartlist_t *decode_hashed_passwords(config_line_t *passwords);
+smartlist_t *decode_hashed_passwords(struct config_line_t *passwords);
 void disable_control_logging(void);
 void enable_control_logging(void);
 
@@ -325,4 +325,3 @@ STATIC int getinfo_helper_current_time(
 #endif /* defined(CONTROL_PRIVATE) */
 
 #endif /* !defined(TOR_CONTROL_H) */
-
diff --git a/src/or/crypt_path_st.h b/src/or/crypt_path_st.h
index 88b4085ac..7d38c7375 100644
--- a/src/or/crypt_path_st.h
+++ b/src/or/crypt_path_st.h
@@ -8,6 +8,7 @@
 #define CRYPT_PATH_ST_H
 
 #include "or/relay_crypto_st.h"
+struct crypto_dh_t;
 
 /** Holds accounting information for a single step in the layered encryption
  * performed by a circuit.  Used only at the client edge of a circuit. */
@@ -23,7 +24,7 @@ struct crypt_path_t {
   onion_handshake_state_t handshake_state;
   /** Diffie-hellman handshake state for performing an introduction
    * operations */
-  crypto_dh_t *rend_dh_handshake_state;
+  struct crypto_dh_t *rend_dh_handshake_state;
 
   /** Negotiated key material shared with the OR at this step. */
   char rend_circ_nonce[DIGEST_LEN];/* KH in tor-spec.txt */
@@ -53,4 +54,3 @@ struct crypt_path_t {
 };
 
 #endif
-
diff --git a/src/or/dir_connection_st.h b/src/or/dir_connection_st.h
index f68266ca2..1282f82d6 100644
--- a/src/or/dir_connection_st.h
+++ b/src/or/dir_connection_st.h
@@ -9,6 +9,8 @@
 
 #include "or/connection_st.h"
 
+struct tor_compress_state_t;
+
 /** Subtype of connection_t for an "directory connection" -- that is, an HTTP
  * connection to retrieve or serve directory material. */
 struct dir_connection_t {
@@ -31,7 +33,7 @@ struct dir_connection_t {
    * it from back to front. */
   smartlist_t *spool;
   /** The compression object doing on-the-fly compression for spooled data. */
-  tor_compress_state_t *compress_state;
+  struct tor_compress_state_t *compress_state;
 
   /** What rendezvous service are we querying for? */
   rend_data_t *rend_data;
@@ -63,4 +65,3 @@ struct dir_connection_t {
 };
 
 #endif
-
diff --git a/src/or/dirauth/dirvote.c b/src/or/dirauth/dirvote.c
index 85a0d3e70..66137d1a9 100644
--- a/src/or/dirauth/dirvote.c
+++ b/src/or/dirauth/dirvote.c
@@ -44,6 +44,7 @@
 #include "or/vote_timing_st.h"
 
 #include "lib/container/order.h"
+#include "lib/encoding/confline.h"
 
 /**
  * \file dirvote.c
diff --git a/src/or/dirauth/shared_random_state.c b/src/or/dirauth/shared_random_state.c
index c30a02442..85c02887d 100644
--- a/src/or/dirauth/shared_random_state.c
+++ b/src/or/dirauth/shared_random_state.c
@@ -21,6 +21,7 @@
 #include "or/shared_random_client.h"
 #include "or/dirauth/shared_random_state.h"
 #include "or/voting_schedule.h"
+#include "lib/encoding/confline.h"
 
 /* Default filename of the shared random state on disk. */
 static const char default_fname[] = "sr-state";
@@ -1321,4 +1322,3 @@ get_sr_state(void)
 }
 
 #endif /* defined(TOR_UNIT_TESTS) */
-
diff --git a/src/or/dirauth/shared_random_state.h b/src/or/dirauth/shared_random_state.h
index a8ac0134c..f99874872 100644
--- a/src/or/dirauth/shared_random_state.h
+++ b/src/or/dirauth/shared_random_state.h
@@ -85,11 +85,11 @@ typedef struct sr_disk_state_t {
   /* State valid until? */
   time_t ValidUntil;
   /* All commits seen that are valid. */
-  config_line_t *Commit;
+  struct config_line_t *Commit;
   /* Previous and current shared random value. */
-  config_line_t *SharedRandValues;
+  struct config_line_t *SharedRandValues;
   /* Extra Lines for configuration we might not know. */
-  config_line_t *ExtraLines;
+  struct config_line_t *ExtraLines;
 } sr_disk_state_t;
 
 /* API */
@@ -144,4 +144,3 @@ STATIC sr_state_t *get_sr_state(void);
 #endif /* defined(TOR_UNIT_TESTS) */
 
 #endif /* !defined(TOR_SHARED_RANDOM_STATE_H) */
-
diff --git a/src/or/directory.c b/src/or/directory.c
index 6b8885e12..60f2a3285 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -17,6 +17,7 @@
 #include "or/consdiff.h"
 #include "or/consdiffmgr.h"
 #include "or/control.h"
+#include "lib/compress/compress.h"
 #include "lib/crypt_ops/crypto_rand.h"
 #include "lib/crypt_ops/crypto_util.h"
 #include "or/directory.h"
@@ -42,6 +43,7 @@
 #include "or/routerlist.h"
 #include "or/routerparse.h"
 #include "or/routerset.h"
+#include "lib/encoding/confline.h"
 
 #if defined(EXPORTMALLINFO) && defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
 #if !defined(OpenBSD)
@@ -5952,4 +5954,3 @@ dir_split_resource_into_spoolable(const char *resource,
   smartlist_free(fingerprints);
   return r;
 }
-
diff --git a/src/or/directory.h b/src/or/directory.h
index 5cf8892ac..6ed9e9b17 100644
--- a/src/or/directory.h
+++ b/src/or/directory.h
@@ -13,6 +13,7 @@
 #define TOR_DIRECTORY_H
 
 #include "or/hs_ident.h"
+enum compress_method_t;
 
 dir_connection_t *TO_DIR_CONN(connection_t *c);
 int directories_have_accepted_server_descriptor(void);
@@ -90,7 +91,7 @@ void directory_request_add_header(directory_request_t *req,
 MOCK_DECL(void, directory_initiate_request, (directory_request_t *request));
 
 int parse_http_response(const char *headers, int *code, time_t *date,
-                        compress_method_t *compression, char **response);
+                        enum compress_method_t *compression, char **response);
 int parse_http_command(const char *headers,
                        char **command_out, char **url_out);
 char *http_get_header(const char *headers, const char *which);
@@ -189,7 +190,7 @@ struct directory_request_t {
   /** Hidden-service-specific information v2. */
   const rend_data_t *rend_query;
   /** Extra headers to append to the request */
-  config_line_t *additional_headers;
+  struct config_line_t *additional_headers;
   /** Hidden-service-specific information for v3+. */
   const hs_ident_dir_conn_t *hs_ident;
   /** Used internally to directory.c: gets informed when the attempt to
@@ -203,8 +204,10 @@ STATIC int handle_get_hs_descriptor_v3(dir_connection_t *conn,
                                        const struct get_handler_args_t *args);
 STATIC int directory_handle_command(dir_connection_t *conn);
 STATIC char *accept_encoding_header(void);
-STATIC int allowed_anonymous_connection_compression_method(compress_method_t);
-STATIC void warn_disallowed_anonymous_compression_method(compress_method_t);
+STATIC int allowed_anonymous_connection_compression_method(
+                                               enum compress_method_t);
+STATIC void warn_disallowed_anonymous_compression_method(
+                                               enum compress_method_t);
 
 STATIC int handle_response_fetch_hsdesc_v3(dir_connection_t *conn,
                                           const response_handler_args_t *args);
@@ -239,7 +242,8 @@ STATIC int handle_post_hs_descriptor(const char *url, const char *body);
 STATIC char* authdir_type_to_string(dirinfo_type_t auth);
 STATIC const char * dir_conn_purpose_to_string(int purpose);
 STATIC int should_use_directory_guards(const or_options_t *options);
-STATIC compression_level_t choose_compression_level(ssize_t n_bytes);
+enum compression_level_t;
+STATIC enum compression_level_t choose_compression_level(ssize_t n_bytes);
 STATIC int find_dl_min_delay(const download_status_t *dls,
                              const or_options_t *options);
 
@@ -268,4 +272,3 @@ STATIC unsigned parse_accept_encoding_header(const char *h);
 #endif /* defined(TOR_UNIT_TESTS) || defined(DIRECTORY_PRIVATE) */
 
 #endif /* !defined(TOR_DIRECTORY_H) */
-
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 62d4e7322..9ad453356 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -46,7 +46,9 @@
 #include "or/tor_version_st.h"
 #include "or/vote_routerstatus_st.h"
 
+#include "lib/compress/compress.h"
 #include "lib/container/order.h"
+#include "lib/encoding/confline.h"
 
 /**
  * \file dirserv.c
diff --git a/src/or/dns.c b/src/or/dns.c
index ddb50d196..08a55170e 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -64,6 +64,7 @@
 #include "or/router.h"
 #include "ht.h"
 #include "lib/sandbox/sandbox.h"
+#include "common/compat_libevent.h"
 
 #include "or/edge_connection_st.h"
 #include "or/or_circuit_st.h"
@@ -2136,4 +2137,3 @@ dns_insert_cache_entry(cached_resolve_t *new_entry)
 {
   HT_INSERT(cache_map, &cache_root, new_entry);
 }
-
diff --git a/src/or/dnsserv.c b/src/or/dnsserv.c
index ce1746fe2..d2ef4a496 100644
--- a/src/or/dnsserv.c
+++ b/src/or/dnsserv.c
@@ -34,6 +34,7 @@
 #include "or/entry_connection_st.h"
 #include "or/listener_connection_st.h"
 #include "or/socks_request_st.h"
+#include "common/compat_libevent.h"
 
 #include <event2/dns.h>
 #include <event2/dns_compat.h>
@@ -412,4 +413,3 @@ dnsserv_close_listener(connection_t *conn)
     listener_conn->dns_server_port = NULL;
   }
 }
-
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index 191933622..2ed2bc904 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -139,6 +139,7 @@
 #include "or/transports.h"
 #include "or/statefile.h"
 #include "lib/math/fp.h"
+#include "lib/encoding/confline.h"
 
 #include "or/node_st.h"
 #include "or/origin_circuit_st.h"
diff --git a/src/or/hibernate.c b/src/or/hibernate.c
index 12264f758..2c43e0f99 100644
--- a/src/or/hibernate.c
+++ b/src/or/hibernate.c
@@ -41,6 +41,7 @@ hibernating, phase 2:
 #include "or/main.h"
 #include "or/router.h"
 #include "or/statefile.h"
+#include "common/compat_libevent.h"
 
 #include "or/or_connection_st.h"
 
@@ -1227,4 +1228,3 @@ hibernate_set_state_for_testing_(hibernate_state_t newstate)
   hibernate_state = newstate;
 }
 #endif /* defined(TOR_UNIT_TESTS) */
-
diff --git a/src/or/hs_circuit.c b/src/or/hs_circuit.c
index 853669846..044ff2bbc 100644
--- a/src/or/hs_circuit.c
+++ b/src/or/hs_circuit.c
@@ -23,6 +23,7 @@
 #include "or/router.h"
 
 #include "or/hs_cell.h"
+#include "or/hs_circuitmap.h"
 #include "or/hs_ident.h"
 #include "or/hs_ntor.h"
 #include "or/hs_service.h"
diff --git a/src/or/hs_circuitmap.c b/src/or/hs_circuitmap.c
index 21db65249..c4bf9fab4 100644
--- a/src/or/hs_circuitmap.c
+++ b/src/or/hs_circuitmap.c
@@ -583,4 +583,3 @@ hs_circuitmap_free_all(void)
     tor_free(the_hs_circuitmap);
   }
 }
-
diff --git a/src/or/hs_circuitmap.h b/src/or/hs_circuitmap.h
index 2118a6414..c39a37c05 100644
--- a/src/or/hs_circuitmap.h
+++ b/src/or/hs_circuitmap.h
@@ -11,7 +11,7 @@
 
 typedef HT_HEAD(hs_circuitmap_ht, circuit_t) hs_circuitmap_ht;
 
-typedef struct hs_token_s hs_token_t;
+typedef struct hs_token_t hs_token_t;
 struct or_circuit_t;
 struct origin_circuit_t;
 
@@ -90,7 +90,7 @@ typedef enum {
 
 /** Represents a token used in the HS protocol. Each such token maps to a
  *  specific introduction or rendezvous circuit. */
-struct hs_token_s {
+struct hs_token_t {
   /* Type of HS token. */
   hs_token_type_t type;
 
@@ -110,4 +110,3 @@ hs_circuitmap_ht *get_hs_circuitmap(void);
 #endif /* TOR_UNIT_TESTS */
 
 #endif /* !defined(TOR_HS_CIRCUITMAP_H) */
-
diff --git a/src/or/hs_client.c b/src/or/hs_client.c
index 8fddd51a4..0b60c8dcf 100644
--- a/src/or/hs_client.c
+++ b/src/or/hs_client.c
@@ -22,6 +22,7 @@
 #include "or/hs_cache.h"
 #include "or/hs_cell.h"
 #include "or/hs_circuit.h"
+#include "or/hs_circuitmap.h"
 #include "or/hs_client.h"
 #include "or/hs_control.h"
 #include "or/hs_descriptor.h"
@@ -1619,4 +1620,3 @@ hs_client_dir_info_changed(void)
    * AP_CONN_STATE_RENDDESC_WAIT state in order to fetch the descriptor. */
   retry_all_socks_conn_waiting_for_desc();
 }
-
diff --git a/src/or/hs_config.c b/src/or/hs_config.c
index c8ce5b43f..603cd6e74 100644
--- a/src/or/hs_config.c
+++ b/src/or/hs_config.c
@@ -29,6 +29,7 @@
 #include "or/hs_config.h"
 #include "or/hs_service.h"
 #include "or/rendservice.h"
+#include "lib/encoding/confline.h"
 
 /* Using the given list of services, stage them into our global state. Every
  * service version are handled. This function can remove entries in the given
@@ -587,4 +588,3 @@ hs_config_service_all(const or_options_t *options, int validate_only)
   /* Tor main should call the free all function on error. */
   return ret;
 }
-
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index b5649e263..994a5687b 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -47,6 +47,8 @@
 #include "or/origin_circuit_st.h"
 #include "or/routerstatus_st.h"
 
+#include "lib/encoding/confline.h"
+
 /* Trunnel */
 #include "trunnel/ed25519_cert.h"
 #include "trunnel/hs/cell_common.h"
@@ -3631,4 +3633,3 @@ get_first_service(void)
 }
 
 #endif /* defined(TOR_UNIT_TESTS) */
-
diff --git a/src/or/main.c b/src/or/main.c
index 81a8cfbee..6a5bf9ae0 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -116,6 +116,9 @@
 #include "lib/sandbox/sandbox.h"
 #include "lib/fs/lockfile.h"
 #include "lib/net/buffers_net.h"
+#include "lib/tls/tortls.h"
+#include "common/compat_libevent.h"
+#include "lib/encoding/confline.h"
 
 #include <event2/event.h>
 
diff --git a/src/or/main.h b/src/or/main.h
index 214a9b3b0..90146f4bd 100644
--- a/src/or/main.h
+++ b/src/or/main.h
@@ -96,10 +96,12 @@ uint64_t get_main_loop_idle_count(void);
 void periodic_events_on_new_options(const or_options_t *options);
 void reschedule_per_second_timer(void);
 
+struct token_bucket_rw_t;
+
 extern time_t time_of_process_start;
 extern int quiet_level;
-extern token_bucket_rw_t global_bucket;
-extern token_bucket_rw_t global_relayed_bucket;
+extern struct token_bucket_rw_t global_bucket;
+extern struct token_bucket_rw_t global_relayed_bucket;
 
 #ifdef MAIN_PRIVATE
 STATIC void init_connection_lists(void);
@@ -118,4 +120,3 @@ extern periodic_event_item_t periodic_events[];
 #endif /* defined(MAIN_PRIVATE) */
 
 #endif /* !defined(TOR_MAIN_H) */
-
diff --git a/src/or/ntmain.c b/src/or/ntmain.c
index e23a41fb8..99e77a285 100644
--- a/src/or/ntmain.c
+++ b/src/or/ntmain.c
@@ -25,6 +25,7 @@
 #include "or/ntmain.h"
 #include "lib/log/win32err.h"
 #include "lib/fs/winlib.h"
+#include "common/compat_libevent.h"
 
 #include <windows.h>
 #define GENSRV_SERVICENAME  "tor"
diff --git a/src/or/onion.c b/src/or/onion.c
index 2b30870e5..80d8e1a8b 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -68,6 +68,7 @@
 #include "or/config.h"
 #include "or/cpuworker.h"
 #include "lib/crypt_ops/crypto_util.h"
+#include "lib/crypt_ops/crypto_dh.h"
 #include "or/networkstatus.h"
 #include "or/onion.h"
 #include "or/onion_fast.h"
@@ -1343,4 +1344,3 @@ extended_cell_format(uint8_t *command_out, uint16_t *len_out,
 
   return 0;
 }
-
diff --git a/src/or/onion_fast.c b/src/or/onion_fast.c
index 7d555c26e..6e834ccf9 100644
--- a/src/or/onion_fast.c
+++ b/src/or/onion_fast.c
@@ -29,6 +29,7 @@
 
 #include "or/or.h"
 #include "or/onion_fast.h"
+#include "lib/crypt_ops/crypto_hkdf.h"
 #include "lib/crypt_ops/crypto_rand.h"
 #include "lib/crypt_ops/crypto_util.h"
 
@@ -141,4 +142,3 @@ fast_client_handshake(const fast_handshake_state_t *handshake_state,
   tor_free(out);
   return r;
 }
-
diff --git a/src/or/onion_tap.c b/src/or/onion_tap.c
index 0f9f638fa..05bcce2e8 100644
--- a/src/or/onion_tap.c
+++ b/src/or/onion_tap.c
@@ -29,6 +29,7 @@
 
 #include "or/or.h"
 #include "or/config.h"
+#include "lib/crypt_ops/crypto_dh.h"
 #include "lib/crypt_ops/crypto_rand.h"
 #include "lib/crypt_ops/crypto_util.h"
 #include "or/onion_tap.h"
@@ -243,4 +244,3 @@ onion_skin_TAP_client_handshake(crypto_dh_t *handshake_state,
   tor_free(key_material);
   return -1;
 }
-
diff --git a/src/or/onion_tap.h b/src/or/onion_tap.h
index 5b1eacce7..9a3df684d 100644
--- a/src/or/onion_tap.h
+++ b/src/or/onion_tap.h
@@ -17,22 +17,24 @@
                                  DH1024_KEY_LEN)
 #define TAP_ONIONSKIN_REPLY_LEN (DH1024_KEY_LEN+DIGEST_LEN)
 
-int onion_skin_TAP_create(crypto_pk_t *router_key,
-                      crypto_dh_t **handshake_state_out,
+struct crypto_dh_t;
+struct crypto_pk_t;
+
+int onion_skin_TAP_create(struct crypto_pk_t *router_key,
+                      struct crypto_dh_t **handshake_state_out,
                       char *onion_skin_out);
 
 int onion_skin_TAP_server_handshake(const char *onion_skin,
-                                crypto_pk_t *private_key,
-                                crypto_pk_t *prev_private_key,
+                                struct crypto_pk_t *private_key,
+                                struct crypto_pk_t *prev_private_key,
                                 char *handshake_reply_out,
                                 char *key_out,
                                 size_t key_out_len);
 
-int onion_skin_TAP_client_handshake(crypto_dh_t *handshake_state,
+int onion_skin_TAP_client_handshake(struct crypto_dh_t *handshake_state,
                                 const char *handshake_reply,
                                 char *key_out,
                                 size_t key_out_len,
                                 const char **msg_out);
 
 #endif /* !defined(TOR_ONION_TAP_H) */
-
diff --git a/src/or/or.h b/src/or/or.h
index 3d3972fb8..2f3dba2b0 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -63,27 +63,17 @@
 #include <windows.h>
 #endif /* defined(_WIN32) */
 
+#include "common/util.h"
+
+#include "lib/container/map.h"
+#include "lib/container/smartlist.h"
 #include "lib/crypt_ops/crypto.h"
 #include "lib/crypt_ops/crypto_format.h"
-#include "lib/crypt_ops/crypto_dh.h"
-#include "lib/crypt_ops/crypto_hkdf.h"
-#include "lib/tls/tortls.h"
-#include "lib/log/torlog.h"
-#include "lib/container/smartlist.h"
-#include "lib/container/map.h"
-#include "lib/compress/compress.h"
+#include "lib/defs/dh_sizes.h"
+#include "lib/encoding/binascii.h"
 #include "lib/net/address.h"
-#include "common/compat_libevent.h"
+
 #include "ht.h"
-#include "lib/encoding/confline.h"
-#include "or/replaycache.h"
-#include "lib/crypt_ops/crypto_curve25519.h"
-#include "lib/crypt_ops/crypto_ed25519.h"
-#include "tor_queue.h"
-#include "common/token_bucket.h"
-#include "lib/encoding/binascii.h"
-#include "or/hs_circuitmap.h"
-#include "common/util.h"
 
 // These, more than other includes, are for keeping the other struct
 // definitions working. We should remove them when we minimize our includes.
@@ -1523,6 +1513,7 @@ typedef enum {
 
 struct fast_handshake_state_t;
 struct ntor_handshake_state_t;
+struct crypto_dh_t;
 #define ONION_HANDSHAKE_TYPE_TAP  0x0000
 #define ONION_HANDSHAKE_TYPE_FAST 0x0001
 #define ONION_HANDSHAKE_TYPE_NTOR 0x0002
@@ -1531,7 +1522,7 @@ typedef struct {
   uint16_t tag;
   union {
     struct fast_handshake_state_t *fast;
-    crypto_dh_t *tap;
+    struct crypto_dh_t *tap;
     struct ntor_handshake_state_t *ntor;
   } u;
 } onion_handshake_state_t;
@@ -1694,6 +1685,8 @@ typedef enum {OUTBOUND_ADDR_EXIT, OUTBOUND_ADDR_OR,
               OUTBOUND_ADDR_EXIT_AND_OR,
               OUTBOUND_ADDR_MAX} outbound_addr_t;
 
+struct config_line_t;
+
 /** Configuration options for a Tor process. */
 typedef struct {
   uint32_t magic_;
@@ -1707,7 +1700,7 @@ typedef struct {
   } command;
   char *command_arg; /**< Argument for command-line option. */
 
-  config_line_t *Logs; /**< New-style list of configuration lines
+  struct config_line_t *Logs; /**< New-style list of configuration lines
                         * for logs */
   int LogTimeGranularity; /**< Log resolution in milliseconds. */
 
@@ -1761,7 +1754,7 @@ typedef struct {
   int DisableAllSwap; /**< Boolean: Attempt to call mlockall() on our
                        * process for all current and future memory. */
 
-  config_line_t *ExitPolicy; /**< Lists of exit policy components. */
+  struct config_line_t *ExitPolicy; /**< Lists of exit policy components. */
   int ExitPolicyRejectPrivate; /**< Should we not exit to reserved private
                                 * addresses, and our own published addresses?
                                 */
@@ -1770,36 +1763,37 @@ typedef struct {
                                         * Includes OutboundBindAddresses and
                                         * configured ports. */
   int ReducedExitPolicy; /**<Should we use the Reduced Exit Policy? */
-  config_line_t *SocksPolicy; /**< Lists of socks policy components */
-  config_line_t *DirPolicy; /**< Lists of dir policy components */
+  struct config_line_t *SocksPolicy; /**< Lists of socks policy components */
+  struct config_line_t *DirPolicy; /**< Lists of dir policy components */
   /** Local address to bind outbound sockets */
-  config_line_t *OutboundBindAddress;
+  struct config_line_t *OutboundBindAddress;
   /** Local address to bind outbound relay sockets */
-  config_line_t *OutboundBindAddressOR;
+  struct config_line_t *OutboundBindAddressOR;
   /** Local address to bind outbound exit sockets */
-  config_line_t *OutboundBindAddressExit;
+  struct config_line_t *OutboundBindAddressExit;
   /** Addresses derived from the various OutboundBindAddress lines.
    * [][0] is IPv4, [][1] is IPv6
    */
   tor_addr_t OutboundBindAddresses[OUTBOUND_ADDR_MAX][2];
   /** Directory server only: which versions of
    * Tor should we tell users to run? */
-  config_line_t *RecommendedVersions;
-  config_line_t *RecommendedClientVersions;
-  config_line_t *RecommendedServerVersions;
-  config_line_t *RecommendedPackages;
+  struct config_line_t *RecommendedVersions;
+  struct config_line_t *RecommendedClientVersions;
+  struct config_line_t *RecommendedServerVersions;
+  struct config_line_t *RecommendedPackages;
   /** Whether dirservers allow router descriptors with private IPs. */
   int DirAllowPrivateAddresses;
   /** Whether routers accept EXTEND cells to routers with private IPs. */
   int ExtendAllowPrivateAddresses;
   char *User; /**< Name of user to run Tor as. */
-  config_line_t *ORPort_lines; /**< Ports to listen on for OR connections. */
+   /** Ports to listen on for OR connections. */
+  struct config_line_t *ORPort_lines;
   /** Ports to listen on for extended OR connections. */
-  config_line_t *ExtORPort_lines;
+  struct config_line_t *ExtORPort_lines;
   /** Ports to listen on for SOCKS connections. */
-  config_line_t *SocksPort_lines;
+  struct config_line_t *SocksPort_lines;
   /** Ports to listen on for transparent pf/netfilter connections. */
-  config_line_t *TransPort_lines;
+  struct config_line_t *TransPort_lines;
   char *TransProxyType; /**< What kind of transparent proxy
                          * implementation are we using? */
   /** Parsed value of TransProxyType. */
@@ -1809,20 +1803,21 @@ typedef struct {
     TPT_IPFW,
     TPT_TPROXY,
   } TransProxyType_parsed;
-  config_line_t *NATDPort_lines; /**< Ports to listen on for transparent natd
-                            * connections. */
+  /** Ports to listen on for transparent natd connections. */
+  struct config_line_t *NATDPort_lines;
   /** Ports to listen on for HTTP Tunnel connections. */
-  config_line_t *HTTPTunnelPort_lines;
-  config_line_t *ControlPort_lines; /**< Ports to listen on for control
+  struct config_line_t *HTTPTunnelPort_lines;
+  struct config_line_t *ControlPort_lines; /**< Ports to listen on for control
                                * connections. */
-  config_line_t *ControlSocket; /**< List of Unix Domain Sockets to listen on
-                                 * for control connections. */
+  /** List of Unix Domain Sockets to listen on for control connections. */
+  struct config_line_t *ControlSocket;
 
   int ControlSocketsGroupWritable; /**< Boolean: Are control sockets g+rw? */
   int UnixSocksGroupWritable; /**< Boolean: Are SOCKS Unix sockets g+rw? */
   /** Ports to listen on for directory connections. */
-  config_line_t *DirPort_lines;
-  config_line_t *DNSPort_lines; /**< Ports to listen on for DNS requests. */
+  struct config_line_t *DirPort_lines;
+  /** Ports to listen on for DNS requests. */
+  struct config_line_t *DNSPort_lines;
 
   /* MaxMemInQueues value as input by the user. We clean this up to be
    * MaxMemInQueues. */
@@ -1878,19 +1873,19 @@ typedef struct {
   char *BridgePassword_AuthDigest_;
 
   int UseBridges; /**< Boolean: should we start all circuits with a bridge? */
-  config_line_t *Bridges; /**< List of bootstrap bridge addresses. */
+  struct config_line_t *Bridges; /**< List of bootstrap bridge addresses. */
 
-  config_line_t *ClientTransportPlugin; /**< List of client
+  struct config_line_t *ClientTransportPlugin; /**< List of client
                                            transport plugins. */
 
-  config_line_t *ServerTransportPlugin; /**< List of client
+  struct config_line_t *ServerTransportPlugin; /**< List of client
                                            transport plugins. */
 
   /** List of TCP/IP addresses that transports should listen at. */
-  config_line_t *ServerTransportListenAddr;
+  struct config_line_t *ServerTransportListenAddr;
 
   /** List of options that must be passed to pluggable transports. */
-  config_line_t *ServerTransportOptions;
+  struct config_line_t *ServerTransportOptions;
 
   int BridgeRelay; /**< Boolean: are we acting as a bridge relay? We make
                     * this explicit so we can change how we behave in the
@@ -1975,9 +1970,10 @@ typedef struct {
   int FascistFirewall; /**< Whether to prefer ORs reachable on open ports. */
   smartlist_t *FirewallPorts; /**< Which ports our firewall allows
                                * (strings). */
-  config_line_t *ReachableAddresses; /**< IP:ports our firewall allows. */
-  config_line_t *ReachableORAddresses; /**< IP:ports for OR conns. */
-  config_line_t *ReachableDirAddresses; /**< IP:ports for Dir conns. */
+   /** IP:ports our firewall allows. */
+  struct config_line_t *ReachableAddresses;
+  struct config_line_t *ReachableORAddresses; /**< IP:ports for OR conns. */
+  struct config_line_t *ReachableDirAddresses; /**< IP:ports for Dir conns. */
 
   int ConstrainedSockets; /**< Shrink xmit and recv socket buffers. */
   uint64_t ConstrainedSockSize; /**< Size of constrained buffers. */
@@ -2004,7 +2000,7 @@ typedef struct {
   smartlist_t *TrackHostExits;
   int TrackHostExitsExpire; /**< Number of seconds until we expire an
                              * addressmap */
-  config_line_t *AddressMap; /**< List of address map directives. */
+  struct config_line_t *AddressMap; /**< List of address map directives. */
   int AutomapHostsOnResolve; /**< If true, when we get a resolve request for a
                               * hostname ending with one of the suffixes in
                               * <b>AutomapHostsSuffixes</b>, map it to a
@@ -2049,10 +2045,11 @@ typedef struct {
   uint64_t PerConnBWRate; /**< Long-term bw on a single TLS conn, if set. */
   uint64_t PerConnBWBurst; /**< Allowed burst on a single TLS conn, if set. */
   int NumCPUs; /**< How many CPUs should we try to use? */
-  config_line_t *RendConfigLines; /**< List of configuration lines
+  struct config_line_t *RendConfigLines; /**< List of configuration lines
                                           * for rendezvous services. */
-  config_line_t *HidServAuth; /**< List of configuration lines for client-side
-                               * authorizations for hidden services */
+  struct config_line_t *HidServAuth; /**< List of configuration lines for
+                               * client-side authorizations for hidden
+                               * services */
   char *ContactInfo; /**< Contact info to be published in the directory. */
 
   int HeartbeatPeriod; /**< Log heartbeat messages after this many seconds
@@ -2083,10 +2080,10 @@ typedef struct {
   /** List of configuration lines for replacement directory authorities.
    * If you just want to replace one class of authority at a time,
    * use the "Alternate*Authority" options below instead. */
-  config_line_t *DirAuthorities;
+  struct config_line_t *DirAuthorities;
 
   /** List of fallback directory servers */
-  config_line_t *FallbackDir;
+  struct config_line_t *FallbackDir;
   /** Whether to use the default hard-coded FallbackDirs */
   int UseDefaultFallbackDirs;
 
@@ -2096,21 +2093,22 @@ typedef struct {
 
   /** If set, use these main (currently v3) directory authorities and
    * not the default ones. */
-  config_line_t *AlternateDirAuthority;
+  struct config_line_t *AlternateDirAuthority;
 
   /** If set, use these bridge authorities and not the default one. */
-  config_line_t *AlternateBridgeAuthority;
+  struct config_line_t *AlternateBridgeAuthority;
 
-  config_line_t *MyFamily_lines; /**< Declared family for this OR. */
-  config_line_t *MyFamily; /**< Declared family for this OR, normalized */
-  config_line_t *NodeFamilies; /**< List of config lines for
+  struct config_line_t *MyFamily_lines; /**< Declared family for this OR. */
+  struct config_line_t *MyFamily; /**< Declared family for this OR,
+                                     normalized */
+  struct config_line_t *NodeFamilies; /**< List of config lines for
                                 * node families */
   smartlist_t *NodeFamilySets; /**< List of parsed NodeFamilies values. */
-  config_line_t *AuthDirBadExit; /**< Address policy for descriptors to
+  struct config_line_t *AuthDirBadExit; /**< Address policy for descriptors to
                                   * mark as bad exits. */
-  config_line_t *AuthDirReject; /**< Address policy for descriptors to
+  struct config_line_t *AuthDirReject; /**< Address policy for descriptors to
                                  * reject. */
-  config_line_t *AuthDirInvalid; /**< Address policy for descriptors to
+  struct config_line_t *AuthDirInvalid; /**< Address policy for descriptors to
                                   * never mark as valid. */
   /** @name AuthDir...CC
    *
@@ -2153,9 +2151,9 @@ typedef struct {
   enum { ACCT_MAX, ACCT_SUM, ACCT_IN, ACCT_OUT } AccountingRule;
 
   /** Base64-encoded hash of accepted passwords for the control system. */
-  config_line_t *HashedControlPassword;
+  struct config_line_t *HashedControlPassword;
   /** As HashedControlPassword, but not saved. */
-  config_line_t *HashedControlSessionPassword;
+  struct config_line_t *HashedControlSessionPassword;
 
   int CookieAuthentication; /**< Boolean: do we enable cookie-based auth for
                              * the control system? */
@@ -2767,15 +2765,15 @@ typedef struct {
   uint64_t AccountingExpectedUsage;
 
   /** A list of Entry Guard-related configuration lines. (pre-prop271) */
-  config_line_t *EntryGuards;
+  struct config_line_t *EntryGuards;
 
   /** A list of guard-related configuration lines. (post-prop271) */
-  config_line_t *Guard;
+  struct config_line_t *Guard;
 
-  config_line_t *TransportProxies;
+  struct config_line_t *TransportProxies;
 
   /** Cached revision counters for active hidden services on this host */
-  config_line_t *HidServRevCounter;
+  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
@@ -2803,7 +2801,7 @@ typedef struct {
   smartlist_t *BWHistoryDirWriteMaxima;
 
   /** Build time histogram */
-  config_line_t * BuildtimeHistogram;
+  struct config_line_t * BuildtimeHistogram;
   int TotalBuildTimes;
   int CircuitBuildAbandonedCount;
 
@@ -2812,7 +2810,7 @@ typedef struct {
 
   /** Holds any unrecognized values we found in the state file, in the order
    * in which we found them. */
-  config_line_t *ExtraLines;
+  struct config_line_t *ExtraLines;
 
   /** When did we last rotate our onion key?  "0" for 'no idea'. */
   time_t LastRotatedOnionKey;
diff --git a/src/or/or_connection_st.h b/src/or/or_connection_st.h
index eba2721c3..dbfe7528b 100644
--- a/src/or/or_connection_st.h
+++ b/src/or/or_connection_st.h
@@ -8,6 +8,9 @@
 #define OR_CONNECTION_ST_H
 
 #include "or/connection_st.h"
+#include "common/token_bucket.h"
+
+struct tor_tls_t;
 
 /** Subtype of connection_t for an "OR connection" -- that is, one that speaks
  * cells over TLS. */
@@ -33,7 +36,7 @@ struct or_connection_t {
 
   char *nickname; /**< Nickname of OR on other side (if any). */
 
-  tor_tls_t *tls; /**< TLS connection state. */
+  struct tor_tls_t *tls; /**< TLS connection state. */
   int tls_error; /**< Last tor_tls error code. */
   /** When we last used this conn for any client traffic. If not
    * recent, we can rate limit it further. */
@@ -87,4 +90,3 @@ struct or_connection_t {
 };
 
 #endif
-
diff --git a/src/or/or_handshake_certs_st.h b/src/or/or_handshake_certs_st.h
index f05dd9261..38e798b5e 100644
--- a/src/or/or_handshake_certs_st.h
+++ b/src/or/or_handshake_certs_st.h
@@ -7,6 +7,8 @@
 #ifndef OR_HANDSHAKE_CERTS_ST
 #define OR_HANDSHAKE_CERTS_ST
 
+struct tor_x509_cert_t;
+
 /** Structure to hold all the certificates we've received on an OR connection
  */
 struct or_handshake_certs_t {
@@ -14,13 +16,13 @@ struct or_handshake_certs_t {
   int started_here;
   /** The cert for the 'auth' RSA key that's supposed to sign the AUTHENTICATE
    * cell. Signed with the RSA identity key. */
-  tor_x509_cert_t *auth_cert;
+  struct tor_x509_cert_t *auth_cert;
   /** The cert for the 'link' RSA key that was used to negotiate the TLS
    *  connection.  Signed with the RSA identity key. */
-  tor_x509_cert_t *link_cert;
+  struct tor_x509_cert_t *link_cert;
   /** A self-signed identity certificate: the RSA identity key signed
    * with itself.  */
-  tor_x509_cert_t *id_cert;
+  struct tor_x509_cert_t *id_cert;
   /** The Ed25519 signing key, signed with the Ed25519 identity key. */
   struct tor_cert_st *ed_id_sign;
   /** A digest of the X509 link certificate for the TLS connection, signed
@@ -36,4 +38,3 @@ struct or_handshake_certs_t {
 };
 
 #endif
-
diff --git a/src/or/periodic.c b/src/or/periodic.c
index d379325f5..0cbf359b2 100644
--- a/src/or/periodic.c
+++ b/src/or/periodic.c
@@ -16,6 +16,7 @@
 #include "or/config.h"
 #include "or/main.h"
 #include "or/periodic.h"
+#include "common/compat_libevent.h"
 
 /** We disable any interval greater than this number of seconds, on the
  * grounds that it is probably an absolute time mistakenly passed in as a
@@ -169,4 +170,3 @@ periodic_event_disable(periodic_event_item_t *event)
   mainloop_event_cancel(event->ev);
   event->enabled = 0;
 }
-
diff --git a/src/or/policies.c b/src/or/policies.c
index 0f52d6bf1..78bf369cb 100644
--- a/src/or/policies.c
+++ b/src/or/policies.c
@@ -29,6 +29,7 @@
 #include "or/routerparse.h"
 #include "or/geoip.h"
 #include "ht.h"
+#include "lib/encoding/confline.h"
 
 #include "or/dir_server_st.h"
 #include "or/microdesc_st.h"
@@ -3143,4 +3144,3 @@ policies_free_all(void)
   }
   HT_CLEAR(policy_map, &policy_root);
 }
-
diff --git a/src/or/policies.h b/src/or/policies.h
index d4379c0e7..fa55f1cb1 100644
--- a/src/or/policies.h
+++ b/src/or/policies.h
@@ -88,7 +88,7 @@ int policies_parse_exit_policy_from_options(
                                           uint32_t local_address,
                                           const tor_addr_t *ipv6_local_address,
                                           smartlist_t **result);
-int policies_parse_exit_policy(config_line_t *cfg, smartlist_t **dest,
+int policies_parse_exit_policy(struct config_line_t *cfg, smartlist_t **dest,
                                exit_policy_parser_cfg_t options,
                                const smartlist_t *configured_addresses);
 void policies_parse_exit_policy_reject_private(
@@ -151,4 +151,3 @@ STATIC const tor_addr_port_t * fascist_firewall_choose_address(
 #endif /* defined(POLICIES_PRIVATE) */
 
 #endif /* !defined(TOR_POLICIES_H) */
-
diff --git a/src/or/reasons.c b/src/or/reasons.c
index b9b7a7db8..13523476c 100644
--- a/src/or/reasons.c
+++ b/src/or/reasons.c
@@ -17,6 +17,7 @@
 #include "or/or.h"
 #include "or/config.h"
 #include "or/reasons.h"
+#include "lib/tls/tortls.h"
 
 /***************************** Edge (stream) reasons **********************/
 
@@ -493,4 +494,3 @@ end_reason_to_http_connect_response_line(int endreason)
       return "HTTP/1.0 500 Internal Server Error (weird end reason)\r\n\r\n";
   }
 }
-
diff --git a/src/or/relay_crypto.c b/src/or/relay_crypto.c
index 6682cd86f..1fcfae0b3 100644
--- a/src/or/relay_crypto.c
+++ b/src/or/relay_crypto.c
@@ -7,6 +7,7 @@
 #include "or/or.h"
 #include "or/circuitlist.h"
 #include "or/config.h"
+#include "lib/crypt_ops/crypto.h"
 #include "lib/crypt_ops/crypto_util.h"
 #include "or/hs_ntor.h" // for HS_NTOR_KEY_EXPANSION_KDF_OUT_LEN
 #include "or/relay.h"
@@ -329,4 +330,3 @@ relay_crypto_assert_ok(const relay_crypto_t *crypto)
   tor_assert(crypto->f_digest);
   tor_assert(crypto->b_digest);
 }
-
diff --git a/src/or/relay_crypto_st.h b/src/or/relay_crypto_st.h
index 4e23f4e40..f186e182f 100644
--- a/src/or/relay_crypto_st.h
+++ b/src/or/relay_crypto_st.h
@@ -7,21 +7,25 @@
 #ifndef RELAY_CRYPTO_ST_H
 #define RELAY_CRYPTO_ST_H
 
+#define crypto_cipher_t aes_cnt_cipher
+struct crypto_cipher_t;
+struct crypto_digest_t;
+
 struct relay_crypto_t {
   /* crypto environments */
   /** Encryption key and counter for cells heading towards the OR at this
    * step. */
-  crypto_cipher_t *f_crypto;
+  struct crypto_cipher_t *f_crypto;
   /** Encryption key and counter for cells heading back from the OR at this
    * step. */
-  crypto_cipher_t *b_crypto;
+  struct crypto_cipher_t *b_crypto;
 
   /** Digest state for cells heading towards the OR at this step. */
-  crypto_digest_t *f_digest; /* for integrity checking */
+  struct crypto_digest_t *f_digest; /* for integrity checking */
   /** Digest state for cells heading away from the OR at this step. */
-  crypto_digest_t *b_digest;
+  struct crypto_digest_t *b_digest;
 
 };
+#undef crypto_cipher_t
 
 #endif
-
diff --git a/src/or/rend_intro_point_st.h b/src/or/rend_intro_point_st.h
index f707c7aaa..89fe5ef2b 100644
--- a/src/or/rend_intro_point_st.h
+++ b/src/or/rend_intro_point_st.h
@@ -7,14 +7,17 @@
 #ifndef REND_INTRO_POINT_ST_H
 #define REND_INTRO_POINT_ST_H
 
+struct replaycache_t;
+struct crypto_pk_t;
+
 /** Introduction point information.  Used both in rend_service_t (on
  * the service side) and in rend_service_descriptor_t (on both the
  * client and service side). */
 struct rend_intro_point_t {
   extend_info_t *extend_info; /**< Extend info for connecting to this
                                * introduction point via a multi-hop path. */
-  crypto_pk_t *intro_key; /**< Introduction key that replaces the service
-                               * key, if this descriptor is V2. */
+  struct crypto_pk_t *intro_key; /**< Introduction key that replaces the
+                                  * service key, if this descriptor is V2. */
 
   /** (Client side only) Flag indicating that a timeout has occurred
    * after sending an INTRODUCE cell to this intro point.  After a
@@ -35,7 +38,7 @@ struct rend_intro_point_t {
   /** (Service side only) A replay cache recording the RSA-encrypted parts
    * of INTRODUCE2 cells this intro point's circuit has received.  This is
    * used to prevent replay attacks. */
-  replaycache_t *accepted_intro_rsa_parts;
+  struct replaycache_t *accepted_intro_rsa_parts;
 
   /** (Service side only) Count of INTRODUCE2 cells accepted from this
    * intro point.
@@ -71,4 +74,3 @@ struct rend_intro_point_t {
 };
 
 #endif
-
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index b71457456..d4262f2f3 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -16,6 +16,7 @@
 #include "or/connection.h"
 #include "or/connection_edge.h"
 #include "or/control.h"
+#include "lib/crypt_ops/crypto_dh.h"
 #include "lib/crypt_ops/crypto_rand.h"
 #include "lib/crypt_ops/crypto_util.h"
 #include "or/directory.h"
@@ -32,6 +33,7 @@
 #include "or/router.h"
 #include "or/routerlist.h"
 #include "or/routerset.h"
+#include "lib/encoding/confline.h"
 
 #include "or/cpath_build_state_st.h"
 #include "or/crypt_path_st.h"
@@ -1253,4 +1255,3 @@ rend_client_non_anonymous_mode_enabled(const or_options_t *options)
   return 0;
 #endif /* defined(NON_ANONYMOUS_MODE_ENABLED) */
 }
-
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index 1eadbd602..928dda012 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -27,6 +27,7 @@
 #include "or/rendmid.h"
 #include "or/rendservice.h"
 #include "or/rephist.h"
+#include "or/replaycache.h"
 #include "or/router.h"
 #include "or/routerlist.h"
 #include "or/routerparse.h"
@@ -1053,4 +1054,3 @@ rend_circuit_pk_digest_eq(const origin_circuit_t *ocirc,
  match:
   return 1;
 }
-
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index f55b9b776..e5ddb1102 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -35,6 +35,7 @@
 #include "or/routerlist.h"
 #include "or/routerparse.h"
 #include "or/routerset.h"
+#include "lib/encoding/confline.h"
 
 #include "or/cpath_build_state_st.h"
 #include "or/crypt_path_st.h"
@@ -4437,4 +4438,3 @@ set_rend_rend_service_staging_list(smartlist_t *new_list)
 }
 
 #endif /* defined(TOR_UNIT_TESTS) */
-
diff --git a/src/or/rendservice.h b/src/or/rendservice.h
index a9b3689d2..0b119e61d 100644
--- a/src/or/rendservice.h
+++ b/src/or/rendservice.h
@@ -14,6 +14,7 @@
 
 #include "or/or.h"
 #include "or/hs_service.h"
+#include "lib/crypt_ops/crypto_dh.h"
 
 typedef struct rend_intro_cell_s rend_intro_cell_t;
 
@@ -138,7 +139,7 @@ STATIC void rend_service_prune_list_impl_(void);
 #endif /* defined(RENDSERVICE_PRIVATE) */
 
 int rend_num_services(void);
-int rend_config_service(const config_line_t *line_,
+int rend_config_service(const struct config_line_t *line_,
                         const or_options_t *options,
                         hs_service_config_t *config);
 void rend_service_prune_list(void);
@@ -218,4 +219,3 @@ int rend_service_reveal_startup_time(const or_options_t *options);
 int rend_service_non_anonymous_mode_enabled(const or_options_t *options);
 
 #endif /* !defined(TOR_RENDSERVICE_H) */
-
diff --git a/src/or/replaycache.h b/src/or/replaycache.h
index d8a992912..3118a88a1 100644
--- a/src/or/replaycache.h
+++ b/src/or/replaycache.h
@@ -9,11 +9,11 @@
 #ifndef TOR_REPLAYCACHE_H
 #define TOR_REPLAYCACHE_H
 
-typedef struct replaycache_s replaycache_t;
+typedef struct replaycache_t replaycache_t;
 
 #ifdef REPLAYCACHE_PRIVATE
 
-struct replaycache_s {
+struct replaycache_t {
   /* Scrub interval */
   time_t scrub_interval;
   /* Last scrubbed */
@@ -65,4 +65,3 @@ int replaycache_add_test_and_elapsed(
 void replaycache_scrub_if_needed(replaycache_t *r);
 
 #endif /* !defined(TOR_REPLAYCACHE_H) */
-
diff --git a/src/or/router.c b/src/or/router.c
index c7fed1f02..091809a22 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -51,6 +51,8 @@
 #include "or/routerinfo_st.h"
 
 #include "lib/osinfo/uname.h"
+#include "lib/tls/tortls.h"
+#include "lib/encoding/confline.h"
 
 /**
  * \file router.c
diff --git a/src/or/routerkeys.c b/src/or/routerkeys.c
index b6d4d83d6..d6e7c752c 100644
--- a/src/or/routerkeys.c
+++ b/src/or/routerkeys.c
@@ -16,12 +16,14 @@
 
 #include "or/or.h"
 #include "or/config.h"
-#include "lib/crypt_ops/crypto_util.h"
 #include "or/router.h"
-#include "lib/crypt_ops/crypto_pwbox.h"
 #include "or/routerkeys.h"
 #include "or/torcert.h"
+
+#include "lib/crypt_ops/crypto_pwbox.h"
+#include "lib/crypt_ops/crypto_util.h"
 #include "lib/term/getpass.h"
+#include "lib/tls/tortls.h"
 
 #define ENC_KEY_HEADER "Boxed Ed25519 key"
 #define ENC_KEY_TAG "master"
diff --git a/src/or/scheduler.c b/src/or/scheduler.c
index 960972de8..7c423064c 100644
--- a/src/or/scheduler.c
+++ b/src/or/scheduler.c
@@ -12,6 +12,7 @@
 #include "lib/container/buffers.h"
 #define TOR_CHANNEL_INTERNAL_
 #include "or/channeltls.h"
+#include "common/compat_libevent.h"
 
 #include "or/or_connection_st.h"
 
@@ -765,4 +766,3 @@ scheduler_touch_channel(channel_t *chan)
 }
 
 #endif /* defined(TOR_UNIT_TESTS) */
-
diff --git a/src/or/statefile.c b/src/or/statefile.c
index 80c56b2d5..090e29a18 100644
--- a/src/or/statefile.c
+++ b/src/or/statefile.c
@@ -42,6 +42,7 @@
 #include "or/router.h"
 #include "lib/sandbox/sandbox.h"
 #include "or/statefile.h"
+#include "lib/encoding/confline.h"
 
 /** A list of state-file "abbreviations," for compatibility. */
 static config_abbrev_t state_abbrevs_[] = {
@@ -708,4 +709,3 @@ or_state_free_all(void)
   or_state_free(global_state);
   global_state = NULL;
 }
-
diff --git a/src/or/statefile.h b/src/or/statefile.h
index ed21dd14e..e996d5b6e 100644
--- a/src/or/statefile.h
+++ b/src/or/statefile.h
@@ -20,11 +20,11 @@ void or_state_free_all(void);
 void or_state_mark_dirty(or_state_t *state, time_t when);
 
 #ifdef STATEFILE_PRIVATE
-STATIC config_line_t *get_transport_in_state_by_name(const char *transport);
+STATIC struct config_line_t *get_transport_in_state_by_name(
+                                                 const char *transport);
 STATIC void or_state_free_(or_state_t *state);
 #define or_state_free(st) FREE_AND_NULL(or_state_t, or_state_free_, (st))
 STATIC or_state_t *or_state_new(void);
 #endif
 
 #endif /* !defined(TOR_STATEFILE_H) */
-
diff --git a/src/or/status.c b/src/or/status.c
index d0b3bc553..2cb1dc734 100644
--- a/src/or/status.c
+++ b/src/or/status.c
@@ -31,6 +31,7 @@
 #include "or/dos.h"
 
 #include "or/routerinfo_st.h"
+#include "lib/tls/tortls.h"
 
 static void log_accounting(const time_t now, const or_options_t *options);
 #include "or/geoip.h"
@@ -247,4 +248,3 @@ log_accounting(const time_t now, const or_options_t *options)
   tor_free(acc_max);
   tor_free(remaining);
 }
-
diff --git a/src/or/torcert.c b/src/or/torcert.c
index 785132c17..27bdb3433 100644
--- a/src/or/torcert.c
+++ b/src/or/torcert.c
@@ -33,6 +33,7 @@
 #include "lib/log/torlog.h"
 #include "common/util.h"
 #include "trunnel/link_handshake.h"
+#include "lib/tls/tortls.h"
 
 #include "or/or_handshake_certs_st.h"
 
@@ -723,4 +724,3 @@ tor_cert_encode_ed22519(const tor_cert_t *cert, char **cert_str_out)
   tor_free(ed_cert_b64);
   return ret;
 }
-
diff --git a/src/or/torcert.h b/src/or/torcert.h
index ba5787934..5fa97679d 100644
--- a/src/or/torcert.h
+++ b/src/or/torcert.h
@@ -49,6 +49,8 @@ typedef struct tor_cert_st {
   unsigned cert_valid : 1;
 } tor_cert_t;
 
+struct tor_tls_t;
+
 tor_cert_t *tor_cert_create(const ed25519_keypair_t *signing_key,
                             uint8_t cert_type,
                             const ed25519_public_key_t *signed_key,
@@ -90,15 +92,15 @@ void or_handshake_certs_free_(or_handshake_certs_t *certs);
   FREE_AND_NULL(or_handshake_certs_t, or_handshake_certs_free_, (certs))
 int or_handshake_certs_rsa_ok(int severity,
                               or_handshake_certs_t *certs,
-                              tor_tls_t *tls,
+                              struct tor_tls_t *tls,
                               time_t now);
 int or_handshake_certs_ed25519_ok(int severity,
                                   or_handshake_certs_t *certs,
-                                  tor_tls_t *tls,
+                                  struct tor_tls_t *tls,
                                   time_t now);
 void or_handshake_certs_check_both(int severity,
                               or_handshake_certs_t *certs,
-                              tor_tls_t *tls,
+                              struct tor_tls_t *tls,
                               time_t now,
                               const ed25519_public_key_t **ed_id_out,
                               const common_digests_t **rsa_id_out);
@@ -106,4 +108,3 @@ void or_handshake_certs_check_both(int severity,
 int tor_cert_encode_ed22519(const tor_cert_t *cert, char **cert_str_out);
 
 #endif /* !defined(TORCERT_H_INCLUDED) */
-
diff --git a/src/test/bench.c b/src/test/bench.c
index f46eeef7f..427ebd814 100644
--- a/src/test/bench.c
+++ b/src/test/bench.c
@@ -21,10 +21,12 @@
 
 #include "or/config.h"
 #include "lib/crypt_ops/crypto_curve25519.h"
+#include "lib/crypt_ops/crypto_dh.h"
 #include "or/onion_ntor.h"
 #include "lib/crypt_ops/crypto_ed25519.h"
 #include "lib/crypt_ops/crypto_rand.h"
 #include "or/consdiff.h"
+#include "lib/compress/compress.h"
 
 #include "or/cell_st.h"
 #include "or/or_circuit_st.h"
diff --git a/src/test/fuzz/fuzzing_common.c b/src/test/fuzz/fuzzing_common.c
index 9e736ea69..c947ebfce 100644
--- a/src/test/fuzz/fuzzing_common.c
+++ b/src/test/fuzz/fuzzing_common.c
@@ -6,6 +6,7 @@
 #include "lib/err/backtrace.h"
 #include "or/config.h"
 #include "test/fuzz/fuzzing.h"
+#include "lib/compress/compress.h"
 #include "lib/crypt_ops/crypto.h"
 #include "lib/crypt_ops/crypto_ed25519.h"
 
@@ -189,4 +190,3 @@ main(int argc, char **argv)
 }
 
 #endif
-
diff --git a/src/test/test.c b/src/test/test.c
index d36c47a07..64332e264 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -9,6 +9,7 @@
  **/
 
 #include "orconfig.h"
+#include "lib/crypt_ops/crypto_dh.h"
 #include "lib/crypt_ops/crypto_rand.h"
 
 #include <stdio.h>
diff --git a/src/test/test_buffers.c b/src/test/test_buffers.c
index 66ee99722..604f1422c 100644
--- a/src/test/test_buffers.c
+++ b/src/test/test_buffers.c
@@ -8,6 +8,8 @@
 #include "or/or.h"
 #include "lib/container/buffers.h"
 #include "lib/tls/buffers_tls.h"
+#include "lib/tls/tortls.h"
+#include "lib/compress/compress.h"
 #include "lib/crypt_ops/crypto_rand.h"
 #include "or/proto_http.h"
 #include "or/proto_socks.h"
@@ -819,4 +821,3 @@ struct testcase_t buffer_tests[] = {
 
   END_OF_TESTCASES
 };
-
diff --git a/src/test/test_cell_formats.c b/src/test/test_cell_formats.c
index 844fa4a16..da5e5defd 100644
--- a/src/test/test_cell_formats.c
+++ b/src/test/test_cell_formats.c
@@ -1302,4 +1302,3 @@ struct testcase_t cell_format_tests[] = {
   TEST(is_destroy, 0),
   END_OF_TESTCASES
 };
-
diff --git a/src/test/test_channelpadding.c b/src/test/test_channelpadding.c
index 4ae7e1636..ec29c1d30 100644
--- a/src/test/test_channelpadding.c
+++ b/src/test/test_channelpadding.c
@@ -19,6 +19,7 @@
 #include "or/main.h"
 #include "or/networkstatus.h"
 #include "test/log_test_helpers.h"
+#include "lib/tls/tortls.h"
 
 #include "or/cell_st.h"
 #include "or/networkstatus_st.h"
@@ -1168,4 +1169,3 @@ struct testcase_t channelpadding_tests[] = {
   TEST_CHANNELPADDING(channelpadding_timers, TT_FORK),
   END_OF_TESTCASES
 };
-
diff --git a/src/test/test_config.c b/src/test/test_config.c
index 113898982..d84cac4e9 100644
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@ -51,6 +51,7 @@
 #include "lib/fs/conffile.h"
 #include "lib/meminfo/meminfo.h"
 #include "lib/net/gethostname.h"
+#include "lib/encoding/confline.h"
 
 static void
 test_config_addressmap(void *arg)
diff --git a/src/test/test_conscache.c b/src/test/test_conscache.c
index e3a617fe3..3d3a50297 100644
--- a/src/test/test_conscache.c
+++ b/src/test/test_conscache.c
@@ -4,6 +4,7 @@
 #include "or/or.h"
 #include "or/config.h"
 #include "or/conscache.h"
+#include "lib/encoding/confline.h"
 #include "test/test.h"
 
 #ifdef HAVE_UTIME_H
@@ -337,4 +338,3 @@ struct testcase_t conscache_tests[] = {
   ENT(filter),
   END_OF_TESTCASES
 };
-
diff --git a/src/test/test_consdiffmgr.c b/src/test/test_consdiffmgr.c
index c09586afc..a0dfe95d3 100644
--- a/src/test/test_consdiffmgr.c
+++ b/src/test/test_consdiffmgr.c
@@ -13,6 +13,8 @@
 #include "or/networkstatus.h"
 #include "or/routerparse.h"
 #include "common/workqueue.h"
+#include "lib/compress/compress.h"
+#include "lib/encoding/confline.h"
 
 #include "or/networkstatus_st.h"
 
@@ -896,4 +898,3 @@ struct testcase_t consdiffmgr_tests[] = {
 
   END_OF_TESTCASES
 };
-
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c
index a85d036e3..eb4b36f08 100644
--- a/src/test/test_crypto.c
+++ b/src/test/test_crypto.c
@@ -12,7 +12,9 @@
 #include "common/util.h"
 #include "siphash.h"
 #include "lib/crypt_ops/crypto_curve25519.h"
+#include "lib/crypt_ops/crypto_dh.h"
 #include "lib/crypt_ops/crypto_ed25519.h"
+#include "lib/crypt_ops/crypto_hkdf.h"
 #include "lib/crypt_ops/crypto_rand.h"
 #include "ed25519_vectors.inc"
 
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 498ecf942..5891f1c9e 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -45,6 +45,7 @@
 #include "or/relay.h"
 #include "test/log_test_helpers.h"
 #include "or/voting_schedule.h"
+#include "lib/compress/compress.h"
 
 #include "or/authority_cert_st.h"
 #include "or/document_signature_st.h"
diff --git a/src/test/test_entryconn.c b/src/test/test_entryconn.c
index d6ac5e1d3..b23f12087 100644
--- a/src/test/test_entryconn.c
+++ b/src/test/test_entryconn.c
@@ -22,6 +22,8 @@
 #include "or/entry_connection_st.h"
 #include "or/socks_request_st.h"
 
+#include "lib/encoding/confline.h"
+
 static void *
 entryconn_rewrite_setup(const struct testcase_t *tc)
 {
@@ -833,4 +835,3 @@ struct testcase_t entryconn_tests[] = {
 
   END_OF_TESTCASES
 };
-
diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c
index 4d37d0fe8..f0d649330 100644
--- a/src/test/test_entrynodes.c
+++ b/src/test/test_entrynodes.c
@@ -44,6 +44,7 @@
 #include "test/log_test_helpers.h"
 
 #include "lib/container/bloomfilt.h"
+#include "lib/encoding/confline.h"
 
 /* TODO:
  * choose_random_entry() test with state set.
diff --git a/src/test/test_helpers.c b/src/test/test_helpers.c
index ba279c790..6d410af52 100644
--- a/src/test/test_helpers.c
+++ b/src/test/test_helpers.c
@@ -23,6 +23,7 @@
 #include "or/nodelist.h"
 #include "or/relay.h"
 #include "or/routerlist.h"
+#include "lib/encoding/confline.h"
 
 #include "or/cell_st.h"
 #include "or/connection_st.h"
@@ -282,4 +283,3 @@ helper_parse_options(const char *conf)
   }
   return opt;
 }
-
diff --git a/src/test/test_hs_client.c b/src/test/test_hs_client.c
index 3a4d35431..b5cb9bb91 100644
--- a/src/test/test_hs_client.c
+++ b/src/test/test_hs_client.c
@@ -22,12 +22,14 @@
 
 #include "or/config.h"
 #include "lib/crypt_ops/crypto.h"
+#include "lib/crypt_ops/crypto_dh.h"
 #include "or/channeltls.h"
 #include "or/main.h"
 #include "or/nodelist.h"
 #include "or/routerset.h"
 
 #include "or/hs_circuit.h"
+#include "or/hs_circuitmap.h"
 #include "or/hs_client.h"
 #include "or/hs_ident.h"
 #include "or/hs_cache.h"
@@ -609,4 +611,3 @@ struct testcase_t hs_client_tests[] = {
     TT_FORK, NULL, NULL },
   END_OF_TESTCASES
 };
-
diff --git a/src/test/test_hs_service.c b/src/test/test_hs_service.c
index 684ac98f4..3ea1e7530 100644
--- a/src/test/test_hs_service.c
+++ b/src/test/test_hs_service.c
@@ -45,6 +45,7 @@
 #include "or/hs_intropoint.h"
 #include "or/hs_ntor.h"
 #include "or/hs_circuit.h"
+#include "or/hs_circuitmap.h"
 #include "or/hs_service.h"
 #include "or/hs_client.h"
 #include "or/main.h"
@@ -1634,4 +1635,3 @@ struct testcase_t hs_service_tests[] = {
 
   END_OF_TESTCASES
 };
-
diff --git a/src/test/test_link_handshake.c b/src/test/test_link_handshake.c
index ffb6c47b1..515fdc50a 100644
--- a/src/test/test_link_handshake.c
+++ b/src/test/test_link_handshake.c
@@ -24,6 +24,8 @@
 #include "or/or_handshake_state_st.h"
 #include "or/var_cell_st.h"
 
+#include "lib/tls/tortls.h"
+
 #include "test/test.h"
 #include "test/log_test_helpers.h"
 
diff --git a/src/test/test_options.c b/src/test/test_options.c
index ab8727c3d..76d95349c 100644
--- a/src/test/test_options.c
+++ b/src/test/test_options.c
@@ -18,6 +18,7 @@
 #include "lib/sandbox/sandbox.h"
 #include "lib/memarea/memarea.h"
 #include "lib/osinfo/uname.h"
+#include "lib/encoding/confline.h"
 #include "or/policies.h"
 #include "test/test_helpers.h"
 
diff --git a/src/test/test_policy.c b/src/test/test_policy.c
index 2c29bbb16..a723e82eb 100644
--- a/src/test/test_policy.c
+++ b/src/test/test_policy.c
@@ -8,6 +8,7 @@
 #include "or/routerparse.h"
 #define POLICIES_PRIVATE
 #include "or/policies.h"
+#include "lib/encoding/confline.h"
 #include "test/test.h"
 
 #include "or/node_st.h"
@@ -2450,4 +2451,3 @@ struct testcase_t policy_tests[] = {
     test_policies_fascist_firewall_choose_address, 0, NULL, NULL },
   END_OF_TESTCASES
 };
-
diff --git a/src/test/test_pt.c b/src/test/test_pt.c
index c2c4e1989..087040506 100644
--- a/src/test/test_pt.c
+++ b/src/test/test_pt.c
@@ -19,6 +19,7 @@
 #include "or/statefile.h"
 #include "test/test.h"
 #include "lib/process/subprocess.h"
+#include "lib/encoding/confline.h"
 
 static void
 reset_mp(managed_proxy_t *mp)
diff --git a/src/test/test_routerlist.c b/src/test/test_routerlist.c
index 5da42c133..8fbe27cec 100644
--- a/src/test/test_routerlist.c
+++ b/src/test/test_routerlist.c
@@ -39,6 +39,8 @@
 #include "or/node_st.h"
 #include "or/routerstatus_st.h"
 
+#include "lib/encoding/confline.h"
+
 #include "test/test.h"
 #include "test/test_dir_common.h"
 #include "test/log_test_helpers.h"
@@ -782,4 +784,3 @@ struct testcase_t routerlist_tests[] = {
   { "warn_early_consensus", test_warn_early_consensus, 0, NULL, NULL },
   END_OF_TESTCASES
 };
-
diff --git a/src/test/test_status.c b/src/test/test_status.c
index 09b9662b4..071b3ba8a 100644
--- a/src/test/test_status.c
+++ b/src/test/test_status.c
@@ -24,6 +24,7 @@
 #include "or/main.h"
 #include "or/nodelist.h"
 #include "or/statefile.h"
+#include "lib/tls/tortls.h"
 
 #include "or/origin_circuit_st.h"
 #include "or/routerinfo_st.h"
@@ -1097,4 +1098,3 @@ struct testcase_t status_tests[] = {
   TEST_CASE_ASPECT(log_heartbeat, tls_write_overhead),
   END_OF_TESTCASES
 };
-
diff --git a/src/test/test_storagedir.c b/src/test/test_storagedir.c
index d07d35e09..efb6a0027 100644
--- a/src/test/test_storagedir.c
+++ b/src/test/test_storagedir.c
@@ -4,6 +4,7 @@
 #include "or/or.h"
 #include "lib/crypt_ops/crypto_rand.h"
 #include "lib/fs/storagedir.h"
+#include "lib/encoding/confline.h"
 #include "test/test.h"
 
 #ifdef HAVE_UTIME_H
@@ -373,4 +374,3 @@ struct testcase_t storagedir_tests[] = {
   ENT(read_labeled),
   END_OF_TESTCASES
 };
-
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 7f37a2ab9..6d0162e6e 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -22,6 +22,7 @@
 #include "lib/memarea/memarea.h"
 #include "lib/process/waitpid.h"
 #include "test/log_test_helpers.h"
+#include "lib/compress/compress.h"
 #include "lib/compress/compress_zstd.h"
 #include "lib/encoding/keyval.h"
 #include "lib/fdio/fdio.h"
@@ -35,6 +36,7 @@
 #include "lib/math/laplace.h"
 #include "lib/meminfo/meminfo.h"
 #include "lib/time/tvdiff.h"
+#include "lib/encoding/confline.h"
 
 #ifdef HAVE_PWD_H
 #include <pwd.h>
diff --git a/src/test/testing_common.c b/src/test/testing_common.c
index 3baeb9803..879382ce2 100644
--- a/src/test/testing_common.c
+++ b/src/test/testing_common.c
@@ -13,12 +13,15 @@
 #include "or/or.h"
 #include "or/control.h"
 #include "or/config.h"
+#include "lib/crypt_ops/crypto_dh.h"
 #include "lib/crypt_ops/crypto_rand.h"
 #include "or/rephist.h"
 #include "lib/err/backtrace.h"
 #include "test/test.h"
 #include "or/channelpadding.h"
 #include "or/main.h"
+#include "lib/compress/compress.h"
+#include "common/compat_libevent.h"
 
 #include <stdio.h>
 #ifdef HAVE_FCNTL_H





More information about the tor-commits mailing list