routerinfo_st.h 4.5 KB

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