12#ifndef TOR_DIRECTORY_H
13#define TOR_DIRECTORY_H
18#define DIR_CONN_STATE_MIN_ 1
20#define DIR_CONN_STATE_CONNECTING 1
22#define DIR_CONN_STATE_CLIENT_SENDING 2
24#define DIR_CONN_STATE_CLIENT_READING 3
26#define DIR_CONN_STATE_CLIENT_FINISHED 4
28#define DIR_CONN_STATE_SERVER_COMMAND_WAIT 5
30#define DIR_CONN_STATE_SERVER_WRITING 6
31#define DIR_CONN_STATE_MAX_ 6
33#define DIR_PURPOSE_MIN_ 6
36#define DIR_PURPOSE_FETCH_SERVERDESC 6
39#define DIR_PURPOSE_FETCH_EXTRAINFO 7
41#define DIR_PURPOSE_UPLOAD_DIR 8
43#define DIR_PURPOSE_UPLOAD_VOTE 10
45#define DIR_PURPOSE_UPLOAD_SIGNATURES 11
48#define DIR_PURPOSE_FETCH_STATUS_VOTE 12
51#define DIR_PURPOSE_FETCH_DETACHED_SIGNATURES 13
54#define DIR_PURPOSE_FETCH_CONSENSUS 14
57#define DIR_PURPOSE_FETCH_CERTIFICATE 15
60#define DIR_PURPOSE_SERVER 16
65#define DIR_PURPOSE_FETCH_MICRODESC 19
67#define DIR_PURPOSE_UPLOAD_HSDESC 20
69#define DIR_PURPOSE_FETCH_HSDESC 21
72#define DIR_PURPOSE_HAS_FETCHED_HSDESC 22
73#define DIR_PURPOSE_MAX_ 22
77#define DIR_PURPOSE_IS_UPLOAD(p) \
78 ((p)==DIR_PURPOSE_UPLOAD_DIR || \
79 (p)==DIR_PURPOSE_UPLOAD_VOTE || \
80 (p)==DIR_PURPOSE_UPLOAD_SIGNATURES || \
81 (p)==DIR_PURPOSE_UPLOAD_HSDESC)
85#define DIR_PURPOSE_IS_HS(p) \
86 ((p) == DIR_PURPOSE_FETCH_HSDESC || \
87 (p) == DIR_PURPOSE_UPLOAD_HSDESC)
93 char **command_out,
char **url_out);
104#define DSR_HEX (1<<0)
105#define DSR_BASE64 (1<<1)
106#define DSR_DIGEST256 (1<<2)
107#define DSR_SORT_UNIQ (1<<3)
113char *directory_dump_request_log(
void);
114void note_request(
const char *key,
size_t bytes);
117 const char *resource);
121#define X_ADDRESS_HEADER "X-Your-Address-Is: "
122#define X_OR_DIFF_FROM_CONSENSUS_HEADER "X-Or-Diff-From-Consensus: "
int connection_dir_finished_flushing(dir_connection_t *conn)
int connection_dir_finished_connecting(dir_connection_t *conn)
int purpose_needs_anonymity(uint8_t dir_purpose, uint8_t router_purpose, const char *resource)
int dir_split_resource_into_fingerprint_pairs(const char *res, smartlist_t *pairs_out)
int parse_http_response(const char *headers, int *code, time_t *date, enum compress_method_t *compression, char **response)
char * authdir_type_to_string(dirinfo_type_t auth)
int connection_dir_is_encrypted(const dir_connection_t *conn)
const dir_connection_t * CONST_TO_DIR_CONN(const connection_t *c)
dir_connection_t * TO_DIR_CONN(connection_t *c)
bool connection_dir_is_anonymous(const dir_connection_t *conn)
int dir_split_resource_into_fingerprints(const char *resource, smartlist_t *fp_out, int *compressed_out, int flags)
char * http_get_header(const char *headers, const char *which)
int connection_dir_reached_eof(dir_connection_t *conn)
int parse_http_command(const char *headers, char **command_out, char **url_out)
void connection_dir_about_to_close(dir_connection_t *dir_conn)
int connection_dir_process_inbuf(dir_connection_t *conn)