signed_descriptor_st.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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-2018, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. #ifndef SIGNED_DESCRIPTOR_ST_H
  7. #define SIGNED_DESCRIPTOR_ST_H
  8. #include "feature/dirclient/download_status_st.h"
  9. /** Information need to cache an onion router's descriptor. */
  10. struct signed_descriptor_t {
  11. /** Pointer to the raw server descriptor, preceded by annotations. Not
  12. * necessarily NUL-terminated. If saved_location is SAVED_IN_CACHE, this
  13. * pointer is null. */
  14. char *signed_descriptor_body;
  15. /** Length of the annotations preceding the server descriptor. */
  16. size_t annotations_len;
  17. /** Length of the server descriptor. */
  18. size_t signed_descriptor_len;
  19. /** Digest of the server descriptor, computed as specified in
  20. * dir-spec.txt. */
  21. char signed_descriptor_digest[DIGEST_LEN];
  22. /** Identity digest of the router. */
  23. char identity_digest[DIGEST_LEN];
  24. /** Declared publication time of the descriptor. */
  25. time_t published_on;
  26. /** For routerdescs only: digest of the corresponding extrainfo. */
  27. char extra_info_digest[DIGEST_LEN];
  28. /** For routerdescs only: A SHA256-digest of the extrainfo (if any) */
  29. char extra_info_digest256[DIGEST256_LEN];
  30. /** Certificate for ed25519 signing key. */
  31. struct tor_cert_st *signing_key_cert;
  32. /** For routerdescs only: Status of downloading the corresponding
  33. * extrainfo. */
  34. download_status_t ei_dl_status;
  35. /** Where is the descriptor saved? */
  36. saved_location_t saved_location;
  37. /** If saved_location is SAVED_IN_CACHE or SAVED_IN_JOURNAL, the offset of
  38. * this descriptor in the corresponding file. */
  39. off_t saved_offset;
  40. /** What position is this descriptor within routerlist->routers or
  41. * routerlist->old_routers? -1 for none. */
  42. int routerlist_index;
  43. /** The valid-until time of the most recent consensus that listed this
  44. * descriptor. 0 for "never listed in a consensus, so far as we know." */
  45. time_t last_listed_as_valid_until;
  46. /* If true, we do not ever try to save this object in the cache. */
  47. unsigned int do_not_cache : 1;
  48. /* If true, this item is meant to represent an extrainfo. */
  49. unsigned int is_extrainfo : 1;
  50. /* If true, we got an extrainfo for this item, and the digest was right,
  51. * but it was incompatible. */
  52. unsigned int extrainfo_is_bogus : 1;
  53. /* If true, we are willing to transmit this item unencrypted. */
  54. unsigned int send_unencrypted : 1;
  55. };
  56. #endif