rendclient.c File Reference

Client code to access location-hidden services. More...

#include "or.h"

Defines

#define REND_HID_SERV_DIR_REQUERY_PERIOD   (15 * 60)

Functions

void rend_client_introcirc_has_opened (origin_circuit_t *circ)
static int rend_client_send_establish_rendezvous (origin_circuit_t *circ)
int rend_client_send_introduction (origin_circuit_t *introcirc, origin_circuit_t *rendcirc)
void rend_client_rendcirc_has_opened (origin_circuit_t *circ)
int rend_client_introduction_acked (origin_circuit_t *circ, const char *request, size_t request_len)
static time_t lookup_last_hid_serv_request (routerstatus_t *hs_dir, const char *desc_id_base32, time_t now, int set)
static void directory_clean_last_hid_serv_requests (void)
static int directory_get_from_hs_dir (const char *desc_id, const rend_data_t *rend_query)
void rend_client_refetch_v2_renddesc (const rend_data_t *rend_query)
int rend_client_remove_intro_point (extend_info_t *failed_intro, const rend_data_t *rend_query)
int rend_client_rendezvous_acked (origin_circuit_t *circ, const char *request, size_t request_len)
int rend_client_receive_rendezvous (origin_circuit_t *circ, const char *request, size_t request_len)
void rend_client_desc_trynow (const char *query)
extend_info_trend_client_get_random_intro (const rend_data_t *rend_query)
rend_service_authorization_trend_client_lookup_service_authorization (const char *onion_address)
static void rend_service_authorization_free (rend_service_authorization_t *auth)
static void rend_service_authorization_strmap_item_free (void *service_auth)
void rend_service_authorization_free_all (void)
int rend_parse_service_authorization (or_options_t *options, int validate_only)

Variables

static strmap_t * last_hid_serv_requests = NULL
static strmap_t * auth_hid_servs = NULL


Detailed Description

Client code to access location-hidden services.


Define Documentation

#define REND_HID_SERV_DIR_REQUERY_PERIOD   (15 * 60)

The period for which a hidden service directory cannot be queried for the same descriptor ID again.

Referenced by directory_clean_last_hid_serv_requests(), and directory_get_from_hs_dir().


Function Documentation

static void directory_clean_last_hid_serv_requests ( void   )  [static]

Clean the history of request times to hidden service directories, so that it does not contain requests older than REND_HID_SERV_DIR_REQUERY_PERIOD seconds any more.

References REND_HID_SERV_DIR_REQUERY_PERIOD, strmap_iter_done(), strmap_iter_get(), strmap_iter_init(), strmap_iter_next(), strmap_iter_next_rmv(), and tor_free.

Referenced by directory_get_from_hs_dir().

static int directory_get_from_hs_dir ( const char *  desc_id,
const rend_data_t rend_query 
) [static]

Determine the responsible hidden service directories for desc_id and fetch the descriptor belonging to that ID from one of them. Only send a request to hidden service directories that we did not try within the last REND_HID_SERV_DIR_REQUERY_PERIOD seconds; on success, return 1, in the case that no hidden service directory is left to ask for the descriptor, return 0, and in case of a failure -1. query is only passed for pretty log statements.

References rend_data_t::auth_type, base32_encode(), base64_encode(), rend_data_t::descriptor_cookie, DIGEST_LEN, DIR_PURPOSE_FETCH_RENDDESC_V2, directory_clean_last_hid_serv_requests(), directory_initiate_command_routerstatus_rend(), escaped_safe_str_client(), hid_serv_get_responsible_directories(), LD_BUG, LD_REND, lookup_last_hid_serv_request(), rend_data_t::onion_address, REND_DESC_COOKIE_LEN, REND_DESC_COOKIE_LEN_BASE64, REND_DESC_ID_V2_LEN_BASE32, REND_HID_SERV_DIR_REQUERY_PERIOD, router_get_by_digest(), ROUTER_PURPOSE_GENERAL, smartlist_choose(), smartlist_create(), smartlist_free(), and tor_assert.

Referenced by rend_client_refetch_v2_renddesc().

static time_t lookup_last_hid_serv_request ( routerstatus_t hs_dir,
const char *  desc_id_base32,
time_t  now,
int  set 
) [static]

Look up the last request time to hidden service directory hs_dir for descriptor ID desc_id_base32. If set is non-zero, assign the current time now and return that. Otherwise, return the most recent request time, or 0 if no such request has been sent before.

References base32_encode(), DIGEST_LEN, routerstatus_t::identity_digest, REND_DESC_ID_V2_LEN_BASE32, strmap_get_lc(), strmap_set(), tor_free, and tor_snprintf().

Referenced by directory_get_from_hs_dir().

void rend_client_desc_trynow ( const char *  query  ) 

extend_info_t* rend_client_get_random_intro ( const rend_data_t rend_query  ) 

void rend_client_introcirc_has_opened ( origin_circuit_t circ  ) 

Called when we've established a circuit to an introduction point: send the introduction request.

References origin_circuit_t::_base, CIRCUIT_PURPOSE_C_INTRODUCING, connection_ap_attach_pending(), origin_circuit_t::cpath, LD_REND, circuit_t::purpose, and tor_assert.

Referenced by circuit_has_opened().

int rend_client_introduction_acked ( origin_circuit_t circ,
const char *  request,
size_t  request_len 
)

rend_service_authorization_t* rend_client_lookup_service_authorization ( const char *  onion_address  ) 

Look up the client-side authorization for the hidden service with onion_address. Return NULL if no authorization is available for that address.

References strmap_get(), and tor_assert.

int rend_client_receive_rendezvous ( origin_circuit_t circ,
const char *  request,
size_t  request_len 
)

void rend_client_refetch_v2_renddesc ( const rend_data_t rend_query  ) 

Unless we already have a descriptor for rend_query with at least one (possibly) working introduction point in it, start a connection to a hidden service directory to fetch a v2 rendezvous service descriptor.

References rend_data_t::auth_type, crypto_rand_int(), rend_data_t::descriptor_cookie, DIGEST_LEN, directory_get_from_hs_dir(), get_options(), LD_REND, rend_data_t::onion_address, rend_cache_lookup_entry(), rend_client_desc_trynow(), rend_compute_v2_desc_id(), REND_NUMBER_OF_NON_CONSECUTIVE_REPLICAS, safe_str_client(), and tor_assert.

Referenced by circuit_get_open_circ_or_launch(), connection_about_to_close_connection(), and rend_client_remove_intro_point().

int rend_client_remove_intro_point ( extend_info_t failed_intro,
const rend_data_t rend_query 
)

void rend_client_rendcirc_has_opened ( origin_circuit_t circ  ) 

Called when a rendezvous circuit is open; sends a establish rendezvous circuit as appropriate.

References origin_circuit_t::_base, CIRCUIT_PURPOSE_C_ESTABLISH_REND, LD_REND, circuit_t::purpose, rend_client_send_establish_rendezvous(), and tor_assert.

Referenced by circuit_get_open_circ_or_launch(), and circuit_has_opened().

int rend_client_rendezvous_acked ( origin_circuit_t circ,
const char *  request,
size_t  request_len 
)

Called when we receive a RENDEZVOUS_ESTABLISHED cell; changes the state of the circuit to C_REND_READY.

References origin_circuit_t::_base, CIRCUIT_PURPOSE_C_ESTABLISH_REND, CIRCUIT_PURPOSE_C_REND_READY, connection_ap_attach_pending(), LD_PROTOCOL, LD_REND, circuit_t::purpose, and TO_CIRCUIT.

Referenced by rend_process_relay_cell().

static int rend_client_send_establish_rendezvous ( origin_circuit_t circ  )  [static]

int rend_client_send_introduction ( origin_circuit_t introcirc,
origin_circuit_t rendcirc 
)

int rend_parse_service_authorization ( or_options_t options,
int  validate_only 
)

static void rend_service_authorization_free ( rend_service_authorization_t auth  )  [static]

void rend_service_authorization_free_all ( void   ) 

Release all the storage held in auth_hid_servs.

References rend_service_authorization_strmap_item_free(), and strmap_free().

Referenced by rend_parse_service_authorization(), and tor_free_all().

static void rend_service_authorization_strmap_item_free ( void *  service_auth  )  [static]


Variable Documentation

strmap_t* auth_hid_servs = NULL [static]

Client-side authorizations for hidden services; map of onion address to rend_service_authorization_t*.

strmap_t* last_hid_serv_requests = NULL [static]

Contains the last request times to hidden service directories for certain queries; keys are strings consisting of base32-encoded hidden service directory identities and base32-encoded descriptor IDs; values are pointers to timestamps of the last requests.


Generated on Tue May 25 00:30:48 2010 for tor by  doxygen 1.5.6