Browse Source

Remove other needless includes include from or/*.h

Nick Mathewson 5 years ago
parent
commit
500826479a

+ 1 - 1
src/or/channel.c

@@ -79,6 +79,7 @@
 #include "lib/time/compat_time.h"
 #include "or/networkstatus.h"
 #include "or/rendservice.h"
+#include "common/timers.h"
 
 #include "or/cell_queue_st.h"
 
@@ -3477,4 +3478,3 @@ channel_update_bad_for_new_circs(const char *digest, int force)
     channel_rsa_id_group_set_badness(&(*iter)->channel_list, force);
   }
 }
-

+ 5 - 2
src/or/channel.h

@@ -11,11 +11,13 @@
 
 #include "or/or.h"
 #include "or/circuitmux.h"
-#include "common/timers.h"
 #include "common/handles.h"
 
 #include "tor_queue.h"
 
+#define tor_timer_t timeout
+struct tor_timer_t;
+
 /* 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 *);
@@ -94,7 +96,7 @@ struct channel_s {
   monotime_coarse_t next_padding_time;
 
   /** The callback pointer for the padding callbacks */
-  tor_timer_t *padding_timer;
+  struct tor_timer_t *padding_timer;
   /** The handle to this channel (to free on canceled timers) */
   struct channel_handle_t *timer_handle;
 
@@ -637,5 +639,6 @@ int packed_cell_is_destroy(channel_t *chan,
 HANDLE_DECL(channel, channel_s,)
 #define channel_handle_free(h)    \
   FREE_AND_NULL(channel_handle_t, channel_handle_free_, (h))
+#undef tor_timer_t
 
 #endif /* !defined(TOR_CHANNEL_H) */

+ 1 - 1
src/or/channelpadding.c

@@ -22,6 +22,7 @@
 #include "or/router.h"
 #include "lib/time/compat_time.h"
 #include "or/rendservice.h"
+#include "common/timers.h"
 
 #include "or/cell_st.h"
 #include "or/or_connection_st.h"
@@ -797,4 +798,3 @@ channelpadding_decide_to_pad_channel(channel_t *chan)
     return CHANNELPADDING_PADLATER;
   }
 }
-

+ 1 - 0
src/or/circuitlist.c

@@ -91,6 +91,7 @@
 #include "lib/compress/compress_lzma.h"
 #include "lib/compress/compress_zlib.h"
 #include "lib/compress/compress_zstd.h"
+#include "lib/container/buffers.h"
 
 #include "ht.h"
 

+ 2 - 4
src/or/connection.h

@@ -14,8 +14,7 @@
 
 listener_connection_t *TO_LISTENER_CONN(connection_t *);
 
-/* XXXX For buf_datalen in inline function */
-#include "lib/container/buffers.h"
+struct buf_t;
 
 const char *conn_type_to_string(int type);
 const char *conn_state_to_string(int type, int state);
@@ -159,7 +158,7 @@ connection_buf_add(const char *string, size_t len, connection_t *conn)
 }
 void connection_buf_add_compress(const char *string, size_t len,
                                  dir_connection_t *conn, int done);
-void connection_buf_add_buf(connection_t *conn, buf_t *buf);
+void connection_buf_add_buf(connection_t *conn, struct buf_t *buf);
 
 size_t connection_get_inbuf_len(connection_t *conn);
 size_t connection_get_outbuf_len(connection_t *conn);
@@ -259,4 +258,3 @@ MOCK_DECL(STATIC smartlist_t *, pick_oos_victims, (int n));
 #endif /* defined(CONNECTION_PRIVATE) */
 
 #endif /* !defined(TOR_CONNECTION_H) */
-

+ 1 - 0
src/or/hs_circuit.c

@@ -13,6 +13,7 @@
 #include "or/circuitlist.h"
 #include "or/circuituse.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/nodelist.h"

+ 1 - 1
src/or/hs_descriptor.c

@@ -66,6 +66,7 @@
 #include "or/hs_cache.h"
 #include "or/hs_config.h"
 #include "or/torcert.h" /* tor_cert_encode_ed22519() */
+#include "lib/memarea/memarea.h"
 
 #include "or/extend_info_st.h"
 
@@ -2607,4 +2608,3 @@ hs_desc_lspec_to_trunnel(const hs_desc_link_specifier_t *spec)
 
   return ls;
 }
-

+ 0 - 4
src/or/hs_descriptor.h

@@ -12,9 +12,6 @@
 #include <stdint.h>
 
 #include "or/or.h"
-#include "lib/net/address.h"
-#include "lib/crypt_ops/crypto.h"
-#include "lib/crypt_ops/crypto_ed25519.h"
 #include "trunnel/ed25519_cert.h" /* needed for trunnel */
 #include "or/torcert.h"
 
@@ -281,4 +278,3 @@ MOCK_DECL(STATIC size_t, decrypt_desc_layer,(const hs_descriptor_t *desc,
 #endif /* defined(HS_DESCRIPTOR_PRIVATE) */
 
 #endif /* !defined(TOR_HS_DESCRIPTOR_H) */
-

+ 1 - 0
src/or/main.c

@@ -119,6 +119,7 @@
 #include "lib/tls/tortls.h"
 #include "common/compat_libevent.h"
 #include "lib/encoding/confline.h"
+#include "common/timers.h"
 
 #include <event2/event.h>
 

+ 1 - 1
src/or/onion_ntor.c

@@ -27,6 +27,7 @@
 #include "lib/crypt_ops/crypto_util.h"
 #include "or/onion_ntor.h"
 #include "lib/log/torlog.h"
+#include "lib/ctime/di_ops.h"
 #include "common/util.h"
 
 /** Free storage held in an ntor handshake state. */
@@ -335,4 +336,3 @@ onion_skin_ntor_client_handshake(
 
   return bad ? -1 : 0;
 }
-

+ 3 - 3
src/or/onion_ntor.h

@@ -6,7 +6,8 @@
 
 #include "lib/cc/torint.h"
 #include "lib/crypt_ops/crypto_curve25519.h"
-#include "lib/ctime/di_ops.h"
+
+struct di_digest256_map_t;
 
 /** State to be maintained by a client between sending an ntor onionskin
  * and receiving a reply. */
@@ -27,7 +28,7 @@ int onion_skin_ntor_create(const uint8_t *router_id,
                            uint8_t *onion_skin_out);
 
 int onion_skin_ntor_server_handshake(const uint8_t *onion_skin,
-                                 const di_digest256_map_t *private_keys,
+                                 const struct di_digest256_map_t *private_keys,
                                  const curve25519_keypair_t *junk_keypair,
                                  const uint8_t *my_node_id,
                                  uint8_t *handshake_reply_out,
@@ -60,4 +61,3 @@ struct ntor_handshake_state_t {
 #endif /* defined(ONION_NTOR_PRIVATE) */
 
 #endif /* !defined(TOR_ONION_NTOR_H) */
-

+ 2 - 0
src/or/parsecommon.c

@@ -13,6 +13,8 @@
 #include "lib/container/smartlist.h"
 #include "lib/string/util_string.h"
 #include "lib/string/printf.h"
+#include "lib/memarea/memarea.h"
+#include "lib/crypt_ops/crypto.h"
 
 #include <string.h>
 

+ 6 - 5
src/or/parsecommon.h

@@ -9,10 +9,11 @@
 #ifndef TOR_PARSECOMMON_H
 #define TOR_PARSECOMMON_H
 
-#include "lib/crypt_ops/crypto.h"
-#include "lib/memarea/memarea.h"
+#include <stddef.h>
 
 struct smartlist_t;
+struct crypto_pk_t;
+struct memarea_t;
 
 /** Enumeration of possible token types.  The ones starting with K_ correspond
 * to directory 'keywords'. A_ is for an annotation, R or C is related to
@@ -206,7 +207,7 @@ typedef struct directory_token_t {
   size_t object_size;          /**< Bytes in object_body */
   char *object_body;           /**< Contents of object, base64-decoded. */
 
-  crypto_pk_t *key;        /**< For public keys only.  Heap-allocated. */
+  struct crypto_pk_t *key;     /**< For public keys only.  Heap-allocated. */
 
   char *error;                 /**< For ERR_ tokens only. */
 } directory_token_t;
@@ -298,12 +299,12 @@ typedef struct token_rule_t {
 
 void token_clear(directory_token_t *tok);
 
-int tokenize_string(memarea_t *area,
+int tokenize_string(struct memarea_t *area,
                     const char *start, const char *end,
                     struct smartlist_t *out,
                     token_rule_t *table,
                     int flags);
-directory_token_t *get_next_token(memarea_t *area,
+directory_token_t *get_next_token(struct memarea_t *area,
                                   const char **s,
                                   const char *eos,
                                   token_rule_t *table);

+ 1 - 0
src/or/rendservice.c

@@ -16,6 +16,7 @@
 #include "or/circuituse.h"
 #include "or/config.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"

+ 2 - 3
src/or/rendservice.h

@@ -14,13 +14,12 @@
 
 #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;
+typedef struct rend_intro_cell_t rend_intro_cell_t;
 
 /* This can be used for both INTRODUCE1 and INTRODUCE2 */
 
-struct rend_intro_cell_s {
+struct rend_intro_cell_t {
   /* Is this an INTRODUCE1 or INTRODUCE2? (set to 1 or 2) */
   uint8_t type;
   /* Public key digest */

+ 2 - 0
src/test/test_channelpadding.c

@@ -20,6 +20,8 @@
 #include "or/networkstatus.h"
 #include "test/log_test_helpers.h"
 #include "lib/tls/tortls.h"
+#include "common/timers.h"
+#include "lib/container/buffers.h"
 
 #include "or/cell_st.h"
 #include "or/networkstatus_st.h"

+ 1 - 0
src/test/test_routerlist.c

@@ -40,6 +40,7 @@
 #include "or/routerstatus_st.h"
 
 #include "lib/encoding/confline.h"
+#include "lib/container/buffers.h"
 
 #include "test/test.h"
 #include "test/test_dir_common.h"