Commit 194acfb5 authored by Nick Mathewson's avatar Nick Mathewson 🌉
Browse files

Split directory.c code into several modules

Parts of this C file naturally belong in dircache, dirclient, and
dircommon: so, move them there.
parent 0e4c42a9
o Code simplification and refactoring:
- Split directory.c into separate pieces for client, server, and
common functionality. Closes ticket 26744.
......@@ -62,9 +62,12 @@ LIBTOR_APP_A_SOURCES = \
src/feature/dirauth/keypin.c \
src/feature/dircache/conscache.c \
src/feature/dircache/consdiffmgr.c \
src/feature/dircache/directory.c \
src/feature/dircache/dircache.c \
src/feature/dircache/dirserv.c \
src/feature/dirclient/dirclient.c \
src/feature/dirclient/dlstatus.c \
src/feature/dircommon/consdiff.c \
src/feature/dircommon/directory.c \
src/feature/dircommon/fp_pair.c \
src/feature/dircommon/voting_schedule.c \
src/feature/hibernate/hibernate.c \
......@@ -257,12 +260,15 @@ noinst_HEADERS += \
src/feature/dircache/cached_dir_st.h \
src/feature/dircache/conscache.h \
src/feature/dircache/consdiffmgr.h \
src/feature/dircache/directory.h \
src/feature/dircache/dircache.h \
src/feature/dircache/dirserv.h \
src/feature/dirclient/dir_server_st.h \
src/feature/dirclient/dirclient.h \
src/feature/dirclient/dlstatus.h \
src/feature/dirclient/download_status_st.h \
src/feature/dircommon/consdiff.h \
src/feature/dircommon/dir_connection_st.h \
src/feature/dircommon/directory.h \
src/feature/dircommon/fp_pair.h \
src/feature/dircommon/vote_timing_st.h \
src/feature/dircommon/voting_schedule.h \
......
......@@ -77,7 +77,7 @@
#include "core/or/connection_or.h"
#include "feature/control/control.h"
#include "lib/crypt_ops/crypto_util.h"
#include "feature/dircache/directory.h"
#include "feature/dircommon/directory.h"
#include "feature/dircache/dirserv.h"
#include "feature/relay/dns.h"
#include "feature/client/dnsserv.h"
......
......@@ -68,7 +68,7 @@
#include "feature/control/control.h"
#include "core/mainloop/cpuworker.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "feature/dircache/directory.h"
#include "feature/dircommon/directory.h"
#include "feature/dircache/dirserv.h"
#include "feature/dirauth/reachability.h"
#include "feature/relay/dns.h"
......
......@@ -44,7 +44,7 @@
#include "core/or/connection_or.h"
#include "feature/control/control.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "feature/dircache/directory.h"
#include "feature/dircommon/directory.h"
#include "feature/client/entrynodes.h"
#include "core/crypto/hs_ntor.h"
#include "core/mainloop/mainloop.h"
......
......@@ -69,7 +69,7 @@
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_util.h"
#include "lib/crypt_ops/crypto_dh.h"
#include "feature/dircache/directory.h"
#include "feature/dircommon/directory.h"
#include "feature/client/entrynodes.h"
#include "core/mainloop/mainloop.h"
#include "feature/hs/hs_circuit.h"
......
......@@ -40,7 +40,7 @@
#include "core/mainloop/connection.h"
#include "core/or/connection_edge.h"
#include "feature/control/control.h"
#include "feature/dircache/directory.h"
#include "feature/dircommon/directory.h"
#include "feature/client/entrynodes.h"
#include "feature/hs/hs_common.h"
#include "feature/hs/hs_client.h"
......
......@@ -73,7 +73,7 @@
#include "lib/crypt_ops/crypto_util.h"
#include "feature/relay/dns.h"
#include "feature/client/dnsserv.h"
#include "feature/dircache/directory.h"
#include "feature/dircommon/directory.h"
#include "feature/dircache/dirserv.h"
#include "feature/hibernate/hibernate.h"
#include "feature/hs/hs_common.h"
......
......@@ -63,7 +63,7 @@
#include "feature/control/control.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_util.h"
#include "feature/dircache/directory.h"
#include "feature/dircommon/directory.h"
#include "feature/relay/dns.h"
#include "feature/stats/geoip.h"
#include "feature/hs/hs_cache.h"
......
......@@ -18,7 +18,9 @@
#include "core/or/circuitbuild.h"
#include "app/config/config.h"
#include "core/mainloop/connection.h"
#include "feature/dircache/directory.h"
#include "feature/dircommon/directory.h"
#include "feature/dirclient/dirclient.h"
#include "feature/dirclient/dlstatus.h"
#include "feature/client/entrynodes.h"
#include "feature/nodelist/nodelist.h"
#include "core/or/policies.h"
......
......@@ -125,7 +125,7 @@
#include "core/mainloop/connection.h"
#include "feature/control/control.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "feature/dircache/directory.h"
#include "feature/dircommon/directory.h"
#include "feature/client/entrynodes.h"
#include "core/mainloop/mainloop.h"
#include "feature/nodelist/microdesc.h"
......
......@@ -56,7 +56,9 @@
#include "feature/control/fmt_serverstatus.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_util.h"
#include "feature/dircache/directory.h"
#include "feature/dircommon/directory.h"
#include "feature/dirclient/dirclient.h"
#include "feature/dirclient/dlstatus.h"
#include "feature/dircache/dirserv.h"
#include "feature/client/dnsserv.h"
#include "feature/client/entrynodes.h"
......
......@@ -9,7 +9,8 @@
#include "feature/dirauth/dircollate.h"
#include "feature/dirauth/recommend_pkg.h"
#include "feature/dirauth/voteflags.h"
#include "feature/dircache/directory.h"
#include "feature/dircommon/directory.h"
#include "feature/dirclient/dirclient.h"
#include "feature/dirauth/bwauth.h"
#include "feature/dircache/dirserv.h"
#include "feature/dirauth/guardfraction.h"
......
......@@ -19,7 +19,8 @@
#include "core/or/policies.h"
#include "feature/dirauth/keypin.h"
#include "feature/dirauth/reachability.h"
#include "feature/dircache/directory.h"
#include "feature/dirclient/dlstatus.h"
#include "feature/dircommon/directory.h"
#include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h"
#include "feature/nodelist/routerlist.h"
......
This diff is collapsed.
/* 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 */
/**
* \file dircache.h
* \brief Header file for dircache.c.
**/
#ifndef TOR_DIRCACHE_H
#define TOR_DIRCACHE_H
int directory_handle_command(dir_connection_t *conn);
#ifdef DIRCACHE_PRIVATE
MOCK_DECL(STATIC int, directory_handle_command_get,(dir_connection_t *conn,
const char *headers,
const char *req_body,
size_t req_body_len));
MOCK_DECL(STATIC int, directory_handle_command_post,(dir_connection_t *conn,
const char *headers,
const char *body,
size_t body_len));
STATIC int handle_post_hs_descriptor(const char *url, const char *body);
enum compression_level_t;
STATIC enum compression_level_t choose_compression_level(ssize_t n_bytes);
struct get_handler_args_t;
STATIC int handle_get_hs_descriptor_v3(dir_connection_t *conn,
const struct get_handler_args_t *args);
STATIC int parse_http_url(const char *headers, char **url);
STATIC int parse_hs_version_from_post(const char *url, const char *prefix,
const char **end_pos);
STATIC unsigned parse_accept_encoding_header(const char *h);
#endif
#endif /* !defined(TOR_DIRCACHE_H) */
......@@ -10,7 +10,7 @@
#include "core/mainloop/connection.h"
#include "feature/dircache/conscache.h"
#include "feature/dircache/consdiffmgr.h"
#include "feature/dircache/directory.h"
#include "feature/dircommon/directory.h"
#include "feature/dircache/dirserv.h"
#include "feature/nodelist/microdesc.h"
#include "feature/nodelist/routerlist.h"
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment