9 #ifndef TOR_HS_SERVICE_H
10 #define TOR_HS_SERVICE_H
23 #include "trunnel/hs/cell_establish_intro.h"
30 #define HS_SERVICE_DEFAULT_VERSION HS_VERSION_THREE
34 #define HS_SERVICE_NEXT_UPLOAD_TIME_MIN (60 * 60)
36 #define HS_SERVICE_NEXT_UPLOAD_TIME_MAX (120 * 60)
257 uint32_t intro_dos_rate_per_sec;
258 uint32_t intro_dos_burst_per_sec;
293 size_t n_ob_subcreds;
343 #define hs_service_free(s) FREE_AND_NULL(hs_service_t, hs_service_free_, (s))
361 const uint8_t *payload,
364 const uint8_t *payload,
371 int max_streams_per_rdv_circuit,
372 int max_streams_close_circuit,
378 const uint8_t version,
394 #define service_authorized_client_free(c) \
395 FREE_AND_NULL(hs_service_authorized_client_t, \
396 service_authorized_client_free_, (c))
399 int hs_service_allow_non_anonymous_connection(
const or_options_t *options);
400 int hs_service_non_anonymous_mode_enabled(
const or_options_t *options);
401 int hs_service_reveal_startup_time(
const or_options_t *options);
403 #ifdef HS_SERVICE_PRIVATE
405 #ifdef TOR_UNIT_TESTS
407 STATIC unsigned int get_hs_service_map_size(
void);
408 STATIC int get_hs_service_staging_list_size(
void);
409 STATIC hs_service_ht *get_hs_service_map(
void);
427 #define service_intro_point_free(ip) \
428 FREE_AND_NULL(hs_service_intro_point_t, \
429 service_intro_point_free_, (ip))
463 #define service_descriptor_free(d) \
464 FREE_AND_NULL(hs_service_descriptor_t, \
465 service_descriptor_free_, (d))
475 int descriptor_changed);
Header for crypto_curve25519.c.
Header for crypto_ed25519.c.
Header file containing common data for the whole HS subsystem.
hs_service_add_ephemeral_status_t
#define HS_SERVICE_ADDR_LEN_BASE32
Header file for hs_descriptor.c.
Header file containing circuit and connection identifier data for the whole HS subsystem.
Header file for hs_intropoint.c.
STATIC void service_clear_config(hs_service_config_t *config)
STATIC void upload_descriptor_to_all(const hs_service_t *service, hs_service_descriptor_t *desc)
STATIC int service_authorized_client_config_equal(const hs_service_config_t *config1, const hs_service_config_t *config2)
STATIC const node_t * get_node_from_intro_point(const hs_service_intro_point_t *ip)
STATIC void service_desc_schedule_upload(hs_service_descriptor_t *desc, time_t now, int descriptor_changed)
STATIC void service_intro_point_remove(const hs_service_t *service, const hs_service_intro_point_t *ip)
STATIC hs_service_t * find_service(hs_service_ht *map, const ed25519_public_key_t *pk)
STATIC int register_service(hs_service_ht *map, hs_service_t *service)
STATIC hs_service_intro_point_t * service_intro_point_find(const hs_service_t *service, const ed25519_public_key_t *auth_key)
STATIC hs_service_intro_point_t * service_intro_point_new(const node_t *node)
STATIC void run_upload_descriptor_event(time_t now)
STATIC void build_all_descriptors(time_t now)
STATIC void get_objects_from_ident(const hs_ident_circuit_t *ident, hs_service_t **service, hs_service_intro_point_t **ip, hs_service_descriptor_t **desc)
STATIC int client_filename_is_valid(const char *filename)
STATIC void service_intro_point_free_(hs_service_intro_point_t *ip)
STATIC hs_service_descriptor_t * service_desc_find_by_intro(const hs_service_t *service, const hs_service_intro_point_t *ip)
STATIC unsigned int count_desc_circuit_established(const hs_service_descriptor_t *desc)
STATIC int intro_point_should_expire(const hs_service_intro_point_t *ip, time_t now)
STATIC void rotate_all_descriptors(time_t now)
STATIC int can_service_launch_intro_circuit(hs_service_t *service, time_t now)
STATIC void update_all_descriptors_intro_points(time_t now)
STATIC hs_service_descriptor_t * service_descriptor_new(void)
STATIC hs_service_authorized_client_t * parse_authorized_client(const char *client_key_str)
STATIC void remove_service(hs_service_ht *map, hs_service_t *service)
STATIC void service_descriptor_free_(hs_service_descriptor_t *desc)
STATIC void run_housekeeping_event(time_t now)
STATIC void service_intro_point_add(digest256map_t *map, hs_service_intro_point_t *ip)
STATIC int write_address_to_file(const hs_service_t *service, const char *fname_)
STATIC int service_desc_hsdirs_changed(const hs_service_t *service, const hs_service_descriptor_t *desc)
smartlist_t * hs_service_get_metrics_stores(void)
hs_service_add_ephemeral_status_t hs_service_add_ephemeral(ed25519_secret_key_t *sk, smartlist_t *ports, int max_streams_per_rdv_circuit, int max_streams_close_circuit, smartlist_t *auth_clients_v3, char **address_out)
void hs_service_stage_services(const smartlist_t *service_list)
void hs_service_circuit_cleanup_on_close(const circuit_t *circ)
void hs_service_init(void)
int hs_service_receive_introduce2(origin_circuit_t *circ, const uint8_t *payload, size_t payload_len)
hs_service_t * hs_service_find(const ed25519_public_key_t *ident_pk)
char * hs_service_lookup_current_desc(const ed25519_public_key_t *pk)
hs_service_authorized_client_t * parse_authorized_client_key(const char *key_str, int severity)
void hs_service_lists_fnames_for_sandbox(smartlist_t *file_list, smartlist_t *dir_list)
void hs_service_circuit_has_opened(origin_circuit_t *circ)
unsigned int hs_service_get_num_services(void)
void service_authorized_client_free_(hs_service_authorized_client_t *client)
@ HS_CIRCUIT_ID_PROTOCOL_NONE
@ HS_CIRCUIT_ID_PROTOCOL_HAPROXY
typedef HT_HEAD(hs_service_ht, hs_service_t) hs_service_ht
hs_circuit_id_protocol_t hs_service_exports_circuit_id(const ed25519_public_key_t *pk)
void hs_service_free_all(void)
hs_service_t * hs_service_new(const or_options_t *options)
void hs_service_dir_info_changed(void)
void hs_service_free_(hs_service_t *service)
int hs_service_del_ephemeral(const char *address)
int hs_service_get_version_from_key(const hs_service_t *service)
int hs_service_receive_intro_established(origin_circuit_t *circ, const uint8_t *payload, size_t payload_len)
void hs_service_run_scheduled_events(time_t now)
void hs_service_upload_desc_to_dir(const char *encoded_desc, const uint8_t version, const ed25519_public_key_t *identity_pk, const ed25519_public_key_t *blinded_pk, const routerstatus_t *hsdir_rs)
void hs_service_map_has_changed(void)
void hs_service_dump_stats(int severity)
int hs_service_set_conn_addr_port(const origin_circuit_t *circ, edge_connection_t *conn)
int hs_service_load_all_keys(void)
Header for lib/metrics/metrics_store.c.
Header file for replaycache.c.
curve25519_public_key_t client_pk
smartlist_t * ob_master_pubkeys
hs_circuit_id_protocol_t circuit_id_protocol
uint64_t max_streams_per_rdv_circuit
unsigned int is_single_onion
unsigned int dir_group_readable
unsigned int hs_version_explicitly_set
unsigned int max_streams_close_circuit
unsigned int is_ephemeral
unsigned int has_dos_defense_enabled
unsigned int num_intro_points
unsigned int allow_unknown_ports
curve25519_keypair_t auth_ephemeral_kp
smartlist_t * previous_hsdirs
unsigned int missing_intro_points
ed25519_keypair_t signing_kp
struct crypto_ope_t * ope_cipher
ed25519_keypair_t blinded_kp
uint8_t descriptor_cookie[HS_DESC_DESCRIPTOR_COOKIE_LEN]
hs_service_intropoints_t intro_points
unsigned int support_intro2_dos_defense
ed25519_keypair_t auth_key_kp
replaycache_t * replay_cache
curve25519_public_key_t onion_key
curve25519_keypair_t enc_key_kp
uint8_t legacy_key_digest[DIGEST_LEN]
uint64_t introduce2_count
unsigned int num_circuits_launched
time_t retry_period_started
unsigned int is_identify_key_offline
ed25519_secret_key_t identity_sk
ed25519_public_key_t identity_pk
time_t next_rotation_time
replaycache_t * replay_cache_rend_cookie
time_t intro_circ_retry_started_time
unsigned int num_intro_circ_launched
hs_service_descriptor_t * desc_current
char onion_address[HS_SERVICE_ADDR_LEN_BASE32+1]
hs_service_config_t config
HT_ENTRY(hs_service_t) hs_service_node
hs_service_descriptor_t * desc_next
hs_service_metrics_t metrics
#define MOCK_DECL(rv, funcname, arglist)