routerinfo_st.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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 ROUTERINFO_ST_H
  7. #define ROUTERINFO_ST_H
  8. #include "or/signed_descriptor_st.h"
  9. struct curve25519_public_key_t;
  10. /** Information about another onion router in the network. */
  11. struct routerinfo_t {
  12. signed_descriptor_t cache_info;
  13. char *nickname; /**< Human-readable OR name. */
  14. uint32_t addr; /**< IPv4 address of OR, in host order. */
  15. uint16_t or_port; /**< Port for TLS connections. */
  16. uint16_t dir_port; /**< Port for HTTP directory connections. */
  17. /** A router's IPv6 address, if it has one. */
  18. /* XXXXX187 Actually these should probably be part of a list of addresses,
  19. * not just a special case. Use abstractions to access these; don't do it
  20. * directly. */
  21. tor_addr_t ipv6_addr;
  22. uint16_t ipv6_orport;
  23. crypto_pk_t *onion_pkey; /**< Public RSA key for onions. */
  24. crypto_pk_t *identity_pkey; /**< Public RSA key for signing. */
  25. /** Public curve25519 key for onions */
  26. struct curve25519_public_key_t *onion_curve25519_pkey;
  27. /** What's the earliest expiration time on all the certs in this
  28. * routerinfo? */
  29. time_t cert_expiration_time;
  30. char *platform; /**< What software/operating system is this OR using? */
  31. char *protocol_list; /**< Encoded list of subprotocol versions supported
  32. * by this OR */
  33. /* link info */
  34. uint32_t bandwidthrate; /**< How many bytes does this OR add to its token
  35. * bucket per second? */
  36. uint32_t bandwidthburst; /**< How large is this OR's token bucket? */
  37. /** How many bytes/s is this router known to handle? */
  38. uint32_t bandwidthcapacity;
  39. smartlist_t *exit_policy; /**< What streams will this OR permit
  40. * to exit on IPv4? NULL for 'reject *:*'. */
  41. /** What streams will this OR permit to exit on IPv6?
  42. * NULL for 'reject *:*' */
  43. struct short_policy_t *ipv6_exit_policy;
  44. long uptime; /**< How many seconds the router claims to have been up */
  45. smartlist_t *declared_family; /**< Nicknames of router which this router
  46. * claims are its family. */
  47. char *contact_info; /**< Declared contact info for this router. */
  48. unsigned int is_hibernating:1; /**< Whether the router claims to be
  49. * hibernating */
  50. unsigned int caches_extra_info:1; /**< Whether the router says it caches and
  51. * serves extrainfo documents. */
  52. unsigned int allow_single_hop_exits:1; /**< Whether the router says
  53. * it allows single hop exits. */
  54. unsigned int wants_to_be_hs_dir:1; /**< True iff this router claims to be
  55. * a hidden service directory. */
  56. unsigned int policy_is_reject_star:1; /**< True iff the exit policy for this
  57. * router rejects everything. */
  58. /** True if, after we have added this router, we should re-launch
  59. * tests for it. */
  60. unsigned int needs_retest_if_added:1;
  61. /** True iff this router included "tunnelled-dir-server" in its descriptor,
  62. * implying it accepts tunnelled directory requests, or it advertised
  63. * dir_port > 0. */
  64. unsigned int supports_tunnelled_dir_requests:1;
  65. /** Used during voting to indicate that we should not include an entry for
  66. * this routerinfo. Used only during voting. */
  67. unsigned int omit_from_vote:1;
  68. /** Flags to summarize the protocol versions for this routerinfo_t. */
  69. protover_summary_flags_t pv;
  70. /** Tor can use this router for general positions in circuits; we got it
  71. * from a directory server as usual, or we're an authority and a server
  72. * uploaded it. */
  73. #define ROUTER_PURPOSE_GENERAL 0
  74. /** Tor should avoid using this router for circuit-building: we got it
  75. * from a controller. If the controller wants to use it, it'll have to
  76. * ask for it by identity. */
  77. #define ROUTER_PURPOSE_CONTROLLER 1
  78. /** Tor should use this router only for bridge positions in circuits: we got
  79. * it via a directory request from the bridge itself, or a bridge
  80. * authority. */
  81. #define ROUTER_PURPOSE_BRIDGE 2
  82. /** Tor should not use this router; it was marked in cached-descriptors with
  83. * a purpose we didn't recognize. */
  84. #define ROUTER_PURPOSE_UNKNOWN 255
  85. /** In what way did we find out about this router? One of ROUTER_PURPOSE_*.
  86. * Routers of different purposes are kept segregated and used for different
  87. * things; see notes on ROUTER_PURPOSE_* macros above.
  88. */
  89. uint8_t purpose;
  90. };
  91. #endif