diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-04-16 18:45:48 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-04-16 18:45:48 -0400 |
commit | 91a6fbcf777ae94661a2a27fc4180dcb28d1f974 (patch) | |
tree | a47b16f416dfd429a47c75bad41ed27c3baa67ac /src/or/directory.h | |
parent | b081a7ed21ae729f6e195715e130edaca3e0b7fe (diff) | |
download | tor-91a6fbcf777ae94661a2a27fc4180dcb28d1f974.tar.gz tor-91a6fbcf777ae94661a2a27fc4180dcb28d1f974.zip |
Begin work to turn "directory request" into an object
This patch adds the object type, and makes all of the functions
that used to feed into directory_initiate_command_rend() feed into
that type instead.
Diffstat (limited to 'src/or/directory.h')
-rw-r--r-- | src/or/directory.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/or/directory.h b/src/or/directory.h index 0c5db3e070..18fe5505c7 100644 --- a/src/or/directory.h +++ b/src/or/directory.h @@ -41,6 +41,31 @@ typedef enum { int directory_must_use_begindir(const or_options_t *options); +typedef struct directory_request_t directory_request_t; +directory_request_t *directory_request_new(uint8_t dir_purpose); +void directory_request_free(directory_request_t *req); +void directory_request_set_or_addr_port(directory_request_t *req, + const tor_addr_port_t *p); +void directory_request_set_dir_addr_port(directory_request_t *req, + const tor_addr_port_t *p); +void directory_request_set_directory_id_digest(directory_request_t *req, + const char *digest); +void directory_request_set_router_purpose(directory_request_t *req, + uint8_t router_purpose); +void directory_request_set_indirection(directory_request_t *req, + dir_indirection_t indirection); +void directory_request_set_resource(directory_request_t *req, + const char *resource); +void directory_request_set_payload(directory_request_t *req, + const char *payload, + size_t payload_len); +void directory_request_set_if_modified_since(directory_request_t *req, + time_t if_modified_since); +void directory_request_set_rend_query(directory_request_t *req, + const rend_data_t *query); +void directory_request_set_guard_state(directory_request_t *req, + struct circuit_guard_state_t *state); + MOCK_DECL(void, directory_initiate_command_routerstatus, (const routerstatus_t *status, uint8_t dir_purpose, @@ -63,6 +88,8 @@ void directory_initiate_command_routerstatus_rend(const routerstatus_t *status, const rend_data_t *rend_query, struct circuit_guard_state_t *guard_state); +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); |