Tor  0.4.3.0-alpha-dev
rendcommon.h
Go to the documentation of this file.
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-2019, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 /**
8  * \file rendcommon.h
9  * \brief Header file for rendcommon.c.
10  **/
11 
12 #ifndef TOR_RENDCOMMON_H
13 #define TOR_RENDCOMMON_H
14 
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;
20 
21 int rend_cmp_service_ids(const char *one, const char *two);
22 
23 void rend_process_relay_cell(circuit_t *circ, const crypt_path_t *layer_hint,
24  int command, size_t length,
25  const uint8_t *payload);
26 
28 #define rend_service_descriptor_free(desc) \
29  FREE_AND_NULL(rend_service_descriptor_t, rend_service_descriptor_free_, \
30  (desc))
31 int rend_get_service_id(crypto_pk_t *pk, char *out);
34 #define rend_encoded_v2_service_descriptor_free(desc) \
35  FREE_AND_NULL(rend_encoded_v2_service_descriptor_t, \
36  rend_encoded_v2_service_descriptor_free_, (desc))
38 #define rend_intro_point_free(intro) \
39  FREE_AND_NULL(rend_intro_point_t, rend_intro_point_free_, (intro))
40 
41 int rend_valid_v2_service_id(const char *query);
42 int rend_valid_descriptor_id(const char *query);
43 int rend_valid_client_name(const char *client_name);
45  rend_service_descriptor_t *desc, time_t now,
46  uint8_t period, rend_auth_type_t auth_type,
47  crypto_pk_t *client_key,
48  smartlist_t *client_cookies);
49 int rend_compute_v2_desc_id(char *desc_id_out, const char *service_id,
50  const char *descriptor_cookie,
51  time_t now, uint8_t replica);
52 void rend_get_descriptor_id_bytes(char *descriptor_id_out,
53  const char *service_id,
54  const char *secret_id_part);
56  const char *id);
57 
58 int rend_circuit_pk_digest_eq(const origin_circuit_t *ocirc,
59  const uint8_t *digest);
60 
61 char *rend_auth_encode_cookie(const uint8_t *cookie_in,
62  rend_auth_type_t auth_type);
63 int rend_auth_decode_cookie(const char *cookie_in,
64  uint8_t *cookie_out,
65  rend_auth_type_t *auth_type_out,
66  char **err_msg_out);
67 
68 int rend_allow_non_anonymous_connection(const or_options_t* options);
69 int rend_non_anonymous_mode_enabled(const or_options_t *options);
70 
71 void assert_circ_anonymity_ok(const origin_circuit_t *circ,
72  const or_options_t *options);
73 
74 #ifdef RENDCOMMON_PRIVATE
75 
76 STATIC int
78 
79 #endif /* defined(RENDCOMMON_PRIVATE) */
80 
81 #endif /* !defined(TOR_RENDCOMMON_H) */
82 
int rend_compute_v2_desc_id(char *desc_id_out, const char *service_id, const char *descriptor_cookie, time_t now, uint8_t replica)
Definition: rendcommon.c:153
char * rend_auth_encode_cookie(const uint8_t *cookie_in, rend_auth_type_t auth_type)
Definition: rendcommon.c:888
void rend_intro_point_free_(rend_intro_point_t *intro)
Definition: rendcommon.c:450
int rend_cmp_service_ids(const char *one, const char *two)
Definition: rendcommon.c:48
int rend_valid_descriptor_id(const char *query)
Definition: rendcommon.c:733
int rend_auth_decode_cookie(const char *cookie_in, uint8_t *cookie_out, rend_auth_type_t *auth_type_out, char **err_msg_out)
Definition: rendcommon.c:924
int rend_encode_v2_descriptors(smartlist_t *descs_out, rend_service_descriptor_t *desc, time_t now, uint8_t period, rend_auth_type_t auth_type, crypto_pk_t *client_key, smartlist_t *client_cookies)
Definition: rendcommon.c:474
int rend_valid_v2_service_id(const char *query)
Definition: rendcommon.c:719
#define STATIC
Definition: testsupport.h:32
rend_auth_type_t
Definition: or.h:402
int rend_valid_client_name(const char *client_name)
Definition: rendcommon.c:751
int hid_serv_get_responsible_directories(smartlist_t *responsible_dirs, const char *id)
Definition: rendcommon.c:842
STATIC int rend_desc_v2_is_parsable(rend_encoded_v2_service_descriptor_t *desc)
Definition: rendcommon.c:419
int rend_get_service_id(crypto_pk_t *pk, char *out)
Definition: rendcommon.c:706
void rend_process_relay_cell(circuit_t *circ, const crypt_path_t *layer_hint, int command, size_t length, const uint8_t *payload)
Definition: rendcommon.c:767
tor_cmdline_mode_t command
Definition: config.c:2215
void rend_encoded_v2_service_descriptor_free_(rend_encoded_v2_service_descriptor_t *desc)
Definition: rendcommon.c:439
void rend_service_descriptor_free_(rend_service_descriptor_t *desc)
Definition: rendcommon.c:56
void rend_get_descriptor_id_bytes(char *descriptor_id_out, const char *service_id, const char *secret_id_part)
Definition: rendcommon.c:87