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-2013, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
9 * \brief Header file for rendservice.c.
12 #ifndef TOR_RENDSERVICE_H
13 #define TOR_RENDSERVICE_H
17 typedef struct rend_intro_cell_s rend_intro_cell_t
;
19 #ifdef RENDSERVICE_PRIVATE
21 /* This can be used for both INTRODUCE1 and INTRODUCE2 */
23 struct rend_intro_cell_s
{
24 /* Is this an INTRODUCE1 or INTRODUCE2? (set to 1 or 2) */
26 /* Public key digest */
27 uint8_t pk
[DIGEST_LEN
];
28 /* Optionally, store ciphertext here */
30 ssize_t ciphertext_len
;
31 /* Optionally, store plaintext */
33 ssize_t plaintext_len
;
34 /* Have we parsed the plaintext? */
36 /* intro protocol version (0, 1, 2 or 3) */
38 /* Version-specific parts */
41 /* Rendezvous point nickname */
45 /* Rendezvous point nickname or hex-encoded key digest */
49 /* The extend_info_t struct has everything v2 uses */
50 extend_info_t
*extend_info
;
55 /* Length of auth data */
59 /* Rendezvous point's IP address/port, identity digest and onion key */
60 extend_info_t
*extend_info
;
63 /* Rendezvous cookie */
64 uint8_t rc
[REND_COOKIE_LEN
];
65 /* Diffie-Hellman data */
66 uint8_t dh
[DH_KEY_LEN
];
71 int num_rend_services(void);
72 int rend_config_services(const or_options_t
*options
, int validate_only
);
73 int rend_service_load_all_keys(void);
74 void rend_services_add_filenames_to_lists(smartlist_t
*open_lst
,
75 smartlist_t
*stat_lst
);
76 void rend_services_introduce(void);
77 void rend_consider_services_upload(time_t now
);
78 void rend_hsdir_routers_changed(void);
79 void rend_consider_descriptor_republication(void);
81 void rend_service_intro_has_opened(origin_circuit_t
*circuit
);
82 int rend_service_intro_established(origin_circuit_t
*circuit
,
83 const uint8_t *request
,
85 void rend_service_rendezvous_has_opened(origin_circuit_t
*circuit
);
86 int rend_service_introduce(origin_circuit_t
*circuit
, const uint8_t *request
,
88 int rend_service_decrypt_intro(rend_intro_cell_t
*request
,
91 void rend_service_free_intro(rend_intro_cell_t
*request
);
92 rend_intro_cell_t
* rend_service_begin_parse_intro(const uint8_t *request
,
96 int rend_service_parse_intro_plaintext(rend_intro_cell_t
*intro
,
98 int rend_service_validate_intro_early(const rend_intro_cell_t
*intro
,
100 int rend_service_validate_intro_late(const rend_intro_cell_t
*intro
,
102 void rend_service_relaunch_rendezvous(origin_circuit_t
*oldcirc
);
103 int rend_service_set_connection_addr_port(edge_connection_t
*conn
,
104 origin_circuit_t
*circ
);
105 void rend_service_dump_stats(int severity
);
106 void rend_service_free_all(void);