Back to index

tor  0.2.3.18-rc
rendcommon.h
Go to the documentation of this file.
00001 /* Copyright (c) 2001 Matej Pfajfar.
00002  * Copyright (c) 2001-2004, Roger Dingledine.
00003  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
00004  * Copyright (c) 2007-2012, The Tor Project, Inc. */
00005 /* See LICENSE for licensing information */
00006 
00012 #ifndef _TOR_RENDCOMMON_H
00013 #define _TOR_RENDCOMMON_H
00014 
00016 static INLINE void
00017 rend_data_free(rend_data_t *data)
00018 {
00019   tor_free(data);
00020 }
00021 
00022 int rend_cmp_service_ids(const char *one, const char *two);
00023 
00024 void rend_process_relay_cell(circuit_t *circ, const crypt_path_t *layer_hint,
00025                              int command, size_t length,
00026                              const uint8_t *payload);
00027 
00028 void rend_service_descriptor_free(rend_service_descriptor_t *desc);
00029 rend_service_descriptor_t *rend_parse_service_descriptor(const char *str,
00030                                                          size_t len);
00031 int rend_get_service_id(crypto_pk_t *pk, char *out);
00032 void rend_encoded_v2_service_descriptor_free(
00033                                rend_encoded_v2_service_descriptor_t *desc);
00034 void rend_intro_point_free(rend_intro_point_t *intro);
00035 
00036 void rend_cache_init(void);
00037 void rend_cache_clean(time_t now);
00038 void rend_cache_clean_v2_descs_as_dir(time_t now);
00039 void rend_cache_purge(void);
00040 void rend_cache_free_all(void);
00041 int rend_valid_service_id(const char *query);
00042 int rend_cache_lookup_desc(const char *query, int version, const char **desc,
00043                            size_t *desc_len);
00044 int rend_cache_lookup_entry(const char *query, int version,
00045                             rend_cache_entry_t **entry_out);
00046 int rend_cache_lookup_v2_desc_as_dir(const char *query, const char **desc);
00047 int rend_cache_store(const char *desc, size_t desc_len, int published,
00048                      const char *service_id);
00049 int rend_cache_store_v2_desc_as_client(const char *desc,
00050                                        const rend_data_t *rend_query);
00051 int rend_cache_store_v2_desc_as_dir(const char *desc);
00052 int rend_cache_size(void);
00053 int rend_encode_v2_descriptors(smartlist_t *descs_out,
00054                                rend_service_descriptor_t *desc, time_t now,
00055                                uint8_t period, rend_auth_type_t auth_type,
00056                                crypto_pk_t *client_key,
00057                                smartlist_t *client_cookies);
00058 int rend_compute_v2_desc_id(char *desc_id_out, const char *service_id,
00059                             const char *descriptor_cookie,
00060                             time_t now, uint8_t replica);
00061 int rend_id_is_in_interval(const char *a, const char *b, const char *c);
00062 void rend_get_descriptor_id_bytes(char *descriptor_id_out,
00063                                   const char *service_id,
00064                                   const char *secret_id_part);
00065 
00066 #endif
00067