authcert.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* Copyright (c) 2001-2004, Roger Dingledine.
  2. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
  3. * Copyright (c) 2007-2018, The Tor Project, Inc. */
  4. /* See LICENSE for licensing information */
  5. /**
  6. * \file authcert.h
  7. * \brief Header file for authcert.c
  8. **/
  9. #ifndef TOR_AUTHCERT_H
  10. #define TOR_AUTHCERT_H
  11. #include "lib/testsupport/testsupport.h"
  12. int trusted_dirs_reload_certs(void);
  13. /*
  14. * Pass one of these as source to trusted_dirs_load_certs_from_string()
  15. * to indicate whence string originates; this controls error handling
  16. * behavior such as marking downloads as failed.
  17. */
  18. #define TRUSTED_DIRS_CERTS_SRC_SELF 0
  19. #define TRUSTED_DIRS_CERTS_SRC_FROM_STORE 1
  20. #define TRUSTED_DIRS_CERTS_SRC_DL_BY_ID_DIGEST 2
  21. #define TRUSTED_DIRS_CERTS_SRC_DL_BY_ID_SK_DIGEST 3
  22. #define TRUSTED_DIRS_CERTS_SRC_FROM_VOTE 4
  23. int trusted_dirs_load_certs_from_string(const char *contents, int source,
  24. int flush, const char *source_dir);
  25. void trusted_dirs_remove_old_certs(void);
  26. void trusted_dirs_flush_certs_to_disk(void);
  27. authority_cert_t *authority_cert_get_newest_by_id(const char *id_digest);
  28. authority_cert_t *authority_cert_get_by_sk_digest(const char *sk_digest);
  29. authority_cert_t *authority_cert_get_by_digests(const char *id_digest,
  30. const char *sk_digest);
  31. void authority_cert_get_all(smartlist_t *certs_out);
  32. void authority_cert_dl_failed(const char *id_digest,
  33. const char *signing_key_digest, int status);
  34. void authority_certs_fetch_missing(networkstatus_t *status, time_t now,
  35. const char *dir_hint);
  36. int authority_cert_dl_looks_uncertain(const char *id_digest);
  37. int authority_cert_is_blacklisted(const authority_cert_t *cert);
  38. void authority_cert_free_(authority_cert_t *cert);
  39. #define authority_cert_free(cert) \
  40. FREE_AND_NULL(authority_cert_t, authority_cert_free_, (cert))
  41. MOCK_DECL(smartlist_t *, list_authority_ids_with_downloads, (void));
  42. MOCK_DECL(download_status_t *, id_only_download_status_for_authority_id,
  43. (const char *digest));
  44. MOCK_DECL(smartlist_t *, list_sk_digests_for_authority_id,
  45. (const char *digest));
  46. MOCK_DECL(download_status_t *, download_status_for_authority_id_and_sk,
  47. (const char *id_digest, const char *sk_digest));
  48. void authcert_free_all(void);
  49. #endif