1 /* Copyright (c) 2001 Matej Pfajfar.
2 * Copyright (c) 2001-2004, Roger Dingledine.
3 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4 * Copyright (c) 2007-2016, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
9 * \brief Header file for rendcommon.c.
12 #ifndef TOR_RENDCOMMON_H
13 #define TOR_RENDCOMMON_H
15 typedef enum rend_intro_point_failure_t
{
16 INTRO_POINT_FAILURE_GENERIC
= 0,
17 INTRO_POINT_FAILURE_TIMEOUT
= 1,
18 INTRO_POINT_FAILURE_UNREACHABLE
= 2,
19 } rend_intro_point_failure_t
;
21 /** Free all storage associated with <b>data</b> */
23 rend_data_free(rend_data_t
*data
)
28 /* Cleanup the HSDir identity digest. */
29 SMARTLIST_FOREACH(data
->hsdirs_fp
, char *, d
, tor_free(d
));
30 smartlist_free(data
->hsdirs_fp
);
34 int rend_cmp_service_ids(const char *one
, const char *two
);
36 void rend_process_relay_cell(circuit_t
*circ
, const crypt_path_t
*layer_hint
,
37 int command
, size_t length
,
38 const uint8_t *payload
);
40 void rend_service_descriptor_free(rend_service_descriptor_t
*desc
);
41 int rend_get_service_id(crypto_pk_t
*pk
, char *out
);
42 void rend_encoded_v2_service_descriptor_free(
43 rend_encoded_v2_service_descriptor_t
*desc
);
44 void rend_intro_point_free(rend_intro_point_t
*intro
);
46 int rend_valid_service_id(const char *query
);
47 int rend_valid_descriptor_id(const char *query
);
48 int rend_valid_client_name(const char *client_name
);
49 int rend_encode_v2_descriptors(smartlist_t
*descs_out
,
50 rend_service_descriptor_t
*desc
, time_t now
,
51 uint8_t period
, rend_auth_type_t auth_type
,
52 crypto_pk_t
*client_key
,
53 smartlist_t
*client_cookies
);
54 int rend_compute_v2_desc_id(char *desc_id_out
, const char *service_id
,
55 const char *descriptor_cookie
,
56 time_t now
, uint8_t replica
);
57 void rend_get_descriptor_id_bytes(char *descriptor_id_out
,
58 const char *service_id
,
59 const char *secret_id_part
);
60 int hid_serv_get_responsible_directories(smartlist_t
*responsible_dirs
,
63 rend_data_t
*rend_data_dup(const rend_data_t
*data
);
64 rend_data_t
*rend_data_client_create(const char *onion_address
,
67 rend_auth_type_t auth_type
);
68 rend_data_t
*rend_data_service_create(const char *onion_address
,
69 const char *pk_digest
,
70 const uint8_t *cookie
,
71 rend_auth_type_t auth_type
);
73 char *rend_auth_encode_cookie(const uint8_t *cookie_in
,
74 rend_auth_type_t auth_type
);
75 int rend_auth_decode_cookie(const char *cookie_in
,
77 rend_auth_type_t
*auth_type_out
,
80 int rend_allow_non_anonymous_connection(const or_options_t
* options
);
81 int rend_non_anonymous_mode_enabled(const or_options_t
*options
);
83 void assert_circ_anonymity_ok(origin_circuit_t
*circ
,
84 const or_options_t
*options
);