rendcommon.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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-2017, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. /**
  7. * \file rendcommon.h
  8. * \brief Header file for rendcommon.c.
  9. **/
  10. #ifndef TOR_RENDCOMMON_H
  11. #define TOR_RENDCOMMON_H
  12. typedef enum rend_intro_point_failure_t {
  13. INTRO_POINT_FAILURE_GENERIC = 0,
  14. INTRO_POINT_FAILURE_TIMEOUT = 1,
  15. INTRO_POINT_FAILURE_UNREACHABLE = 2,
  16. } rend_intro_point_failure_t;
  17. int rend_cmp_service_ids(const char *one, const char *two);
  18. void rend_process_relay_cell(circuit_t *circ, const crypt_path_t *layer_hint,
  19. int command, size_t length,
  20. const uint8_t *payload);
  21. void rend_service_descriptor_free_(rend_service_descriptor_t *desc);
  22. #define rend_service_descriptor_free(desc) \
  23. FREE_AND_NULL(rend_service_descriptor_t, rend_service_descriptor_free_, \
  24. (desc))
  25. int rend_get_service_id(crypto_pk_t *pk, char *out);
  26. void rend_encoded_v2_service_descriptor_free_(
  27. rend_encoded_v2_service_descriptor_t *desc);
  28. #define rend_encoded_v2_service_descriptor_free(desc) \
  29. FREE_AND_NULL(rend_encoded_v2_service_descriptor_t, \
  30. rend_encoded_v2_service_descriptor_free_, (desc))
  31. void rend_intro_point_free_(rend_intro_point_t *intro);
  32. #define rend_intro_point_free(intro) \
  33. FREE_AND_NULL(rend_intro_point_t, rend_intro_point_free_, (intro))
  34. int rend_valid_v2_service_id(const char *query);
  35. int rend_valid_descriptor_id(const char *query);
  36. int rend_valid_client_name(const char *client_name);
  37. int rend_encode_v2_descriptors(smartlist_t *descs_out,
  38. rend_service_descriptor_t *desc, time_t now,
  39. uint8_t period, rend_auth_type_t auth_type,
  40. crypto_pk_t *client_key,
  41. smartlist_t *client_cookies);
  42. int rend_compute_v2_desc_id(char *desc_id_out, const char *service_id,
  43. const char *descriptor_cookie,
  44. time_t now, uint8_t replica);
  45. void rend_get_descriptor_id_bytes(char *descriptor_id_out,
  46. const char *service_id,
  47. const char *secret_id_part);
  48. int hid_serv_get_responsible_directories(smartlist_t *responsible_dirs,
  49. const char *id);
  50. int rend_circuit_pk_digest_eq(const origin_circuit_t *ocirc,
  51. const uint8_t *digest);
  52. char *rend_auth_encode_cookie(const uint8_t *cookie_in,
  53. rend_auth_type_t auth_type);
  54. int rend_auth_decode_cookie(const char *cookie_in,
  55. uint8_t *cookie_out,
  56. rend_auth_type_t *auth_type_out,
  57. char **err_msg_out);
  58. int rend_allow_non_anonymous_connection(const or_options_t* options);
  59. int rend_non_anonymous_mode_enabled(const or_options_t *options);
  60. void assert_circ_anonymity_ok(const origin_circuit_t *circ,
  61. const or_options_t *options);
  62. #ifdef RENDCOMMON_PRIVATE
  63. STATIC int
  64. rend_desc_v2_is_parsable(rend_encoded_v2_service_descriptor_t *desc);
  65. #endif /* defined(RENDCOMMON_PRIVATE) */
  66. #endif /* !defined(TOR_RENDCOMMON_H) */